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
PacketLogger
Plugins

Print out incoming messages to a target destination. More...

## Classes

class | SLNet::PacketConsoleLogger
| Packetlogger that logs to a remote command console. More...
class | SLNet::PacketFileLogger
| Packetlogger that outputs to a file. More...
class | SLNet::PacketLogger
| Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality. More...
class | SLNet::PacketOutputWindowLogger
| Packetlogger that outputs to the output window in the debugger. Windows only. More...
class | SLNet::ThreadsafePacketLogger
| Same as PacketLogger, but writes output in the user thread. More...

## Detailed Description

Print out incoming messages to a target destination.

## Class Documentation

class SLNet::PacketConsoleLogger

Packetlogger that logs to a remote command console.

Definition at line 35 of file PacketConsoleLogger.h.

Inheritance diagram for SLNet::PacketConsoleLogger:

### Public Member Functions

| PacketConsoleLogger ()
virtual void | SetLogCommandParser (LogCommandParser *lcp)
virtual void | WriteLog (const char *str)
| Override this to log strings to wherever. Log should be threadsafe.
Public Member Functions inherited from SLNet::PacketLogger
| PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
| Events on low level sends and receives. These functions may be called from different threads at the same time.
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)
virtual void | LogHeader (void)
| Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
| Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
| Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
| Log the direct sends and receives or not. Default true.
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 | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Protected Attributes

LogCommandParser * | logCommandParser
Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])

#### Constructor & Destructor Documentation

SLNet::PacketConsoleLogger::PacketConsoleLogger | ( |  | ) |

#### Member Function Documentation

virtual void SLNet::PacketConsoleLogger::SetLogCommandParser | ( | LogCommandParser * | lcp | ) |

virtual

virtual void SLNet::PacketConsoleLogger::WriteLog | ( | const char * | str | ) |

virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

#### Member Data Documentation

LogCommandParser* SLNet::PacketConsoleLogger::logCommandParser

protected

Definition at line 43 of file PacketConsoleLogger.h.

class SLNet::PacketFileLogger

Packetlogger that outputs to a file.

Definition at line 35 of file PacketFileLogger.h.

Inheritance diagram for SLNet::PacketFileLogger:

### Public Member Functions

| PacketFileLogger ()
virtual | ~PacketFileLogger ()
void | StartLog (const char *filenamePrefix)
virtual void | WriteLog (const char *str)
| Override this to log strings to wherever. Log should be threadsafe.
Public Member Functions inherited from SLNet::PacketLogger
| PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
| Events on low level sends and receives. These functions may be called from different threads at the same time.
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)
virtual void | LogHeader (void)
| Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
| Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
| Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
| Log the direct sends and receives or not. Default true.
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 | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Protected Attributes

FILE * | packetLogFile
Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])

#### Constructor & Destructor Documentation

SLNet::PacketFileLogger::PacketFileLogger | ( |  | ) |

virtual SLNet::PacketFileLogger::~PacketFileLogger | ( |  | ) |

virtual

#### Member Function Documentation

void SLNet::PacketFileLogger::StartLog | ( | const char * | filenamePrefix | ) |

virtual void SLNet::PacketFileLogger::WriteLog | ( | const char * | str | ) |

virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

#### Member Data Documentation

FILE* SLNet::PacketFileLogger::packetLogFile

protected

Definition at line 46 of file PacketFileLogger.h.

class SLNet::PacketLogger

Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality.

Definition at line 44 of file PacketLogger.h.

Inheritance diagram for SLNet::PacketLogger:

### Public Member Functions

| PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
| Events on low level sends and receives. These functions may be called from different threads at the same time.
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)
virtual void | LogHeader (void)
| Logs out a header for all the data.
virtual void | WriteLog (const char *str)
| Override this to log strings to wherever. Log should be threadsafe.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
| Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
| Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
| Log the direct sends and receives or not. Default true.
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 | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Static Public Member Functions

static const char * | BaseIDTOString (unsigned char Id)

### Protected Member Functions

virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
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

bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

#### Constructor & Destructor Documentation

SLNet::PacketLogger::PacketLogger | ( |  | ) |

virtual SLNet::PacketLogger::~PacketLogger | ( |  | ) |

virtual

#### Member Function Documentation

virtual void SLNet::PacketLogger::AddToLog | ( | const char * | str | ) |

protectedvirtual

Reimplemented in SLNet::ThreadsafePacketLogger.

static const char* SLNet::PacketLogger::BaseIDTOString | ( | unsigned char | Id | ) |

static

virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
|  | size_t | intoLength,
|  | const char * | dir,
|  | const char * | type,
|  | unsigned int | reliableMessageNumber,
|  | unsigned int | frame,
|  | unsigned char | id,
|  | const BitSize_t | bitLen,
|  | unsigned long long | time,
|  | const SystemAddress & | local,
|  | const SystemAddress & | remote,
|  | unsigned int | splitPacketId,
|  | unsigned int | splitPacketIndex,
|  | unsigned int | splitPacketCount,
|  | unsigned int | orderingIndex
| ) |  |

virtual

virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
|  | const char * | dir,
|  | const char * | type,
|  | unsigned int | reliableMessageNumber,
|  | unsigned int | frame,
|  | unsigned char | id,
|  | const BitSize_t | bitLen,
|  | unsigned long long | time,
|  | const SystemAddress & | local,
|  | const SystemAddress & | remote,
|  | unsigned int | splitPacketId,
|  | unsigned int | splitPacketIndex,
|  | unsigned int | splitPacketCount,
|  | unsigned int | orderingIndex
| ) |  |

virtual

virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
|  | size_t | intoLength,
|  | const char * | dir,
|  | const char * | type,
|  | unsigned int | reliableMessageNumber,
|  | unsigned int | frame,
|  | const char * | idToPrint,
|  | const BitSize_t | bitLen,
|  | unsigned long long | time,
|  | const SystemAddress & | local,
|  | const SystemAddress & | remote,
|  | unsigned int | splitPacketId,
|  | unsigned int | splitPacketIndex,
|  | unsigned int | splitPacketCount,
|  | unsigned int | orderingIndex
| ) |  |

virtual

virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
|  | const char * | dir,
|  | const char * | type,
|  | unsigned int | reliableMessageNumber,
|  | unsigned int | frame,
|  | const char * | idToPrint,
|  | const BitSize_t | bitLen,
|  | unsigned long long | time,
|  | const SystemAddress & | local,
|  | const SystemAddress & | remote,
|  | unsigned int | splitPacketId,
|  | unsigned int | splitPacketIndex,
|  | unsigned int | splitPacketCount,
|  | unsigned int | orderingIndex
| ) |  |

virtual

void SLNet::PacketLogger::GetLocalTime | ( | char | buffer[128] | ) |

protected

const char* SLNet::PacketLogger::IDTOString | ( | unsigned char | Id | ) |

protected

virtual void SLNet::PacketLogger::LogHeader | ( | void |  | ) |

virtual

Logs out a header for all the data.

virtual void SLNet::PacketLogger::OnAck | ( | unsigned int | messageNumber,
|  | SystemAddress | remoteSystemAddress,
|  | SLNet::TimeMS | time
| ) |  |

virtual

Called when we get an ack for a message we reliably sent

Precondition
  To be called, UsesReliabilityLayer() must return true

Parameters

  [in] | messageNumber | The numerical identifier for which message this is
  [in] | remoteSystemAddress | The player we sent or got this packet from
  [in] | time | The current time as returned by SLNet::GetTimeMS()

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnDirectSocketReceive | ( | const char * | data,
|  | const BitSize_t | bitsUsed,
|  | SystemAddress | remoteSystemAddress
| ) |  |

virtual

Called on a receive from the socket, per datagram, that does not go through the reliability layer

Precondition
  To be called, UsesReliabilityLayer() must return true

