FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
mroute_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_MROUTE_CMDS_H__
17 #define __VOM_MROUTE_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace route {
27 namespace ip_mroute_cmds {
28 
29 /**
30  * A command class that creates or updates the route
31  */
32 class update_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_mroute_add_del>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  table_id_t id,
40  const mprefix_t& mprefix,
41  const path& path,
42  const itf_flags_t& flags);
43 
44  /**
45  * Issue the command to VPP/HW
46  */
47  rc_t issue(connection& con);
48 
49  /**
50  * convert to string format for debug purposes
51  */
52  std::string to_string() const;
53 
54  /**
55  * Comparison operator - only used for UT
56  */
57  bool operator==(const update_cmd& i) const;
58 
59 private:
60  route::table_id_t m_id;
61  mprefix_t m_mprefix;
62  const path m_path;
63  const itf_flags_t& m_flags;
64 };
65 
66 /**
67  * A cmd class that deletes a route
68  */
69 class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_mroute_add_del>
70 {
71 public:
72  /**
73  * Constructor
74  */
76  table_id_t id,
77  const mprefix_t& mprefix,
78  const path& path,
79  const itf_flags_t& flags);
80 
81  /**
82  * Issue the command to VPP/HW
83  */
84  rc_t issue(connection& con);
85 
86  /**
87  * convert to string format for debug purposes
88  */
89  std::string to_string() const;
90 
91  /**
92  * Comparison operator - only used for UT
93  */
94  bool operator==(const delete_cmd& i) const;
95 
96 private:
97  route::table_id_t m_id;
98  mprefix_t m_mprefix;
99  const path m_path;
100  const itf_flags_t& m_flags;
101 };
102 
103 /**
104  * A cmd class that Dumps ipv4 fib
105  */
106 class dump_cmd : public VOM::dump_cmd<vapi::Ip_mroute_dump>
107 {
108 public:
109  /**
110  * Constructor
111  */
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  route::table_id_t m_id;
134  const l3_proto_t& m_proto;
135 };
136 
137 }; // namespace ip_mroute_cmds
138 }; // namespace route
139 }; // namespace VOM
140 
141 /*
142  * fd.io coding-style-patch-verification: ON
143  *
144  * Local Variables:
145  * eval: (c-set-style "mozilla")
146  * End:
147  */
148 
149 #endif
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:121
u32 flags
Definition: vhost_user.h:141
A cmd class that deletes a route.
Definition: mroute_cmds.hpp:69
A path for IP or MPLS routes.
Definition: route.hpp:32
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
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
A command class that creates or updates the route.
Definition: mroute_cmds.hpp:32
A cmd class that Dumps ipv4 fib.
std::string to_string() const
convert to string format for debug purposes
Definition: mroute_cmds.cpp:66
bool operator==(const update_cmd &i) const
Comparison operator - only used for UT.
Definition: mroute_cmds.cpp:40
typedef mprefix
Definition: ip_types.api:93
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A prefix defintion.
Definition: prefix.hpp:252
update_cmd(HW::item< bool > &item, table_id_t id, const mprefix_t &mprefix, const path &path, const itf_flags_t &flags)
Constructor.
Definition: mroute_cmds.cpp:26
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< bool > & 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
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: mroute_cmds.cpp:46