FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
l3_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_L3_BINDING_CMDS_H__
17 #define __VOM_L3_BINDING_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/l3_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/interface.api.vapi.hpp>
24 #include <vapi/ip.api.vapi.hpp>
25 
26 namespace VOM {
27 namespace l3_binding_cmds {
28 
29 /**
30  * A functor class that binds the L3 config to the interface
31  */
32 class bind_cmd
33  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_add_del_address>
34 {
35 public:
36  /**
37  * Constructor
38  */
40  const handle_t& itf,
41  const route::prefix_t& pfx);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
46  rc_t issue(connection& con);
47  /**
48  * convert to string format for debug purposes
49  */
50  std::string to_string() const;
51 
52  /**
53  * Comparison operator - only used for UT
54  */
55  bool operator==(const bind_cmd& i) const;
56 
57 private:
58  /**
59  * Reference to the interface to bind to
60  */
61  const handle_t& m_itf;
62 
63  /**
64  * The prefix to bind
65  */
66  const route::prefix_t& m_pfx;
67 };
68 
69 /**
70  * A cmd class that Unbinds L3 Config from an interface
71  */
73  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_add_del_address>
74 {
75 public:
76  /**
77  * Constructor
78  */
80  const handle_t& itf,
81  const route::prefix_t& pfx);
82 
83  /**
84  * Issue the command to VPP/HW
85  */
86  rc_t issue(connection& con);
87  /**
88  * convert to string format for debug purposes
89  */
90  std::string to_string() const;
91 
92  /**
93  * Comparison operator - only used for UT
94  */
95  bool operator==(const unbind_cmd& i) const;
96 
97 private:
98  /**
99  * Reference to the interface to unbind fomr
100  */
101  const handle_t& m_itf;
102 
103  /**
104  * The prefix to unbind
105  */
106  const route::prefix_t& m_pfx;
107 };
108 
109 /**
110  * A cmd class that Dumps all the IPv4 L3 configs
111  */
112 class dump_v4_cmd : public dump_cmd<vapi::Ip_address_dump>
113 {
114 public:
115  /**
116  * Constructor
117  */
118  dump_v4_cmd(const handle_t& itf);
119  dump_v4_cmd(const dump_v4_cmd& d);
120 
121  /**
122  * Issue the command to VPP/HW
123  */
124  rc_t issue(connection& con);
125  /**
126  * convert to string format for debug purposes
127  */
128  std::string to_string() const;
129 
130  /**
131  * Comparison operator - only used for UT
132  */
133  bool operator==(const dump_v4_cmd& i) const;
134 
135 private:
136  /**
137  * HW reutrn code
138  */
140 
141  /**
142  * The interface to get the addresses for
143  */
144  const handle_t& m_itf;
145 };
146 
147 }; // namespace l3_binding_cmds
148 }; // namespace VOM
149 
150 /*
151  * fd.io coding-style-patch-verification: ON
152  *
153  * Local Variables:
154  * eval: (c-set-style "mozilla")
155  * End:
156  */
157 
158 #endif
A functor class that binds the L3 config to the interface.
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
std::string to_string() const
convert to string format for debug purposes
bind_cmd(HW::item< bool > &item, const handle_t &itf, const route::prefix_t &pfx)
Constructor.
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that Unbinds L3 Config from an interface.
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
A cmd class that Dumps all the IPv4 L3 configs.
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
A prefix defintion.
Definition: prefix.hpp:131
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66