FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
nat_binding_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_NAT_BINDING_CMDS_H__
17 #define __VOM_NAT_BINDING_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/nat_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/nat.api.vapi.hpp>
24 #include <vapi/nat66.api.vapi.hpp>
25 
26 namespace VOM {
27 namespace nat_binding_cmds {
28 /**
29  * A functor class that binds a NAT configuration to an input interface
30  */
32  : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_feature>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  const handle_t& itf,
40  const nat_binding::zone_t& zone);
41 
42  /**
43  * Issue the command to VPP/HW
44  */
46  /**
47  * convert to string format for debug purposes
48  */
49  std::string to_string() const;
50 
51  /**
52  * Comparison operator - only used for UT
53  */
54  bool operator==(const bind_44_input_cmd& i) const;
55 
56 private:
57  /**
58  * The interface to bind
59  */
60  const handle_t m_itf;
61 
62  /**
63  * The zone the interface is in
64  */
65  const nat_binding::zone_t m_zone;
66 };
67 
68 /**
69  * A cmd class that unbinds a NAT configuration from an input interface
70  */
72  : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_feature>
73 {
74 public:
75  /**
76  * Constructor
77  */
79  const handle_t& itf,
80  const nat_binding::zone_t& zone);
81 
82  /**
83  * Issue the command to VPP/HW
84  */
86  /**
87  * convert to string format for debug purposes
88  */
89  std::string to_string() const;
90 
91  /**
92  * Comparison operator - only used for UT
93  */
94  bool operator==(const unbind_44_input_cmd& i) const;
95 
96 private:
97  /**
98  * The interface to bind
99  */
100  const handle_t m_itf;
101 
102  /**
103  * The zone the interface is in
104  */
105  const nat_binding::zone_t m_zone;
106 };
107 
108 /**
109  * A functor class that binds a NAT configuration to an output interface
110  */
112  : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_output_feature>
113 {
114 public:
115  /**
116  * Constructor
117  */
119  const handle_t& itf,
120  const nat_binding::zone_t& zone);
121 
122  /**
123  * Issue the command to VPP/HW
124  */
126  /**
127  * convert to string format for debug purposes
128  */
129  std::string to_string() const;
130 
131  /**
132  * Comparison operator - only used for UT
133  */
134  bool operator==(const bind_44_output_cmd& i) const;
135 
136 private:
137  /**
138  * The interface to bind
139  */
140  const handle_t m_itf;
141 
142  /**
143  * The zone the interface is in
144  */
145  const nat_binding::zone_t m_zone;
146 };
147 
148 /**
149  * A cmd class that unbinds a NAT configuration from an output interface
150  */
152  : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_output_feature>
153 {
154 public:
155  /**
156  * Constructor
157  */
159  const handle_t& itf,
160  const nat_binding::zone_t& zone);
161 
162  /**
163  * Issue the command to VPP/HW
164  */
166  /**
167  * convert to string format for debug purposes
168  */
169  std::string to_string() const;
170 
171  /**
172  * Comparison operator - only used for UT
173  */
174  bool operator==(const unbind_44_output_cmd& i) const;
175 
176 private:
177  /**
178  * The interface to bind
179  */
180  const handle_t m_itf;
181 
182  /**
183  * The zone the interface is in
184  */
185  const nat_binding::zone_t m_zone;
186 };
187 
188 /**
189  * A cmd class that Dumps all the nat_statics
190  */
191 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
192 {
193 public:
194  /**
195  * Constructor
196  */
199 
200  /**
201  * Issue the command to VPP/HW
202  */
204  /**
205  * convert to string format for debug purposes
206  */
207  std::string to_string() const;
208 
209  /**
210  * Comparison operator - only used for UT
211  */
212  bool operator==(const dump_input_44_cmd& i) const;
213 
214 private:
215  /**
216  * HW reutrn code
217  */
218  HW::item<bool> item;
219 };
220 
221 /**
222  * A cmd class that Dumps all the nat_statics
223  */
225  : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
226 {
227 public:
228  /**
229  * Constructor
230  */
233 
234  /**
235  * Issue the command to VPP/HW
236  */
238  /**
239  * convert to string format for debug purposes
240  */
241  std::string to_string() const;
242 
243  /**
244  * Comparison operator - only used for UT
245  */
246  bool operator==(const dump_output_44_cmd& i) const;
247 
248 private:
249  /**
250  * HW reutrn code
251  */
252  HW::item<bool> item;
253 };
254 
255 /////
256 /**
257  * A functor class that binds a NAT configuration to an input interface
258  */
260  : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
261 {
262 public:
263  /**
264  * Constructor
265  */
267  const handle_t& itf,
268  const nat_binding::zone_t& zone);
269 
270  /**
271  * Issue the command to VPP/HW
272  */
274  /**
275  * convert to string format for debug purposes
276  */
277  std::string to_string() const;
278 
279  /**
280  * Comparison operator - only used for UT
281  */
282  bool operator==(const bind_66_input_cmd& i) const;
283 
284 private:
285  /**
286  * The interface to bind
287  */
288  const handle_t m_itf;
289 
290  /**
291  * The zone the interface is in
292  */
293  const nat_binding::zone_t m_zone;
294 };
295 
296 /**
297  * A cmd class that unbinds a NAT configuration from an input interface
298  */
300  : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
301 {
302 public:
303  /**
304  * Constructor
305  */
307  const handle_t& itf,
308  const nat_binding::zone_t& zone);
309 
310  /**
311  * Issue the command to VPP/HW
312  */
314  /**
315  * convert to string format for debug purposes
316  */
317  std::string to_string() const;
318 
319  /**
320  * Comparison operator - only used for UT
321  */
322  bool operator==(const unbind_66_input_cmd& i) const;
323 
324 private:
325  /**
326  * The interface to bind
327  */
328  const handle_t m_itf;
329 
330  /**
331  * The zone the interface is in
332  */
333  const nat_binding::zone_t m_zone;
334 };
335 
336 /**
337  * A cmd class that Dumps all the nat_statics
338  */
339 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
340 {
341 public:
342  /**
343  * Constructor
344  */
347 
348  /**
349  * Issue the command to VPP/HW
350  */
352  /**
353  * convert to string format for debug purposes
354  */
355  std::string to_string() const;
356 
357  /**
358  * Comparison operator - only used for UT
359  */
360  bool operator==(const dump_input_66_cmd& i) const;
361 
362 private:
363  /**
364  * HW reutrn code
365  */
366  HW::item<bool> item;
367 };
368 
369 }; // namespace nat_binding_cmds
370 }; // namespace VOM
371 
372 /*
373  * fd.io coding-style-patch-verification: OFF
374  *
375  * Local Variables:
376  * eval: (c-set-style "mozilla")
377  * End:
378  */
379 
380 #endif
VOM::HW::item< bool >
VOM::nat_binding_cmds::dump_input_44_cmd
A cmd class that Dumps all the nat_statics.
Definition: nat_binding_cmds.hpp:191
VOM::nat_binding_cmds::unbind_66_input_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:307
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::nat_binding_cmds::dump_output_44_cmd::operator==
bool operator==(const dump_output_44_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:225
VOM::nat_binding_cmds::unbind_44_input_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:93
VOM::nat_binding_cmds::bind_44_input_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:36
VOM::nat_binding_cmds::bind_44_output_cmd::bind_44_output_cmd
bind_44_output_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:102
VOM::nat_binding_cmds::unbind_44_output_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:175
VOM::nat_binding_cmds::bind_66_input_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:264
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::nat_binding_cmds::bind_44_input_cmd::operator==
bool operator==(const bind_44_input_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:30
VOM::nat_binding_cmds::dump_input_44_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:199
VOM::nat_binding_cmds::unbind_44_output_cmd
A cmd class that unbinds a NAT configuration from an output interface.
Definition: nat_binding_cmds.hpp:151
VOM::nat_binding::zone_t
NAT Zoness.
Definition: nat_binding.hpp:36
VOM::nat_binding_cmds::unbind_44_input_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:77
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::nat_binding_cmds::bind_66_input_cmd::bind_66_input_cmd
bind_66_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:248
VOM::nat_binding_cmds::bind_44_input_cmd::bind_44_input_cmd
bind_44_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:20
VOM::nat_binding_cmds::bind_44_output_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:118
VOM::nat_binding_cmds::unbind_66_input_cmd::operator==
bool operator==(const unbind_66_input_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:301
VOM::nat_binding_cmds::dump_output_44_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:231
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::nat_binding_cmds::dump_output_44_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:243
VOM::nat_binding_cmds::unbind_66_input_cmd
A cmd class that unbinds a NAT configuration from an input interface.
Definition: nat_binding_cmds.hpp:299
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::nat_binding_cmds::bind_44_output_cmd
A functor class that binds a NAT configuration to an output interface.
Definition: nat_binding_cmds.hpp:111
VOM::nat_binding_cmds::dump_input_44_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:211
dump_cmd.hpp
VOM::nat_binding_cmds::unbind_66_input_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:325
VOM::nat_binding_cmds::bind_44_output_cmd::operator==
bool operator==(const bind_44_output_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:112
VOM::rpc_cmd< HW::item< bool >, vapi::Nat44_interface_add_del_feature >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::nat_binding_cmds::dump_input_44_cmd::operator==
bool operator==(const dump_input_44_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:193
VOM::nat_binding_cmds::unbind_44_input_cmd
A cmd class that unbinds a NAT configuration from an input interface.
Definition: nat_binding_cmds.hpp:71
VOM::nat_binding_cmds::unbind_44_input_cmd::unbind_44_input_cmd
unbind_44_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:61
VOM::nat_binding_cmds::dump_input_66_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:361
VOM::nat_binding_cmds::unbind_44_output_cmd::unbind_44_output_cmd
unbind_44_output_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:143
VOM::nat_binding_cmds::bind_44_input_cmd
A functor class that binds a NAT configuration to an input interface.
Definition: nat_binding_cmds.hpp:31
VOM::nat_binding_cmds::bind_66_input_cmd
A functor class that binds a NAT configuration to an input interface.
Definition: nat_binding_cmds.hpp:259
VOM::nat_binding_cmds::dump_input_66_cmd
A cmd class that Dumps all the nat_statics.
Definition: nat_binding_cmds.hpp:339
VOM::nat_binding_cmds::unbind_44_input_cmd::operator==
bool operator==(const unbind_44_input_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:71
VOM::nat_binding_cmds::dump_input_66_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:349
VOM::nat_binding_cmds::dump_input_66_cmd::operator==
bool operator==(const dump_input_66_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:343
VOM::nat_binding_cmds::unbind_44_output_cmd::operator==
bool operator==(const unbind_44_output_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:153
i
int i
Definition: flowhash_template.h:376
VOM::nat_binding_cmds::dump_input_44_cmd::dump_input_44_cmd
dump_input_44_cmd()
Constructor.
Definition: nat_binding_cmds.cpp:184
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::nat_binding_cmds::bind_44_input_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:52
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
VOM::nat_binding_cmds::unbind_66_input_cmd::unbind_66_input_cmd
unbind_66_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
Definition: nat_binding_cmds.cpp:291
VOM::nat_binding_cmds::bind_66_input_cmd::operator==
bool operator==(const bind_66_input_cmd &i) const
Comparison operator - only used for UT.
Definition: nat_binding_cmds.cpp:258
VOM::nat_binding_cmds::bind_66_input_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:282
VOM::nat_binding_cmds::dump_output_44_cmd
A cmd class that Dumps all the nat_statics.
Definition: nat_binding_cmds.hpp:224
VOM::nat_binding_cmds::dump_output_44_cmd::dump_output_44_cmd
dump_output_44_cmd()
Constructor.
Definition: nat_binding_cmds.cpp:216
rpc_cmd.hpp
VOM::nat_binding_cmds::bind_44_output_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: nat_binding_cmds.cpp:134
VOM::nat_binding_cmds::dump_input_66_cmd::dump_input_66_cmd
dump_input_66_cmd()
Constructor.
Definition: nat_binding_cmds.cpp:334
VOM::nat_binding_cmds::unbind_44_output_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: nat_binding_cmds.cpp:159
nat_binding.hpp
string
const char *const string
Definition: cJSON.h:172