FD.io VPP
v18.04-17-g3a0d853
Vector Packet Processing
|
A base class for all RPC commands to VPP. More...
Public Types | |
typedef MSG | msg_t |
convenient typedef More... | |
Public Member Functions | |
rpc_cmd (HWITEM &item) | |
Constructor taking the HW item that will be updated by the command. More... | |
virtual | ~rpc_cmd () |
Desructor. More... | |
HWITEM & | item () |
return the HW item the command updates More... | |
const HWITEM & | item () const |
return the const HW item the command updates More... | |
void | fulfill (const DATA &d) |
Fulfill the commands promise. More... | |
DATA | wait () |
Wait on the commands promise. More... | |
virtual void | succeeded () |
Called by the HW Command Q when it is disabled to indicate the command can be considered successful without issuing it to HW. More... | |
virtual vapi_error_e | operator() (MSG &reply) |
call operator used as a callback by VAPI when the reply is available More... | |
virtual void | retire (connection &con) |
Retire/cancel a long running command. More... | |
Public Member Functions inherited from VOM::cmd | |
cmd () | |
Default constructor. More... | |
virtual | ~cmd () |
Virtual destructor. More... | |
virtual rc_t | issue (connection &con)=0 |
Issue the command to VPP/HW. More... | |
virtual std::string | to_string () const =0 |
convert to string format for debug purposes More... | |
Protected Attributes | |
HWITEM & | m_hw_item |
A reference to an object's HW::item that the command will update. More... | |
std::promise< DATA > | m_promise |
The promise that implements the synchronous issue. More... | |
A base class for all RPC commands to VPP.
RPC commands are one of the sub-set of command types to VPP that modify/create state in VPP and thus return an error code. Commands are issued in one thread context, but read in another. The command has an associated std::promise that is met by the RX thread. this allows the sender, which waits on the promise's future, to experience a synchronous command.
The command is templatised on the type of the HW::item to be set by the command, and the data returned in the promise,
Definition at line 38 of file rpc_cmd.hpp.
typedef MSG VOM::rpc_cmd< HWITEM, DATA, MSG >::msg_t |
convenient typedef
Definition at line 44 of file rpc_cmd.hpp.
|
inline |
Constructor taking the HW item that will be updated by the command.
Definition at line 49 of file rpc_cmd.hpp.
|
inlinevirtual |
Desructor.
Definition at line 59 of file rpc_cmd.hpp.
|
inline |
Fulfill the commands promise.
Called from the RX thread
Definition at line 74 of file rpc_cmd.hpp.
|
inline |
return the HW item the command updates
Definition at line 64 of file rpc_cmd.hpp.
|
inline |
return the const HW item the command updates
Definition at line 69 of file rpc_cmd.hpp.
|
inlinevirtual |
call operator used as a callback by VAPI when the reply is available
Reimplemented in VOM::interface::create_cmd< MSG >, VOM::interface::create_cmd< vapi::Create_vhost_user_if >, VOM::interface::create_cmd< vapi::Af_packet_create >, VOM::interface::create_cmd< vapi::Bond_create >, VOM::interface::create_cmd< vapi::Vxlan_add_del_tunnel >, VOM::interface::create_cmd< vapi::Tap_connect >, VOM::interface::create_cmd< vapi::Create_loopback >, VOM::interface::create_cmd< vapi::Create_vlan_subif >, and VOM::ACL::list_cmds::update_cmd< RULE, UPDATE >.
Definition at line 117 of file rpc_cmd.hpp.
|
inlinevirtual |
Retire/cancel a long running command.
Implements VOM::cmd.
Reimplemented in VOM::interface_cmds::stats_enable_cmd, VOM::interface_cmds::events_cmd, VOM::dhcp_config_cmds::events_cmd, VOM::event_cmd< WANT, EVENT >, VOM::event_cmd< vapi::Want_per_interface_combined_stats, vapi::Vnet_per_interface_combined_counters >, VOM::event_cmd< vapi::Control_ping, vapi::Dhcp_compl_event >, and VOM::event_cmd< vapi::Want_interface_events, vapi::Sw_interface_event >.
Definition at line 129 of file rpc_cmd.hpp.
|
inlinevirtual |
Called by the HW Command Q when it is disabled to indicate the command can be considered successful without issuing it to HW.
Implements VOM::cmd.
Reimplemented in VOM::interface::delete_cmd< MSG >, VOM::interface::delete_cmd< vapi::Af_packet_delete >, VOM::interface::delete_cmd< vapi::Bond_delete >, VOM::interface::delete_cmd< vapi::Vxlan_add_del_tunnel >, VOM::interface::delete_cmd< vapi::Delete_subif >, VOM::interface::delete_cmd< vapi::Delete_vhost_user_if >, VOM::interface::delete_cmd< vapi::Tap_delete >, VOM::interface::delete_cmd< vapi::Delete_loopback >, VOM::interface::create_cmd< MSG >, VOM::interface::create_cmd< vapi::Create_vhost_user_if >, VOM::interface::create_cmd< vapi::Af_packet_create >, VOM::interface::create_cmd< vapi::Bond_create >, VOM::interface::create_cmd< vapi::Vxlan_add_del_tunnel >, VOM::interface::create_cmd< vapi::Tap_connect >, VOM::interface::create_cmd< vapi::Create_loopback >, VOM::interface::create_cmd< vapi::Create_vlan_subif >, and VOM::ACL::list_cmds::update_cmd< RULE, UPDATE >.
Definition at line 108 of file rpc_cmd.hpp.
|
inline |
Wait on the commands promise.
i.e. block on the completion of the command.
Definition at line 89 of file rpc_cmd.hpp.
|
protected |
A reference to an object's HW::item that the command will update.
Definition at line 135 of file rpc_cmd.hpp.
|
protected |
The promise that implements the synchronous issue.
Definition at line 140 of file rpc_cmd.hpp.