BF2MC-Matchmaker
Public Member Functions | Private Member Functions | List of all members
GPSP::Client Class Reference

Client class for GPSP protocol. More...

#include <client.h>

Inheritance diagram for GPSP::Client:
Inheritance graph
[legend]
Collaboration diagram for GPSP::Client:
Collaboration graph
[legend]

Public Member Functions

 Client (int socket, struct sockaddr_in address)
 Construct a new Client object. More...
 
 ~Client ()
 Destroy the Client object.
 
void Listen ()
 Listen for incoming messages.
 
void Disconnect ()
 Disconnect the client.
 
void onRequest (const std::string &msg)
 Handle incoming requests. More...
 
void requestNicks (const GameSpy::Parameter &parameter) const
 Request nicknames. More...
 
void requestValid (const GameSpy::Parameter &parameter) const
 Request validation. More...
 
void requestNewUser (const GameSpy::Parameter &parameter) const
 Request a new user. More...
 
void requestSearch (const GameSpy::Parameter &parameter) const
 Search for users. More...
 
- Public Member Functions inherited from Net::Socket
void Close ()
 Closes the socket.
 
std::string GetIP () const
 Gets the IP address associated with the socket. More...
 
void GetIpArray (uint8_t *ip) const
 Gets the IP address associated with the socket as an array of bytes. More...
 
uint16_t GetPort () const
 Gets the port number associated with the socket. More...
 
std::string GetAddress () const
 Gets the full address (IP:Port) associated with the socket. More...
 
std::string GetSocketType () const
 Gets the socket type. More...
 
std::chrono::system_clock::time_point GetLastRecievedTime () const
 Gets the time when the socket last received data. More...
 
void Send (const std::string &msg) const
 Sends a message over the socket. More...
 
void Send (const std::vector< unsigned char > &msg) const
 Sends a message over the socket. More...
 
void UDPSend (const std::string &msg) const
 Sends a UDP message over the socket. More...
 
void UDPSend (const std::vector< unsigned char > &msg) const
 Sends a UDP message over the socket. More...
 
void UpdateLastRecievedTime ()
 Updates the last received time to the current system time.
 
virtual void WTF_WHY_AM_I_HERE_1337 ()
 Empty virtual function required for static_cast in C++. More...
 

Private Member Functions

void _LogTransaction (const std::string &direction, const std::string &response) const
 Log a transaction with direction and response. More...
 

Additional Inherited Members

- Protected Attributes inherited from Net::Socket
int _socket
 
struct sockaddr_in _address
 
std::chrono::system_clock::time_point _recieved_time
 
std::mutex _mutex
 

Detailed Description

Client class for GPSP protocol.

Definition at line 12 of file gpsp/client.h.

Constructor & Destructor Documentation

◆ Client()

GPSP::Client::Client ( int  socket,
struct sockaddr_in  address 
)

Construct a new Client object.

Parameters
socketThe socket descriptor.
addressThe address information.

Definition at line 25 of file gpsp/client.cpp.

Member Function Documentation

◆ _LogTransaction()

void GPSP::Client::_LogTransaction ( const std::string &  direction,
const std::string &  response 
) const
private

Log a transaction with direction and response.

This function logs a transaction with the specified direction (e.g., "<--" or "-->") and the response received.

Parameters
directionThe direction of the transaction ("<--" or "-->").
responseThe response data to be logged.

Definition at line 443 of file gpsp/client.cpp.

◆ onRequest()

void GPSP::Client::onRequest ( const std::string &  msg)

Handle incoming requests.

Parameters
msgThe incoming message.

Definition at line 75 of file gpsp/client.cpp.

◆ requestNewUser()

void GPSP::Client::requestNewUser ( const GameSpy::Parameter &  parameter) const

Request a new user.

Parameters
parameterThe request parameters.

Definition at line 276 of file gpsp/client.cpp.

◆ requestNicks()

void GPSP::Client::requestNicks ( const GameSpy::Parameter &  parameter) const

Request nicknames.

Parameters
parameterThe request parameters.

Definition at line 115 of file gpsp/client.cpp.

◆ requestSearch()

void GPSP::Client::requestSearch ( const GameSpy::Parameter &  parameter) const

Search for users.

Parameters
parameterThe request parameters.

Definition at line 393 of file gpsp/client.cpp.

◆ requestValid()

void GPSP::Client::requestValid ( const GameSpy::Parameter &  parameter) const

Request validation.

Parameters
parameterThe request parameters.

Definition at line 219 of file gpsp/client.cpp.


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