RakNet::UDPForwarder Class Reference
[NatPunchthrough]

Forwards UDP datagrams. Independent of RakNet's protocol. More...

#include <UDPForwarder.h>

List of all members.

Public Member Functions

void Startup (void)
void Shutdown (void)
 Stops the system, and frees all sockets.
void Update (void)
 Call on a regular basis. Will call select() on all sockets and forward messages.
void SetMaxForwardEntries (unsigned short maxEntries)
int GetMaxForwardEntries (void) const
int GetUsedForwardEntries (void) const
bool StartForwarding (SystemAddress source, SystemAddress destination, RakNetTimeMS timeoutOnNoDataMS, unsigned short *srcToDestPort, unsigned short *destToSourcePort)
void StopForwarding (SystemAddress source, SystemAddress destination)


Detailed Description

Forwards UDP datagrams. Independent of RakNet's protocol.

Member Function Documentation

int UDPForwarder::GetMaxForwardEntries ( void   )  const

Returns:
The maxEntries parameter passed to SetMaxForwardEntries(), or the default if it was never called

int UDPForwarder::GetUsedForwardEntries ( void   )  const

Note:
Each call to StartForwarding uses up two forwarding entries, since communications are bidirectional
Returns:
How many entries have been used

void UDPForwarder::SetMaxForwardEntries ( unsigned short  maxEntries  ) 

Sets the maximum number of forwarding entries allowed Set according to your available bandwidth and the estimated average bandwidth per forwarded address. A single connection requires 2 entries, as connections are bi-directional.

Parameters:
[in] maxEntries The maximum number of simultaneous forwarding entries. Defaults to 64 (32 connections)

bool UDPForwarder::StartForwarding ( SystemAddress  source,
SystemAddress  destination,
RakNetTimeMS  timeoutOnNoDataMS,
unsigned short *  srcToDestPort,
unsigned short *  destToSourcePort 
)

Forwards datagrams from source to destination, and vice-versa Does nothing if this forward entry already exists via a previous call

Precondition:
Call Startup()
Note:
RakNet's protocol will ensure a message is sent at least every 5 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an extra few seconds for latency
Parameters:
[in] source The source IP and port
[in] destination Where to forward to (and vice-versa)
[in] timeoutOnNoDataMS If no messages are forwarded for this many MS, then automatically remove this entry. Currently hardcoded to UDP_FORWARDER_MAXIMUM_TIMEOUT (else the call fails)
[out] srcToDestPort Port to go from source to destination
[out] destToSourcePort Port to go from destination to source
Returns:
false on failure (can't bind the sockets). True otherwise, with srcToDestPortOut and destToSourcePortOut written

void UDPForwarder::Startup ( void   ) 

Starts the system. Required to call before StartForwarding

void UDPForwarder::StopForwarding ( SystemAddress  source,
SystemAddress  destination 
)

No longer forward datagrams from source to destination

Parameters:
[in] source The source IP and port
[in] destination Where to forward to


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

Generated on Thu Apr 30 08:06:52 2009 for RakNet by  doxygen 1.5.7.1