RakNet
4.0
|
Class interface for the Router2 system. More...
#include <Router2.h>
Public Member Functions | |
void | SetSocketFamily (unsigned short _socketFamily) |
void | EstablishRouting (RakNetGUID endpointGuid) |
Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED. | |
void | SetMaximumForwardingRequests (int max) |
void | SetDebugInterface (Router2DebugInterface *_debugInterface) |
For testing and debugging. | |
Router2DebugInterface * | GetDebugInterface (void) const |
Get the pointer passed to SetDebugInterface() | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
![]() | |
virtual void | OnAttach (void) |
Called when the interface is attached. | |
virtual void | OnDetach (void) |
Called when the interface is detached. | |
virtual void | OnRakPeerStartup (void) |
Called when RakPeer is initialized. | |
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
virtual bool | UsesReliabilityLayer (void) const |
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) |
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend) |
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time) |
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
Class interface for the Router2 system.
void RakNet::Router2::EstablishRouting | ( | RakNetGUID | endpointGuid | ) |
Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED.
On ID_ROUTER_2_FORWARDING_ESTABLISHED, EstablishRouting as follows:
RakNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); RakNetGUID endpointGuid; bs.Read(endpointGuid); unsigned short sourceToDestPort; bs.Read(sourceToDestPort); char ipAddressString[32]; packet->systemAddress.ToString(false, ipAddressString); rakPeerInterface->EstablishRouting(ipAddressString, sourceToDestPort, 0,0);
|
virtual |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from RakNet::PluginInterface2.
|
virtual |
Called when a connection attempt fails
[in] | packet | Packet to be returned to the user |
[in] | failedConnectionReason | Why the connection failed |
Reimplemented from RakNet::PluginInterface2.
|
virtual |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
void RakNet::Router2::SetMaximumForwardingRequests | ( | int | max | ) |
Set the maximum number of bidirectional connections this system will support Defaults to 0
void RakNet::Router2::SetSocketFamily | ( | unsigned short | _socketFamily | ) |
Sets the socket family to use, either IPV4 or IPV6
[in] | socketFamily | For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC. |