RakNet  4.0
Public Member Functions | Protected Member Functions | List of all members
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. More...

#include <PacketLogger.h>

Inheritance diagram for RakNet::PacketLogger:
RakNet::PluginInterface2 RakNet::PacketConsoleLogger RakNet::PacketFileLogger RakNet::PacketOutputWindowLogger RakNet::ThreadsafePacketLogger

Public Member Functions

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, RakNet::TimeMS time, int isSend)
 
virtual void OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::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 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 RakNet::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)
 

Protected Member Functions

virtual bool UsesReliabilityLayer (void) const
 

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.

Member Function Documentation

virtual void RakNet::PacketLogger::OnAck ( unsigned int  messageNumber,
SystemAddress  remoteSystemAddress,
RakNet::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]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

Precondition
To be called, UsesReliabilityLayer() must return true
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::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

Precondition
To be called, UsesReliabilityLayer() must return true
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::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]bitsUsedHow many bits long data is
[in]remoteSystemAddressWhich system this message is being sent to

Reimplemented from RakNet::PluginInterface2.

virtual bool RakNet::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 RakNet::PluginInterface2.


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