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

#include <xmpp_session.h>

Inheritance diagram for XmppSession:
Collaboration diagram for XmppSession:

Public Types

typedef std::pair< uint64_t,
uint64_t > 
StatsPair
 
- Public Types inherited from SslSession
typedef
boost::asio::ssl::stream
< boost::asio::ip::tcp::socket > 
SslSocket
 
- Public Types inherited from TcpSession
enum  Event {
  EVENT_NONE, ACCEPT, CONNECT_COMPLETE, CONNECT_FAILED,
  CLOSE
}
 
enum  Direction { ACTIVE, PASSIVE }
 
typedef
boost::asio::ip::tcp::socket 
Socket
 
typedef
boost::asio::ip::tcp::socket::native_handle_type 
NativeSocketType
 
typedef
boost::asio::ip::tcp::endpoint 
Endpoint
 
typedef boost::function< void(TcpSession
*, Event)> 
EventObserver
 
typedef boost::asio::const_buffer Buffer
 

Public Member Functions

 XmppSession (XmppConnectionManager *manager, SslSocket *sock, bool async_ready=true)
 
virtual ~XmppSession ()
 
void SetConnection (XmppConnection *connection)
 
void ClearConnection ()
 
XmppConnectionConnection ()
 
virtual void WriteReady (const boost::system::error_code &error)
 
void ProcessWriteReady ()
 
StatsPair Stats (unsigned int message_type) const
 
void IncStats (unsigned int message_type, uint64_t bytes)
 
virtual int GetSessionInstance () const
 
boost::system::error_code EnableTcpKeepalive (int tcp_hold_time)
 
- Public Member Functions inherited from SslSession
 SslSession (SslServer *server, SslSocket *socket, bool async_read_ready=true)
 
virtual Socketsocket () const
 
void TriggerSslHandShake (SslHandShakeCallbackHandler)
 
bool IsSslDisabled ()
 
bool IsSslHandShakeDelayed ()
 
bool IsSslHandShakeSuccess ()
 
bool IsSslHandShakeSuccessLocked ()
 
bool IsSslHandShakeInProgress ()
 
void SetSslHandShakeInProgress (bool state)
 
- Public Member Functions inherited from TcpSession
 TcpSession (TcpServer *server, Socket *socket, bool async_read_ready=true, size_t buffer_send_size=TcpSession::kDefaultWriteBufferSize)
 
virtual bool Send (const uint8_t *data, size_t size, size_t *sent)
 
virtual bool Connected (Endpoint remote)
 
virtual void Accepted ()
 
void ConnectFailed ()
 
void Close ()
 
virtual std::string ToString () const
 
NativeSocketType sock_descriptor ()
 
TcpServerserver ()
 
int32_t local_port () const
 
int32_t remote_port () const
 
void set_observer (EventObserver observer)
 
virtual void ReleaseBuffer (Buffer buffer)
 
bool IsEstablished () const
 
bool IsClosed () const
 
bool IsServerSession ()
 
Endpoint remote_endpoint () const
 
const std::string & remote_addr_string () const
 
Endpoint local_endpoint () const
 
const boost::system::error_code & close_reason () const
 
virtual boost::system::error_code SetSocketOptions ()
 
void set_read_on_connect (bool read)
 
void SessionEstablished (Endpoint remote, Direction direction)
 
virtual void AsyncReadStart ()
 
virtual void SetDeferReader (bool defer_reader)
 
virtual bool IsReaderDeferred () const
 
const io::SocketStatsGetSocketStats () const
 
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 (uint32_t peer_ip, const std::string &md5_password)
 
int ClearMd5SocketOption (uint32_t peer_ip)
 
int SetDscpSocketOption (uint8_t value)
 
uint8_t GetDscpValue () const
 
const std::string & ToUVEKey () const
 
boost::system::error_code SetTcpNoDelay ()
 
boost::system::error_code SetTcpSendBufSize (uint32_t size)
 
boost::system::error_code SetTcpRecvBufSize (uint32_t size)
 

Static Public Attributes

static const int kMaxMessageSize = 4096
 
- Static Public Attributes inherited from TcpSession
static const int kDefaultBufferSize = 16 * 1024
 
static const int kDefaultWriteBufferSize = 32 * 1024
 

Protected Member Functions

virtual void OnRead (Buffer buffer)
 
- Protected Member Functions inherited from SslSession
virtual ~SslSession ()
 
