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
00034
00035
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
00058 virtual void WriteMiscellaneous(const char *type, const char *msg);
00059
00060
00061
00062 virtual void SetPrintID(bool print);
00063
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
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_*