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

#include <xmpp_state_machine.h>

Inheritance diagram for XmppStateMachine:
Collaboration diagram for XmppStateMachine:

Public Member Functions

 XmppStateMachine (XmppConnection *connection, bool active, bool auth_enabled=false, int config_hold_time=kHoldTime)
 
 ~XmppStateMachine ()
 
void Initialize ()
 
void Clear ()
 
void SetAdminState (bool down)
 
void OnStart (const xmsm::EvStart &event)
 
virtual void StartConnectTimer (int seconds)
 
void CancelConnectTimer ()
 
virtual void StartOpenTimer (int seconds)
 
void CancelOpenTimer ()
 
int GetConfiguredHoldTime () const
 
virtual void StartHoldTimer ()
 
void CancelHoldTimer ()
 
void ResetSession ()
 
bool IsAuthEnabled ()
 
void TimerErrorHandler (std::string name, std::string error)
 
virtual void OnSessionEvent (TcpSession *session, TcpSession::Event event)
 
bool PassiveOpen (XmppSession *session)
 
void OnMessage (XmppSession *session, const XmppStanza::XmppMessage *msg)
 
void ProcessMessage (XmppSession *session, const XmppStanza::XmppMessage *msg)
 
void OnEvent (SslSession *session, xmsm::SslHandShakeResponse)
 
void AssignSession ()
 
int GetConnectTime () const
 
void SetHandShakeCbHandler (SslHandShakeCallbackHandler cb)
 
SslHandShakeCallbackHandler HandShakeCbHandler ()
 
std::string StateName () const
 
std::string LastStateName () const
 
std::string LastStateChangeAt () const
 
xmsm::XmState StateType () const
 
xmsm::XmOpenConfirmState OpenConfirmStateType () const
 
XmppConnectionconnection ()
 
void set_connection (const XmppConnection *connection)
 
void SwapXmppConnection (XmppStateMachine *other)
 
bool IsActiveChannel ()
 
bool logUVE ()
 
const char * ChannelType ()
 
void set_session (TcpSession *session)
 
void clear_session ()
 
void DeleteSession (XmppSession *session)
 
XmppSessionsession ()
 
void RemoveSession ()
 
void set_state (xmsm::XmState state)
 
xmsm::XmState get_state ()
 
void set_openconfirm_state (xmsm::XmOpenConfirmState state)
 
xmsm::XmOpenConfirmState get_openconfirm_state ()
 
void connect_attempts_inc ()
 
void connect_attempts_clear ()
 
int get_connect_attempts () const
 
void keepalive_count_inc ()
 
void keepalive_count_clear ()
 
int get_keepalive_count () const
 
int hold_time () const
 
virtual int hold_time_msecs () const
 
void set_hold_time (int hold_time)
 
void unconsumed_event (const sc::event_base &event)
 
void SendConnectionInfo (const std::string &event, const std::string &nextstate="")
 
void SendConnectionInfo (XmppConnectionInfo *info, const std::string &event, const std::string &nextstate="")
 
void ResurrectOldConnection (XmppConnection *connection, XmppSession *session)
 
void set_last_event (const std::string &event)
 
void update_last_event (const std::string &event)
 
const std::string last_event () const
 
bool ConnectTimerCancelled ()
 
bool OpenTimerCancelled ()
 
bool HoldTimerCancelled ()
 
void AssertOnHoldTimeout ()
 
bool HoldTimerExpired ()
 
const Timerhold_timer () const
 

Static Public Attributes

static const int kOpenTime = 15
 
static const int kConnectInterval = 30
 
static const int kHoldTime = 90
 
static const int kMaxAttempts = 4
 
static const int kJitter = 10
 

Private Member Functions

bool ConnectTimerExpired ()
 
bool OpenTimerExpired ()
 
bool Enqueue (const sc::event_base &ev)
 
bool DequeueEvent (boost::intrusive_ptr< const sc::event_base > event)
 
void ProcessEvent (const sc::event_base &event)
 
void ProcessStreamHeaderMessage (XmppSession *session, const XmppStanza::XmppMessage *msg)
 
 DISALLOW_COPY_AND_ASSIGN (XmppStateMachine)
 

Private Attributes

WorkQueue
< boost::intrusive_ptr< const
sc::event_base > > 
work_queue_
 
XmppConnectionconnection_
 
XmppSessionsession_
 
