|
R-Type
Distributed multiplayer game engine in C++
|
#include <cstdint>#include <memory>#include "IAddress.hpp"#include "IHost.hpp"#include "IPacket.hpp"

Go to the source code of this file.
Functions | |
| std::unique_ptr< IHost > | createServerHost (const IAddress &address, size_t maxClients=32, size_t channelLimit=2, uint32_t incomingBandwidth=0, uint32_t outgoingBandwidth=0) |
| Create a host for server-side networking. | |
| std::unique_ptr< IHost > | createClientHost (size_t channelLimit=2, uint32_t incomingBandwidth=0, uint32_t outgoingBandwidth=0) |
| Create a host for client-side networking. | |
| std::unique_ptr< IPacket > | createPacket (const std::vector< uint8_t > &data, uint32_t flags=static_cast< uint32_t >(PacketFlag::RELIABLE)) |
| Create a network packet with the given data and flags. | |
| std::unique_ptr< IAddress > | createAddress (const std::string &host="0.0.0.0", uint16_t port=0) |
| Create a network address. | |
| bool | initializeNetworking () |
| Initialize the networking subsystem. | |
| void | deinitializeNetworking () |
| Cleanup the networking subsystem. | |
| std::unique_ptr< IAddress > createAddress | ( | const std::string & | host = "0.0.0.0", |
| uint16_t | port = 0 |
||
| ) |
Create a network address.
| host | The hostname or IP address. |
| port | The port number. |
Definition at line 37 of file NetworkFactory.cpp.
Referenced by Replicator::connect(), and ServerNetworkManager::start().
| std::unique_ptr< IHost > createClientHost | ( | size_t | channelLimit = 2, |
| uint32_t | incomingBandwidth = 0, |
||
| uint32_t | outgoingBandwidth = 0 |
||
| ) |
Create a host for client-side networking.
This function creates a host that can initiate connections to servers. The concrete implementation (ENet, custom backend) is hidden from the caller.
| channelLimit | Maximum number of channels per connection. |
| incomingBandwidth | Incoming bandwidth limit (0 = unlimited). |
| outgoingBandwidth | Outgoing bandwidth limit (0 = unlimited). |
Definition at line 28 of file NetworkFactory.cpp.
| std::unique_ptr< IPacket > createPacket | ( | const std::vector< uint8_t > & | data, |
| uint32_t | flags = static_cast< uint32_t >(PacketFlag::RELIABLE) |
||
| ) |
Create a network packet with the given data and flags.
| data | The data to include in the packet. |
| flags | Packet flags controlling delivery guarantees. |
Definition at line 33 of file NetworkFactory.cpp.
Referenced by Server::_broadcastGameState(), Server::_handleHandshakeRequest(), Server::_processPendingDestructions(), Server::_sendPacket(), Replicator::sendAutoMatchmaking(), Replicator::sendChatMessage(), Replicator::sendConnectRequest(), Replicator::sendCreateRoom(), server::GameruleBroadcaster::sendGamerulePacket(), Replicator::sendJoinRoom(), Replicator::sendLeaveRoom(), Replicator::sendListRooms(), Replicator::sendLoginAccount(), Replicator::sendPacket(), Replicator::sendRegisterAccount(), Replicator::sendStartGame(), and Replicator::updateAutoMatchmakingPreference().
| std::unique_ptr< IHost > createServerHost | ( | const IAddress & | address, |
| size_t | maxClients = 32, |
||
| size_t | channelLimit = 2, |
||
| uint32_t | incomingBandwidth = 0, |
||
| uint32_t | outgoingBandwidth = 0 |
||
| ) |
Create a host for server-side networking.
This function creates a host that listens for incoming connections on the specified address. The concrete implementation (ENet, custom backend) is hidden from the caller.
| address | Address to bind the server to. |
| maxClients | Maximum number of clients that can connect. |
| channelLimit | Maximum number of channels per connection. |
| incomingBandwidth | Incoming bandwidth limit (0 = unlimited). |
| outgoingBandwidth | Outgoing bandwidth limit (0 = unlimited). |
Definition at line 22 of file NetworkFactory.cpp.
Referenced by ServerNetworkManager::start().
| void deinitializeNetworking | ( | ) |
Cleanup the networking subsystem.
Should be called when networking is no longer needed.
Definition at line 18 of file NetworkFactory.cpp.
Referenced by Client::~Client(), and Server::~Server().
| bool initializeNetworking | ( | ) |
Initialize the networking subsystem.
Must be called before using any networking functions.
Definition at line 14 of file NetworkFactory.cpp.
Referenced by Client::initialize(), and Server::initialize().