Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
RealmSocket Class Reference

#include <RealmSocket.h>

Inheritance diagram for RealmSocket:
Collaboration diagram for RealmSocket:

Classes

class  Session

Public Member Functions

void Close ()
void DiscardBytes (size_t len)
size_t GetAvailableBytes (void) const
const std::string & getRemoteAddress (void) const
uint16 getRemotePort (void) const
bool PeekBytes (void *buf, size_t len, size_t offset=0) const
bool QueueSend (void const *buf, size_t len)
bool ReadBytes (void *buf, size_t len)
 RealmSocket (std::unique_ptr< RealmSocketHandle > socket, std::string remoteAddress, uint16 remotePort)
void set_session (std::unique_ptr< Session > session)
void SetPacketLogAccountName (std::string accountName)
void Start ()
 ~RealmSocket (void)

Private Member Functions

void AsyncRead ()
Skyfire::PacketLogServerSessionInfo BuildPacketLogSessionInfo () const
void CloseSocket ()
void CompactInputBuffer ()
void HandleRead (boost::system::error_code const &error, size_t bytesTransferred)
void HandleWrite (boost::system::error_code const &error)
bool IsOpen (void) const
void LogAuthPacket (void const *data, size_t len, Skyfire::PacketLogServerDirection direction)
void NotifyClose ()
void QueueWrite (std::vector< char > data)
void Run ()
void StartAsyncWrite ()

Private Attributes

std::atomic< bool > _closed
std::atomic< bool > _closeNotified
std::vector< char > _inputBuffer
size_t _inputReadPos
std::string _packetLogAccountName
std::array< char, 4096 > _readBuffer
std::string _remoteAddress
uint16 _remotePort
std::unique_ptr< Session_session
std::unique_ptr< RealmSocketHandle_socket
bool _writeInProgress
std::deque< std::vector< char > > _writeQueue

Detailed Description

Definition at line 22 of file RealmSocket.h.

Constructor & Destructor Documentation

◆ RealmSocket()

RealmSocket::RealmSocket ( std::unique_ptr< RealmSocketHandle > socket,
std::string remoteAddress,
uint16 remotePort )

◆ ~RealmSocket()

RealmSocket::~RealmSocket ( void )

Definition at line 58 of file RealmSocket.cpp.

References CloseSocket().

Member Function Documentation

◆ AsyncRead()

void RealmSocket::AsyncRead ( )
private

Definition at line 160 of file RealmSocket.cpp.

References _closed, _readBuffer, _socket, and IsOpen().

Referenced by HandleRead(), Run(), and Start().

◆ BuildPacketLogSessionInfo()

◆ Close()

◆ CloseSocket()

void RealmSocket::CloseSocket ( )
private

◆ CompactInputBuffer()

void RealmSocket::CompactInputBuffer ( )
private

Definition at line 273 of file RealmSocket.cpp.

References _inputBuffer, and _inputReadPos.

Referenced by HandleRead().

◆ DiscardBytes()

void RealmSocket::DiscardBytes ( size_t len)

◆ GetAvailableBytes()

size_t RealmSocket::GetAvailableBytes ( void ) const

Definition at line 92 of file RealmSocket.cpp.

References _inputBuffer, and _inputReadPos.

Referenced by PeekBytes().

◆ getRemoteAddress()

const std::string & RealmSocket::getRemoteAddress ( void ) const

Definition at line 76 of file RealmSocket.cpp.

References _remoteAddress.

Referenced by AuthSocket::_HandleLogonChallenge().

◆ getRemotePort()

uint16 RealmSocket::getRemotePort ( void ) const

Definition at line 81 of file RealmSocket.cpp.

References _remotePort.

◆ HandleRead()

void RealmSocket::HandleRead ( boost::system::error_code const & error,
size_t bytesTransferred )
private

◆ HandleWrite()

void RealmSocket::HandleWrite ( boost::system::error_code const & error)
private

◆ IsOpen()

bool RealmSocket::IsOpen ( void ) const
private

Definition at line 244 of file RealmSocket.cpp.

References _socket.

Referenced by AsyncRead(), CloseSocket(), QueueWrite(), and StartAsyncWrite().

◆ LogAuthPacket()

