FD.io VPP  v21.01.1
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  */
45  rc_t issue(connection& con);
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  */
85  rc_t issue(connection& con);
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  */
125  rc_t issue(connection& con);
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  */
165  rc_t issue(connection& con);
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  */
203  rc_t issue(connection& con);
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  */
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  */
237  rc_t issue(connection& con);
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  */
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  */
273  rc_t issue(connection& con);
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  */
313  rc_t issue(connection& con);
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  */
351  rc_t issue(connection& con);
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  */
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
A cmd class that Dumps all the nat_statics.
A cmd class that unbinds a NAT configuration from an input interface.
const char *const string
Definition: cJSON.h:172
A functor class that binds a NAT configuration to an output interface.
A cmd class that unbinds a NAT configuration from an input interface.
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
std::string to_string() const
convert to string format for debug purposes
A representation of the connection to VPP.
Definition: connection.hpp:33
A cmd class that Dumps all the nat_statics.
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
A functor class that binds a NAT configuration to an input interface.
A functor class that binds a NAT configuration to an input interface.
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
bind_44_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
bool operator==(const bind_44_input_cmd &i) const
Comparison operator - only used for UT.
A cmd class that Dumps all the nat_statics.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that unbinds a NAT configuration from an output interface.
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