FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
vapi::Connection Class Reference

Class representing a connection to VPP. More...

Public Member Functions

 Connection (void)
 
 Connection (const Connection &)=delete
 
 ~Connection (void)
 
bool is_msg_available (vapi_msg_id_t type)
 check if message identified by it's message id is known by the vpp to which the connection is open More...
 
vapi_error_e connect (const char *name, const char *chroot_prefix, int max_outstanding_requests, int response_queue_size, bool handle_keepalives=true)
 connect to vpp More...
 
vapi_error_e disconnect ()
 disconnect from vpp More...
 
vapi_error_e get_fd (int *fd)
 get event file descriptor More...
 
vapi_error_e dispatch (const Common_req *limit=nullptr, u32 time=5)
 wait for responses from vpp and assign them to appropriate objects More...
 
vapi_error_e dispatch (const Common_req &limit)
 convenience wrapper function More...
 
vapi_error_e wait_for_response (const Common_req &req)
 wait for response to a specific request More...
 

Friends

template<typename Req , typename Resp , typename... Args>
class Request
 
template<typename Req , typename Resp , typename... Args>
class Dump
 
template<typename M >
class Result_set
 
template<typename M >
class Event_registration
 
template<typename M >
class Msg
 
template<typename M , typename... Args>
Mvapi_alloc (Connection &con, Args...)
 

Detailed Description

Class representing a connection to VPP.

After creating a Connection object, call connect() to actually connect to VPP. Use is_msg_available to discover whether a specific message is known and supported by the VPP connected to.

Definition at line 153 of file vapi.hpp.

Constructor & Destructor Documentation

◆ Connection() [1/2]

vapi::Connection::Connection ( void  )
inline

Definition at line 156 of file vapi.hpp.

+ Here is the call graph for this function:

◆ Connection() [2/2]

vapi::Connection::Connection ( const Connection )
delete

◆ ~Connection()

vapi::Connection::~Connection ( void  )
inline

Definition at line 172 of file vapi.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ connect()

vapi_error_e vapi::Connection::connect ( const char *  name,
const char *  chroot_prefix,
int  max_outstanding_requests,
int  response_queue_size,
bool  handle_keepalives = true 
)
inline

connect to vpp

Parameters
nameapplication name
chroot_prefixshared memory prefix
max_queued_requestmax number of outstanding requests queued
handle_keepaliveshandle memclnt_keepalive automatically
Returns
VAPI_OK on success, other error code on error

Definition at line 202 of file vapi.hpp.

+ Here is the call graph for this function:

◆ disconnect()

vapi_error_e vapi::Connection::disconnect ( )
inline

disconnect from vpp

Returns
VAPI_OK on success, other error code on error

Definition at line 216 of file vapi.hpp.

+ Here is the call graph for this function:

◆ dispatch() [1/2]

vapi_error_e vapi::Connection::dispatch ( const Common_req limit = nullptr,
u32  time = 5 
)
inline

wait for responses from vpp and assign them to appropriate objects

Parameters
limitstop dispatch after the limit object received it's response
Returns
VAPI_OK on success, other error code on error

Definition at line 250 of file vapi.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dispatch() [2/2]

vapi_error_e vapi::Connection::dispatch ( const Common_req limit)
inline

convenience wrapper function

Definition at line 322 of file vapi.hpp.

◆ get_fd()

vapi_error_e vapi::Connection::get_fd ( int *  fd)
inline

get event file descriptor

Note
this file descriptor becomes readable when messages (from vpp) are waiting in queue
Parameters
[out]fdpointer to result variable
Returns
VAPI_OK on success, other error code on error

Definition at line 238 of file vapi.hpp.

+ Here is the call graph for this function:

◆ is_msg_available()

bool vapi::Connection::is_msg_available ( vapi_msg_id_t  type)
inline

check if message identified by it's message id is known by the vpp to which the connection is open

Definition at line 187 of file vapi.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wait_for_response()

vapi_error_e vapi::Connection::wait_for_response ( const Common_req req)
inline

wait for response to a specific request

Parameters
reqrequest to wait for response for
Returns
VAPI_OK on success, other error code on error

Definition at line 334 of file vapi.hpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ Dump

template<typename Req , typename Resp , typename... Args>
friend class Dump
friend

Definition at line 452 of file vapi.hpp.

◆ Event_registration

template<typename M >
friend class Event_registration
friend

Definition at line 456 of file vapi.hpp.

◆ Msg

template<typename M >
friend class Msg
friend

Definition at line 461 of file vapi.hpp.

◆ Request

template<typename Req , typename Resp , typename... Args>
friend class Request
friend

Definition at line 450 of file vapi.hpp.

◆ Result_set

template<typename M >
friend class Result_set
friend

Definition at line 454 of file vapi.hpp.

◆ vapi_alloc

template<typename M , typename... Args>
M* vapi_alloc ( Connection con,
Args...   
)
friend

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