void RealmSocket::LogAuthPacket ( void const * data,
size_t len,
Skyfire::PacketLogServerDirection direction )
private

Definition at line 296 of file RealmSocket.cpp.

References BuildPacketLogSessionInfo(), and sPacketLogServer.

Referenced by HandleRead(), and QueueSend().

◆ NotifyClose()

void RealmSocket::NotifyClose ( )
private

Definition at line 261 of file RealmSocket.cpp.

References _closeNotified, _session, and sPacketLogServer.

Referenced by CloseSocket().

◆ PeekBytes()

bool RealmSocket::PeekBytes ( void * buf,
size_t len,
size_t offset = 0 ) const

Definition at line 97 of file RealmSocket.cpp.

References _inputBuffer, _inputReadPos, and GetAvailableBytes().

Referenced by ReadBytes().

◆ QueueSend()

◆ QueueWrite()

void RealmSocket::QueueWrite ( std::vector< char > data)
private

Definition at line 194 of file RealmSocket.cpp.

References _closed, _writeInProgress, _writeQueue, IsOpen(), and StartAsyncWrite().

◆ ReadBytes()

bool RealmSocket::ReadBytes ( void * buf,
size_t len )

Definition at line 113 of file RealmSocket.cpp.

References DiscardBytes(), and PeekBytes().

◆ Run()

void RealmSocket::Run ( )
private

Definition at line 155 of file RealmSocket.cpp.

References AsyncRead().

◆ set_session()

void RealmSocket::set_session ( std::unique_ptr< Session > session)

Definition at line 150 of file RealmSocket.cpp.

References _session.

◆ SetPacketLogAccountName()

void RealmSocket::SetPacketLogAccountName ( std::string accountName)

◆ Start()

void RealmSocket::Start ( )

Definition at line 63 of file RealmSocket.cpp.

References _session, and AsyncRead().

◆ StartAsyncWrite()

void RealmSocket::StartAsyncWrite ( )
private

Definition at line 206 of file RealmSocket.cpp.

References _closed, _socket, _writeInProgress, _writeQueue, and IsOpen().

Referenced by HandleWrite(), and QueueWrite().

Member Data Documentation

◆ _closed

std::atomic<bool> RealmSocket::_closed
private

◆ _closeNotified

std::atomic<bool> RealmSocket::_closeNotified
private

Definition at line 81 of file RealmSocket.h.

Referenced by NotifyClose(), and RealmSocket().

◆ _inputBuffer

std::vector<char> RealmSocket::_inputBuffer
private

◆ _inputReadPos

size_t RealmSocket::_inputReadPos
private

◆ _packetLogAccountName

std::string RealmSocket::_packetLogAccountName
private

Definition at line 76 of file RealmSocket.h.

Referenced by BuildPacketLogSessionInfo(), RealmSocket(), and SetPacketLogAccountName().

◆ _readBuffer

std::array<char, 4096> RealmSocket::_readBuffer
private

Definition at line 71 of file RealmSocket.h.

Referenced by AsyncRead(), HandleRead(), and RealmSocket().

◆ _remoteAddress

std::string RealmSocket::_remoteAddress
private

◆ _remotePort

uint16 RealmSocket::_remotePort
private

Definition at line 77 of file RealmSocket.h.

Referenced by getRemotePort(), HandleWrite(), and RealmSocket().

◆ _session

std::unique_ptr<Session> RealmSocket::_session
private

Definition at line 74 of file RealmSocket.h.

Referenced by HandleRead(), NotifyClose(), RealmSocket(), set_session(), and Start().

◆ _socket

std::unique_ptr<RealmSocketHandle> RealmSocket::_socket
private

Definition at line 70 of file RealmSocket.h.

Referenced by AsyncRead(), CloseSocket(), IsOpen(), QueueSend(), RealmSocket(), and StartAsyncWrite().

◆ _writeInProgress

bool RealmSocket::_writeInProgress
private

Definition at line 79 of file RealmSocket.h.

Referenced by HandleWrite(), QueueWrite(), RealmSocket(), and StartAsyncWrite().

◆ _writeQueue

std::deque<std::vector<char> > RealmSocket::_writeQueue
private

Definition at line 78 of file RealmSocket.h.

Referenced by HandleWrite(), QueueWrite(), RealmSocket(), and StartAsyncWrite().


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