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

#include <xmpp_connection.h>

Inheritance diagram for XmppConnection:
Collaboration diagram for XmppConnection:

Classes

struct  ErrorStats
 
struct  ProtoStats
 

Public Member Functions

 XmppConnection (TcpServer *server, const XmppChannelConfig *config)
 
virtual ~XmppConnection ()
 
void SetConfig (const XmppChannelConfig *)
 
virtual bool AcceptSession (XmppSession *session)
 
virtual void ReceiveMsg (XmppSession *session, const std::string &)
 
virtual
boost::asio::ip::tcp::endpoint 
endpoint () const
 
virtual
boost::asio::ip::tcp::endpoint 
local_endpoint () const
 
std::string endpoint_string () const
 
std::string local_endpoint_string () const
 
TcpServerserver ()
 
XmppSessionCreateSession ()
 
int GetTaskInstance () const
 
const std::string & ToUVEKey () const
 
const std::string & ToString () const
 
const std::string & FromString () const
 
void SetAdminDown (bool toggle)
 
bool Send (const uint8_t *data, size_t size, const std::string *msg_str=NULL)
 
virtual bool SendOpen (XmppSession *session)
 
virtual bool SendOpenConfirm (XmppSession *session)
 
virtual bool SendStreamFeatureRequest (XmppSession *session)
 
virtual bool SendStartTls (XmppSession *session)
 
virtual bool SendProceedTls (XmppSession *session)
 
void SendKeepAlive ()
 
void SendClose (XmppSession *session)
 
void ProcessSslHandShakeResponse (SslSessionPtr session, const boost::system::error_code &error)
 
int ProcessXmppIqMessage (const XmppStanza::XmppMessage *)
 
int ProcessXmppChatMessage (const XmppStanza::XmppChatMessage *)
 
void StartKeepAliveTimer ()
 
void StopKeepAliveTimer ()
 
void UpdateKeepAliveTimer (uint8_t time_out)
 
void set_session (XmppSession *session)
 
void clear_session ()
 
void SetTo (const std::string &)
 
const XmppSessionsession () const
 
XmppSessionsession ()
 
bool logUVE () const
 
bool IsClient () const
 
virtual void ManagedDelete ()=0
 
virtual void RetryDelete ()=0
 
virtual LifetimeActordeleter ()=0
 
virtual const LifetimeActordeleter () const =0
 
virtual LifetimeManagerlifetime_manager ()=0
 
xmsm::XmState GetStateMcState () const
 
xmsm::XmOpenConfirmState GetStateMcOpenConfirmState () const
 
bool IsActiveChannel () const
 
XmppChannelMuxChannelMux ()
 
void SetChannelMux (XmppChannelMux *channel_mux)
 
void Initialize ()
 
void Clear ()
 
void SetAdminState (bool down)
 
void Shutdown ()
 
bool MayDelete () const
 
bool IsDeleted () const
 
std::string & GetComputeHostName ()
 
std::string & GetControllerHostName ()
 
std::string & GetFrom ()
 
std::string & GetTo ()
 
virtual void set_close_reason (const std::string &reason)=0
 
virtual void increment_flap_count ()=0
 
virtual uint32_t flap_count () const =0
 
virtual const std::string last_flap_at () const =0
 
virtual void WriteReady ()
 
int GetConfiguredHoldTime () const
 
int GetNegotiatedHoldTime () const
 
std::string StateName () const
 
std::string LastStateName () const
 
std::string LastStateChangeAt () const
 
std::string LastEvent () const
 
uint32_t tx_open () const
 
uint32_t tx_keepalive () const
 
uint32_t tx_close () const
 
uint32_t tx_update () const
 
uint32_t rx_open () const
 
uint32_t rx_keepalive () const
 
uint32_t rx_close () const
 
uint32_t rx_update () const
 
void LogMsg (std::string msg)
 
bool disable_read () const
 
void set_disable_read (bool disable_read)
 
XmppStateMachinestate_machine ()
 
const XmppStateMachinestate_machine () const
 
void set_state_machine (XmppStateMachine *state_machine)
 
void SwapXmppStateMachine (XmppConnection *other)
 
uint8_t dscp_value () const
 
int SetDscpValue (uint8_t value)
 
void inc_connect_error ()
 
void inc_session_close ()
 
void inc_open_fail ()
 
void inc_stream_feature_fail ()
 
void inc_handshake_failure ()
 
