SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes
NatPunchthrough
Plugins

Connect systems despite both systems being behind a router. More...

## Classes

struct | SLNet::PunchthroughConfiguration
struct | SLNet::NatPunchthroughDebugInterface
struct | SLNet::NatPunchthroughDebugInterface_Printf
struct | SLNet::NatPunchthroughDebugInterface_PacketLogger
class | SLNet::NatPunchthroughClient
| Client code for NATPunchthrough. More...
struct | SLNet::NatPunchthroughServerDebugInterface
struct | SLNet::NatPunchthroughServerDebugInterface_Printf
struct | SLNet::NatPunchthroughServerDebugInterface_PacketLogger
class | SLNet::NatPunchthroughServer
| Server code for NATPunchthrough. More...
class | SLNet::UDPForwarder
| Forwards UDP datagrams. Independent of RakNet's protocol. More...
class | SLNet::UDPProxyCoordinator
| Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server. More...
struct | SLNet::NatPunchthroughClient::AddrAndGuid
struct | SLNet::NatPunchthroughClient::DSTAndFac
struct | SLNet::NatPunchthroughClient::SendPing
struct | SLNet::NatPunchthroughServer::ConnectionAttempt
struct | SLNet::NatPunchthroughServer::User
struct | SLNet::UDPForwarder::ForwardEntry
struct | SLNet::UDPForwarder::StartForwardingInputStruct
struct | SLNet::UDPForwarder::StartForwardingOutputStruct
struct | SLNet::UDPForwarder::StopForwardingStruct
struct | SLNet::UDPProxyCoordinator::ForwardingRequest
struct | SLNet::UDPProxyCoordinator::SenderAndTargetAddress
struct | SLNet::UDPProxyCoordinator::ServerWithPing

## Detailed Description

Connect systems despite both systems being behind a router.

## Class Documentation

struct SLNet::PunchthroughConfiguration

Definition at line 53 of file NatPunchthroughClient.h.

### Public Member Functions

| PunchthroughConfiguration ()

### Public Attributes

SLNet::Time | TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL
| How much time between each UDP send.
SLNet::Time | TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL
int | UDP_SENDS_PER_PORT_INTERNAL
| How many tries for one port before giving up and going to the next port.
int | UDP_SENDS_PER_PORT_EXTERNAL
int | INTERNAL_IP_WAIT_AFTER_ATTEMPTS
| After giving up on one internal port, how long to wait before trying the next port.
int | MAX_PREDICTIVE_PORT_RANGE
| How many external ports to try past the last known starting port.
int | EXTERNAL_IP_WAIT_AFTER_FIRST_TTL
| After sending TTL, how long to wait until first punch attempt.
int | EXTERNAL_IP_WAIT_BETWEEN_PORTS
| After giving up on one external port, how long to wait before trying the next port.
int | EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS
| After trying all external ports, how long to wait before returning ID_NAT_PUNCHTHROUGH_FAILED.
int | MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK
bool | retryOnFailure

#### Constructor & Destructor Documentation

SLNet::PunchthroughConfiguration::PunchthroughConfiguration | ( |  | ) |

inline

internal: (15 ms * 2 tries + 30 wait) * 5 ports * 8 players = 2.4 seconds external: (50 ms * 8 sends + 200 wait) * 2 port * 8 players = 9.6 seconds Total: 8 seconds

set to 0 to not do lan connects

Definition at line 58 of file NatPunchthroughClient.h.

#### Member Data Documentation

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS

After trying all external ports, how long to wait before returning ID_NAT_PUNCHTHROUGH_FAILED.

Definition at line 93 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_AFTER_FIRST_TTL

After sending TTL, how long to wait until first punch attempt.

Definition at line 87 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_BETWEEN_PORTS

After giving up on one external port, how long to wait before trying the next port.

Definition at line 90 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::INTERNAL_IP_WAIT_AFTER_ATTEMPTS

After giving up on one internal port, how long to wait before trying the next port.

Definition at line 81 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::MAX_PREDICTIVE_PORT_RANGE

How many external ports to try past the last known starting port.

Definition at line 84 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK

Maximum number of internal IP address to try to connect to. Cannot be greater than MAXIMUM_NUMBER_OF_INTERNAL_IDS Should be high enough to try all internal IP addresses on the majority of computers

Definition at line 98 of file NatPunchthroughClient.h.

bool SLNet::PunchthroughConfiguration::retryOnFailure

If the first punchthrough attempt fails, try again This sometimes works because the remote router was looking for an incoming message on a higher numbered port before responding to a lower numbered port from the other system

Definition at line 102 of file NatPunchthroughClient.h.

SLNet::Time SLNet::PunchthroughConfiguration::TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL

Definition at line 74 of file NatPunchthroughClient.h.

SLNet::Time SLNet::PunchthroughConfiguration::TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL

How much time between each UDP send.

Definition at line 73 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::UDP_SENDS_PER_PORT_EXTERNAL

Definition at line 78 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::UDP_SENDS_PER_PORT_INTERNAL

How many tries for one port before giving up and going to the next port.

Definition at line 77 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughDebugInterface

Definition at line 106 of file NatPunchthroughClient.h.

Inheritance diagram for SLNet::NatPunchthroughDebugInterface:

### Public Member Functions

| NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()
virtual void | OnClientMessage (const char *msg)=0

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughDebugInterface::NatPunchthroughDebugInterface | ( |  | ) |

inline

Definition at line 108 of file NatPunchthroughClient.h.

virtual SLNet::NatPunchthroughDebugInterface::~NatPunchthroughDebugInterface | ( |  | ) |

inlinevirtual

Definition at line 109 of file NatPunchthroughClient.h.

#### Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface::OnClientMessage | ( | const char * | msg | ) |

pure virtual

