Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL: TNL Namespace Reference

# TNL Namespace Reference

## Detailed Description

Global namespace for all TNL classes.

## Data Structures

class | Assert
| Assert functions for validating proper program state. More...
class | AsymmetricKey
class | BitSet32
| Represents a word of bits. More...
struct | Point3F
| Point3F is used by BitStream for transmitting 3D points and vectors. More...
class | BitStream
| BitStream provides a bit-level stream interface to a data buffer. More...
class | PacketStream
| PacketStream provides a network interface to the BitStream for easy construction of data packets. More...
class | ByteBuffer
class | Certificate
| The Certificate class manages a digitally signed certificate. More...
class | ClientPuzzleManager
| The ClientPuzzleManager class issues, solves and validates client puzzles for connection authentication. More...
class | ConnectionStringTable
| ConnectionStringTable is a helper class to EventConnection for reducing duplicated string data sends. More...
class | DataChunker
| Implements a chunked data allocater. More...
class | ClassChunker
| Templatized data chunker class with proper construction and destruction of its elements. More...
class | EventConnection
| EventConnection is a NetConnection subclass used for sending guaranteed and unguaranteed event packages across a connection. More...
class | GhostConnection
| GhostConnection is a subclass of EventConnection that manages the transmission (ghosting) and updating of NetObjects over a connection. More...
struct | GhostInfo
| Each GhostInfo structure tracks the state of a single NetObject's ghost for a single GhostConnection. More...
class | Journal
| The Journal class represents the recordable entry point(s) into program execution. More...
struct | JournalEntryRecord
class | JournalToken
class | JournalBlockTypeToken
class | LogConsumer
| LogConsumer is the base class for the message logging system in TNL. More...
struct | LogType
struct | LogTypeRef
struct | Functor
| Base class for FunctorDecl template classes. More...
struct | FunctorDecl
| FunctorDecl template class. More...
class | NetClassRep
| NetClassRep class instances represent each declared NetClass and are used to construct object instances. More...
class | NetClassRepInstance
| NetClassRepInstance - one of these templates is instantiated for each class that is declared via the IMPLEMENT_* macros below. More...
class | Object
| Base class for all NetObject, NetEvent, NetConnection and NetInterface instances. More...
class | RefObjectRef
| Base class for Object reference counting. More...
class | RefPtr
| Reference counted object template pointer class. More...
class | SafeObjectRef
| Base class for Object safe pointers. More...
class | SafePtr
| Safe object template pointer class. More...
struct | NetConnectionRep
| NetConnectionRep maintians a linked list of valid connection classes. More...
struct | ConnectionParameters
| All data associated with the negotiation of the connection. More...
class | NetConnection
| TNL network connection base class. More...
class | NetEvent
| An event to be sent over the network. More...
class | NetInterface
| NetInterface class. More...
class | NetObject
| Superclass for ghostable networked objects. More...
class | NetObjectRPCEvent
| Event class for handling RPC method invocations on NetObjects. More...
class | StringTableEntry
| The StringTableEntry class encapsulates an entry in the network StringTable. More...
struct | Nonce
class | RPCEvent
| Base class for RPC events. More...
struct | StringData
class | StringPtr
class | SymmetricCipher
| Class for symmetric encryption of data across a connection. More...
class | Semaphore
| Platform independent semaphore class. More...
class | Mutex
| Platform independent Mutual Exclusion implementation. More...
class | Thread
| Platform independent Thread class. More...
class | ThreadStorage
| Platform independent per-thread storage class. More...
class | ThreadQueue
| Managing object for a queue of worker threads that pass messages back and forth to the main thread. More...
struct | NetType
| NetType serves as a base class for all bit-compressed versions of the base types that can be transmitted using TNL's RPC mechanism. More...
struct | Int
| Unsigned integer bit-level RPC template wrapper. More...
struct | SignedInt
| Signed integer bit-level RPC template wrapper. More...
struct | Float
| Floating point 0. More...
struct | SignedFloat
| Floating point -1. More...
struct | RangedU32
| Unsigned ranged integer bit-level RPC template wrapper. More...
struct | Address
| Representation of a network address. More...
struct | IPAddress
| Packed representaion of an IPAddress. More...
class | Socket
| The Socket class encapsulates a platform's network socket. More...
struct | VectorRep
| VectorRep is an image of a Vector template object that is used for marshalling and unmarshalling Vectors across RPCs. More...
class | Vector
| A dynamic array template class. More...
struct | FunctorDecl< void(T::*)()>
struct | FunctorDecl< void(T::*)(A)>
struct | FunctorDecl< void(T::*)(A, B)>
struct | FunctorDecl< void(T::*)(A, B, C)>
struct | FunctorDecl< void(T::*)(A, B, C, D)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E, F)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E, F, G)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E, F, G, H)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E, F, G, H, I)>
struct | FunctorDecl< void(T::*)(A, B, C, D, E, F, G, H, I, J)>

