OpenSDN source code
XmppServer Class Reference

#include <xmpp_server.h>

Inheritance diagram for XmppServer:
Collaboration diagram for XmppServer:

Classes

class  DeleteActor
 

Public Types

typedef boost::asio::ip::tcp::endpoint Endpoint
 
typedef boost::function< void(XmppChannelMux *, xmps::PeerState)> ConnectionEventCb
 
- 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
 

Public Member Functions

 XmppServer (EventManager *evm, const std::string &server_addr, const XmppChannelConfig *config)
 
 XmppServer (EventManager *evm, const std::string &server_addr)
 
 XmppServer (EventManager *evm)
 
virtual ~XmppServer ()
 
void RegisterConnectionEvent (xmps::PeerId, ConnectionEventCb)
 
void UnRegisterConnectionEvent (xmps::PeerId)
 
void NotifyConnectionEvent (XmppChannelMux *, xmps::PeerState)
 
size_t ConnectionEventCount () const
 
LifetimeManagerlifetime_manager ()
 
virtual LifetimeActordeleter ()
 
virtual LifetimeActordeleter () const
 
virtual TcpSessionCreateSession ()
 
virtual bool Initialize (short port)
 
virtual bool Initialize (short port, bool logUVE)
 
virtual bool Initialize (short port, bool logUVE, const IpAddress &ip)
 
void SessionShutdown ()
 
bool MayDelete () const
 
void Shutdown ()
 
void Terminate ()
 
virtual XmppServerConnectionCreateConnection (XmppSession *session)
 
virtual XmppServerConnectionFindConnection (Endpoint remote_endpoint)
 
virtual XmppServerConnectionFindConnection (const std::string &address)
 
virtual void InsertConnection (XmppServerConnection *connection)
 
virtual void RemoveConnection (XmppServerConnection *connection)
 
void SwapXmppConnectionMapEntries (XmppConnection *connection1, XmppConnection *connection2)
 
virtual void InsertDeletedConnection (XmppServerConnection *connection)
 
virtual void RemoveDeletedConnection (XmppServerConnection *connection)
 
bool ClearConnection (const std::string &hostname)
 
void ClearAllConnections ()
 
void UpdateAllConnections (uint8_t time_out)
 
const std::string & ServerAddr () const
 
size_t ConnectionCount () const
 
XmppConnectionEndpointFindConnectionEndpoint (const std::string &endpoint_name)
 
XmppConnectionEndpointLocateConnectionEndpoint (XmppServerConnection *connection, bool &created)
 
void ReleaseConnectionEndpoint (XmppServerConnection *connection)
 
void FillShowConnections (std::vector< ShowXmppConnection > *show_connection_list) const
 
void FillShowServer (ShowXmppServerResp *resp) const
 
void CreateConfigUpdater (BgpConfigManager *config_manager)
 
virtual bool IsPeerCloseGraceful () const
 
uint16_t GetGracefulRestartTime () const
 
uint32_t GetLongLivedGracefulRestartTime () const
 
uint32_t GetEndOfRibReceiveTime () const
 
uint32_t GetEndOfRibSendTime () const
 
bool IsGRHelperModeEnabled () const
 
bool gr_helper_disable () const
 
void set_gr_helper_disable (bool gr_helper_disable)
 
void SetDscpValue (uint8_t value)
 
uint8_t dscp_value () const
 
const std::string subcluster_name () const
 
void set_subcluster_name (const std::string &subcluster_name)
 
- Public Member Functions inherited from XmppConnectionManager
 XmppConnectionManager (EventManager *evm, boost::asio::ssl::context::method m, bool ssl_enabled, bool ssl_handshake_delayed)
 
void Shutdown ()
 
void EnqueueSession (XmppSession *session)
 
size_t GetSessionQueueSize () const
 
tbb::mutex & mutex () 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 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)
 

Protected Types

typedef std::map< Endpoint, XmppServerConnection * > ConnectionMap
 
- Protected Types inherited from TcpServer
typedef boost::intrusive_ptr< TcpServerTcpServerPtr
 
