TrinityCore
Loading...
Searching...
No Matches
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
23
#include <boost/asio/ip/address.hpp>
24
#include <mutex>
25
26
enum
Direction
27
{
28
CLIENT_TO_SERVER
,
29
SERVER_TO_CLIENT
30
};
31
32
class
WorldPacket
;
33
34
class
TC_GAME_API
PacketLog
35
{
36
private
:
37
PacketLog
();
38
~PacketLog
();
39
std::mutex
_logPacketLock
;
40
std::once_flag
_initializeFlag
;
41
42
public
:
43
static
PacketLog
* instance();
44
45
void
Initialize();
46
bool
CanLogPacket
()
const
{
return
(_file !=
nullptr
); }
47
void
LogPacket(
WorldPacket
const
& packet,
Direction
direction, boost::asio::ip::address
const
& addr,
uint16
port);
48
49
private
:
50
FILE*
_file
;
51
};
52
53
#define sPacketLog PacketLog::instance()
54
#endif
Common.h
TC_GAME_API
#define TC_GAME_API
Definition
Define.h:114
uint16
uint16_t uint16
Definition
Define.h:134
Direction
Direction
Definition
PacketLog.h:27
SERVER_TO_CLIENT
@ SERVER_TO_CLIENT
Definition
PacketLog.h:29
CLIENT_TO_SERVER
@ CLIENT_TO_SERVER
Definition
PacketLog.h:28
PacketLog
Definition
PacketLog.h:35
PacketLog::_file
FILE * _file
Definition
PacketLog.h:50
PacketLog::CanLogPacket
bool CanLogPacket() const
Definition
PacketLog.h:46
PacketLog::_initializeFlag
std::once_flag _initializeFlag
Definition
PacketLog.h:40
PacketLog::_logPacketLock
std::mutex _logPacketLock
Definition
PacketLog.h:39
WorldPacket
Definition
WorldPacket.h:27
server
game
Server
Protocol
PacketLog.h
Generated on Sun May 10 2026 02:30:17 for TrinityCore by
1.9.8