ENetTransport
- Module
- Networking
- Header
#include "Networking/ENetTransport.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
ENetTransport() = default | ENetTransport | |
~ENetTransport() override | ~ENetTransport |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Host | |
uint16_t | GetBoundPort | |
bool | Connect | |
void | Disconnect | |
void | DisconnectPeer | |
void | DisconnectPeerAfterFlush | |
void | Poll | |
void | Send | |
void | Broadcast | |
ConnectionState | GetState | |
uint32_t | GetLocalPeerId | |
const std::vector<NetworkPeer>& | GetPeers | |
bool | GetPeerStats | |
bool | GetSimulationStats | |
void | SetEncryptionMode | Overrides the net.encrypt / net.psk config for this transport instance. |
void | SetPreSharedKey | |
ENetEncryptionMode | GetEncryptionMode | |
std::string | GetJoinKey | Host: the key a peer from off this machine has to present — the one the host made up for this session when no net.psk is configured, empty otherwise. |
void | SetJoinKey | |
bool | IsPeerEncrypted | |
bool | ShouldWarnUnauthenticated | True when a session is encrypted but ANONYMOUS (empty PSK) on a public (non-private, non-loopback) address — the man-in-the-middle exposure the transport warns about. |
std::string | HostPskFor | The PSK a host demands from a peer at peerAddress, and the one a client presents to address: a configured net.psk for everyone; otherwise none on loopback and the host's join key from anywhere else. |
std::string | ClientPskFor | |
FNetSimQueue& | GetSendSimulation | Network emulation (net.sim.*). |
FNetSimQueue& | GetReceiveSimulation |
Function details
ENetTransport
ENetTransport() = default~ENetTransport
~ENetTransport() overrideHost
bool Host(uint16_t port, uint32_t maxClients) overrideGetBoundPort
uint16_t GetBoundPort() const overrideConnect
bool Connect(const std::string& address, uint16_t port) overrideDisconnect
void Disconnect() overrideDisconnectPeer
void DisconnectPeer(uint32_t peerId) overrideDisconnectPeerAfterFlush
void DisconnectPeerAfterFlush(uint32_t peerId) overridePoll
void Poll(std::vector<NetworkEvent>& outEvents) overrideSend
void Send(uint32_t peerId, const void* data, size_t size, uint8_t channel) overrideBroadcast
void Broadcast(const void* data, size_t size, uint8_t channel) overrideGetState
ConnectionState GetState() const overrideGetLocalPeerId
uint32_t GetLocalPeerId() const overrideGetPeers
const std::vector<NetworkPeer>& GetPeers() const overrideGetPeerStats
bool GetPeerStats(uint32_t peerId, NetworkPeerStats& outStats) const overrideGetSimulationStats
bool GetSimulationStats(FNetSimTransportStats& outStats) const overrideSetEncryptionMode
void SetEncryptionMode(ENetEncryptionMode mode)Overrides the net.encrypt / net.psk config for this transport instance. Must be called before Host/Connect.
SetPreSharedKey
void SetPreSharedKey(const std::string& psk)GetEncryptionMode
ENetEncryptionMode GetEncryptionMode() constGetJoinKey
std::string GetJoinKey() const overrideHost: the key a peer from off this machine has to present — the one the host made up for this session when no net.psk is configured, empty otherwise. Client: the key to present to the next host (host:port#KEY). Loopback links need none: nothing off this machine can sit between them.
SetJoinKey
void SetJoinKey(const std::string& key) overrideIsPeerEncrypted
bool IsPeerEncrypted(uint32_t peerId) constShouldWarnUnauthenticated
static bool ShouldWarnUnauthenticated(const std::string& address, bool encrypted, const std::string& psk)True when a session is encrypted but ANONYMOUS (empty PSK) on a public (non-private, non-loopback) address — the man-in-the-middle exposure the transport warns about. Static + pure so it's unit-testable.
HostPskFor
static std::string HostPskFor(const std::string& configuredPsk, const std::string& sessionKey, const std::string& peerAddress)The PSK a host demands from a peer at peerAddress, and the one a client presents to address: a configured net.psk for everyone; otherwise none on loopback and the host's join key from anywhere else. Pure, for tests.
ClientPskFor
static std::string ClientPskFor(const std::string& configuredPsk, const std::string& joinKey, const std::string& address)GetSendSimulation
FNetSimQueue& GetSendSimulation()Network emulation (net.sim.*). Both queues follow the process-wide settings unless a caller pins its own — a test wants a fixed pattern, not whatever the console last set.
GetReceiveSimulation
FNetSimQueue& GetReceiveSimulation()