Implemented in SLNet::NatPunchthroughDebugInterface_PacketLogger, and SLNet::NatPunchthroughDebugInterface_Printf.

struct SLNet::NatPunchthroughDebugInterface_Printf

Definition at line 114 of file NatPunchthroughClient.h.

Inheritance diagram for SLNet::NatPunchthroughDebugInterface_Printf:

### Public Member Functions

virtual void | OnClientMessage (const char *msg)
Public Member Functions inherited from SLNet::NatPunchthroughDebugInterface
| NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()

#### Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface_Printf::OnClientMessage | ( | const char * | msg | ) |

virtual

Implements SLNet::NatPunchthroughDebugInterface.

struct SLNet::NatPunchthroughDebugInterface_PacketLogger

Definition at line 121 of file NatPunchthroughClient.h.

Inheritance diagram for SLNet::NatPunchthroughDebugInterface_PacketLogger:

### Public Member Functions

| NatPunchthroughDebugInterface_PacketLogger ()
| ~NatPunchthroughDebugInterface_PacketLogger ()
virtual void | OnClientMessage (const char *msg)
Public Member Functions inherited from SLNet::NatPunchthroughDebugInterface
| NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()

### Public Attributes

PacketLogger * | pl

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughDebugInterface_PacketLogger::NatPunchthroughDebugInterface_PacketLogger | ( |  | ) |

inline

Definition at line 126 of file NatPunchthroughClient.h.

SLNet::NatPunchthroughDebugInterface_PacketLogger::~NatPunchthroughDebugInterface_PacketLogger | ( |  | ) |

inline

Definition at line 127 of file NatPunchthroughClient.h.

#### Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface_PacketLogger::OnClientMessage | ( | const char * | msg | ) |

virtual

Implements SLNet::NatPunchthroughDebugInterface.

#### Member Data Documentation

PacketLogger* SLNet::NatPunchthroughDebugInterface_PacketLogger::pl

Definition at line 124 of file NatPunchthroughClient.h.

class SLNet::NatPunchthroughClient

Client code for NATPunchthrough.

Maintain connection to NatPunchthroughServer to process incoming connection attempts through NatPunchthroughClient
Client will send datagrams to port to estimate next port
Will simultaneously connect with another client once ports are estimated.

See Also
  NatTypeDetectionClient See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

Definition at line 139 of file NatPunchthroughClient.h.

Inheritance diagram for SLNet::NatPunchthroughClient:

### Public Member Functions

| NatPunchthroughClient ()
| ~NatPunchthroughClient ()
void | FindRouterPortStride (const SystemAddress &facilitator)
bool | OpenNAT (RakNetGUID destination, const SystemAddress &facilitator)
PunchthroughConfiguration * | GetPunchthroughConfiguration (void)
void | SetDebugInterface (NatPunchthroughDebugInterface *i)
void | GetUPNPPortMappings (char *externalPort, char *internalPort, const SystemAddress &natPunchthroughServerAddress)
| Get the port mappings you should pass to UPNP (for miniupnpc-1.6.20120410, for the function UPNP_AddPortMapping)
virtual void | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnAttach (void)
| Called when the interface is attached.
virtual void | OnDetach (void)
| Called when the interface is detached.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
void | Clear (void)
Public Member Functions inherited from SLNet::PluginInterface2
| PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
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, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Public Attributes

struct SLNet::NatPunchthroughClient::SendPing | sp

### Protected Types

enum | { HAS_PORT_STRIDE, UNKNOWN_PORT_STRIDE, CALCULATING_PORT_STRIDE, INCAPABLE_PORT_STRIDE }

### Protected Member Functions

void | OnFailureNotification (Packet *packet)
void | OnGetMostRecentPort (Packet *packet)
void | OnConnectAtTime (Packet *packet)
unsigned int | GetPendingOpenNATIndex (RakNetGUID destination, const SystemAddress &facilitator)
void | SendPunchthrough (RakNetGUID destination, const SystemAddress &facilitator)
void | QueueOpenNAT (RakNetGUID destination, const SystemAddress &facilitator)
void | SendQueuedOpenNAT (void)
void | SendTTL (const SystemAddress &sa)
void | SendOutOfBand (SystemAddress sa, MessageID oobId)
void | OnPunchthroughFailure (void)
void | OnReadyForNextPunchthrough (void)
void | PushFailure (void)
bool | RemoveFromFailureQueue (void)
void | PushSuccess (void)
void | IncrementExternalAttemptCount (SLNet::Time time, SLNet::Time delta)
Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

### Protected Attributes

unsigned short | mostRecentExternalPort
PunchthroughConfiguration | pc
NatPunchthroughDebugInterface * | natPunchthroughDebugInterface
DataStructures::List< AddrAndGuid > | failedAttemptList
DataStructures::Queue< DSTAndFac > | queuedOpenNat
unsigned short | portStride
enum SLNet::NatPunchthroughClient:: { ... } | hasPortStride
SLNet::Time | portStrideCalTimeout
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

#### Member Enumeration Documentation

anonymous enum

protected

Enumerator:

  HAS_PORT_STRIDE |
  UNKNOWN_PORT_STRIDE |
  CALCULATING_PORT_STRIDE |
  INCAPABLE_PORT_STRIDE |

Definition at line 276 of file NatPunchthroughClient.h.

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughClient::NatPunchthroughClient | ( |  | ) |

SLNet::NatPunchthroughClient::~NatPunchthroughClient | ( |  | ) |

#### Member Function Documentation

void SLNet::NatPunchthroughClient::Clear | ( | void |  | ) |

void SLNet::NatPunchthroughClient::FindRouterPortStride | ( | const SystemAddress & | facilitator | ) |

If the instance of RakPeer running NATPunchthroughServer was bound to two IP addresses, then you can call FindRouterPortStride() This will determine the stride that your router uses when assigning ports, if your router is full-cone This function is also called automatically when you call OpenNAT - however, calling it earlier when you are connected to the facilitator will speed up the process

