FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
VOM::rpc_cmd< HWITEM, MSG > Class Template Reference

A base class for all RPC commands to VPP. More...

+ Inheritance diagram for VOM::rpc_cmd< HWITEM, MSG >:
+ Collaboration diagram for VOM::rpc_cmd< HWITEM, MSG >:

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 HWITEM &d)
 Fulfill the commands promise. More...
 
rc_t 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< HWITEM > m_promise
 The promise that implements the synchronous issue. More...
 

Detailed Description

template<typename HWITEM, typename MSG>
class VOM::rpc_cmd< HWITEM, MSG >

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.

Member Typedef Documentation

template<typename HWITEM, typename MSG>
typedef MSG VOM::rpc_cmd< HWITEM, MSG >::msg_t

convenient typedef

Definition at line 44 of file rpc_cmd.hpp.

Constructor & Destructor Documentation

template<typename HWITEM, typename MSG>
VOM::rpc_cmd< HWITEM, MSG >::rpc_cmd ( HWITEM &  item)
inline

Constructor taking the HW item that will be updated by the command.

Definition at line 49 of file rpc_cmd.hpp.

template<typename HWITEM, typename MSG>
virtual VOM::rpc_cmd< HWITEM, MSG >::~rpc_cmd ( )
inlinevirtual

Desructor.

Definition at line 59 of file rpc_cmd.hpp.

Member Function Documentation

template<typename HWITEM, typename MSG>
void VOM::rpc_cmd< HWITEM, MSG >::fulfill ( const HWITEM &  d)
inline

Fulfill the commands promise.

Called from the RX thread

Definition at line 74 of file rpc_cmd.hpp.

+ Here is the caller graph for this function:

template<typename HWITEM, typename MSG>
HWITEM& VOM::rpc_cmd< HWITEM, MSG >::item ( )
inline

return the HW item the command updates

Definition at line 64 of file rpc_cmd.hpp.

+ Here is the caller graph for this function:

template<typename HWITEM, typename MSG>
const HWITEM& VOM::rpc_cmd< HWITEM, MSG >::item ( ) const
inline

return the const HW item the command updates

Definition at line 69 of file rpc_cmd.hpp.

template<typename HWITEM, typename MSG>
rc_t VOM::rpc_cmd< HWITEM, MSG >::wait ( )
inline

Wait on the commands promise.

i.e. block on the completion of the command.

Definition at line 80 of file rpc_cmd.hpp.

Field Documentation

template<typename HWITEM, typename MSG>
HWITEM& VOM::rpc_cmd< HWITEM, MSG >::m_hw_item
protected

A reference to an object's HW::item that the command will update.

Definition at line 132 of file rpc_cmd.hpp.

template<typename HWITEM, typename MSG>
std::promise<HWITEM> VOM::rpc_cmd< HWITEM, MSG >::m_promise
protected

The promise that implements the synchronous issue.

Definition at line 137 of file rpc_cmd.hpp.


The documentation for this class was generated from the following file: