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

#include <http_client.h>

Inheritance diagram for HttpClient:
Collaboration diagram for HttpClient:

Public Member Functions

 HttpClient (EventManager *evm, std::string task_name=std::string("http client"))
 
virtual ~HttpClient ()
 
void Init ()
 
void Shutdown ()
 
void SessionShutdown ()
 
virtual TcpSessionCreateSession ()
 
HttpConnectionCreateConnection (boost::asio::ip::tcp::endpoint)
 
HttpConnectionCreateConnection (const std::string &host, int port)
 
bool AddConnection (HttpConnection *)
 
void RemoveConnection (HttpConnection *)
 
void ProcessEvent (EnqueuedCb cb)
 
struct _GlobalInfoGlobalInfo ()
 
boost::asio::io_context * io_service ()
 
void StartTimer (long)
 
void CancelTimer ()
 
bool IsErrorHard (const boost::system::error_code &ec)
 
- Public Member Functions inherited from TcpServer
 TcpServer (EventManager *evm)
 
virtual ~TcpServer ()
 
virtual bool Initialize (unsigned short port)
 
virtual bool Initialize (unsigned short port, const IpAddress &host_ip, int intf_id=-1)
 
bool InitializeInternal (boost::asio::ip::tcp::endpoint localaddr)
 
const std::string ToString () const
 
void SetAcceptor ()
 
void ResetAcceptor ()
 
void Shutdown ()
 
void ClearSessions ()
 
void UpdateSessionsDscp (uint8_t dscp)
 
virtual void DeleteSession (TcpSession *session)
 
virtual void Connect (TcpSession *session, Endpoint remote)
 
virtual bool DisableSandeshLogMessages () const
 
int GetPort () const
 
const io::SocketStatsGetSocketStats () const
 
size_t GetSessionCount () const
 
EventManagerevent_manager ()
 
bool HasSessionReadAvailable () const
 
bool HasSessions () const
 
TcpSessionGetSession (Endpoint remote)
 
void WaitForEmpty ()
 
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 (NativeSocketType fd, uint32_t peer_ip, const std::string &md5_password)
 
int SetListenSocketMd5Option (uint32_t peer_ip, const std::string &md5_password)
 
int SetDscpSocketOption (NativeSocketType fd, uint8_t value)
 
uint8_t GetDscpValue (NativeSocketType fd) const
 
int SetListenSocketDscp (uint8_t value)
 
int SetSocketOptions (const SandeshConfig &sandesh_config)
 
int SetKeepAliveSocketOption (int fd, const SandeshConfig &sandesh_config)
 

Static Public Attributes

static const uint32_t kDefaultTimeout = 1
 

Protected Member Functions

virtual TcpSessionAllocSession (Socket *socket)
 
- Protected Member Functions inherited from TcpServer
virtual TcpSessionAllocSession (bool server_session)
 
virtual Socketaccept_socket () const
 
virtual void set_accept_socket ()
 
virtual bool AcceptSession (TcpSession *session)
 
void set_socket_open_failure (bool flag)
 
bool socket_open_failure () const
 
Endpoint LocalEndpoint () const
 
virtual void AcceptHandlerComplete (TcpSessionPtr session)
 
virtual void ConnectHandlerComplete (TcpSessionPtr session)
 

Private Types

typedef
boost::asio::ip::tcp::endpoint 
endpoint
 
typedef std::pair< endpoint,
size_t > 
Key
 
typedef boost::ptr_map< Key,
HttpConnection
HttpConnectionMap
 

Private Member Functions

void TimerErrorHandler (std::string name, std::string error)
 
void RemoveConnectionInternal (HttpConnection *)
 
bool DequeueEvent (EnqueuedCb)
 
void ShutdownInternal ()
 
bool TimerCb ()
 
 DISALLOW_COPY_AND_ASSIGN (HttpClient)
 

Private Attributes

struct _GlobalInfogi_
 
Timercurl_timer_
 
HttpConnectionMap map_
 
size_t id_
 
WorkQueue< EnqueuedCbwork_queue_
 

Additional Inherited Members

- Public Types inherited from TcpServer
typedef
boost::asio::ip::tcp::endpoint 
Endpoint
 
typedef
boost::asio::ip::tcp::socket 
Socket
 
typedef
boost::asio::ip::tcp::socket::native_handle_type 
NativeSocketType
 
- Protected Types inherited from TcpServer
typedef boost::intrusive_ptr
< TcpServer
TcpServerPtr
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 

Detailed Description

Definition at line 181 of file http_client.h.

Member Typedef Documentation

typedef boost::asio::ip::tcp::endpoint HttpClient::endpoint
private

Definition at line 219 of file http_client.h.

typedef boost::ptr_map<Key, HttpConnection> HttpClient::HttpConnectionMap
private

Definition at line 221 of file http_client.h.

typedef std::pair<endpoint, size_t> HttpClient::Key
private

Definition at line 220 of file http_client.h.

Constructor & Destructor Documentation

HttpClient::HttpClient ( EventManager evm,
std::string  task_name = std::string(                "http client") 
)
explicit

Definition at line 373 of file http_client.cc.

HttpClient::~HttpClient ( )
virtual

Definition at line 418 of file http_client.cc.

Member Function Documentation

bool HttpClient::AddConnection ( HttpConnection conn)

Definition at line 464 of file http_client.cc.

Here is the call graph for this function:

TcpSession * HttpClient::AllocSession ( Socket socket)
protectedvirtual

Implements TcpServer.

Reimplemented in MetadataClient.

Definition at line 434 of file http_client.cc.

void HttpClient::CancelTimer ( )

Definition at line 497 of file http_client.cc.

Here is the call graph for this function:

HttpConnection * HttpClient::CreateConnection ( boost::asio::ip::tcp::endpoint  ep)

Definition at line 454 of file http_client.cc.

HttpConnection * HttpClient::CreateConnection ( const std::string &  host,
int  port 
)

Definition at line 459 of file http_client.cc.

TcpSession * HttpClient::CreateSession ( )
virtual

Reimplemented from TcpServer.

Definition at line 439 of file http_client.cc.

Here is the call graph for this function:

bool HttpClient::DequeueEvent ( EnqueuedCb  cb)
private

Definition at line 513 of file http_client.cc.

HttpClient::DISALLOW_COPY_AND_ASSIGN ( HttpClient  )
private
struct _GlobalInfo* HttpClient::GlobalInfo ( )
inline

Definition at line 202 of file http_client.h.

void HttpClient::Init ( )

Definition at line 422 of file http_client.cc.

Here is the call graph for this function:

boost::asio::io_context * HttpClient::io_service ( )

Definition at line 430 of file http_client.cc.

Here is the call graph for this function:

bool HttpClient::IsErrorHard ( const boost::system::error_code &  ec)

Definition at line 501 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::ProcessEvent ( EnqueuedCb  cb)

Definition at line 479 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::RemoveConnection ( HttpConnection connection)

Definition at line 473 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::RemoveConnectionInternal ( HttpConnection connection)
private

Definition at line 505 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::SessionShutdown ( )

Definition at line 426 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::Shutdown ( void  )

Definition at line 406 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::ShutdownInternal ( )
private

Definition at line 383 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::StartTimer ( long  timeout_ms)

Definition at line 492 of file http_client.cc.

Here is the call graph for this function:

bool HttpClient::TimerCb ( )
private

Definition at line 488 of file http_client.cc.

Here is the call graph for this function:

void HttpClient::TimerErrorHandler ( std::string  name,
std::string  error 
)
private

Definition at line 485 of file http_client.cc.

Member Data Documentation

Timer* HttpClient::curl_timer_
private

Definition at line 225 of file http_client.h.

struct _GlobalInfo* HttpClient::gi_
private

Definition at line 224 of file http_client.h.

size_t HttpClient::id_
private

Definition at line 227 of file http_client.h.

const uint32_t HttpClient::kDefaultTimeout = 1
static

Definition at line 183 of file http_client.h.

HttpConnectionMap HttpClient::map_
private

Definition at line 226 of file http_client.h.

WorkQueue<EnqueuedCb> HttpClient::work_queue_
private

Definition at line 229 of file http_client.h.


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