EvEmu
0.8.4
11 September 2021
|
Handles a client connection to the API server. More...
#include "APIServerConnection.h"
Public Member Functions | |
void | Process () |
boost::asio::ip::tcp::socket & | socket () |
Static Public Member Functions | |
static std::tr1::shared_ptr < APIServerConnection > | create (boost::asio::io_context &io) |
Private Member Functions | |
APIServerConnection (boost::asio::io_context &io) | |
void | ProcessHeaders () |
void | ProcessPostData () |
void | SendXML () |
void | NotFound () |
void | Close () |
void | Redirect () |
void | RedirectLocation () |
void | RedirectFinalize () |
Static Private Member Functions | |
static bool | starts_with (std::string &haystack, const char *const needle) |
Private Attributes | |
std::string | _service |
std::string | _service_handler |
std::string | _redirectUrl |
std::string | _http_cmd_str |
APICommandCall | m_apiCommandCall |
boost::asio::streambuf | _buffer |
boost::asio::streambuf | _postBuffer |
boost::asio::ip::tcp::socket | _socket |
std::tr1::shared_ptr < std::vector< char > > | _xmlData |
Static Private Attributes | |
static boost::asio::const_buffers_1 | _responseOK = boost::asio::buffer("HTTP/1.0 200 OK\r\nContent-Type: text/xml\r\n\r\n", 43) |
static boost::asio::const_buffers_1 | _responseNotFound |
static boost::asio::const_buffers_1 | _responseNoContent = boost::asio::buffer("HTTP/1.0 204 No Content", 23) |
static boost::asio::const_buffers_1 | _responseRedirectBegin = boost::asio::buffer("HTTP/1.0 301 Moved Permanently\r\nLocation: ", 42) |
static boost::asio::const_buffers_1 | _responseRedirectEnd = boost::asio::buffer("\r\n\r\n", 4) |
Handles a client connection to the API server.
Handles exactly one client; does all the protocol related stuff. Very limited HTTP handling.
Definition at line 41 of file APIServerConnection.h.
|
private |
Definition at line 71 of file APIServerConnection.cpp.
Referenced by create().
|
private |
Definition at line 418 of file APIServerConnection.cpp.
References _socket.
Referenced by NotFound(), ProcessPostData(), RedirectFinalize(), and SendXML().
|
static |
Definition at line 428 of file APIServerConnection.cpp.
References APIServerConnection().
Referenced by APIServerListener::StartAccept().
|
private |
Definition at line 394 of file APIServerConnection.cpp.
References _responseNotFound, _socket, and Close().
Referenced by ProcessHeaders(), and ProcessPostData().
void APIServerConnection::Process | ( | ) |
Definition at line 81 of file APIServerConnection.cpp.
References _buffer, _socket, and ProcessHeaders().
|
private |
Definition at line 87 of file APIServerConnection.cpp.
References _buffer, _http_cmd_str, _postBuffer, _responseOK, _service, _service_handler, _socket, _xmlData, m_apiCommandCall, NotFound(), ProcessPostData(), sAPIServer, SendXML(), sLog, and starts_with().
Referenced by Process().
|
private |
Definition at line 326 of file APIServerConnection.cpp.
References _http_cmd_str, _postBuffer, _responseNoContent, _responseOK, _service, _service_handler, _socket, _xmlData, Close(), m_apiCommandCall, NotFound(), sAPIServer, SendXML(), and sLog.
Referenced by ProcessHeaders().
|
private |
Definition at line 399 of file APIServerConnection.cpp.
References _responseRedirectBegin, _socket, and RedirectLocation().
|
private |
Definition at line 413 of file APIServerConnection.cpp.
References _responseRedirectEnd, _socket, and Close().
Referenced by RedirectLocation().
|
private |
Definition at line 404 of file APIServerConnection.cpp.
References _redirectUrl, _service, _socket, APIServer::FallbackURL, and RedirectFinalize().
Referenced by Redirect().
|
private |
Definition at line 389 of file APIServerConnection.cpp.
References _socket, _xmlData, and Close().
Referenced by ProcessHeaders(), and ProcessPostData().
boost::asio::ip::tcp::socket & APIServerConnection::socket | ( | ) |
Definition at line 76 of file APIServerConnection.cpp.
References _socket.
|
staticprivate |
Definition at line 423 of file APIServerConnection.cpp.
Referenced by ProcessHeaders().
|
private |
Definition at line 68 of file APIServerConnection.h.
Referenced by Process(), and ProcessHeaders().
|
private |
Definition at line 65 of file APIServerConnection.h.
Referenced by ProcessHeaders(), and ProcessPostData().
|
private |
Definition at line 69 of file APIServerConnection.h.
Referenced by ProcessHeaders(), and ProcessPostData().
|
private |
Definition at line 64 of file APIServerConnection.h.
Referenced by RedirectLocation().
|
staticprivate |
Definition at line 75 of file APIServerConnection.h.
Referenced by ProcessPostData().
|
staticprivate |
Definition at line 74 of file APIServerConnection.h.
Referenced by NotFound().
|
staticprivate |
Definition at line 73 of file APIServerConnection.h.
Referenced by ProcessHeaders(), and ProcessPostData().
|
staticprivate |
Definition at line 76 of file APIServerConnection.h.
Referenced by Redirect().
|
staticprivate |
Definition at line 77 of file APIServerConnection.h.
Referenced by RedirectFinalize().
|
private |
Definition at line 62 of file APIServerConnection.h.
Referenced by ProcessHeaders(), ProcessPostData(), and RedirectLocation().
|
private |
Definition at line 63 of file APIServerConnection.h.
Referenced by ProcessHeaders(), and ProcessPostData().
|
private |
Definition at line 70 of file APIServerConnection.h.
Referenced by Close(), NotFound(), Process(), ProcessHeaders(), ProcessPostData(), Redirect(), RedirectFinalize(), RedirectLocation(), SendXML(), and socket().
|
private |
Definition at line 71 of file APIServerConnection.h.
Referenced by ProcessHeaders(), ProcessPostData(), and SendXML().
|
private |
Definition at line 66 of file APIServerConnection.h.
Referenced by ProcessHeaders(), and ProcessPostData().