Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Static Public Member Functions | Public Attributes
RakNet::SystemAddress Struct Reference

Network address for a system. More...

#include <RakNetTypes.h>

List of all members.

Public Member Functions

void CopyPort (const SystemAddress &right)
 Copy the port from another SystemAddress structure.
bool EqualsExcludingPort (const SystemAddress &right) const
 Returns if two system addresses have the same IP (port is not checked)
void FixForIPVersion (const SystemAddress &boundAddressToSocket)
bool FromString (const char *str, char portDelineator='|', int ipVersion=0)
bool FromStringExplicitPort (const char *str, unsigned short port, int ipVersion=0)
 Same as FromString(), but you explicitly set a port at the same time.
unsigned int GetIPPROTO (void) const
unsigned char GetIPVersion (void) const
unsigned short GetPort (void) const
 Returns the port in host order (this is what you normally use)
unsigned short GetPortNetworkOrder (void) const
bool IsLoopback (void) const
bool operator!= (const SystemAddress &right) const
bool operator< (const SystemAddress &right) const
SystemAddressoperator= (const SystemAddress &input)
bool operator== (const SystemAddress &right) const
bool operator> (const SystemAddress &right) const
void SetBinaryAddress (const char *str, char portDelineator=':')
 Old version, for crap platforms that don't support newer socket functions.
void SetPort (unsigned short s)
 Sets the port. The port value should be in host order (this is what you normally use)
void SetPortNetworkOrder (unsigned short s)
void SetToLoopback (void)
 Call SetToLoopback(), with whatever IP version is currently held. Defaults to IPV4.
void SetToLoopback (unsigned char ipVersion)
 SystemAddress (const char *str)
 SystemAddress ()
 Constructors.
 SystemAddress (const char *str, unsigned short port)
void ToString (bool writePort, char *dest, char portDelineator='|') const
const char * ToString (bool writePort=true, char portDelineator='|') const
void ToString_Old (bool writePort, char *dest, char portDelineator=':') const
 Old version, for crap platforms that don't support newer socket functions.

Static Public Member Functions

static int size (void)
static unsigned long ToInteger (const SystemAddress &sa)
 Hash the system address.

Public Attributes

union struct sockaddr_in addr4
 SystemAddress, with RAKNET_SUPPORT_IPV6 defined, holds both an sockaddr_in6 and a sockaddr_in.
 address
unsigned short debugPort
 This is not used internally, but holds a copy of the port held in the address union, so for debugging it's easier to check what port is being held.
SystemIndex systemIndex

Detailed Description

Corresponds to a network address
This is not necessarily a unique identifier. For example, if a system has both LAN and internet connections, the system may be identified by either one, depending on who is communicating
Therefore, you should not transmit the SystemAddress over the network and expect it to identify a system, or use it to connect to that system, except in the case where that system is not behind a NAT (such as with a dedciated server) Use RakNetGUID for a unique per-instance of RakPeer to identify systems

Definition at line 176 of file RakNetTypes.h.


Constructor & Destructor Documentation

RakNet::SystemAddress::SystemAddress ( )
RakNet::SystemAddress::SystemAddress ( const char *  str)
RakNet::SystemAddress::SystemAddress ( const char *  str,
unsigned short  port 
)

Member Function Documentation

void RakNet::SystemAddress::CopyPort ( const SystemAddress right)
bool RakNet::SystemAddress::EqualsExcludingPort ( const SystemAddress right) const
void RakNet::SystemAddress::FixForIPVersion ( const SystemAddress boundAddressToSocket)
bool RakNet::SystemAddress::FromString ( const char *  str,
char  portDelineator = '|',
int  ipVersion = 0 
)

Set the system address from a printable IP string, for example "192.0.2.1" or "2001:db8:63b3:1::3490" You can write the port as well, using the portDelineator, for example "192.0.2.1|1234"

Parameters:
[in]strA printable IP string, for example "192.0.2.1" or "2001:db8:63b3:1::3490". Pass 0 for str to set to UNASSIGNED_SYSTEM_ADDRESS
[in]portDelineatorif str contains a port, delineate the port with this character. portDelineator should not be '.', ':', '%', '-', '/', a number, or a-f
[in]ipVersionOnly used if str is a pre-defined address in the wrong format, such as 127.0.0.1 but you want ip version 6, so you can pass 6 here to do the conversion
Note:
The current port is unchanged if a port is not specified in str
Returns:
True on success, false on ipVersion does not match type of passed string
bool RakNet::SystemAddress::FromStringExplicitPort ( const char *  str,
unsigned short  port,
int  ipVersion = 0 
)
unsigned int RakNet::SystemAddress::GetIPPROTO ( void  ) const
unsigned char RakNet::SystemAddress::GetIPVersion ( void  ) const

Return the IP version, either IPV4 or IPV6

Returns:
Either 4 or 6

Referenced by RakNet::BitStream::Write().

unsigned short RakNet::SystemAddress::GetPort ( void  ) const
unsigned short RakNet::SystemAddress::GetPortNetworkOrder ( void  ) const
bool RakNet::SystemAddress::IsLoopback ( void  ) const
Returns:
If was set to 127.0.0.1 or ::1
bool RakNet::SystemAddress::operator!= ( const SystemAddress right) const
bool RakNet::SystemAddress::operator< ( const SystemAddress right) const
SystemAddress& RakNet::SystemAddress::operator= ( const SystemAddress input)
bool RakNet::SystemAddress::operator== ( const SystemAddress right) const
bool RakNet::SystemAddress::operator> ( const SystemAddress right) const
void RakNet::SystemAddress::SetBinaryAddress ( const char *  str,
char  portDelineator = ':' 
)
void RakNet::SystemAddress::SetPort ( unsigned short  s)
void RakNet::SystemAddress::SetPortNetworkOrder ( unsigned short  s)
void RakNet::SystemAddress::SetToLoopback ( void  )
void RakNet::SystemAddress::SetToLoopback ( unsigned char  ipVersion)

Call SetToLoopback() with a specific IP version

Parameters:
[in]ipVersionEither 4 for IPV4 or 6 for IPV6
static int RakNet::SystemAddress::size ( void  ) [static]
static unsigned long RakNet::SystemAddress::ToInteger ( const SystemAddress sa) [static]
const char* RakNet::SystemAddress::ToString ( bool  writePort = true,
char  portDelineator = '|' 
) const
void RakNet::SystemAddress::ToString ( bool  writePort,
char *  dest,
char  portDelineator = '|' 
) const
void RakNet::SystemAddress::ToString_Old ( bool  writePort,
char *  dest,
char  portDelineator = ':' 
) const

Member Data Documentation

union struct sockaddr_in RakNet::SystemAddress::addr4

Definition at line 196 of file RakNetTypes.h.

Definition at line 197 of file RakNetTypes.h.

Referenced by RakNet::BitStream::Read(), and RakNet::BitStream::Write().

Definition at line 200 of file RakNetTypes.h.

Referenced by RakNet::BitStream::Read().

Definition at line 283 of file RakNetTypes.h.


The documentation for this struct 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