size_t get_connect_error ()
 
size_t get_session_close ()
 
size_t get_open_fail ()
 
size_t get_stream_feature_fail ()
 
size_t get_handshake_failure ()
 
size_t get_sm_connect_attempts ()
 
size_t get_sm_keepalive_count ()
 
std::string GetXmppAuthenticationType () const
 
void SwapContents (XmppConnection *other)
 
boost::asio::ip::tcp::endpoint & endpoint ()
 
const Timerkeepalive_timer () const
 

Static Public Attributes

static const char * kAuthTypeNil = "NIL"
 
static const char * kAuthTypeTls = "TLS"
 

Protected Member Functions

const XmppChannelMuxchannel_mux () const
 

Protected Attributes

TcpServerserver_
 
XmppSessionsession_
 

Private Member Functions

bool KeepAliveTimerExpired ()
 
void KeepaliveTimerErrorHanlder (std::string error_name, std::string error_message)
 
XmppStanza::XmppMessageXmppDecode (const std::string &msg)
 
void LogKeepAliveSend ()
 
int GetTaskInstance (bool is_client) const
 
void IncProtoStats (unsigned int type)
 
 DISALLOW_COPY_AND_ASSIGN (XmppConnection)
 

Private Attributes

boost::asio::ip::tcp::endpoint endpoint_
 
boost::asio::ip::tcp::endpoint local_endpoint_
 
const XmppChannelConfigconfig_
 
tbb::spin_mutex spin_mutex_
 
Timerkeepalive_timer_
 
bool is_client_
 
bool log_uve_
 
bool admin_down_
 
bool disable_read_
 
std::string from_
 
std::string to_
 
bool auth_enabled_
 
uint8_t dscp_value_
 
std::string xmlns_
 
std::string uve_key_str_
 
boost::scoped_ptr
< XmppStateMachine
state_machine_
 
boost::scoped_ptr< XmppChannelMuxmux_
 
std::unique_ptr
< XmppStanza::XmppMessage
last_msg_
 
ProtoStats stats_ [2]
 
ErrorStats error_stats_
 

Friends

class XmppStateMachineTest
 

Detailed Description

Definition at line 30 of file xmpp_connection.h.

Constructor & Destructor Documentation

XmppConnection::XmppConnection ( TcpServer server,
const XmppChannelConfig config 
)

Definition at line 40 of file xmpp_connection.cc.

Here is the call graph for this function:

XmppConnection::~XmppConnection ( )
virtual

Definition at line 68 of file xmpp_connection.cc.

Here is the call graph for this function:

Member Function Documentation

bool XmppConnection::AcceptSession ( XmppSession session)
virtual

Definition at line 221 of file xmpp_connection.cc.

Here is the call graph for this function:

const XmppChannelMux * XmppConnection::channel_mux ( ) const
protected

Definition at line 491 of file xmpp_connection.cc.

XmppChannelMux* XmppConnection::ChannelMux ( )
inline

Definition at line 128 of file xmpp_connection.h.

void XmppConnection::Clear ( )
inline

Definition at line 132 of file xmpp_connection.h.

void XmppConnection::clear_session ( )

Definition at line 96 of file xmpp_connection.cc.

Here is the call graph for this function:

XmppSession * XmppConnection::CreateSession ( )

Definition at line 129 of file xmpp_connection.cc.

Here is the call graph for this function:

virtual LifetimeActor* XmppConnection::deleter ( )
pure virtual
virtual const LifetimeActor* XmppConnection::deleter ( ) const
pure virtual
bool XmppConnection::disable_read ( ) const
inline

Definition at line 205 of file xmpp_connection.h.

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

Definition at line 217 of file xmpp_connection.h.

boost::asio::ip::tcp::endpoint XmppConnection::endpoint ( ) const
virtual

Definition at line 168 of file xmpp_connection.cc.

boost::asio::ip::tcp::endpoint& XmppConnection::endpoint ( )
inline

Definition at line 237 of file xmpp_connection.h.

string XmppConnection::endpoint_string ( ) const

Definition at line 176 of file xmpp_connection.cc.

virtual uint32_t XmppConnection::flap_count ( ) const
pure virtual
const string & XmppConnection::FromString ( ) const

Definition at line 188 of file xmpp_connection.cc.

size_t XmppConnection::get_connect_error ( )

Definition at line 532 of file xmpp_connection.cc.

