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;
258 }; // namespace nat_binding_cmds
262 * fd.io coding-style-patch-verification: ON
265 * eval: (c-set-style "mozilla")