RAPP Platform API
|
base class for asio handling, including helper methods and most protected members More...
#include <asio_handler.hpp>
Public Member Functions | |
asio_handler (const std::string token) | |
ctor More... | |
void | content_length (std::string response, std::size_t &length) |
get the content leangth from More... | |
std::string | decode64 (const std::string &val) |
decode base64 More... | |
std::string | encode64 (const std::string &val) |
encode base64 More... | |
void | error_handler (const boost::system::error_code &error) |
Handle an Error. More... | |
std::string | escape_string (const std::string &str) |
escape JSON strings when sending them over the socket More... | |
bool | has_content_length (std::string response) |
examine if the header response contains a content-length filed More... | |
void | invalid_request (const std::string message) |
Handle Invalid Query - e.g.: response which states our query was invalid. More... | |
std::string | random_boundary () const |
Create a random boundary for the multipart/form in HTTP. More... | |
std::string | strip_header (std::string response) |
remove/strip the HTTP header and More... | |
Protected Attributes | |
std::size_t | bytes_transferred_ = 0 |
Bytes Transferred. More... | |
std::function< void(std::string)> | callback_ |
Callback Handler - use with std::bind or boost variant. More... | |
std::size_t | content_length_ = 0 |
Content-Length. More... | |
std::atomic< bool > | flag_ = {false} |
flag used to extract header More... | |
std::string | header_ |
Header that will be used. More... | |
std::string | json_ |
JSON reply. More... | |
std::string | post_ |
Actual post Data. More... | |
boost::asio::streambuf | request_ |
Request Container. More... | |
boost::asio::streambuf | response_ |
Response Container. More... | |
std::unique_ptr < boost::asio::deadline_timer > | timer_ |
time-out timer More... | |
const std::string | token_ |
user authentication token More... | |
base class for asio handling, including helper methods and most protected members
Definition at line 14 of file asio_handler.hpp.
rapp::cloud::asio_handler::asio_handler | ( | const std::string | token | ) |
ctor
Definition at line 19 of file asio_handler.hpp.
void rapp::cloud::asio_handler::content_length | ( | std::string | response, |
std::size_t & | length | ||
) |
std::string rapp::cloud::asio_handler::decode64 | ( | const std::string & | val | ) |
decode base64
val | must be encoded using base64 |
Definition at line 101 of file asio_handler.cpp.
std::string rapp::cloud::asio_handler::encode64 | ( | const std::string & | val | ) |
encode base64
val | must be plain-text string |
Definition at line 110 of file asio_handler.cpp.
void rapp::cloud::asio_handler::error_handler | ( | const boost::system::error_code & | error | ) |
Handle an Error.
error | is the raised error from the client |
Definition at line 6 of file asio_handler.cpp.
std::string rapp::cloud::asio_handler::escape_string | ( | const std::string & | str | ) |
escape JSON strings when sending them over the socket
str | will be escaped and returned |
Definition at line 82 of file asio_handler.cpp.
bool rapp::cloud::asio_handler::has_content_length | ( | std::string | response | ) |
examine if the header response contains a content-length
filed
Definition at line 42 of file asio_handler.cpp.
void rapp::cloud::asio_handler::invalid_request | ( | const std::string | message | ) |
Handle Invalid Query - e.g.: response which states our query was invalid.
Definition at line 11 of file asio_handler.cpp.
std::string rapp::cloud::asio_handler::random_boundary | ( | ) | const |
Create a random boundary for the multipart/form in HTTP.
Definition at line 67 of file asio_handler.cpp.
std::string rapp::cloud::asio_handler::strip_header | ( | std::string | response | ) |
|
protected |
Bytes Transferred.
Definition at line 74 of file asio_handler.hpp.
|
protected |
Callback Handler - use with std::bind or boost variant.
Definition at line 61 of file asio_handler.hpp.
|
protected |
Content-Length.
Definition at line 72 of file asio_handler.hpp.
|
protected |
flag used to extract header
Definition at line 70 of file asio_handler.hpp.
|
protected |
Header that will be used.
Definition at line 57 of file asio_handler.hpp.
|
protected |
JSON reply.
Definition at line 76 of file asio_handler.hpp.
|
protected |
Actual post Data.
Definition at line 59 of file asio_handler.hpp.
|
protected |
Request Container.
Definition at line 63 of file asio_handler.hpp.
|
protected |
Response Container.
Definition at line 65 of file asio_handler.hpp.
|
protected |
time-out timer
Definition at line 68 of file asio_handler.hpp.
|
protected |
user authentication token
Definition at line 78 of file asio_handler.hpp.