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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __VOM_NAT_BINDING_CMDS_H__
17 #define __VOM_NAT_BINDING_CMDS_H__
19 #include "vom/dump_cmd.hpp"
20 #include "vom/nat_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
23 #include <vapi/nat.api.vapi.hpp>
26 namespace nat_binding_cmds {
28 * A functor class that binds a NAT configuration to an input interface
30 class bind_44_input_cmd
31 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
37 bind_44_input_cmd(HW::item<bool>& item,
39 const nat_binding::zone_t& zone);
42 * Issue the command to VPP/HW
44 rc_t issue(connection& con);
46 * convert to string format for debug purposes
48 std::string to_string() const;
51 * Comparison operator - only used for UT
53 bool operator==(const bind_44_input_cmd& i) const;
57 * The interface to bind
62 * The zone the interface is in
64 const nat_binding::zone_t m_zone;
68 * A cmd class that unbinds a NAT configuration from an input interface
70 class unbind_44_input_cmd
71 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
77 unbind_44_input_cmd(HW::item<bool>& item,
79 const nat_binding::zone_t& zone);
82 * Issue the command to VPP/HW
84 rc_t issue(connection& con);
86 * convert to string format for debug purposes
88 std::string to_string() const;
91 * Comparison operator - only used for UT
93 bool operator==(const unbind_44_input_cmd& i) const;
97 * The interface to bind
102 * The zone the interface is in
104 const nat_binding::zone_t m_zone;
108 * A functor class that binds a NAT configuration to an output interface
110 class bind_44_output_cmd
111 : public rpc_cmd<HW::item<bool>,
113 vapi::Nat44_interface_add_del_output_feature>
119 bind_44_output_cmd(HW::item<bool>& item,
121 const nat_binding::zone_t& zone);
124 * Issue the command to VPP/HW
126 rc_t issue(connection& con);
128 * convert to string format for debug purposes
130 std::string to_string() const;
133 * Comparison operator - only used for UT
135 bool operator==(const bind_44_output_cmd& i) const;
139 * The interface to bind
141 const handle_t m_itf;
144 * The zone the interface is in
146 const nat_binding::zone_t m_zone;
150 * A cmd class that unbinds a NAT configuration from an output interface
152 class unbind_44_output_cmd
153 : public rpc_cmd<HW::item<bool>,
155 vapi::Nat44_interface_add_del_output_feature>
161 unbind_44_output_cmd(HW::item<bool>& item,
163 const nat_binding::zone_t& zone);
166 * Issue the command to VPP/HW
168 rc_t issue(connection& con);
170 * convert to string format for debug purposes
172 std::string to_string() const;
175 * Comparison operator - only used for UT
177 bool operator==(const unbind_44_output_cmd& i) const;
181 * The interface to bind
183 const handle_t m_itf;
186 * The zone the interface is in
188 const nat_binding::zone_t m_zone;
192 * A cmd class that Dumps all the nat_statics
194 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
201 dump_input_44_cmd(const dump_input_44_cmd& d);
204 * Issue the command to VPP/HW
206 rc_t issue(connection& con);
208 * convert to string format for debug purposes
210 std::string to_string() const;
213 * Comparison operator - only used for UT
215 bool operator==(const dump_input_44_cmd& i) const;
225 * A cmd class that Dumps all the nat_statics
227 class dump_output_44_cmd
228 : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
234 dump_output_44_cmd();
235 dump_output_44_cmd(const dump_output_44_cmd& d);
238 * Issue the command to VPP/HW
240 rc_t issue(connection& con);
242 * convert to string format for debug purposes
244 std::string to_string() const;
247 * Comparison operator - only used for UT
249 bool operator==(const dump_output_44_cmd& i) const;
260 * A functor class that binds a NAT configuration to an input interface
262 class bind_66_input_cmd
263 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
269 bind_66_input_cmd(HW::item<bool>& item,
271 const nat_binding::zone_t& zone);
274 * Issue the command to VPP/HW
276 rc_t issue(connection& con);
278 * convert to string format for debug purposes
280 std::string to_string() const;
283 * Comparison operator - only used for UT
285 bool operator==(const bind_66_input_cmd& i) const;
289 * The interface to bind
291 const handle_t m_itf;
294 * The zone the interface is in
296 const nat_binding::zone_t m_zone;
300 * A cmd class that unbinds a NAT configuration from an input interface
302 class unbind_66_input_cmd
303 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat66_add_del_interface>
309 unbind_66_input_cmd(HW::item<bool>& item,
311 const nat_binding::zone_t& zone);
314 * Issue the command to VPP/HW
316 rc_t issue(connection& con);
318 * convert to string format for debug purposes
320 std::string to_string() const;
323 * Comparison operator - only used for UT
325 bool operator==(const unbind_66_input_cmd& i) const;
329 * The interface to bind
331 const handle_t m_itf;
334 * The zone the interface is in
336 const nat_binding::zone_t m_zone;
340 * A functor class that binds a NAT configuration to an output interface
342 /* class bind_66_output_cmd */
343 /* : public rpc_cmd<HW::item<bool>, */
345 /* vapi::Nat66_interface_add_del_output_feature> */
351 /* bind_66_output_cmd(HW::item<bool>& item, */
352 /* const handle_t& itf, */
353 /* const nat_binding::zone_t& zone); */
356 /* * Issue the command to VPP/HW */
358 /* rc_t issue(connection& con); */
360 /* * convert to string format for debug purposes */
362 /* std::string to_string() const; */
365 /* * Comparison operator - only used for UT */
367 /* bool operator==(const bind_66_output_cmd& i) const; */
371 /* * The interface to bind */
373 /* const handle_t m_itf; */
376 /* * The zone the interface is in */
378 /* const nat_binding::zone_t m_zone; */
382 /* * A cmd class that unbinds a NAT configuration from an output interface */
384 /* class unbind_66_output_cmd */
385 /* : public rpc_cmd<HW::item<bool>, */
387 /* vapi::Nat66_interface_add_del_output_feature> */
393 /* unbind_66_output_cmd(HW::item<bool>& item, */
394 /* const handle_t& itf, */
395 /* const nat_binding::zone_t& zone); */
398 /* * Issue the command to VPP/HW */
400 /* rc_t issue(connection& con); */
402 /* * convert to string format for debug purposes */
404 /* std::string to_string() const; */
407 /* * Comparison operator - only used for UT */
409 /* bool operator==(const unbind_66_output_cmd& i) const; */
413 /* * The interface to bind */
415 /* const handle_t m_itf; */
418 /* * The zone the interface is in */
420 /* const nat_binding::zone_t m_zone; */
424 * A cmd class that Dumps all the nat_statics
426 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
433 dump_input_66_cmd(const dump_input_66_cmd& d);
436 * Issue the command to VPP/HW
438 rc_t issue(connection& con);
440 * convert to string format for debug purposes
442 std::string to_string() const;
445 * Comparison operator - only used for UT
447 bool operator==(const dump_input_66_cmd& i) const;
457 * A cmd class that Dumps all the nat_statics
459 /* class dump_output_66_cmd */
460 /* : public dump_cmd<vapi::Nat66_interface_output_feature_dump> */
466 /* dump_output_66_cmd(); */
467 /* dump_output_66_cmd(const dump_output_66_cmd& d); */
470 /* * Issue the command to VPP/HW */
472 /* rc_t issue(connection& con); */
474 /* * convert to string format for debug purposes */
476 /* std::string to_string() const; */
479 /* * Comparison operator - only used for UT */
481 /* bool operator==(const dump_output_66_cmd& i) const; */
485 /* * HW reutrn code */
487 /* HW::item<bool> item; */
490 }; // namespace nat_binding_cmds
494 * fd.io coding-style-patch-verification: ON
497 * eval: (c-set-style "mozilla")