|
R-Type
Distributed multiplayer game engine in C++
|
Interface representing a remote peer in the network. More...
#include <IPeer.hpp>


Public Member Functions | |
| virtual | ~IPeer ()=default |
| virtual bool | send (std::unique_ptr< IPacket > packet, uint8_t channelID=0)=0 |
| Send a packet to this peer. | |
| virtual void | disconnect (uint32_t data=0)=0 |
| Disconnect from this peer. | |
| virtual void | disconnectNow (uint32_t data=0)=0 |
| Force an immediate disconnect from this peer. | |
| virtual void | disconnectLater (uint32_t data=0)=0 |
| Disconnect from this peer after all queued packets are sent. | |
| virtual PeerState | getState () const =0 |
| Get the current state of 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 uint32_t | getRoundTripTime () const =0 |
| Get the round-trip time (ping) to this peer. | |
| virtual void | setData (void *data)=0 |
| Set application-specific data associated with this peer. | |
| virtual void * | getData () const =0 |
| Get application-specific data associated with this peer. | |
Interface representing a remote peer in the network.
IPeer represents a connection to another endpoint (client or server). The concrete implementation (ENetPeer, custom connection, etc.) is hidden behind this interface to maintain backend independence.
|
virtualdefault |
|
pure virtual |
Disconnect from this peer.
| data | Optional user data to send with the disconnect notification. |
Implemented in ENetPeerWrapper.
|
pure virtual |
Disconnect from this peer after all queued packets are sent.
| data | Optional user data to send with the disconnect notification. |
Implemented in ENetPeerWrapper.
|
pure virtual |
Force an immediate disconnect from this peer.
| data | Optional user data to send with the disconnect notification. |
Implemented in ENetPeerWrapper.
Referenced by Replicator::disconnect().
|
pure virtual |
Get the address of this peer.
Implemented in ENetPeerWrapper.
|
pure virtual |
Get application-specific data associated with this peer.
Implemented in ENetPeerWrapper.
|
pure virtual |
Get a unique identifier for this peer.
Implemented in ENetPeerWrapper.
|
pure virtual |
Get the round-trip time (ping) to this peer.
Implemented in ENetPeerWrapper.
Referenced by Replicator::networkThreadLoop().
|
pure virtual |
Get the current state of this peer.
Implemented in ENetPeerWrapper.
Referenced by Replicator::disconnect().
|
pure virtual |
Send a packet to this peer.
| packet | The packet to send. |
| channelID | The channel ID to send the packet on. |
Implemented in ENetPeerWrapper.
Referenced by 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().
|
pure virtual |
Set application-specific data associated with this peer.
| data | Pointer to user data. |
Implemented in ENetPeerWrapper.