Parameters

  [in] | destination | The system to punch. Must already be connected to facilitator

unsigned int SLNet::NatPunchthroughClient::GetPendingOpenNATIndex | ( | RakNetGUID | destination,
|  | const SystemAddress & | facilitator
| ) |  |

protected

PunchthroughConfiguration* SLNet::NatPunchthroughClient::GetPunchthroughConfiguration | ( | void |  | ) |

Modify the system configuration if desired Don't modify the variables in the structure while punchthrough is in progress

void SLNet::NatPunchthroughClient::GetUPNPPortMappings | ( | char * | externalPort,
|  | char * | internalPort,
|  | const SystemAddress & | natPunchthroughServerAddress
| ) |  |

Get the port mappings you should pass to UPNP (for miniupnpc-1.6.20120410, for the function UPNP_AddPortMapping)

void SLNet::NatPunchthroughClient::IncrementExternalAttemptCount | ( | SLNet::Time | time,
|  | SLNet::Time | delta
| ) |  |

protected

virtual void SLNet::NatPunchthroughClient::OnAttach | ( | void |  | ) |

virtual

Called when the interface is attached.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::NatPunchthroughClient::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

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 SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnConnectAtTime | ( | Packet * | packet | ) |

protected

virtual void SLNet::NatPunchthroughClient::OnDetach | ( | void |  | ) |

virtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnFailureNotification | ( | Packet * | packet | ) |

protected

void SLNet::NatPunchthroughClient::OnGetMostRecentPort | ( | Packet * | packet | ) |

protected

