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

#include <sandesh_client.h>

Inheritance diagram for SandeshClient:
Collaboration diagram for SandeshClient:

Public Member Functions

 SandeshClient (EventManager *evm, const std::vector< Endpoint > &collectors, const SandeshConfig &config, bool periodicuve=false)
 
virtual ~SandeshClient ()
 
void Initiate ()
 
void Shutdown ()
 
virtual SandeshSessionCreateSMSession (SslSession::EventObserver eocb, SandeshReceiveMsgCb rmcb, TcpServer::Endpoint ep)
 
void InitializeSMSession (int connects)
 
void DeleteSMSession (SandeshSession *session)
 
bool CloseSMSession ()
 
bool ReceiveMsg (const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
 
void SendUVE (int count, const std::string &stateName, const std::string &server, const Endpoint &server_ip, const std::vector< Endpoint > &collector_eps)
 
bool SendSandesh (Sandesh *snh)
 
bool SendSandeshUVE (Sandesh *snh_uve)
 
SandeshClientSM::State state ()
 
bool IsSession ()
 
SandeshSessionsession () const
 
SandeshClientSMstate_machine () const
 
StatsClientstats_client () const
 
void SetDscpValue (uint8_t value)
 
uint8_t dscp_value () const
 
void SetSessionWaterMarkInfo (Sandesh::QueueWaterMarkInfo &scwm)
 
void ResetSessionWaterMarkInfo ()
 
void GetSessionWaterMarkInfo (std::vector< Sandesh::QueueWaterMarkInfo > &scwm_info) const
 
void ReConfigCollectors (const std::vector< std::string > &)
 
int session_close_interval_msec () const
 
uint64_t session_close_time_usec () const
 
- Public Member Functions inherited from SslServer
 SslServer (EventManager *evm, boost::asio::ssl::context::method m, bool ssl_enabled=true, bool ssl_handshake_delayed=false)
 
virtual ~SslServer ()
 
- 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)
 
- Public Member Functions inherited from SandeshClientSM::Mgr
virtual void SendUVE (int count, const std::string &stateName, const std::string &server, const TcpServer::Endpoint &server_ip, const std::vector< TcpServer::Endpoint > &collectors)=0
 

Static Public Attributes

static const int kInitialSMSessionCloseIntervalMSec = 10 * 1000
 
static const int kMaxSMSessionCloseIntervalMSec = 60 * 1000
 

Protected Member Functions

virtual SslSessionAllocSession (SslSocket *socket)
 
bool CloseSMSessionInternal ()
 
- Protected Member Functions inherited from SslServer
boost::asio::ssl::context * context ()
 
- Protected Member Functions inherited from TcpServer
virtual bool AcceptSession (TcpSession *session)
 
void set_socket_open_failure (bool flag)
 
bool socket_open_failure () const
 
Endpoint LocalEndpoint () const
 
- Protected Member Functions inherited from SandeshClientSM::Mgr
 Mgr ()
 
virtual ~Mgr ()
 

Private Member Functions

