GBP V2
[vpp.git] / src / vpp-api / vom / nat_binding_cmds.hpp
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  */
30 class bind_44_input_cmd
31   : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
32 {
33 public:
34   /**
35    * Constructor
36    */
37   bind_44_input_cmd(HW::item<bool>& item,
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  */
70 class unbind_44_input_cmd
71   : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
72 {
73 public:
74   /**
75    * Constructor
76    */
77   unbind_44_input_cmd(HW::item<bool>& item,
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  */
110 class bind_44_output_cmd
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    */
119   bind_44_output_cmd(HW::item<bool>& item,
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  */
152 class unbind_44_output_cmd
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    */
161   unbind_44_output_cmd(HW::item<bool>& item,
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    */
200   dump_input_44_cmd();
201   dump_input_44_cmd(const dump_input_44_cmd& d);
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    */
221   HW::item<bool> item;
222 };
223
224 /**
225  * A cmd class that Dumps all the nat_statics
226  */
227 class dump_output_44_cmd
228   : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
229 {
230 public:
231   /**
232    * Constructor
233    */
234   dump_output_44_cmd();
235   dump_output_44_cmd(const dump_output_44_cmd& d);
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    */
255   HW::item<bool> item;
256 };
257
258 /////
259 /**
260 * A functor class that binds a NAT configuration to an input interface
261 */
262 class bind_66_input_cmd
263   : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
264 {
265 public:
266   /**
267    * Constructor
268    */
269   bind_66_input_cmd(HW::item<bool>& item,
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  */
302 class unbind_66_input_cmd
303   : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
304 {
305 public:
306   /**
307    * Constructor
308    */
309   unbind_66_input_cmd(HW::item<bool>& item,
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 functor class that binds a NAT configuration to an output interface
341  */
342 /* class bind_66_output_cmd */
343 /*   : public rpc_cmd<HW::item<bool>, */
344 /*                    rc_t, */
345 /*                    vapi::Nat66_interface_add_del_output_feature> */
346 /* { */
347 /* public: */
348 /*   /\** */
349 /*    * Constructor */
350 /*    *\/ */
351 /*   bind_66_output_cmd(HW::item<bool>& item, */
352 /*                      const handle_t& itf, */
353 /*                      const nat_binding::zone_t& zone); */
354
355 /*   /\** */
356 /*    * Issue the command to VPP/HW */
357 /*    *\/ */
358 /*   rc_t issue(connection& con); */
359 /*   /\** */
360 /*    * convert to string format for debug purposes */
361 /*    *\/ */
362 /*   std::string to_string() const; */
363
364 /*   /\** */
365 /*    * Comparison operator - only used for UT */
366 /*    *\/ */
367 /*   bool operator==(const bind_66_output_cmd& i) const; */
368
369 /* private: */
370 /*   /\** */
371 /*    * The interface to bind */
372 /*    *\/ */
373 /*   const handle_t m_itf; */
374
375 /*   /\** */
376 /*    * The zone the interface is in */
377 /*    *\/ */
378 /*   const nat_binding::zone_t m_zone; */
379 /* }; */
380
381 /* /\** */
382 /*  * A cmd class that unbinds a NAT configuration from an output interface */
383 /*  *\/ */
384 /* class unbind_66_output_cmd */
385 /*   : public rpc_cmd<HW::item<bool>, */
386 /*                    rc_t, */
387 /*                    vapi::Nat66_interface_add_del_output_feature> */
388 /* { */
389 /* public: */
390 /*   /\** */
391 /*    * Constructor */
392 /*    *\/ */
393 /*   unbind_66_output_cmd(HW::item<bool>& item, */
394 /*                        const handle_t& itf, */
395 /*                        const nat_binding::zone_t& zone); */
396
397 /*   /\** */
398 /*    * Issue the command to VPP/HW */
399 /*    *\/ */
400 /*   rc_t issue(connection& con); */
401 /*   /\** */
402 /*    * convert to string format for debug purposes */
403 /*    *\/ */
404 /*   std::string to_string() const; */
405
406 /*   /\** */
407 /*    * Comparison operator - only used for UT */
408 /*    *\/ */
409 /*   bool operator==(const unbind_66_output_cmd& i) const; */
410
411 /* private: */
412 /*   /\** */
413 /*    * The interface to bind */
414 /*    *\/ */
415 /*   const handle_t m_itf; */
416
417 /*   /\** */
418 /*    * The zone the interface is in */
419 /*    *\/ */
420 /*   const nat_binding::zone_t m_zone; */
421 /* }; */
422
423 /**
424  * A cmd class that Dumps all the nat_statics
425  */
426 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
427 {
428 public:
429   /**
430    * Constructor
431    */
432   dump_input_66_cmd();
433   dump_input_66_cmd(const dump_input_66_cmd& d);
434
435   /**
436    * Issue the command to VPP/HW
437    */
438   rc_t issue(connection& con);
439   /**
440    * convert to string format for debug purposes
441    */
442   std::string to_string() const;
443
444   /**
445    * Comparison operator - only used for UT
446    */
447   bool operator==(const dump_input_66_cmd& i) const;
448
449 private:
450   /**
451    * HW reutrn code
452    */
453   HW::item<bool> item;
454 };
455
456 /**
457  * A cmd class that Dumps all the nat_statics
458  */
459 /* class dump_output_66_cmd */
460 /*   : public dump_cmd<vapi::Nat66_interface_output_feature_dump> */
461 /* { */
462 /* public: */
463 /*   /\** */
464 /*    * Constructor */
465 /*    *\/ */
466 /*   dump_output_66_cmd(); */
467 /*   dump_output_66_cmd(const dump_output_66_cmd& d); */
468
469 /*   /\** */
470 /*    * Issue the command to VPP/HW */
471 /*    *\/ */
472 /*   rc_t issue(connection& con); */
473 /*   /\** */
474 /*    * convert to string format for debug purposes */
475 /*    *\/ */
476 /*   std::string to_string() const; */
477
478 /*   /\** */
479 /*    * Comparison operator - only used for UT */
480 /*    *\/ */
481 /*   bool operator==(const dump_output_66_cmd& i) const; */
482
483 /* private: */
484 /*   /\** */
485 /*    * HW reutrn code */
486 /*    *\/ */
487 /*   HW::item<bool> item; */
488 /* }; */
489
490 }; // namespace nat_binding_cmds
491 }; // namespace VOM
492
493 /*
494  * fd.io coding-style-patch-verification: ON
495  *
496  * Local Variables:
497  * eval: (c-set-style "mozilla")
498  * End:
499  */
500
501 #endif