• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

PacketLogger.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "NativeFeatureIncludes.h"
00009 #if _RAKNET_SUPPORT_PacketLogger==1
00010 
00011 #ifndef __PACKET_LOGGER_H
00012 #define __PACKET_LOGGER_H
00013 
00014 class RakPeerInterface;
00015 #include "RakNetTypes.h"
00016 #include "PluginInterface2.h"
00017 #include "Export.h"
00018 
00023 
00027 class RAK_DLL_EXPORT PacketLogger : public PluginInterface2
00028 {
00029 public:
00030         PacketLogger();
00031         virtual ~PacketLogger();
00032 
00033         // Translate the supplied parameters into an output line - overloaded version that takes a MessageIdentifier
00034         // and translates it into a string (numeric or textual representation based on printId); this calls the
00035         // second version which takes a const char* argument for the messageIdentifier
00036         virtual void FormatLine(char* into, const char* dir, const char* type, unsigned int packet, unsigned int frame
00037                 , unsigned char messageIdentifier, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
00038                 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
00039         virtual void FormatLine(char* into, const char* dir, const char* type, unsigned int packet, unsigned int frame
00040                 , const char* idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
00041                 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
00042 
00044         virtual void OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
00045         virtual void OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
00046         virtual void OnReliabilityLayerPacketError(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
00047         virtual void OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNetTime time, int isSend);
00048         virtual void OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNetTime time);
00049         virtual void OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
00050 
00052         virtual void LogHeader(void);
00053 
00055         virtual void WriteLog(const char *str);
00056 
00057         // Write informational messages
00058         virtual void WriteMiscellaneous(const char *type, const char *msg);
00059 
00060 
00061         // Set to true to print ID_* instead of numbers
00062         virtual void SetPrintID(bool print);
00063         // Print or hide acks (clears up the screen not to print them but is worse for debugging)
00064         virtual void SetPrintAcks(bool print);
00065 
00067         virtual void SetPrefix(const char *_prefix);
00068 
00070         virtual void SetSuffix(const char *_suffix);
00071         static const char* BaseIDTOString(unsigned char Id);
00072 
00074         void SetLogDirectMessages(bool send);
00075 protected:
00076         const char* IDTOString(unsigned char Id);
00077         virtual void AddToLog(const char *str);
00078         // Users should override this
00079         virtual const char* UserIDTOString(unsigned char Id);
00080         void GetLocalTime(char buffer[128]);
00081         bool logDirectMessages;
00082 
00083         bool printId, printAcks;
00084         char prefix[256];
00085         char suffix[256];
00086 };
00087 
00088 #endif
00089 
00090 #endif // _RAKNET_SUPPORT_*

Generated on Thu Sep 30 2010 01:27:26 for RakNet by  doxygen 1.7.1