TrinityCore
Loading...
Searching...
No Matches
Trinity::Net::Http::BaseSocket< Stream > Class Template Referenceabstract

#include <BaseHttpSocket.h>

+ Inheritance diagram for Trinity::Net::Http::BaseSocket< Stream >:

Public Member Functions

 BaseSocket (BaseSocket const &other)=delete
 
 BaseSocket (BaseSocket &&other)=delete
 
BaseSocketoperator= (BaseSocket const &other)=delete
 
BaseSocketoperator= (BaseSocket &&other)=delete
 
 ~BaseSocket ()=default
 
SocketReadCallbackResult ReadHandler () final
 
bool HandleMessage (Request &request)
 
virtual RequestHandlerResult RequestHandler (RequestContext &context)=0
 
void SendResponse (RequestContext &context) final
 
void Start () override
 
bool Update () override
 
boost::asio::ip::address const & GetRemoteIpAddress () const final
 
bool IsOpen () const final
 
void CloseSocket () final
 
std::string GetClientInfo () const override
 
SessionStateGetSessionState () const override
 
void ResetHttpParser ()
 
- Public Member Functions inherited from Trinity::Net::Socket< Stream >
 Socket (IoContextTcpSocket &&socket, Args &&... args)
 
 Socket (boost::asio::io_context &context, Args &&... args)
 
 Socket (Socket const &other)=delete
 
 Socket (Socket &&other)=delete
 
Socketoperator= (Socket const &other)=delete
 
Socketoperator= (Socket &&other)=delete
 
virtual ~Socket ()
 
decltype(auto) Connect (boost::asio::ip::tcp::endpoint const &endpoint, Callback &&callback)
 
decltype(auto) Connect (std::vector< boost::asio::ip::tcp::endpoint > const &endpoints, Callback &&callback)
 
boost::asio::ip::address const & GetRemoteIpAddress () const
 
uint16 GetRemotePort () const
 
void SetRemoteEndpoint (boost::asio::ip::tcp::endpoint const &endpoint)
 
void AsyncRead (Callback &&callback)
 
void QueuePacket (MessageBuffer &&buffer)
 
bool IsOpen () const
 
void CloseSocket ()
 
void DelayedCloseSocket ()
 Marks the socket for closing after write buffer becomes empty.
 
MessageBufferGetReadBuffer ()
 
Stream & underlying_stream ()
 
- Public Member Functions inherited from Trinity::Net::Http::AbstractSocket
 AbstractSocket ()=default
 
 AbstractSocket (AbstractSocket const &other)=default
 
 AbstractSocket (AbstractSocket &&other)=default
 
AbstractSocketoperator= (AbstractSocket const &other)=default
 
AbstractSocketoperator= (AbstractSocket &&other)=default
 
virtual ~AbstractSocket ()=default
 
void LogRequestAndResponse (RequestContext const &context, MessageBuffer &buffer) const
 
Optional< boost::uuids::uuid > GetSessionId () const
 

Protected Member Functions

virtual std::shared_ptr< SessionStateObtainSessionState (RequestContext &context) const =0
 
- Protected Member Functions inherited from Trinity::Net::Socket< Stream >
virtual void OnClose ()
 
bool AsyncProcessQueue ()
 
void SetNoDelay (bool enable)
 

Protected Attributes

Optional< RequestParser_httpParser
 
std::shared_ptr< SessionState_state
 

Private Types

using Base = Trinity::Net::Socket< Stream >
 

Additional Inherited Members

- Static Public Member Functions inherited from Trinity::Net::Http::AbstractSocket
static bool ParseRequest (MessageBuffer &packet, RequestParser &parser)
 
static bool ParseResponse (MessageBuffer &packet, ResponseParser &parser)
 
static MessageBuffer SerializeRequest (Request const &request)
 
static MessageBuffer SerializeResponse (Request const &request, Response const &response)
 
static std::string GetClientInfo (boost::asio::ip::address const &address, uint16 port, SessionState const *state)
 

Detailed Description

template<typename Stream>
class Trinity::Net::Http::BaseSocket< Stream >

Definition at line 140 of file BaseHttpSocket.h.

Member Typedef Documentation

◆ Base

template<typename Stream >
using Trinity::Net::Http::BaseSocket< Stream >::Base = Trinity::Net::Socket<Stream>
private

Definition at line 142 of file BaseHttpSocket.h.

Constructor & Destructor Documentation

◆ BaseSocket() [1/2]

