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

#include <ssl_session.h>

Inheritance diagram for SslSession:
Collaboration diagram for SslSession:

Classes

class  SslReader
 

Public Types

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

 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)
 
virtual int GetSessionInstance () const
 
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 Member Functions

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 Member Functions

virtual ~SslSession ()
 
- Protected Member Functions inherited from TcpSession
void AsyncReadStartInternal (TcpSessionPtr session)
 
virtual ~TcpSession ()
 
virtual void OnRead (Buffer buffer)=0
 
virtual void WriteReady (const boost::system::error_code &error)
 
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 ()
 

Private Member Functions

size_t ReadSome (boost::asio::mutable_buffer buffer, boost::system::error_code *error)
 
void AsyncWrite (const uint8_t *data, std::size_t size)
 
virtual TaskCreateReaderTask (boost::asio::mutable_buffer, size_t)
 
void SetSslHandShakeSuccess ()
 
void SetSslHandShakeFailure ()
 
virtual size_t GetReadBufferSize () const
 
virtual void AsyncReadSome ()
 
 DISALLOW_COPY_AND_ASSIGN (SslSession)
 

Static Private Member Functions

static void TriggerSslHandShakeInternal (SslSessionPtr ptr, SslHandShakeCallbackHandler cb)
 
static void SslHandShakeCallback (SslHandShakeCallbackHandler cb, SslSessionPtr, const boost::system::error_code &error)
 

Private Attributes

boost::scoped_ptr< SslSocketssl_socket_
 
bool ssl_handshake_in_progress_
 
bool ssl_handshake_success_
 
bool ssl_enabled_
 
bool ssl_handshake_delayed_
 
size_t ssl_last_read_len_
 

Friends

class SslServer
 

Additional Inherited Members

- Static Public Attributes inherited from TcpSession
static const int kDefaultBufferSize = 16 * 1024
 
static const int kDefaultWriteBufferSize = 32 * 1024
 
- 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)
 
- Protected Attributes inherited from TcpSession
tbb::mutex mutex_
 
io::SocketStats stats_
 
boost::scoped_ptr< Strandio_strand_
 

Detailed Description

Definition at line 16 of file ssl_session.h.

Member Typedef Documentation

typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SslSession::SslSocket

Definition at line 18 of file ssl_session.h.

Constructor & Destructor Documentation

SslSession::SslSession ( SslServer server,
SslSocket socket,
bool  async_read_ready = true 
)

Definition at line 69 of file ssl_session.cc.

SslSession::~SslSession ( )
protectedvirtual

Definition at line 85 of file ssl_session.cc.

Member Function Documentation

void SslSession::AsyncReadSome ( )
privatevirtual

Reimplemented from TcpSession.

Definition at line 107 of file ssl_session.cc.

Here is the call graph for this function:

void SslSession::AsyncWrite ( const uint8_t *  data,
std::size_t  size 
)
privatevirtual

Reimplemented from TcpSession.

Definition at line 152 of file ssl_session.cc.

Here is the call graph for this function:

Task * SslSession::CreateReaderTask ( boost::asio::mutable_buffer  ,
size_t   
)
privatevirtual

Reimplemented from TcpSession.

Definition at line 88 of file ssl_session.cc.

Here is the call graph for this function:

SslSession::DISALLOW_COPY_AND_ASSIGN ( SslSession  )
private
size_t SslSession::GetReadBufferSize ( ) const
privatevirtual

Reimplemented from TcpSession.

Definition at line 123 of file ssl_session.cc.

bool SslSession::IsSocketErrorHard ( const boost::system::error_code &  ec)
static

Definition at line 132 of file ssl_session.cc.

Here is the call graph for this function:

bool SslSession::IsSslDisabled ( )
inline

Definition at line 30 of file ssl_session.h.

bool SslSession::IsSslHandShakeDelayed ( )
inline

Definition at line 34 of file ssl_session.h.

bool SslSession::IsSslHandShakeInProgress ( )
inline

Definition at line 47 of file ssl_session.h.

bool SslSession::IsSslHandShakeSuccess ( )
inline

Definition at line 38 of file ssl_session.h.

bool SslSession::IsSslHandShakeSuccessLocked ( )
inline

Definition at line 43 of file ssl_session.h.

size_t SslSession::ReadSome ( boost::asio::mutable_buffer  buffer,
boost::system::error_code *  error 
)
privatevirtual

Reimplemented from TcpSession.

Definition at line 143 of file ssl_session.cc.

Here is the call graph for this function:

void SslSession::SetSslHandShakeFailure ( )
inlineprivate

Definition at line 85 of file ssl_session.h.

void SslSession::SetSslHandShakeInProgress ( bool  state)
inline

Definition at line 52 of file ssl_session.h.

void SslSession::SetSslHandShakeSuccess ( )
inlineprivate

Definition at line 80 of file ssl_session.h.

TcpSession::Socket * SslSession::socket ( ) const
virtual

Reimplemented from TcpSession.

Definition at line 97 of file ssl_session.cc.

void SslSession::SslHandShakeCallback ( SslHandShakeCallbackHandler  cb,
SslSessionPtr  ,
const boost::system::error_code &  error 
)
staticprivate

Definition at line 162 of file ssl_session.cc.

void SslSession::TriggerSslHandShake ( SslHandShakeCallbackHandler  cb)

Definition at line 193 of file ssl_session.cc.

Here is the call graph for this function:

void SslSession::TriggerSslHandShakeInternal ( SslSessionPtr  ptr,
SslHandShakeCallbackHandler  cb 
)
staticprivate

Definition at line 177 of file ssl_session.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class SslServer
friend

Definition at line 62 of file ssl_session.h.

Member Data Documentation

bool SslSession::ssl_enabled_
private

Definition at line 100 of file ssl_session.h.

bool SslSession::ssl_handshake_delayed_
private

Definition at line 101 of file ssl_session.h.

bool SslSession::ssl_handshake_in_progress_
private

Definition at line 95 of file ssl_session.h.

bool SslSession::ssl_handshake_success_
private

Definition at line 96 of file ssl_session.h.

size_t SslSession::ssl_last_read_len_
private

Definition at line 104 of file ssl_session.h.

boost::scoped_ptr<SslSocket> SslSession::ssl_socket_
private

Definition at line 92 of file ssl_session.h.


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