- Protected Member Functions inherited from TcpSession
void AsyncReadStartInternal (TcpSessionPtr session)
 
virtual ~TcpSession ()
 
void AsyncWriteInternal (TcpSessionPtr session)
 
virtual int reader_task_id () const
 
bool established () const
 
EventObserver observer ()
 
boost::system::error_code SetSocketKeepaliveOptions (int keepalive_time, int keepalive_intvl, int keepalive_probes, int tcp_user_timeout_val=0)
 
void CloseInternal (const boost::system::error_code &ec, bool call_observer, bool notify_server=true)
 
void TriggerAsyncReadHandler ()
 

Protected Attributes

std::string jid
 
- Protected Attributes inherited from TcpSession
tbb::mutex mutex_
 
io::SocketStats stats_
 
boost::scoped_ptr< Strandio_strand_
 

Private Types

typedef std::deque< BufferBufferQueue
 

Private Member Functions

contrail::regex tag_to_pattern (const char *)
 
int MatchRegex (const contrail::regex &patt)
 
bool Match (Buffer buffer, int *result, bool NewBuf)
 
void SetBuf (const std::string &)
 
void ReplaceBuf (const std::string &)
 
bool LeftOver () const
 
 DISALLOW_COPY_AND_ASSIGN (XmppSession)
 

Private Attributes

XmppConnectionManagermanager_
 
XmppConnectionconnection_
 
BufferQueue queue_
 
std::string begin_tag_
 
std::string buf_
 
std::string::const_iterator offset_
 
int tag_known_
 
int task_instance_
 
boost::match_results
< std::string::const_iterator > 
res_
 
std::vector< StatsPairstats_
 
int keepalive_idle_time_
 
int keepalive_interval_
 
int keepalive_probes_
 
int tcp_user_timeout_
 
bool stream_open_matched_
 

Static Private Attributes

static const int kSessionKeepaliveProbes = 3
 
static const contrail::regex patt_
 
static const contrail::regex stream_patt_
 
static const contrail::regex stream_res_end_
 
static const contrail::regex whitespace_
 
static const contrail::regex stream_features_patt_
 
static const contrail::regex starttls_patt_
 
static const contrail::regex proceed_patt_
 
static const contrail::regex end_patt_
 

Friends

class XmppRegexMock
 

Additional Inherited Members

- Static Public Member Functions inherited from SslSession
static bool IsSocketErrorHard (const boost::system::error_code &ec)
 
- Static Public Member Functions inherited from TcpSession
static const uint8_t * BufferData (const Buffer &buffer)
 
static size_t BufferSize (const Buffer &buffer)
 
static bool IsSocketErrorHard (const boost::system::error_code &ec)
 
- Protected Types inherited from TcpSession
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 
typedef boost::asio::strand
< boost::asio::io_context::executor_type > 
Strand
 
- Static Protected Member Functions inherited from TcpSession
static void AsyncReadHandler (TcpSessionPtr session)
 
static void AsyncWriteHandler (TcpSessionPtr session, const boost::system::error_code &error, std::size_t bytes_transferred)
 

Detailed Description

Definition at line 18 of file xmpp_session.h.

Member Typedef Documentation

typedef std::deque<Buffer> XmppSession::BufferQueue
private

Definition at line 53 of file xmpp_session.h.

typedef std::pair<uint64_t, uint64_t> XmppSession::StatsPair

Definition at line 31 of file xmpp_session.h.

Constructor & Destructor Documentation

XmppSession::XmppSession ( XmppConnectionManager manager,
SslSocket sock,
bool  async_ready = true 
)

Definition at line 33 of file xmpp_session.cc.

XmppSession::~XmppSession ( )
virtual

Definition at line 47 of file xmpp_session.cc.

Here is the call graph for this function:

Member Function Documentation

void XmppSession::ClearConnection ( )

Definition at line 63 of file xmpp_session.cc.

XmppConnection* XmppSession::Connection ( )
inline

Definition at line 26 of file xmpp_session.h.

XmppSession::DISALLOW_COPY_AND_ASSIGN ( XmppSession  )
private
boost::system::error_code XmppSession::EnableTcpKeepalive ( int  tcp_hold_time)

Definition at line 108 of file xmpp_session.cc.

Here is the call graph for this function:

virtual int XmppSession::GetSessionInstance ( ) const
inlinevirtual

Reimplemented from TcpSession.

Definition at line 38 of file xmpp_session.h.

void XmppSession::IncStats ( unsigned int  message_type,
uint64_t  bytes 
)

Definition at line 102 of file xmpp_session.cc.

bool XmppSession::LeftOver ( ) const
private

Definition at line 156 of file xmpp_session.cc.

bool XmppSession::Match ( Buffer  buffer,
int *  result,
bool  NewBuf 
)
private

Definition at line 183 of file xmpp_session.cc.

Here is the call graph for this function:

int XmppSession::MatchRegex ( const contrail::regex patt)
private

Definition at line 164 of file xmpp_session.cc.

Here is the call graph for this function:

void XmppSession::OnRead ( Buffer  buffer)
protectedvirtual

Implements TcpSession.

Definition at line 276 of file xmpp_session.cc.

Here is the call graph for this function:

void XmppSession::ProcessWriteReady ( )

Definition at line 72 of file xmpp_session.cc.

Here is the call graph for this function:

void XmppSession::ReplaceBuf ( const std::string &  str)
private

Definition at line 150 of file xmpp_session.cc.

void XmppSession::SetBuf ( const std::string &  str)
private

Definition at line 140 of file xmpp_session.cc.

Here is the call graph for this function:

void XmppSession::SetConnection ( XmppConnection connection)

Definition at line 52 of file xmpp_session.cc.

Here is the call graph for this function:

XmppSession::StatsPair XmppSession::Stats ( unsigned int  message_type) const

Definition at line 97 of file xmpp_session.cc.

regex XmppSession::tag_to_pattern ( const char *  tag)
private

Definition at line 131 of file xmpp_session.cc.

void XmppSession::WriteReady ( const boost::system::error_code &  error)
virtual

Reimplemented from TcpSession.

Definition at line 91 of file xmpp_session.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class XmppRegexMock
friend

Definition at line 36 of file xmpp_session.h.

Member Data Documentation

std::string XmppSession::begin_tag_
private

Definition at line 65 of file xmpp_session.h.

std::string XmppSession::buf_
private

Definition at line 66 of file xmpp_session.h.

XmppConnection* XmppSession::connection_
private

Definition at line 63 of file xmpp_session.h.

const regex XmppSession::end_patt_
staticprivate

Definition at line 85 of file xmpp_session.h.

std::string XmppSession::jid
protected

Definition at line 43 of file xmpp_session.h.

int XmppSession::keepalive_idle_time_
private

Definition at line 72 of file xmpp_session.h.

int XmppSession::keepalive_interval_
private

Definition at line 73 of file xmpp_session.h.

int XmppSession::keepalive_probes_
private

Definition at line 74 of file xmpp_session.h.

const int XmppSession::kMaxMessageSize = 4096
static

Definition at line 35 of file xmpp_session.h.

const int XmppSession::kSessionKeepaliveProbes = 3
staticprivate

Definition at line 52 of file xmpp_session.h.

XmppConnectionManager* XmppSession::manager_
private

Definition at line 62 of file xmpp_session.h.

std::string::const_iterator XmppSession::offset_
private

Definition at line 67 of file xmpp_session.h.

const regex XmppSession::patt_
staticprivate

Definition at line 78 of file xmpp_session.h.

const regex XmppSession::proceed_patt_
staticprivate

Definition at line 84 of file xmpp_session.h.

BufferQueue XmppSession::queue_
private

Definition at line 64 of file xmpp_session.h.

boost::match_results<std::string::const_iterator> XmppSession::res_
private

Definition at line 70 of file xmpp_session.h.

const regex XmppSession::starttls_patt_
staticprivate

Definition at line 83 of file xmpp_session.h.

std::vector<StatsPair> XmppSession::stats_
private

Definition at line 71 of file xmpp_session.h.

const regex XmppSession::stream_features_patt_
staticprivate

Definition at line 82 of file xmpp_session.h.

bool XmppSession::stream_open_matched_
private

Definition at line 76 of file xmpp_session.h.

const regex XmppSession::stream_patt_
staticprivate

Definition at line 79 of file xmpp_session.h.

const regex XmppSession::stream_res_end_
staticprivate

Definition at line 80 of file xmpp_session.h.

int XmppSession::tag_known_
private

Definition at line 68 of file xmpp_session.h.

int XmppSession::task_instance_
private

Definition at line 69 of file xmpp_session.h.

int XmppSession::tcp_user_timeout_
private

Definition at line 75 of file xmpp_session.h.

const regex XmppSession::whitespace_
staticprivate

Definition at line 81 of file xmpp_session.h.


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