FD.io VPP  v21.06-3-gbb25fbf28
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  */
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  */
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  */
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  */
132  HW::item<bool> item;
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: OFF
143  *
144  * Local Variables:
145  * eval: (c-set-style "mozilla")
146  * End:
147  */
148 
149 #endif
VOM::HW::item< bool >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::route::ip_mroute_cmds::dump_cmd
A cmd class that Dumps ipv4 fib.
Definition: mroute_cmds.hpp:106
VOM::route::ip_mroute_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: mroute_cmds.cpp:96
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::route::mprefix_t
A prefix defintion.
Definition: prefix.hpp:252
mprefix
typedef mprefix
Definition: ip_types.api:118
VOM::route::ip_mroute_cmds::update_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: mroute_cmds.cpp:66
route.hpp
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::route::ip_mroute_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: mroute_cmds.cpp:118
VOM::route::ip_mroute_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: mroute_cmds.cpp:140
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VOM::route::ip_mroute_cmds::delete_cmd
A cmd class that deletes a route.
Definition: mroute_cmds.hpp:69
dump_cmd.hpp
VOM::route::ip_mroute_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: mroute_cmds.cpp:134
VOM::rpc_cmd< HW::item< bool >, vapi::Ip_mroute_add_del >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::l3_proto_t
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
VOM::route::ip_mroute_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: mroute_cmds.cpp:157
VOM::route::itf_flags_t
Definition: route.hpp:207
VOM::dump_cmd< vapi::Ip_mroute_dump >::dump_cmd
dump_cmd()
Default Constructor.
Definition: dump_cmd.hpp:55
VOM::route::ip_mroute_cmds::update_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: mroute_cmds.cpp:46
VOM::route::path
A path for IP or MPLS routes.
Definition: route.hpp:32
VOM::route::ip_mroute_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
Definition: mroute_cmds.cpp:90
VOM::route::table_id_t
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:121
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
VOM::route::ip_mroute_cmds::update_cmd::update_cmd
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
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
VOM::route::ip_mroute_cmds::update_cmd::operator==
bool operator==(const update_cmd &i) const
Comparison operator - only used for UT.
Definition: mroute_cmds.cpp:40
VOM::route::ip_mroute_cmds::delete_cmd::delete_cmd
delete_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:76
VOM::route::ip_mroute_cmds::update_cmd
A command class that creates or updates the route.
Definition: mroute_cmds.hpp:32
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105