TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PacketLog.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 "Opcodes.h"
23 
24 #include <boost/asio/ip/address.hpp>
25 #include <mutex>
26 
28 {
31 };
32 
33 class WorldPacket;
34 
36 {
37  private:
38  PacketLog();
39  ~PacketLog();
40  std::mutex _logPacketLock;
41  std::once_flag _initializeFlag;
42 
43  public:
44  static PacketLog* instance();
45 
46  void Initialize();
47  bool CanLogPacket() const { return (_file != NULL); }
48  void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address const& addr, uint16 port, ConnectionType connectionType);
49 
50  private:
51  FILE* _file;
52 };
53 
54 #define sPacketLog PacketLog::instance()
55 #endif
std::once_flag _initializeFlag
Definition: PacketLog.h:41
FILE * _file
Definition: PacketLog.h:51
arena_t NULL
Definition: jemalloc_internal.h:624
bool CanLogPacket() const
Definition: PacketLog.h:47
static void Initialize(PCASC_SALSA20 pState, LPBYTE pbKey, DWORD cbKeyLength, LPBYTE pbVector)
Definition: CascDecrypt.cpp:81
uint16_t uint16
Definition: Define.h:151
Definition: PacketLog.h:30
Definition: PacketLog.h:29
Definition: PacketLog.h:35
#define TC_GAME_API
Definition: Define.h:134
std::mutex _logPacketLock
Definition: PacketLog.h:40
Definition: WorldPacket.h:26
ConnectionType
Definition: Opcodes.h:29
Direction
Definition: PacketLog.h:27