typedef boost::intrusive_ptr< TcpSessionTcpSessionPtr
 

Protected Member Functions

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

Protected Attributes

tbb::reader_writer_lock connection_map_mutex_
 
ConnectionMap connection_map_
 

Private Types

typedef std::set< XmppServerConnection * > ConnectionSet
 
typedef std::map< std::string, XmppConnectionEndpoint * > ConnectionEndpointMap
 
typedef std::map< xmps::PeerId, ConnectionEventCbConnectionEventCbMap
 

Private Member Functions

bool DequeueConnection (XmppServerConnection *connection)
 
size_t GetConnectionQueueSize () const
 
void SetConnectionQueueDisable (bool disabled)
 
void WorkQueueExitCallback (bool done)
 
size_t ConnectionMapSize () const
 
 DISALLOW_COPY_AND_ASSIGN (XmppServer)
 

Private Attributes

ConnectionSet deleted_connection_set_
 
size_t max_connections_
 
tbb::mutex endpoint_map_mutex_
 
ConnectionEndpointMap connection_endpoint_map_
 
tbb::mutex deletion_mutex_
 
boost::scoped_ptr< LifetimeManagerlifetime_manager_
 
boost::scoped_ptr< DeleteActordeleter_
 
ConnectionEventCbMap connection_event_map_
 
std::string server_addr_
 
bool log_uve_
 
bool auth_enabled_
 
int tcp_hold_time_
 
bool gr_helper_disable_
 
boost::scoped_ptr< XmppConfigUpdaterxmpp_config_updater_
 
uint8_t dscp_value_
 
std::string subcluster_name_
 
WorkQueue< XmppServerConnection * > connection_queue_
 

Friends

class BgpXmppBasicTest
 
class DeleteActor
 
class XmppStateMachineTest
 

Detailed Description

Definition at line 32 of file xmpp_server.h.

Member Typedef Documentation

◆ ConnectionEndpointMap

typedef std::map<std::string, XmppConnectionEndpoint *> XmppServer::ConnectionEndpointMap
private

Definition at line 123 of file xmpp_server.h.

◆ ConnectionEventCb

Definition at line 42 of file xmpp_server.h.

◆ ConnectionEventCbMap

Definition at line 124 of file xmpp_server.h.

◆ ConnectionMap

Definition at line 113 of file xmpp_server.h.

◆ ConnectionSet

typedef std::set<XmppServerConnection *> XmppServer::ConnectionSet
private

Definition at line 122 of file xmpp_server.h.

◆ Endpoint

typedef boost::asio::ip::tcp::endpoint XmppServer::Endpoint

Definition at line 34 of file xmpp_server.h.

Constructor & Destructor Documentation

◆ XmppServer() [1/3]

XmppServer::XmppServer ( EventManager evm,
const std::string &  server_addr,
const XmppChannelConfig config 
)

◆ XmppServer() [2/3]

XmppServer::XmppServer ( EventManager evm,
const std::string &  server_addr 
)

◆ XmppServer() [3/3]

XmppServer::XmppServer ( EventManager evm)
explicit

Definition at line 219 of file xmpp_server.cc.

◆ ~XmppServer()

XmppServer::~XmppServer ( )
virtual

Definition at line 295 of file xmpp_server.cc.

Here is the call graph for this function:

Member Function Documentation

◆ AcceptSession()

bool XmppServer::AcceptSession ( TcpSession session)
protectedvirtual

Reimplemented from TcpServer.

Definition at line 490 of file xmpp_server.cc.

Here is the call graph for this function:

◆ AllocSession()

SslSession * XmppServer::AllocSession ( SslSocket socket)
protectedvirtual

Implements SslServer.

Definition at line 472 of file xmpp_server.cc.

Here is the call graph for this function:

◆ ClearAllConnections()

void XmppServer::ClearAllConnections ( )

Definition at line 445 of file xmpp_server.cc.

◆ ClearConnection()

bool XmppServer::ClearConnection ( const std::string &  hostname)

Definition at line 427 of file xmpp_server.cc.

