FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
nat_binding_cmds.hpp
Go to the documentation of this file.
1 /*
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 
16 #ifndef __VOM_NAT_BINDING_CMDS_H__
17 #define __VOM_NAT_BINDING_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/nat_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/nat.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace nat_binding_cmds {
27 /**
28  * A functor class that binds a NAT configuration to an input interface
29  */
31  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  const handle_t& itf,
39  const nat_binding::zone_t& zone);
40 
41  /**
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;
49 
50  /**
51  * Comparison operator - only used for UT
52  */
53  bool operator==(const bind_44_input_cmd& i) const;
54 
55 private:
56  /**
57  * The interface to bind
58  */
59  const handle_t m_itf;
60 
61  /**
62  * The zone the interface is in
63  */
64  const nat_binding::zone_t m_zone;
65 };
66 
67 /**
68  * A cmd class that unbinds a NAT configuration from an input interface
69  */
71  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_interface_add_del_feature>
72 {
73 public:
74  /**
75  * Constructor
76  */
78  const handle_t& itf,
79  const nat_binding::zone_t& zone);
80 
81  /**
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;
89 
90  /**
91  * Comparison operator - only used for UT
92  */
93  bool operator==(const unbind_44_input_cmd& i) const;
94 
95 private:
96  /**
97  * The interface to bind
98  */
99  const handle_t m_itf;
100 
101  /**
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  */
111  : public rpc_cmd<HW::item<bool>,
112  rc_t,
113  vapi::Nat44_interface_add_del_output_feature>
114 {
115 public:
116  /**
117  * Constructor
118  */
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 
137 private:
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  */
153  : public rpc_cmd<HW::item<bool>,
154  rc_t,
155  vapi::Nat44_interface_add_del_output_feature>
156 {
157 public:
158  /**
159  * Constructor
160  */
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 
179 private:
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;
189 };
190 
191 /**
192  * A cmd class that Dumps all the nat_statics
193  */
194 class dump_input_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
195 {
196 public:
197  /**
198  * Constructor
199  */
202 
203  /**
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;
211 
212  /**
213  * Comparison operator - only used for UT
214  */
215  bool operator==(const dump_input_44_cmd& i) const;
216 
217 private:
218  /**
219  * HW reutrn code
220  */
222 };
223 
224 /**
225  * A cmd class that Dumps all the nat_statics
226  */
228  : public dump_cmd<vapi::Nat44_interface_output_feature_dump>
229 {
230 public:
231  /**
232  * Constructor
233  */
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 
251 private:
252  /**
253  * HW reutrn code
254  */
256 };
257 
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  */
268 
269 #endif
A cmd class that Dumps all the nat_statics.
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
A cmd class that unbinds a NAT configuration from an input interface.
A functor class that binds a NAT configuration to an output interface.
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
A representation of the connection to VPP.
Definition: connection.hpp:33
A cmd class that Dumps all the nat_statics.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:38
A functor class that binds a NAT configuration to an input interface.
A type declaration of an interface handle in VPP.
Definition: types.hpp:164
bind_44_input_cmd(HW::item< bool > &item, const handle_t &itf, const nat_binding::zone_t &zone)
Constructor.
bool operator==(const bind_44_input_cmd &i) const
Comparison operator - only used for UT.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that unbinds a NAT configuration from an output interface.
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
std::string to_string() const
convert to string format for debug purposes