OpenSDN source code
|
#include <http_client.h>
Public Member Functions | |
HttpClient (EventManager *evm, std::string task_name=std::string("http client")) | |
virtual | ~HttpClient () |
void | Init () |
void | Shutdown () |
void | SessionShutdown () |
virtual TcpSession * | CreateSession () |
HttpConnection * | CreateConnection (boost::asio::ip::tcp::endpoint) |
HttpConnection * | CreateConnection (const std::string &host, int port) |
bool | AddConnection (HttpConnection *) |
void | RemoveConnection (HttpConnection *) |
void | ProcessEvent (EnqueuedCb cb) |
struct _GlobalInfo * | GlobalInfo () |
boost::asio::io_context * | io_service () |
void | StartTimer (long) |
void | CancelTimer () |
bool | IsErrorHard (const boost::system::error_code &ec) |
![]() | |
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::SocketStats & | GetSocketStats () const |
size_t | GetSessionCount () const |
EventManager * | event_manager () |
bool | HasSessionReadAvailable () const |
bool | HasSessions () const |
TcpSession * | GetSession (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 TcpSession * | AllocSession (Socket *socket) |
![]() | |
virtual TcpSession * | AllocSession (bool server_session) |
virtual Socket * | accept_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 _GlobalInfo * | gi_ |
Timer * | curl_timer_ |
HttpConnectionMap | map_ |
size_t | id_ |
WorkQueue< EnqueuedCb > | work_queue_ |
Additional Inherited Members | |
![]() | |
typedef boost::asio::ip::tcp::endpoint | Endpoint |
typedef boost::asio::ip::tcp::socket | Socket |
typedef boost::asio::ip::tcp::socket::native_handle_type | NativeSocketType |
![]() | |
typedef boost::intrusive_ptr < TcpServer > | TcpServerPtr |
typedef boost::intrusive_ptr < TcpSession > | TcpSessionPtr |
Definition at line 181 of file http_client.h.
|
private |
Definition at line 219 of file http_client.h.
|
private |
Definition at line 221 of file http_client.h.
|
private |
Definition at line 220 of file http_client.h.
|
explicit |
Definition at line 373 of file http_client.cc.
|
virtual |
Definition at line 418 of file http_client.cc.
bool HttpClient::AddConnection | ( | HttpConnection * | conn | ) |
|
protectedvirtual |
Implements TcpServer.
Reimplemented in MetadataClient.
Definition at line 434 of file http_client.cc.
void HttpClient::CancelTimer | ( | ) |
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.
|
virtual |
Reimplemented from TcpServer.
Definition at line 439 of file http_client.cc.
|
private |
Definition at line 513 of file http_client.cc.
|
private |
|
inline |
Definition at line 202 of file http_client.h.
void HttpClient::Init | ( | ) |
boost::asio::io_context * HttpClient::io_service | ( | ) |
bool HttpClient::IsErrorHard | ( | const boost::system::error_code & | ec | ) |
void HttpClient::ProcessEvent | ( | EnqueuedCb | cb | ) |
void HttpClient::RemoveConnection | ( | HttpConnection * | connection | ) |
|
private |
void HttpClient::SessionShutdown | ( | ) |
void HttpClient::Shutdown | ( | void | ) |
|
private |
void HttpClient::StartTimer | ( | long | timeout_ms | ) |
|
private |
|
private |
Definition at line 485 of file http_client.cc.
|
private |
Definition at line 225 of file http_client.h.
|
private |
Definition at line 224 of file http_client.h.
|
private |
Definition at line 227 of file http_client.h.
|
static |
Definition at line 183 of file http_client.h.
|
private |
Definition at line 226 of file http_client.h.
|
private |
Definition at line 229 of file http_client.h.