|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
18 #include <vapi/tapv2.api.vapi.hpp>
23 namespace tap_interface_cmds {
33 , m_l2_address(l2_address)
39 msg_t req(
con.ctx(), std::ref(*
this));
41 auto& payload = req.get_request().get_payload();
42 memset(payload.host_if_name, 0,
sizeof(payload.host_if_name));
43 memcpy(payload.host_if_name,
45 std::min(
m_name.length(),
sizeof(payload.host_if_name)));
46 payload.host_if_name_set = 1;
49 if (m_prefix.
address().is_v6()) {
50 m_prefix.
to_vpp((uint8_t*)&payload.host_ip6_prefix_set,
51 payload.host_ip6_prefix.address,
52 &payload.host_ip6_prefix.len);
54 m_prefix.
to_vpp((uint8_t*)&payload.host_ip4_prefix_set,
55 payload.host_ip4_prefix.address,
56 &payload.host_ip4_prefix.len);
57 payload.host_ip4_prefix_set = 1;
62 m_l2_address.
to_bytes(payload.host_mac_addr, 6);
63 payload.host_mac_addr_set = 1;
66 payload.id = 0xffffffff;
67 payload.use_random_mac = 1;
68 payload.tx_ring_sz = 1024;
69 payload.rx_ring_sz = 1024;
100 msg_t req(
con.ctx(), std::ref(*
this));
102 auto& payload = req.get_request().get_payload();
117 std::ostringstream s;
146 return (
"tapv2-itf-dump");
vapi::Sw_interface_tap_v2_dump msg_t
const static l2_address_t ZERO
An all 0's L2 address.
rc_t wait()
Wait on the commands promise.
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
The VPP Object Model (VOM) library.
const static prefix_t ZERO
The all Zeros prefix.
const static rc_t OK
The HW write was successfull.
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
uint32_t value() const
get the value of the handle
std::string to_string() const
convert to string format for debug purposes
tapv2_delete_cmd(HW::item< handle_t > &item)
A cmd class that Dumps all the Vpp Interfaces.
HW::item< handle_t > & m_hw_item
A reference to an object's HW::item that the command will update.
std::unique_ptr< vapi::Sw_interface_tap_v2_dump > m_dump
The VAPI event registration.
void insert_interface()
add the created interface to the DB
const boost::asio::ip::address & address() const
Get the address.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
tapv2_dump_cmd()
Default Constructor.
DEFINE_VAPI_MSG_IDS_TAPV2_API_JSON
A representation of the connection to VPP.
std::string to_string() const
convert to string format for debug purposes
rc_t wait()
Wait for the issue of the command to complete.
A representation of an interface in VPP.
const static rc_t NOOP
The HW write/update action was/has not been attempted.
std::string to_string() const
convert to string format for debug purposes
vapi::Tap_create_v2 msg_t
convenient typedef
rc_t rc() const
Get the HW return code.
Type def of a L2 address as read from VPP.
T & data()
Return the data read/written.
void remove_interface()
remove the deleted interface from the DB
rc_t issue(connection &con)
Issue the command to VPP/HW.
tapv2_create_cmd(HW::item< handle_t > &item, const std::string &name, const route::prefix_t &prefix, const l2_address_t &l2_address)
rc_t issue(connection &con)
Issue the command to VPP/HW.
void to_vpp(uint8_t *is_ip6, uint8_t *addr, uint8_t *len) const
Convert the prefix into VPP API parameters.
const std::string & m_name
The name of the interface to be created.
std::string to_string() const
convert to string format for debug purposes
Error codes that VPP will return during a HW write.
bool operator==(const tapv2_dump_cmd &i) const
Comparison operator - only used for UT.