51 virtual bool send(std::unique_ptr<IPacket> packet, uint8_t channelID = 0) = 0;
90 [[nodiscard]]
virtual uint32_t
getID()
const = 0;
108 [[nodiscard]]
virtual void *
getData()
const = 0;
PeerState
Represents the connection state of a peer.
@ CONNECTION_SUCCEEDED
Connection has succeeded.
@ DISCONNECT_LATER
Peer is scheduled to disconnect.
@ ACKNOWLEDGING_CONNECT
Connection acknowledgment is being sent.
@ ACKNOWLEDGING_DISCONNECT
Disconnect acknowledgment is being sent.
@ ZOMBIE
Peer is in a zombie state.
@ CONNECTION_PENDING
Connection is pending.
@ DISCONNECTED
Peer is disconnected.
@ CONNECTING
Connection to peer is being established.
@ CONNECTED
Peer is connected.
@ DISCONNECTING
Disconnection is in progress.
Interface representing a network address (IP + port).
Interface representing a remote peer in the network.
virtual void disconnect(uint32_t data=0)=0
Disconnect from this peer.
virtual const IAddress & getAddress() const =0
Get the address of this peer.
virtual uint32_t getID() const =0
Get a unique identifier for this peer.
virtual void disconnectLater(uint32_t data=0)=0
Disconnect from this peer after all queued packets are sent.
virtual void * getData() const =0
Get application-specific data associated with this peer.
virtual PeerState getState() const =0
Get the current state of this peer.
virtual bool send(std::unique_ptr< IPacket > packet, uint8_t channelID=0)=0
Send a packet to this peer.
virtual void disconnectNow(uint32_t data=0)=0
Force an immediate disconnect from this peer.
virtual void setData(void *data)=0
Set application-specific data associated with this peer.
virtual uint32_t getRoundTripTime() const =0
Get the round-trip time (ping) to this peer.