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

#include <sandesh_client_sm_priv.h>

Inheritance diagram for SandeshClientSMImpl:
Collaboration diagram for SandeshClientSMImpl:

Classes

struct  EventContainer
 

Public Member Functions

 SandeshClientSMImpl (EventManager *evm, Mgr *mgr, int sm_task_instance, int sm_task_id, bool periodicuve)
 
virtual ~SandeshClientSMImpl ()
 
Mgr *const GetMgr ()
 
void set_session (SandeshSession *session, bool enq=true)
 
bool send_session (Sandesh *snh)
 
void SetAdminState (bool down)
 
void SetCollectors (const std::vector< TcpServer::Endpoint > &collectors)
 
void GetCollectors (std::vector< TcpServer::Endpoint > &collectors)
 
TcpServer::Endpoint GetCollector () const
 
TcpServer::Endpoint GetNextCollector ()
 
bool SendSandeshUVE (Sandesh *snh)
 
bool SendSandesh (Sandesh *snh)
 
void EnqueDelSession (SandeshSession *session)
 
void OnSessionEvent (TcpSession *session, TcpSession::Event event)
 
bool OnMessage (SandeshSession *session, const std::string &msg)
 
template<class Ev >
void OnIdle (const Ev &event)
 
template<class Ev >
void ReleaseSandesh (const Ev &event)
 
template<class Ev >
void DeleteTcpSession (const Ev &event)
 
void StartConnectTimer (int seconds)
 
void CancelConnectTimer ()
 
bool ConnectTimerRunning ()
 
void FireConnectTimer ()
 
void StartIdleHoldTimer ()
 
void CancelIdleHoldTimer ()
 
bool IdleHoldTimerRunning ()
 
void IdleHoldTimerFired ()
 
bool CollectorUpdate (const std::vector< TcpServer::Endpoint > &collectors)
 
bool CollectorChange ()
 
int GetConnectTime () const
 
const std::string & StateName () const
 
const std::string & StateName (SandeshClientSM::State state) const
 
const std::string & LastStateName () const
 
void set_state (State state)
 
State get_state () const
 
int connects_inc ()
 
int connects () const
 
void connect_attempts_inc ()
 
void connect_attempts_clear ()
 
int idle_hold_time () const
 
void reset_idle_hold_time ()
 
void set_idle_hold_time (int idle_hold_time)
 
void set_last_event (const std::string &event)
 
const std::string last_event () const
 
void reset_last_info ()
 
void set_collector_name (const std::string &cname)
 
std::string collector_name ()
 
void unconsumed_event (const sc::event_base &event)
 
void SendUVE ()
 
- Public Member Functions inherited from SandeshClientSM
State state () const
 
SandeshSessionsession ()
 
TcpServer::Endpoint server ()
 
virtual ~SandeshClientSM ()
 

Static Public Attributes

static const int kConnectInterval = 30
 
static const int kIdleHoldTime = 5000
 
- Static Public Attributes inherited from SandeshClientSM
static const int kTickInterval = 30000
 

Private Member Functions

void StartStatisticsTimer ()
 
bool StatisticsTimerExpired ()
 
void TimerErrorHanlder (std::string name, std::string error)
 
bool ConnectTimerExpired ()
 
bool IdleHoldTimerExpired ()
 
template<typename Ev >
void Enqueue (const Ev &event)
 
bool DequeueEvent (EventContainer ec)
 
void UpdateEventDequeue (const sc::event_base &event)
 
void UpdateEventDequeueFail (const sc::event_base &event)
 
void UpdateEventEnqueue (const sc::event_base &event)
 
void UpdateEventEnqueueFail (const sc::event_base &event)
 
void UpdateEventStats (const sc::event_base &event, bool enqueue, bool fail)
 
 DISALLOW_COPY_AND_ASSIGN (SandeshClientSMImpl)
 

Private Attributes

std::vector< TcpServer::Endpointcollectors_
 
int collector_index_
 
TcpServer::Endpoint active_
 
WorkQueue< EventContainerwork_queue_
 