bool ReceiveCtrlMsg (const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
 
 DISALLOW_COPY_AND_ASSIGN (SandeshClient)
 

Private Attributes

int sm_task_instance_
 
int sm_task_id_
 
int session_task_instance_
 
int session_writer_task_id_
 
int session_reader_task_id_
 
uint8_t dscp_value_
 
std::vector< Endpointcollectors_
 
std::string stats_collector_
 
boost::scoped_ptr
< SandeshClientSM
sm_
 
boost::scoped_ptr< StatsClientstats_client_
 
std::vector
< Sandesh::QueueWaterMarkInfo
session_wm_info_
 
int session_close_interval_msec_
 
uint64_t session_close_time_usec_
 

Static Private Attributes

static const int kSMTaskInstance = 0
 
static const std::string kSMTask = "sandesh::SandeshClientSM"
 
static const int kSessionTaskInstance = Task::kTaskInstanceAny
 
static const std::string kSessionWriterTask = "sandesh::SandeshClientSession"
 
static const std::string kSessionReaderTask = "sandesh::SandeshClientReader"
 
static const std::vector
< Sandesh::QueueWaterMarkInfo
kSessionWaterMarkInfo
 
static bool task_policy_set_ = false
 

Friends

class CollectorInfoRequest
 

Additional Inherited Members

- Public Types inherited from SslServer
typedef
boost::asio::ssl::stream
< boost::asio::ip::tcp::socket > 
SslSocket
 
- 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
 
- Protected Types inherited from TcpServer
typedef boost::intrusive_ptr
< TcpServer
TcpServerPtr
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 

Detailed Description

Definition at line 42 of file sandesh_client.h.

Constructor & Destructor Documentation

SandeshClient::SandeshClient ( EventManager evm,
const std::vector< Endpoint > &  collectors,
const SandeshConfig config,
bool  periodicuve = false 
)

Definition at line 62 of file sandesh_client.cc.

Here is the call graph for this function:

SandeshClient::~SandeshClient ( )
virtual

Definition at line 151 of file sandesh_client.cc.

Member Function Documentation

SslSession * SandeshClient::AllocSession ( SslSocket socket)
protectedvirtual

Implements SslServer.

Definition at line 530 of file sandesh_client.cc.

bool SandeshClient::CloseSMSession ( )

Definition at line 381 of file sandesh_client.cc.

Here is the call graph for this function:

bool SandeshClient::CloseSMSessionInternal ( )
protected

Definition at line 330 of file sandesh_client.cc.

Here is the call graph for this function:

SandeshSession * SandeshClient::CreateSMSession ( SslSession::EventObserver  eocb,
SandeshReceiveMsgCb  rmcb,
TcpServer::Endpoint  ep 
)
virtual

Implements SandeshClientSM::Mgr.

Definition at line 275 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::DeleteSMSession ( SandeshSession session)
inlinevirtual

Implements SandeshClientSM::Mgr.

Definition at line 62 of file sandesh_client.h.

Here is the call graph for this function:

SandeshClient::DISALLOW_COPY_AND_ASSIGN ( SandeshClient  )
private
uint8_t SandeshClient::dscp_value ( ) const
inline

Definition at line 99 of file sandesh_client.h.

void SandeshClient::GetSessionWaterMarkInfo ( std::vector< Sandesh::QueueWaterMarkInfo > &  scwm_info) const

Definition at line 525 of file sandesh_client.cc.

void SandeshClient::InitializeSMSession ( int  connects)
virtual

Implements SandeshClientSM::Mgr.

Definition at line 312 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::Initiate ( )

Definition at line 169 of file sandesh_client.cc.

bool SandeshClient::IsSession ( )
inline

Definition at line 81 of file sandesh_client.h.

bool SandeshClient::ReceiveCtrlMsg ( const std::string &  msg,
const SandeshHeader &  header,
const std::string &  sandesh_name,
const uint32_t  header_offset 
)
private

Definition at line 190 of file sandesh_client.cc.

Here is the call graph for this function:

bool SandeshClient::ReceiveMsg ( const std::string &  msg,
const SandeshHeader &  header,
const std::string &  sandesh_name,
const uint32_t  header_offset 
)
virtual

Implements SandeshClientSM::Mgr.

Definition at line 221 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::ReConfigCollectors ( const std::vector< std::string > &  collector_list)

Definition at line 153 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::ResetSessionWaterMarkInfo ( )

Definition at line 517 of file sandesh_client.cc.

Here is the call graph for this function:

bool SandeshClient::SendSandesh ( Sandesh snh)

Definition at line 182 of file sandesh_client.cc.

bool SandeshClient::SendSandeshUVE ( Sandesh snh_uve)

Definition at line 186 of file sandesh_client.cc.

void SandeshClient::SendUVE ( int  count,
const std::string &  stateName,
const std::string &  server,
const Endpoint server_ip,
const std::vector< Endpoint > &  collector_eps 
)

Definition at line 397 of file sandesh_client.cc.

Here is the call graph for this function:

SandeshSession* SandeshClient::session ( ) const
inline

Definition at line 86 of file sandesh_client.h.

int SandeshClient::session_close_interval_msec ( ) const
inline

Definition at line 107 of file sandesh_client.h.

uint64_t SandeshClient::session_close_time_usec ( ) const
inline

Definition at line 110 of file sandesh_client.h.

void SandeshClient::SetDscpValue ( uint8_t  value)

Definition at line 536 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::SetSessionWaterMarkInfo ( Sandesh::QueueWaterMarkInfo scwm)

Definition at line 508 of file sandesh_client.cc.

Here is the call graph for this function:

void SandeshClient::Shutdown ( void  )

Definition at line 178 of file sandesh_client.cc.

SandeshClientSM::State SandeshClient::state ( )
inline

Definition at line 77 of file sandesh_client.h.

SandeshClientSM* SandeshClient::state_machine ( ) const
inline

Definition at line 90 of file sandesh_client.h.

StatsClient* SandeshClient::stats_client ( ) const
inlinevirtual

Implements SandeshClientSM::Mgr.

Definition at line 94 of file sandesh_client.h.

Friends And Related Function Documentation

friend class CollectorInfoRequest
friend

Definition at line 114 of file sandesh_client.h.

Member Data Documentation

std::vector<Endpoint> SandeshClient::collectors_
private

Definition at line 133 of file sandesh_client.h.

uint8_t SandeshClient::dscp_value_
private

Definition at line 132 of file sandesh_client.h.

const int SandeshClient::kInitialSMSessionCloseIntervalMSec = 10 * 1000
static

Definition at line 44 of file sandesh_client.h.

const int SandeshClient::kMaxSMSessionCloseIntervalMSec = 60 * 1000
static

Definition at line 45 of file sandesh_client.h.

const std::string SandeshClient::kSessionReaderTask = "sandesh::SandeshClientReader"
staticprivate

Definition at line 124 of file sandesh_client.h.

const int SandeshClient::kSessionTaskInstance = Task::kTaskInstanceAny
staticprivate

Definition at line 122 of file sandesh_client.h.

const std::vector< Sandesh::QueueWaterMarkInfo > SandeshClient::kSessionWaterMarkInfo
staticprivate
Initial value:
= boost::assign::tuple_list_of
(50*1024*1024, SandeshLevel::SYS_UVE, true, false)
(30*1024*1024, SandeshLevel::SYS_EMERG, true, false)
(20*1024*1024, SandeshLevel::SYS_ERR, true, false)
(1*1024*1024, SandeshLevel::SYS_DEBUG, true, false)
(35*1024*1024, SandeshLevel::SYS_EMERG, false, false)
(25*1024*1024, SandeshLevel::SYS_ERR, false, false)
(15*1024*1024, SandeshLevel::SYS_DEBUG, false, false)
(2*1024, SandeshLevel::INVALID, false, false)

Definition at line 125 of file sandesh_client.h.

const std::string SandeshClient::kSessionWriterTask = "sandesh::SandeshClientSession"
staticprivate

Definition at line 123 of file sandesh_client.h.

const std::string SandeshClient::kSMTask = "sandesh::SandeshClientSM"
staticprivate

Definition at line 121 of file sandesh_client.h.

const int SandeshClient::kSMTaskInstance = 0
staticprivate

Definition at line 120 of file sandesh_client.h.

int SandeshClient::session_close_interval_msec_
private

Definition at line 139 of file sandesh_client.h.

uint64_t SandeshClient::session_close_time_usec_
private

Definition at line 140 of file sandesh_client.h.

int SandeshClient::session_reader_task_id_
private

Definition at line 131 of file sandesh_client.h.

int SandeshClient::session_task_instance_
private

Definition at line 129 of file sandesh_client.h.

std::vector<Sandesh::QueueWaterMarkInfo> SandeshClient::session_wm_info_
private

Definition at line 137 of file sandesh_client.h.

int SandeshClient::session_writer_task_id_
private

Definition at line 130 of file sandesh_client.h.

boost::scoped_ptr<SandeshClientSM> SandeshClient::sm_
private

Definition at line 135 of file sandesh_client.h.

int SandeshClient::sm_task_id_
private

Definition at line 128 of file sandesh_client.h.

int SandeshClient::sm_task_instance_
private

Definition at line 127 of file sandesh_client.h.

boost::scoped_ptr<StatsClient> SandeshClient::stats_client_
private

Definition at line 136 of file sandesh_client.h.

std::string SandeshClient::stats_collector_
private

Definition at line 134 of file sandesh_client.h.

bool SandeshClient::task_policy_set_ = false
staticprivate

Definition at line 138 of file sandesh_client.h.


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