TcpServerserver_
 
Timerconnect_timer_
 
Timeropen_timer_
 
Timerhold_timer_
 
int config_hold_time_
 
int hold_time_
 
uint32_t attempts_
 
uint32_t keepalive_count_
 
bool deleted_
 
bool in_dequeue_
 
bool is_active_
 
bool auth_enabled_
 
xmsm::XmState state_
 
xmsm::XmState last_state_
 
xmsm::XmOpenConfirmState openconfirm_state_
 
uint64_t state_since_
 
std::string last_event_
 
uint64_t last_event_at_
 
SslHandShakeCallbackHandler handshake_cb_
 
tbb::mutex mutex_
 

Friends

class XmppStateMachineTest
 

Detailed Description

Definition at line 60 of file xmpp_state_machine.h.

Constructor & Destructor Documentation

XmppStateMachine::XmppStateMachine ( XmppConnection connection,
bool  active,
bool  auth_enabled = false,
int  config_hold_time = kHoldTime 
)

Definition at line 1088 of file xmpp_state_machine.cc.

Here is the call graph for this function:

XmppStateMachine::~XmppStateMachine ( )

Definition at line 1126 of file xmpp_state_machine.cc.

Here is the call graph for this function:

Member Function Documentation

void XmppStateMachine::AssertOnHoldTimeout ( )

Definition at line 1047 of file xmpp_state_machine.cc.

void XmppStateMachine::AssignSession ( )

Definition at line 1586 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::CancelConnectTimer ( )

Definition at line 1194 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::CancelHoldTimer ( )

Definition at line 1244 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::CancelOpenTimer ( )

Definition at line 1205 of file xmpp_state_machine.cc.

Here is the call graph for this function:

const char * XmppStateMachine::ChannelType ( )

Definition at line 1605 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::Clear ( )

Definition at line 1507 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::clear_session ( )

Definition at line 1150 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::connect_attempts_clear ( )
inline

Definition at line 150 of file xmpp_state_machine.h.

void XmppStateMachine::connect_attempts_inc ( )
inline

Definition at line 149 of file xmpp_state_machine.h.

XmppConnection* XmppStateMachine::connection ( )
inline

Definition at line 129 of file xmpp_state_machine.h.

bool XmppStateMachine::ConnectTimerCancelled ( )
inline

Definition at line 184 of file xmpp_state_machine.h.

Here is the call graph for this function:

bool XmppStateMachine::ConnectTimerExpired ( )
private

Definition at line 1251 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::DeleteSession ( XmppSession session)

Definition at line 1160 of file xmpp_state_machine.cc.

Here is the call graph for this function:

bool XmppStateMachine::DequeueEvent ( boost::intrusive_ptr< const sc::event_base >  event)
private

Definition at line 1609 of file xmpp_state_machine.cc.

Here is the call graph for this function:

XmppStateMachine::DISALLOW_COPY_AND_ASSIGN ( XmppStateMachine  )
private
bool XmppStateMachine::Enqueue ( const sc::event_base &  ev)
private

Definition at line 1683 of file xmpp_state_machine.cc.

Here is the call graph for this function:

int XmppStateMachine::get_connect_attempts ( ) const
inline

Definition at line 151 of file xmpp_state_machine.h.

int XmppStateMachine::get_keepalive_count ( ) const
inline

Definition at line 155 of file xmpp_state_machine.h.

xmsm::XmOpenConfirmState XmppStateMachine::get_openconfirm_state ( )
inline

Definition at line 145 of file xmpp_state_machine.h.

xmsm::XmState XmppStateMachine::get_state ( )
inline

Definition at line 143 of file xmpp_state_machine.h.

int XmppStateMachine::GetConfiguredHoldTime ( ) const

Definition at line 1209 of file xmpp_state_machine.cc.

int XmppStateMachine::GetConnectTime ( ) const

Definition at line 1592 of file xmpp_state_machine.cc.

SslHandShakeCallbackHandler XmppStateMachine::HandShakeCbHandler ( )
inline

Definition at line 120 of file xmpp_state_machine.h.

int XmppStateMachine::hold_time ( ) const
inline

Definition at line 157 of file xmpp_state_machine.h.

virtual int XmppStateMachine::hold_time_msecs ( ) const
inlinevirtual

Definition at line 158 of file xmpp_state_machine.h.

const Timer* XmppStateMachine::hold_timer ( ) const
inline