Timerconnect_timer_
 
Timeridle_hold_timer_
 
Timerstatistics_timer_
 
int idle_hold_time_
 
int statistics_timer_interval_
 
bool periodicuve_
 
int attempts_
 
bool deleted_
 
bool in_dequeue_
 
int connects_
 
State last_state_
 
uint64_t state_since_
 
std::string last_event_
 
uint64_t last_event_at_
 
std::string coll_name_
 
tbb::mutex mutex_
 
std::string generator_key_
 
SandeshEventStatistics event_stats_
 

Static Private Attributes

static const int kStatisticsSendInterval = 30000
 

Friends

class SandeshClientStateMachineTest
 

Additional Inherited Members

- Public Types inherited from SandeshClientSM
enum  State {
  IDLE = 0, DISCONNECT = 1, CONNECT = 2, CLIENT_INIT = 3,
  ESTABLISHED = 4
}
 
- Static Public Member Functions inherited from SandeshClientSM
static SandeshClientSMCreateClientSM (EventManager *evm, Mgr *mgr, int sm_task_instance, int sm_task_id, bool periodicuve)
 
- Protected Member Functions inherited from SandeshClientSM
 SandeshClientSM (Mgr *mgr)
 
void set_session (SandeshSession *session, bool enq)
 
bool send_session (Sandesh *snh)
 
void set_server (TcpServer::Endpoint e)
 
- Protected Attributes inherited from SandeshClientSM
Mgr *const mgr_
 
tbb::atomic< Statestate_
 

Detailed Description

Definition at line 42 of file sandesh_client_sm_priv.h.

Constructor & Destructor Documentation

SandeshClientSMImpl::SandeshClientSMImpl ( EventManager evm,
Mgr mgr,
int  sm_task_instance,
int  sm_task_id,
bool  periodicuve 
)

Definition at line 898 of file sandesh_client_sm.cc.

Here is the call graph for this function:

SandeshClientSMImpl::~SandeshClientSMImpl ( )
virtual

Definition at line 921 of file sandesh_client_sm.cc.

Here is the call graph for this function:

Member Function Documentation

void SandeshClientSMImpl::CancelConnectTimer ( )

Definition at line 660 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::CancelIdleHoldTimer ( )

Definition at line 677 of file sandesh_client_sm.cc.

Here is the call graph for this function:

std::string SandeshClientSMImpl::collector_name ( )
inline

Definition at line 136 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::CollectorChange ( )

Definition at line 1049 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::CollectorUpdate ( const std::vector< TcpServer::Endpoint > &  collectors)

Definition at line 1035 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::connect_attempts_clear ( )
inline

Definition at line 113 of file sandesh_client_sm_priv.h.

void SandeshClientSMImpl::connect_attempts_inc ( )
inline

Definition at line 112 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::connects ( ) const
inline

Definition at line 111 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::connects_inc ( )
inline

Definition at line 110 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::ConnectTimerExpired ( )
private

Definition at line 704 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::ConnectTimerRunning ( )

Definition at line 664 of file sandesh_client_sm.cc.

Here is the call graph for this function:

template<class Ev >
void SandeshClientSMImpl::DeleteTcpSession ( const Ev &  event)

Definition at line 650 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::DequeueEvent ( SandeshClientSMImpl::EventContainer  ec)
private

Definition at line 832 of file sandesh_client_sm.cc.

Here is the call graph for this function:

SandeshClientSMImpl::DISALLOW_COPY_AND_ASSIGN ( SandeshClientSMImpl  )
private
void SandeshClientSMImpl::EnqueDelSession ( SandeshSession session)
virtual

Implements SandeshClientSM.

Definition at line 622 of file sandesh_client_sm.cc.

Here is the call graph for this function:

template<typename Ev >
void SandeshClientSMImpl::Enqueue ( const Ev &  event)
private

Definition at line 882 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::FireConnectTimer ( )

Definition at line 688 of file sandesh_client_sm.cc.

Here is the call graph for this function:

State SandeshClientSMImpl::get_state ( ) const
inline

