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>, 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>, 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>, vapi::Nat44_interface_add_del_output_feature>
117 bind_44_output_cmd(HW::item<bool>& item,
119 const nat_binding::zone_t& zone);
122 * Issue the command to VPP/HW
124 rc_t issue(connection& con);
126 * convert to string format for debug purposes
128 std::string to_string() const;
131 * Comparison operator - only used for UT
133 bool operator==(const bind_44_output_cmd& i) const;
137 * The interface to bind
139 const handle_t m_itf;
142 * The zone the interface is in
144 const nat_binding::zone_t m_zone;
148 * A cmd class that unbinds a NAT configuration from an output interface
150 class unbind_44_output_cmd
151 : public rpc_cmd<HW::item<bool>, vapi::Nat44_interface_add_del_output_feature>
157 unbind_44_output_cmd(HW::item<bool>& item,
159 const nat_binding::zone_t& zone);
162 * Issue the command to VPP/HW
164 rc_t issue(connection& con);
166 * convert to string format for debug purposes
168 std::string to_string() const;
171 * Comparison operator - only used for UT
173 bool operator==(const unbind_44_output_cmd& i) const;
177 * The interface to bind
179 const handle_t m_itf;
182 * The zone the interface is in
184 const nat_binding::zone_t m_zone;
188 * A cmd class that Dumps all the nat_statics
190 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
197 dump_input_44_cmd(const dump_input_44_cmd& d);
200 * Issue the command to VPP/HW
202 rc_t issue(connection& con);
204 * convert to string format for debug purposes
206 std::string to_string() const;
209 * Comparison operator - only used for UT
211 bool operator==(const dump_input_44_cmd& i) const;
221 * A cmd class that Dumps all the nat_statics
223 class dump_output_44_cmd
224 : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
230 dump_output_44_cmd();
231 dump_output_44_cmd(const dump_output_44_cmd& d);
234 * Issue the command to VPP/HW
236 rc_t issue(connection& con);
238 * convert to string format for debug purposes
240 std::string to_string() const;
243 * Comparison operator - only used for UT
245 bool operator==(const dump_output_44_cmd& i) const;
256 * A functor class that binds a NAT configuration to an input interface
258 class bind_66_input_cmd
259 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
265 bind_66_input_cmd(HW::item<bool>& item,
267 const nat_binding::zone_t& zone);
270 * Issue the command to VPP/HW
272 rc_t issue(connection& con);
274 * convert to string format for debug purposes
276 std::string to_string() const;
279 * Comparison operator - only used for UT
281 bool operator==(const bind_66_input_cmd& i) const;
285 * The interface to bind
287 const handle_t m_itf;
290 * The zone the interface is in
292 const nat_binding::zone_t m_zone;
296 * A cmd class that unbinds a NAT configuration from an input interface
298 class unbind_66_input_cmd
299 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_interface>
305 unbind_66_input_cmd(HW::item<bool>& item,
307 const nat_binding::zone_t& zone);
310 * Issue the command to VPP/HW
312 rc_t issue(connection& con);
314 * convert to string format for debug purposes
316 std::string to_string() const;
319 * Comparison operator - only used for UT
321 bool operator==(const unbind_66_input_cmd& i) const;
325 * The interface to bind
327 const handle_t m_itf;
330 * The zone the interface is in
332 const nat_binding::zone_t m_zone;
336 * A cmd class that Dumps all the nat_statics
338 class dump_input_66_cmd : public dump_cmd<vapi::Nat66_interface_dump>
345 dump_input_66_cmd(const dump_input_66_cmd& d);
348 * Issue the command to VPP/HW
350 rc_t issue(connection& con);
352 * convert to string format for debug purposes
354 std::string to_string() const;
357 * Comparison operator - only used for UT
359 bool operator==(const dump_input_66_cmd& i) const;
368 }; // namespace nat_binding_cmds
372 * fd.io coding-style-patch-verification: ON
375 * eval: (c-set-style "mozilla")