_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

net_serialization.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
11 //
12 // (c) Copyright 2020 by the Stratagus Developers
13 //
14 // This program is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; only version 2 of the License.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 // 02111-1307, USA.
27 
28 
29 #ifndef NET_SERIALIZATION_H
30 #define NET_SERIALIZATION_H
31 
32 extern size_t serialize32(unsigned char *buf, uint32_t data);
33 extern size_t serialize32(unsigned char *buf, int32_t data);
34 extern size_t serialize16(unsigned char *buf, uint16_t data);
35 extern size_t serialize16(unsigned char *buf, int16_t data);
36 extern size_t serialize8(unsigned char *buf, uint8_t data);
37 extern size_t serialize8(unsigned char *buf, int8_t data);
38 template <int N>
39 extern size_t serialize(unsigned char *buf, const char(&data)[N]);
40 extern size_t serialize(unsigned char *buf, const std::string &s);
41 extern size_t serialize(unsigned char *buf, const std::vector<unsigned char> &data);
42 extern size_t deserialize32(const unsigned char *buf, uint32_t *data);
43 extern size_t deserialize32(const unsigned char *buf, int32_t *data);
44 extern size_t deserialize16(const unsigned char *buf, uint16_t *data);
45 extern size_t deserialize16(const unsigned char *buf, int16_t *data);
46 extern size_t deserialize8(const unsigned char *buf, uint8_t *data);
47 extern size_t deserialize8(const unsigned char *buf, int8_t *data);
48 template <int N>
49 extern size_t deserialize(const unsigned char *buf, char(&data)[N]);
50 extern size_t deserialize(const unsigned char *buf, std::string &s);
51 extern size_t deserialize(const unsigned char *buf, std::vector<unsigned char> &data);
52 
53 #endif
serialize8
size_t serialize8(unsigned char *buf, uint8_t data)
Definition: net_message.cpp:73
deserialize16
size_t deserialize16(const unsigned char *buf, uint16_t *data)
Definition: net_message.cpp:146
deserialize
size_t deserialize(const unsigned char *buf, char(&data)[N])
Definition: net_message.cpp:167
deserialize32
size_t deserialize32(const unsigned char *buf, uint32_t *data)
Definition: net_message.cpp:136
serialize
size_t serialize(unsigned char *buf, const char(&data)[N])
Definition: net_message.cpp:88
deserialize8
size_t deserialize8(const unsigned char *buf, uint8_t *data)
Definition: net_message.cpp:156
serialize32
size_t serialize32(unsigned char *buf, uint32_t data)
Definition: net_message.cpp:45
serialize16
size_t serialize16(unsigned char *buf, uint16_t data)
Definition: net_message.cpp:59
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.