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.19 by root, Sun Sep 30 20:22:18 2007 UTC vs.
Revision 1.24 by root, Mon Oct 12 14:00:58 2009 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* This file defines various flags that both the new client and 25/* This file defines various flags that both the new client and
25 * newserver uses. These should never be changed, only expanded. 26 * newserver uses. These should never be changed, only expanded.
26 * Changing them will likely cause all old clients to not work properly. 27 * Changing them will likely cause all old clients to not work properly.
199 unsigned int len; 200 unsigned int len;
200 const void *ptr; 201 const void *ptr;
201 202
202 data (const void *ptr, int len) : len (len), ptr (ptr) { } 203 data (const void *ptr, int len) : len (len), ptr (ptr) { }
203 data (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } 204 data (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
204 data (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } 205 data (shstr_tmp sh) : len (sh.length ()), ptr ((void *)&sh) { }
206 data (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { }
205}; 207};
206 208
207struct data8 209struct data8
208{ 210{
209 unsigned int len; 211 unsigned int len;
210 const void *ptr; 212 const void *ptr;
211 213
212 data8 (const void *ptr, int len) : len (len), ptr (ptr) { } 214 data8 (const void *ptr, int len) : len (len), ptr (ptr) { }
213 data8 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } 215 data8 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
214 data8 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } 216 data8 (shstr_tmp sh) : len (sh.length ()), ptr ((void *)&sh) { }
217 data8 (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { }
215}; 218};
216 219
217struct data16 220struct data16
218{ 221{
219 unsigned int len; 222 unsigned int len;
220 const void *ptr; 223 const void *ptr;
221 224
222 data16 (const void *ptr, int len) : len (len), ptr (ptr) { } 225 data16 (const void *ptr, int len) : len (len), ptr (ptr) { }
223 data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } 226 data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
224 data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } 227 data16 (shstr_tmp sh) : len (sh.length ()), ptr ((void *)&sh) { }
228 data16 (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { }
225}; 229};
226 230
227struct ber32 231struct ber32
228{ 232{
229 enum { size = 5 }; // maximum length of an encoded ber32 233 enum { size = 5 }; // maximum length of an encoded ber32
287 packet &operator <<(const data &v); 291 packet &operator <<(const data &v);
288 packet &operator <<(const data8 &v); 292 packet &operator <<(const data8 &v);
289 packet &operator <<(const data16 &v); 293 packet &operator <<(const data16 &v);
290 294
291 packet &operator <<(const char *v); 295 packet &operator <<(const char *v);
292 packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); } 296 packet &operator <<(shstr_tmp sh) { return *this << data (sh); }
293 packet &operator <<(const std::string &s) { return *this << data (s.data (), s.size ()); } 297 packet &operator <<(const std::string &s) { return *this << data (s.data (), s.size ()); }
294 298
295 void vprintf (const char *format, va_list ap); 299 void vprintf (const char *format, va_list ap);
296 300
297 void printf (const char *format, ...) 301 void printf (const char *format, ...)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines