OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KSyncSockTcp Class Reference

#include <ksync_sock.h>

Inheritance diagram for KSyncSockTcp:
Collaboration diagram for KSyncSockTcp:

Public Member Functions

 KSyncSockTcp (EventManager *evm, boost::asio::ip::address ip_addr, int port)
 
virtual ~KSyncSockTcp ()
 
virtual uint32_t GetSeqno (char *data)
 
virtual bool IsMoreData (char *data)
 
virtual bool BulkDecoder (char *data, KSyncBulkSandeshContext *ctxt)
 
virtual bool Decoder (char *data, AgentSandeshContext *ctxt)
 
virtual bool Validate (char *data)
 
virtual void AsyncReceive (boost::asio::mutable_buffers_1, HandlerCb)
 
virtual void AsyncSendTo (KSyncBufferList *iovec, uint32_t seq_no, HandlerCb cb)
 
virtual std::size_t SendTo (KSyncBufferList *iovec, uint32_t seq_no)
 
virtual void Receive (boost::asio::mutable_buffers_1)
 
virtual TcpSessionAllocSession (Socket *socket)
 
virtual bool Run (void)
 
bool ReceiveMsg (const u_int8_t *msg, size_t size)
 
void OnSessionEvent (TcpSession *session, TcpSession::Event event)
 
bool connect_complete () const
 
void AsyncReadStart ()
 
- Public Member Functions inherited from KSyncSock
 KSyncSock ()
 
virtual ~KSyncSock ()
 
void SendAsync (KSyncEntry *entry, int msg_len, char *msg, KSyncEntry::KSyncEvent event)
 
std::size_t BlockingSend (char *msg, int msg_len)
 
bool BlockingRecv ()
 
void GenericSend (IoContext *ctx)
 
uint32_t AllocSeqNo (IoContext::Type type)
 
uint32_t AllocSeqNo (IoContext::Type type, uint32_t instance)
 
KSyncReceiveQueueGetReceiveQueue (IoContext::Type type, uint32_t instance)
 
KSyncReceiveQueueGetReceiveQueue (uint32_t seqno)
 
KSyncBulkMsgContextLocateBulkContext (uint32_t seqno, IoContext::Type io_context_type, uint32_t work_queue_index)
 
int SendBulkMessage (KSyncBulkMsgContext *bulk_context, uint32_t seqno)
 
bool TryAddToBulk (KSyncBulkMsgContext *bulk_context, IoContext *ioc)
 
void OnEmptyQueue (bool done)
 
int tx_count () const
 
const KSyncTxQueuesend_queue () const
 
const KSyncReceiveQueueget_receive_work_queue (uint16_t index) const
 
KSyncReceiveQueueAllocQueue (KSyncBulkSandeshContext ctxt[], uint32_t task_id, uint32_t instance, const char *name)
 
uint32_t WaitTreeSize () const
 
void SetSeqno (uint32_t seq)
 
void SetMeasureQueueDelay (bool val)
 
void reset_use_wait_tree ()
 
void set_process_data_inline ()
 
void EnqueueRxProcessData (KSyncEntry *entry, KSyncEntry::KSyncEvent event)
 
- Public Member Functions inherited from TcpServer
 TcpServer (EventManager *evm)
 
virtual ~TcpServer ()
 
virtual bool Initialize (unsigned short port)
 
virtual bool Initialize (unsigned short port, const IpAddress &host_ip, int intf_id=-1)
 
bool InitializeInternal (boost::asio::ip::tcp::endpoint localaddr)
 
const std::string ToString () const
 
void SetAcceptor ()
 
void ResetAcceptor ()
 
void Shutdown ()
 
void ClearSessions ()
 
void UpdateSessionsDscp (uint8_t dscp)
 
virtual TcpSessionCreateSession ()
 
virtual void DeleteSession (TcpSession *session)
 
virtual void Connect (TcpSession *session, Endpoint remote)
 
virtual bool DisableSandeshLogMessages () const
 
int GetPort () const
 
const io::SocketStatsGetSocketStats () const
 
size_t GetSessionCount () const
 
EventManagerevent_manager ()
 
bool HasSessionReadAvailable () const
 
bool HasSessions () const
 
TcpSessionGetSession (Endpoint remote)
 
void WaitForEmpty ()
 
void GetRxSocketStats (SocketIOStats *socket_stats) const
 