Definition at line 108 of file sandesh_client_sm_priv.h.

TcpServer::Endpoint SandeshClientSMImpl::GetCollector ( ) const

Definition at line 1018 of file sandesh_client_sm.cc.

void SandeshClientSMImpl::GetCollectors ( std::vector< TcpServer::Endpoint > &  collectors)

Definition at line 1013 of file sandesh_client_sm.cc.

int SandeshClientSMImpl::GetConnectTime ( ) const

Definition at line 803 of file sandesh_client_sm.cc.

Mgr* const SandeshClientSMImpl::GetMgr ( )
inline

Definition at line 53 of file sandesh_client_sm_priv.h.

TcpServer::Endpoint SandeshClientSMImpl::GetNextCollector ( )

Definition at line 1025 of file sandesh_client_sm.cc.

int SandeshClientSMImpl::idle_hold_time ( ) const
inline

Definition at line 114 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::IdleHoldTimerExpired ( )
private

Definition at line 713 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::IdleHoldTimerFired ( )

Definition at line 692 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::IdleHoldTimerRunning ( )

Definition at line 681 of file sandesh_client_sm.cc.

Here is the call graph for this function:

const std::string SandeshClientSMImpl::last_event ( ) const
inline

Definition at line 125 of file sandesh_client_sm_priv.h.

const string & SandeshClientSMImpl::LastStateName ( ) const

Definition at line 797 of file sandesh_client_sm.cc.

template<class Ev >
void SandeshClientSMImpl::OnIdle ( const Ev &  event)

Definition at line 627 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::OnMessage ( SandeshSession session,
const std::string &  msg 
)

Definition at line 757 of file sandesh_client_sm.cc.

Here is the call graph for this function:

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

Definition at line 718 of file sandesh_client_sm.cc.

Here is the call graph for this function:

template<class Ev >
void SandeshClientSMImpl::ReleaseSandesh ( const Ev &  event)

Definition at line 637 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::reset_idle_hold_time ( )
inline

Definition at line 115 of file sandesh_client_sm_priv.h.

void SandeshClientSMImpl::reset_last_info ( )
inline

Definition at line 129 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::send_session ( Sandesh snh)
inline

Definition at line 57 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

bool SandeshClientSMImpl::SendSandesh ( Sandesh snh)
virtual

Implements SandeshClientSM.

Definition at line 752 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::SendSandeshUVE ( Sandesh snh)
virtual

Implements SandeshClientSM.

Definition at line 747 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::SendUVE ( )
inline

Definition at line 139 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

void SandeshClientSMImpl::set_collector_name ( const std::string &  cname)
inline

Definition at line 135 of file sandesh_client_sm_priv.h.

void SandeshClientSMImpl::set_idle_hold_time ( int  idle_hold_time)
inline

Definition at line 116 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

void SandeshClientSMImpl::set_last_event ( const std::string &  event)
inline

Definition at line 120 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

void SandeshClientSMImpl::set_session ( SandeshSession session,
bool  enq = true 
)
inline

Definition at line 54 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

void SandeshClientSMImpl::set_state ( State  state)
inline

Definition at line 103 of file sandesh_client_sm_priv.h.

Here is the call graph for this function:

void SandeshClientSMImpl::SetAdminState ( bool  down)
virtual

Implements SandeshClientSM.

Definition at line 611 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::SetCollectors ( const std::vector< TcpServer::Endpoint > &  collectors)
virtual

Implements SandeshClientSM.

Definition at line 1008 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::StartConnectTimer ( int  seconds)

Definition at line 654 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::StartIdleHoldTimer ( )

Definition at line 668 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::StartStatisticsTimer ( )
private

Definition at line 959 of file sandesh_client_sm.cc.

Here is the call graph for this function:

const string & SandeshClientSMImpl::StateName ( ) const
virtual

Implements SandeshClientSM.

Definition at line 793 of file sandesh_client_sm.cc.

const string & SandeshClientSMImpl::StateName ( SandeshClientSM::State  state) const

