Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

PacketLogger Class Reference
[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...

#include <PacketLogger.h>

Inherits PluginInterface2.

Inherited by PacketConsoleLogger, PacketFileLogger, PacketOutputWindowLogger, and ThreadsafePacketLogger.

Collaboration diagram for PacketLogger:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PacketLogger ()
virtual ~PacketLogger ()
virtual void FormatLine (char *into, const char *dir, const char *type, unsigned int packet, unsigned int frame, unsigned char messageIdentifier, 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 packet, 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 OnReliabilityLayerPacketError (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNetTime time, int isSend)
virtual void OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNetTime 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.

Static Public Member Functions

static const char * BaseIDTOString (unsigned char Id)

Protected Member Functions

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

bool logDirectMessages
bool printId
bool printAcks
char prefix [256]
char suffix [256]

Detailed Description

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 27 of file PacketLogger.h.


Constructor & Destructor Documentation

PacketLogger::PacketLogger (  ) 

Definition at line 25 of file PacketLogger.cpp.

PacketLogger::~PacketLogger (  )  [virtual]

Definition at line 33 of file PacketLogger.cpp.


Member Function Documentation

void PacketLogger::AddToLog ( const char *  str  )  [protected, virtual]

Reimplemented in ThreadsafePacketLogger.

Definition at line 199 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const char * PacketLogger::BaseIDTOString ( unsigned char  Id  )  [static]

Definition at line 235 of file PacketLogger.cpp.

Here is the caller graph for this function:

void PacketLogger::FormatLine ( char *  into,
const char *  dir,
const char *  type,
unsigned int  packet,
unsigned int  frame,
unsigned char  messageIdentifier,
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]

Definition at line 36 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PacketLogger::FormatLine ( char *  into,
const char *  dir,
const char *  type,
unsigned int  packet,
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]

Definition at line 62 of file PacketLogger.cpp.

Here is the call graph for this function:

void PacketLogger::GetLocalTime ( char  buffer[128]  )  [protected]

Definition at line 398 of file PacketLogger.cpp.

Here is the caller graph for this function:

const char * PacketLogger::IDTOString ( unsigned char  Id  )  [protected]

Definition at line 380 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PacketLogger::LogHeader ( void   )  [virtual]

Logs out a header for all the data.

Definition at line 102 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PacketLogger::OnAck ( unsigned int  messageNumber,
SystemAddress  remoteSystemAddress,
RakNetTime  time 
) [virtual]

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

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 RakNet::GetTime()

Reimplemented from PluginInterface2.

Definition at line 122 of file PacketLogger.cpp.

Here is the call graph for this function:

void 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

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

Definition at line 107 of file PacketLogger.cpp.

Here is the call graph for this function:

void 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 PluginInterface2.

Definition at line 92 of file PacketLogger.cpp.

Here is the call graph for this function:

void PacketLogger::OnInternalPacket ( InternalPacket internalPacket,
unsigned  frameNumber,
SystemAddress  remoteSystemAddress,
RakNetTime  time,
int  isSend 
) [virtual]

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

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 RakNet::GetTime()
[in] isSend Is this callback representing a send event or receive event?

Reimplemented from PluginInterface2.

Definition at line 162 of file PacketLogger.cpp.

Here is the call graph for this function:

void 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 PluginInterface2.

Definition at line 141 of file PacketLogger.cpp.

Here is the call graph for this function:

void PacketLogger::OnReliabilityLayerPacketError ( const char *  errorMessage,
const BitSize_t  bitsUsed,
SystemAddress  remoteSystemAddress 
) [virtual]

Called when the reliability layer rejects a send or receive

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

Reimplemented from PluginInterface2.

Definition at line 116 of file PacketLogger.cpp.

Here is the call graph for this function:

void PacketLogger::SetLogDirectMessages ( bool  send  ) 

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

Definition at line 432 of file PacketLogger.cpp.

void PacketLogger::SetPrefix ( const char *  _prefix  )  [virtual]

Prepend this string to output logs.

Definition at line 388 of file PacketLogger.cpp.

void PacketLogger::SetPrintAcks ( bool  print  )  [virtual]

Definition at line 231 of file PacketLogger.cpp.

void PacketLogger::SetPrintID ( bool  print  )  [virtual]

Definition at line 227 of file PacketLogger.cpp.

void PacketLogger::SetSuffix ( const char *  _suffix  )  [virtual]

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

Definition at line 393 of file PacketLogger.cpp.

const char * PacketLogger::UserIDTOString ( unsigned char  Id  )  [protected, virtual]

Definition at line 373 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void PacketLogger::WriteLog ( const char *  str  )  [virtual]

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

Reimplemented in PacketConsoleLogger, PacketFileLogger, and PacketOutputWindowLogger.

Definition at line 203 of file PacketLogger.cpp.

Here is the caller graph for this function:

void PacketLogger::WriteMiscellaneous ( const char *  type,
const char *  msg 
) [virtual]

Definition at line 207 of file PacketLogger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 81 of file PacketLogger.h.

char PacketLogger::prefix[256] [protected]

Definition at line 84 of file PacketLogger.h.

bool PacketLogger::printAcks [protected]

Definition at line 83 of file PacketLogger.h.

bool PacketLogger::printId [protected]

Definition at line 83 of file PacketLogger.h.

char PacketLogger::suffix[256] [protected]

Definition at line 85 of file PacketLogger.h.


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