1 #ifndef BROWSING_CLIENT_H
2 #define BROWSING_CLIENT_H
5 #include <net/socket.h>
6 #include <battlefield/gameserver.h>
32 Client(
int socket,
struct sockaddr_in address);
57 void onRequest(
const std::vector<unsigned char>& request);
84 std::vector<std::vector<unsigned char>>& requests);
107 void _Encrypt(std::vector<unsigned char>& response);
115 void _LogTransaction(
const std::string& direction,
const std::string& response)
const;
123 void _FilterServers(
const std::string& filter, Battlefield::GameServers& game_servers);
Class representing game server information.
Client class for handling browsing requests.
bool _FilterServerReconfigurable(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on reconfigurability.
bool _FilterServerNumPlayers(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on number of players.
bool _FilterServerGameVersion(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on game version.
void Listen()
Listens for incoming requests from the client.
void Disconnect()
Disconnects the client.
bool _FilterServerMapName(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on map name.
void _FilterServers(const std::string &filter, Battlefield::GameServers &game_servers)
Filters game servers based on the provided filter criteria.
~Client()
Destroys the Client object.
void _BufferToRequests(const std::vector< unsigned char > &buffer, std::vector< std::vector< unsigned char >> &requests)
Converts a buffer to a list of requests.
void _insertClientInfo(std::vector< unsigned char > &response)
Inserts client information into the response.
Client(int socket, struct sockaddr_in address)
Constructs a new Client object.
void requestServerList(const std::vector< unsigned char > &request)
Sends a request for the server list.
static void Crack()
Cracking function to find the secret key from a package.
bool _FilterServerRegion(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on region.
bool _FilterServerTeamplay(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on teamplay.
bool _FilterServerStatsTracking(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on stats tracking.
void _LogTransaction(const std::string &direction, const std::string &response) const
Logs a transaction.
void _Encrypt(std::vector< unsigned char > &response)
Encrypts the response.
void onRequest(const std::vector< unsigned char > &request)
Event handler for incoming requests.
void requestServerInfo(const std::vector< unsigned char > &request)
Sends a request for server information.
bool _FilterServerClan(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on clan.
void _insertGameServerFlagIpPort(std::vector< unsigned char > &response, const Battlefield::GameServer &game_server)
Inserts game server flag, IP, and port into the response.
static void Heartbeat()
Heartbeat function to manage client connections.
std::vector< unsigned char > _client_challenge
Challenge data sent to the client.
static void Test()
Testing function to encrypt/decrypt a package.
bool _FilterServerGameType(const std::string &filter, const Battlefield::GameServer &game_server)
Checks if a game server matches the filter criteria based on game type.
A base class representing a network socket.