OpenSDN source code
|
#include <http_client.h>
Public Types | |
typedef boost::function< void(std::string &, boost::system::error_code &)> | HttpCb |
Public Member Functions | |
HttpConnection (boost::asio::ip::tcp::endpoint, size_t id, HttpClient *client) | |
HttpConnection (const std::string &host, int port, size_t id, HttpClient *client) | |
~HttpConnection () | |
int | Initialize () |
int | HttpPut (const std::string &put_string, const std::string &path, HttpCb) |
int | HttpPut (const std::string &put_string, const std::string &path, bool header, bool short_timeout, bool reuse, std::vector< std::string > &hdr_options, HttpCb cb) |
int | HttpPost (const std::string &post_string, const std::string &path, HttpCb) |
int | HttpPost (const std::string &post_string, const std::string &path, bool header, bool short_timeout, bool reuse, std::vector< std::string > &hdr_options, HttpCb cb) |
int | HttpGet (const std::string &path, HttpCb) |
int | HttpGet (const std::string &path, bool header, bool short_timeout, bool reuse, std::vector< std::string > &hdr_options, HttpCb cb) |
int | HttpHead (const std::string &path, bool header, bool short_timeout, bool reuse, std::vector< std::string > &hdr_options, HttpCb cb) |
int | HttpDelete (const std::string &path, HttpCb) |
int | HttpDelete (const std::string &path, bool header, bool short_timeout, bool reuse, std::vector< std::string > &hdr_options, HttpCb cb) |
int | Status () |
std::string | Version () |
std::string | Reason () |
std::map< std::string, std::string > * | Headers () |
void | ClearCallback () |
struct _ConnInfo * | curl_handle () |
std::map< CURLoption, int > * | curl_options () |
HttpClient * | client () |
HttpClientSession * | session () |
tbb::mutex & | mutex () |
boost::asio::ip::tcp::endpoint | endpoint () |
size_t | id () |
const std::string & | GetData () |
void | set_curl_handle (struct _ConnInfo *handle) |
HttpClientSession * | CreateSession () |
void | set_session (HttpClientSession *session) |
void | delete_session () |
void | AssignData (const char *ptr, size_t size) |
void | AssignHeader (const char *ptr, size_t size) |
void | UpdateOffset (size_t bytes) |
size_t | GetOffset () |
HttpCb | HttpClientCb () |
void | RegisterEventCb (HttpClientSession::SessionEventCb cb) |
void | set_use_ssl (bool ssl_flag) |
bool | use_ssl () |
void | set_client_cert (const std::string &client_cert) |
void | set_client_cert_type (const std::string &client_cert_type) |
void | set_client_key (const std::string &client_key) |
void | set_ca_cert (const std::string &ca_cert) |
Private Types | |
enum | HTTPHeaderDataState { STATUS = 142, HEADER } |
Private Member Functions | |
std::string | make_url (std::string &path) |
unsigned short | bool2bf (bool header, bool short_timeout, bool reuse) |
void | bf2bool (unsigned short bf, bool &header, bool &short_timeout, bool &reuse) |
void | HttpProcessInternal (const std::string body, std::string path, unsigned short header_shortTimeout_reuse, std::vector< std::string > hdr_options, HttpCb cb, http_method m) |
DISALLOW_COPY_AND_ASSIGN (HttpConnection) | |
Private Attributes | |
const std::string | host_ |
boost::asio::ip::tcp::endpoint | endpoint_ |
size_t | id_ |
HttpCb | cb_ |
size_t | offset_ |
std::string | buf_ |
struct _ConnInfo * | curl_handle_ |
std::map< CURLoption, int > | curl_options_ |
HttpClientSession * | session_ |
HttpClient * | client_ |
tbb::mutex | mutex_ |
HttpClientSession::SessionEventCb | event_cb_ |
int | status_ |
std::string | version_ |
std::string | reason_ |
std::map< std::string, std::string > | headers_ |
bool | sent_hdr_ |
bool | use_ssl_ |
std::string | client_cert_ |
std::string | client_cert_type_ |
std::string | client_key_ |
std::string | ca_cert_ |
enum HttpConnection::HTTPHeaderDataState | state_ |
Definition at line 62 of file http_client.h.
typedef boost::function<void(std::string &, boost::system::error_code &)> HttpConnection::HttpCb |
Definition at line 70 of file http_client.h.
|
private |
Enumerator | |
---|---|
STATUS | |
HEADER |
Definition at line 172 of file http_client.h.
HttpConnection::HttpConnection | ( | boost::asio::ip::tcp::endpoint | ep, |
size_t | id, | ||
HttpClient * | client | ||
) |
Definition at line 72 of file http_client.cc.
HttpConnection::HttpConnection | ( | const std::string & | host, |
int | port, | ||
size_t | id, | ||
HttpClient * | client | ||
) |
Definition at line 80 of file http_client.cc.
HttpConnection::~HttpConnection | ( | ) |
void HttpConnection::AssignData | ( | const char * | ptr, |
size_t | size | ||
) |
Definition at line 306 of file http_client.cc.
void HttpConnection::AssignHeader | ( | const char * | ptr, |
size_t | size | ||
) |
Definition at line 316 of file http_client.cc.
|
inlineprivate |
Definition at line 137 of file http_client.h.
|
inlineprivate |
Definition at line 133 of file http_client.h.
void HttpConnection::ClearCallback | ( | ) |
Definition at line 211 of file http_client.cc.
|
inline |
Definition at line 98 of file http_client.h.
HttpClientSession * HttpConnection::CreateSession | ( | ) |
|
inline |
Definition at line 96 of file http_client.h.
|
inline |
Definition at line 97 of file http_client.h.
void HttpConnection::delete_session | ( | ) |
|
private |
|
inline |
Definition at line 101 of file http_client.h.
const std::string & HttpConnection::GetData | ( | ) |
Definition at line 361 of file http_client.cc.
size_t HttpConnection::GetOffset | ( | ) |
Definition at line 369 of file http_client.cc.
|
inline |
Definition at line 93 of file http_client.h.
|
inline |
Definition at line 113 of file http_client.h.
int HttpConnection::HttpDelete | ( | const std::string & | path, |
HttpCb | cb | ||
) |
Definition at line 196 of file http_client.cc.
int HttpConnection::HttpDelete | ( | const std::string & | path, |
bool | header, | ||
bool | short_timeout, | ||
bool | reuse, | ||
std::vector< std::string > & | hdr_options, | ||
HttpCb | cb | ||
) |
int HttpConnection::HttpGet | ( | const std::string & | path, |
HttpCb | cb | ||
) |
Definition at line 135 of file http_client.cc.
int HttpConnection::HttpGet | ( | const std::string & | path, |
bool | header, | ||
bool | short_timeout, | ||
bool | reuse, | ||
std::vector< std::string > & | hdr_options, | ||
HttpCb | cb | ||
) |
int HttpConnection::HttpHead | ( | const std::string & | path, |
bool | header, | ||
bool | short_timeout, | ||
bool | reuse, | ||
std::vector< std::string > & | hdr_options, | ||
HttpCb | cb | ||
) |
int HttpConnection::HttpPost | ( | const std::string & | post_string, |
const std::string & | path, | ||
HttpCb | cb | ||
) |
Definition at line 180 of file http_client.cc.
int HttpConnection::HttpPost | ( | const std::string & | post_string, |
const std::string & | path, | ||
bool | header, | ||
bool | short_timeout, | ||
bool | reuse, | ||
std::vector< std::string > & | hdr_options, | ||
HttpCb | cb | ||
) |
|
private |
int HttpConnection::HttpPut | ( | const std::string & | put_string, |
const std::string & | path, | ||
HttpCb | cb | ||
) |
Definition at line 162 of file http_client.cc.
int HttpConnection::HttpPut | ( | const std::string & | put_string, |
const std::string & | path, | ||
bool | header, | ||
bool | short_timeout, | ||
bool | reuse, | ||
std::vector< std::string > & | hdr_options, | ||
HttpCb | cb | ||
) |
|
inline |
Definition at line 102 of file http_client.h.
int HttpConnection::Initialize | ( | ) |
|
private |
Definition at line 92 of file http_client.cc.
|
inline |
Definition at line 100 of file http_client.h.
|
inline |
Definition at line 92 of file http_client.h.
|
inline |
Definition at line 114 of file http_client.h.
|
inline |
Definition at line 99 of file http_client.h.
|
inline |
Definition at line 126 of file http_client.h.
|
inline |
Definition at line 117 of file http_client.h.
|
inline |
Definition at line 120 of file http_client.h.
|
inline |
Definition at line 123 of file http_client.h.
|
inline |
Definition at line 105 of file http_client.h.
void HttpConnection::set_session | ( | HttpClientSession * | session | ) |
|
inline |
Definition at line 115 of file http_client.h.
|
inline |
Definition at line 90 of file http_client.h.
void HttpConnection::UpdateOffset | ( | size_t | bytes | ) |
Definition at line 365 of file http_client.cc.
|
inline |
Definition at line 116 of file http_client.h.
|
inline |
Definition at line 91 of file http_client.h.
|
private |
Definition at line 155 of file http_client.h.
|
private |
Definition at line 171 of file http_client.h.
|
private |
Definition at line 153 of file http_client.h.
|
private |
Definition at line 159 of file http_client.h.
|
private |
Definition at line 168 of file http_client.h.
|
private |
Definition at line 169 of file http_client.h.
|
private |
Definition at line 170 of file http_client.h.
|
private |
Definition at line 156 of file http_client.h.
|
private |
Definition at line 157 of file http_client.h.
|
private |
Definition at line 151 of file http_client.h.
|
private |
Definition at line 161 of file http_client.h.
|
private |
Definition at line 165 of file http_client.h.
|
private |
Definition at line 150 of file http_client.h.
|
private |
Definition at line 152 of file http_client.h.
|
mutableprivate |
Definition at line 160 of file http_client.h.
|
private |
Definition at line 154 of file http_client.h.
|
private |
Definition at line 164 of file http_client.h.
|
private |
Definition at line 166 of file http_client.h.
|
private |
Definition at line 158 of file http_client.h.
|
private |
|
private |
Definition at line 162 of file http_client.h.
|
private |
Definition at line 167 of file http_client.h.
|
private |
Definition at line 163 of file http_client.h.