TrinityCore
PacketLog.h
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef TRINITY_PACKETLOG_H
19
#define TRINITY_PACKETLOG_H
20
21
#include "
Common.h
"
22
#include <mutex>
23
24
enum
Direction
25
{
26
CLIENT_TO_SERVER
,
27
SERVER_TO_CLIENT
28
};
29
30
class
WorldPacket
;
31
enum
ConnectionType
:
int8
;
32
33
namespace
boost
34
{
35
namespace
asio
36
{
37
namespace
ip
38
{
39
class
address;
40
}
41
}
42
}
43
44
class
TC_GAME_API
PacketLog
45
{
46
private
:
47
PacketLog
();
48
~PacketLog
();
49
std::mutex
_logPacketLock
;
50
std::once_flag
_initializeFlag
;
51
52
public
:
53
static
PacketLog
* instance();
54
55
void
Initialize
();
56
bool
CanLogPacket
()
const
{
return
(_file !=
nullptr
); }
57
void
LogPacket(
WorldPacket
const
& packet,
Direction
direction, boost::asio::ip::address
const
& addr,
uint16
port,
ConnectionType
connectionType);
58
59
private
:
60
FILE*
_file
;
61
};
62
63
#define sPacketLog PacketLog::instance()
64
#endif
Common.h
TC_GAME_API
#define TC_GAME_API
Definition:
Define.h:123
int8
int8_t int8
Definition:
Define.h:140
uint16
uint16_t uint16
Definition:
Define.h:143
Direction
Direction
Definition:
PacketLog.h:25
SERVER_TO_CLIENT
@ SERVER_TO_CLIENT
Definition:
PacketLog.h:27
CLIENT_TO_SERVER
@ CLIENT_TO_SERVER
Definition:
PacketLog.h:26
PacketLog
Definition:
PacketLog.h:45
PacketLog::_file
FILE * _file
Definition:
PacketLog.h:60
PacketLog::CanLogPacket
bool CanLogPacket() const
Definition:
PacketLog.h:56
PacketLog::_initializeFlag
std::once_flag _initializeFlag
Definition:
PacketLog.h:50
PacketLog::_logPacketLock
std::mutex _logPacketLock
Definition:
PacketLog.h:49
WorldPacket
Definition:
WorldPacket.h:26
ConnectionType
ConnectionType
Definition:
Opcodes.h:29
AIRegistry::Initialize
void Initialize()
Definition:
CreatureAIRegistry.cpp:35
boost
Definition:
AsioHacksFwd.h:27
server
game
Server
Protocol
PacketLog.h
Generated on Thu Mar 14 2024 23:39:20 for TrinityCore by
1.9.4