#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. |
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 void RakNet::Router2::OnClosedConnection | ( | const SystemAddress & | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
PI2_LostConnectionReason | lostConnectionReason | |||
) | [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 void RakNet::Router2::OnFailedConnectionAttempt | ( | Packet * | packet, | |
PI2_FailedConnectionAttemptReason | failedConnectionAttemptReason | |||
) | [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 PluginReceiveResult RakNet::Router2::OnReceive | ( | Packet * | packet | ) | [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. |