Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

RakNet::Router2 Class Reference
[Router2]

Class interface for the Router2 system. More...

#include <Router2.h>

Inherits PluginInterface2.

Collaboration diagram for RakNet::Router2:
Collaboration graph
[legend]

List of all members.

Classes

struct  ConnectionRequestSystem
struct  ConnnectRequest
struct  ForwardedConnection
struct  MiniPunchRequest

Public Types

enum  Router2RequestStates { R2RS_REQUEST_STATE_QUERY_FORWARDING, REQUEST_STATE_REQUEST_FORWARDING }

Public Member Functions

 Router2 ()
virtual ~Router2 ()
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.
Router2DebugInterfaceGetDebugInterface (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 (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual void OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
unsigned int GetConnectionRequestIndex (RakNetGUID endpointGuid)

Protected Member Functions

bool UpdateForwarding (unsigned int connectionRequestIndex)
void RemoveConnectionRequest (unsigned int connectionRequestIndex)
void RequestForwarding (unsigned int connectionRequestIndex)
void OnQueryForwarding (Packet *packet)
void OnQueryForwardingReply (Packet *packet)
void OnRequestForwarding (Packet *packet)
void OnReroute (Packet *packet)
void OnMiniPunchReply (Packet *packet)
void OnMiniPunchReplyBounce (Packet *packet)
bool OnForwardingSuccess (Packet *packet)
int GetLargestPingAmongConnectedSystems (void) const
void ReturnToUser (MessageID messageId, RakNetGUID endpointGuid, SystemAddress systemAddress)
bool ConnectInternal (RakNetGUID endpointGuid, bool returnConnectionLostOnFailure)
void ClearConnectionRequests (void)
void ClearMinipunches (void)
void ClearForwardedConnections (void)
void ClearAll (void)
int ReturnFailureOnCannotForward (RakNetGUID sourceGuid, RakNetGUID endpointGuid)
void SendFailureOnCannotForward (RakNetGUID sourceGuid, RakNetGUID endpointGuid)
void SendForwardingSuccess (RakNetGUID sourceGuid, RakNetGUID endpointGuid, unsigned short sourceToDstPort)
void SendOOBFromRakNetPort (OutOfBandIdentifiers oob, BitStream *extraData, SystemAddress sa)
void SendOOBFromSpecifiedSocket (OutOfBandIdentifiers oob, SystemAddress sa, SOCKET socket)
void SendOOBMessages (MiniPunchRequest *mpr)

Protected Attributes

UDPForwarderudpForwarder
int maximumForwardingRequests
DataStructures::List
< ConnnectRequest * > 
connectionRequests
DataStructures::List
< MiniPunchRequest
miniPunchesInProgress
DataStructures::List
< ForwardedConnection
forwardedConnectionList
Router2DebugInterfacedebugInterface

Detailed Description

Class interface for the Router2 system.

Definition at line 39 of file Router2.h.


Member Enumeration Documentation

Enumerator:
R2RS_REQUEST_STATE_QUERY_FORWARDING 
REQUEST_STATE_REQUEST_FORWARDING 

Definition at line 86 of file Router2.h.


Constructor & Destructor Documentation

Router2::Router2 (  ) 

Definition at line 65 of file Router2.cpp.

Router2::~Router2 (  )  [virtual]

Definition at line 71 of file Router2.cpp.

Here is the call graph for this function:


Member Function Documentation

void Router2::ClearAll ( void   )  [protected]

Definition at line 1030 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::ClearConnectionRequests ( void   )  [protected]

Definition at line 85 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::ClearForwardedConnections ( void   )  [protected]

Definition at line 1026 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::ClearMinipunches ( void   )  [protected]

Definition at line 81 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Router2::ConnectInternal ( RakNetGUID  endpointGuid,
bool  returnConnectionLostOnFailure 
) [protected]

Definition at line 93 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void 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);

Note:
The SystemAddress for a connection should not be used - always use RakNetGuid as the address can change at any time. When the address changes, you will get ID_ROUTER_2_REROUTED

Definition at line 157 of file Router2.cpp.

Here is the call graph for this function:

unsigned int Router2::GetConnectionRequestIndex ( RakNetGUID  endpointGuid  ) 

Definition at line 997 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Router2DebugInterface * Router2::GetDebugInterface ( void   )  const

Get the pointer passed to SetDebugInterface().

Definition at line 1040 of file Router2.cpp.

int Router2::GetLargestPingAmongConnectedSystems ( void   )  const [protected]

Definition at line 976 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnClosedConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
) [virtual]

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:
[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 PluginInterface2.

Definition at line 368 of file Router2.cpp.

Here is the call graph for this function:

void Router2::OnFailedConnectionAttempt ( Packet packet,
PI2_FailedConnectionAttemptReason  failedConnectionAttemptReason 
) [virtual]

Called when a connection attempt fails

Parameters:
[in] packet Packet to be returned to the user
[in] failedConnectionReason Why the connection failed

Reimplemented from PluginInterface2.

Definition at line 458 of file Router2.cpp.

Here is the call graph for this function:

bool Router2::OnForwardingSuccess ( Packet packet  )  [protected]

Definition at line 919 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnMiniPunchReply ( Packet packet  )  [protected]

Definition at line 905 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnMiniPunchReplyBounce ( Packet packet  )  [protected]

Definition at line 865 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnNewConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
bool  isIncoming 
) [virtual]