## Namespaces

namespace | HuffmanStringProcessor
| HuffmanStringProcessor does Huffman coding on strings written into BitStream objects.

namespace | StringTable
| A global table for the hashing and tracking of network strings.

namespace | Platform
| Platform specific functionality is gathered here to enable easier porting.

namespace | Random
| The Random namespace is an interface to a cryptographically secure pseudo random number generator (PRNG).

## Typedefs

typedef RefPtr< AsymmetricKey > | AsymmetricKeyPtr
typedef RefPtr< ByteBuffer > | ByteBufferPtr
typedef const ByteBuffer & | ByteBufferRef
typedef U32 | StringTableEntryId
typedef const StringTableEntry & | StringTableEntryRef
typedef signed char | S8
| Compiler independent signed char (8bit integer).
typedef unsigned char | U8
| Compiler independent unsigned char (8bit integer).
typedef signed short | S16
| Compiler independent signed 16-bit short integer.
typedef unsigned short | U16
| Compiler independent unsigned 16-bit short integer.
typedef signed int | S32
| Compiler independent signed 32-bit integer.
typedef unsigned int | U32
| Compiler independent unsigned 32-bit integer.
typedef float | F32
| Compiler independent 32-bit float.
typedef double | F64
| Compiler independent 64-bit float.
typedef const IPAddress & | IPAddressRef
typedef int(QSORT_CALLBACK *) | qsort_compare_func (const void *, const void *)

## Enumerations

enum | NetClassType { NetClassTypeNone = -1, NetClassTypeObject = 0, NetClassTypeDataBlock, NetClassTypeEvent,
NetClassTypeCount
}
| NetClassTypes are used to define the ranges of individual class identifiers, in order to reduce the number of bits necessary to identify the class of an object across the network. More...
enum | NetClassGroup { NetClassGroupGame, NetClassGroupCommunity, NetClassGroupMaster, NetClassGroupUnused2,
NetClassGroupCount,
NetClassGroupInvalid = NetClassGroupCount
}
| NetClassGroups are used to define different service types for an application. More...
enum | NetClassMask { NetClassGroupGameMask = 1 << NetClassGroupGame, NetClassGroupCommunityMask = 1 << NetClassGroupCommunity, NetClassGroupMasterMask = 1 << NetClassGroupMaster, NetClassGroupAllMask = (1 << NetClassGroupCount) - 1
}
| Mask values used to indicate which NetClassGroup(s) a NetObject or NetEvent can be transmitted through. More...
enum | NetObjectRPCDirection { RPCToGhost = 1, RPCToGhostParent = 2 }
| Direction that a NetObject RPC method call should travel. More...
enum | RPCDirection { RPCDirAny = NetEvent::DirAny, RPCDirServerToClient = NetEvent::DirServerToClient, RPCDirClientToServer = NetEvent::DirClientToServer }
| Enumeration for valid directions that RPC messages can travel. More...
enum | RPCGuaranteeType { RPCGuaranteedOrdered = NetEvent::GuaranteedOrdered, RPCGuaranteed = NetEvent::Guaranteed, RPCUnguaranteed = NetEvent::Unguaranteed }
| Type of data guarantee this RPC should use. More...
enum | TransportProtocol { IPProtocol, TCPProtocol, IPXProtocol, IPv6Protocol
}
| Enumeration for transport protocols for the TNL. More...
enum | Constants { MaxPacketDataSize = 1500 }
| Packet level network constants. More...
enum | NetError { NoError, InvalidPacketProtocol, WouldBlock, UnknownError
}
| Error conditions that can be returned by sendto and recvfrom. More...

