Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
RakNet::PacketLogger Class Reference

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.

#include <PacketLogger.h>

Inheritance diagram for RakNet::PacketLogger:

List of all members.

Public Member Functions

virtual void FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, 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 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 LogHeader (void)
 Logs out a header for all the data.
virtual void OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time)
virtual void OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
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 OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend)
virtual void OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void OnReliabilityLayerPacketError (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
 PacketLogger ()
void SetLogDirectMessages (bool send)
 Log the direct sends and receives or not. Default true.
virtual void SetPrefix (const char *_prefix)
 Prepend this string to output logs.
virtual void SetPrintAcks (bool print)
virtual void SetPrintID (bool print)
virtual void SetSuffix (const char *_suffix)
 Append this string to output logs. (newline is useful here)
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 ~PacketLogger ()

Static Public Member Functions

static const char * BaseIDTOString (unsigned char Id)
static void DestroyInstance (PacketLogger *i)
static PacketLoggerGetInstance (void)

Protected Member Functions

virtual void AddToLog (const char *str)
void GetLocalTime (char buffer[128])
const char * IDTOString (unsigned char Id)
virtual const char * UserIDTOString (unsigned char Id)

Protected Attributes

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

Detailed Description

Definition at line 31 of file PacketLogger.h.


Constructor & Destructor Documentation

RakNet::PacketLogger::PacketLogger ( )
virtual RakNet::PacketLogger::~PacketLogger ( ) [virtual]

Member Function Documentation

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

Reimplemented in RakNet::ThreadsafePacketLogger.

static const char* RakNet::PacketLogger::BaseIDTOString ( unsigned char  Id) [static]
static void RakNet::PacketLogger::DestroyInstance ( PacketLogger i) [static]
virtual void RakNet::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]
virtual void RakNet::PacketLogger::FormatLine ( char *  into,
const char *  dir,
const char *  type,
unsigned int  reliableMessageNumber,
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]
static PacketLogger* RakNet::PacketLogger::GetInstance ( void  ) [static]
void RakNet::PacketLogger::GetLocalTime ( char  buffer[128]) [protected]
const char* RakNet::PacketLogger::IDTOString ( unsigned char  Id) [protected]
virtual void RakNet::PacketLogger::LogHeader ( void  ) [virtual]
virtual void RakNet::PacketLogger::OnAck ( unsigned int  messageNumber,
SystemAddress  remoteSystemAddress,
RakNet::TimeMS  time 
) [virtual]

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

Parameters:
[in]messageNumberThe numerical identifier for which message this is
[in]remoteSystemAddressThe player we sent or got this packet from
[in]timeThe current time as returned by RakNet::GetTimeMS()

Reimplemented from RakNet::PluginInterface2.

virtual void RakNet::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]dataThe data being sent
[in]bitsUsedHow many bits long data is
[in]remoteSystemAddressWhich system this message is being sent to

Reimplemented from RakNet::PluginInterface2.

virtual void RakNet::PacketLogger::OnDirectSocketSend ( const char *  data,
const BitSize_t  bitsUsed,
SystemAddress  remoteSystemAddress 
) [virtual]

Reimplemented from RakNet::PluginInterface2.

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

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

Parameters:
[in]internalPacketThe user message, along with all send data.
[in]frameNumberThe number of frames sent or received so far for this player depending on isSend . Indicates the frame of this user message.
[in]remoteSystemAddressThe player we sent or got this packet from
[in]timeThe current time as returned by RakNet::GetTimeMS()
[in]isSendIs this callback representing a send event or receive event?

Reimplemented from RakNet::PluginInterface2.

virtual void RakNet::PacketLogger::OnPushBackPacket ( const char *  data,
const BitSize_t  bitsUsed,
SystemAddress  remoteSystemAddress 
) [virtual]

System called RakPeerInterface::PushBackPacket

Parameters:
[in]dataThe data being sent
[in]bitsUsedHow many bits long data is
[in]remoteSystemAddressThe player we sent or got this packet from

Reimplemented from RakNet::PluginInterface2.

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

Called when the reliability layer rejects a send or receive

Parameters:
[in]bitsUsedHow many bits long data is
[in]remoteSystemAddressWhich system this message is being sent to

Reimplemented from RakNet::PluginInterface2.

void RakNet::PacketLogger::SetLogDirectMessages ( bool  send)
virtual void RakNet::PacketLogger::SetPrefix ( const char *  _prefix) [virtual]
virtual void RakNet::PacketLogger::SetPrintAcks ( bool  print) [virtual]
virtual void RakNet::PacketLogger::SetPrintID ( bool  print) [virtual]
virtual void RakNet::PacketLogger::SetSuffix ( const char *  _suffix) [virtual]
virtual const char* RakNet::PacketLogger::UserIDTOString ( unsigned char  Id) [protected, virtual]
virtual void RakNet::PacketLogger::WriteLog ( const char *  str) [virtual]
virtual void RakNet::PacketLogger::WriteMiscellaneous ( const char *  type,
const char *  msg 
) [virtual]

Member Data Documentation

Definition at line 88 of file PacketLogger.h.

char RakNet::PacketLogger::prefix[256] [protected]

Definition at line 91 of file PacketLogger.h.

Definition at line 90 of file PacketLogger.h.

Definition at line 90 of file PacketLogger.h.

char RakNet::PacketLogger::suffix[256] [protected]

Definition at line 92 of file PacketLogger.h.


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