FD.io VPP  v19.04.2-12-g66b1689
Vector Packet Processing
ip_unnumbered_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_IP_UNNUMBERED_CMDS_H__
17 #define __VOM_IP_UNNUMBERED_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/ip_unnumbered.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/interface.api.vapi.hpp>
24 #include <vapi/ip.api.vapi.hpp>
25 
26 namespace VOM {
27 namespace ip_unnumbered_cmds {
28 
29 /**
30 *A command class that configures the IP unnumbered
31 */
33  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_unnumbered>
34 {
35 public:
36  /**
37  * Constructor
38  */
39  config_cmd(HW::item<bool>& item, const handle_t& itf, const handle_t& l3_itf);
40 
41  /**
42  * Issue the command to VPP/HW
43  */
44  rc_t issue(connection& con);
45  /**
46  * convert to string format for debug purposes
47  */
48  std::string to_string() const;
49 
50  /**
51  * Comparison operator - only used for UT
52  */
53  bool operator==(const config_cmd& i) const;
54 
55 private:
56  /**
57  * Reference to the interface for which the address is required
58  */
59  const handle_t& m_itf;
60  /**
61  * Reference to the interface which has an address
62  */
63  const handle_t& m_l3_itf;
64 };
65 
66 /**
67  * A cmd class that Unconfigs L3 Config from an interface
68  */
70  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_unnumbered>
71 {
72 public:
73  /**
74  * Constructor
75  */
77  const handle_t& itf,
78  const handle_t& l3_itf);
79 
80  /**
81  * Issue the command to VPP/HW
82  */
83  rc_t issue(connection& con);
84  /**
85  * convert to string format for debug purposes
86  */
87  std::string to_string() const;
88 
89  /**
90  * Comparison operator - only used for UT
91  */
92  bool operator==(const unconfig_cmd& i) const;
93 
94 private:
95  /**
96  * Reference to the interface for which the address is required
97  */
98  const handle_t& m_itf;
99  /**
100  * Reference to the interface which has an address
101  */
102  const handle_t& m_l3_itf;
103 };
104 
105 /**
106  * A cmd class that Dumps all the IP unnumbered interfaces
107  */
108 class dump_cmd : public VOM::dump_cmd<vapi::Ip_unnumbered_dump>
109 {
110 public:
111  /**
112  * Constructor
113  */
114  dump_cmd() = default;
115 
116  /**
117  * Issue the command to VPP/HW
118  */
119  rc_t issue(connection& con);
120  /**
121  * convert to string format for debug purposes
122  */
123  std::string to_string() const;
124 
125  /**
126  * Comparison operator - only used for UT
127  */
128  bool operator==(const dump_cmd& i) const;
129 
130 private:
131  /**
132  * HW reutrn code
133  */
135 };
136 }; // namespace ip_unnumbered_cmds
137 }; // namespace VOM
138 
139 /*
140  * fd.io coding-style-patch-verification: ON
141  *
142  * Local Variables:
143  * eval: (c-set-style "mozilla")
144  * End:
145  */
146 
147 #endif
A command class that configures the IP unnumbered.
A cmd class that Dumps all the IP unnumbered interfaces.
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
config_cmd(HW::item< bool > &item, const handle_t &itf, const handle_t &l3_itf)
Constructor.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A cmd class that Unconfigs L3 Config from an interface.
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
rc_t issue(connection &con)
Issue the command to VPP/HW.
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
std::string to_string() const
convert to string format for debug purposes
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66