◆ ConnectionCount()

size_t XmppServer::ConnectionCount ( ) const

Definition at line 405 of file xmpp_server.cc.

Here is the call graph for this function:

◆ ConnectionEventCount()

size_t XmppServer::ConnectionEventCount ( ) const

Definition at line 396 of file xmpp_server.cc.

◆ ConnectionMapSize()

size_t XmppServer::ConnectionMapSize ( ) const
private

Definition at line 400 of file xmpp_server.cc.

◆ CreateConfigUpdater()

void XmppServer::CreateConfigUpdater ( BgpConfigManager config_manager)

Definition at line 234 of file xmpp_server.cc.

◆ CreateConnection()

XmppServerConnection * XmppServer::CreateConnection ( XmppSession session)
virtual

Definition at line 566 of file xmpp_server.cc.

Here is the call graph for this function:

◆ CreateSession()

TcpSession * XmppServer::CreateSession ( )
virtual

Reimplemented from TcpServer.

Definition at line 364 of file xmpp_server.cc.

Here is the call graph for this function:

◆ deleter() [1/2]

LifetimeActor * XmppServer::deleter ( )
virtual

Implements XmppConnectionManager.

Definition at line 352 of file xmpp_server.cc.

◆ deleter() [2/2]

LifetimeActor * XmppServer::deleter ( ) const
virtual

Definition at line 356 of file xmpp_server.cc.

◆ DequeueConnection()

bool XmppServer::DequeueConnection ( XmppServerConnection connection)
private

Definition at line 600 of file xmpp_server.cc.

Here is the call graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

XmppServer::DISALLOW_COPY_AND_ASSIGN ( XmppServer  )
private

◆ dscp_value()

uint8_t XmppServer::dscp_value ( ) const
inline

Definition at line 100 of file xmpp_server.h.

◆ FillShowConnections()

void XmppServer::FillShowConnections ( std::vector< ShowXmppConnection > *  show_connection_list) const

Definition at line 731 of file xmpp_server.cc.

Here is the call graph for this function:

◆ FillShowServer()

void XmppServer::FillShowServer ( ShowXmppServerResp *  resp) const

Definition at line 747 of file xmpp_server.cc.

Here is the call graph for this function:

◆ FindConnection() [1/2]

virtual XmppServerConnection* XmppServer::FindConnection ( const std::string &  address)
virtual

◆ FindConnection() [2/2]

XmppServerConnection * XmppServer::FindConnection ( Endpoint  remote_endpoint)
virtual

Definition at line 409 of file xmpp_server.cc.

◆ FindConnectionEndpoint()

XmppConnectionEndpoint * XmppServer::FindConnectionEndpoint ( const std::string &  endpoint_name)

Definition at line 675 of file xmpp_server.cc.

◆ GetConnectionQueueSize()

size_t XmppServer::GetConnectionQueueSize ( ) const
private

Definition at line 641 of file xmpp_server.cc.

Here is the call graph for this function:

◆ GetEndOfRibReceiveTime()

uint32_t XmppServer::GetEndOfRibReceiveTime ( ) const

Definition at line 252 of file xmpp_server.cc.

◆ GetEndOfRibSendTime()

uint32_t XmppServer::GetEndOfRibSendTime ( ) const

Definition at line 258 of file xmpp_server.cc.

◆ GetGracefulRestartTime()

uint16_t XmppServer::GetGracefulRestartTime ( ) const

Definition at line 238 of file xmpp_server.cc.

◆ GetLongLivedGracefulRestartTime()

uint32_t XmppServer::GetLongLivedGracefulRestartTime ( ) const

Definition at line 245 of file xmpp_server.cc.

◆ gr_helper_disable()

bool XmppServer::gr_helper_disable ( ) const
inline

Definition at line 95 of file xmpp_server.h.

◆ Initialize() [1/3]

bool XmppServer::Initialize ( short  port)
virtual

Definition at line 300 of file xmpp_server.cc.

Here is the call graph for this function:

◆ Initialize() [2/3]