Definition at line 189 of file xmpp_state_machine.h.

bool XmppStateMachine::HoldTimerCancelled ( )
inline

Definition at line 186 of file xmpp_state_machine.h.

Here is the call graph for this function:

bool XmppStateMachine::HoldTimerExpired ( )

Definition at line 1270 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::Initialize ( )

Definition at line 1144 of file xmpp_state_machine.cc.

Here is the call graph for this function:

bool XmppStateMachine::IsActiveChannel ( )

Definition at line 1597 of file xmpp_state_machine.cc.

bool XmppStateMachine::IsAuthEnabled ( )
inline

Definition at line 89 of file xmpp_state_machine.h.

void XmppStateMachine::keepalive_count_clear ( )
inline

Definition at line 154 of file xmpp_state_machine.h.

void XmppStateMachine::keepalive_count_inc ( )
inline

Definition at line 153 of file xmpp_state_machine.h.

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

Definition at line 179 of file xmpp_state_machine.h.

string XmppStateMachine::LastStateChangeAt ( ) const

Definition at line 1574 of file xmpp_state_machine.cc.

Here is the call graph for this function:

string XmppStateMachine::LastStateName ( ) const

Definition at line 1570 of file xmpp_state_machine.cc.

bool XmppStateMachine::logUVE ( )

Definition at line 1601 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::OnEvent ( SslSession session,
xmsm::SslHandShakeResponse  resp 
)

Definition at line 1520 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::OnMessage ( XmppSession session,
const XmppStanza::XmppMessage msg 
)

Definition at line 1443 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::OnSessionEvent ( TcpSession session,
TcpSession::Event  event 
)
virtual

Definition at line 1286 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::OnStart ( const xmsm::EvStart event)

Definition at line 1248 of file xmpp_state_machine.cc.

xmsm::XmOpenConfirmState XmppStateMachine::OpenConfirmStateType ( ) const

Definition at line 1582 of file xmpp_state_machine.cc.

bool XmppStateMachine::OpenTimerCancelled ( )
inline

Definition at line 185 of file xmpp_state_machine.h.

Here is the call graph for this function:

bool XmppStateMachine::OpenTimerExpired ( )
private

Definition at line 1259 of file xmpp_state_machine.cc.

Here is the call graph for this function:

bool XmppStateMachine::PassiveOpen ( XmppSession session)

Definition at line 1321 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::ProcessEvent ( const sc::event_base &  event)
private

Definition at line 1623 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::ProcessMessage ( XmppSession session,
const XmppStanza::XmppMessage msg 
)

Definition at line 1449 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::ProcessStreamHeaderMessage ( XmppSession session,
const XmppStanza::XmppMessage msg 
)
private

Definition at line 1333 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::RemoveSession ( )
inline

Definition at line 141 of file xmpp_state_machine.h.

void XmppStateMachine::ResetSession ( )

Definition at line 1068 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::ResurrectOldConnection ( XmppConnection connection,
XmppSession session 
)

Definition at line 1727 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::SendConnectionInfo ( const std::string &  event,
const std::string &  nextstate = "" 
)
void XmppStateMachine::SendConnectionInfo ( XmppConnectionInfo *  info,
const std::string &  event,
const std::string &  nextstate = "" 
)
XmppSession* XmppStateMachine::session ( )
inline

Definition at line 140 of file xmpp_state_machine.h.

void XmppStateMachine::set_connection ( const XmppConnection connection)
inline

Definition at line 130 of file xmpp_state_machine.h.

Here is the call graph for this function:

void XmppStateMachine::set_hold_time ( int  hold_time)
inline

Definition at line 159 of file xmpp_state_machine.h.

Here is the call graph for this function:

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

Definition at line 171 of file xmpp_state_machine.h.

Here is the call graph for this function:

void XmppStateMachine::set_openconfirm_state ( xmsm::XmOpenConfirmState  state)

Definition at line 1554 of file xmpp_state_machine.cc.

void XmppStateMachine::set_session ( TcpSession session)

Definition at line 1171 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::set_state ( xmsm::XmState  state)

Definition at line 1535 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::SetAdminState ( bool  down)

Definition at line 1511 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::SetHandShakeCbHandler ( SslHandShakeCallbackHandler  cb)
inline

Definition at line 116 of file xmpp_state_machine.h.

void XmppStateMachine::StartConnectTimer ( int  seconds)
virtual