Called when we got a new connection

Parameters:
[in] systemAddress Address of the new connection
[in] rakNetGuid The guid of the specified system
[in] isIncoming If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from PluginInterface2.

Definition at line 481 of file Router2.cpp.

void Router2::OnQueryForwarding ( Packet packet  )  [protected]

Definition at line 634 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnQueryForwardingReply ( Packet packet  )  [protected]

Definition at line 666 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnRakPeerShutdown ( void   )  [virtual]

Called when RakPeer is shutdown.

Reimplemented from PluginInterface2.

Definition at line 496 of file Router2.cpp.

Here is the call graph for this function:

PluginReceiveResult Router2::OnReceive ( Packet packet  )  [virtual]

OnReceive is called for every packet.

Parameters:
[in] packet the packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

The routed system wants more time to stay alive on no communication, in case the router drops or crashes

Reimplemented from PluginInterface2.

Definition at line 185 of file Router2.cpp.

Here is the call graph for this function:

void Router2::OnRequestForwarding ( Packet packet  )  [protected]

Definition at line 793 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::OnReroute ( Packet packet  )  [protected]

Definition at line 772 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::RemoveConnectionRequest ( unsigned int  connectionRequestIndex  )  [protected]

Definition at line 546 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::RequestForwarding ( unsigned int  connectionRequestIndex  )  [protected]

Definition at line 563 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int Router2::ReturnFailureOnCannotForward ( RakNetGUID  sourceGuid,
RakNetGUID  endpointGuid 
) [protected]

Definition at line 612 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::ReturnToUser ( MessageID  messageId,
RakNetGUID  endpointGuid,
SystemAddress  systemAddress 
) [protected]

Definition at line 1017 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SendFailureOnCannotForward ( RakNetGUID  sourceGuid,
RakNetGUID  endpointGuid 
) [protected]

Definition at line 603 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SendForwardingSuccess ( RakNetGUID  sourceGuid,
RakNetGUID  endpointGuid,
unsigned short  sourceToDstPort 
) [protected]

Definition at line 717 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SendOOBFromRakNetPort ( OutOfBandIdentifiers  oob,
BitStream extraData,
SystemAddress  sa 
) [protected]

Definition at line 731 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SendOOBFromSpecifiedSocket ( OutOfBandIdentifiers  oob,
SystemAddress  sa,
SOCKET  socket 
) [protected]

Definition at line 744 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SendOOBMessages ( Router2::MiniPunchRequest mpr  )  [protected]

Definition at line 751 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router2::SetDebugInterface ( Router2DebugInterface _debugInterface  ) 

For testing and debugging.

Definition at line 1036 of file Router2.cpp.

void Router2::SetMaximumForwardingRequests ( int  max  ) 

Set the maximum number of bidirectional connections this system will support Defaults to 0

Definition at line 169 of file Router2.cpp.

Here is the call graph for this function:

void Router2::Update ( void   )  [virtual]

Update is called every time a packet is checked for .

Reimplemented from PluginInterface2.

Definition at line 302 of file Router2.cpp.

Here is the call graph for this function:

bool Router2::UpdateForwarding ( unsigned int  connectionRequestIndex  )  [protected]

Definition at line 500 of file Router2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 157 of file Router2.h.

Definition at line 172 of file Router2.h.

Definition at line 159 of file Router2.h.

Definition at line 156 of file Router2.h.

Definition at line 158 of file Router2.h.

Definition at line 155 of file Router2.h.


The documentation for this class was generated from the following files: