OpenSDN source code
|
#include <sandesh_session.h>
Public Member Functions | |
SandeshSession (SslServer *client, SslSocket *socket, int task_instance, int writer_task_id, int reader_task_id) | |
virtual | ~SandeshSession () |
virtual void | Shutdown () |
virtual void | OnRead (Buffer buffer) |
virtual void | WriteReady (const boost::system::error_code &ec) |
virtual bool | EnqueueBuffer (u_int8_t *buf, u_int32_t buf_len) |
Sandesh::SandeshQueue * | send_queue () |
Sandesh::SandeshBufferQueue * | send_buffer_queue () |
SandeshWriter * | writer () |
void | SetConnection (SandeshConnection *connection) |
SandeshConnection * | connection () |
void | SetReceiveMsgCb (SandeshReceiveMsgCb cb) |
virtual int | GetSessionInstance () const |
virtual void | EnqueueClose () |
virtual boost::system::error_code | SetSocketOptions () |
virtual std::string | ToString () const |
void | set_stats_client (StatsClient *stats_client) |
void | increment_recv_msg () |
void | increment_recv_msg_fail () |
void | increment_recv_fail () |
void | increment_send_msg () |
void | increment_send_msg_fail () |
void | increment_send_buffer_fail () |
void | increment_wait_msgq_enqueue () |
void | increment_wait_msgq_dequeue () |
void | increment_write_ready_cb_error () |
const SandeshSessionStats & | GetStats () const |
void | SetSendQueueWaterMark (Sandesh::QueueWaterMarkInfo &wm_info) |
void | ResetSendQueueWaterMark () |
SandeshLevel::type | SendingLevel () const |
![]() | |
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 () |
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 |
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 Member Functions | |
static Sandesh * | DecodeCtrlSandesh (const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t &header_offset) |
![]() | |
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) |
Protected Member Functions | |
virtual int | reader_task_id () const |
![]() | |
virtual | ~SslSession () |
![]() | |
void | AsyncReadStartInternal (TcpSessionPtr session) |
virtual | ~TcpSession () |
void | AsyncWriteInternal (TcpSessionPtr session) |
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 () |
Private Member Functions | |
bool | SendMsg (SandeshElement element) |
bool | SendBuffer (boost::shared_ptr< TMemoryBuffer > sbuffer) |
bool | SessionSendReady () |
void | SetSendingLevel (size_t count, SandeshLevel::type level) |
DISALLOW_COPY_AND_ASSIGN (SandeshSession) | |
Private Attributes | |
int | instance_ |
boost::scoped_ptr< SandeshWriter > | writer_ |
boost::scoped_ptr< SandeshReader > | reader_ |
boost::scoped_ptr < Sandesh::SandeshQueue > | send_queue_ |
boost::scoped_ptr < Sandesh::SandeshBufferQueue > | send_buffer_queue_ |
StatsClient * | stats_client_ |
SandeshConnection * | connection_ |
tbb::mutex | conn_mutex_ |
tbb::mutex | send_mutex_ |
int | keepalive_idle_time_ |
int | keepalive_interval_ |
int | keepalive_probes_ |
int | tcp_user_timeout_ |
int | reader_task_id_ |
SandeshLevel::type | sending_level_ |
SandeshSessionStats | sstats_ |
Static Private Attributes | |
static const int | kSessionKeepaliveIdleTime = 15 |
static const int | kSessionKeepaliveInterval = 3 |
static const int | kSessionKeepaliveProbes = 5 |
static const int | kSessionTcpUserTimeout = 30000 |
static const int | kQueueSize = 200 * 1024 * 1024 |
Friends | |
class | SandeshSessionTest |
Additional Inherited Members | |
![]() | |
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 |
![]() | |
static const int | kDefaultBufferSize = 16 * 1024 |
static const int | kDefaultWriteBufferSize = 32 * 1024 |
![]() | |
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) |
![]() | |
tbb::mutex | mutex_ |
io::SocketStats | stats_ |
boost::scoped_ptr< Strand > | io_strand_ |
Definition at line 143 of file sandesh_session.h.
|
virtual |
Definition at line 308 of file sandesh_session.cc.
|
inline |
Definition at line 167 of file sandesh_session.h.
|
static |
|
private |
|
virtual |
|
virtual |
|
inlinevirtual |
Reimplemented from TcpSession.
Definition at line 174 of file sandesh_session.h.
|
inline |
Definition at line 211 of file sandesh_session.h.
|
inline |
Definition at line 190 of file sandesh_session.h.
|
inline |
Definition at line 184 of file sandesh_session.h.
|
inline |
Definition at line 187 of file sandesh_session.h.
|
inline |
Definition at line 199 of file sandesh_session.h.
|
inline |
Definition at line 193 of file sandesh_session.h.
|
inline |
Definition at line 196 of file sandesh_session.h.
|
inline |
Definition at line 205 of file sandesh_session.h.
|
inline |
Definition at line 202 of file sandesh_session.h.
|
inline |
Definition at line 208 of file sandesh_session.h.
|
virtual |
Implements TcpSession.
Definition at line 365 of file sandesh_session.cc.
|
inlineprotectedvirtual |
Reimplemented from TcpSession.
Definition at line 219 of file sandesh_session.h.
void SandeshSession::ResetSendQueueWaterMark | ( | ) |
Definition at line 328 of file sandesh_session.cc.
|
inline |
Definition at line 157 of file sandesh_session.h.
|
inline |
Definition at line 154 of file sandesh_session.h.
|
private |
SandeshLevel::type SandeshSession::SendingLevel | ( | ) | const |
Definition at line 339 of file sandesh_session.cc.
|
private |
|
private |
|
inline |
Definition at line 180 of file sandesh_session.h.
|
inline |
|
inline |
Definition at line 171 of file sandesh_session.h.
|
private |
Definition at line 333 of file sandesh_session.cc.
void SandeshSession::SetSendQueueWaterMark | ( | Sandesh::QueueWaterMarkInfo & | wm_info | ) |
|
virtual |
Reimplemented from TcpSession.
Definition at line 356 of file sandesh_session.cc.
|
virtual |
|
virtual |
Reimplemented from TcpSession.
Definition at line 350 of file sandesh_session.cc.
|
inline |
Definition at line 160 of file sandesh_session.h.
|
inlinevirtual |
Reimplemented from TcpSession.
Definition at line 150 of file sandesh_session.h.
|
friend |
Definition at line 224 of file sandesh_session.h.
|
private |
Definition at line 245 of file sandesh_session.h.
|
private |
Definition at line 244 of file sandesh_session.h.
|
private |
Definition at line 238 of file sandesh_session.h.
|
private |
Definition at line 247 of file sandesh_session.h.
|
private |
Definition at line 248 of file sandesh_session.h.
|
private |
Definition at line 249 of file sandesh_session.h.
|
staticprivate |
Definition at line 231 of file sandesh_session.h.
|
staticprivate |
Definition at line 227 of file sandesh_session.h.
|
staticprivate |
Definition at line 228 of file sandesh_session.h.
|
staticprivate |
Definition at line 229 of file sandesh_session.h.
|
staticprivate |
Definition at line 230 of file sandesh_session.h.
|
private |
Definition at line 240 of file sandesh_session.h.
|
private |
Definition at line 251 of file sandesh_session.h.
|
private |
Definition at line 242 of file sandesh_session.h.
|
private |
Definition at line 246 of file sandesh_session.h.
|
private |
Definition at line 241 of file sandesh_session.h.
|
private |
Definition at line 252 of file sandesh_session.h.
|
private |
Definition at line 255 of file sandesh_session.h.
|
private |
Definition at line 243 of file sandesh_session.h.
|
private |
Definition at line 250 of file sandesh_session.h.
|
private |
Definition at line 239 of file sandesh_session.h.