FD.io VPP  v18.07-rc0-415-g6c78436
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 
25 namespace VOM {
26 namespace nat_binding_cmds {
27 /**
28  * A functor class that binds a NAT configuration to an input interface
29  */
31  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  const handle_t& itf,
39  const nat_binding::zone_t& zone);
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 bind_44_input_cmd& i) const;
54 
55 private:
56  /**
57  * The interface to bind
58  */
59  const handle_t m_itf;
60 
61  /**
62  * The zone the interface is in
63  */
64  const nat_binding::zone_t m_zone;
65 };
66 
67 /**
68  * A cmd class that unbinds a NAT configuration from an input interface
69  */
71  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
72 {
73 public:
74  /**
75  * Constructor
76  */
78  const handle_t& itf,
79  const nat_binding::zone_t& zone);
80 
81  /**
82  * Issue the command to VPP/HW
83  */
84  rc_t issue(connection& con);
85  /**
86  * convert to string format for debug purposes
87  */
88  std::string to_string() const;
89 
90  /**
91  * Comparison operator - only used for UT
92  */
93  bool operator==(const unbind_44_input_cmd& i) const;
94 
95 private:
96  /**
97  * The interface to bind
98  */
99  const handle_t m_itf;
100 
101  /**
102  * The zone the interface is in
103  */
104  const nat_binding::zone_t m_zone;
105 };
106 
107 /**
108  * A functor class that binds a NAT configuration to an output interface
109  */
111  : public rpc_cmd<HW::item<bool>,
112  rc_t,
113  vapi::Nat44_interface_add_del_output_feature>
114 {
115 public:
116  /**
117  * Constructor
118  */
120  const handle_t& itf,
121  const nat_binding::zone_t& zone);
122 
123  /**
124  * Issue the command to VPP/HW
125  */
126  rc_t issue(connection& con);
127  /**
128  * convert to string format for debug purposes
129  */
130  std::string to_string() const;
131 
132  /**
133  * Comparison operator - only used for UT
134  */
135  bool operator==(const bind_44_output_cmd& i) const;
136 
137 private:
138  /**
139  * The interface to bind
140  */
141  const handle_t m_itf;
142 
143  /**
144  * The zone the interface is in
145  */
146  const nat_binding::zone_t m_zone;
147 };
148 
149 /**
150  * A cmd class that unbinds a NAT configuration from an output interface
151  */
153  : public rpc_cmd<HW::item<bool>,
154  rc_t,
155  vapi::Nat44_interface_add_del_output_feature>
156 {
157 public:
158  /**
159  * Constructor
160  */
162  const handle_t& itf,
163  const nat_binding::zone_t& zone);
164 
165  /**
166  * Issue the command to VPP/HW
167  */
168  rc_t issue(connection& con);
169  /**
170  * convert to string format for debug purposes
171  */
172  std::string to_string() const;
173 
174  /**
175  * Comparison operator - only used for UT
176  */
177  bool operator==(const unbind_44_output_cmd& i) const;
178 
179 private:
180  /**
181  * The interface to bind
182  */
183  const handle_t m_itf;
184 
185  /**
186  * The zone the interface is in
187  */
188  const nat_binding::zone_t m_zone;
189 };
190 
191 /**
192  * A cmd class that Dumps all the nat_statics
193  */
194 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
195 {
196 public:
197  /**
198  * Constructor
199  */
202 
203  /**
204  * Issue the command to VPP/HW
205  */
206  rc_t issue(connection& con);
207  /**
208  * convert to string format for debug purposes
209  */
210  std::string to_string() const;
211 
212  /**
213  * Comparison operator - only used for UT
214  */
215  bool operator==(const dump_input_44_cmd& i) const;
216 
217 private:
218  /**
219  * HW reutrn code
220  */
222 };
223 
224 /**
225  * A cmd class that Dumps all the nat_statics
226  */
228  : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
229 {
230 public:
231  /**
232  * Constructor
233  */
236 
237  /**
238  * Issue the command to VPP/HW
239  */
240  rc_t issue(connection& con);
241  /**
242  * convert to string format for debug purposes
243  */
244  std::string to_string() const;
245 
246  /**
247  * Comparison operator - only used for UT
248  */
249  bool operator==(const dump_output_44_cmd& i) const;
250 
251 private:
252  /**
253  * HW reutrn code
254  */
256 };
257 
258 /////
259 /**
260 * A functor class that binds a NAT configuration to an input interface
261 */
263  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
264 {
265 public:
266  /**
267  * Constructor
268  */
270  const handle_t& itf,
271  const nat_binding::zone_t& zone);
272 
273  /**
274  * Issue the command to VPP/HW
275  */
276  rc_t issue(connection& con);
277  /**
278  * convert to string format for debug purposes
279  */
280  std::string to_string() const;
281 
282  /**
283  * Comparison operator - only used for UT
284  */
285  bool operator==(const bind_66_input_cmd& i) const;
286 
287 private:
288  /**
289  * The interface to bind
290  */
291  const handle_t m_itf;
292 
293  /**
294  * The zone the interface is in
295  */
296  const nat_binding::zone_t m_zone;
297 };
298 
299 /**
300  * A cmd class that unbinds a NAT configuration from an input interface
301  */
303  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
304 {
305 public:
306  /**
307  * Constructor
308  */
310  const handle_t& itf,
311  const nat_binding::zone_t& zone);
312 
313  /**
314  * Issue the command to VPP/HW
315  */
316  rc_t issue(connection& con);
317  /**
318  * convert to string format for debug purposes
319  */
320  std::string to_string() const;
321 
322  /**
323  * Comparison operator - only used for UT
324  */
325  bool operator==(const unbind_66_input_cmd& i) const;
326 
327 private:
328  /**
329  * The interface to bind
330  */
331  const handle_t m_itf;
332 
333  /**
334  * The zone the interface is in
335  */
336  const nat_binding::zone_t m_zone;
337 };
338 
339 /**
340  * A cmd class that Dumps all the nat_statics
341  */
342 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
343 {
344 public:
345  /**
346  * Constructor
347  */
350 
351  /**
352  * Issue the command to VPP/HW
353  */
354  rc_t issue(connection& con);
355  /**
356  * convert to string format for debug purposes
357  */
358  std::string to_string() const;
359 
360  /**
361  * Comparison operator - only used for UT
362  */
363  bool operator==(const dump_input_66_cmd& i) const;
364 
365 private:
366  /**
367  * HW reutrn code
368  */
370 };
371 
372 }; // namespace nat_binding_cmds
373 }; // namespace VOM
374 
375 /*
376  * fd.io coding-style-patch-verification: ON
377  *
378  * Local Variables:
379  * eval: (c-set-style "mozilla")
380  * End:
381  */
382 
383 #endif
A cmd class that Dumps all the nat_statics.
A cmd class that unbinds a NAT configuration from an input interface.
A functor class that binds a NAT configuration to an output interface.
int i
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:90
A representation of the connection to VPP.
Definition: connection.hpp:33
A cmd class that Dumps all the nat_statics.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:38
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:236
bind_44_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
A cmd class that Dumps all the nat_statics.
bool operator==(const bind_44_input_cmd &i) const
Comparison operator - only used for UT.
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
std::string to_string() const
convert to string format for debug purposes