## Functions

const char * | avar (const char *in_msg,...)
| sprintf style string formating into a fixed temporary buffer.
U8 | endianSwap (const U8 in_swap)
S8 | endianSwap (const S8 in_swap)
U16 | endianSwap (const U16 in_swap)
| Convert the byte ordering on the U16 to and from big/little endian format.
S16 | endianSwap (const S16 in_swap)
U32 | endianSwap (const U32 in_swap)
| Convert the byte ordering on the U32 to and from big/little endian format.
S32 | endianSwap (const S32 in_swap)
U64 | endianSwap (const U64 in_swap)
S64 | endianSwap (const S64 in_swap)
F32 | endianSwap (const F32 in_swap)
F64 | endianSwap (const F64 in_swap)
void | logprintf (const char *format,...)
| Global interface to the TNL logging system.
bool | atob (const char *str)
| String to boolean conversion.
int | dSprintf (char *buffer, U32 bufferSize, const char *format,...)
| Printf into string with a buffer size.
int | dVsprintf (char *buffer, U32 bufferSize, const char *format, void *arglist)
| Vsprintf with buffer size argument. compiler independent.
char | dToupper (const char c)
| Converts an ASCII character to upper case.
char | dTolower (const char c)
| Converts an ASCII character to lower case.
template<class T>
T * | constructInPlace (T *p)
| Constructs an object that already has memory allocated for it.
template<class T>
T * | constructInPlace (T *p, const T *copy)
| Copy constructs an object that already has memory allocated for it.
template<class T>
void | destructInPlace (T *p)
| Destructs an object without freeing the memory associated with it.
| DeclareTemplatizedMinMax (U32) DeclareTemplatizedMinMax(S32) DeclareTemplatizedMinMax(U16) DeclareTemplatizedMinMax(S16) DeclareTemplatizedMinMax(U8) DeclareTemplatizedMinMax(S8) DeclareTemplatizedMinMax(F32) DeclareTemplatizedMinMax(F64) inline void writeU32ToBuffer(U32 value
GeneralMath Math Helpers
Some general numeric utility functions.
bool | isPow2 (const U32 number)
| Determines if number is a power of two.
U32 | getBinLog2 (U32 value)
| Determines the binary logarithm of the input value rounded down to the nearest power of 2.
U32 | getNextBinLog2 (U32 number)
| Determines the binary logarithm of the next greater power of two of the input number.
U32 | getNextPow2 (U32 value)
| Determines the next greater power of two from the value. If the value is a power of two, it is returned.

## Variables

static const U32 | MinimumPaddingBits = 128
| Padding space that is required at the end of each packet for bit flag writes and such.
static const F32 | FloatOne = F32(1.0)
| Constant float 1.0.
static const F32 | FloatHalf = F32(0.5)
| Constant float 0.5.
static const F32 | FloatZero = F32(0.0)
| Constant float 0.0.
static const F32 | FloatPi = F32(3.14159265358979323846)
| Constant float PI.
static const F32 | Float2Pi = F32(2.0 * 3.14159265358979323846)
| Constant float 2*PI.
static const F32 | FloatInversePi = F32(1.0 / 3.14159265358979323846)
| Constant float 1 / PI.
static const F32 | FloatHalfPi = F32(0.5 * 3.14159265358979323846)
| Constant float 1/2 * PI.
static const F32 | Float2InversePi = F32(2.0 / 3.14159265358979323846)
| Constant float 2 / PI.
static const F32 | FloatInverse2Pi = F32(0.5 / 3.14159265358979323846)
| Constant float 2 / PI.
static const F32 | FloatSqrt2 = F32(1.41421356237309504880f)
| Constant float sqrt(2).
static const F32 | FloatSqrtHalf = F32(0.7071067811865475244008443f)
| Constant float sqrt(0.5).
static const S8 | S8_MIN = S8(-128)
| Constant Min Limit S8.
static const S8 | S8_MAX = S8(127)
| Constant Max Limit S8.
static const U8 | U8_MAX = U8(255)
| Constant Max Limit U8.
static const S16 | S16_MIN = S16(-32768)
| Constant Min Limit S16.
static const S16 | S16_MAX = S16(32767)
| Constant Max Limit S16.
static const U16 | U16_MAX = U16(65535)
| Constant Max Limit U16.
static const S32 | S32_MIN = S32(-2147483647 - 1)
| Constant Min Limit S32.
static const S32 | S32_MAX = S32(2147483647)
| Constant Max Limit S32.
static const U32 | U32_MAX = U32(0xffffffff)
| Constant Max Limit U32.
static const F32 | F32_MIN = F32(1.175494351e-38F)
| Constant Min Limit F32.
static const F32 | F32_MAX = F32(3.402823466e+38F)
| Constant Max Limit F32.

## Typedef Documentation

typedef RefPtr<AsymmetricKey> TNL::AsymmetricKeyPtr

typedef RefPtr<ByteBuffer> TNL::ByteBufferPtr

typedef const ByteBuffer& TNL::ByteBufferRef

typedef U32 TNL::StringTableEntryId

typedef const StringTableEntry& TNL::StringTableEntryRef

typedef const IPAddress& TNL::IPAddressRef

typedef int(QSORT_CALLBACK *) TNL::qsort_compare_func(const void *, const void *)

## Enumeration Type Documentation

enum TNL::NetClassType

NetClassTypes are used to define the ranges of individual class identifiers, in order to reduce the number of bits necessary to identify the class of an object across the network.

For example, if there are only 21 classes declared of NetClassTypeObject, the class identifier only needs to be sent using 5 bits.

Enumerator:

  NetClassTypeNone | Not an id'able network class.
  NetClassTypeObject | Game object classes.
  NetClassTypeDataBlock | Data block classes.
  NetClassTypeEvent | Event classes.
  NetClassTypeCount |

enum TNL::NetClassGroup

NetClassGroups are used to define different service types for an application.

Each network-related class can be marked as valid across one or more NetClassGroups. Each network connection belongs to a particular group, and can only transmit objects that are valid in that group.

Enumerator:

  NetClassGroupGame | Group for game related network classes.
  NetClassGroupCommunity | Group for community server/authentication classes.
  NetClassGroupMaster | Group for simple master server.
  NetClassGroupUnused2 | Reserved group.
  NetClassGroupCount |
  NetClassGroupInvalid |

enum TNL::NetClassMask

Mask values used to indicate which NetClassGroup(s) a NetObject or NetEvent can be transmitted through.

Enumerator:

  NetClassGroupGameMask |
  NetClassGroupCommunityMask |
  NetClassGroupMasterMask |
  NetClassGroupAllMask |

enum TNL::NetObjectRPCDirection

Direction that a NetObject RPC method call should travel.

Enumerator:

  RPCToGhost |
  RPCToGhostParent |

enum TNL::RPCDirection

Enumeration for valid directions that RPC messages can travel.

Enumerator:

  RPCDirAny | This RPC can be sent from the server or the client.
  RPCDirServerToClient | This RPC can only be sent from the server to the client.
  RPCDirClientToServer | This RPC can only be sent from the client to the server.

enum TNL::RPCGuaranteeType

Type of data guarantee this RPC should use.

Enumerator:

  RPCGuaranteedOrdered | RPC event delivery is guaranteed and will be processed in the order it was sent relative to other ordered events and RPCs.
  RPCGuaranteed | RPC event delivery is guaranteed and will be processed in the order it was received.
  RPCUnguaranteed | Event delivery is not guaranteed - however, the event will remain ordered relative to other unguaranteed events.

enum TNL::TransportProtocol

Enumeration for transport protocols for the TNL.

Currently only IP and IPX are supported - the IPv6 constant is for future use.

Enumerator:

  IPProtocol | The standard Internet routing protocol.
  TCPProtocol | The standard Internet guaranteed delivery protocol.
  IPXProtocol | Novell's IPX protocol.
  IPv6Protocol | The next generation 128-bit address internet protocol (not currently supported by TNL).

enum TNL::Constants

Packet level network constants.

Enumerator:

  MaxPacketDataSize | The maximum size of a data packet sent through the Net::sendto and Net::recvfrom functions.

enum TNL::NetError

Error conditions that can be returned by sendto and recvfrom.

Enumerator:

  NoError | The operation succeeded without error.
  InvalidPacketProtocol | The program attempted to send a packet to an address using a socket that didn't support the protocol of the address.
  WouldBlock | The operation would have blocked, for example if there was no data to read.
  UnknownError | There was some other, unknown error.

## Function Documentation

const char* TNL::avar | ( | const char * | in_msg,
|  |  | ... |
| ) |  |  |

sprintf style string formating into a fixed temporary buffer.

Parameters:

  | in_msg | sprintf style format string

Returns:
  pointer to fixed buffer containing formatted string

Example:

       U8 a = 5;
       S16 b = -10;
       char *output = avar("hello %s! a=%u, b=%d", "world");
       ouput = "hello world! a=5, b=-10"

Warning:
  avar uses a static fixed buffer. Treat the buffer as volatile data and use it immediately. Other functions my use avar too and clobber the buffer.

U8 TNL::endianSwap | ( | const U8 | in_swap | ) | `[inline]`

S8 TNL::endianSwap | ( | const S8 | in_swap | ) | `[inline]`

U16 TNL::endianSwap | ( | const U16 | in_swap | ) | `[inline]`

Convert the byte ordering on the U16 to and from big/little endian format.

Parameters:

  | in_swap | Any U16

Returns:
  swapped U16.

S16 TNL::endianSwap | ( | const S16 | in_swap | ) | `[inline]`

U32 TNL::endianSwap | ( | const U32 | in_swap | ) | `[inline]`

Convert the byte ordering on the U32 to and from big/little endian format.

Parameters:

  | in_swap | Any U32

Returns:
  swapped U32.

S32 TNL::endianSwap | ( | const S32 | in_swap | ) | `[inline]`

U64 TNL::endianSwap | ( | const U64 | in_swap | ) | `[inline]`

S64 TNL::endianSwap | ( | const S64 | in_swap | ) | `[inline]`

F32 TNL::endianSwap | ( | const F32 | in_swap | ) | `[inline]`

F64 TNL::endianSwap | ( | const F64 | in_swap | ) | `[inline]`

void TNL::logprintf | ( | const char * | format,
|  |  | ... |
| ) |  |  |

Global interface to the TNL logging system.

The TNL logging system is consumer based. This is just a global stub that routes the log string to all the consumers.

You should really be using the TNLLogMessage() and TNLLogMessageV() macros instead of calling this.

See also:
  LogConsumer

bool TNL::atob | ( | const char * | str | ) |

String to boolean conversion.

int TNL::dSprintf | ( | char * | buffer,
|  | U32 | bufferSize,
|  | const char * | format,
|  |  | ... |
| ) |  |  |

Printf into string with a buffer size.

This will print into the specified string until the buffer size is reached.

int TNL::dVsprintf | ( | char * | buffer,
|  | U32 | bufferSize,
|  | const char * | format,
|  | void * | arglist |
| ) |  |  |

Vsprintf with buffer size argument. compiler independent.

This will print into the specified string until the buffer size is reached.

char TNL::dToupper | ( | const char | c | ) | `[inline]`

Converts an ASCII character to upper case.

char TNL::dTolower | ( | const char | c | ) | `[inline]`

Converts an ASCII character to lower case.

## Variable Documentation

const U32 TNL::MinimumPaddingBits = 128`[static]`

Padding space that is required at the end of each packet for bit flag writes and such.