SLikeNet
0.1.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PacketLogger.h
Go to the documentation of this file.
1
/*
2
* Original work: Copyright (c) 2014, Oculus VR, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
7
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
8
*
9
*
10
* Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11
*
12
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13
* license found in the license.txt file in the root directory of this source tree.
14
*/
15
19
20
21
#include "
NativeFeatureIncludes.h
"
22
#if _RAKNET_SUPPORT_PacketLogger==1
23
24
#ifndef __PACKET_LOGGER_H
25
#define __PACKET_LOGGER_H
26
27
#include "
types.h
"
28
#include "
PluginInterface2.h
"
29
#include "
Export.h
"
30
31
namespace
SLNet
32
{
34
class
RakPeerInterface;
35
40
44
class
RAK_DLL_EXPORT
PacketLogger
:
public
PluginInterface2
45
{
46
public
:
47
// GetInstance() and DestroyInstance(instance*)
48
STATIC_FACTORY_DECLARATIONS
(
PacketLogger
)
49
50
PacketLogger
();
51
virtual
~
PacketLogger
();
52
53
// Translate the supplied parameters into an output line - overloaded version that takes a MessageIdentifier
54
// and translates it into a string (numeric or textual representation based on printId); this calls the
55
// second version which takes a const char* argument for the messageIdentifier
56
virtual
void
FormatLine(
char
* into,
size_t
intoLength,
const
char
* dir,
const
char
* type,
unsigned
int
reliableMessageNumber,
unsigned
int
frame
57
,
unsigned
char
id
,
const
BitSize_t
bitLen,
unsigned
long
long
time,
const
SystemAddress
& local,
const
SystemAddress
& remote,
58
unsigned
int
splitPacketId,
unsigned
int
splitPacketIndex,
unsigned
int
splitPacketCount,
unsigned
int
orderingIndex);
59
virtual
void
FormatLine(
char
* into,
const
char
* dir,
const
char
* type,
unsigned
int
reliableMessageNumber,
unsigned
int
frame
60
,
unsigned
char
id
,
const
BitSize_t
bitLen,
unsigned
long
long
time,
const
SystemAddress
& local,
const
SystemAddress
& remote,
61
unsigned
int
splitPacketId,
unsigned
int
splitPacketIndex,
unsigned
int
splitPacketCount,
unsigned
int
orderingIndex);
62
virtual
void
FormatLine(
char
* into,
size_t
intoLength,
const
char
* dir,
const
char
* type,
unsigned
int
reliableMessageNumber,
unsigned
int
frame
63
,
const
char
* idToPrint,
const
BitSize_t
bitLen,
unsigned
long
long
time,
const
SystemAddress
& local,
const
SystemAddress
& remote,
64
unsigned
int
splitPacketId,
unsigned
int
splitPacketIndex,
unsigned
int
splitPacketCount,
unsigned
int
orderingIndex);
65
virtual
void
FormatLine(
char
* into,
const
char
* dir,
const
char
* type,
unsigned
int
reliableMessageNumber,
unsigned
int
frame
66
,
const
char
* idToPrint,
const
BitSize_t
bitLen,
unsigned
long
long
time,
const
SystemAddress
& local,
const
SystemAddress
& remote,
67
unsigned
int
splitPacketId,
unsigned
int
splitPacketIndex,
unsigned
int
splitPacketCount,
unsigned
int
orderingIndex);
68
70
virtual
void
OnDirectSocketSend(
const
char
*data,
const
BitSize_t
bitsUsed,
SystemAddress
remoteSystemAddress);
71
virtual
void
OnDirectSocketReceive(
const
char
*data,
const
BitSize_t
bitsUsed,
SystemAddress
remoteSystemAddress);
72
virtual
void
OnReliabilityLayerNotification(
const
char
*errorMessage,
const
BitSize_t
bitsUsed,
SystemAddress
remoteSystemAddress,
bool
isError);
73
virtual
void
OnInternalPacket(
InternalPacket
*internalPacket,
unsigned
frameNumber,
SystemAddress
remoteSystemAddress,
SLNet::TimeMS
time,
int
isSend);
74
virtual
void
OnAck(
unsigned
int
messageNumber,
SystemAddress
remoteSystemAddress,
SLNet::TimeMS
time);
75
virtual
void
OnPushBackPacket(
const
char
*data,
const
BitSize_t
bitsUsed,
SystemAddress
remoteSystemAddress);
76
78
virtual
void
LogHeader(
void
);
79
81
virtual
void
WriteLog(
const
char
*str);
82
83
// Write informational messages
84
virtual
void
WriteMiscellaneous(
const
char
*type,
const
char
*msg);
85
86
87
// Set to true to print ID_* instead of numbers
88
virtual
void
SetPrintID(
bool
print);
89
// Print or hide acks (clears up the screen not to print them but is worse for debugging)
90
virtual
void
SetPrintAcks(
bool
print);
91
93
virtual
void
SetPrefix(
const
char
*_prefix);
94
96
virtual
void
SetSuffix(
const
char
*_suffix);
97
static
const
char
* BaseIDTOString(
unsigned
char
Id);
98
100
void
SetLogDirectMessages(
bool
send);
101
protected
:
102
103
virtual
bool
UsesReliabilityLayer
(
void
)
const
{
return
true
;}
104
const
char
* IDTOString(
unsigned
char
Id);
105
virtual
void
AddToLog(
const
char
*str);
106
// Users should override this
107
virtual
const
char
* UserIDTOString(
unsigned
char
Id);
108
void
GetLocalTime(
char
buffer[128]);
109
bool
logDirectMessages
;
110
111
bool
printId
, printAcks;
112
char
prefix[256];
113
char
suffix[256];
114
};
115
116
}
// namespace SLNet
117
118
#endif
119
120
#endif // _RAKNET_SUPPORT_*
Source
include
slikenet
PacketLogger.h
Generated on Wed Aug 14 2019 22:09:46 for SLikeNet by
1.8.2