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.cpp
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
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketLogger==1
18
19 #include "slikenet/PacketLogger.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/DS_List.h"
22 #include "slikenet/InternalPacket.h"
23 #include "slikenet/peerinterface.h"
24 #include "slikenet/MessageIdentifiers.h"
25 #include "slikenet/StringCompressor.h"
26 #include "slikenet/GetTime.h"
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include "slikenet/Itoa.h"
31 #include <time.h>
32 #include "slikenet/SocketIncludes.h"
33 #include "slikenet/gettimeofday.h"
34 #include "slikenet/linux_adapter.h"
35 #include "slikenet/osx_adapter.h"
36
37 using namespace SLNet;
38
39 STATIC_FACTORY_DEFINITIONS(PacketLogger,PacketLogger);
40
41 PacketLogger::PacketLogger()
42 {
43 printId=true;
44 printAcks=true;
45 prefix[0]=0;
46 suffix[0]=0;
47 logDirectMessages=true;
48 }
49 PacketLogger::~PacketLogger()
50 {
51 }
52 void PacketLogger::FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
53 , unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
54 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
55 {
56 char numericID[16];
57 const char* idToPrint = NULL;
58 if (printId)
59 {
60 if (splitPacketCount > 0 && splitPacketCount != (unsigned int)-1)
61 idToPrint = "(SPLIT PACKET)";
62 else
63 idToPrint = IDTOString(id);
64 }
65 // If printId is false, idToPrint will be NULL, as it will
66 // in the case of an unrecognized id. Testing printId for false
67 // would just be redundant.
68 if (idToPrint == NULL)
69 {
70 sprintf_s(numericID, "%5u", id);
71 idToPrint = numericID;
72 }
73
74 FormatLine(into, dir, type, reliableMessageNumber, frame, idToPrint, bitLen, time, local, remote, splitPacketId, splitPacketIndex, splitPacketCount, orderingIndex);
75 }
76 void PacketLogger::FormatLine(
77 char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id
78 , const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
79 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
80 {
81 char numericID[16];
82 const char* idToPrint = NULL;
83 if(printId)
84 {
85 if (splitPacketCount>0 && splitPacketCount!=(unsigned int)-1)
86 idToPrint="(SPLIT PACKET)";
87 else
88 idToPrint = IDTOString(id);
89 }
90 // If printId is false, idToPrint will be NULL, as it will
91 // in the case of an unrecognized id. Testing printId for false
92 // would just be redundant.
93 if(idToPrint == NULL)
94 {
95 sprintf_s(numericID, "%5u", id);
96 idToPrint = numericID;
97 }
98
99 FormatLine(into, intoLength, dir, type, reliableMessageNumber, frame, idToPrint, bitLen, time, local, remote,splitPacketId,splitPacketIndex,splitPacketCount, orderingIndex);
100 }
101
102 void PacketLogger::FormatLine(
103 char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame, const char* idToPrint
104 , const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
105 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
106 {
107 char str1[64], str2[62];
108 local.ToString(true, str1, static_cast<size_t>(64));
109 remote.ToString(true, str2, static_cast<size_t>(62));
110 char localtime[128];
111 GetLocalTime(localtime);
112 char str3[64];
113 if (reliableMessageNumber==(unsigned int)-1)
114 {
115 str3[0]='N';
116 str3[1]='/';
117 str3[2]='A';
118 str3[3]=0;
119 }
120 else
121 {
122 sprintf_s(str3,"%5u",reliableMessageNumber);
123 }
124
125 sprintf_s(into, intoLength, "%s,%s%s,%s,%s,%5u,%s,%u,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,%i,%i,%i,%i,%s,"
126 , localtime
127 , prefix
128 , dir
129 , type
130 , str3
131 , frame
132 , idToPrint
133 , bitLen
134 , time
135 , str1
136 , str2
137 , splitPacketId
138 , splitPacketIndex
139 , splitPacketCount
140 , orderingIndex
141 , suffix
142 );
143 }
144 void PacketLogger::FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
145 , const char* idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
146 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
147 {
148 char str1[64], str2[62];
149 local.ToString(true, str1, static_cast<size_t>(64));
150 remote.ToString(true, str2, static_cast<size_t>(62));
151 char localtime[128];
152 GetLocalTime(localtime);
153 char str3[64];
154 if (reliableMessageNumber == (unsigned int)-1)
155 {
156 str3[0] = 'N';
157 str3[1] = '/';
158 str3[2] = 'A';
159 str3[3] = 0;
160 }
161 else
162 {
163 sprintf_s(str3, "%5u", reliableMessageNumber);
164 }
165
166 #pragma warning(push)
167 #pragma warning(disable:4996)
168 sprintf(into, "%s,%s%s,%s,%s,%5u,%s,%u,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,%i,%i,%i,%i,%s,"
169 , localtime
170 , prefix
171 , dir
172 , type
173 , str3
174 , frame
175 , idToPrint
176 , bitLen
177 , time
178 , str1
179 , str2
180 , splitPacketId
181 , splitPacketIndex
182 , splitPacketCount
183 , orderingIndex
184 , suffix
185 );
186 #pragma warning(pop)
187 }
188 void PacketLogger::OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
189 {
190 if (logDirectMessages==false)
191 return;
192
193 char str[256];
194 FormatLine(str, 256, "Snd", "Raw", 0, 0, data[0], bitsUsed, SLNet::GetTimeMS(), rakPeerInterface->GetExternalID(remoteSystemAddress), remoteSystemAddress, (unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
195 AddToLog(str);
196 }
197
198 void PacketLogger::LogHeader(void)
199 {
200 // Last 5 are splitpacket id, split packet index, split packet count, ordering index, suffix
201 AddToLog("Clock,S|R,Typ,Reliable#,Frm #,PktID,BitLn,Time ,Local IP:Port ,RemoteIP:Port,SPID,SPIN,SPCO,OI,Suffix,Miscellaneous\n");
202 }
203 void PacketLogger::OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
204 {
205 if (logDirectMessages==false)
206 return;
207
208 char str[256];
209 FormatLine(str, 256, "Rcv", "Raw", 0, 0, data[0], bitsUsed, SLNet::GetTime(), rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS), remoteSystemAddress,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
210 AddToLog(str);
211 }
212 void PacketLogger::OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
213 {
214 char str[1024];
215 char *type;
216 if (isError)
217 type=(char*) "RcvErr";
218 else
219 type=(char*) "RcvWrn";
220 FormatLine(str, 1024, type, errorMessage, 0, 0, "", bitsUsed, SLNet::GetTime(), rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS), remoteSystemAddress,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
221 AddToLog(str);
222 RakAssert(isError==false);
223 }
224 void PacketLogger::OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
225 {
226 char str[256];
227 char str1[64], str2[62];
228 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
229 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
230 remoteSystemAddress.ToString(true, str2, static_cast<size_t>(62));
231 char localtime[128];
232 GetLocalTime(localtime);
233
234 sprintf_s(str, "%s,Rcv,Ack,%i,,,,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,,,,,,"
235 , localtime
236 , messageNumber
237 , (unsigned long long) time
238 , str1
239 , str2
240 );
241 AddToLog(str);
242 }
243 void PacketLogger::OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
244 {
245 char str[256];
246 char str1[64], str2[62];
247 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
248 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
249 remoteSystemAddress.ToString(true, str2, static_cast<size_t>(62));
250 SLNet::TimeMS time = SLNet::GetTimeMS();
251 char localtime[128];
252 GetLocalTime(localtime);
253
254 sprintf_s(str, "%s,Lcl,PBP,,,%s,%i,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,,,,,,"
255 , localtime
256 , BaseIDTOString(data[0])
257 , bitsUsed
258 , (unsigned long long) time
259 , str1
260 , str2
261 );
262 AddToLog(str);
263 }
264 void PacketLogger::OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
265 {
266 char str[256];
267 const char *sendTypes[] =
268 {
269 "Rcv",
270 "Snd",
271 "Err1",
272 "Err2",
273 "Err3",
274 "Err4",
275 "Err5",
276 "Err6",
277 };
278 const char *sendType = sendTypes[isSend];
279 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
280
281 unsigned int reliableMessageNumber;
282 if (internalPacket->reliability==UNRELIABLE || internalPacket->reliability==UNRELIABLE_SEQUENCED || internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT)
283 reliableMessageNumber=(unsigned int)-1;
284 else
285 reliableMessageNumber=internalPacket->reliableMessageNumber;
286
287 if (internalPacket->data[0]==ID_TIMESTAMP)
288 {
289 FormatLine(str, 256, sendType, "Tms", reliableMessageNumber, frameNumber, internalPacket->data[1+sizeof(SLNet::Time)], internalPacket->dataBitLength, (unsigned long long)time, localSystemAddress, remoteSystemAddress, internalPacket->splitPacketId, internalPacket->splitPacketIndex, internalPacket->splitPacketCount, internalPacket->orderingIndex);
290 }
291 else
292 {
293 FormatLine(str, 256, sendType, "Nrm", reliableMessageNumber, frameNumber, internalPacket->data[0], internalPacket->dataBitLength, (unsigned long long)time, localSystemAddress, remoteSystemAddress, internalPacket->splitPacketId, internalPacket->splitPacketIndex, internalPacket->splitPacketCount, internalPacket->orderingIndex);
294 }
295
296 AddToLog(str);
297 }
298 void PacketLogger::AddToLog(const char *str)
299 {
300 WriteLog(str);
301 }
302 void PacketLogger::WriteLog(const char *str)
303 {
304 RAKNET_DEBUG_PRINTF("%s\n", str);
305 }
306 void PacketLogger::WriteMiscellaneous(const char *type, const char *msg)
307 {
308 char str[1024];
309 char str1[64];
310 SystemAddress localSystemAddress = rakPeerInterface->GetInternalID();
311 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
312 SLNet::TimeMS time = SLNet::GetTimeMS();
313 char localtime[128];
314 GetLocalTime(localtime);
315
316 sprintf_s(str, "%s,Lcl,%s,,,,,%" PRINTF_64_BIT_MODIFIER "u,%s,,,,,,,%s"
317 , localtime
318 , type
319 , (unsigned long long) time
320 , str1
321 , msg
322 );
323
324 AddToLog(msg);
325 }
326 void PacketLogger::SetPrintID(bool print)
327 {
328 printId=print;
329 }
330 void PacketLogger::SetPrintAcks(bool print)
331 {
332 printAcks=print;
333 }
334 const char* PacketLogger::BaseIDTOString(unsigned char Id)
335 {
336 if (Id >= ID_USER_PACKET_ENUM)
337 return 0;
338
339 const char *IDTable[((int)ID_USER_PACKET_ENUM)+1]=
340 {
341 "ID_CONNECTED_PING",
342 "ID_UNCONNECTED_PING",
343 "ID_UNCONNECTED_PING_OPEN_CONNECTIONS",
344 "ID_CONNECTED_PONG",
345 "ID_DETECT_LOST_CONNECTIONS",
346 "ID_OPEN_CONNECTION_REQUEST_1",
347 "ID_OPEN_CONNECTION_REPLY_1",
348 "ID_OPEN_CONNECTION_REQUEST_2",
349 "ID_OPEN_CONNECTION_REPLY_2",
350 "ID_CONNECTION_REQUEST",
351 "ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY",
352 "ID_OUR_SYSTEM_REQUIRES_SECURITY",
353 "ID_PUBLIC_KEY_MISMATCH",
354 "ID_OUT_OF_BAND_INTERNAL",
355 "ID_SND_RECEIPT_ACKED",
356 "ID_SND_RECEIPT_LOSS",
357 "ID_CONNECTION_REQUEST_ACCEPTED",
358 "ID_CONNECTION_ATTEMPT_FAILED",
359 "ID_ALREADY_CONNECTED",
360 "ID_NEW_INCOMING_CONNECTION",
361 "ID_NO_FREE_INCOMING_CONNECTIONS",
362 "ID_DISCONNECTION_NOTIFICATION",
363 "ID_CONNECTION_LOST",
364 "ID_CONNECTION_BANNED",
365 "ID_INVALID_PASSWORD",
366 "ID_INCOMPATIBLE_PROTOCOL_VERSION",
367 "ID_IP_RECENTLY_CONNECTED",
368 "ID_TIMESTAMP",
369 "ID_UNCONNECTED_PONG",
370 "ID_ADVERTISE_SYSTEM",
371 "ID_DOWNLOAD_PROGRESS",
372 "ID_REMOTE_DISCONNECTION_NOTIFICATION",
373 "ID_REMOTE_CONNECTION_LOST",
374 "ID_REMOTE_NEW_INCOMING_CONNECTION",
375 "ID_FILE_LIST_TRANSFER_HEADER",
376 "ID_FILE_LIST_TRANSFER_FILE",
377 "ID_FILE_LIST_REFERENCE_PUSH_ACK",
378 "ID_DDT_DOWNLOAD_REQUEST",
379 "ID_TRANSPORT_STRING",
380 "ID_REPLICA_MANAGER_CONSTRUCTION",
381 "ID_REPLICA_MANAGER_SCOPE_CHANGE",
382 "ID_REPLICA_MANAGER_SERIALIZE",
383 "ID_REPLICA_MANAGER_DOWNLOAD_STARTED",
384 "ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE",
385 "ID_RAKVOICE_OPEN_CHANNEL_REQUEST",
386 "ID_RAKVOICE_OPEN_CHANNEL_REPLY",
387 "ID_RAKVOICE_CLOSE_CHANNEL",
388 "ID_RAKVOICE_DATA",
389 "ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE",
390 "ID_AUTOPATCHER_CREATION_LIST",
391 "ID_AUTOPATCHER_DELETION_LIST",
392 "ID_AUTOPATCHER_GET_PATCH",
393 "ID_AUTOPATCHER_PATCH_LIST",
394 "ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR",
395 "ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES",
396 "ID_AUTOPATCHER_FINISHED_INTERNAL",
397 "ID_AUTOPATCHER_FINISHED",
398 "ID_AUTOPATCHER_RESTART_APPLICATION",
399 "ID_NAT_PUNCHTHROUGH_REQUEST",
400 "ID_NAT_CONNECT_AT_TIME",
401 "ID_NAT_GET_MOST_RECENT_PORT",
402 "ID_NAT_CLIENT_READY",
403 "ID_NAT_TARGET_NOT_CONNECTED",
404 "ID_NAT_TARGET_UNRESPONSIVE",
405 "ID_NAT_CONNECTION_TO_TARGET_LOST",
406 "ID_NAT_ALREADY_IN_PROGRESS",
407 "ID_NAT_PUNCHTHROUGH_FAILED",
408 "ID_NAT_PUNCHTHROUGH_SUCCEEDED",
409 "ID_READY_EVENT_SET",
410 "ID_READY_EVENT_UNSET",
411 "ID_READY_EVENT_ALL_SET",
412 "ID_READY_EVENT_QUERY",
413 "ID_LOBBY_GENERAL",
414 "ID_RPC_REMOTE_ERROR",
415 "ID_RPC_PLUGIN",
416 "ID_FILE_LIST_REFERENCE_PUSH",
417 "ID_READY_EVENT_FORCE_ALL_SET",
418 "ID_ROOMS_EXECUTE_FUNC",
419 "ID_ROOMS_LOGON_STATUS",
420 "ID_ROOMS_HANDLE_CHANGE",
421 "ID_LOBBY2_SEND_MESSAGE",
422 "ID_LOBBY2_SERVER_ERROR",
423 "ID_FCM2_NEW_HOST",
424 "ID_FCM2_REQUEST_FCMGUID",
425 "ID_FCM2_RESPOND_CONNECTION_COUNT",
426 "ID_FCM2_INFORM_FCMGUID",
427 "ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT",
428 "ID_FCM2_VERIFIED_JOIN_START",
429 "ID_FCM2_VERIFIED_JOIN_CAPABLE",
430 "ID_FCM2_VERIFIED_JOIN_FAILED",
431 "ID_FCM2_VERIFIED_JOIN_ACCEPTED",
432 "ID_FCM2_VERIFIED_JOIN_REJECTED",
433 "ID_UDP_PROXY_GENERAL",
434 "ID_SQLite3_EXEC",
435 "ID_SQLite3_UNKNOWN_DB",
436 "ID_SQLLITE_LOGGER",
437 "ID_NAT_TYPE_DETECTION_REQUEST",
438 "ID_NAT_TYPE_DETECTION_RESULT",
439 "ID_ROUTER_2_INTERNAL",
440 "ID_ROUTER_2_FORWARDING_NO_PATH",
441 "ID_ROUTER_2_FORWARDING_ESTABLISHED",
442 "ID_ROUTER_2_REROUTED",
443 "ID_TEAM_BALANCER_INTERNAL",
444 "ID_TEAM_BALANCER_REQUESTED_TEAM_FULL",
445 "ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED",
446 "ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED",
447 "ID_TEAM_BALANCER_TEAM_ASSIGNED",
448 "ID_LIGHTSPEED_INTEGRATION",
449 "ID_XBOX_LOBBY",
450 "ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS",
451 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS",
452 "ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE",
453 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE",
454 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT",
455 "ID_TWO_WAY_AUTHENTICATION_NEGOTIATION",
456 "ID_CLOUD_POST_REQUEST",
457 "ID_CLOUD_RELEASE_REQUEST",
458 "ID_CLOUD_GET_REQUEST",
459 "ID_CLOUD_GET_RESPONSE",
460 "ID_CLOUD_UNSUBSCRIBE_REQUEST",
461 "ID_CLOUD_SERVER_TO_SERVER_COMMAND",
462 "ID_CLOUD_SUBSCRIPTION_NOTIFICATION",
463 "ID_LIB_VOICE",
464 "ID_RELAY_PLUGIN",
465 "ID_NAT_REQUEST_BOUND_ADDRESSES",
466 "ID_NAT_RESPOND_BOUND_ADDRESSES",
467 "ID_FCM2_UPDATE_USER_CONTEXT",
468 "ID_RESERVED_3",
469 "ID_RESERVED_4",
470 "ID_RESERVED_5",
471 "ID_RESERVED_6",
472 "ID_RESERVED_7",
473 "ID_RESERVED_8",
474 "ID_RESERVED_9",
475 "ID_USER_PACKET_ENUM"
476 };
477
478 return (char*)IDTable[Id];
479 }
480 const char* PacketLogger::UserIDTOString(unsigned char Id)
481 {
482 // Users should override this
483 static char str[256];
484 Itoa(Id, str, 10);
485 return (const char*) str;
486 }
487 const char* PacketLogger::IDTOString(unsigned char Id)
488 {
489 const char *out;
490 out=BaseIDTOString(Id);
491 if (out)
492 return out;
493 return UserIDTOString(Id);
494 }
495 void PacketLogger::SetPrefix(const char *_prefix)
496 {
497 strncpy_s(prefix, _prefix, 255);
498 prefix[255]=0;
499 }
500 void PacketLogger::SetSuffix(const char *_suffix)
501 {
502 strncpy_s(suffix, _suffix, 255);
503 suffix[255]=0;
504 }
505 void PacketLogger::GetLocalTime(char buffer[128])
506 {
507 #if defined(_WIN32) && !defined(__GNUC__) && !defined(__GCCXML__)
508 time_t rawtime;
509 struct timeval tv;
510 // If you get an arror about an incomplete type, just delete this file
511 struct timezone tz;
512 gettimeofday(&tv, &tz);
513 // time ( &rawtime );
514 rawtime=tv.tv_sec;
515
516 struct tm timeinfo;
517 localtime_s ( &timeinfo, &rawtime );
518 strftime (buffer,128,"%x %X",&timeinfo);
519 char buff[32];
520 sprintf_s(buff, ".%i", tv.tv_usec);
521 strcat_s(buffer,128,buff);
522
523 // Commented version puts the time first
524 /*
525 struct tm timeinfo;
526 localtime_s ( &timeinfo, &rawtime );
527 strftime (buffer,128,"%X",&timeinfo);
528 char buff[32];
529 sprintf_s(buff, ".%i ", tv.tv_usec);
530 strcat_s(buffer,128,buff);
531 char buff2[32];
532 strftime (buff2,32,"%x",&timeinfo);
533 strcat_s(buffer,128,buff2);
534 */
535 #else
536 buffer[0]=0;
537 #endif
538 }
539 void PacketLogger::SetLogDirectMessages(bool send)
540 {
541 logDirectMessages=send;
542 }
543
544 #endif // _RAKNET_SUPPORT_*