FD.io VPP  v19.04.2-12-g66b1689
Vector Packet Processing
arp_proxy_config_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_ARP_PROXY_CONFIG_CMDS_H__
17 #define __VOM_ARP_PROXY_CONFIG_CMDS_H__
18 
19 #include "vom/arp_proxy_config.hpp"
20 #include "vom/dump_cmd.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace arp_proxy_config_cmds {
27 /**
28  * A command class that adds the ARP Proxy config
29  */
30 class config_cmd : public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_add_del>
31 {
32 public:
33  /**
34  * Constructor
35  */
37  const boost::asio::ip::address_v4& lo,
38  const boost::asio::ip::address_v4& high);
39 
40  /**
41  * Issue the command to VPP/HW
42  */
43  rc_t issue(connection& con);
44  /**
45  * convert to string format for debug purposes
46  */
47  std::string to_string() const;
48 
49  /**
50  * Comparison operator - only used for UT
51  */
52  bool operator==(const config_cmd& i) const;
53 
54 private:
55  /**
56  * Address range
57  */
58  const boost::asio::ip::address_v4 m_low;
59  const boost::asio::ip::address_v4 m_high;
60 };
61 
62 /**
63  * A cmd class that Unconfigs ArpProxy Config from an interface
64  */
65 class unconfig_cmd : public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_add_del>
66 {
67 public:
68  /**
69  * Constructor
70  */
72  const boost::asio::ip::address_v4& lo,
73  const boost::asio::ip::address_v4& hig);
74 
75  /**
76  * Issue the command to VPP/HW
77  */
78  rc_t issue(connection& con);
79  /**
80  * convert to string format for debug purposes
81  */
82  std::string to_string() const;
83 
84  /**
85  * Comparison operator - only used for UT
86  */
87  bool operator==(const unconfig_cmd& i) const;
88 
89 private:
90  /**
91  * Address range
92  */
93  const boost::asio::ip::address_v4 m_low;
94  const boost::asio::ip::address_v4 m_high;
95 };
96 
97 /**
98  * A cmd class that Dumps all the Proxy ARP configs
99  */
100 class dump_cmd : public VOM::dump_cmd<vapi::Proxy_arp_dump>
101 {
102 public:
103  /**
104  * Constructor
105  */
106  dump_cmd() = default;
107 
108  /**
109  * Issue the command to VPP/HW
110  */
111  rc_t issue(connection& con);
112  /**
113  * convert to string format for debug purposes
114  */
115  std::string to_string() const;
116 
117  /**
118  * Comparison operator - only used for UT
119  */
120  bool operator==(const dump_cmd& i) const;
121 
122 private:
123  /**
124  * HW reutrn code
125  */
127 };
128 
129 }; // namespace cmds
130 }; // namespace VOM
131 
132 /*
133  * fd.io coding-style-patch-verification: ON
134  *
135  * Local Variables:
136  * eval: (c-set-style "mozilla")
137  * End:
138  */
139 
140 #endif
config_cmd(HW::item< bool > &item, const boost::asio::ip::address_v4 &lo, const boost::asio::ip::address_v4 &high)
Constructor.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A representation of the connection to VPP.
Definition: connection.hpp:33
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
lo
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A cmd class that Unconfigs ArpProxy Config from an interface.
std::string to_string() const
convert to string format for debug purposes
A command class that adds the ARP Proxy config.
A cmd class that Dumps all the Proxy ARP configs.
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
rc_t issue(connection &con)
Issue the command to VPP/HW.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66