template<typename Stream >
Trinity::Net::Http::BaseSocket< Stream >::BaseSocket ( BaseSocket< Stream > const &  other)
delete

◆ BaseSocket() [2/2]

template<typename Stream >
Trinity::Net::Http::BaseSocket< Stream >::BaseSocket ( BaseSocket< Stream > &&  other)
delete

◆ ~BaseSocket()

template<typename Stream >
Trinity::Net::Http::BaseSocket< Stream >::~BaseSocket ( )
default

Member Function Documentation

◆ CloseSocket()

template<typename Stream >
void Trinity::Net::Http::BaseSocket< Stream >::CloseSocket ( )
inlinefinalvirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 216 of file BaseHttpSocket.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetClientInfo()

template<typename Stream >
std::string Trinity::Net::Http::BaseSocket< Stream >::GetClientInfo ( ) const
inlineoverridevirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 218 of file BaseHttpSocket.h.

+ Here is the call graph for this function:

◆ GetRemoteIpAddress()

template<typename Stream >
boost::asio::ip::address const & Trinity::Net::Http::BaseSocket< Stream >::GetRemoteIpAddress ( ) const
inlinefinalvirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 212 of file BaseHttpSocket.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSessionState()

template<typename Stream >
SessionState * Trinity::Net::Http::BaseSocket< Stream >::GetSessionState ( ) const
inlineoverridevirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 223 of file BaseHttpSocket.h.

◆ HandleMessage()

template<typename Stream >
bool Trinity::Net::Http::BaseSocket< Stream >::HandleMessage ( Request request)
inline

Definition at line 177 of file BaseHttpSocket.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsOpen()

template<typename Stream >
bool Trinity::Net::Http::BaseSocket< Stream >::IsOpen ( ) const
inlinefinalvirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 214 of file BaseHttpSocket.h.

+ Here is the call graph for this function:

◆ ObtainSessionState()

template<typename Stream >
virtual std::shared_ptr< SessionState > Trinity::Net::Http::BaseSocket< Stream >::ObtainSessionState ( RequestContext context) const
protectedpure virtual
+ Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Stream >
BaseSocket & Trinity::Net::Http::BaseSocket< Stream >::operator= ( BaseSocket< Stream > &&  other)
delete

◆ operator=() [2/2]

template<typename Stream >
BaseSocket & Trinity::Net::Http::BaseSocket< Stream >::operator= ( BaseSocket< Stream > const &  other)
delete

◆ ReadHandler()

template<typename Stream >
SocketReadCallbackResult Trinity::Net::Http::BaseSocket< Stream >::ReadHandler ( )
inlinefinalvirtual

Reimplemented from Trinity::Net::Socket< Stream >.

Definition at line 154 of file BaseHttpSocket.h.

+ Here is the call graph for this function:

◆ RequestHandler()

template<typename Stream >
virtual RequestHandlerResult Trinity::Net::Http::BaseSocket< Stream >::RequestHandler ( RequestContext context)
pure virtual

◆ ResetHttpParser()

template<typename Stream >
void Trinity::Net::Http::BaseSocket< Stream >::ResetHttpParser ( )
inline

Definition at line 225 of file BaseHttpSocket.h.

+ Here is the caller graph for this function:

◆ SendResponse()

template<typename Stream >
void Trinity::Net::Http::BaseSocket< Stream >::SendResponse ( RequestContext context)
inlinefinalvirtual

Implements Trinity::Net::Http::AbstractSocket.

Definition at line 194 of file BaseHttpSocket.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Start()

template<typename Stream >
void Trinity::Net::Http::BaseSocket< Stream >::Start ( )
inlineoverridevirtual

Reimplemented from Trinity::Net::Socket< Stream >.

Reimplemented in Trinity::Net::Http::Socket, and Trinity::Net::Http::SslSocket.

Definition at line 208 of file BaseHttpSocket.h.

+ Here is the call graph for this function:

◆ Update()

template<typename Stream >
bool Trinity::Net::Http::BaseSocket< Stream >::Update ( )
inlineoverridevirtual

Reimplemented from Trinity::Net::Socket< Stream >.

Definition at line 210 of file BaseHttpSocket.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ _httpParser

template<typename Stream >
Optional<RequestParser> Trinity::Net::Http::BaseSocket< Stream >::_httpParser
protected

Definition at line 235 of file BaseHttpSocket.h.

◆ _state

template<typename Stream >
std::shared_ptr<SessionState> Trinity::Net::Http::BaseSocket< Stream >::_state
protected

Definition at line 236 of file BaseHttpSocket.h.


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