size_t XmppConnection::get_handshake_failure ( )

Definition at line 548 of file xmpp_connection.cc.

size_t XmppConnection::get_open_fail ( )

Definition at line 540 of file xmpp_connection.cc.

size_t XmppConnection::get_session_close ( )

Definition at line 536 of file xmpp_connection.cc.

size_t XmppConnection::get_sm_connect_attempts ( )

Definition at line 552 of file xmpp_connection.cc.

size_t XmppConnection::get_sm_keepalive_count ( )

Definition at line 556 of file xmpp_connection.cc.

size_t XmppConnection::get_stream_feature_fail ( )

Definition at line 544 of file xmpp_connection.cc.

std::string& XmppConnection::GetComputeHostName ( )
inline

Definition at line 139 of file xmpp_connection.h.

int XmppConnection::GetConfiguredHoldTime ( ) const
inline

Definition at line 154 of file xmpp_connection.h.

std::string& XmppConnection::GetControllerHostName ( )
inline

Definition at line 140 of file xmpp_connection.h.

std::string& XmppConnection::GetFrom ( )
inline

Definition at line 142 of file xmpp_connection.h.

int XmppConnection::GetNegotiatedHoldTime ( ) const
inline

Definition at line 158 of file xmpp_connection.h.

xmsm::XmOpenConfirmState XmppConnection::GetStateMcOpenConfirmState ( ) const

Definition at line 161 of file xmpp_connection.cc.

Here is the call graph for this function:

xmsm::XmState XmppConnection::GetStateMcState ( ) const

Definition at line 155 of file xmpp_connection.cc.

Here is the call graph for this function:

int XmppConnection::GetTaskInstance ( ) const
inline

Definition at line 75 of file xmpp_connection.h.

Here is the call graph for this function:

int XmppConnection::GetTaskInstance ( bool  is_client) const
private

Definition at line 143 of file xmpp_connection.cc.

Here is the call graph for this function:

std::string& XmppConnection::GetTo ( )
inline

Definition at line 143 of file xmpp_connection.h.

std::string XmppConnection::GetXmppAuthenticationType ( ) const

Definition at line 75 of file xmpp_connection.cc.

void XmppConnection::inc_connect_error ( )

Definition at line 512 of file xmpp_connection.cc.

void XmppConnection::inc_handshake_failure ( )

Definition at line 528 of file xmpp_connection.cc.

void XmppConnection::inc_open_fail ( )

Definition at line 520 of file xmpp_connection.cc.

void XmppConnection::inc_session_close ( )

Definition at line 516 of file xmpp_connection.cc.

void XmppConnection::inc_stream_feature_fail ( )

Definition at line 524 of file xmpp_connection.cc.

void XmppConnection::IncProtoStats ( unsigned int  type)
private

Definition at line 495 of file xmpp_connection.cc.

virtual void XmppConnection::increment_flap_count ( )
pure virtual
void XmppConnection::Initialize ( )
inline

Definition at line 131 of file xmpp_connection.h.

bool XmppConnection::IsActiveChannel ( ) const
inline

Definition at line 125 of file xmpp_connection.h.

bool XmppConnection::IsClient ( ) const
inline

Definition at line 116 of file xmpp_connection.h.

bool XmppConnection::IsDeleted ( ) const

Definition at line 121 of file xmpp_connection.cc.

Here is the call graph for this function:

const Timer* XmppConnection::keepalive_timer ( ) const
inline

Definition at line 238 of file xmpp_connection.h.

void XmppConnection::KeepaliveTimerErrorHanlder ( std::string  error_name,
std::string  error_message 
)
private

Definition at line 452 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::KeepAliveTimerExpired ( )
private

Definition at line 439 of file xmpp_connection.cc.

Here is the call graph for this function:

virtual const std::string XmppConnection::last_flap_at ( ) const
pure virtual
std::string XmppConnection::LastEvent ( ) const
inline

Definition at line 174 of file xmpp_connection.h.

std::string XmppConnection::LastStateChangeAt ( ) const
inline

Definition at line 170 of file xmpp_connection.h.

std::string XmppConnection::LastStateName ( ) const
inline

Definition at line 166 of file xmpp_connection.h.

virtual LifetimeManager* XmppConnection::lifetime_manager ( )
pure virtual
boost::asio::ip::tcp::endpoint XmppConnection::local_endpoint ( ) const
virtual

