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

#include <http_client.h>

Inheritance diagram for HttpClientSession:
Collaboration diagram for HttpClientSession:

Public Types

typedef boost::function< void(HttpClientSession
*session, TcpSession::Event
event)> 
SessionEventCb
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 
- 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

 HttpClientSession (HttpClient *client, Socket *socket)
 
virtual ~HttpClientSession ()
 
virtual void OnRead (Buffer buffer)
 
void RegisterEventCb (SessionEventCb cb)
 
void SetConnection (HttpConnection *conn)
 
HttpConnectionConnection ()
 
tbb::mutex & mutex ()
 
- 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
 
virtual Socketsocket () 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)
 

Private Member Functions

void OnEvent (TcpSession *session, Event event)
 
void OnEventInternal (TcpSessionPtr session, Event event)
 
 DISALLOW_COPY_AND_ASSIGN (HttpClientSession)
 

Private Attributes

HttpConnectionconnection_
 
uint32_t delete_called_
 
tbb::mutex mutex_
 
SessionEventCb event_cb_
 

Additional Inherited Members

- 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)
 
- 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
 
- Protected Member Functions inherited from TcpSession
void AsyncReadStartInternal (TcpSessionPtr session)
 
virtual TaskCreateReaderTask (boost::asio::mutable_buffer, size_t)
 
virtual ~TcpSession ()
 
virtual void WriteReady (const boost::system::error_code &error)
 
void AsyncWriteInternal (TcpSessionPtr session)
 
virtual void AsyncReadSome ()
 
virtual size_t GetReadBufferSize () const
 
virtual size_t ReadSome (boost::asio::mutable_buffer buffer, boost::system::error_code *error)
 
virtual void AsyncWrite (const uint8_t *data, std::size_t size)
 
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 ()
 
- 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 36 of file http_client.h.

Member Typedef Documentation

typedef boost::function<void(HttpClientSession *session, TcpSession::Event event)> HttpClientSession::SessionEventCb

Definition at line 39 of file http_client.h.

typedef boost::intrusive_ptr<TcpSession> HttpClientSession::TcpSessionPtr

Definition at line 40 of file http_client.h.

Constructor & Destructor Documentation

HttpClientSession::HttpClientSession ( HttpClient client,
Socket socket 
)

Definition at line 17 of file http_client.cc.

Here is the call graph for this function:

virtual HttpClientSession::~HttpClientSession ( )
inlinevirtual

Definition at line 43 of file http_client.h.

Member Function Documentation

HttpConnection* HttpClientSession::Connection ( )
inline

Definition at line 48 of file http_client.h.

HttpClientSession::DISALLOW_COPY_AND_ASSIGN ( HttpClientSession  )
private
tbb::mutex& HttpClientSession::mutex ( )
inline

Definition at line 49 of file http_client.h.

void HttpClientSession::OnEvent ( TcpSession session,
Event  event 
)
private

Definition at line 26 of file http_client.cc.

Here is the call graph for this function:

void HttpClientSession::OnEventInternal ( TcpSessionPtr  session,
Event  event 
)
private

Definition at line 34 of file http_client.cc.

void HttpClientSession::OnRead ( Buffer  buffer)
virtual

Implements TcpSession.

Definition at line 22 of file http_client.cc.

void HttpClientSession::RegisterEventCb ( SessionEventCb  cb)

Definition at line 61 of file http_client.cc.

void HttpClientSession::SetConnection ( HttpConnection conn)
inline

Definition at line 47 of file http_client.h.

Member Data Documentation

HttpConnection* HttpClientSession::connection_
private

Definition at line 54 of file http_client.h.

uint32_t HttpClientSession::delete_called_
private

Definition at line 55 of file http_client.h.

SessionEventCb HttpClientSession::event_cb_
private

Definition at line 57 of file http_client.h.

tbb::mutex HttpClientSession::mutex_
private

Definition at line 56 of file http_client.h.


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