Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Public Member Functions | Public Attributes
RakNet::UDPForwarder Class Reference

Forwards UDP datagrams. Independent of RakNet's protocol.

#include <UDPForwarder.h>

List of all members.

Classes

struct  ForwardEntry
struct  SrcAndDest
struct  ThreadOperation

Public Member Functions

UDPForwarderResult AddForwardingEntry (SrcAndDest srcAndDest, RakNet::TimeMS timeoutOnNoDataMS, unsigned short *port, const char *forceHostAddress, short socketFamily)
int GetMaxForwardEntries (void) const
int GetUsedForwardEntries (void) const
void SetMaxForwardEntries (unsigned short maxEntries)
void Shutdown (void)
 Stops the system, and frees all sockets.
UDPForwarderResult StartForwarding (SystemAddress source, SystemAddress destination, RakNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily, unsigned short *forwardingPort, SOCKET *forwardingSocket)
UDPForwarderResult StartForwardingThreaded (SystemAddress source, SystemAddress destination, RakNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily, unsigned short *forwardingPort, SOCKET *forwardingSocket)
void Startup (void)
void StopForwarding (SystemAddress source, SystemAddress destination)
void StopForwardingThreaded (SystemAddress source, SystemAddress destination)
 UDPForwarder ()
void Update (void)
void UpdateThreaded_Old (void)
 ~UDPForwarder ()

Public Attributes

DataStructures::Multilist
< ML_ORDERED_LIST,
ForwardEntry *, SrcAndDest
forwardList
bool isRunning
unsigned short maxForwardEntries
short socketFamily
SimpleMutex threadOperationIncomingMutex
DataStructures::Queue
< ThreadOperation
threadOperationIncomingQueue
SimpleMutex threadOperationOutgoingMutex
DataStructures::Queue
< ThreadOperation
threadOperationOutgoingQueue
bool threadRunning

Detailed Description

Definition at line 43 of file UDPForwarder.h.


Constructor & Destructor Documentation

RakNet::UDPForwarder::UDPForwarder ( )
RakNet::UDPForwarder::~UDPForwarder ( )

Member Function Documentation

UDPForwarderResult RakNet::UDPForwarder::AddForwardingEntry ( SrcAndDest  srcAndDest,
RakNet::TimeMS  timeoutOnNoDataMS,
unsigned short *  port,
const char *  forceHostAddress,
short  socketFamily 
)
int RakNet::UDPForwarder::GetMaxForwardEntries ( void  ) const
Returns:
The maxEntries parameter passed to SetMaxForwardEntries(), or the default if it was never called
int RakNet::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 RakNet::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]maxEntriesThe maximum number of simultaneous forwarding entries. Defaults to 64 (32 connections)
void RakNet::UDPForwarder::Shutdown ( void  )
UDPForwarderResult RakNet::UDPForwarder::StartForwarding ( SystemAddress  source,
SystemAddress  destination,
RakNet::TimeMS  timeoutOnNoDataMS,
const char *  forceHostAddress,
unsigned short  socketFamily,
unsigned short *  forwardingPort,
SOCKET forwardingSocket 
)
Parameters:
[out]forwardingPortNew opened port for forwarding
[out]forwardingSocketNew opened socket for forwarding
Returns:
UDPForwarderResult
UDPForwarderResult RakNet::UDPForwarder::StartForwardingThreaded ( SystemAddress  source,
SystemAddress  destination,
RakNet::TimeMS  timeoutOnNoDataMS,
const char *  forceHostAddress,
unsigned short  socketFamily,
unsigned short *  forwardingPort,
SOCKET forwardingSocket 
)
void RakNet::UDPForwarder::Startup ( void  )

Starts the system. Required to call before StartForwarding

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

No longer forward datagrams from source to destination

Parameters:
[in]sourceThe source IP and port
[in]destinationWhere to forward to
void RakNet::UDPForwarder::StopForwardingThreaded ( SystemAddress  source,
SystemAddress  destination 
)
void RakNet::UDPForwarder::Update ( void  )

Call on a regular basis, unless using UDP_FORWARDER_EXECUTE_THREADED. Will call select__() on all sockets and forward messages.

void RakNet::UDPForwarder::UpdateThreaded_Old ( void  )

Member Data Documentation

Definition at line 156 of file UDPForwarder.h.

Definition at line 162 of file UDPForwarder.h.

Definition at line 157 of file UDPForwarder.h.

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 15 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an some extra seconds for latency
Parameters:
[in]sourceThe source IP and port
[in]destinationWhere to forward to (and vice-versa)
[in]timeoutOnNoDataMSIf no messages are forwarded for this many MS, then automatically remove this entry. Currently hardcoded to UDP_FORWARDER_MAXIMUM_TIMEOUT (else the call fails)
[in]forceHostAddressForce binding on a particular address. 0 to use any.
[in]socketFamilyIP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.

Definition at line 82 of file UDPForwarder.h.

Definition at line 144 of file UDPForwarder.h.

Definition at line 145 of file UDPForwarder.h.

Definition at line 144 of file UDPForwarder.h.

Definition at line 146 of file UDPForwarder.h.

Definition at line 162 of file UDPForwarder.h.


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net