Definition at line 172 of file xmpp_connection.cc.

string XmppConnection::local_endpoint_string ( ) const

Definition at line 182 of file xmpp_connection.cc.

void XmppConnection::LogKeepAliveSend ( )
private

Definition at line 414 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::LogMsg ( std::string  msg)

Definition at line 407 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::logUVE ( ) const
inline

Definition at line 115 of file xmpp_connection.h.

virtual void XmppConnection::ManagedDelete ( )
pure virtual
bool XmppConnection::MayDelete ( ) const

Definition at line 125 of file xmpp_connection.cc.

void XmppConnection::ProcessSslHandShakeResponse ( SslSessionPtr  session,
const boost::system::error_code &  error 
)

Definition at line 376 of file xmpp_connection.cc.

Here is the call graph for this function:

int XmppConnection::ProcessXmppChatMessage ( const XmppStanza::XmppChatMessage msg)

Definition at line 644 of file xmpp_connection.cc.

int XmppConnection::ProcessXmppIqMessage ( const XmppStanza::XmppMessage msg)

Definition at line 650 of file xmpp_connection.cc.

void XmppConnection::ReceiveMsg ( XmppSession session,
const std::string &   
)
virtual

Definition at line 560 of file xmpp_connection.cc.

Here is the call graph for this function:

virtual void XmppConnection::RetryDelete ( )
pure virtual
uint32_t XmppConnection::rx_close ( ) const
inline

Definition at line 197 of file xmpp_connection.h.

uint32_t XmppConnection::rx_keepalive ( ) const
inline

Definition at line 194 of file xmpp_connection.h.

uint32_t XmppConnection::rx_open ( ) const
inline

Definition at line 191 of file xmpp_connection.h.

uint32_t XmppConnection::rx_update ( ) const
inline

Definition at line 200 of file xmpp_connection.h.

bool XmppConnection::Send ( const uint8_t *  data,
size_t  size,
const std::string *  msg_str = NULL 
)

Definition at line 226 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::SendClose ( XmppSession session)

Definition at line 364 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::SendKeepAlive ( )

Definition at line 427 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::SendOpen ( XmppSession session)
virtual

Definition at line 262 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::SendOpenConfirm ( XmppSession session)
virtual

Definition at line 281 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::SendProceedTls ( XmppSession session)
virtual

Definition at line 343 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::SendStartTls ( XmppSession session)
virtual

Definition at line 322 of file xmpp_connection.cc.

Here is the call graph for this function:

bool XmppConnection::SendStreamFeatureRequest ( XmppSession session)
virtual

Definition at line 301 of file xmpp_connection.cc.

Here is the call graph for this function:

TcpServer* XmppConnection::server ( )
inline

Definition at line 73 of file xmpp_connection.h.

const XmppSession * XmppConnection::session ( ) const

Definition at line 104 of file xmpp_connection.cc.

XmppSession * XmppConnection::session ( )

Definition at line 108 of file xmpp_connection.cc.

virtual void XmppConnection::set_close_reason ( const std::string &  reason)
pure virtual
void XmppConnection::set_disable_read ( bool  disable_read)
inline

Definition at line 206 of file xmpp_connection.h.

Here is the call graph for this function:

void XmppConnection::set_session ( XmppSession session)

Definition at line 87 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::set_state_machine ( XmppStateMachine state_machine)
inline

Definition at line 210 of file xmpp_connection.h.

void XmppConnection::SetAdminDown ( bool  toggle)

Definition at line 216 of file xmpp_connection.cc.

void XmppConnection::SetAdminState ( bool  down)
inline

Definition at line 133 of file xmpp_connection.h.

void XmppConnection::SetChannelMux ( XmppChannelMux channel_mux)
inline

Definition at line 129 of file xmpp_connection.h.

void XmppConnection::SetConfig ( const XmppChannelConfig config)

Definition at line 83 of file xmpp_connection.cc.

int XmppConnection::SetDscpValue ( uint8_t  value)

Definition at line 253 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::SetTo ( const std::string &  )

Definition at line 205 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::Shutdown ( void  )

Definition at line 117 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::StartKeepAliveTimer ( )

Definition at line 458 of file xmpp_connection.cc.

Here is the call graph for this function:

XmppStateMachine * XmppConnection::state_machine ( )

Definition at line 483 of file xmpp_connection.cc.

const XmppStateMachine * XmppConnection::state_machine ( ) const

