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.15 by root, Sat Jul 28 12:02:58 2007 UTC vs.
Revision 1.17 by root, Sun Jul 29 19:11:47 2007 UTC

45 45
46#include <cstdarg> 46#include <cstdarg>
47 47
48/* Maximum size of any packet we expect. 48/* Maximum size of any packet we expect.
49 * 49 *
50 * The size must be the same in the server and the client (stupid), and its also NOT 50 * The size must be the same in the server and the client (stupid).
51 * the maximum buffer size as one would expect, but the maximum buffer size + 1. 51 * TODO: make the actual network configurable per clietn and use 2**16.
52 */ 52 */
53#define MAXSOCKBUF 10240 53#define MAXSOCKBUF 10239
54 54
55#define CS_QUERY_YESNO 0x1 /* Yes/no question */ 55#define CS_QUERY_YESNO 0x1 /* Yes/no question */
56#define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */ 56#define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */
57#define CS_QUERY_HIDEINPUT 0x4 /* Hide input being entered */ 57#define CS_QUERY_HIDEINPUT 0x4 /* Hide input being entered */
58 58
267{ 267{
268 enum { size = 5 }; // maximum length of an encoded ber32 268 enum { size = 5 }; // maximum length of an encoded ber32
269 uint32 val; 269 uint32 val;
270 270
271 ber32 (uint32 val) : val (val) { } 271 ber32 (uint32 val) : val (val) { }
272
273 static int encoded_size (uint32 val)
274 {
275 if (val >= (1 << 7*4)) return 5;
276 if (val >= (1 << 7*3)) return 4;
277 if (val >= (1 << 7*2)) return 3;
278 if (val >= (1 << 7*1)) return 2;
279 return 1;
280 }
272}; 281};
273 282
274/* Contains the base information we use to make up a packet we want to send. */ 283/* Contains the base information we use to make up a packet we want to send. */
275struct packet 284struct packet
276{ 285{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines