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>
24 #include <vapi/nat66.api.vapi.hpp>
27 namespace nat_binding_cmds {
29 * A functor class that binds a NAT configuration to an input interface
31 class bind_44_input_cmd
32 : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_feature>
38 bind_44_input_cmd(HW::item<bool>& item,
40 const nat_binding::zone_t& zone);
43 * Issue the command to VPP/HW
45 rc_t issue(connection& con);
47 * convert to string format for debug purposes
49 std::string to_string() const;
52 * Comparison operator - only used for UT
54 bool operator==(const bind_44_input_cmd& i) const;
58 * The interface to bind
63 * The zone the interface is in
65 const nat_binding::zone_t m_zone;
69 * A cmd class that unbinds a NAT configuration from an input interface
71 class unbind_44_input_cmd
72 : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_feature>
78 unbind_44_input_cmd(HW::item<bool>& item,
80 const nat_binding::zone_t& zone);
83 * Issue the command to VPP/HW
85 rc_t issue(connection& con);
87 * convert to string format for debug purposes
89 std::string to_string() const;
92 * Comparison operator - only used for UT
94 bool operator==(const unbind_44_input_cmd& i) const;
98 * The interface to bind
100 const handle_t m_itf;
103 * The zone the interface is in
105 const nat_binding::zone_t m_zone;
109 * A functor class that binds a NAT configuration to an output interface
111 class bind_44_output_cmd
112 : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_output_feature>
118 bind_44_output_cmd(HW::item<bool>& item,
120 const nat_binding::zone_t& zone);
123 * Issue the command to VPP/HW
125 rc_t issue(connection& con);
127 * convert to string format for debug purposes
129 std::string to_string() const;
132 * Comparison operator - only used for UT
134 bool operator==(const bind_44_output_cmd& i) const;
138 * The interface to bind
140 const handle_t m_itf;
143 * The zone the interface is in
145 const nat_binding::zone_t m_zone;
149 * A cmd class that unbinds a NAT configuration from an output interface
151 class unbind_44_output_cmd
152 : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_output_feature>
158 unbind_44_output_cmd(HW::item<bool>& item,
160 const nat_binding::zone_t& zone);
163 * Issue the command to VPP/HW
165 rc_t issue(connection& con);
167 * convert to string format for debug purposes
169 std::string to_string() const;
172 * Comparison operator - only used for UT
174 bool operator==(const unbind_44_output_cmd& i) const;
178 * The interface to bind
180 const handle_t m_itf;
183 * The zone the interface is in
185 const nat_binding::zone_t m_zone;
189 * A cmd class that Dumps all the nat_statics
191 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
198 dump_input_44_cmd(const dump_input_44_cmd& d);
201 * Issue the command to VPP/HW
203 rc_t issue(connection& con);
205 * convert to string format for debug purposes
207 std::string to_string() const;
210 * Comparison operator - only used for UT
212 bool operator==(const dump_input_44_cmd& i) const;
222 * A cmd class that Dumps all the nat_statics
224 class dump_output_44_cmd
225 : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
231 dump_output_44_cmd();
232 dump_output_44_cmd(const dump_output_44_cmd& d);
235 * Issue the command to VPP/HW
237 rc_t issue(connection& con);
239 * convert to string format for debug purposes
241 std::string to_string() const;
244 * Comparison operator - only used for UT
246 bool operator==(const dump_output_44_cmd& i) const;
257 * A functor class that binds a NAT configuration to an input interface
259 class bind_66_input_cmd
260 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
266 bind_66_input_cmd(HW::item<bool>& item,
268 const nat_binding::zone_t& zone);
271 * Issue the command to VPP/HW
273 rc_t issue(connection& con);
275 * convert to string format for debug purposes
277 std::string to_string() const;
280 * Comparison operator - only used for UT
282 bool operator==(const bind_66_input_cmd& i) const;
286 * The interface to bind
288 const handle_t m_itf;
291 * The zone the interface is in
293 const nat_binding::zone_t m_zone;
297 * A cmd class that unbinds a NAT configuration from an input interface
299 class unbind_66_input_cmd
300 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
306 unbind_66_input_cmd(HW::item<bool>& item,
308 const nat_binding::zone_t& zone);
311 * Issue the command to VPP/HW
313 rc_t issue(connection& con);
315 * convert to string format for debug purposes
317 std::string to_string() const;
320 * Comparison operator - only used for UT
322 bool operator==(const unbind_66_input_cmd& i) const;
326 * The interface to bind
328 const handle_t m_itf;
331 * The zone the interface is in
333 const nat_binding::zone_t m_zone;
337 * A cmd class that Dumps all the nat_statics
339 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
346 dump_input_66_cmd(const dump_input_66_cmd& d);
349 * Issue the command to VPP/HW
351 rc_t issue(connection& con);
353 * convert to string format for debug purposes
355 std::string to_string() const;
358 * Comparison operator - only used for UT
360 bool operator==(const dump_input_66_cmd& i) const;
369 }; // namespace nat_binding_cmds
373 * fd.io coding-style-patch-verification: ON
376 * eval: (c-set-style "mozilla")