FD.io VPP  v21.10.1-2-g0a485f517
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/tapv2.api.vapi.hpp>
26 
27 namespace VOM {
28 namespace tap_interface_cmds {
29 
30 /**
31  * A functor class that creates an interface
32  */
33 class tapv2_create_cmd : public interface::create_cmd<vapi::Tap_create_v2>
34 {
35 public:
37  const std::string& name,
38  const route::prefix_t& prefix,
39  const l2_address_t& l2_address);
40 
41  /**
42  * Issue the command to VPP/HW
43  */
45  /**
46  * convert to string format for debug purposes
47  */
48  std::string to_string() const;
49 
50 private:
51  const route::prefix_t& m_prefix;
52  const l2_address_t& m_l2_address;
53 };
54 
55 /**
56  * A functor class that deletes a Tap interface
57  */
58 class tapv2_delete_cmd : public interface::delete_cmd<vapi::Tap_delete_v2>
59 {
60 public:
62 
63  /**
64  * Issue the command to VPP/HW
65  */
67  /**
68  * convert to string format for debug purposes
69  */
70  std::string to_string() const;
71 };
72 
73 /**
74  * A cmd class that Dumps all the Vpp Interfaces
75  */
76 class tapv2_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_v2_dump>
77 {
78 public:
79  /**
80  * Default Constructor
81  */
83 
84  /**
85  * Issue the command to VPP/HW
86  */
88  /**
89  * convert to string format for debug purposes
90  */
91  std::string to_string() const;
92 
93  /**
94  * Comparison operator - only used for UT
95  */
96  bool operator==(const tapv2_dump_cmd& i) const;
97 };
98 
99 }; // namespace tap_interface_cmds
100 }; // namespace VOM
101 
102 #endif
VOM::route::prefix_t
A prefix defintion.
Definition: prefix.hpp:131
VOM::HW::item< handle_t >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
name
string name[64]
Definition: fib.api:25
VOM::tap_interface_cmds::tapv2_create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: tap_interface_cmds.cpp:83
VOM::tap_interface_cmds::tapv2_delete_cmd::tapv2_delete_cmd
tapv2_delete_cmd(HW::item< handle_t > &item)
Definition: tap_interface_cmds.cpp:92
tap_interface.hpp
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::interface::delete_cmd
Base class for intterface Delete commands.
Definition: interface.hpp:376
VOM::tap_interface_cmds::tapv2_dump_cmd
A cmd class that Dumps all the Vpp Interfaces.
Definition: tap_interface_cmds.hpp:76
VOM::tap_interface_cmds::tapv2_delete_cmd
A functor class that deletes a Tap interface.
Definition: tap_interface_cmds.hpp:58
VOM::tap_interface_cmds::tapv2_create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: tap_interface_cmds.cpp:37
VOM::tap_interface_cmds::tapv2_dump_cmd::tapv2_dump_cmd
tapv2_dump_cmd()
Default Constructor.
Definition: tap_interface_cmds.cpp:123
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::tap_interface_cmds::tapv2_dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: tap_interface_cmds.cpp:144
VOM::tap_interface_cmds::tapv2_create_cmd
A functor class that creates an interface.
Definition: tap_interface_cmds.hpp:33
VOM::interface::create_cmd
A base class for interface Create commands.
Definition: interface.hpp:309
dump_cmd.hpp
VOM::l2_address_t
Type def of a L2 address as read from VPP.
Definition: types.hpp:339
VOM::rpc_cmd< HW::item< handle_t >, vapi::Tap_create_v2 >::item
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::tap_interface_cmds::tapv2_dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: tap_interface_cmds.cpp:132
VOM::tap_interface_cmds::tapv2_create_cmd::tapv2_create_cmd
tapv2_create_cmd(HW::item< handle_t > &item, const std::string &name, const route::prefix_t &prefix, const l2_address_t &l2_address)
Definition: tap_interface_cmds.cpp:27
VOM::tap_interface_cmds::tapv2_delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: tap_interface_cmds.cpp:97
interface.hpp
i
int i
Definition: flowhash_template.h:376
VOM::tap_interface_cmds::tapv2_delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: tap_interface_cmds.cpp:115
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::tap_interface_cmds::tapv2_dump_cmd::operator==
bool operator==(const tapv2_dump_cmd &i) const
Comparison operator - only used for UT.
Definition: tap_interface_cmds.cpp:126
rpc_cmd.hpp
prefix
vl_api_prefix_t prefix
Definition: ip.api:175
string
const char *const string
Definition: cJSON.h:172