FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
tap_interface_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_TAP_INTERFACE_CMDS_H__
17 #define __VOM_TAP_INTERFACE_CMDS_H__
18 
19 #include "vom/interface.hpp"
20 #include "vom/tap_interface.hpp"
21 #include "vom/dump_cmd.hpp"
22 #include "vom/rpc_cmd.hpp"
23 
24 #include <vapi/interface.api.vapi.hpp>
25 #include <vapi/tap.api.vapi.hpp>
26 #include <vapi/tapv2.api.vapi.hpp>
27 
28 namespace VOM {
29 namespace tap_interface_cmds {
30 
31 /**
32  * A functor class that creates an interface
33  */
34 class tap_create_cmd : public interface::create_cmd<vapi::Tap_connect>
35 {
36 public:
38  const std::string& name,
40  const l2_address_t& l2_address);
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 private:
52  route::prefix_t& m_prefix;
53  const l2_address_t& m_l2_address;
54 };
55 
56 /**
57  * A functor class that deletes a Tap interface
58  */
59 class tap_delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
60 {
61 public:
63 
64  /**
65  * Issue the command to VPP/HW
66  */
67  rc_t issue(connection& con);
68  /**
69  * convert to string format for debug purposes
70  */
71  std::string to_string() const;
72 };
73 
74 /**
75  * A cmd class that Dumps all the Vpp Interfaces
76  */
77 class tap_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_dump>
78 {
79 public:
80  /**
81  * Default Constructor
82  */
83  tap_dump_cmd();
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 tap_dump_cmd& i) const;
98 };
99 
100 /**
101  * A functor class that creates an interface
102  */
103 class tapv2_create_cmd : public interface::create_cmd<vapi::Tap_create_v2>
104 {
105 public:
107  const std::string& name,
109  const l2_address_t& l2_address);
110 
111  /**
112  * Issue the command to VPP/HW
113  */
114  rc_t issue(connection& con);
115  /**
116  * convert to string format for debug purposes
117  */
118  std::string to_string() const;
119 
120 private:
121  route::prefix_t& m_prefix;
122  const l2_address_t& m_l2_address;
123 };
124 
125 /**
126  * A functor class that deletes a Tap interface
127  */
128 class tapv2_delete_cmd : public interface::delete_cmd<vapi::Tap_delete_v2>
129 {
130 public:
132 
133  /**
134  * Issue the command to VPP/HW
135  */
136  rc_t issue(connection& con);
137  /**
138  * convert to string format for debug purposes
139  */
140  std::string to_string() const;
141 };
142 
143 /**
144  * A cmd class that Dumps all the Vpp Interfaces
145  */
146 class tapv2_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_v2_dump>
147 {
148 public:
149  /**
150  * Default Constructor
151  */
152  tapv2_dump_cmd();
153 
154  /**
155  * Issue the command to VPP/HW
156  */
157  rc_t issue(connection& con);
158  /**
159  * convert to string format for debug purposes
160  */
161  std::string to_string() const;
162 
163  /**
164  * Comparison operator - only used for UT
165  */
166  bool operator==(const tapv2_dump_cmd& i) const;
167 };
168 
169 }; // namespace tap_interface_cmds
170 }; // namespace VOM
171 
172 #endif
A functor class that creates an interface.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
A functor class that deletes a Tap interface.
Type def of a L2 address as read from VPP.
Definition: types.hpp:334
A cmd class that Dumps all the Vpp Interfaces.
tap_create_cmd(HW::item< handle_t > &item, const std::string &name, route::prefix_t &prefix, const l2_address_t &l2_address)
A functor class that creates an interface.
A representation of the connection to VPP.
Definition: connection.hpp:33
virtual bool operator==(const create_cmd &o) const
Comparison operator - only used for UT.
Definition: interface.hpp:301
Base class for intterface Delete commands.
Definition: interface.hpp:350
A cmd class that Dumps all the Vpp Interfaces.
A base class for interface Create commands.
Definition: interface.hpp:284
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
rc_t issue(connection &con)
Issue the command to VPP/HW.
A functor class that deletes a Tap interface.
typedef prefix
Definition: ip_types.api:40
std::string to_string() const
convert to string format for debug purposes
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
A prefix defintion.
Definition: prefix.hpp:93
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64