R-Type
|
#include <UdpClient.hpp>
Public Member Functions | |
UdpClient (asio::io_context &IOContext, asio::ip::udp::endpoint &serverEndpoint, SafeQueue< struct RType::Event > &eventQueue) | |
~UdpClient () | |
void | handleTransformComponent (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleTextureComponent (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleCollisionComponent (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleControllableComponent (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleTextureState (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleScore (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleEndGame (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleString (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
Handle String. More... | |
void | handleDisconnexion (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
Handle Disconnexion. More... | |
void | sendDataInformation (std::vector< std::byte > dataInformation, uint8_t packetType) |
Function that will send information to the server. More... | |
void | run () |
Launch the Udp Client. More... | |
void | handleData (struct RType::Protocol::HeaderDataPacket &, unsigned short port) |
Handle the data depends of the header. More... | |
![]() | |
ACommunication (asio::io_context &IOContext, unsigned short port) | |
Abstract class that will handle communication. More... | |
virtual | ~ACommunication () |
template<typename Socket , typename Endpoint > | |
void | sendData (void *data, std::size_t size, uint8_t packetType, Socket &socket, Endpoint &endpoint) |
Set the header to send the value. More... | |
void | sendInformation (void *data, std::size_t size, asio::ip::udp::socket &socket, asio::ip::udp::endpoint &endpoint, struct RType::Protocol::HeaderDataPacket &header) |
send the data to endpoint from the socket More... | |
void | sendInformation (void *data, std::size_t size, asio::ip::tcp::socket &socket, asio::ip::tcp::endpoint &, struct RType::Protocol::HeaderDataPacket &header) |
send the data to endpoint from the socket More... | |
void | handleReceive (const asio::error_code &error, std::size_t recvBytes, struct RType::Protocol::HeaderDataPacket &header) |
handle the header information More... | |
void | readHeader () |
read the header to retrieve informations More... | |
Additional Inherited Members | |
![]() | |
asio::streambuf | _streamBuffer |
asio::ip::udp::socket | _udpSocket |
asio::streambuf::mutable_buffers_type | _buffer |
struct RType::Protocol::HeaderDataPacket | _header |
asio::ip::udp::endpoint | _endpoint |
std::map< unsigned short, asio::ip::udp::endpoint > | _listClient |
RType::Client::UdpClient::UdpClient | ( | asio::io_context & | IOContext, |
asio::ip::udp::endpoint & | serverEndpoint, | ||
SafeQueue< struct RType::Event > & | eventQueue | ||
) |
RType::Client::UdpClient::~UdpClient | ( | ) |
void RType::Client::UdpClient::handleCollisionComponent | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::handleControllableComponent | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
|
virtual |
Handle the data depends of the header.
error | if asynchronous operation fails, it will be checked |
header | that contain the type of data |
Implements GameEngine::Network::ACommunication.
void RType::Client::UdpClient::handleDisconnexion | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
Handle Disconnexion.
header | that contains the size of the payload |
void RType::Client::UdpClient::handleEndGame | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::handleScore | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::handleString | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
Handle String.
header | that contains the size of the payload |
void RType::Client::UdpClient::handleTextureComponent | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::handleTextureState | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::handleTransformComponent | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Client::UdpClient::run | ( | ) |
Launch the Udp Client.
void RType::Client::UdpClient::sendDataInformation | ( | std::vector< std::byte > | dataInformation, |
uint8_t | packetType | ||
) |
Function that will send information to the server.
dataInformation | that contains the information |
packetType | corresponding the type of data |