FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
route_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_ROUTE_CMDS_H__
17 #define __VOM_ROUTE_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route.hpp"
21 #include "vom/srpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace route {
27 namespace ip_route_cmds {
28 
29 /**
30  * A command class that creates or updates the route
31  */
32 class update_cmd : public srpc_cmd<vapi::Ip_route_add_del>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  table_id_t id,
40  const prefix_t& prefix,
41  const path_list_t& pl);
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 update_cmd& i) const;
57 
58 private:
59  route::table_id_t m_id;
60  prefix_t m_prefix;
61  const path_list_t& m_pl;
62 };
63 
64 /**
65  * A cmd class that deletes a route
66  */
67 class delete_cmd : public rpc_cmd<HW::item<handle_t>, vapi::Ip_route_add_del>
68 {
69 public:
70  /**
71  * Constructor
72  */
74 
75  /**
76  * Issue the command to VPP/HW
77  */
78  rc_t issue(connection& con);
79 
80  /**
81  * convert to string format for debug purposes
82  */
83  std::string to_string() const;
84 
85  /**
86  * Comparison operator - only used for UT
87  */
88  bool operator==(const delete_cmd& i) const;
89 
90 private:
91  route::table_id_t m_id;
92  prefix_t m_prefix;
93 };
94 
95 /**
96  * A cmd class that Dumps ip fib routes
97  */
98 class dump_cmd : public VOM::dump_cmd<vapi::Ip_route_dump>
99 {
100 public:
101  /**
102  * Constructor
103  */
105  dump_cmd(const dump_cmd& d);
106 
107  /**
108  * Issue the command to VPP/HW
109  */
110  rc_t issue(connection& con);
111  /**
112  * convert to string format for debug purposes
113  */
114  std::string to_string() const;
115 
116  /**
117  * Comparison operator - only used for UT
118  */
119  bool operator==(const dump_cmd& i) const;
120 
121 private:
122  /**
123  * HW reutrn code
124  */
126  route::table_id_t m_id;
127  const l3_proto_t& m_proto;
128 };
129 
130 }; // namespace ip_route_cmds
131 }; // namespace route
132 }; // namespace VOM
133 
134 /*
135  * fd.io coding-style-patch-verification: ON
136  *
137  * Local Variables:
138  * eval: (c-set-style "mozilla")
139  * End:
140  */
141 
142 #endif
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:121
std::string to_string() const
convert to string format for debug purposes
Definition: route_cmds.cpp:68
A command class that creates or updates the route.
Definition: route_cmds.hpp:32
A cmd class that Dumps ip fib routes.
Definition: route_cmds.hpp:98
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
vl_api_prefix_t prefix
Definition: ip.api:144
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
update_cmd(HW::item< handle_t > &item, table_id_t id, const prefix_t &prefix, const path_list_t &pl)
Constructor.
Definition: route_cmds.cpp:26
A representation of the connection to VPP.
Definition: connection.hpp:33
vl_api_ip_proto_t proto
Definition: acl_types.api:50
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
std::set< path > path_list_t
A path-list is a set of paths.
Definition: route.hpp:231
A cmd class that deletes a route.
Definition: route_cmds.hpp:67
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_cmds.cpp:45
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
bool operator==(const update_cmd &i) const
Comparison operator - only used for UT.
Definition: route_cmds.cpp:38
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
A prefix defintion.
Definition: prefix.hpp:131
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66