Parameters

  [in] | data | The data being sent
  [in] | bitsUsed | How many bits long data is
  [in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnDirectSocketSend | ( | const char * | data,
|  | const BitSize_t | bitsUsed,
|  | SystemAddress | remoteSystemAddress
| ) |  |

virtual

Events on low level sends and receives. These functions may be called from different threads at the same time.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnInternalPacket | ( | InternalPacket * | internalPacket,
|  | unsigned | frameNumber,
|  | SystemAddress | remoteSystemAddress,
|  | SLNet::TimeMS | time,
|  | int | isSend
| ) |  |

virtual

Called on a send or receive of a message within the reliability layer

Precondition
  To be called, UsesReliabilityLayer() must return true

Parameters

  [in] | internalPacket | The user message, along with all send data.
  [in] | frameNumber | The number of frames sent or received so far for this player depending on isSend . Indicates the frame of this user message.
  [in] | remoteSystemAddress | The player we sent or got this packet from
  [in] | time | The current time as returned by SLNet::GetTimeMS()
  [in] | isSend | Is this callback representing a send event or receive event?

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnPushBackPacket | ( | const char * | data,
|  | const BitSize_t | bitsUsed,
|  | SystemAddress | remoteSystemAddress
| ) |  |

virtual

System called RakPeerInterface::PushBackPacket

Parameters

  [in] | data | The data being sent
  [in] | bitsUsed | How many bits long data is
  [in] | remoteSystemAddress | The player we sent or got this packet from

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnReliabilityLayerNotification | ( | const char * | errorMessage,
|  | const BitSize_t | bitsUsed,
|  | SystemAddress | remoteSystemAddress,
|  | bool | isError
| ) |  |

virtual

Called when the reliability layer rejects a send or receive

Precondition
  To be called, UsesReliabilityLayer() must return true

Parameters

  [in] | bitsUsed | How many bits long data is
  [in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented from SLNet::PluginInterface2.

void SLNet::PacketLogger::SetLogDirectMessages | ( | bool | send | ) |

Log the direct sends and receives or not. Default true.

virtual void SLNet::PacketLogger::SetPrefix | ( | const char * | _prefix | ) |

virtual

Prepend this string to output logs.

virtual void SLNet::PacketLogger::SetPrintAcks | ( | bool | print | ) |

virtual

virtual void SLNet::PacketLogger::SetPrintID | ( | bool | print | ) |

virtual

virtual void SLNet::PacketLogger::SetSuffix | ( | const char * | _suffix | ) |

virtual

Append this string to output logs. (newline is useful here)

virtual const char* SLNet::PacketLogger::UserIDTOString | ( | unsigned char | Id | ) |

protectedvirtual

virtual bool SLNet::PacketLogger::UsesReliabilityLayer | ( | void |  | ) | const

inlineprotectedvirtual

Queried when attached to RakPeer Return true to call OnDirectSocketSend(), OnDirectSocketReceive(), OnReliabilityLayerNotification(), OnInternalPacket(), and OnAck() If true, then you cannot call RakPeer::AttachPlugin() or RakPeer::DetachPlugin() for this plugin, while RakPeer is active

Reimplemented from SLNet::PluginInterface2.

Definition at line 103 of file PacketLogger.h.

virtual void SLNet::PacketLogger::WriteLog | ( | const char * | str | ) |

virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented in SLNet::PacketFileLogger, SLNet::PacketConsoleLogger, and SLNet::PacketOutputWindowLogger.

virtual void SLNet::PacketLogger::WriteMiscellaneous | ( | const char * | type,
|  | const char * | msg
| ) |  |

virtual

#### Member Data Documentation

bool SLNet::PacketLogger::logDirectMessages

protected

Definition at line 109 of file PacketLogger.h.

char SLNet::PacketLogger::prefix[256]

protected

Definition at line 112 of file PacketLogger.h.

bool SLNet::PacketLogger::printAcks

protected

Definition at line 111 of file PacketLogger.h.

bool SLNet::PacketLogger::printId

protected

Definition at line 111 of file PacketLogger.h.

char SLNet::PacketLogger::suffix[256]

protected

Definition at line 113 of file PacketLogger.h.

class SLNet::PacketOutputWindowLogger

Packetlogger that outputs to the output window in the debugger. Windows only.

Definition at line 34 of file PacketOutputWindowLogger.h.

Inheritance diagram for SLNet::PacketOutputWindowLogger:

### Public Member Functions

| PacketOutputWindowLogger ()
virtual | ~PacketOutputWindowLogger ()
virtual void | WriteLog (const char *str)
| Override this to log strings to wherever. Log should be threadsafe.
Public Member Functions inherited from SLNet::PacketLogger
| PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
| Events on low level sends and receives. These functions may be called from different threads at the same time.
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)
virtual void | LogHeader (void)
| Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
| Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
| Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
| Log the direct sends and receives or not. Default true.
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 | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]

#### Constructor & Destructor Documentation

SLNet::PacketOutputWindowLogger::PacketOutputWindowLogger | ( |  | ) |

virtual SLNet::PacketOutputWindowLogger::~PacketOutputWindowLogger | ( |  | ) |

virtual

#### Member Function Documentation

virtual void SLNet::PacketOutputWindowLogger::WriteLog | ( | const char * | str | ) |

virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

class SLNet::ThreadsafePacketLogger

Same as PacketLogger, but writes output in the user thread.

Definition at line 35 of file ThreadsafePacketLogger.h.

Inheritance diagram for SLNet::ThreadsafePacketLogger:

### Public Member Functions

| ThreadsafePacketLogger ()
virtual | ~ThreadsafePacketLogger ()
virtual void | Update (void)
| Update is called every time a packet is checked for .
Public Member Functions inherited from SLNet::PacketLogger
| PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
| Events on low level sends and receives. These functions may be called from different threads at the same time.
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)
virtual void | LogHeader (void)
| Logs out a header for all the data.
virtual void | WriteLog (const char *str)
| Override this to log strings to wherever. Log should be threadsafe.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
| Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
| Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
| Log the direct sends and receives or not. Default true.
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 PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Protected Member Functions

virtual void | AddToLog (const char *str)
Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
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::SingleProducerConsumer < char * > | logMessages
Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)

#### Constructor & Destructor Documentation

SLNet::ThreadsafePacketLogger::ThreadsafePacketLogger | ( |  | ) |

virtual SLNet::ThreadsafePacketLogger::~ThreadsafePacketLogger | ( |  | ) |

virtual

#### Member Function Documentation

virtual void SLNet::ThreadsafePacketLogger::AddToLog | ( | const char * | str | ) |

protectedvirtual

Reimplemented from SLNet::PacketLogger.

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

virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

#### Member Data Documentation

DataStructures::SingleProducerConsumer<char*> SLNet::ThreadsafePacketLogger::logMessages

protected

Definition at line 46 of file ThreadsafePacketLogger.h.