Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Client Class Reference

#include <Client.h>

Public Member Functions

 Client (ASIO *asioPointer, boost::asio::io_context &service, bool debugOutput)
 
void start (boost::asio::ip::tcp::resolver::iterator endpoint_iter)
 
void stop ()
 
tcp_socketgetSocket () noexcept
 
bool sendPacket (const WorldPacket &p)
 
void receivePacket (WorldPacket &p) const
 
void toggleDebugOutput (const bool debugOutput) noexcept
 

Private Member Functions

void start_connect (boost::asio::ip::tcp::resolver::iterator endpoint_iter)
 
void handle_connect (const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator endpoint_iter)
 
void start_read ()
 
void handle_read_body (const boost::system::error_code &ec, size_t bytes_transferred)
 
void handle_read_packet (const boost::system::error_code &ec, size_t bytes_transferred)
 
void receiveFile ()
 
void handle_read_file (const boost::system::error_code &ec, size_t bytes_transferred)
 
void start_write ()
 
void handle_write (const boost::system::error_code &ec)
 
void handle_read_file_content (const boost::system::error_code &err, std::size_t bytes_transferred)
 
void check_deadline ()
 

Private Attributes

bool _stopped = false
 
bool _debugOutput
 
tcp_socket _socket
 
size_t _header = 0
 
boost::asio::streambuf _inputBuffer
 
deadline_timer _deadline
 
deadline_timer _heartbeatTimer
 
eastl::deque< WorldPacket_packetQueue
 
std::ofstream _outputFile
 
boost::asio::streambuf _requestBuf
 
size_t _fileSize = 0
 
std::array< char, 1024 > _buf {}
 
ASIO_asioPointer
 

Detailed Description

Definition at line 44 of file Client.h.

Constructor & Destructor Documentation

◆ Client()

Divide::Client::Client ( ASIO asioPointer,
boost::asio::io_context &  service,
bool  debugOutput 
)

Definition at line 18 of file Client.cpp.

Member Function Documentation

◆ check_deadline()

void Divide::Client::check_deadline ( )
private

Definition at line 250 of file Client.cpp.

◆ getSocket()

tcp_socket & Divide::Client::getSocket ( )
inlinenoexcept

Definition at line 60 of file Client.h.

◆ handle_connect()

void Divide::Client::handle_connect ( const boost::system::error_code &  ec,
boost::asio::ip::tcp::resolver::iterator  endpoint_iter 
)
private

Definition at line 306 of file Client.cpp.

◆ handle_read_body()

void Divide::Client::handle_read_body ( const boost::system::error_code &  ec,
size_t  bytes_transferred 
)
private

Definition at line 72 of file Client.cpp.

◆ handle_read_file()

void Divide::Client::handle_read_file ( const boost::system::error_code &  ec,
size_t  bytes_transferred 
)
private

Definition at line 135 of file Client.cpp.

◆ handle_read_file_content()

void Divide::Client::handle_read_file_content ( const boost::system::error_code &  err,
std::size_t  bytes_transferred 
)
private

Definition at line 177 of file Client.cpp.

◆ handle_read_packet()

void Divide::Client::handle_read_packet ( const boost::system::error_code &  ec,
size_t  bytes_transferred 
)
private

Definition at line 96 of file Client.cpp.

◆ handle_write()

void Divide::Client::handle_write ( const boost::system::error_code &  ec)
private

Definition at line 224 of file Client.cpp.

◆ receiveFile()

void Divide::Client::receiveFile ( )
private

◆ receivePacket()

void Divide::Client::receivePacket ( WorldPacket p) const

Definition at line 35 of file Client.cpp.

◆ sendPacket()

bool Divide::Client::sendPacket ( const WorldPacket p)

Definition at line 27 of file Client.cpp.

◆ start()

void Divide::Client::start ( boost::asio::ip::tcp::resolver::iterator  endpoint_iter)

Definition at line 40 of file Client.cpp.

◆ start_connect()

void Divide::Client::start_connect ( boost::asio::ip::tcp::resolver::iterator  endpoint_iter)
private

Definition at line 278 of file Client.cpp.

◆ start_read()

void Divide::Client::start_read ( )
private

Definition at line 57 of file Client.cpp.

◆ start_write()

void Divide::Client::start_write ( )
private

Definition at line 194 of file Client.cpp.

◆ stop()

void Divide::Client::stop ( )

Definition at line 49 of file Client.cpp.

◆ toggleDebugOutput()

void Divide::Client::toggleDebugOutput ( const bool  debugOutput)
inlinenoexcept

Definition at line 69 of file Client.h.

Member Data Documentation

◆ _asioPointer

ASIO* Divide::Client::_asioPointer
private

Definition at line 113 of file Client.h.

◆ _buf

std::array<char, 1024> Divide::Client::_buf {}
private

Definition at line 112 of file Client.h.

◆ _deadline

deadline_timer Divide::Client::_deadline
private

Definition at line 104 of file Client.h.

◆ _debugOutput

bool Divide::Client::_debugOutput
private

Definition at line 100 of file Client.h.

◆ _fileSize

size_t Divide::Client::_fileSize = 0
private

Definition at line 111 of file Client.h.

◆ _header

size_t Divide::Client::_header = 0
private

Definition at line 102 of file Client.h.

◆ _heartbeatTimer

deadline_timer Divide::Client::_heartbeatTimer
private

Definition at line 105 of file Client.h.

◆ _inputBuffer

boost::asio::streambuf Divide::Client::_inputBuffer
private

Definition at line 103 of file Client.h.

◆ _outputFile

std::ofstream Divide::Client::_outputFile
private

Definition at line 109 of file Client.h.

◆ _packetQueue

eastl::deque<WorldPacket> Divide::Client::_packetQueue
private

Definition at line 106 of file Client.h.

◆ _requestBuf

boost::asio::streambuf Divide::Client::_requestBuf
private

Definition at line 110 of file Client.h.

◆ _socket

tcp_socket Divide::Client::_socket
private

Definition at line 101 of file Client.h.

◆ _stopped

bool Divide::Client::_stopped = false
private

Definition at line 100 of file Client.h.


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