FD.io VPP  v18.10-34-gcce845e
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/ip_punt_redirect.hpp"
20 #include "vom/rpc_cmd.hpp"
21 
22 #include <vapi/ip.api.vapi.hpp>
23 
24 namespace VOM {
25 namespace ip_punt_redirect_cmds {
26 
27 /**
28 *A command class that configures the IP punt_redirect
29 */
30 class config_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
31 {
32 public:
33  /**
34  * Constructor
35  */
37  const handle_t& rx_itf,
38  const handle_t& tx_itf,
40 
41  /**
42  * Issue the command to VPP/HW
43  */
44  rc_t issue(connection& con);
45  /**
46  * convert to string format for debug purposes
47  */
48  std::string to_string() const;
49 
50  /**
51  * Comparison operator - only used for UT
52  */
53  bool operator==(const config_cmd& i) const;
54 
55 private:
56  /**
57  * Reference to the interface from which traffic is coming
58  */
59  const handle_t& m_rx_itf;
60  /**
61  * Reference to the interface where traffic will be redirected
62  */
63  const handle_t& m_tx_itf;
64 
65  /**
66  * Reference to nexh hop ip address
67  */
68  const boost::asio::ip::address& m_addr;
69 };
70 
71 /**
72  * A cmd class that Unconfigs Ip punt redirect
73  */
74 class unconfig_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
75 {
76 public:
77  /**
78  * Constructor
79  */
81  const handle_t& rx_itf,
82  const handle_t& tx_itf,
84 
85  /**
86  * Issue the command to VPP/HW
87  */
88  rc_t issue(connection& con);
89  /**
90  * convert to string format for debug purposes
91  */
92  std::string to_string() const;
93 
94  /**
95  * Comparison operator - only used for UT
96  */
97  bool operator==(const unconfig_cmd& i) const;
98 
99 private:
100  /**
101  * Reference to the interface from which traffic is coming
102  */
103  const handle_t& m_rx_itf;
104  /**
105  * Reference to the interface where traffic will be redirected
106  */
107  const handle_t& m_tx_itf;
108 
109  /**
110  * Reference to nexh hop ip address
111  */
112  const boost::asio::ip::address& m_addr;
113 };
114 
115 }; // namespace ip_punt_redirect_cmds
116 }; // namespace VOM
117 
118 /*
119  * fd.io coding-style-patch-verification: ON
120  *
121  * Local Variables:
122  * eval: (c-set-style "mozilla")
123  * End:
124  */
125 
126 #endif
typedef address
Definition: ip_types.api:35
A command class that configures the IP punt_redirect.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
vhost_vring_addr_t addr
Definition: vhost_user.h:121
std::string to_string() const
convert to string format for debug purposes
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:38
A type declaration of an interface handle in VPP.
Definition: types.hpp:228
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
config_cmd(HW::item< bool > &item, const handle_t &rx_itf, const handle_t &tx_itf, const boost::asio::ip::address &addr)
Constructor.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64