OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
< TcpServer
TcpServerPtr
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 

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,
ConnectionEventCb
ConnectionEventCbMap
 

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
< LifetimeManager
lifetime_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
< XmppConfigUpdater
xmpp_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

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

Definition at line 123 of file xmpp_server.h.

Definition at line 42 of file xmpp_server.h.

Definition at line 124 of file xmpp_server.h.

Definition at line 113 of file xmpp_server.h.

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

Definition at line 122 of file xmpp_server.h.

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

Definition at line 34 of file xmpp_server.h.

Constructor & Destructor Documentation

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

Definition at line 219 of file xmpp_server.cc.

XmppServer::~XmppServer ( )
virtual

Definition at line 295 of file xmpp_server.cc.

Here is the call graph for this function:

Member Function Documentation

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:

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:

void XmppServer::ClearAllConnections ( )

Definition at line 445 of file xmpp_server.cc.

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

Definition at line 427 of file xmpp_server.cc.

size_t XmppServer::ConnectionCount ( ) const

Definition at line 405 of file xmpp_server.cc.

Here is the call graph for this function:

size_t XmppServer::ConnectionEventCount ( ) const

Definition at line 396 of file xmpp_server.cc.

size_t XmppServer::ConnectionMapSize ( ) const
private

Definition at line 400 of file xmpp_server.cc.

void XmppServer::CreateConfigUpdater ( BgpConfigManager config_manager)

Definition at line 234 of file xmpp_server.cc.

XmppServerConnection * XmppServer::CreateConnection ( XmppSession session)
virtual

Definition at line 566 of file xmpp_server.cc.

Here is the call graph for this function:

TcpSession * XmppServer::CreateSession ( )
virtual

Reimplemented from TcpServer.

Definition at line 364 of file xmpp_server.cc.

Here is the call graph for this function:

LifetimeActor * XmppServer::deleter ( )
virtual

Implements XmppConnectionManager.

Definition at line 352 of file xmpp_server.cc.

LifetimeActor * XmppServer::deleter ( ) const
virtual

Definition at line 356 of file xmpp_server.cc.

bool XmppServer::DequeueConnection ( XmppServerConnection connection)
private

Definition at line 600 of file xmpp_server.cc.

Here is the call graph for this function:

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

Definition at line 100 of file xmpp_server.h.

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:

void XmppServer::FillShowServer ( ShowXmppServerResp *  resp) const

Definition at line 747 of file xmpp_server.cc.

Here is the call graph for this function:

XmppServerConnection * XmppServer::FindConnection ( Endpoint  remote_endpoint)
virtual

Definition at line 409 of file xmpp_server.cc.

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

Definition at line 675 of file xmpp_server.cc.

size_t XmppServer::GetConnectionQueueSize ( ) const
private

Definition at line 641 of file xmpp_server.cc.

Here is the call graph for this function:

uint32_t XmppServer::GetEndOfRibReceiveTime ( ) const

Definition at line 252 of file xmpp_server.cc.

uint32_t XmppServer::GetEndOfRibSendTime ( ) const

Definition at line 258 of file xmpp_server.cc.

uint16_t XmppServer::GetGracefulRestartTime ( ) const

Definition at line 238 of file xmpp_server.cc.

uint32_t XmppServer::GetLongLivedGracefulRestartTime ( ) const

Definition at line 245 of file xmpp_server.cc.

bool XmppServer::gr_helper_disable ( ) const
inline

Definition at line 95 of file xmpp_server.h.

bool XmppServer::Initialize ( short  port)
virtual

Definition at line 300 of file xmpp_server.cc.

Here is the call graph for this function:

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:

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:

void XmppServer::InsertConnection ( XmppServerConnection connection)
virtual

Definition at line 545 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::InsertDeletedConnection ( XmppServerConnection connection)
virtual

Definition at line 652 of file xmpp_server.cc.

Here is the call graph for this function:

bool XmppServer::IsGRHelperModeEnabled ( ) const

Definition at line 264 of file xmpp_server.cc.

bool XmppServer::IsPeerCloseGraceful ( ) const
virtual

