blob: bb9404872ebc1b5b85cbc5fa31f1195bc7b70ebc [file] [log] [blame]
Neale Ranns041fa502017-12-20 08:49:51 -08001/*
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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070016#ifndef __VOM_NAT_BINDING_CMDS_H__
17#define __VOM_NAT_BINDING_CMDS_H__
18
Neale Ranns041fa502017-12-20 08:49:51 -080019#include "vom/dump_cmd.hpp"
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070020#include "vom/nat_binding.hpp"
21#include "vom/rpc_cmd.hpp"
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070022
23#include <vapi/nat.api.vapi.hpp>
24
25namespace VOM {
26namespace nat_binding_cmds {
27/**
Neale Ranns041fa502017-12-20 08:49:51 -080028 * A functor class that binds a NAT configuration to an input interface
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070029 */
30class bind_44_input_cmd
Neale Ranns041fa502017-12-20 08:49:51 -080031 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070032{
33public:
Neale Ranns041fa502017-12-20 08:49:51 -080034 /**
35 * Constructor
36 */
37 bind_44_input_cmd(HW::item<bool>& item,
38 const handle_t& itf,
39 const nat_binding::zone_t& zone);
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070040
Neale Ranns041fa502017-12-20 08:49:51 -080041 /**
42 * Issue the command to VPP/HW
43 */
44 rc_t issue(connection& con);
45 /**
46 * convert to string format for debug purposes
47 */
48 std::string to_string() const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070049
Neale Ranns041fa502017-12-20 08:49:51 -080050 /**
51 * Comparison operator - only used for UT
52 */
53 bool operator==(const bind_44_input_cmd& i) const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070054
55private:
Neale Ranns041fa502017-12-20 08:49:51 -080056 /**
57 * The interface to bind
58 */
59 const handle_t m_itf;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070060
Neale Ranns041fa502017-12-20 08:49:51 -080061 /**
62 * The zone the interface is in
63 */
64 const nat_binding::zone_t m_zone;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070065};
66
67/**
Neale Ranns041fa502017-12-20 08:49:51 -080068 * A cmd class that unbinds a NAT configuration from an input interface
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070069 */
70class unbind_44_input_cmd
Neale Ranns041fa502017-12-20 08:49:51 -080071 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070072{
73public:
Neale Ranns041fa502017-12-20 08:49:51 -080074 /**
75 * Constructor
76 */
77 unbind_44_input_cmd(HW::item<bool>& item,
78 const handle_t& itf,
79 const nat_binding::zone_t& zone);
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070080
Neale Ranns041fa502017-12-20 08:49:51 -080081 /**
82 * Issue the command to VPP/HW
83 */
84 rc_t issue(connection& con);
85 /**
86 * convert to string format for debug purposes
87 */
88 std::string to_string() const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070089
Neale Ranns041fa502017-12-20 08:49:51 -080090 /**
91 * Comparison operator - only used for UT
92 */
93 bool operator==(const unbind_44_input_cmd& i) const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070094
95private:
Neale Ranns041fa502017-12-20 08:49:51 -080096 /**
97 * The interface to bind
98 */
99 const handle_t m_itf;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700100
Neale Ranns041fa502017-12-20 08:49:51 -0800101 /**
102 * The zone the interface is in
103 */
104 const nat_binding::zone_t m_zone;
105};
106
107/**
108 * A functor class that binds a NAT configuration to an output interface
109 */
110class bind_44_output_cmd
111 : public rpc_cmd<HW::item<bool>,
112 rc_t,
113 vapi::Nat44_interface_add_del_output_feature>
114{
115public:
116 /**
117 * Constructor
118 */
119 bind_44_output_cmd(HW::item<bool>& item,
120 const handle_t& itf,
121 const nat_binding::zone_t& zone);
122
123 /**
124 * Issue the command to VPP/HW
125 */
126 rc_t issue(connection& con);
127 /**
128 * convert to string format for debug purposes
129 */
130 std::string to_string() const;
131
132 /**
133 * Comparison operator - only used for UT
134 */
135 bool operator==(const bind_44_output_cmd& i) const;
136
137private:
138 /**
139 * The interface to bind
140 */
141 const handle_t m_itf;
142
143 /**
144 * The zone the interface is in
145 */
146 const nat_binding::zone_t m_zone;
147};
148
149/**
150 * A cmd class that unbinds a NAT configuration from an output interface
151 */
152class unbind_44_output_cmd
153 : public rpc_cmd<HW::item<bool>,
154 rc_t,
155 vapi::Nat44_interface_add_del_output_feature>
156{
157public:
158 /**
159 * Constructor
160 */
161 unbind_44_output_cmd(HW::item<bool>& item,
162 const handle_t& itf,
163 const nat_binding::zone_t& zone);
164
165 /**
166 * Issue the command to VPP/HW
167 */
168 rc_t issue(connection& con);
169 /**
170 * convert to string format for debug purposes
171 */
172 std::string to_string() const;
173
174 /**
175 * Comparison operator - only used for UT
176 */
177 bool operator==(const unbind_44_output_cmd& i) const;
178
179private:
180 /**
181 * The interface to bind
182 */
183 const handle_t m_itf;
184
185 /**
186 * The zone the interface is in
187 */
188 const nat_binding::zone_t m_zone;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700189};
190
191/**
192 * A cmd class that Dumps all the nat_statics
193 */
Neale Ranns041fa502017-12-20 08:49:51 -0800194class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700195{
196public:
Neale Ranns041fa502017-12-20 08:49:51 -0800197 /**
198 * Constructor
199 */
200 dump_input_44_cmd();
201 dump_input_44_cmd(const dump_input_44_cmd& d);
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700202
Neale Ranns041fa502017-12-20 08:49:51 -0800203 /**
204 * Issue the command to VPP/HW
205 */
206 rc_t issue(connection& con);
207 /**
208 * convert to string format for debug purposes
209 */
210 std::string to_string() const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700211
Neale Ranns041fa502017-12-20 08:49:51 -0800212 /**
213 * Comparison operator - only used for UT
214 */
215 bool operator==(const dump_input_44_cmd& i) const;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700216
217private:
Neale Ranns041fa502017-12-20 08:49:51 -0800218 /**
219 * HW reutrn code
220 */
221 HW::item<bool> item;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700222};
Neale Ranns041fa502017-12-20 08:49:51 -0800223
224/**
225 * A cmd class that Dumps all the nat_statics
226 */
227class dump_output_44_cmd
228 : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
229{
230public:
231 /**
232 * Constructor
233 */
234 dump_output_44_cmd();
235 dump_output_44_cmd(const dump_output_44_cmd& d);
236
237 /**
238 * Issue the command to VPP/HW
239 */
240 rc_t issue(connection& con);
241 /**
242 * convert to string format for debug purposes
243 */
244 std::string to_string() const;
245
246 /**
247 * Comparison operator - only used for UT
248 */
249 bool operator==(const dump_output_44_cmd& i) const;
250
251private:
252 /**
253 * HW reutrn code
254 */
255 HW::item<bool> item;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700256};
Neale Ranns041fa502017-12-20 08:49:51 -0800257
258}; // namespace nat_binding_cmds
259}; // namespace VOM
260
261/*
262 * fd.io coding-style-patch-verification: ON
263 *
264 * Local Variables:
265 * eval: (c-set-style "mozilla")
266 * End:
267 */
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700268
269#endif