Pol  Revision:f37d500
packets.h
Go to the documentation of this file.
1 
7 #ifndef POL_PACKETS_H
8 #define POL_PACKETS_H
9 
10 #include <boost/noncopyable.hpp>
11 #include <cstring>
12 #include <limits>
13 #include <map>
14 #include <memory>
15 #include <mutex>
16 #include <queue>
17 #include <string.h>
18 #include <type_traits>
19 
20 #include "../../clib/clib_endian.h"
21 #include "../../clib/compilerspecifics.h"
22 #include "../../clib/logfacility.h"
23 #include "../../clib/passert.h"
24 #include "../../clib/rawtypes.h"
25 #include "../../clib/spinlock.h"
26 #include "../../clib/strutil.h"
27 #include "../layers.h"
28 #include "../pktboth.h"
29 #include "../pktbothid.h"
30 #include "../pktdef.h"
31 #include "../pktoutid.h"
32 #include "../realms.h"
33 #include "../uconst.h"
34 #include "packetinterface.h"
35 
36 namespace Pol
37 {
38 namespace Network
39 {
40 #define MAX_PACKETS_INSTANCES 100
41 namespace PacketWriterDefs
42 {
43 // "normal" packet queue
45 {
46 public:
48  virtual ~PacketQueueSingle();
49 
50 private:
53 
54 public:
55  virtual PacketInterface* GetNext( u8 id, u16 sub = 0 ) POL_OVERRIDE;
56  virtual void Add( PacketInterface* pkt ) POL_OVERRIDE;
57  virtual size_t Count() const POL_OVERRIDE { return _packets.size(); };
58  virtual size_t estimateSize() const POL_OVERRIDE;
59 };
60 
61 // packet with subs queue
63 {
64 public:
66  virtual ~PacketQueueSubs();
67 
68 private:
71 
72 public:
73  virtual PacketInterface* GetNext( u8 id, u16 sub = 0 ) POL_OVERRIDE;
74  virtual void Add( PacketInterface* pkt ) POL_OVERRIDE;
75  virtual size_t Count() const POL_OVERRIDE;
76  virtual bool HasSubs() const POL_OVERRIDE { return true; };
78  virtual size_t estimateSize() const POL_OVERRIDE;
79 };
80 
81 // wierdo generic template definitions for packets
82 namespace PktWriterTemplateSpecs
83 {
84 template <typename T>
86 {
87 public:
88  static void Write( T x, char buffer[], u16& offset ); // linker error
89  static void WriteFlipped( T x, char buffer[], u16& offset );
90 };
91 
92 template <>
94 {
95 public:
96  static void Write( u32 x, char buffer[], u16& offset )
97  {
98  std::memcpy( &buffer[offset], &x, sizeof( x ) );
99  offset += 4;
100  };
101  static void WriteFlipped( u32 x, char buffer[], u16& offset )
102  {
103  x = cfBEu32( x );
104  std::memcpy( &buffer[offset], &x, sizeof( x ) );
105  offset += 4;
106  };
107 };
108 template <>
110 {
111  static void Write( s32 x, char buffer[], u16& offset )
112  {
113  std::memcpy( &buffer[offset], &x, sizeof( x ) );
114  offset += 4;
115  };
116  static void WriteFlipped( s32 x, char buffer[], u16& offset )
117  {
118  x = cfBEu32( x );
119  std::memcpy( &buffer[offset], &x, sizeof( x ) );
120  offset += 4;
121  };
122 };
123 template <>
125 {
126  static void Write( u16 x, char buffer[], u16& offset )
127  {
128  std::memcpy( &buffer[offset], &x, sizeof( x ) );
129  offset += 2;
130  };
131  static void WriteFlipped( u16 x, char buffer[], u16& offset )
132  {
133  x = cfBEu16( x );
134  std::memcpy( &buffer[offset], &x, sizeof( x ) );
135  offset += 2;
136  };
137 };
138 template <>
140 {
141  static void Write( s16 x, char buffer[], u16& offset )
142  {
143  std::memcpy( &buffer[offset], &x, sizeof( x ) );
144  offset += 2;
145  };
146  static void WriteFlipped( s16 x, char buffer[], u16& offset )
147  {
148  x = cfBEu16( x );
149  std::memcpy( &buffer[offset], &x, sizeof( x ) );
150  offset += 2;
151  };
152 };
153 template <>
155 {
156  static void Write( u8 x, char buffer[], u16& offset ) { buffer[offset++] = x; }
157  static void WriteFlipped( u8 x, char buffer[], u16& offset ) { buffer[offset++] = x; }
158 };
159 template <>
161 {
162  static void Write( s8 x, char buffer[], u16& offset ) { buffer[offset++] = x; };
163  static void WriteFlipped( s8 x, char buffer[], u16& offset ) { buffer[offset++] = x; };
164 };
165 }
166 
167 // "writer"class
168 template <u8 _id, u16 _size, u16 _sub = 0>
170 {
171 public:
172  static const u8 ID = _id;
173  static const u16 SUB = _sub;
174  static const u16 SIZE = _size;
175  char buffer[SIZE];
176  virtual char* getBuffer() POL_OVERRIDE { return &buffer[offset]; };
177  virtual inline u8 getID() const POL_OVERRIDE { return ID; };
178  virtual inline u16 getSize() const POL_OVERRIDE { return SIZE; };
179  virtual size_t estimateSize() const POL_OVERRIDE { return SIZE + sizeof( PacketInterface ); };
180  // ---- Buffer Write Methods ----
181  // N is the argument which will be static_cast to T
182  // Two versions exists: T equals N only check if its integer or enum
183  // T != N same check as above plus signed compare and during runtime max check
184  // Todo instead of disallowing signed differences perform more magic to safely check the limits?
185  template <class T, typename N>
186  typename std::enable_if<std::is_same<T, N>::value, void>::type Write( N x )
187  {
188  static_assert( std::is_integral<N>::value || std::is_enum<N>::value,
189  "Invalid argument type integral type is needed!" );
190  passert_always_r( offset + sizeof( T ) <= SIZE, "pkt " + Clib::hexint( ID ) );
192  };
193  template <class T, typename N>
194  typename std::enable_if<!std::is_same<T, N>::value, void>::type Write( N x )
195  {
196  static_assert( std::is_integral<N>::value || std::is_enum<N>::value,
197  "Invalid argument type integral type is needed!" );
198  static_assert( std::is_signed<T>::value == std::is_signed<N>::value,
199  "Signed/Unsigned missmatch!" );
200  // passert_always_r((std::numeric_limits<T>::max() >= x), "Number is bigger then desired type!"
201  // );
202  passert_always_r( offset + sizeof( T ) <= SIZE, "pkt " + Clib::hexint( ID ) );
203  if ( std::numeric_limits<T>::max() < x ) // dont let the shard crash, a warning is better
204  {
205  POLLOG_ERROR.Format(
206  "ERROR: Write: trying to write {} on offset {} for pkt 0x{:X}/0x{:X} and only {} is "
207  "allowed!\n" )
208  << x << offset << (int)ID << SUB << std::numeric_limits<T>::max();
209  PktWriterTemplateSpecs::WriteHelper<T>::Write( std::numeric_limits<T>::max(), buffer,
210  offset );
211  }
212  else
213  PktWriterTemplateSpecs::WriteHelper<T>::Write( static_cast<T>( x ), buffer, offset );
214  };
215 
216  template <class T, typename N>
217  typename std::enable_if<std::is_same<T, N>::value, void>::type WriteFlipped( N x )
218  {
219  static_assert( std::is_integral<N>::value || std::is_enum<N>::value,
220  "Invalid argument type integral type is needed!" );
221  passert_always_r( offset + sizeof( T ) <= SIZE, "pkt " + Clib::hexint( ID ) );
223  };
224 
225  template <class T, typename N>
226  typename std::enable_if<!std::is_same<T, N>::value, void>::type WriteFlipped( N x )
227  {
228  static_assert( std::is_integral<N>::value || std::is_enum<N>::value,
229  "Invalid argument type integral type is needed!" );
230  static_assert( std::is_signed<T>::value == std::is_signed<N>::value,
231  "Signed/Unsigned missmatch!" );
232  // passert_always_r((std::numeric_limits<T>::max() >= x), "Number is bigger then desired type!"
233  // );
234  passert_always_r( offset + sizeof( T ) <= SIZE, "pkt " + Clib::hexint( _id ) );
235  if ( std::numeric_limits<T>::max() < x ) // dont let the shard crash, a warning is better
236  {
237  POLLOG_ERROR.Format(
238  "ERROR: WriteFlipped: trying to write {} on offset {} for pkt 0x{:X}/0x{:X} and only {} "
239  "is allowed!\n" )
240  << x << offset << (int)ID << SUB << std::numeric_limits<T>::max();
241  PktWriterTemplateSpecs::WriteHelper<T>::WriteFlipped( std::numeric_limits<T>::max(), buffer,
242  offset );
243  }
244  else
245  PktWriterTemplateSpecs::WriteHelper<T>::WriteFlipped( static_cast<T>( x ), buffer, offset );
246  };
247 
248  void Write( const char* x, u16 len, bool nullterm = true )
249  {
250  if ( len < 1 )
251  return;
252  passert_always_r( offset + len <= SIZE, "pkt " + Clib::hexint( ID ) );
253  strncpy( &buffer[offset], x, nullterm ? len - 1 : len );
254  offset += len;
255  };
256  void Write( u8 x[], u16 len )
257  {
258  if ( len < 1 )
259  return;
260  passert_always_r( offset + len <= SIZE, "pkt " + Clib::hexint( ID ) );
261  memcpy( &buffer[offset], x, len );
262  offset += len;
263  };
264  void Write( const u16* x, u16 len, bool nullterm = true )
265  {
266  passert_always_r( offset + len * 2 <= SIZE, "pkt " + Clib::hexint( ID ) );
267  std::memcpy( &buffer[offset], x, 2 * len );
268  offset += len * 2;
269  if ( nullterm )
270  {
271  passert_always_r( offset + 2 <= SIZE, "pkt " + Clib::hexint( ID ) );
272  offset += 2;
273  }
274  };
275  void WriteFlipped( const u16* x, u16 len, bool nullterm = true )
276  {
277  passert_always_r( offset + len * 2 <= SIZE, "pkt " + Clib::hexint( ID ) );
278  s32 signedlen = static_cast<s32>( len );
279  while ( signedlen-- > 0 )
280  {
281  u16 tmp = ctBEu16( *x );
282  std::memcpy( &buffer[offset], &tmp, 2 );
283  ++x;
284  offset += 2;
285  }
286  if ( nullterm )
287  {
288  passert_always_r( offset + 2 <= SIZE, "pkt " + Clib::hexint( ID ) );
289  offset += 2;
290  }
291  };
292 };
293 
294 // "normal" pkt
295 template <u8 _id, u16 _size>
296 class PacketTemplate : public PacketWriter<_id, _size>
297 {
298 public:
299  PacketTemplate() { ReSetBuffer(); };
300  virtual void ReSetBuffer() POL_OVERRIDE
301  {
302  memset( PacketWriter<_id, _size>::buffer, 0, _size );
305  };
306 };
307 
308 // sub packet
309 template <u8 _id, u16 _suboff, u16 _sub, u16 _size>
310 class PacketTemplateSub : public PacketWriter<_id, _size, _sub>
311 {
312 public:
313  PacketTemplateSub() { ReSetBuffer(); };
314  virtual void ReSetBuffer() POL_OVERRIDE
315  {
316  memset( PacketWriter<_id, _size, _sub>::buffer, 0, _size );
318  ( *(u16*)(void*)&PacketWriter<_id, _size, _sub>::buffer[_suboff] ) = cfBEu16( _sub );
320  };
321  virtual inline u16 getSubID() const POL_OVERRIDE { return _sub; };
322 };
323 
324 // special def for encrypted buffer
325 template <u8 _id, u16 _size>
327 {
328 public:
329  static const u8 ID = _id;
330  static const u8 SUB = 0;
331  static const u16 SIZE = _size;
332  EmptyBufferTemplate() { ReSetBuffer(); };
333  char buffer[SIZE];
334  virtual void ReSetBuffer() POL_OVERRIDE
335  {
336  memset( buffer, 0, SIZE );
337  offset = 0;
338  };
339  virtual char* getBuffer() POL_OVERRIDE { return &buffer[offset]; };
340  virtual inline u8 getID() const POL_OVERRIDE { return ID; };
341  virtual inline u16 getSize() const POL_OVERRIDE { return SIZE; };
342  virtual size_t estimateSize() const POL_OVERRIDE { return SIZE + sizeof( PacketInterface ); };
343 };
344 }
345 
346 
347 // buffer for encrypted Data send with a dummy pktid
348 // NOTE: redefine id if pkt 0x0 ever gets send
349 #define ENCRYPTEDPKTBUFFER static_cast<u8>( 0 )
350 
351 // Packet defs start
353 
364 // HSA 9 old 7
399  7 + ( 5 * ( Core::NUM_LAYERS + 1 ) ) + 1>
406 // HSA 30 old 26
427 // HSA 10 old 6
430 
432  5 + 8>
435  0xFFFF>
438  5 + 1>
441  5 + 8>
447  5 + 8>
465  5 + 6>
470 
476  49 + ( SPEECH_MAX_LEN + 1 ) * 2 + SPEECH_MAX_LEN + 1>
484 // HSA 26 old 24
489 // Packet defs end
490 }
491 }
492 #endif
virtual void ReSetBuffer() POL_OVERRIDE
Definition: packets.h:300
std::enable_if<!std::is_same< T, N >::value, void >::type WriteFlipped(N x)
Definition: packets.h:226
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_CLOSE_GUMP, 5+8 > PktOut_BF_Sub4
Definition: packets.h:433
unsigned char u8
Definition: rawtypes.h:25
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_EXTENDED_STATS_OUT, 5+7 > PktOut_BF_Sub19
Definition: packets.h:454
std::queue< PacketInterface * > PacketInterfaceQueue
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_ACTIVATE_CUSTOM_HOUSE_TOOL, 5+12 > PktOut_BF_Sub20
Definition: packets.h:463
PacketWriterDefs::PacketTemplate< Core::PKTOUT_82_ID, 2 > PktOut_82
Definition: packets.h:396
PacketWriterDefs::PacketTemplate< Core::PKTOUT_1B_ID, 37 > PktOut_1B
Definition: packets.h:358
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A5_ID, URL_MAX_LEN+4 > PktOut_A5
Definition: packets.h:413
PacketWriterDefs::PacketTemplate< Core::PKTOUT_74_ID, 0xFFFF > PktOut_74
Definition: packets.h:390
PacketWriterDefs::PacketTemplate< Core::PKTOUT_55_ID, 1 > PktOut_55
Definition: packets.h:380
#define POL_OVERRIDE
PacketWriterDefs::PacketTemplate< Core::PKTBI_56_ID, 11 > PktOut_56
Definition: packets.h:381
static void WriteFlipped(s16 x, char buffer[], u16 &offset)
Definition: packets.h:146
PacketWriterDefs::PacketTemplate< Core::PKTOUT_11_ID, 121 > PktOut_11
Definition: packets.h:355
std::enable_if< std::is_same< T, N >::value, void >::type Write(N x)
Definition: packets.h:186
PacketWriterDefs::PacketTemplate< Core::PKTOUT_1A_ID, 20 > PktOut_1A
Definition: packets.h:357
PacketWriterDefs::PacketTemplate< Core::PKTOUT_E2_ID, 10 > PktOut_E2
Definition: packets.h:482
virtual char * getBuffer() POL_OVERRIDE
Definition: packets.h:176
PacketWriterDefs::PacketTemplate< Core::PKTOUT_1C_ID, 44+SPEECH_MAX_LEN+1 > PktOut_1C
Definition: packets.h:359
PacketWriterDefs::PacketTemplate< Core::PKTOUT_AB_ID, 531 > PktOut_AB
Definition: packets.h:418
PacketWriterDefs::PacketTemplate< Core::PKTBI_93_ID, 99 > PktOut_93
Definition: packets.h:403
PacketWriterDefs::PacketTemplate< Core::PKTOUT_AF_ID, 13 > PktOut_AF
Definition: packets.h:421
PacketWriterDefs::PacketTemplate< Core::PKTBI_99_ID, 30 > PktOut_99
Definition: packets.h:407
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A2_ID, 9 > PktOut_A2
Definition: packets.h:411
PacketWriterDefs::PacketTemplate< Core::PKTOUT_21_ID, 8 > PktOut_21
Definition: packets.h:362
static void Write(s8 x, char buffer[], u16 &offset)
Definition: packets.h:162
static void WriteFlipped(u8 x, char buffer[], u16 &offset)
Definition: packets.h:157
virtual u8 getID() const POL_OVERRIDE
Definition: packets.h:340
void Write(const u16 *x, u16 len, bool nullterm=true)
Definition: packets.h:264
#define cfBEu32(x)
Definition: clib_endian.h:43
virtual PacketInterfaceQueueMap * GetSubs() POL_OVERRIDE
Definition: packets.h:77
PacketWriterDefs::PacketTemplate< Core::PKTOUT_E3_ID, 77 > PktOut_E3
Definition: packets.h:483
#define SPEECH_MAX_LEN
Definition: pktdef.h:27
PacketWriterDefs::PacketTemplate< Core::PKTOUT_BC_ID, 3 > PktOut_BC
Definition: packets.h:429
void Write(const char *x, u16 len, bool nullterm=true)
Definition: packets.h:248
PacketWriterDefs::PacketTemplate< Core::PKTBI_B8_OUT_ID, 7+5 *(SPEECH_MAX_LEN+1)> PktOut_B8
Definition: packets.h:425
#define ctBEu16(x)
Definition: clib_endian.h:46
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_CHARACTER_RACE_CHANGER, 5+2 > PktOut_BF_Sub2A
Definition: packets.h:469
PacketWriterDefs::PacketTemplate< Core::PKTBI_98_OUT_ID, 37 > PktOut_98
Definition: packets.h:405
PacketWriterDefs::PacketTemplate< Core::PKTBI_66_ID, 0xFFFF > PktOut_66
Definition: packets.h:383
virtual size_t estimateSize() const POL_OVERRIDE
Definition: packets.cpp:204
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_CURSOR_HUE, 5+1 > PktOut_BF_Sub8
Definition: packets.h:439
PacketWriterDefs::PacketTemplate< Core::PKTBI_3B_ID, 8 > PktOut_3B
Definition: packets.h:374
virtual u16 getSubID() const POL_OVERRIDE
Definition: packets.h:321
std::map< u16, PacketInterfaceQueue > PacketInterfaceQueueMap
PacketWriterDefs::PacketTemplate< Core::PKTOUT_1D_ID, 5 > PktOut_1D
Definition: packets.h:360
PacketWriterDefs::PacketTemplate< Core::PKTBI_2C_ID, 2 > PktOut_2C
Definition: packets.h:369
#define POLLOG_ERROR
Definition: logfacility.h:207
PacketWriterDefs::PacketTemplate< Core::PKTOUT_DF_ID, 0xFFFF > PktOut_DF
Definition: packets.h:481
PacketWriterDefs::PacketTemplate< Core::PKTOUT_DD_ID, 0xFFFF > PktOut_DD
Definition: packets.h:480
PacketWriterDefs::PacketTemplate< Core::PKTOUT_6D_ID, 3 > PktOut_6D
Definition: packets.h:385
PacketWriterDefs::PacketTemplate< Core::PKTOUT_29_ID, 1 > PktOut_29
Definition: packets.h:368
virtual void Add(PacketInterface *pkt) POL_OVERRIDE
Definition: packets.cpp:193
PacketWriterDefs::PacketTemplate< Core::PKTOUT_78_ID, 19+(9 *Core::HIGHEST_LAYER)+4 > PktOut_78
Definition: packets.h:394
PacketWriterDefs::PacketTemplate< Core::PKTBI_D6_OUT_ID, 0xFFFF > PktOut_D6
Definition: packets.h:478
virtual size_t estimateSize() const POL_OVERRIDE
Definition: packets.h:342
virtual u16 getSize() const POL_OVERRIDE
Definition: packets.h:178
virtual u8 getID() const POL_OVERRIDE
Definition: packets.h:177
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_CLOSE_WINDOW, 5+8 > PktOut_BF_Sub16
Definition: packets.h:448
PacketWriterDefs::PacketTemplate< Core::PKTOUT_BA_ID, 10 > PktOut_BA
Definition: packets.h:428
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A9_ID, 10000 > PktOut_A9
Definition: packets.h:416
std::string hexint(unsigned short v)
Definition: strutil.cpp:23
virtual size_t estimateSize() const POL_OVERRIDE
Definition: packets.h:179
unsigned short u16
Definition: rawtypes.h:26
unsigned char buffer[10000]
Definition: UoToolMain.cpp:109
unsigned int u32
Definition: rawtypes.h:27
PacketWriterDefs::PacketTemplate< Core::PKTOUT_89_ID, 7+(5 *(Core::NUM_LAYERS+1))+1 > PktOut_89
Definition: packets.h:400
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_OBJECT_CACHE, 5+8 > PktOut_BF_Sub10
Definition: packets.h:442
std::enable_if< std::is_same< T, N >::value, void >::type WriteFlipped(N x)
Definition: packets.h:217
signed short s16
Definition: rawtypes.h:30
PacketWriterDefs::PacketTemplate< Core::PKTBI_6C_ID, 19 > PktOut_6C
Definition: packets.h:384
PacketWriterDefs::PacketTemplate< Core::PKTOUT_88_ID, 66 > PktOut_88
Definition: packets.h:397
virtual char * getBuffer() POL_OVERRIDE
Definition: packets.h:339
PacketWriterDefs::PacketTemplate< Core::PKTOUT_AA_ID, 5 > PktOut_AA
Definition: packets.h:417
virtual bool HasSubs() const
PacketWriterDefs::PacketTemplate< Core::PKTOUT_8C_ID, 11 > PktOut_8C
Definition: packets.h:401
PacketWriterDefs::PacketTemplate< Core::PKTOUT_2E_ID, 15 > PktOut_2E
Definition: packets.h:371
PacketWriterDefs::PacketTemplate< Core::PKTOUT_2D_ID, 17 > PktOut_2D
Definition: packets.h:370
static void Write(s32 x, char buffer[], u16 &offset)
Definition: packets.h:111
PacketWriterDefs::PacketTemplate< Core::PKTOUT_25_ID, 21 > PktOut_25
Definition: packets.h:366
PacketWriterDefs::PacketTemplate< Core::PKTOUT_77_ID, 17 > PktOut_77
Definition: packets.h:392
std::enable_if<!std::is_same< T, N >::value, void >::type Write(N x)
Definition: packets.h:194
static void Write(u32 x, char buffer[], u16 &offset)
Definition: packets.h:96
static void WriteFlipped(u16 x, char buffer[], u16 &offset)
Definition: packets.h:131
PacketWriterDefs::PacketTemplate< Core::PKTOUT_9E_ID, 0xFFFF > PktOut_9E
Definition: packets.h:409
#define MAX_NUMER_REALMS
Definition: realms.h:31
static void Write(u8 x, char buffer[], u16 &offset)
Definition: packets.h:156
PacketWriterDefs::PacketTemplate< Core::PKTBI_C2_ID, 21 > PktOut_C2
Definition: packets.h:473
virtual void ReSetBuffer() POL_OVERRIDE
Definition: packets.h:314
PacketWriterDefs::PacketTemplate< Core::PKTBI_3A_ID, 6+100 *9 > PktOut_3A
Definition: packets.h:373
PacketWriterDefs::PacketTemplate< Core::PKTBI_72_ID, 5 > PktOut_72
Definition: packets.h:389
static void Write(s16 x, char buffer[], u16 &offset)
Definition: packets.h:141
PacketWriterDefs::PacketTemplate< Core::PKTOUT_53_ID, 2 > PktOut_53
Definition: packets.h:378
signed int s32
Definition: rawtypes.h:31
PacketWriterDefs::PacketTemplate< Core::PKTOUT_2F_ID, 10 > PktOut_2F
Definition: packets.h:372
PacketWriterDefs::PacketTemplate< Core::PKTOUT_F6_ID, 0xFFFF > PktOut_F6
Definition: packets.h:487
#define cfBEu16(x)
Definition: clib_endian.h:44
PacketWriterDefs::PacketTemplate< Core::PKTOUT_B0_ID, 0xFFFF > PktOut_B0
Definition: packets.h:422
signed char s8
Definition: rawtypes.h:29
PacketWriterDefs::PacketTemplate< Core::PKTOUT_C1_ID, 48+(SPEECH_MAX_LEN+1)+2 > PktOut_C1
Definition: packets.h:472
virtual size_t Count() const POL_OVERRIDE
Definition: packets.h:57
PacketWriterDefs::PacketTemplate< Core::PKTOUT_6E_ID, 14 > PktOut_6E
Definition: packets.h:386
static void WriteFlipped(s32 x, char buffer[], u16 &offset)
Definition: packets.h:116
PacketWriterDefs::PacketTemplate< Core::PKTOUT_70_ID, 28 > PktOut_70
Definition: packets.h:388
PacketWriterDefs::PacketTemplate< Core::PKTOUT_AE_ID,(SPEECH_MAX_LEN+1)*2+48 > PktOut_AE
Definition: packets.h:420
PacketWriterDefs::PacketTemplate< Core::PKTOUT_3C_ID, 5+MAX_CONTAINER_ITEMS *20 > PktOut_3C
Definition: packets.h:376
PacketWriterDefs::EmptyBufferTemplate< ENCRYPTEDPKTBUFFER, 0xFFFF > EncryptedPktBuffer
Definition: packets.h:352
PacketWriterDefs::PacketTemplate< Core::PKTOUT_C7_ID, 49 > PktOut_C7
Definition: packets.h:474
PacketWriterDefs::PacketTemplate< Core::PKTBI_95_ID, 9 > PktOut_95
Definition: packets.h:404
#define passert_always_r(exp, reason)
Definition: passert.h:84
PacketWriterDefs::PacketTemplate< Core::PKTOUT_20_ID, 19 > PktOut_20
Definition: packets.h:361
static void WriteFlipped(T x, char buffer[], u16 &offset)
virtual u16 getSize() const POL_OVERRIDE
Definition: packets.h:341
PacketWriterDefs::PacketTemplate< Core::PKTOUT_F3_ID, 26 > PktOut_F3
Definition: packets.h:485
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_DAMAGE, 5+6 > PktOut_BF_Sub22
Definition: packets.h:466
PacketWriterDefs::PacketTemplate< Core::PKTOUT_65_ID, 4 > PktOut_65
Definition: packets.h:382
static void Write(u16 x, char buffer[], u16 &offset)
Definition: packets.h:126
PacketWriterDefs::PacketTemplate< Core::PKTBI_6F_ID, 47 > PktOut_6F
Definition: packets.h:387
PacketWriterDefs::PacketTemplate< Core::PKTOUT_7C_ID, 2000 > PktOut_7C
Definition: packets.h:395
void WriteFlipped(const u16 *x, u16 len, bool nullterm=true)
Definition: packets.h:275
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A8_ID, 2000 > PktOut_A8
Definition: packets.h:415
PacketWriterDefs::PacketTemplate< Core::PKTOUT_DC_ID, 9 > PktOut_DC
Definition: packets.h:479
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A6_ID, 10010 > PktOut_A6
Definition: packets.h:414
PacketWriterDefs::PacketTemplate< Core::PKTOUT_54_ID, 12 > PktOut_54
Definition: packets.h:379
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_PARTY_SYSTEM, 0xFFFF > PktOut_BF_Sub6
Definition: packets.h:436
PacketWriterDefs::PacketTemplate< Core::PKTOUT_0B_ID, 7 > PktOut_0B
Definition: packets.h:354
static void Write(T x, char buffer[], u16 &offset)
PacketWriterDefs::PacketTemplate< Core::PKTOUT_90_ID, 19 > PktOut_90
Definition: packets.h:402
static void WriteFlipped(s8 x, char buffer[], u16 &offset)
Definition: packets.h:163
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A3_ID, 9 > PktOut_A3
Definition: packets.h:412
PacketWriterDefs::PacketTemplate< Core::PKTOUT_4F_ID, 2 > PktOut_4F
Definition: packets.h:377
PacketWriterDefs::PacketTemplate< Core::PKTBI_9A_ID, 16 > PktOut_9A
Definition: packets.h:408
virtual PacketInterface * GetNext(u8 id, u16 sub=0) POL_OVERRIDE
Definition: packets.cpp:165
PacketWriterDefs::PacketTemplate< Core::PKTOUT_B7_ID, 521 > PktOut_B7
Definition: packets.h:423
PacketWriterDefs::PacketTemplate< Core::PKTOUT_76_ID, 16 > PktOut_76
Definition: packets.h:391
PacketWriterDefs::PacketTemplate< Core::PKTOUT_A1_ID, 9 > PktOut_A1
Definition: packets.h:410
PacketWriterDefs::PacketTemplate< Core::PKTBI_22_APPROVED_ID, 3 > PktOut_22
Definition: packets.h:363
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_ENABLE_MAP_DIFFS, 5+4+MAX_NUMER_REALMS *8 > PktOut_BF_Sub18
Definition: packets.h:451
PacketWriterDefs::PacketTemplate< Core::PKTOUT_27_ID, 2 > PktOut_27
Definition: packets.h:367
PacketWriterDefs::PacketTemplate< Core::PKTOUT_F7_ID, 0xFFFF > PktOut_F7
Definition: packets.h:488
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_NEW_SPELLBOOK, 5+18 > PktOut_BF_Sub1B
Definition: packets.h:457
PacketWriterDefs::PacketTemplate< Core::PKTOUT_B9_ID, 5 > PktOut_B9
Definition: packets.h:426
static void WriteFlipped(u32 x, char buffer[], u16 &offset)
Definition: packets.h:101
PacketWriterDefs::PacketTemplate< Core::PKTOUT_17_ID, 12 > PktOut_17
Definition: packets.h:356
Definition: berror.cpp:12
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_CUSTOM_HOUSE_SHORT, 5+8 > PktOut_BF_Sub1D
Definition: packets.h:460
PacketWriterDefs::PacketTemplate< Core::PKTOUT_F5_ID, 21 > PktOut_F5
Definition: packets.h:486
PacketWriterDefs::PacketTemplateSub< Core::PKTBI_BF_ID, 3, Core::PKTBI_BF::TYPE_DISPLAY_POPUP_MENU, 0xFFFF > PktOut_BF_Sub14
Definition: packets.h:445
PacketWriterDefs::PacketTemplate< Core::PKTOUT_24_ID, 9 > PktOut_24
Definition: packets.h:365