bool XmppServer::Initialize ( short  port,
bool  logUVE 
)
virtual

Definition at line 305 of file xmpp_server.cc.

Here is the call graph for this function:

◆ Initialize() [3/3]

bool XmppServer::Initialize ( short  port,
bool  logUVE,
const IpAddress ip 
)
virtual

Definition at line 310 of file xmpp_server.cc.

Here is the call graph for this function:

◆ InsertConnection()

void XmppServer::InsertConnection ( XmppServerConnection connection)
virtual

Definition at line 545 of file xmpp_server.cc.

Here is the call graph for this function:

◆ InsertDeletedConnection()

void XmppServer::InsertDeletedConnection ( XmppServerConnection connection)
virtual

Definition at line 652 of file xmpp_server.cc.

Here is the call graph for this function:

◆ IsGRHelperModeEnabled()

bool XmppServer::IsGRHelperModeEnabled ( ) const

Definition at line 264 of file xmpp_server.cc.

◆ IsPeerCloseGraceful()

bool XmppServer::IsPeerCloseGraceful ( ) const
virtual

Definition at line 280 of file xmpp_server.cc.

Here is the call graph for this function:

◆ lifetime_manager()

LifetimeManager * XmppServer::lifetime_manager ( )

Definition at line 360 of file xmpp_server.cc.

◆ LocateConnectionEndpoint()

XmppConnectionEndpoint * XmppServer::LocateConnectionEndpoint ( XmppServerConnection connection,
bool &  created 
)

Definition at line 683 of file xmpp_server.cc.

Here is the call graph for this function:

◆ MayDelete()

bool XmppServer::MayDelete ( ) const

Definition at line 328 of file xmpp_server.cc.

Here is the call graph for this function:

◆ NotifyConnectionEvent()

void XmppServer::NotifyConnectionEvent ( XmppChannelMux mux,
xmps::PeerState  state 
)

Definition at line 463 of file xmpp_server.cc.

◆ RegisterConnectionEvent()

void XmppServer::RegisterConnectionEvent ( xmps::PeerId  id,
ConnectionEventCb  cb 
)

Definition at line 452 of file xmpp_server.cc.

◆ ReleaseConnectionEndpoint()

void XmppServer::ReleaseConnectionEndpoint ( XmppServerConnection connection)

Definition at line 721 of file xmpp_server.cc.

Here is the call graph for this function:

◆ RemoveConnection()

void XmppServer::RemoveConnection ( XmppServerConnection connection)
virtual

Definition at line 518 of file xmpp_server.cc.

Here is the call graph for this function:

◆ RemoveDeletedConnection()

void XmppServer::RemoveDeletedConnection ( XmppServerConnection connection)
virtual

Definition at line 665 of file xmpp_server.cc.

Here is the call graph for this function:

◆ ServerAddr()

const std::string& XmppServer::ServerAddr ( ) const
inline

Definition at line 76 of file xmpp_server.h.

◆ SessionShutdown()

void XmppServer::SessionShutdown ( )

Definition at line 318 of file xmpp_server.cc.

Here is the call graph for this function:

◆ set_gr_helper_disable()

void XmppServer::set_gr_helper_disable ( bool  gr_helper_disable)
inline

Definition at line 96 of file xmpp_server.h.

Here is the call graph for this function:

◆ set_subcluster_name()

void XmppServer::set_subcluster_name ( const std::string &  subcluster_name)
inline

Definition at line 104 of file xmpp_server.h.

Here is the call graph for this function:

◆ SetConnectionQueueDisable()

void XmppServer::SetConnectionQueueDisable ( bool  disabled)
private

Definition at line 645 of file xmpp_server.cc.

Here is the call graph for this function:

◆ SetDscpValue()

void XmppServer::SetDscpValue ( uint8_t  value)

Definition at line 585 of file xmpp_server.cc.

Here is the call graph for this function:

◆ Shutdown()

void XmppServer::Shutdown ( void  )

Definition at line 339 of file xmpp_server.cc.

◆ subcluster_name()

const std::string XmppServer::subcluster_name ( ) const
inline

Definition at line 101 of file xmpp_server.h.

◆ SwapXmppConnectionMapEntries()

void XmppServer::SwapXmppConnectionMapEntries ( XmppConnection connection1,
XmppConnection connection2 
)

Definition at line 529 of file xmpp_server.cc.

Here is the call graph for this function:

◆ Terminate()

void XmppServer::Terminate ( )

Definition at line 347 of file xmpp_server.cc.

Here is the call graph for this function:

◆ UnRegisterConnectionEvent()

void XmppServer::UnRegisterConnectionEvent ( xmps::PeerId  id)

Definition at line 457 of file xmpp_server.cc.

◆ UpdateAllConnections()

void XmppServer::UpdateAllConnections ( uint8_t  time_out)

Definition at line 438 of file xmpp_server.cc.

◆ WorkQueueExitCallback()

void XmppServer::WorkQueueExitCallback ( bool  done)
private

Friends And Related Function Documentation

◆ BgpXmppBasicTest

friend class BgpXmppBasicTest
friend

Definition at line 118 of file xmpp_server.h.

◆ DeleteActor

friend class DeleteActor
friend

Definition at line 119 of file xmpp_server.h.

◆ XmppStateMachineTest

friend class XmppStateMachineTest
friend

Definition at line 120 of file xmpp_server.h.

Member Data Documentation

◆ auth_enabled_

bool XmppServer::auth_enabled_
private

Definition at line 145 of file xmpp_server.h.

◆ connection_endpoint_map_

ConnectionEndpointMap XmppServer::connection_endpoint_map_
private

Definition at line 136 of file xmpp_server.h.

◆ connection_event_map_

ConnectionEventCbMap XmppServer::connection_event_map_
private

Definition at line 142 of file xmpp_server.h.

◆ connection_map_

ConnectionMap XmppServer::connection_map_
protected

Definition at line 114 of file xmpp_server.h.

◆ connection_map_mutex_

tbb::reader_writer_lock XmppServer::connection_map_mutex_
mutableprotected

Definition at line 112 of file xmpp_server.h.

◆ connection_queue_

WorkQueue<XmppServerConnection *> XmppServer::connection_queue_
private

Definition at line 151 of file xmpp_server.h.

◆ deleted_connection_set_

ConnectionSet XmppServer::deleted_connection_set_
private

Definition at line 132 of file xmpp_server.h.

◆ deleter_

boost::scoped_ptr<DeleteActor> XmppServer::deleter_
private

Definition at line 140 of file xmpp_server.h.

◆ deletion_mutex_

tbb::mutex XmppServer::deletion_mutex_
private

Definition at line 138 of file xmpp_server.h.

◆ dscp_value_

uint8_t XmppServer::dscp_value_
private

Definition at line 149 of file xmpp_server.h.

◆ endpoint_map_mutex_

tbb::mutex XmppServer::endpoint_map_mutex_
private

Definition at line 135 of file xmpp_server.h.

◆ gr_helper_disable_

bool XmppServer::gr_helper_disable_
private

Definition at line 147 of file xmpp_server.h.

◆ lifetime_manager_

boost::scoped_ptr<LifetimeManager> XmppServer::lifetime_manager_
private

Definition at line 139 of file xmpp_server.h.

◆ log_uve_

bool XmppServer::log_uve_
private

Definition at line 144 of file xmpp_server.h.

◆ max_connections_

size_t XmppServer::max_connections_
private

Definition at line 133 of file xmpp_server.h.

◆ server_addr_

std::string XmppServer::server_addr_
private

Definition at line 143 of file xmpp_server.h.

◆ subcluster_name_

std::string XmppServer::subcluster_name_
private

Definition at line 150 of file xmpp_server.h.

◆ tcp_hold_time_

int XmppServer::tcp_hold_time_
private

Definition at line 146 of file xmpp_server.h.

◆ xmpp_config_updater_

boost::scoped_ptr<XmppConfigUpdater> XmppServer::xmpp_config_updater_
private

Definition at line 148 of file xmpp_server.h.


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