FD.io VPP  v20.09-64-g4f7b92f0a
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  */
45  rc_t issue(connection& con);
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  */
89  rc_t issue(connection& con);
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  */
130  rc_t issue(connection& con);
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  */
146 };
147 
148 }; // namespace ip_punt_redirect_cmds
149 }; // namespace VOM
150 
151 /*
152  * fd.io coding-style-patch-verification: ON
153  *
154  * Local Variables:
155  * eval: (c-set-style "mozilla")
156  * End:
157  */
158 
159 #endif
config_cmd(HW::item< bool > &item, const handle_t rx_itf, const handle_t tx_itf, const boost::asio::ip::address &addr)
Constructor.
A command class that configures the IP punt_redirect.
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
vhost_vring_addr_t addr
Definition: vhost_user.h:111
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that Unconfigs Ip punt redirect.
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
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
std::string to_string() const
convert to string format for debug purposes
manual_print typedef address
Definition: ip_types.api:85
A cmd class that Dumps all the IP punt redirect.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
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