void GetTxSocketStats (SocketIOStats *socket_stats) const
 
void GetRxSocketStats (SocketIOStats &socket_stats) const
 
void GetTxSocketStats (SocketIOStats &socket_stats) const
 
int SetMd5SocketOption (NativeSocketType fd, uint32_t peer_ip, const std::string &md5_password)
 
int SetListenSocketMd5Option (uint32_t peer_ip, const std::string &md5_password)
 
int SetDscpSocketOption (NativeSocketType fd, uint8_t value)
 
uint8_t GetDscpValue (NativeSocketType fd) const
 
int SetListenSocketDscp (uint8_t value)
 
int SetSocketOptions (const SandeshConfig &sandesh_config)
 
int SetKeepAliveSocketOption (int fd, const SandeshConfig &sandesh_config)
 

Static Public Member Functions

static void Init (EventManager *evm, boost::asio::ip::address ip_addr, int port, const std::string &cpu_pin_policy)
 
- Static Public Member Functions inherited from KSyncSock
static void Start (bool read_inline)
 
static void Shutdown ()
 
static KSyncSockGet (DBTablePartBase *partition)
 
static KSyncSockGet (int partition_id)
 
static uint32_t GetPid ()
 
static int GetNetlinkFamilyId ()
 
static void SetNetlinkFamilyId (int id)
 
static AgentSandeshContextGetAgentSandeshContext (uint32_t type)
 
static void SetAgentSandeshContext (AgentSandeshContext *ctx, uint32_t idx)
 

Private Attributes

EventManagerevm_
 
TcpSessionsession_
 
boost::asio::ip::tcp::endpoint server_ep_
 
boost::asio::ip::tcp::socket * tcp_socket_
 
bool connect_complete_
 
char * rx_buff_
 
char * rx_buff_rem_
 
size_t remain_
 

Additional Inherited Members

- Public Types inherited from KSyncSock
typedef std::map< uint32_t,
KSyncBulkMsgContext
WaitTree
 
typedef std::pair< uint32_t,
KSyncBulkMsgContext
WaitTreePair
 
typedef boost::function< void(const
boost::system::error_code
&, size_t)> 
HandlerCb
 
typedef WorkQueue< KSyncRxDataKSyncReceiveQueue
 
typedef WorkQueue
< KSyncRxQueueData
KSyncRxWorkQueue
 
- Public Types inherited from TcpServer
typedef
boost::asio::ip::tcp::endpoint 
Endpoint
 
typedef
boost::asio::ip::tcp::socket 
Socket
 
typedef
boost::asio::ip::tcp::socket::native_handle_type 
NativeSocketType
 
- Static Public Attributes inherited from KSyncSock
static const int kRxWorkQueueCount = 2
 
static const int kMsgGrowSize = 16
 
static const unsigned kBufLen = (4*1024)
 
static const unsigned kMaxBulkMsgCount = 16
 
static const unsigned kMaxBulkMsgSize = (4*1024)
 
static const unsigned kInvalidBulkSeqNo = 0xFFFFFFFF
 
- Protected Types inherited from TcpServer
typedef boost::intrusive_ptr
< TcpServer
TcpServerPtr
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 
- Protected Member Functions inherited from KSyncSock
bool ValidateAndEnqueue (char *data, KSyncBulkMsgContext *context)
 
KSyncBulkSandeshContextGetBulkSandeshContext (uint32_t seqno)
 
void ProcessDataInline (char *data)
 
- Protected Member Functions inherited from TcpServer
virtual TcpSessionAllocSession (bool server_session)
 
virtual Socketaccept_socket () const
 
virtual void set_accept_socket ()
 
virtual bool AcceptSession (TcpSession *session)
 
void set_socket_open_failure (bool flag)
 
bool socket_open_failure () const
 
Endpoint LocalEndpoint () const
 
virtual void AcceptHandlerComplete (TcpSessionPtr session)
 
virtual void ConnectHandlerComplete (TcpSessionPtr session)
 
- Static Protected Member Functions inherited from KSyncSock
static void Init (bool use_work_queue, const std::string &cpu_pin_policy)
 
static void SetSockTableEntry (KSyncSock *sock)
 
- Protected Attributes inherited from KSyncSock
tbb::mutex mutex_
 
nl_client * nl_client_
 
