FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ip_punt_redirect_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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_IP_PUNT_REDIRECT_CMDS_H__
17 #define __VOM_IP_PUNT_REDIRECT_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/ip_punt_redirect.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace ip_punt_redirect_cmds {
27 
28 /**
29 *A command class that configures the IP punt_redirect
30 */
31 class config_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  const handle_t rx_itf,
39  const handle_t tx_itf,
41 
42  /**
43  * Issue the command to VPP/HW
44  */
46  /**
47  * convert to string format for debug purposes
48  */
49  std::string to_string() const;
50 
51  /**
52  * Comparison operator - only used for UT
53  */
54  bool operator==(const config_cmd& i) const;
55 
56 private:
57  /**
58  * Reference to the interface from which traffic is coming
59  */
60  const handle_t m_rx_itf;
61  /**
62  * Reference to the interface where traffic will be redirected
63  */
64  const handle_t m_tx_itf;
65 
66  /**
67  * Reference to nexh hop ip address
68  */
69  const boost::asio::ip::address& m_addr;
70 };
71 
72 /**
73  * A cmd class that Unconfigs Ip punt redirect
74  */
75 class unconfig_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
76 {
77 public:
78  /**
79  * Constructor
80  */
82  const handle_t rx_itf,
83  const handle_t tx_itf,
85 
86  /**
87  * Issue the command to VPP/HW
88  */
90  /**
91  * convert to string format for debug purposes
92  */
93  std::string to_string() const;
94 
95  /**
96  * Comparison operator - only used for UT
97  */
98  bool operator==(const unconfig_cmd& i) const;
99 
100 private:
101  /**
102  * Reference to the interface from which traffic is coming
103  */
104  const handle_t m_rx_itf;
105  /**
106  * Reference to the interface where traffic will be redirected
107  */
108  const handle_t m_tx_itf;
109 
110  /**
111  * Reference to nexh hop ip address
112  */
113  const boost::asio::ip::address& m_addr;
114 };
115 
116 /**
117  * A cmd class that Dumps all the IP punt redirect
118  */
119 class dump_cmd : public VOM::dump_cmd<vapi::Ip_punt_redirect_dump>
120 {
121 public:
122  /**
123  * Constructor
124  */
125  dump_cmd() = default;
126 
127  /**
128  * Issue the command to VPP/HW
129  */
131  /**
132  * convert to string format for debug purposes
133  */
134  std::string to_string() const;
135 
136  /**
137  * Comparison operator - only used for UT
138  */
139  bool operator==(const dump_cmd& i) const;
140 
141 private:
142  /**
143  * HW reutrn code
144  */
145  HW::item<bool> item;
146 };
147 
148 }; // namespace ip_punt_redirect_cmds
149 }; // namespace VOM
150 
151 /*
152  * fd.io coding-style-patch-verification: OFF
153  *
154  * Local Variables:
155  * eval: (c-set-style "mozilla")
156  * End:
157  */
158 
159 #endif
VOM::HW::item< bool >
VOM::ip_punt_redirect_cmds::config_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_punt_redirect_cmds.cpp:41
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::ip_punt_redirect_cmds::dump_cmd::dump_cmd
dump_cmd()=default
Constructor.
VOM::ip_punt_redirect_cmds::unconfig_cmd::unconfig_cmd
unconfig_cmd(HW::item< bool > &item, const handle_t rx_itf, const handle_t tx_itf, const boost::asio::ip::address &addr)
Constructor.
Definition: ip_punt_redirect_cmds.cpp:68
con
Connection con
Definition: vapi_cpp_test.cpp:56
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
ip_punt_redirect.hpp
VOM::ip_punt_redirect_cmds::config_cmd::operator==
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_punt_redirect_cmds.cpp:34
VOM::ip_punt_redirect_cmds::unconfig_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_punt_redirect_cmds.cpp:87
VOM::ip_punt_redirect_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_punt_redirect_cmds.cpp:136
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::ip_punt_redirect_cmds::unconfig_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_punt_redirect_cmds.cpp:107
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
address
manual_print typedef address
Definition: ip_types.api:96
VOM::ip_punt_redirect_cmds::unconfig_cmd::operator==
bool operator==(const unconfig_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_punt_redirect_cmds.cpp:80
dump_cmd.hpp
VOM::ip_punt_redirect_cmds::unconfig_cmd
A cmd class that Unconfigs Ip punt redirect.
Definition: ip_punt_redirect_cmds.hpp:75
VOM::ip_punt_redirect_cmds::config_cmd::config_cmd
config_cmd(HW::item< bool > &item, const handle_t rx_itf, const handle_t tx_itf, const boost::asio::ip::address &addr)
Constructor.
Definition: ip_punt_redirect_cmds.cpp:22
VOM::rpc_cmd< HW::item< bool >, vapi::Ip_punt_redirect >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::ip_punt_redirect_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_punt_redirect_cmds.cpp:118
VOM::ip_punt_redirect_cmds::config_cmd
A command class that configures the IP punt_redirect.
Definition: ip_punt_redirect_cmds.hpp:31
VOM::ip_punt_redirect_cmds::dump_cmd
A cmd class that Dumps all the IP punt redirect.
Definition: ip_punt_redirect_cmds.hpp:119
VOM::ip_punt_redirect_cmds::config_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_punt_redirect_cmds.cpp:58
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::ip_punt_redirect_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_punt_redirect_cmds.cpp:124
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172