Definition at line 788 of file sandesh_client_sm.cc.

Here is the call graph for this function:

bool SandeshClientSMImpl::StatisticsTimerExpired ( )
private

Definition at line 966 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::TimerErrorHanlder ( std::string  name,
std::string  error 
)
private

Definition at line 699 of file sandesh_client_sm.cc.

void SandeshClientSMImpl::unconsumed_event ( const sc::event_base &  event)

Definition at line 854 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::UpdateEventDequeue ( const sc::event_base &  event)
private

Definition at line 812 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::UpdateEventDequeueFail ( const sc::event_base &  event)
private

Definition at line 820 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::UpdateEventEnqueue ( const sc::event_base &  event)
private

Definition at line 808 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::UpdateEventEnqueueFail ( const sc::event_base &  event)
private

Definition at line 816 of file sandesh_client_sm.cc.

Here is the call graph for this function:

void SandeshClientSMImpl::UpdateEventStats ( const sc::event_base &  event,
bool  enqueue,
bool  fail 
)
private

Definition at line 824 of file sandesh_client_sm.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class SandeshClientStateMachineTest
friend

Definition at line 187 of file sandesh_client_sm_priv.h.

Member Data Documentation

TcpServer::Endpoint SandeshClientSMImpl::active_
private

Definition at line 166 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::attempts_
private

Definition at line 174 of file sandesh_client_sm_priv.h.

std::string SandeshClientSMImpl::coll_name_
private

Definition at line 182 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::collector_index_
private

Definition at line 165 of file sandesh_client_sm_priv.h.

std::vector<TcpServer::Endpoint> SandeshClientSMImpl::collectors_
private

Definition at line 164 of file sandesh_client_sm_priv.h.

Timer* SandeshClientSMImpl::connect_timer_
private

Definition at line 168 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::connects_
private

Definition at line 177 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::deleted_
private

Definition at line 175 of file sandesh_client_sm_priv.h.

SandeshEventStatistics SandeshClientSMImpl::event_stats_
private

Definition at line 185 of file sandesh_client_sm_priv.h.

std::string SandeshClientSMImpl::generator_key_
private

Definition at line 184 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::idle_hold_time_
private

Definition at line 171 of file sandesh_client_sm_priv.h.

Timer* SandeshClientSMImpl::idle_hold_timer_
private

Definition at line 169 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::in_dequeue_
private

Definition at line 176 of file sandesh_client_sm_priv.h.

const int SandeshClientSMImpl::kConnectInterval = 30
static

Definition at line 46 of file sandesh_client_sm_priv.h.

const int SandeshClientSMImpl::kIdleHoldTime = 5000
static

Definition at line 47 of file sandesh_client_sm_priv.h.

const int SandeshClientSMImpl::kStatisticsSendInterval = 30000
staticprivate

Definition at line 144 of file sandesh_client_sm_priv.h.

std::string SandeshClientSMImpl::last_event_
private

Definition at line 180 of file sandesh_client_sm_priv.h.

uint64_t SandeshClientSMImpl::last_event_at_
private

Definition at line 181 of file sandesh_client_sm_priv.h.

State SandeshClientSMImpl::last_state_
private

Definition at line 178 of file sandesh_client_sm_priv.h.

tbb::mutex SandeshClientSMImpl::mutex_
mutableprivate

Definition at line 183 of file sandesh_client_sm_priv.h.

bool SandeshClientSMImpl::periodicuve_
private

Definition at line 173 of file sandesh_client_sm_priv.h.

uint64_t SandeshClientSMImpl::state_since_
private

Definition at line 179 of file sandesh_client_sm_priv.h.

Timer* SandeshClientSMImpl::statistics_timer_
private

Definition at line 170 of file sandesh_client_sm_priv.h.

int SandeshClientSMImpl::statistics_timer_interval_
private

Definition at line 172 of file sandesh_client_sm_priv.h.

WorkQueue<EventContainer> SandeshClientSMImpl::work_queue_
private

Definition at line 167 of file sandesh_client_sm_priv.h.


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