WaitTree wait_tree_
 
KSyncTxQueue send_queue_
 
KSyncReceiveQueueuve_rx_queue [kRxWorkQueueCount]
 
KSyncReceiveQueueksync_rx_queue [kRxWorkQueueCount]
 
uint32_t max_bulk_msg_count_
 
uint32_t max_bulk_buf_size_
 
uint32_t bulk_seq_no_
 
uint32_t bulk_buf_size_
 
uint32_t bulk_msg_count_
 
uint32_t bmca_prod_
 
uint32_t bmca_cons_
 
KSyncBulkMsgContextbulk_mctx_arr_ [KSYNC_BMC_ARR_SIZE]
 

Detailed Description

Definition at line 633 of file ksync_sock.h.

Constructor & Destructor Documentation

KSyncSockTcp::KSyncSockTcp ( EventManager evm,
boost::asio::ip::address  ip_addr,
int  port 
)

Definition at line 16 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

virtual KSyncSockTcp::~KSyncSockTcp ( )
inlinevirtual

Definition at line 637 of file ksync_sock.h.

Member Function Documentation

TcpSession * KSyncSockTcp::AllocSession ( Socket socket)
virtual

Implements TcpServer.

Definition at line 39 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

void KSyncSockTcp::AsyncReadStart ( )

Definition at line 253 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

void KSyncSockTcp::AsyncReceive ( boost::asio::mutable_buffers_1  ,
HandlerCb   
)
virtual

Implements KSyncSock.

Definition at line 113 of file ksync_sock_tcp.cc.

void KSyncSockTcp::AsyncSendTo ( KSyncBufferList iovec,
uint32_t  seq_no,
HandlerCb  cb 
)
virtual

Implements KSyncSock.

Definition at line 89 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::BulkDecoder ( char *  data,
KSyncBulkSandeshContext ctxt 
)
virtual

Implements KSyncSock.

Definition at line 104 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::connect_complete ( ) const
inline

Definition at line 654 of file ksync_sock.h.

bool KSyncSockTcp::Decoder ( char *  data,
AgentSandeshContext ctxt 
)
virtual

Implements KSyncSock.

Definition at line 99 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

uint32_t KSyncSockTcp::GetSeqno ( char *  data)
virtual

Implements KSyncSock.

Definition at line 46 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

void KSyncSockTcp::Init ( EventManager evm,
boost::asio::ip::address  ip_addr,
int  port,
const std::string &  cpu_pin_policy 
)
static

Definition at line 32 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::IsMoreData ( char *  data)
virtual

Implements KSyncSock.

Definition at line 50 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

void KSyncSockTcp::OnSessionEvent ( TcpSession session,
TcpSession::Event  event 
)

Definition at line 266 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

void KSyncSockTcp::Receive ( boost::asio::mutable_buffers_1  )
virtual

Implements KSyncSock.

Definition at line 118 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::ReceiveMsg ( const u_int8_t *  msg,
size_t  size 
)

Definition at line 166 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::Run ( void  )
virtual

Definition at line 173 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

size_t KSyncSockTcp::SendTo ( KSyncBufferList iovec,
uint32_t  seq_no 
)
virtual

Implements KSyncSock.

Definition at line 54 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

bool KSyncSockTcp::Validate ( char *  data)
virtual

Implements KSyncSock.

Definition at line 95 of file ksync_sock_tcp.cc.

Here is the call graph for this function:

Member Data Documentation

bool KSyncSockTcp::connect_complete_
private

Definition at line 667 of file ksync_sock.h.

EventManager* KSyncSockTcp::evm_
private

Definition at line 663 of file ksync_sock.h.

size_t KSyncSockTcp::remain_
private

Definition at line 670 of file ksync_sock.h.

char* KSyncSockTcp::rx_buff_
private

Definition at line 668 of file ksync_sock.h.

char* KSyncSockTcp::rx_buff_rem_
private

Definition at line 669 of file ksync_sock.h.

boost::asio::ip::tcp::endpoint KSyncSockTcp::server_ep_
private

Definition at line 665 of file ksync_sock.h.

TcpSession* KSyncSockTcp::session_
private

Definition at line 664 of file ksync_sock.h.

boost::asio::ip::tcp::socket* KSyncSockTcp::tcp_socket_
private

Definition at line 666 of file ksync_sock.h.


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