FD.io VPP  v19.08-23-g4b943d6
Vector Packet Processing
neighbour_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_NEIGHBOUR_CMDS_H__
17 #define __VOM_NEIGHBOUR_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/srpc_cmd.hpp"
21 #include "neighbour.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace neighbour_cmds {
27 
28 /**
29  * A command class that creates or updates the bridge domain ARP Entry
30  */
31 class create_cmd : public srpc_cmd<vapi::Ip_neighbor_add_del>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  handle_t itf,
39  const mac_address_t& mac,
40  const boost::asio::ip::address& ip_addr,
41  const neighbour::flags_t &flags);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
46  rc_t issue(connection& con);
47 
48  /**
49  * convert to string format for debug purposes
50  */
51  std::string to_string() const;
52 
53  /**
54  * Comparison operator - only used for UT
55  */
56  bool operator==(const create_cmd& i) const;
57 
58 private:
59  handle_t m_itf;
60  mac_address_t m_mac;
61  boost::asio::ip::address m_ip_addr;
62  const neighbour::flags_t &m_flags;
63 };
64 
65 /**
66  * A cmd class that deletes a bridge domain ARP entry
67  */
68 class delete_cmd : public srpc_cmd<vapi::Ip_neighbor_add_del>
69 {
70 public:
71  /**
72  * Constructor
73  */
75  handle_t itf,
76  const mac_address_t& mac,
77  const boost::asio::ip::address& ip_addr,
78  const neighbour::flags_t &flags);
79 
80  /**
81  * Issue the command to VPP/HW
82  */
83  rc_t issue(connection& con);
84 
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 delete_cmd& i) const;
94 
95 private:
96  handle_t m_itf;
97  mac_address_t m_mac;
98  boost::asio::ip::address m_ip_addr;
99  const neighbour::flags_t &m_flags;
100 };
101 
102 /**
103  * A cmd class that Dumps all the neighbours
104  */
105 class dump_cmd : public VOM::dump_cmd<vapi::Ip_neighbor_dump>
106 {
107 public:
108  /**
109  * Constructor
110  */
111  dump_cmd(const handle_t& itf, const l3_proto_t& proto);
112  dump_cmd(const dump_cmd& d);
113 
114  /**
115  * Issue the command to VPP/HW
116  */
117  rc_t issue(connection& con);
118  /**
119  * convert to string format for debug purposes
120  */
121  std::string to_string() const;
122 
123  /**
124  * Comparison operator - only used for UT
125  */
126  bool operator==(const dump_cmd& i) const;
127 
128 private:
129  /**
130  * HW reutrn code
131  */
133 
134  /**
135  * The interface to dump
136  */
137  handle_t m_itf;
138 
139  /**
140  * V4 or V6
141  */
142  l3_proto_t m_proto;
143 };
144 
145 }; // namespace neighbour_cmds
146 }; // namespace vom
147 #endif
148 
typedef address
Definition: ip_types.api:83
u32 flags
Definition: vhost_user.h:141
A cmd class that deletes a bridge domain ARP entry.
vl_api_mac_address_t mac
Definition: l2.api:490
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route...
Definition: prefix.hpp:52
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A representation of the connection to VPP.
Definition: connection.hpp:33
std::string to_string() const
convert to string format for debug purposes
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
A cmd class that Dumps all the neighbours.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A command class that creates or updates the bridge domain ARP Entry.
create_cmd(HW::item< handle_t > &item, handle_t itf, const mac_address_t &mac, const boost::asio::ip::address &ip_addr, const neighbour::flags_t &flags)
Constructor.
Type def of a Ethernet address.
Definition: types.hpp:295
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
vl_api_fib_path_nh_proto_t proto
Definition: fib_types.api:125