Definition at line 487 of file xmpp_connection.cc.

std::string XmppConnection::StateName ( ) const
inline

Definition at line 162 of file xmpp_connection.h.

void XmppConnection::StopKeepAliveTimer ( )

Definition at line 472 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::SwapContents ( XmppConnection other)

Definition at line 984 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::SwapXmppStateMachine ( XmppConnection other)
inline

Definition at line 214 of file xmpp_connection.h.

const string & XmppConnection::ToString ( ) const

Definition at line 192 of file xmpp_connection.cc.

const std::string & XmppConnection::ToUVEKey ( ) const

Definition at line 196 of file xmpp_connection.cc.

uint32_t XmppConnection::tx_close ( ) const
inline

Definition at line 184 of file xmpp_connection.h.

uint32_t XmppConnection::tx_keepalive ( ) const
inline

Definition at line 181 of file xmpp_connection.h.

uint32_t XmppConnection::tx_open ( ) const
inline

Definition at line 178 of file xmpp_connection.h.

uint32_t XmppConnection::tx_update ( ) const
inline

Definition at line 187 of file xmpp_connection.h.

void XmppConnection::UpdateKeepAliveTimer ( uint8_t  time_out)

Definition at line 477 of file xmpp_connection.cc.

Here is the call graph for this function:

void XmppConnection::WriteReady ( )
virtual

Definition at line 112 of file xmpp_connection.cc.

XmppStanza::XmppMessage * XmppConnection::XmppDecode ( const std::string &  msg)
private

Definition at line 592 of file xmpp_connection.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class XmppStateMachineTest
friend

Definition at line 152 of file xmpp_connection.h.

Member Data Documentation

bool XmppConnection::admin_down_
private

Definition at line 263 of file xmpp_connection.h.

bool XmppConnection::auth_enabled_
private

Definition at line 267 of file xmpp_connection.h.

const XmppChannelConfig* XmppConnection::config_
private

Definition at line 255 of file xmpp_connection.h.

bool XmppConnection::disable_read_
private

Definition at line 264 of file xmpp_connection.h.

uint8_t XmppConnection::dscp_value_
private

Definition at line 268 of file xmpp_connection.h.

boost::asio::ip::tcp::endpoint XmppConnection::endpoint_
private

Definition at line 253 of file xmpp_connection.h.

ErrorStats XmppConnection::error_stats_
private

Definition at line 278 of file xmpp_connection.h.

std::string XmppConnection::from_
private

Definition at line 265 of file xmpp_connection.h.

bool XmppConnection::is_client_
private

Definition at line 261 of file xmpp_connection.h.

const char * XmppConnection::kAuthTypeNil = "NIL"
static

Definition at line 233 of file xmpp_connection.h.

const char * XmppConnection::kAuthTypeTls = "TLS"
static

Definition at line 234 of file xmpp_connection.h.

Timer* XmppConnection::keepalive_timer_
private

Definition at line 259 of file xmpp_connection.h.

std::unique_ptr<XmppStanza::XmppMessage> XmppConnection::last_msg_
private

Definition at line 274 of file xmpp_connection.h.

boost::asio::ip::tcp::endpoint XmppConnection::local_endpoint_
private

Definition at line 254 of file xmpp_connection.h.

bool XmppConnection::log_uve_
private

Definition at line 262 of file xmpp_connection.h.

boost::scoped_ptr<XmppChannelMux> XmppConnection::mux_
private

Definition at line 273 of file xmpp_connection.h.

TcpServer* XmppConnection::server_
protected

Definition at line 241 of file xmpp_connection.h.

XmppSession* XmppConnection::session_
protected

Definition at line 242 of file xmpp_connection.h.

tbb::spin_mutex XmppConnection::spin_mutex_
private

Definition at line 258 of file xmpp_connection.h.

boost::scoped_ptr<XmppStateMachine> XmppConnection::state_machine_
private

Definition at line 272 of file xmpp_connection.h.

ProtoStats XmppConnection::stats_[2]
private

Definition at line 276 of file xmpp_connection.h.

std::string XmppConnection::to_
private

Definition at line 266 of file xmpp_connection.h.

std::string XmppConnection::uve_key_str_
mutableprivate

Definition at line 270 of file xmpp_connection.h.

std::string XmppConnection::xmlns_
private

Definition at line 269 of file xmpp_connection.h.


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