Pol  Revision:3cfda13
packethooks.h
Go to the documentation of this file.
1 
13 #ifndef PACKETHOOKS_H
14 #define PACKETHOOKS_H
15 
16 #include <map>
17 #include <string>
18 #include <vector>
19 
20 #include "client.h"
21 #include "msghandl.h"
22 
23 template <class T>
24 class ref_ptr;
25 
26 namespace Pol
27 {
28 namespace Core
29 {
30 class BPacket;
31 class ExportedFunction;
32 }
33 namespace Network
34 {
36 {
37 public:
39  ~PacketHookData();
40  size_t estimateSize() const;
41 
42  int length; // if MSGLEN_2BYTELEN_DATA, variable length
45 
47 
48  unsigned short sub_command_offset;
49  unsigned short sub_command_length;
52  std::map<u32, PacketHookData*> SubCommands;
53 
54  static void initializeGameData( std::vector<std::unique_ptr<PacketHookData>>* data );
55 };
56 
57 void load_packet_hooks();
58 void ExportedPacketHookHandler( Client* client, void* data );
59 void CallOutgoingPacketExportedFunction( Client* client, const void*& data, int& inlength,
60  ref_ptr<Core::BPacket>& outpacket, PacketHookData* phd,
61  bool& handled );
62 bool GetAndCheckPacketHooked( Client* client, const void*& data, PacketHookData*& phd );
63 void clean_packethooks();
64 
65 void SetVersionDetailStruct( const std::string& ver, VersionDetailStruct& detail );
67 }
68 }
69 #endif
PktHandlerFunc default_handler
Definition: packethooks.h:46
void CallOutgoingPacketExportedFunction(Client *client, const void *&data, int &inlength, ref_ptr< Core::BPacket > &outpacket, PacketHookData *phd, bool &handled)
void(* PktHandlerFunc)(Client *client, void *msg)
Definition: msghandl.h:29
VersionDetailStruct client_ver
Definition: packethooks.h:51
void SetVersionDetailStruct(const std::string &ver, VersionDetailStruct &detail)
bool GetAndCheckPacketHooked(Client *client, const void *&data, PacketHookData *&phd)
Definition: refptr.h:64
void ExportedPacketHookHandler(Client *client, void *data)
Definition: packethooks.cpp:83
std::unordered_map< u64, ScriptDiffData > data
Definition: osmod.cpp:966
unsigned short sub_command_offset
Definition: packethooks.h:48
Core::ExportedFunction * outgoing_function
Definition: packethooks.h:44
unsigned short sub_command_length
Definition: packethooks.h:49
std::map< u32, PacketHookData * > SubCommands
Definition: packethooks.h:52
void load_packet_hooks()
bool CompareVersionDetail(VersionDetailStruct ver1, VersionDetailStruct ver2)
Definition: berror.cpp:12
void clean_packethooks()