OpenSDN source code
|
#include <xmpp_session.h>
Public Types | |
typedef std::pair< uint64_t, uint64_t > | StatsPair |
![]() | |
typedef boost::asio::ssl::stream < boost::asio::ip::tcp::socket > | SslSocket |
![]() | |
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 () |
XmppConnection * | Connection () |
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) |
![]() | |
SslSession (SslServer *server, SslSocket *socket, bool async_read_ready=true) | |
virtual Socket * | socket () const |
void | TriggerSslHandShake (SslHandShakeCallbackHandler) |
bool | IsSslDisabled () |
bool | IsSslHandShakeDelayed () |
bool | IsSslHandShakeSuccess () |
bool | IsSslHandShakeSuccessLocked () |
bool | IsSslHandShakeInProgress () |
void | SetSslHandShakeInProgress (bool state) |
![]() | |
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 () |
TcpServer * | server () |
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::SocketStats & | GetSocketStats () 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 const int | kDefaultBufferSize = 16 * 1024 |
static const int | kDefaultWriteBufferSize = 32 * 1024 |
Protected Member Functions | |
virtual void | OnRead (Buffer buffer) |
![]() | |
virtual | ~SslSession () |
![]() | |
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 |
![]() | |
tbb::mutex | mutex_ |
io::SocketStats | stats_ |
boost::scoped_ptr< Strand > | io_strand_ |
Private Types | |
typedef std::deque< Buffer > | BufferQueue |
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 | |
XmppConnectionManager * | manager_ |
XmppConnection * | connection_ |
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< StatsPair > | stats_ |
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 bool | IsSocketErrorHard (const boost::system::error_code &ec) |
![]() | |
static const uint8_t * | BufferData (const Buffer &buffer) |
static size_t | BufferSize (const Buffer &buffer) |
static bool | IsSocketErrorHard (const boost::system::error_code &ec) |
![]() | |
typedef boost::intrusive_ptr < TcpSession > | TcpSessionPtr |
typedef boost::asio::strand < boost::asio::io_context::executor_type > | Strand |
![]() | |
static void | AsyncReadHandler (TcpSessionPtr session) |
static void | AsyncWriteHandler (TcpSessionPtr session, const boost::system::error_code &error, std::size_t bytes_transferred) |
Definition at line 18 of file xmpp_session.h.
|
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.
XmppSession::XmppSession | ( | XmppConnectionManager * | manager, |
SslSocket * | sock, | ||
bool | async_ready = true |
||
) |
Definition at line 33 of file xmpp_session.cc.
|
virtual |
void XmppSession::ClearConnection | ( | ) |
Definition at line 63 of file xmpp_session.cc.
|
inline |
Definition at line 26 of file xmpp_session.h.
|
private |
boost::system::error_code XmppSession::EnableTcpKeepalive | ( | int | tcp_hold_time | ) |
|
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.
|
private |
Definition at line 156 of file xmpp_session.cc.
|
private |
|
private |
|
protectedvirtual |
Implements TcpSession.
Definition at line 276 of file xmpp_session.cc.
void XmppSession::ProcessWriteReady | ( | ) |
|
private |
Definition at line 150 of file xmpp_session.cc.
|
private |
void XmppSession::SetConnection | ( | XmppConnection * | connection | ) |
XmppSession::StatsPair XmppSession::Stats | ( | unsigned int | message_type | ) | const |
Definition at line 97 of file xmpp_session.cc.
|
private |
Definition at line 131 of file xmpp_session.cc.
|
virtual |
Reimplemented from TcpSession.
Definition at line 91 of file xmpp_session.cc.
|
friend |
Definition at line 36 of file xmpp_session.h.
|
private |
Definition at line 65 of file xmpp_session.h.
|
private |
Definition at line 66 of file xmpp_session.h.
|
private |
Definition at line 63 of file xmpp_session.h.
|
staticprivate |
Definition at line 85 of file xmpp_session.h.
|
protected |
Definition at line 43 of file xmpp_session.h.
|
private |
Definition at line 72 of file xmpp_session.h.
|
private |
Definition at line 73 of file xmpp_session.h.
|
private |
Definition at line 74 of file xmpp_session.h.
|
static |
Definition at line 35 of file xmpp_session.h.
|
staticprivate |
Definition at line 52 of file xmpp_session.h.
|
private |
Definition at line 62 of file xmpp_session.h.
|
private |
Definition at line 67 of file xmpp_session.h.
|
staticprivate |
Definition at line 78 of file xmpp_session.h.
|
staticprivate |
Definition at line 84 of file xmpp_session.h.
|
private |
Definition at line 64 of file xmpp_session.h.
|
private |
Definition at line 70 of file xmpp_session.h.
|
staticprivate |
Definition at line 83 of file xmpp_session.h.
|
private |
Definition at line 71 of file xmpp_session.h.
|
staticprivate |
Definition at line 82 of file xmpp_session.h.
|
private |
Definition at line 76 of file xmpp_session.h.
|
staticprivate |
Definition at line 79 of file xmpp_session.h.
|
staticprivate |
Definition at line 80 of file xmpp_session.h.
|
private |
Definition at line 68 of file xmpp_session.h.
|
private |
Definition at line 69 of file xmpp_session.h.
|
private |
Definition at line 75 of file xmpp_session.h.
|
staticprivate |
Definition at line 81 of file xmpp_session.h.