R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
NetworkFactory.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by IamSwan on 06/12/2025.
4** File description:
5** NetworkFactory.hpp
6*/
7
8#pragma once
9
10#include <cstdint>
11#include <memory>
12#include "IAddress.hpp"
13#include "IHost.hpp"
14#include "IPacket.hpp"
15
30std::unique_ptr<IHost> createServerHost(const IAddress &address, size_t maxClients = 32,
31 size_t channelLimit = 2, uint32_t incomingBandwidth = 0,
32 uint32_t outgoingBandwidth = 0);
33
45std::unique_ptr<IHost> createClientHost(size_t channelLimit = 2, uint32_t incomingBandwidth = 0,
46 uint32_t outgoingBandwidth = 0);
47
55std::unique_ptr<IPacket> createPacket(const std::vector<uint8_t> &data,
56 uint32_t flags = static_cast<uint32_t>(PacketFlag::RELIABLE));
57
65std::unique_ptr<IAddress> createAddress(const std::string &host = "0.0.0.0", uint16_t port = 0);
66
74
@ RELIABLE
Packet must be received by the target peer and resent if dropped.
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.
bool initializeNetworking()
Initialize the networking subsystem.
void deinitializeNetworking()
Cleanup the networking subsystem.
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< IAddress > createAddress(const std::string &host="0.0.0.0", uint16_t port=0)
Create a network address.
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.
Interface representing a network address (IP + port).
Definition IAddress.hpp:21