virtual void SLNet::NatPunchthroughClient::OnNewConnection | ( | const 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 SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnPunchthroughFailure | ( | void |  | ) |

protected

virtual void SLNet::NatPunchthroughClient::OnRakPeerShutdown | ( | void |  | ) |

virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnReadyForNextPunchthrough | ( | void |  | ) |

protected

virtual PluginReceiveResult SLNet::NatPunchthroughClient::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

Reimplemented from SLNet::PluginInterface2.

bool SLNet::NatPunchthroughClient::OpenNAT | ( | RakNetGUID | destination,
|  | const SystemAddress & | facilitator
| ) |  |

Punchthrough a NAT. Doesn't connect, just tries to setup the routing table

Parameters

  [in] | destination | The system to punch. Must already be connected to facilitator
  [in] | facilitator | A system we are already connected to running the NatPunchthroughServer plugin

See Also
  OpenNATGroup() You will get ID_NAT_PUNCHTHROUGH_SUCCEEDED on success You will get ID_NAT_TARGET_NOT_CONNECTED, ID_NAT_TARGET_UNRESPONSIVE, ID_NAT_CONNECTION_TO_TARGET_LOST, ID_NAT_ALREADY_IN_PROGRESS, or ID_NAT_PUNCHTHROUGH_FAILED on failures of various types However, if you lose connection to the facilitator, you may not necessarily get above

void SLNet::NatPunchthroughClient::PushFailure | ( | void |  | ) |

protected

void SLNet::NatPunchthroughClient::PushSuccess | ( | void |  | ) |

protected

void SLNet::NatPunchthroughClient::QueueOpenNAT | ( | RakNetGUID | destination,
|  | const SystemAddress & | facilitator
| ) |  |

protected

bool SLNet::NatPunchthroughClient::RemoveFromFailureQueue | ( | void |  | ) |

protected

void SLNet::NatPunchthroughClient::SendOutOfBand | ( | SystemAddress | sa,
|  | MessageID | oobId
| ) |  |

protected

void SLNet::NatPunchthroughClient::SendPunchthrough | ( | RakNetGUID | destination,
|  | const SystemAddress & | facilitator
| ) |  |

protected

void SLNet::NatPunchthroughClient::SendQueuedOpenNAT | ( | void |  | ) |

protected

void SLNet::NatPunchthroughClient::SendTTL | ( | const SystemAddress & | sa | ) |

protected

void SLNet::NatPunchthroughClient::SetDebugInterface | ( | NatPunchthroughDebugInterface * | i | ) |

Sets a callback to be called with debug messages

Parameters

  [in] | i | Pointer to an interface. The pointer is stored, so don't delete it while in progress. Pass 0 to clear.

virtual void SLNet::NatPunchthroughClient::Update | ( | void |  | ) |

virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

#### Member Data Documentation

DataStructures::List<AddrAndGuid> SLNet::NatPunchthroughClient::failedAttemptList

protected

Definition at line 265 of file NatPunchthroughClient.h.

enum { ... } SLNet::NatPunchthroughClient::hasPortStride

unsigned short SLNet::NatPunchthroughClient::mostRecentExternalPort

protected

Definition at line 237 of file NatPunchthroughClient.h.

NatPunchthroughDebugInterface* SLNet::NatPunchthroughClient::natPunchthroughDebugInterface

protected

Definition at line 256 of file NatPunchthroughClient.h.

PunchthroughConfiguration SLNet::NatPunchthroughClient::pc

protected

Definition at line 255 of file NatPunchthroughClient.h.

unsigned short SLNet::NatPunchthroughClient::portStride

protected

Definition at line 275 of file NatPunchthroughClient.h.

SLNet::Time SLNet::NatPunchthroughClient::portStrideCalTimeout

protected

Definition at line 283 of file NatPunchthroughClient.h.

DataStructures::Queue<DSTAndFac> SLNet::NatPunchthroughClient::queuedOpenNat

protected

Definition at line 272 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughClient::SendPing SLNet::NatPunchthroughClient::sp

struct SLNet::NatPunchthroughServerDebugInterface

Definition at line 50 of file NatPunchthroughServer.h.

Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface:

### Public Member Functions

| NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()
virtual void | OnServerMessage (const char *msg)=0

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughServerDebugInterface::NatPunchthroughServerDebugInterface | ( |  | ) |

inline

Definition at line 52 of file NatPunchthroughServer.h.

virtual SLNet::NatPunchthroughServerDebugInterface::~NatPunchthroughServerDebugInterface | ( |  | ) |

inlinevirtual

Definition at line 53 of file NatPunchthroughServer.h.

#### Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface::OnServerMessage | ( | const char * | msg | ) |

pure virtual

Implemented in SLNet::NatPunchthroughServerDebugInterface_PacketLogger, and SLNet::NatPunchthroughServerDebugInterface_Printf.

struct SLNet::NatPunchthroughServerDebugInterface_Printf

Definition at line 58 of file NatPunchthroughServer.h.

Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface_Printf:

### Public Member Functions

virtual void | OnServerMessage (const char *msg)
Public Member Functions inherited from SLNet::NatPunchthroughServerDebugInterface
| NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()

#### Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface_Printf::OnServerMessage | ( | const char * | msg | ) |

virtual

Implements SLNet::NatPunchthroughServerDebugInterface.

struct SLNet::NatPunchthroughServerDebugInterface_PacketLogger

Definition at line 65 of file NatPunchthroughServer.h.

Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface_PacketLogger:

### Public Member Functions

| NatPunchthroughServerDebugInterface_PacketLogger ()
| ~NatPunchthroughServerDebugInterface_PacketLogger ()
virtual void | OnServerMessage (const char *msg)
Public Member Functions inherited from SLNet::NatPunchthroughServerDebugInterface
| NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()

### Public Attributes

PacketLogger * | pl

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughServerDebugInterface_PacketLogger::NatPunchthroughServerDebugInterface_PacketLogger | ( |  | ) |

inline

Definition at line 70 of file NatPunchthroughServer.h.

SLNet::NatPunchthroughServerDebugInterface_PacketLogger::~NatPunchthroughServerDebugInterface_PacketLogger | ( |  | ) |

inline

Definition at line 71 of file NatPunchthroughServer.h.

#### Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface_PacketLogger::OnServerMessage | ( | const char * | msg | ) |

virtual

Implements SLNet::NatPunchthroughServerDebugInterface.

#### Member Data Documentation

PacketLogger* SLNet::NatPunchthroughServerDebugInterface_PacketLogger::pl

Definition at line 68 of file NatPunchthroughServer.h.

class SLNet::NatPunchthroughServer

Server code for NATPunchthrough.

Maintain connection to NatPunchthroughServer to process incoming connection attempts through NatPunchthroughClient
Server maintains two sockets clients can connect to so as to estimate the next port choice
Server tells other client about port estimate, current public port to the server, and a time to start connection attempts

See Also
  NatTypeDetectionClient See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

Definition at line 83 of file NatPunchthroughServer.h.

Inheritance diagram for SLNet::NatPunchthroughServer:

### Public Member Functions

| NatPunchthroughServer ()
virtual | ~NatPunchthroughServer ()
void | SetDebugInterface (NatPunchthroughServerDebugInterface *i)
virtual void | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
Public Member Functions inherited from SLNet::PluginInterface2
| PluginInterface2 ()
virtual | ~PluginInterface2 ()
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 | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
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, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Static Public Member Functions

static int | NatPunchthroughUserComp (const RakNetGUID &key, User *const &data)

### Public Attributes

SLNet::Time | lastUpdate

### Protected Member Functions

void | OnNATPunchthroughRequest (Packet *packet)
void | OnGetMostRecentPort (Packet *packet)
void | OnClientReady (Packet *packet)
void | SendTimestamps (void)
void | StartPendingPunchthrough (void)
void | StartPunchthroughForUser (User *user)
Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

### Protected Attributes

DataStructures::OrderedList < RakNetGUID, User *, NatPunchthroughServer::NatPunchthroughUserComp > | users
uint16_t | sessionId
NatPunchthroughServerDebugInterface * | natPunchthroughServerDebugInterface
SystemAddress | boundAddresses [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
unsigned char | boundAddressCount
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughServer::NatPunchthroughServer | ( |  | ) |

virtual SLNet::NatPunchthroughServer::~NatPunchthroughServer | ( |  | ) |

virtual

#### Member Function Documentation

static int SLNet::NatPunchthroughServer::NatPunchthroughUserComp | ( | const RakNetGUID & | key,
|  | User *const & | data
| ) |  |

static

void SLNet::NatPunchthroughServer::OnClientReady | ( | Packet * | packet | ) |

protected

virtual void SLNet::NatPunchthroughServer::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

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 SLNet::PluginInterface2.

void SLNet::NatPunchthroughServer::OnGetMostRecentPort | ( | Packet * | packet | ) |

protected

void SLNet::NatPunchthroughServer::OnNATPunchthroughRequest | ( | Packet * | packet | ) |

protected

virtual void SLNet::NatPunchthroughServer::OnNewConnection | ( | const 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 SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::NatPunchthroughServer::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

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughServer::SendTimestamps | ( | void |  | ) |

protected

void SLNet::NatPunchthroughServer::SetDebugInterface | ( | NatPunchthroughServerDebugInterface * | i | ) |

Sets a callback to be called with debug messages

Parameters

  [in] | i | Pointer to an interface. The pointer is stored, so don't delete it while in progress. Pass 0 to clear.

void SLNet::NatPunchthroughServer::StartPendingPunchthrough | ( | void |  | ) |

protected

void SLNet::NatPunchthroughServer::StartPunchthroughForUser | ( | User * | user | ) |

protected

virtual void SLNet::NatPunchthroughServer::Update | ( | void |  | ) |

virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

#### Member Data Documentation

unsigned char SLNet::NatPunchthroughServer::boundAddressCount

protected

Definition at line 153 of file NatPunchthroughServer.h.

SystemAddress SLNet::NatPunchthroughServer::boundAddresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]

protected

Definition at line 152 of file NatPunchthroughServer.h.

SLNet::Time SLNet::NatPunchthroughServer::lastUpdate

Definition at line 137 of file NatPunchthroughServer.h.

NatPunchthroughServerDebugInterface* SLNet::NatPunchthroughServer::natPunchthroughServerDebugInterface

protected

Definition at line 150 of file NatPunchthroughServer.h.

uint16_t SLNet::NatPunchthroughServer::sessionId

protected

Definition at line 149 of file NatPunchthroughServer.h.

DataStructures::OrderedList<RakNetGUID, User*, NatPunchthroughServer::NatPunchthroughUserComp> SLNet::NatPunchthroughServer::users

protected

Definition at line 141 of file NatPunchthroughServer.h.

class SLNet::UDPForwarder

Forwards UDP datagrams. Independent of RakNet's protocol.

Definition at line 56 of file UDPForwarder.h.

### Public Member Functions

| UDPForwarder ()
virtual | ~UDPForwarder ()
void | Startup (void)
void | Shutdown (void)
| Stops the system, and frees all sockets.
void | SetMaxForwardEntries (unsigned short maxEntries)
int | GetMaxForwardEntries (void) const
int | GetUsedForwardEntries (void) const
UDPForwarderResult | StartForwarding (SystemAddress source, SystemAddress destination, SLNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily, unsigned short *forwardingPort, __UDPSOCKET__ *forwardingSocket)
void | StopForwarding (SystemAddress source, SystemAddress destination)

### Protected Member Functions

friend | RAK_THREAD_DECLARATION (UpdateUDPForwarderGlobal)
void | UpdateUDPForwarder (void)
void | RecvFrom (SLNet::TimeMS curTime, ForwardEntry *forwardEntry)

### Protected Attributes

DataStructures::ThreadsafeAllocatingQueue < StartForwardingInputStruct > | startForwardingInput
DataStructures::Queue < StartForwardingOutputStruct > | startForwardingOutput
SimpleMutex | startForwardingOutputMutex
DataStructures::ThreadsafeAllocatingQueue < StopForwardingStruct > | stopForwardingCommands
unsigned int | nextInputId
DataStructures::List < ForwardEntry * > | forwardListNotUpdated
unsigned short | maxForwardEntries
SLNet::LocklessUint32_t | isRunning
SLNet::LocklessUint32_t | threadRunning

#### Constructor & Destructor Documentation

SLNet::UDPForwarder::UDPForwarder | ( |  | ) |

virtual SLNet::UDPForwarder::~UDPForwarder | ( |  | ) |

virtual

#### Member Function Documentation

int SLNet::UDPForwarder::GetMaxForwardEntries | ( | void |  | ) | const

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

int SLNet::UDPForwarder::GetUsedForwardEntries | ( | void |  | ) | const

Returns
  How many entries have been used

SLNet::UDPForwarder::RAK_THREAD_DECLARATION | ( | UpdateUDPForwarderGlobal |  | ) |

protected

void SLNet::UDPForwarder::RecvFrom | ( | SLNet::TimeMS | curTime,
|  | ForwardEntry * | forwardEntry
| ) |  |

protected

void SLNet::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.

Parameters

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

void SLNet::UDPForwarder::Shutdown | ( | void |  | ) |

Stops the system, and frees all sockets.

UDPForwarderResult SLNet::UDPForwarder::StartForwarding | ( | SystemAddress | source,
|  | SystemAddress | destination,
|  | SLNet::TimeMS | timeoutOnNoDataMS,
|  | const char * | forceHostAddress,
|  | unsigned short | socketFamily,
|  | unsigned short * | forwardingPort,
|  | __UDPSOCKET__ * | forwardingSocket
| ) |  |

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] | 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.
  [in] | forceHostAddress | Force binding on a particular address. 0 to use any.
  [in] | socketFamily | IP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
  [out] | forwardingPort | New opened port for forwarding
  [out] | forwardingSocket | New opened socket for forwarding

Returns
  UDPForwarderResult

void SLNet::UDPForwarder::Startup | ( | void |  | ) |

Starts the system. Required to call before StartForwarding

void SLNet::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

void SLNet::UDPForwarder::UpdateUDPForwarder | ( | void |  | ) |

protected

#### Member Data Documentation

DataStructures::List<ForwardEntry*> SLNet::UDPForwarder::forwardListNotUpdated

protected

Definition at line 152 of file UDPForwarder.h.

SLNet::LocklessUint32_t SLNet::UDPForwarder::isRunning

protected

Definition at line 156 of file UDPForwarder.h.

unsigned short SLNet::UDPForwarder::maxForwardEntries

protected

Definition at line 155 of file UDPForwarder.h.

unsigned int SLNet::UDPForwarder::nextInputId

protected

Definition at line 149 of file UDPForwarder.h.

DataStructures::ThreadsafeAllocatingQueue<StartForwardingInputStruct> SLNet::UDPForwarder::startForwardingInput

protected

Definition at line 131 of file UDPForwarder.h.

DataStructures::Queue<StartForwardingOutputStruct> SLNet::UDPForwarder::startForwardingOutput

protected

Definition at line 140 of file UDPForwarder.h.

SimpleMutex SLNet::UDPForwarder::startForwardingOutputMutex

protected

Definition at line 141 of file UDPForwarder.h.

DataStructures::ThreadsafeAllocatingQueue<StopForwardingStruct> SLNet::UDPForwarder::stopForwardingCommands

protected

Definition at line 148 of file UDPForwarder.h.

SLNet::LocklessUint32_t SLNet::UDPForwarder::threadRunning

protected

Definition at line 156 of file UDPForwarder.h.

class SLNet::UDPProxyCoordinator

Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server.

When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin. The UDPProxyClient connects to UDPProxyCoordinator to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request

Definition at line 42 of file UDPProxyCoordinator.h.

Inheritance diagram for SLNet::UDPProxyCoordinator:

### Public Member Functions

| UDPProxyCoordinator ()
virtual | ~UDPProxyCoordinator ()
void | SetRemoteLoginPassword (SLNet::RakString password)
virtual void | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
Public Member Functions inherited from SLNet::PluginInterface2
| PluginInterface2 ()
virtual | ~PluginInterface2 ()
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 | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
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, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Protected Member Functions

void | OnForwardingRequestFromClientToCoordinator (Packet *packet)
void | OnLoginRequestFromServerToCoordinator (Packet *packet)
void | OnForwardingReplyFromServerToCoordinator (Packet *packet)
void | OnPingServersReplyFromClientToCoordinator (Packet *packet)
void | TryNextServer (SenderAndTargetAddress sata, ForwardingRequest *fw)
void | SendAllBusy (SystemAddress senderClientAddress, SystemAddress targetClientAddress, RakNetGUID targetClientGuid, SystemAddress requestingAddress)
void | Clear (void)
void | SendForwardingRequest (SystemAddress sourceAddress, SystemAddress targetAddress, SystemAddress serverAddress, SLNet::TimeMS timeoutOnNoDataMS)
Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

### Static Protected Member Functions

static int | ServerWithPingComp (const unsigned short &key, const UDPProxyCoordinator::ServerWithPing &data)
static int | ForwardingRequestComp (const SenderAndTargetAddress &key, ForwardingRequest *const &data)

### Protected Attributes

DataStructures::List < SystemAddress > | serverList
DataStructures::OrderedList < SenderAndTargetAddress, ForwardingRequest *, ForwardingRequestComp > | forwardingRequestList
SLNet::RakString | remoteLoginPassword
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

#### Constructor & Destructor Documentation

SLNet::UDPProxyCoordinator::UDPProxyCoordinator | ( |  | ) |

virtual SLNet::UDPProxyCoordinator::~UDPProxyCoordinator | ( |  | ) |

virtual

#### Member Function Documentation

void SLNet::UDPProxyCoordinator::Clear | ( | void |  | ) |

protected

static int SLNet::UDPProxyCoordinator::ForwardingRequestComp | ( | const SenderAndTargetAddress & | key,
|  | ForwardingRequest *const & | data
| ) |  |

staticprotected

virtual void SLNet::UDPProxyCoordinator::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

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 SLNet::PluginInterface2.

void SLNet::UDPProxyCoordinator::OnForwardingReplyFromServerToCoordinator | ( | Packet * | packet | ) |

protected

void SLNet::UDPProxyCoordinator::OnForwardingRequestFromClientToCoordinator | ( | Packet * | packet | ) |

protected

void SLNet::UDPProxyCoordinator::OnLoginRequestFromServerToCoordinator | ( | Packet * | packet | ) |

protected

void SLNet::UDPProxyCoordinator::OnPingServersReplyFromClientToCoordinator | ( | Packet * | packet | ) |

protected

virtual PluginReceiveResult SLNet::UDPProxyCoordinator::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

Reimplemented from SLNet::PluginInterface2.

void SLNet::UDPProxyCoordinator::SendAllBusy | ( | SystemAddress | senderClientAddress,
|  | SystemAddress | targetClientAddress,
|  | RakNetGUID | targetClientGuid,
|  | SystemAddress | requestingAddress
| ) |  |

protected

void SLNet::UDPProxyCoordinator::SendForwardingRequest | ( | SystemAddress | sourceAddress,
|  | SystemAddress | targetAddress,
|  | SystemAddress | serverAddress,
|  | SLNet::TimeMS | timeoutOnNoDataMS
| ) |  |

protected

static int SLNet::UDPProxyCoordinator::ServerWithPingComp | ( | const unsigned short & | key,
|  | const UDPProxyCoordinator::ServerWithPing & | data
| ) |  |

staticprotected

void SLNet::UDPProxyCoordinator::SetRemoteLoginPassword | ( | SLNet::RakString | password | ) |

For UDPProxyServers logging in remotely, they must pass a password to UDPProxyServer::LoginToCoordinator(). It must match the password set here. If no password is set, they cannot login remotely. By default, no password is set

void SLNet::UDPProxyCoordinator::TryNextServer | ( | SenderAndTargetAddress | sata,
|  | ForwardingRequest * | fw
| ) |  |

protected

virtual void SLNet::UDPProxyCoordinator::Update | ( | void |  | ) |

virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

#### Member Data Documentation

DataStructures::OrderedList<SenderAndTargetAddress, ForwardingRequest*, ForwardingRequestComp> SLNet::UDPProxyCoordinator::forwardingRequestList

protected

Definition at line 112 of file UDPProxyCoordinator.h.

SLNet::RakString SLNet::UDPProxyCoordinator::remoteLoginPassword

protected

Definition at line 114 of file UDPProxyCoordinator.h.

DataStructures::List<SystemAddress> SLNet::UDPProxyCoordinator::serverList

protected

Definition at line 108 of file UDPProxyCoordinator.h.

struct SLNet::NatPunchthroughClient::AddrAndGuid

Definition at line 260 of file NatPunchthroughClient.h.

Class Members
SystemAddress | addr |
RakNetGUID | guid |

struct SLNet::NatPunchthroughClient::DSTAndFac

Definition at line 267 of file NatPunchthroughClient.h.

Class Members
RakNetGUID | destination |
SystemAddress | facilitator |

struct SLNet::NatPunchthroughClient::SendPing

Definition at line 203 of file NatPunchthroughClient.h.

### Public Types

enum | TestMode { TESTING_INTERNAL_IPS, WAITING_FOR_INTERNAL_IPS_RESPONSE, TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT, TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT, TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024, TESTING_EXTERNAL_IPS_1024_TO_1024, WAITING_AFTER_ALL_ATTEMPTS, PUNCHING_FIXED_PORT }

### Public Attributes

SLNet::Time | nextActionTime
SystemAddress | targetAddress
SystemAddress | facilitator
SystemAddress | internalIds [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
RakNetGUID | targetGuid
bool | weAreSender
int | attemptCount
int | retryCount
int | punchingFixedPortAttempts
uint16_t | sessionId
bool | sentTTL
enum SLNet::NatPunchthroughClient::SendPing::TestMode | testMode

#### Member Enumeration Documentation

enum SLNet::NatPunchthroughClient::SendPing::TestMode

Enumerator:

  TESTING_INTERNAL_IPS |
  WAITING_FOR_INTERNAL_IPS_RESPONSE |
  TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT |
  TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT |
  TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024 |
  TESTING_EXTERNAL_IPS_1024_TO_1024 |
  WAITING_AFTER_ALL_ATTEMPTS |
  PUNCHING_FIXED_PORT |

Definition at line 217 of file NatPunchthroughClient.h.

#### Member Data Documentation

int SLNet::NatPunchthroughClient::SendPing::attemptCount

Definition at line 211 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::facilitator

Definition at line 207 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::internalIds[MAXIMUM_NUMBER_OF_INTERNAL_IDS]

Definition at line 208 of file NatPunchthroughClient.h.

SLNet::Time SLNet::NatPunchthroughClient::SendPing::nextActionTime

Definition at line 205 of file NatPunchthroughClient.h.

int SLNet::NatPunchthroughClient::SendPing::punchingFixedPortAttempts

Definition at line 213 of file NatPunchthroughClient.h.

int SLNet::NatPunchthroughClient::SendPing::retryCount

Definition at line 212 of file NatPunchthroughClient.h.

bool SLNet::NatPunchthroughClient::SendPing::sentTTL

Definition at line 215 of file NatPunchthroughClient.h.

uint16_t SLNet::NatPunchthroughClient::SendPing::sessionId

Definition at line 214 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::targetAddress

Definition at line 206 of file NatPunchthroughClient.h.

RakNetGUID SLNet::NatPunchthroughClient::SendPing::targetGuid

Definition at line 209 of file NatPunchthroughClient.h.

enum SLNet::NatPunchthroughClient::SendPing::TestMode SLNet::NatPunchthroughClient::SendPing::testMode

bool SLNet::NatPunchthroughClient::SendPing::weAreSender

Definition at line 210 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughServer::ConnectionAttempt

Definition at line 111 of file NatPunchthroughServer.h.

### Public Types

enum | { NAT_ATTEMPT_PHASE_NOT_STARTED, NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS }

### Public Member Functions

| ConnectionAttempt ()

### Public Attributes

User * | sender
User * | recipient
uint16_t | sessionId
SLNet::Time | startTime
enum SLNet::NatPunchthroughServer::ConnectionAttempt:: { ... } | attemptPhase

#### Member Enumeration Documentation

anonymous enum

Enumerator:

  NAT_ATTEMPT_PHASE_NOT_STARTED |
  NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS |

Definition at line 117 of file NatPunchthroughServer.h.

#### Constructor & Destructor Documentation

SLNet::NatPunchthroughServer::ConnectionAttempt::ConnectionAttempt | ( |  | ) |

inline

Definition at line 113 of file NatPunchthroughServer.h.

#### Member Data Documentation

enum { ... } SLNet::NatPunchthroughServer::ConnectionAttempt::attemptPhase

User * SLNet::NatPunchthroughServer::ConnectionAttempt::recipient

Definition at line 114 of file NatPunchthroughServer.h.

User* SLNet::NatPunchthroughServer::ConnectionAttempt::sender

Definition at line 114 of file NatPunchthroughServer.h.

uint16_t SLNet::NatPunchthroughServer::ConnectionAttempt::sessionId

Definition at line 115 of file NatPunchthroughServer.h.

SLNet::Time SLNet::NatPunchthroughServer::ConnectionAttempt::startTime

Definition at line 116 of file NatPunchthroughServer.h.

struct SLNet::NatPunchthroughServer::User

Definition at line 123 of file NatPunchthroughServer.h.

### Public Member Functions

bool | HasConnectionAttemptToUser (User *user)
void | DerefConnectionAttempt (ConnectionAttempt *ca)
void | DeleteConnectionAttempt (ConnectionAttempt *ca)
void | LogConnectionAttempts (SLNet::RakString &rs)

### Public Attributes

RakNetGUID | guid
SystemAddress | systemAddress
unsigned short | mostRecentPort
bool | isReady
DataStructures::OrderedList < RakNetGUID, RakNetGUID > | groupPunchthroughRequests
DataStructures::List < ConnectionAttempt * > | connectionAttempts

#### Member Function Documentation

void SLNet::NatPunchthroughServer::User::DeleteConnectionAttempt | ( | ConnectionAttempt * | ca | ) |

void SLNet::NatPunchthroughServer::User::DerefConnectionAttempt | ( | ConnectionAttempt * | ca | ) |

bool SLNet::NatPunchthroughServer::User::HasConnectionAttemptToUser | ( | User * | user | ) |

void SLNet::NatPunchthroughServer::User::LogConnectionAttempts | ( | SLNet::RakString & | rs | ) |

#### Member Data Documentation

DataStructures::List<ConnectionAttempt *> SLNet::NatPunchthroughServer::User::connectionAttempts

Definition at line 131 of file NatPunchthroughServer.h.

DataStructures::OrderedList<RakNetGUID,RakNetGUID> SLNet::NatPunchthroughServer::User::groupPunchthroughRequests

Definition at line 129 of file NatPunchthroughServer.h.

RakNetGUID SLNet::NatPunchthroughServer::User::guid

Definition at line 125 of file NatPunchthroughServer.h.

bool SLNet::NatPunchthroughServer::User::isReady

Definition at line 128 of file NatPunchthroughServer.h.

unsigned short SLNet::NatPunchthroughServer::User::mostRecentPort

Definition at line 127 of file NatPunchthroughServer.h.

SystemAddress SLNet::NatPunchthroughServer::User::systemAddress

Definition at line 126 of file NatPunchthroughServer.h.

struct SLNet::UDPForwarder::ForwardEntry

Definition at line 103 of file UDPForwarder.h.

### Public Member Functions

| ForwardEntry ()
| ~ForwardEntry ()

### Public Attributes

SystemAddress | addr1Unconfirmed
SystemAddress | addr2Unconfirmed
SystemAddress | addr1Confirmed
SystemAddress | addr2Confirmed
SLNet::TimeMS | timeLastDatagramForwarded
__UDPSOCKET__ | socket
SLNet::TimeMS | timeoutOnNoDataMS
short | socketFamily

#### Constructor & Destructor Documentation

SLNet::UDPForwarder::ForwardEntry::ForwardEntry | ( |  | ) |

SLNet::UDPForwarder::ForwardEntry::~ForwardEntry | ( |  | ) |

#### Member Data Documentation

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr1Confirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr1Unconfirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr2Confirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr2Unconfirmed

Definition at line 107 of file UDPForwarder.h.

__UDPSOCKET__ SLNet::UDPForwarder::ForwardEntry::socket

Definition at line 109 of file UDPForwarder.h.

short SLNet::UDPForwarder::ForwardEntry::socketFamily

Definition at line 111 of file UDPForwarder.h.

SLNet::TimeMS SLNet::UDPForwarder::ForwardEntry::timeLastDatagramForwarded

Definition at line 108 of file UDPForwarder.h.

SLNet::TimeMS SLNet::UDPForwarder::ForwardEntry::timeoutOnNoDataMS

Definition at line 110 of file UDPForwarder.h.

struct SLNet::UDPForwarder::StartForwardingInputStruct

Definition at line 121 of file UDPForwarder.h.

Class Members
SystemAddress | destination |
RakString | forceHostAddress |
unsigned int | inputId |
unsigned short | socketFamily |
SystemAddress | source |
TimeMS | timeoutOnNoDataMS |

struct SLNet::UDPForwarder::StartForwardingOutputStruct

Definition at line 133 of file UDPForwarder.h.

Class Members
unsigned short | forwardingPort |
__UDPSOCKET__ | forwardingSocket |
unsigned int | inputId |
UDPForwarderResult | result |

struct SLNet::UDPForwarder::StopForwardingStruct

Definition at line 143 of file UDPForwarder.h.

Class Members
SystemAddress | destination |
SystemAddress | source |

struct SLNet::UDPProxyCoordinator::ForwardingRequest

Definition at line 75 of file UDPProxyCoordinator.h.

### Public Member Functions

void | OrderRemainingServersToTry (void)

### Public Attributes

SLNet::TimeMS | timeoutOnNoDataMS
SLNet::TimeMS | timeoutAfterSuccess
SenderAndTargetAddress | sata
SystemAddress | requestingAddress
SystemAddress | currentlyAttemptedServerAddress
DataStructures::Queue < SystemAddress > | remainingServersToTry
SLNet::BitStream | serverSelectionBitstream
DataStructures::List < ServerWithPing > | sourceServerPings
DataStructures::List < ServerWithPing > | targetServerPings
SLNet::TimeMS | timeRequestedPings

#### Member Function Documentation

void SLNet::UDPProxyCoordinator::ForwardingRequest::OrderRemainingServersToTry | ( | void |  | ) |

#### Member Data Documentation

SystemAddress SLNet::UDPProxyCoordinator::ForwardingRequest::currentlyAttemptedServerAddress

Definition at line 81 of file UDPProxyCoordinator.h.

DataStructures::Queue<SystemAddress> SLNet::UDPProxyCoordinator::ForwardingRequest::remainingServersToTry

Definition at line 82 of file UDPProxyCoordinator.h.

SystemAddress SLNet::UDPProxyCoordinator::ForwardingRequest::requestingAddress

Definition at line 80 of file UDPProxyCoordinator.h.

SenderAndTargetAddress SLNet::UDPProxyCoordinator::ForwardingRequest::sata

Definition at line 79 of file UDPProxyCoordinator.h.

SLNet::BitStream SLNet::UDPProxyCoordinator::ForwardingRequest::serverSelectionBitstream

Definition at line 83 of file UDPProxyCoordinator.h.

DataStructures::List<ServerWithPing> SLNet::UDPProxyCoordinator::ForwardingRequest::sourceServerPings

Definition at line 85 of file UDPProxyCoordinator.h.

DataStructures::List<ServerWithPing> SLNet::UDPProxyCoordinator::ForwardingRequest::targetServerPings

Definition at line 85 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeoutAfterSuccess

Definition at line 78 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeoutOnNoDataMS

Definition at line 77 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeRequestedPings

Definition at line 86 of file UDPProxyCoordinator.h.

struct SLNet::UDPProxyCoordinator::SenderAndTargetAddress

Definition at line 61 of file UDPProxyCoordinator.h.

Class Members
SystemAddress | senderClientAddress |
RakNetGUID | senderClientGuid |
SystemAddress | targetClientAddress |
RakNetGUID | targetClientGuid |

struct SLNet::UDPProxyCoordinator::ServerWithPing

Definition at line 69 of file UDPProxyCoordinator.h.

Class Members
unsigned short | ping |
SystemAddress | serverAddress |