ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/network.h
(Generate patch)

Comparing deliantra/server/include/network.h (file contents):
Revision 1.8 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.10 by root, Tue Apr 10 09:35:23 2007 UTC

258 data16 (const void *ptr, int len) : len (len), ptr (ptr) { } 258 data16 (const void *ptr, int len) : len (len), ptr (ptr) { }
259 data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } 259 data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
260 data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } 260 data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { }
261}; 261};
262 262
263struct ber32
264{
265 enum { size = 5 }; // maximum length of an encoded ber32
266 uint32 val;
267
268 ber32 (uint32 val) : val (val) { }
269};
270
263/* Contains the base information we use to make up a packet we want to send. */ 271/* Contains the base information we use to make up a packet we want to send. */
264struct packet 272struct packet
265{ 273{
266 enum { bufsize = MAXSOCKBUF }; 274 enum { bufsize = MAXSOCKBUF };
267 enum { hdrlen = 2 }; // keep this many bytes free at the front 275 enum { hdrlen = 2 }; // keep this many bytes free at the front
299 packet &operator <<(sint16 v) { return *this << (uint16)v; } 307 packet &operator <<(sint16 v) { return *this << (uint16)v; }
300 packet &operator <<(sint32 v) { return *this << (uint32)v; } 308 packet &operator <<(sint32 v) { return *this << (uint32)v; }
301 packet &operator <<(sint64 v) { return *this << (uint64)v; } 309 packet &operator <<(sint64 v) { return *this << (uint64)v; }
302 310
303 // checked 311 // checked
312 packet &operator <<(const ber32 v);
313
304 packet &operator <<(const data &v); 314 packet &operator <<(const data &v);
305 packet &operator <<(const data8 &v); 315 packet &operator <<(const data8 &v);
306 packet &operator <<(const data16 &v); 316 packet &operator <<(const data16 &v);
307 317
308 packet &operator <<(const char *v); 318 packet &operator <<(const char *v);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines