FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
VOM::rpc_cmd< HWITEM, DATA, MSG > Class Template Reference

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

+ Inheritance diagram for VOM::rpc_cmd< HWITEM, DATA, MSG >:
+ Collaboration diagram for VOM::rpc_cmd< HWITEM, DATA, 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 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...
 

Detailed Description

template<typename HWITEM, typename DATA, typename MSG>
class VOM::rpc_cmd< HWITEM, DATA, 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 DATA, typename MSG>
typedef MSG VOM::rpc_cmd< HWITEM, DATA, MSG >::msg_t

convenient typedef

Definition at line 44 of file rpc_cmd.hpp.

Constructor & Destructor Documentation

template<typename HWITEM, typename DATA, typename MSG>
VOM::rpc_cmd< HWITEM, DATA, 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 DATA, typename MSG>
virtual VOM::rpc_cmd< HWITEM, DATA, MSG >::~rpc_cmd ( )
inlinevirtual

Desructor.

Definition at line 59 of file rpc_cmd.hpp.

Member Function Documentation

template<typename HWITEM, typename DATA, typename MSG>
void VOM::rpc_cmd< HWITEM, DATA, MSG >::fulfill ( const DATA &  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 DATA, typename MSG>
HWITEM& VOM::rpc_cmd< HWITEM, DATA, 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 DATA, typename MSG>
const HWITEM& VOM::rpc_cmd< HWITEM, DATA, 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 DATA, typename MSG>
virtual vapi_error_e VOM::rpc_cmd< HWITEM, DATA, MSG >::operator() ( MSG &  reply)
inlinevirtual
template<typename HWITEM, typename DATA, typename MSG>
DATA VOM::rpc_cmd< HWITEM, DATA, MSG >::wait ( )
inline

Wait on the commands promise.

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

Definition at line 89 of file rpc_cmd.hpp.

Field Documentation

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

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

Definition at line 131 of file rpc_cmd.hpp.

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

The promise that implements the synchronous issue.

Definition at line 136 of file rpc_cmd.hpp.


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