--- deliantra/server/include/network.h 2006/12/22 02:04:20 1.6 +++ deliantra/server/include/network.h 2007/05/28 21:15:56 1.12 @@ -1,26 +1,26 @@ /* - CrossFire, A Multiplayer game for X-windows - - Copyright (C) 1992 Frank Tore Johansen - Copyright (C) 2002 Mark Wedel & Crossfire Development Team - Copyright (C) 2005, 2006 The Crossfire+ Development Team - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - The authors can be reached via e-mail at crossfire@schmorp.de -*/ + * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. + * + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen + * + * Crossfire TRT is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * The authors can be reached via e-mail to + */ /* This file defines various flags that both the new client and * newserver uses. These should never be changed, only expanded. @@ -260,6 +260,14 @@ data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } }; +struct ber32 +{ + enum { size = 5 }; // maximum length of an encoded ber32 + uint32 val; + + ber32 (uint32 val) : val (val) { } +}; + /* Contains the base information we use to make up a packet we want to send. */ struct packet { @@ -301,12 +309,15 @@ packet &operator <<(sint64 v) { return *this << (uint64)v; } // checked + packet &operator <<(const ber32 v); + packet &operator <<(const data &v); packet &operator <<(const data8 &v); packet &operator <<(const data16 &v); packet &operator <<(const char *v); packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); } + packet &operator <<(const std::string &s) { return *this << data (s.data (), s.size ()); } void vprintf (const char *format, va_list ap);