Definition at line 1182 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::StartHoldTimer ( )
virtual

Definition at line 1233 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::StartOpenTimer ( int  seconds)
virtual

Definition at line 1198 of file xmpp_state_machine.cc.

Here is the call graph for this function:

string XmppStateMachine::StateName ( ) const

Definition at line 1566 of file xmpp_state_machine.cc.

xmsm::XmState XmppStateMachine::StateType ( ) const

Definition at line 1578 of file xmpp_state_machine.cc.

void XmppStateMachine::SwapXmppConnection ( XmppStateMachine other)

Definition at line 1776 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::TimerErrorHandler ( std::string  name,
std::string  error 
)

Definition at line 1179 of file xmpp_state_machine.cc.

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

Definition at line 1647 of file xmpp_state_machine.cc.

Here is the call graph for this function:

void XmppStateMachine::update_last_event ( const std::string &  event)

Definition at line 1652 of file xmpp_state_machine.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class XmppStateMachineTest
friend

Definition at line 192 of file xmpp_state_machine.h.

Member Data Documentation

uint32_t XmppStateMachine::attempts_
private

Definition at line 211 of file xmpp_state_machine.h.

bool XmppStateMachine::auth_enabled_
private

Definition at line 216 of file xmpp_state_machine.h.

int XmppStateMachine::config_hold_time_
private

Definition at line 209 of file xmpp_state_machine.h.

Timer* XmppStateMachine::connect_timer_
private

Definition at line 206 of file xmpp_state_machine.h.

XmppConnection* XmppStateMachine::connection_
private

Definition at line 203 of file xmpp_state_machine.h.

bool XmppStateMachine::deleted_
private

Definition at line 213 of file xmpp_state_machine.h.

SslHandShakeCallbackHandler XmppStateMachine::handshake_cb_
private

Definition at line 223 of file xmpp_state_machine.h.

int XmppStateMachine::hold_time_
private

Definition at line 210 of file xmpp_state_machine.h.

Timer* XmppStateMachine::hold_timer_
private

Definition at line 208 of file xmpp_state_machine.h.

bool XmppStateMachine::in_dequeue_
private

Definition at line 214 of file xmpp_state_machine.h.

bool XmppStateMachine::is_active_
private

Definition at line 215 of file xmpp_state_machine.h.

const int XmppStateMachine::kConnectInterval = 30
static

Definition at line 64 of file xmpp_state_machine.h.

uint32_t XmppStateMachine::keepalive_count_
private

Definition at line 212 of file xmpp_state_machine.h.

const int XmppStateMachine::kHoldTime = 90
static

Definition at line 65 of file xmpp_state_machine.h.

const int XmppStateMachine::kJitter = 10
static

Definition at line 67 of file xmpp_state_machine.h.

const int XmppStateMachine::kMaxAttempts = 4
static

Definition at line 66 of file xmpp_state_machine.h.

const int XmppStateMachine::kOpenTime = 15
static

Definition at line 63 of file xmpp_state_machine.h.

std::string XmppStateMachine::last_event_
private

Definition at line 221 of file xmpp_state_machine.h.

uint64_t XmppStateMachine::last_event_at_
private

Definition at line 222 of file xmpp_state_machine.h.

xmsm::XmState XmppStateMachine::last_state_
private

Definition at line 218 of file xmpp_state_machine.h.

tbb::mutex XmppStateMachine::mutex_
mutableprivate

Definition at line 224 of file xmpp_state_machine.h.

Timer* XmppStateMachine::open_timer_
private

Definition at line 207 of file xmpp_state_machine.h.

xmsm::XmOpenConfirmState XmppStateMachine::openconfirm_state_
private

Definition at line 219 of file xmpp_state_machine.h.

TcpServer* XmppStateMachine::server_
private

Definition at line 205 of file xmpp_state_machine.h.

XmppSession* XmppStateMachine::session_
private

Definition at line 204 of file xmpp_state_machine.h.

xmsm::XmState XmppStateMachine::state_
private

Definition at line 217 of file xmpp_state_machine.h.

uint64_t XmppStateMachine::state_since_
private

Definition at line 220 of file xmpp_state_machine.h.

WorkQueue<boost::intrusive_ptr<const sc::event_base> > XmppStateMachine::work_queue_
private

Definition at line 202 of file xmpp_state_machine.h.


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