Definition at line 280 of file xmpp_server.cc.

Here is the call graph for this function:

LifetimeManager * XmppServer::lifetime_manager ( )

Definition at line 360 of file xmpp_server.cc.

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

Definition at line 683 of file xmpp_server.cc.

Here is the call graph for this function:

bool XmppServer::MayDelete ( ) const

Definition at line 328 of file xmpp_server.cc.

Here is the call graph for this function:

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

Definition at line 463 of file xmpp_server.cc.

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

Definition at line 452 of file xmpp_server.cc.

void XmppServer::ReleaseConnectionEndpoint ( XmppServerConnection connection)

Definition at line 721 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::RemoveConnection ( XmppServerConnection connection)
virtual

Definition at line 518 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::RemoveDeletedConnection ( XmppServerConnection connection)
virtual

Definition at line 665 of file xmpp_server.cc.

Here is the call graph for this function:

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

Definition at line 76 of file xmpp_server.h.

void XmppServer::SessionShutdown ( )

Definition at line 318 of file xmpp_server.cc.

Here is the call graph for this function:

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:

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:

void XmppServer::SetConnectionQueueDisable ( bool  disabled)
private

Definition at line 645 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::SetDscpValue ( uint8_t  value)

Definition at line 585 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::Shutdown ( void  )

Definition at line 339 of file xmpp_server.cc.

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

Definition at line 101 of file xmpp_server.h.

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

Definition at line 529 of file xmpp_server.cc.

Here is the call graph for this function:

void XmppServer::Terminate ( )

Definition at line 347 of file xmpp_server.cc.

Here is the call graph for this function:

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

Definition at line 457 of file xmpp_server.cc.

void XmppServer::UpdateAllConnections ( uint8_t  time_out)

Definition at line 438 of file xmpp_server.cc.

void XmppServer::WorkQueueExitCallback ( bool  done)
private

Friends And Related Function Documentation

friend class BgpXmppBasicTest
friend

Definition at line 117 of file xmpp_server.h.

friend class DeleteActor
friend

Definition at line 119 of file xmpp_server.h.

friend class XmppStateMachineTest
friend

Definition at line 120 of file xmpp_server.h.

Member Data Documentation

bool XmppServer::auth_enabled_
private

Definition at line 145 of file xmpp_server.h.

ConnectionEndpointMap XmppServer::connection_endpoint_map_
private

Definition at line 136 of file xmpp_server.h.

ConnectionEventCbMap XmppServer::connection_event_map_
private

Definition at line 142 of file xmpp_server.h.

ConnectionMap XmppServer::connection_map_
protected

Definition at line 114 of file xmpp_server.h.

tbb::reader_writer_lock XmppServer::connection_map_mutex_
mutableprotected

Definition at line 112 of file xmpp_server.h.

WorkQueue<XmppServerConnection *> XmppServer::connection_queue_
private

Definition at line 151 of file xmpp_server.h.

ConnectionSet XmppServer::deleted_connection_set_
private

Definition at line 132 of file xmpp_server.h.

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

Definition at line 140 of file xmpp_server.h.

tbb::mutex XmppServer::deletion_mutex_
private

Definition at line 138 of file xmpp_server.h.

uint8_t XmppServer::dscp_value_
private

Definition at line 149 of file xmpp_server.h.

tbb::mutex XmppServer::endpoint_map_mutex_
private

Definition at line 135 of file xmpp_server.h.

bool XmppServer::gr_helper_disable_
private

Definition at line 147 of file xmpp_server.h.

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

Definition at line 139 of file xmpp_server.h.

bool XmppServer::log_uve_
private

Definition at line 144 of file xmpp_server.h.

size_t XmppServer::max_connections_
private

Definition at line 133 of file xmpp_server.h.

std::string XmppServer::server_addr_
private

Definition at line 143 of file xmpp_server.h.

std::string XmppServer::subcluster_name_
private

Definition at line 150 of file xmpp_server.h.

int XmppServer::tcp_hold_time_
private

Definition at line 146 of file xmpp_server.h.

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: