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.3 by root, Fri Dec 15 20:08:45 2006 UTC vs.
Revision 1.4 by root, Sat Dec 16 03:08:26 2006 UTC

39 * more reliable, as both the client and server will definately be 39 * more reliable, as both the client and server will definately be
40 * talking about the same values. 40 * talking about the same values.
41 */ 41 */
42 42
43 43
44#ifndef NEWCLIENT_H 44#ifndef NETWORK_H
45#define NEWCLIENT_H 45#define NETWORK_H
46
47#include <cstdarg>
46 48
47/* Maximum size of any packet we expect. Using this makes it so we don't need to 49/* Maximum size of any packet we expect. Using this makes it so we don't need to
48 * allocated and deallocated the same buffer over and over again and the price 50 * allocated and deallocated the same buffer over and over again and the price
49 * of using a bit of extra memory. It also makes the code simpler. 51 * of using a bit of extra memory. It also makes the code simpler.
50 * 52 *
306 packet &operator <<(const data16 &v); 308 packet &operator <<(const data16 &v);
307 309
308 packet &operator <<(const char *v); 310 packet &operator <<(const char *v);
309 packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); } 311 packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); }
310 312
313 void vprintf (const char *format, va_list ap);
314
311 void printf (const char *format, ...); 315 void printf (const char *format, ...)
316 {
317 va_list ap;
318 va_start (ap, format);
319 vprintf (format, ap);
320 va_end (ap);
321 }
312}; 322};
313 323
314inline uint16 net_uint16 (uint8 *data) { return (data [0] << 8) | data [1]; } 324inline uint16 net_uint16 (uint8 *data) { return (data [0] << 8) | data [1]; }
315inline uint32 net_uint32 (uint8 *data) { return (net_uint16 (data) << 16) | net_uint16 (data + 2); } 325inline uint32 net_uint32 (uint8 *data) { return (net_uint16 (data) << 16) | net_uint16 (data + 2); }
316inline sint16 net_sint16 (uint8 *data) { return sint16 (net_uint16 (data)); } 326inline sint16 net_sint16 (uint8 *data) { return sint16 (net_uint16 (data)); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines