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_STATIC_CMDS_H__
17 #define __VOM_NAT_STATIC_CMDS_H__
19 #include "nat_static.hpp"
20 #include "vom/dump_cmd.hpp"
22 #include <vapi/nat.api.vapi.hpp>
23 #include <vapi/nat66.api.vapi.hpp>
26 namespace nat_static_cmds {
29 * A command class that creates NAT 44 static mapping
32 : public rpc_cmd<HW::item<bool>, vapi::Nat44_add_del_static_mapping>
38 create_44_cmd(HW::item<bool>& item,
40 const boost::asio::ip::address_v4& inside,
41 const boost::asio::ip::address_v4& outside);
44 * Issue the command to VPP/HW
46 rc_t issue(connection& con);
49 * convert to string format for debug purposes
51 std::string to_string() const;
54 * Comparison operator - only used for UT
56 bool operator==(const create_44_cmd& i) const;
59 route::table_id_t m_id;
60 const boost::asio::ip::address_v4 m_inside;
61 const boost::asio::ip::address_v4 m_outside;
65 * A cmd class that deletes a NAT 44 static mapping
68 : public rpc_cmd<HW::item<bool>, vapi::Nat44_add_del_static_mapping>
74 delete_44_cmd(HW::item<bool>& item,
76 const boost::asio::ip::address_v4& inside,
77 const boost::asio::ip::address_v4& outside);
80 * Issue the command to VPP/HW
82 rc_t issue(connection& con);
85 * convert to string format for debug purposes
87 std::string to_string() const;
90 * Comparison operator - only used for UT
92 bool operator==(const delete_44_cmd& i) const;
95 route::table_id_t m_id;
96 const boost::asio::ip::address_v4 m_inside;
97 const boost::asio::ip::address_v4 m_outside;
101 * A cmd class that Dumps all the nat_statics
103 class dump_44_cmd : public dump_cmd<vapi::Nat44_static_mapping_dump>
109 dump_44_cmd() = default;
110 ~dump_44_cmd() = default;
113 * Issue the command to VPP/HW
115 rc_t issue(connection& con);
117 * convert to string format for debug purposes
119 std::string to_string() const;
122 * Comparison operator - only used for UT
124 bool operator==(const dump_44_cmd& i) const;
134 * A command class that creates NAT 66 static mapping
137 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_static_mapping>
143 create_66_cmd(HW::item<bool>& item,
144 route::table_id_t id,
145 const boost::asio::ip::address_v6& inside,
146 const boost::asio::ip::address_v6& outside);
149 * Issue the command to VPP/HW
151 rc_t issue(connection& con);
154 * convert to string format for debug purposes
156 std::string to_string() const;
159 * Comparison operator - only used for UT
161 bool operator==(const create_66_cmd& i) const;
164 route::table_id_t m_id;
165 const boost::asio::ip::address_v6 m_inside;
166 const boost::asio::ip::address_v6 m_outside;
170 * A cmd class that deletes a NAT 66 static mapping
173 : public rpc_cmd<HW::item<bool>, vapi::Nat66_add_del_static_mapping>
179 delete_66_cmd(HW::item<bool>& item,
180 route::table_id_t id,
181 const boost::asio::ip::address_v6& inside,
182 const boost::asio::ip::address_v6& outside);
185 * Issue the command to VPP/HW
187 rc_t issue(connection& con);
190 * convert to string format for debug purposes
192 std::string to_string() const;
195 * Comparison operator - only used for UT
197 bool operator==(const delete_66_cmd& i) const;
200 route::table_id_t m_id;
201 const boost::asio::ip::address_v6 m_inside;
202 const boost::asio::ip::address_v6 m_outside;
206 * A cmd class that Dumps all the nat_statics
208 class dump_66_cmd : public dump_cmd<vapi::Nat66_static_mapping_dump>
214 dump_66_cmd() = default;
215 ~dump_66_cmd() = default;
218 * Issue the command to VPP/HW
220 rc_t issue(connection& con);
222 * convert to string format for debug purposes
224 std::string to_string() const;
227 * Comparison operator - only used for UT
229 bool operator==(const dump_66_cmd& i) const;
238 }; // namespace nat_static_cmds
242 * fd.io coding-style-patch-verification: OFF
245 * eval: (c-set-style "mozilla")