From 794c162c9e92cbcdad73cb82f545876a47afae92 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 12 May 2014 16:04:46 -0700 Subject: Implement proto v2 --- src/ints/little.cpp | 21 + src/ints/little.hpp | 131 ++ src/map/map.t.hpp | 1 - src/mmo/enums.cpp | 21 + src/mmo/enums.hpp | 148 +++ src/mmo/ids.hpp | 27 + src/mmo/mmo.hpp | 220 +--- src/mmo/strs.cpp | 21 + src/mmo/strs.hpp | 125 ++ src/mmo/utils.hpp | 36 + src/proto2/any-user.hpp | 111 ++ src/proto2/any-user_test.cpp | 23 + src/proto2/char-map.hpp | 31 + src/proto2/char-map_test.cpp | 23 + src/proto2/char-user.hpp | 31 + src/proto2/char-user_test.cpp | 23 + src/proto2/fwd.hpp | 26 + src/proto2/include_cstdint_test.cpp | 26 + src/proto2/include_enums_test.cpp | 23 + src/proto2/include_human_time_diff_test.cpp | 23 + src/proto2/include_ids_test.cpp | 29 + src/proto2/include_ip_test.cpp | 23 + src/proto2/include_little_test.cpp | 26 + src/proto2/include_strs_test.cpp | 27 + src/proto2/include_utils_test.cpp | 25 + src/proto2/include_version_test.cpp | 23 + src/proto2/include_vstring_test.cpp | 27 + src/proto2/login-admin.hpp | 1781 +++++++++++++++++++++++++++ src/proto2/login-admin_test.cpp | 23 + src/proto2/login-char.hpp | 941 ++++++++++++++ src/proto2/login-char_test.cpp | 23 + src/proto2/login-user.hpp | 31 + src/proto2/login-user_test.cpp | 23 + src/proto2/map-user.hpp | 81 ++ src/proto2/map-user_test.cpp | 23 + src/proto2/types.hpp | 264 ++++ 36 files changed, 4242 insertions(+), 219 deletions(-) create mode 100644 src/ints/little.cpp create mode 100644 src/ints/little.hpp create mode 100644 src/mmo/enums.cpp create mode 100644 src/mmo/enums.hpp create mode 100644 src/mmo/strs.cpp create mode 100644 src/mmo/strs.hpp create mode 100644 src/proto2/any-user.hpp create mode 100644 src/proto2/any-user_test.cpp create mode 100644 src/proto2/char-map.hpp create mode 100644 src/proto2/char-map_test.cpp create mode 100644 src/proto2/char-user.hpp create mode 100644 src/proto2/char-user_test.cpp create mode 100644 src/proto2/fwd.hpp create mode 100644 src/proto2/include_cstdint_test.cpp create mode 100644 src/proto2/include_enums_test.cpp create mode 100644 src/proto2/include_human_time_diff_test.cpp create mode 100644 src/proto2/include_ids_test.cpp create mode 100644 src/proto2/include_ip_test.cpp create mode 100644 src/proto2/include_little_test.cpp create mode 100644 src/proto2/include_strs_test.cpp create mode 100644 src/proto2/include_utils_test.cpp create mode 100644 src/proto2/include_version_test.cpp create mode 100644 src/proto2/include_vstring_test.cpp create mode 100644 src/proto2/login-admin.hpp create mode 100644 src/proto2/login-admin_test.cpp create mode 100644 src/proto2/login-char.hpp create mode 100644 src/proto2/login-char_test.cpp create mode 100644 src/proto2/login-user.hpp create mode 100644 src/proto2/login-user_test.cpp create mode 100644 src/proto2/map-user.hpp create mode 100644 src/proto2/map-user_test.cpp create mode 100644 src/proto2/types.hpp (limited to 'src') diff --git a/src/ints/little.cpp b/src/ints/little.cpp new file mode 100644 index 0000000..2f81954 --- /dev/null +++ b/src/ints/little.cpp @@ -0,0 +1,21 @@ +#include "little.hpp" +// little.cpp - integers of known endianness +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" diff --git a/src/ints/little.hpp b/src/ints/little.hpp new file mode 100644 index 0000000..d7d57ff --- /dev/null +++ b/src/ints/little.hpp @@ -0,0 +1,131 @@ +#ifndef TMWA_INTS_LITTLE_HPP +#define TMWA_INTS_LITTLE_HPP +// little.hpp - integers of known endianness +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +# include "fwd.hpp" + +# include + +# include + +// We implement our own actual swapping, because glibc emits assembly +// instead of letting the *compiler* do what it does best. +# if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN +# error "broken endians" +# endif + +namespace ints +{ + // TODO hoist this to byte.hpp and also implement big.hpp + struct Byte + { + uint8_t value; + }; + + struct Little16 + { + uint8_t data[2]; + }; + + struct Little32 + { + uint8_t data[4]; + }; + + struct Little64 + { + uint8_t data[8]; + }; + + inline __attribute__((warn_unused_result)) + bool native_to_network(Byte *net, uint8_t nat) + { + net->value = nat; + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little16 *net, uint16_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap16(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little32 *net, uint32_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap32(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little64 *net, uint64_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap64(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + + inline __attribute__((warn_unused_result)) + bool network_to_native(uint8_t *nat, Byte net) + { + *nat = net.value; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint16_t *nat, Little16 net) + { + uint16_t tmp; + __builtin_memcpy(&tmp, &net, 2); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap16(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint32_t *nat, Little32 net) + { + uint32_t tmp; + __builtin_memcpy(&tmp, &net, 4); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap32(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(uint64_t *nat, Little64 net) + { + uint64_t tmp; + __builtin_memcpy(&tmp, &net, 8); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap64(tmp); + *nat = tmp; + return true; + } +} // namespace ints + +using ints::Byte; +using ints::Little16; +using ints::Little32; +using ints::Little64; + +#endif // TMWA_INTS_LITTLE_HPP diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index 10aeb75..e40befa 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -590,7 +590,6 @@ struct NpcName : VString<23> {}; struct ScriptLabel : VString<23> {}; struct ItemName : VString<23> {}; -class BlockId : public Wrapped { public: BlockId() : Wrapped() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped(a) {} }; inline BlockId account_to_block(AccountId a) { return wrap(unwrap(a)); } inline diff --git a/src/mmo/enums.cpp b/src/mmo/enums.cpp new file mode 100644 index 0000000..fe01c5d --- /dev/null +++ b/src/mmo/enums.cpp @@ -0,0 +1,21 @@ +#include "enums.hpp" +// enums.cpp - Common enumerated types +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp new file mode 100644 index 0000000..a7dcc89 --- /dev/null +++ b/src/mmo/enums.hpp @@ -0,0 +1,148 @@ +#ifndef TMWA_MMO_ENUMS_HPP +#define TMWA_MMO_ENUMS_HPP +// enums.hpp - Common enumerated types +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +# include "fwd.hpp" + +# include + +# include "../generic/enum.hpp" + +enum class SkillID : uint16_t; +constexpr SkillID MAX_SKILL = SkillID(474); // not 450 +constexpr SkillID get_enum_min_value(SkillID) { return SkillID(); } +constexpr SkillID get_enum_max_value(SkillID) { return MAX_SKILL; } + +namespace e +{ +enum class EPOS : uint16_t +{ + ZERO = 0x0000, + + LEGS = 0x0001, + WEAPON = 0x0002, + GLOVES = 0x0004, + CAPE = 0x0008, + MISC1 = 0x0010, + SHIELD = 0x0020, + SHOES = 0x0040, + MISC2 = 0x0080, + HAT = 0x0100, + TORSO = 0x0200, + + ARROW = 0x8000, +}; +ENUM_BITWISE_OPERATORS(EPOS) + +constexpr EPOS get_enum_min_value(EPOS) { return EPOS(0x0000); } +constexpr EPOS get_enum_max_value(EPOS) { return EPOS(0xffff); } +} +using e::EPOS; + +namespace e +{ +enum class SkillFlags : uint16_t; +} +using e::SkillFlags; + +// Option and Opt1..3 in map.hpp +namespace e +{ +enum class Option : uint16_t; +constexpr Option get_enum_min_value(Option) { return Option(0x0000); } +constexpr Option get_enum_max_value(Option) { return Option(0xffff); } +} +using e::Option; + +enum class ATTR +{ + STR = 0, + AGI = 1, + VIT = 2, + INT = 3, + DEX = 4, + LUK = 5, + + COUNT = 6, +}; + +constexpr ATTR ATTRs[6] = +{ + ATTR::STR, + ATTR::AGI, + ATTR::VIT, + ATTR::INT, + ATTR::DEX, + ATTR::LUK, +}; + +enum class ItemLook : uint16_t +{ + NONE = 0, + BLADE = 1, // or some other common weapons + _2, + SETZER_AND_SCYTHE = 3, + _6, + STAFF = 10, + BOW = 11, + _13 = 13, + _14 = 14, + _16 = 16, + SINGLE_HANDED_COUNT = 17, + + DUAL_BLADE = 0x11, + DUAL_2 = 0x12, + DUAL_6 = 0x13, + DUAL_12 = 0x14, + DUAL_16 = 0x15, + DUAL_26 = 0x16, +}; + +enum class SEX : uint8_t +{ + FEMALE = 0, + MALE = 1, + // For items. This is also used as error, sometime. + NEUTRAL = 2, +}; +inline +char sex_to_char(SEX sex) +{ + switch (sex) + { + case SEX::FEMALE: return 'F'; + case SEX::MALE: return 'M'; + default: return '\0'; + } +} +inline +SEX sex_from_char(char c) +{ + switch (c) + { + case 'F': return SEX::FEMALE; + case 'M': return SEX::MALE; + default: return SEX::NEUTRAL; + } +} + +#endif // TMWA_MMO_ENUMS_HPP diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index 3c5b1ba..ed5ab58 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -21,6 +21,7 @@ # include "fwd.hpp" +# include "../ints/little.hpp" # include "../ints/wrap.hpp" # include "extract.hpp" @@ -33,6 +34,8 @@ class CharId : public Wrapped { public: CharId() : Wrapped() class PartyId : public Wrapped { public: PartyId() : Wrapped() {} protected: constexpr explicit PartyId(uint32_t a) : Wrapped(a) {} }; class ItemNameId : public Wrapped { public: ItemNameId() : Wrapped() {} protected: constexpr explicit ItemNameId(uint16_t a) : Wrapped(a) {} }; +class BlockId : public Wrapped { public: BlockId() : Wrapped() {} protected: constexpr explicit BlockId(uint32_t a) : Wrapped(a) {} }; + class GmLevel { uint32_t bits; @@ -98,6 +101,30 @@ public: { return l.bits != r.bits; } + + friend + bool native_to_network(Byte *network, GmLevel native) + { + network->value = native.bits; + return true; // LIES. But this code is going away soon anyway + } + friend + bool network_to_native(GmLevel *native, Byte network) + { + native->bits = network.value; + return true; // LIES. But this code is going away soon anyway + } + + friend + bool native_to_network(Little32 *network, GmLevel native) + { + return native_to_network(network, native.bits); + } + friend + bool network_to_native(GmLevel *native, Little32 network) + { + return network_to_native(&native->bits, network); + } }; inline diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index c72d815..a0cee57 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -27,17 +27,13 @@ # include "../compat/memory.hpp" -# include "../strings/vstring.hpp" - # include "../generic/array.hpp" -# include "../generic/enum.hpp" # include "../net/timer.t.hpp" +# include "enums.hpp" # include "ids.hpp" - -// affects CharName -# define NAME_IGNORING_CASE 1 +# include "strs.hpp" constexpr int FIFOSIZE_SERVERLINK = 256 * 1024; @@ -47,11 +43,6 @@ constexpr int MAX_AMOUNT = 30000; constexpr int MAX_ZENY = 1000000000; // 1G zeny constexpr int TRADE_MAX = 10; -enum class SkillID : uint16_t; -constexpr SkillID MAX_SKILL = SkillID(474); // not 450 -constexpr SkillID get_enum_min_value(SkillID) { return SkillID(); } -constexpr SkillID get_enum_max_value(SkillID) { return MAX_SKILL; } - constexpr int GLOBAL_REG_NUM = 96; constexpr int ACCOUNT_REG_NUM = 16; constexpr int ACCOUNT_REG2_NUM = 16; @@ -68,126 +59,6 @@ constexpr int MAX_PARTY = 12; # define MIN_CLOTH_COLOR battle_config.min_cloth_color # define MAX_CLOTH_COLOR battle_config.max_cloth_color -struct AccountName : VString<23> {}; -struct AccountPass : VString<23> {}; -struct AccountCrypt : VString<39> {}; -struct AccountEmail : VString<39> {}; -struct ServerName : VString<19> {}; -struct PartyName : VString<23> {}; -struct VarName : VString<31> {}; - -# define DEFAULT_EMAIL stringish("a@a.com"_s) - -// It is decreed: a mapname shall not contain an extension -class MapName : public strings::_crtp_string -{ - VString<15> _impl; -public: - MapName() = default; - MapName(VString<15> v) : _impl(v.xislice_h(std::find(v.begin(), v.end(), '.'))) {} - - iterator begin() const { return &*_impl.begin(); } - iterator end() const { return &*_impl.end(); } - const char *c_str() const { return _impl.c_str(); } - - operator RString() const { return _impl; } - operator AString() const { return _impl; } - operator TString() const { return _impl; } - operator SString() const { return _impl; } - operator ZString() const { return _impl; } - operator XString() const { return _impl; } -}; -template<> -inline -MapName stringish(VString<15> iv) -{ - return iv; -} -inline -const char *decay_for_printf(const MapName& vs) { return vs.c_str(); } - -// It is decreed: a charname is sometimes case sensitive -struct CharName -{ -private: - VString<23> _impl; -public: - CharName() = default; - explicit CharName(VString<23> name) - : _impl(name) - {} - - VString<23> to__actual() const - { - return _impl; - } - VString<23> to__lower() const - { - return _impl.to_lower(); - } - VString<23> to__upper() const - { - return _impl.to_upper(); - } - VString<23> to__canonical() const - { -# if NAME_IGNORING_CASE == 0 - return to__actual(); -# endif -# if NAME_IGNORING_CASE == 1 - return to__lower(); -# endif - } - - friend bool operator == (const CharName& l, const CharName& r) - { return l.to__canonical() == r.to__canonical(); } - friend bool operator != (const CharName& l, const CharName& r) - { return l.to__canonical() != r.to__canonical(); } - friend bool operator < (const CharName& l, const CharName& r) - { return l.to__canonical() < r.to__canonical(); } - friend bool operator <= (const CharName& l, const CharName& r) - { return l.to__canonical() <= r.to__canonical(); } - friend bool operator > (const CharName& l, const CharName& r) - { return l.to__canonical() > r.to__canonical(); } - friend bool operator >= (const CharName& l, const CharName& r) - { return l.to__canonical() >= r.to__canonical(); } - - friend - VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); } -}; -template<> -inline -CharName stringish(VString<23> iv) -{ - return CharName(iv); -} - -namespace e -{ -enum class EPOS : uint16_t -{ - ZERO = 0x0000, - - LEGS = 0x0001, - WEAPON = 0x0002, - GLOVES = 0x0004, - CAPE = 0x0008, - MISC1 = 0x0010, - SHIELD = 0x0020, - SHOES = 0x0040, - MISC2 = 0x0080, - HAT = 0x0100, - TORSO = 0x0200, - - ARROW = 0x8000, -}; -ENUM_BITWISE_OPERATORS(EPOS) - -constexpr EPOS get_enum_min_value(EPOS) { return EPOS(0x0000); } -constexpr EPOS get_enum_max_value(EPOS) { return EPOS(0xffff); } -} -using e::EPOS; - struct item { ItemNameId nameid; @@ -201,12 +72,6 @@ struct point short x, y; }; -namespace e -{ -enum class SkillFlags : uint16_t; -} -using e::SkillFlags; - struct skill_value { unsigned short lv; @@ -228,87 +93,6 @@ struct global_reg int value; }; -// Option and Opt1..3 in map.hpp -namespace e -{ -enum class Option : uint16_t; -constexpr Option get_enum_min_value(Option) { return Option(0x0000); } -constexpr Option get_enum_max_value(Option) { return Option(0xffff); } -} -using e::Option; - -enum class ATTR -{ - STR = 0, - AGI = 1, - VIT = 2, - INT = 3, - DEX = 4, - LUK = 5, - - COUNT = 6, -}; - -constexpr ATTR ATTRs[6] = -{ - ATTR::STR, - ATTR::AGI, - ATTR::VIT, - ATTR::INT, - ATTR::DEX, - ATTR::LUK, -}; - -enum class ItemLook : uint16_t -{ - NONE = 0, - BLADE = 1, // or some other common weapons - _2, - SETZER_AND_SCYTHE = 3, - _6, - STAFF = 10, - BOW = 11, - _13 = 13, - _14 = 14, - _16 = 16, - SINGLE_HANDED_COUNT = 17, - - DUAL_BLADE = 0x11, - DUAL_2 = 0x12, - DUAL_6 = 0x13, - DUAL_12 = 0x14, - DUAL_16 = 0x15, - DUAL_26 = 0x16, -}; - -enum class SEX : uint8_t -{ - FEMALE = 0, - MALE = 1, - // For items. This is also used as error, sometime. - NEUTRAL = 2, -}; -inline -char sex_to_char(SEX sex) -{ - switch (sex) - { - case SEX::FEMALE: return 'F'; - case SEX::MALE: return 'M'; - default: return '\0'; - } -} -inline -SEX sex_from_char(char c) -{ - switch (c) - { - case 'F': return SEX::FEMALE; - case 'M': return SEX::MALE; - default: return SEX::NEUTRAL; - } -} - struct CharKey { CharName name; diff --git a/src/mmo/strs.cpp b/src/mmo/strs.cpp new file mode 100644 index 0000000..979d6ac --- /dev/null +++ b/src/mmo/strs.cpp @@ -0,0 +1,21 @@ +#include "strs.hpp" +// strs.cpp - common string types +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" diff --git a/src/mmo/strs.hpp b/src/mmo/strs.hpp new file mode 100644 index 0000000..ad2a1b5 --- /dev/null +++ b/src/mmo/strs.hpp @@ -0,0 +1,125 @@ +#ifndef TMWA_MMO_STRS_HPP +#define TMWA_MMO_STRS_HPP +// strs.hpp - common string types +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +# include "fwd.hpp" + +# include "../strings/vstring.hpp" + +// affects CharName +# define NAME_IGNORING_CASE 1 + +struct AccountName : VString<23> {}; +struct AccountPass : VString<23> {}; +struct AccountCrypt : VString<39> {}; +struct AccountEmail : VString<39> {}; +struct ServerName : VString<19> {}; +struct PartyName : VString<23> {}; +struct VarName : VString<31> {}; + +# define DEFAULT_EMAIL stringish("a@a.com"_s) + +// It is decreed: a mapname shall not contain an extension +class MapName : public strings::_crtp_string +{ + VString<15> _impl; +public: + MapName() = default; + MapName(VString<15> v) : _impl(v.xislice_h(std::find(v.begin(), v.end(), '.'))) {} + + iterator begin() const { return &*_impl.begin(); } + iterator end() const { return &*_impl.end(); } + const char *c_str() const { return _impl.c_str(); } + + operator RString() const { return _impl; } + operator AString() const { return _impl; } + operator TString() const { return _impl; } + operator SString() const { return _impl; } + operator ZString() const { return _impl; } + operator XString() const { return _impl; } +}; +template<> +inline +MapName stringish(VString<15> iv) +{ + return iv; +} +inline +const char *decay_for_printf(const MapName& vs) { return vs.c_str(); } + +// It is decreed: a charname is sometimes case sensitive +struct CharName +{ +private: + VString<23> _impl; +public: + CharName() = default; + explicit CharName(VString<23> name) + : _impl(name) + {} + + VString<23> to__actual() const + { + return _impl; + } + VString<23> to__lower() const + { + return _impl.to_lower(); + } + VString<23> to__upper() const + { + return _impl.to_upper(); + } + VString<23> to__canonical() const + { +# if NAME_IGNORING_CASE == 0 + return to__actual(); +# endif +# if NAME_IGNORING_CASE == 1 + return to__lower(); +# endif + } + + friend bool operator == (const CharName& l, const CharName& r) + { return l.to__canonical() == r.to__canonical(); } + friend bool operator != (const CharName& l, const CharName& r) + { return l.to__canonical() != r.to__canonical(); } + friend bool operator < (const CharName& l, const CharName& r) + { return l.to__canonical() < r.to__canonical(); } + friend bool operator <= (const CharName& l, const CharName& r) + { return l.to__canonical() <= r.to__canonical(); } + friend bool operator > (const CharName& l, const CharName& r) + { return l.to__canonical() > r.to__canonical(); } + friend bool operator >= (const CharName& l, const CharName& r) + { return l.to__canonical() >= r.to__canonical(); } + + friend + VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); } +}; +template<> +inline +CharName stringish(VString<23> iv) +{ + return CharName(iv); +} + +#endif // TMWA_MMO_STRS_HPP diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index 9837358..ddfbca6 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -27,6 +27,8 @@ # include +# include "../ints/little.hpp" + # include "../strings/fwd.hpp" # include "../strings/vstring.hpp" @@ -107,6 +109,40 @@ long long& convert_for_scanf(TimeT& t) return t.value; } +// 2038 problem +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *net, TimeT nat) +{ + time_t tmp = nat; + return native_to_network(net, static_cast(tmp)); +} + +inline __attribute__((warn_unused_result)) +bool network_to_native(TimeT *nat, Little32 net) +{ + uint32_t tmp; + bool rv = network_to_native(&tmp, net); + *nat = static_cast(tmp); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(Little64 *net, TimeT nat) +{ + time_t tmp = nat; + return native_to_network(net, static_cast(tmp)); +} + +inline __attribute__((warn_unused_result)) +bool network_to_native(TimeT *nat, Little64 net) +{ + uint64_t tmp; + bool rv = network_to_native(&tmp, net); + *nat = static_cast(tmp); + return rv; +} + + struct timestamp_seconds_buffer : VString<19> {}; struct timestamp_milliseconds_buffer : VString<23> {}; void stamp_time(timestamp_seconds_buffer&, const TimeT *t=nullptr); diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp new file mode 100644 index 0000000..f2847ef --- /dev/null +++ b/src/proto2/any-user.hpp @@ -0,0 +1,111 @@ +#ifndef TMWA_PROTO2_ANY_USER_HPP +#define TMWA_PROTO2_ANY_USER_HPP +// any-user.hpp - TMWA network protocol: any/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + +struct RPacket0x7530_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7530_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7530_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7530_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7530_Fixed) == 2, "sizeof(NetRPacket0x7530_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7530_Fixed *network, RPacket0x7530_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7530_Fixed *native, NetRPacket0x7530_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x7531_Fixed +{ + uint16_t packet_id; + Version version; +}; +struct NetSPacket0x7531_Fixed +{ + Little16 packet_id; + NetVersion version; +}; +static_assert(offsetof(NetSPacket0x7531_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7531_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7531_Fixed, version) == 2, "offsetof(NetSPacket0x7531_Fixed, version) == 2"); +static_assert(sizeof(NetSPacket0x7531_Fixed) == 10, "sizeof(NetSPacket0x7531_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7531_Fixed *network, SPacket0x7531_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->version, native.version); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7531_Fixed *native, NetSPacket0x7531_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->version, network.version); + return rv; +} + +struct RPacket0x7532_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7532_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7532_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7532_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7532_Fixed) == 2, "sizeof(NetRPacket0x7532_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7532_Fixed *network, RPacket0x7532_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7532_Fixed *native, NetRPacket0x7532_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + + +#endif // TMWA_PROTO2_ANY_USER_HPP diff --git a/src/proto2/any-user_test.cpp b/src/proto2/any-user_test.cpp new file mode 100644 index 0000000..5096d24 --- /dev/null +++ b/src/proto2/any-user_test.cpp @@ -0,0 +1,23 @@ +#include "any-user.hpp" +// any-user_test.cpp - TMWA network protocol: any/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/char-map.hpp b/src/proto2/char-map.hpp new file mode 100644 index 0000000..3caa2df --- /dev/null +++ b/src/proto2/char-map.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_CHAR_MAP_HPP +#define TMWA_PROTO2_CHAR_MAP_HPP +// char-map.hpp - TMWA network protocol: char/map +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + + +#endif // TMWA_PROTO2_CHAR_MAP_HPP diff --git a/src/proto2/char-map_test.cpp b/src/proto2/char-map_test.cpp new file mode 100644 index 0000000..1b6ccb1 --- /dev/null +++ b/src/proto2/char-map_test.cpp @@ -0,0 +1,23 @@ +#include "char-map.hpp" +// char-map_test.cpp - TMWA network protocol: char/map +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/char-user.hpp b/src/proto2/char-user.hpp new file mode 100644 index 0000000..d85d768 --- /dev/null +++ b/src/proto2/char-user.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_CHAR_USER_HPP +#define TMWA_PROTO2_CHAR_USER_HPP +// char-user.hpp - TMWA network protocol: char/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + + +#endif // TMWA_PROTO2_CHAR_USER_HPP diff --git a/src/proto2/char-user_test.cpp b/src/proto2/char-user_test.cpp new file mode 100644 index 0000000..952d196 --- /dev/null +++ b/src/proto2/char-user_test.cpp @@ -0,0 +1,23 @@ +#include "char-user.hpp" +// char-user_test.cpp - TMWA network protocol: char/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/fwd.hpp b/src/proto2/fwd.hpp new file mode 100644 index 0000000..023ebe5 --- /dev/null +++ b/src/proto2/fwd.hpp @@ -0,0 +1,26 @@ +#ifndef TMWA_PROTO2_FWD_HPP +#define TMWA_PROTO2_FWD_HPP +// proto2/fwd.hpp - Forward declarations of network packets +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +# include "../sanity.hpp" + +// TODO put stuff here + +#endif // TMWA_PROTO2_FWD_HPP diff --git a/src/proto2/include_cstdint_test.cpp b/src/proto2/include_cstdint_test.cpp new file mode 100644 index 0000000..a067574 --- /dev/null +++ b/src/proto2/include_cstdint_test.cpp @@ -0,0 +1,26 @@ +#include +// include_cstdint_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_uint8_t = uint8_t; +using Test_uint16_t = uint16_t; +using Test_uint32_t = uint32_t; +using Test_uint64_t = uint64_t; diff --git a/src/proto2/include_enums_test.cpp b/src/proto2/include_enums_test.cpp new file mode 100644 index 0000000..a335c81 --- /dev/null +++ b/src/proto2/include_enums_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/enums.hpp" +// include_enums_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_SEX = SEX; diff --git a/src/proto2/include_human_time_diff_test.cpp b/src/proto2/include_human_time_diff_test.cpp new file mode 100644 index 0000000..25a111d --- /dev/null +++ b/src/proto2/include_human_time_diff_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/human_time_diff.hpp" +// include_human_time_diff_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_HumanTimeDiff = HumanTimeDiff; diff --git a/src/proto2/include_ids_test.cpp b/src/proto2/include_ids_test.cpp new file mode 100644 index 0000000..63e1753 --- /dev/null +++ b/src/proto2/include_ids_test.cpp @@ -0,0 +1,29 @@ +#include "../mmo/ids.hpp" +// include_ids_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_Species = Species; +using Test_AccountId = AccountId; +using Test_CharId = CharId; +using Test_PartyId = PartyId; +using Test_ItemNameId = ItemNameId; +using Test_BlockId = BlockId; +using Test_GmLevel = GmLevel; diff --git a/src/proto2/include_ip_test.cpp b/src/proto2/include_ip_test.cpp new file mode 100644 index 0000000..bae7c3a --- /dev/null +++ b/src/proto2/include_ip_test.cpp @@ -0,0 +1,23 @@ +#include "../net/ip.hpp" +// include_ip_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_IP4Address = IP4Address; diff --git a/src/proto2/include_little_test.cpp b/src/proto2/include_little_test.cpp new file mode 100644 index 0000000..70cb5d2 --- /dev/null +++ b/src/proto2/include_little_test.cpp @@ -0,0 +1,26 @@ +#include "../ints/little.hpp" +// include_little_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_Byte = Byte; +using Test_Little16 = Little16; +using Test_Little32 = Little32; +using Test_Little64 = Little64; diff --git a/src/proto2/include_strs_test.cpp b/src/proto2/include_strs_test.cpp new file mode 100644 index 0000000..1087f3a --- /dev/null +++ b/src/proto2/include_strs_test.cpp @@ -0,0 +1,27 @@ +#include "../mmo/strs.hpp" +// include_strs_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_AccountName = AccountName; +using Test_AccountPass = AccountPass; +using Test_AccountEmail = AccountEmail; +using Test_ServerName = ServerName; +using Test_VarName = VarName; diff --git a/src/proto2/include_utils_test.cpp b/src/proto2/include_utils_test.cpp new file mode 100644 index 0000000..840ed5f --- /dev/null +++ b/src/proto2/include_utils_test.cpp @@ -0,0 +1,25 @@ +#include "../mmo/utils.hpp" +// include_utils_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_TimeT = TimeT; +using Test_timestamp_seconds_buffer = timestamp_seconds_buffer; +using Test_timestamp_milliseconds_buffer = timestamp_milliseconds_buffer; diff --git a/src/proto2/include_version_test.cpp b/src/proto2/include_version_test.cpp new file mode 100644 index 0000000..d635efc --- /dev/null +++ b/src/proto2/include_version_test.cpp @@ -0,0 +1,23 @@ +#include "../mmo/version.hpp" +// include_version_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_Version = Version; diff --git a/src/proto2/include_vstring_test.cpp b/src/proto2/include_vstring_test.cpp new file mode 100644 index 0000000..f415127 --- /dev/null +++ b/src/proto2/include_vstring_test.cpp @@ -0,0 +1,27 @@ +#include "../strings/vstring.hpp" +// include_vstring_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +#include "../poison.hpp" + +using Test_VString_15_ = VString<15>; +using Test_VString_19_ = VString<19>; +using Test_VString_23_ = VString<23>; +using Test_VString_31_ = VString<31>; +using Test_VString_39_ = VString<39>; diff --git a/src/proto2/login-admin.hpp b/src/proto2/login-admin.hpp new file mode 100644 index 0000000..635ed44 --- /dev/null +++ b/src/proto2/login-admin.hpp @@ -0,0 +1,1781 @@ +#ifndef TMWA_PROTO2_LOGIN_ADMIN_HPP +#define TMWA_PROTO2_LOGIN_ADMIN_HPP +// login-admin.hpp - TMWA network protocol: login/admin +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + +struct RPacket0x2726_Head +{ + uint16_t packet_id; + uint16_t unused; + uint32_t string_length; +}; +struct NetRPacket0x2726_Head +{ + Little16 packet_id; + Little16 unused; + Little32 string_length; +}; +static_assert(offsetof(NetRPacket0x2726_Head, packet_id) == 0, "offsetof(NetRPacket0x2726_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2726_Head, unused) == 2, "offsetof(NetRPacket0x2726_Head, unused) == 2"); +static_assert(offsetof(NetRPacket0x2726_Head, string_length) == 4, "offsetof(NetRPacket0x2726_Head, string_length) == 4"); +static_assert(sizeof(NetRPacket0x2726_Head) == 8, "sizeof(NetRPacket0x2726_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2726_Head *network, RPacket0x2726_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2726_Head *native, NetRPacket0x2726_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x2726_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2726_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2726_Repeat, c) == 0, "offsetof(NetRPacket0x2726_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2726_Repeat) == 1, "sizeof(NetRPacket0x2726_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2726_Repeat *network, RPacket0x2726_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2726_Repeat *native, NetRPacket0x2726_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x7920_Head +{ + uint16_t packet_id; + uint32_t start_account_id; + uint32_t end_account_id; +}; +struct NetRPacket0x7920_Head +{ + Little16 packet_id; + Little32 start_account_id; + Little32 end_account_id; +}; +static_assert(offsetof(NetRPacket0x7920_Head, packet_id) == 0, "offsetof(NetRPacket0x7920_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7920_Head, start_account_id) == 2, "offsetof(NetRPacket0x7920_Head, start_account_id) == 2"); +static_assert(offsetof(NetRPacket0x7920_Head, end_account_id) == 6, "offsetof(NetRPacket0x7920_Head, end_account_id) == 6"); +static_assert(sizeof(NetRPacket0x7920_Head) == 10, "sizeof(NetRPacket0x7920_Head) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7920_Head *network, RPacket0x7920_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->start_account_id, native.start_account_id); + rv &= native_to_network(&network->end_account_id, native.end_account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7920_Head *native, NetRPacket0x7920_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->start_account_id, network.start_account_id); + rv &= network_to_native(&native->end_account_id, network.end_account_id); + return rv; +} + +struct RPacket0x7920_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x7920_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x7920_Repeat, c) == 0, "offsetof(NetRPacket0x7920_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x7920_Repeat) == 1, "sizeof(NetRPacket0x7920_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7920_Repeat *network, RPacket0x7920_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7920_Repeat *native, NetRPacket0x7920_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x7921_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x7921_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x7921_Head, packet_id) == 0, "offsetof(NetSPacket0x7921_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7921_Head, packet_length) == 2, "offsetof(NetSPacket0x7921_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x7921_Head) == 4, "sizeof(NetSPacket0x7921_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7921_Head *network, SPacket0x7921_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7921_Head *native, NetSPacket0x7921_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x7921_Repeat +{ + uint32_t account_id; + GmLevel gm_level; + AccountName account_name; + SEX sex; + uint32_t login_count; + uint32_t status; +}; +struct NetSPacket0x7921_Repeat +{ + Little32 account_id; + Byte gm_level; + NetString account_name; + Byte sex; + Little32 login_count; + Little32 status; +}; +static_assert(offsetof(NetSPacket0x7921_Repeat, account_id) == 0, "offsetof(NetSPacket0x7921_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket0x7921_Repeat, gm_level) == 4, "offsetof(NetSPacket0x7921_Repeat, gm_level) == 4"); +static_assert(offsetof(NetSPacket0x7921_Repeat, account_name) == 5, "offsetof(NetSPacket0x7921_Repeat, account_name) == 5"); +static_assert(offsetof(NetSPacket0x7921_Repeat, sex) == 29, "offsetof(NetSPacket0x7921_Repeat, sex) == 29"); +static_assert(offsetof(NetSPacket0x7921_Repeat, login_count) == 30, "offsetof(NetSPacket0x7921_Repeat, login_count) == 30"); +static_assert(offsetof(NetSPacket0x7921_Repeat, status) == 34, "offsetof(NetSPacket0x7921_Repeat, status) == 34"); +static_assert(sizeof(NetSPacket0x7921_Repeat) == 38, "sizeof(NetSPacket0x7921_Repeat) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7921_Repeat *network, SPacket0x7921_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->login_count, native.login_count); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7921_Repeat *native, NetSPacket0x7921_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->login_count, network.login_count); + rv &= network_to_native(&native->status, network.status); + return rv; +} + +struct RPacket0x7924_Fixed +{ + uint16_t packet_id; + uint32_t source_item_id; + uint32_t dest_item_id; +}; +struct NetRPacket0x7924_Fixed +{ + Little16 packet_id; + Little32 source_item_id; + Little32 dest_item_id; +}; +static_assert(offsetof(NetRPacket0x7924_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7924_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2, "offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2"); +static_assert(offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6, "offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6"); +static_assert(sizeof(NetRPacket0x7924_Fixed) == 10, "sizeof(NetRPacket0x7924_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7924_Fixed *network, RPacket0x7924_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->source_item_id, native.source_item_id); + rv &= native_to_network(&network->dest_item_id, native.dest_item_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7924_Fixed *native, NetRPacket0x7924_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->source_item_id, network.source_item_id); + rv &= network_to_native(&native->dest_item_id, network.dest_item_id); + return rv; +} + +struct SPacket0x7925_Fixed +{ + uint16_t packet_id; +}; +struct NetSPacket0x7925_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetSPacket0x7925_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7925_Fixed, packet_id) == 0"); +static_assert(sizeof(NetSPacket0x7925_Fixed) == 2, "sizeof(NetSPacket0x7925_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7925_Fixed *network, SPacket0x7925_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7925_Fixed *native, NetSPacket0x7925_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct RPacket0x7930_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; + SEX sex; + AccountEmail email; +}; +struct NetRPacket0x7930_Fixed +{ + Little16 packet_id; + NetString account_name; + NetString password; + Byte sex; + NetString email; +}; +static_assert(offsetof(NetRPacket0x7930_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7930_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7930_Fixed, account_name) == 2, "offsetof(NetRPacket0x7930_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7930_Fixed, password) == 26, "offsetof(NetRPacket0x7930_Fixed, password) == 26"); +static_assert(offsetof(NetRPacket0x7930_Fixed, sex) == 50, "offsetof(NetRPacket0x7930_Fixed, sex) == 50"); +static_assert(offsetof(NetRPacket0x7930_Fixed, email) == 51, "offsetof(NetRPacket0x7930_Fixed, email) == 51"); +static_assert(sizeof(NetRPacket0x7930_Fixed) == 91, "sizeof(NetRPacket0x7930_Fixed) == 91"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7930_Fixed *network, RPacket0x7930_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7930_Fixed *native, NetRPacket0x7930_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct SPacket0x7931_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7931_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7931_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7931_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7931_Fixed, account_id) == 2, "offsetof(NetSPacket0x7931_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7931_Fixed, account_name) == 6, "offsetof(NetSPacket0x7931_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7931_Fixed) == 30, "sizeof(NetSPacket0x7931_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7931_Fixed *network, SPacket0x7931_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7931_Fixed *native, NetSPacket0x7931_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7932_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7932_Fixed +{ + Little16 packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket0x7932_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7932_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7932_Fixed, account_name) == 2, "offsetof(NetRPacket0x7932_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7932_Fixed) == 26, "sizeof(NetRPacket0x7932_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7932_Fixed *network, RPacket0x7932_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7932_Fixed *native, NetRPacket0x7932_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7933_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7933_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7933_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7933_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7933_Fixed, account_id) == 2, "offsetof(NetSPacket0x7933_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7933_Fixed, account_name) == 6, "offsetof(NetSPacket0x7933_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7933_Fixed) == 30, "sizeof(NetSPacket0x7933_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7933_Fixed *network, SPacket0x7933_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7933_Fixed *native, NetSPacket0x7933_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7934_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; +}; +struct NetRPacket0x7934_Fixed +{ + Little16 packet_id; + NetString account_name; + NetString password; +}; +static_assert(offsetof(NetRPacket0x7934_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7934_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7934_Fixed, account_name) == 2, "offsetof(NetRPacket0x7934_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7934_Fixed, password) == 26, "offsetof(NetRPacket0x7934_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket0x7934_Fixed) == 50, "sizeof(NetRPacket0x7934_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7934_Fixed *network, RPacket0x7934_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7934_Fixed *native, NetRPacket0x7934_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + return rv; +} + +struct SPacket0x7935_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7935_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7935_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7935_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7935_Fixed, account_id) == 2, "offsetof(NetSPacket0x7935_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7935_Fixed, account_name) == 6, "offsetof(NetSPacket0x7935_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7935_Fixed) == 30, "sizeof(NetSPacket0x7935_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7935_Fixed *network, SPacket0x7935_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7935_Fixed *native, NetSPacket0x7935_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7936_Fixed +{ + uint16_t packet_id; + AccountName account_name; + uint32_t status; + timestamp_seconds_buffer error_message; +}; +struct NetRPacket0x7936_Fixed +{ + Little16 packet_id; + NetString account_name; + Little32 status; + NetString error_message; +}; +static_assert(offsetof(NetRPacket0x7936_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7936_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7936_Fixed, account_name) == 2, "offsetof(NetRPacket0x7936_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7936_Fixed, status) == 26, "offsetof(NetRPacket0x7936_Fixed, status) == 26"); +static_assert(offsetof(NetRPacket0x7936_Fixed, error_message) == 30, "offsetof(NetRPacket0x7936_Fixed, error_message) == 30"); +static_assert(sizeof(NetRPacket0x7936_Fixed) == 50, "sizeof(NetRPacket0x7936_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7936_Fixed *network, RPacket0x7936_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->status, native.status); + rv &= native_to_network(&network->error_message, native.error_message); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7936_Fixed *native, NetRPacket0x7936_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->status, network.status); + rv &= network_to_native(&native->error_message, network.error_message); + return rv; +} + +struct SPacket0x7937_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7937_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7937_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7937_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7937_Fixed, account_id) == 2, "offsetof(NetSPacket0x7937_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7937_Fixed, account_name) == 6, "offsetof(NetSPacket0x7937_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7937_Fixed) == 30, "sizeof(NetSPacket0x7937_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7937_Fixed *network, SPacket0x7937_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7937_Fixed *native, NetSPacket0x7937_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7938_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7938_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7938_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7938_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7938_Fixed) == 2, "sizeof(NetRPacket0x7938_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7938_Fixed *network, RPacket0x7938_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7938_Fixed *native, NetRPacket0x7938_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x7939_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x7939_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x7939_Head, packet_id) == 0, "offsetof(NetSPacket0x7939_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7939_Head, packet_length) == 2, "offsetof(NetSPacket0x7939_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x7939_Head) == 4, "sizeof(NetSPacket0x7939_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7939_Head *network, SPacket0x7939_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7939_Head *native, NetSPacket0x7939_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x7939_Repeat +{ + IP4Address ip; + uint16_t port; + ServerName name; + uint16_t users; + uint16_t maintenance; + uint16_t is_new; +}; +struct NetSPacket0x7939_Repeat +{ + IP4Address ip; + Little16 port; + NetString name; + Little16 users; + Little16 maintenance; + Little16 is_new; +}; +static_assert(offsetof(NetSPacket0x7939_Repeat, ip) == 0, "offsetof(NetSPacket0x7939_Repeat, ip) == 0"); +static_assert(offsetof(NetSPacket0x7939_Repeat, port) == 4, "offsetof(NetSPacket0x7939_Repeat, port) == 4"); +static_assert(offsetof(NetSPacket0x7939_Repeat, name) == 6, "offsetof(NetSPacket0x7939_Repeat, name) == 6"); +static_assert(offsetof(NetSPacket0x7939_Repeat, users) == 26, "offsetof(NetSPacket0x7939_Repeat, users) == 26"); +static_assert(offsetof(NetSPacket0x7939_Repeat, maintenance) == 28, "offsetof(NetSPacket0x7939_Repeat, maintenance) == 28"); +static_assert(offsetof(NetSPacket0x7939_Repeat, is_new) == 30, "offsetof(NetSPacket0x7939_Repeat, is_new) == 30"); +static_assert(sizeof(NetSPacket0x7939_Repeat) == 32, "sizeof(NetSPacket0x7939_Repeat) == 32"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7939_Repeat *network, SPacket0x7939_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->ip, native.ip); + rv &= native_to_network(&network->port, native.port); + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->users, native.users); + rv &= native_to_network(&network->maintenance, native.maintenance); + rv &= native_to_network(&network->is_new, native.is_new); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7939_Repeat *native, NetSPacket0x7939_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->ip, network.ip); + rv &= network_to_native(&native->port, network.port); + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->users, network.users); + rv &= network_to_native(&native->maintenance, network.maintenance); + rv &= network_to_native(&native->is_new, network.is_new); + return rv; +} + +struct RPacket0x793a_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountPass password; +}; +struct NetRPacket0x793a_Fixed +{ + Little16 packet_id; + NetString account_name; + NetString password; +}; +static_assert(offsetof(NetRPacket0x793a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793a_Fixed, account_name) == 2, "offsetof(NetRPacket0x793a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793a_Fixed, password) == 26, "offsetof(NetRPacket0x793a_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket0x793a_Fixed) == 50, "sizeof(NetRPacket0x793a_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793a_Fixed *network, RPacket0x793a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->password, native.password); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793a_Fixed *native, NetRPacket0x793a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->password, network.password); + return rv; +} + +struct SPacket0x793b_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793b_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x793b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793b_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793b_Fixed, account_id) == 2, "offsetof(NetSPacket0x793b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793b_Fixed, account_name) == 6, "offsetof(NetSPacket0x793b_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793b_Fixed) == 30, "sizeof(NetSPacket0x793b_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793b_Fixed *network, SPacket0x793b_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793b_Fixed *native, NetSPacket0x793b_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x793c_Fixed +{ + uint16_t packet_id; + AccountName account_name; + SEX sex; +}; +struct NetRPacket0x793c_Fixed +{ + Little16 packet_id; + NetString account_name; + Byte sex; +}; +static_assert(offsetof(NetRPacket0x793c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793c_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793c_Fixed, account_name) == 2, "offsetof(NetRPacket0x793c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793c_Fixed, sex) == 26, "offsetof(NetRPacket0x793c_Fixed, sex) == 26"); +static_assert(sizeof(NetRPacket0x793c_Fixed) == 27, "sizeof(NetRPacket0x793c_Fixed) == 27"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793c_Fixed *network, RPacket0x793c_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->sex, native.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793c_Fixed *native, NetRPacket0x793c_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->sex, network.sex); + return rv; +} + +struct SPacket0x793d_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793d_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x793d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793d_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793d_Fixed, account_id) == 2, "offsetof(NetSPacket0x793d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793d_Fixed, account_name) == 6, "offsetof(NetSPacket0x793d_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793d_Fixed) == 30, "sizeof(NetSPacket0x793d_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793d_Fixed *network, SPacket0x793d_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793d_Fixed *native, NetSPacket0x793d_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x793e_Fixed +{ + uint16_t packet_id; + AccountName account_name; + GmLevel gm_level; +}; +struct NetRPacket0x793e_Fixed +{ + Little16 packet_id; + NetString account_name; + Byte gm_level; +}; +static_assert(offsetof(NetRPacket0x793e_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793e_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x793e_Fixed, account_name) == 2, "offsetof(NetRPacket0x793e_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x793e_Fixed, gm_level) == 26, "offsetof(NetRPacket0x793e_Fixed, gm_level) == 26"); +static_assert(sizeof(NetRPacket0x793e_Fixed) == 27, "sizeof(NetRPacket0x793e_Fixed) == 27"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x793e_Fixed *network, RPacket0x793e_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x793e_Fixed *native, NetRPacket0x793e_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct SPacket0x793f_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x793f_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x793f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793f_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x793f_Fixed, account_id) == 2, "offsetof(NetSPacket0x793f_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x793f_Fixed, account_name) == 6, "offsetof(NetSPacket0x793f_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x793f_Fixed) == 30, "sizeof(NetSPacket0x793f_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x793f_Fixed *network, SPacket0x793f_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x793f_Fixed *native, NetSPacket0x793f_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7940_Fixed +{ + uint16_t packet_id; + AccountName account_name; + AccountEmail email; +}; +struct NetRPacket0x7940_Fixed +{ + Little16 packet_id; + NetString account_name; + NetString email; +}; +static_assert(offsetof(NetRPacket0x7940_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7940_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7940_Fixed, account_name) == 2, "offsetof(NetRPacket0x7940_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7940_Fixed, email) == 26, "offsetof(NetRPacket0x7940_Fixed, email) == 26"); +static_assert(sizeof(NetRPacket0x7940_Fixed) == 66, "sizeof(NetRPacket0x7940_Fixed) == 66"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7940_Fixed *network, RPacket0x7940_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7940_Fixed *native, NetRPacket0x7940_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct SPacket0x7941_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7941_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7941_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7941_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7941_Fixed, account_id) == 2, "offsetof(NetSPacket0x7941_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7941_Fixed, account_name) == 6, "offsetof(NetSPacket0x7941_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7941_Fixed) == 30, "sizeof(NetSPacket0x7941_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7941_Fixed *network, SPacket0x7941_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7941_Fixed *native, NetSPacket0x7941_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7942_Head +{ + uint16_t packet_id; + AccountName account_name; + uint16_t string_length; +}; +struct NetRPacket0x7942_Head +{ + Little16 packet_id; + NetString account_name; + Little16 string_length; +}; +static_assert(offsetof(NetRPacket0x7942_Head, packet_id) == 0, "offsetof(NetRPacket0x7942_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7942_Head, account_name) == 2, "offsetof(NetRPacket0x7942_Head, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7942_Head, string_length) == 26, "offsetof(NetRPacket0x7942_Head, string_length) == 26"); +static_assert(sizeof(NetRPacket0x7942_Head) == 28, "sizeof(NetRPacket0x7942_Head) == 28"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7942_Head *network, RPacket0x7942_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7942_Head *native, NetRPacket0x7942_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x7942_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x7942_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x7942_Repeat, c) == 0, "offsetof(NetRPacket0x7942_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x7942_Repeat) == 1, "sizeof(NetRPacket0x7942_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7942_Repeat *network, RPacket0x7942_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7942_Repeat *native, NetRPacket0x7942_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x7943_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7943_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7943_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7943_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7943_Fixed, account_id) == 2, "offsetof(NetSPacket0x7943_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7943_Fixed, account_name) == 6, "offsetof(NetSPacket0x7943_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7943_Fixed) == 30, "sizeof(NetSPacket0x7943_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7943_Fixed *network, SPacket0x7943_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7943_Fixed *native, NetSPacket0x7943_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7944_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7944_Fixed +{ + Little16 packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket0x7944_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7944_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7944_Fixed, account_name) == 2, "offsetof(NetRPacket0x7944_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7944_Fixed) == 26, "sizeof(NetRPacket0x7944_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7944_Fixed *network, RPacket0x7944_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7944_Fixed *native, NetRPacket0x7944_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7945_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7945_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7945_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7945_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7945_Fixed, account_id) == 2, "offsetof(NetSPacket0x7945_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7945_Fixed, account_name) == 6, "offsetof(NetSPacket0x7945_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7945_Fixed) == 30, "sizeof(NetSPacket0x7945_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7945_Fixed *network, SPacket0x7945_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7945_Fixed *native, NetSPacket0x7945_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7946_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x7946_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x7946_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7946_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7946_Fixed, account_id) == 2, "offsetof(NetRPacket0x7946_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x7946_Fixed) == 6, "sizeof(NetRPacket0x7946_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7946_Fixed *network, RPacket0x7946_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7946_Fixed *native, NetRPacket0x7946_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x7947_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; +}; +struct NetSPacket0x7947_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket0x7947_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7947_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7947_Fixed, account_id) == 2, "offsetof(NetSPacket0x7947_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7947_Fixed, account_name) == 6, "offsetof(NetSPacket0x7947_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket0x7947_Fixed) == 30, "sizeof(NetSPacket0x7947_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7947_Fixed *network, SPacket0x7947_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7947_Fixed *native, NetSPacket0x7947_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct RPacket0x7948_Fixed +{ + uint16_t packet_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetRPacket0x7948_Fixed +{ + Little16 packet_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetRPacket0x7948_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7948_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7948_Fixed, account_name) == 2, "offsetof(NetRPacket0x7948_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7948_Fixed, valid_until) == 26, "offsetof(NetRPacket0x7948_Fixed, valid_until) == 26"); +static_assert(sizeof(NetRPacket0x7948_Fixed) == 30, "sizeof(NetRPacket0x7948_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7948_Fixed *network, RPacket0x7948_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7948_Fixed *native, NetRPacket0x7948_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct SPacket0x7949_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetSPacket0x7949_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket0x7949_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7949_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7949_Fixed, account_id) == 2, "offsetof(NetSPacket0x7949_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7949_Fixed, account_name) == 6, "offsetof(NetSPacket0x7949_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x7949_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7949_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket0x7949_Fixed) == 34, "sizeof(NetSPacket0x7949_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7949_Fixed *network, SPacket0x7949_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7949_Fixed *native, NetSPacket0x7949_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct RPacket0x794a_Fixed +{ + uint16_t packet_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetRPacket0x794a_Fixed +{ + Little16 packet_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetRPacket0x794a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794a_Fixed, account_name) == 2, "offsetof(NetRPacket0x794a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x794a_Fixed, ban_until) == 26, "offsetof(NetRPacket0x794a_Fixed, ban_until) == 26"); +static_assert(sizeof(NetRPacket0x794a_Fixed) == 30, "sizeof(NetRPacket0x794a_Fixed) == 30"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794a_Fixed *network, RPacket0x794a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794a_Fixed *native, NetRPacket0x794a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct SPacket0x794b_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetSPacket0x794b_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket0x794b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794b_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794b_Fixed, account_id) == 2, "offsetof(NetSPacket0x794b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x794b_Fixed, account_name) == 6, "offsetof(NetSPacket0x794b_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x794b_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794b_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket0x794b_Fixed) == 34, "sizeof(NetSPacket0x794b_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794b_Fixed *network, SPacket0x794b_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794b_Fixed *native, NetSPacket0x794b_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct RPacket0x794c_Fixed +{ + uint16_t packet_id; + AccountName account_name; + HumanTimeDiff ban_add; +}; +struct NetRPacket0x794c_Fixed +{ + Little16 packet_id; + NetString account_name; + NetHumanTimeDiff ban_add; +}; +static_assert(offsetof(NetRPacket0x794c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794c_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794c_Fixed, account_name) == 2, "offsetof(NetRPacket0x794c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x794c_Fixed, ban_add) == 26, "offsetof(NetRPacket0x794c_Fixed, ban_add) == 26"); +static_assert(sizeof(NetRPacket0x794c_Fixed) == 38, "sizeof(NetRPacket0x794c_Fixed) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794c_Fixed *network, RPacket0x794c_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_add, native.ban_add); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794c_Fixed *native, NetRPacket0x794c_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_add, network.ban_add); + return rv; +} + +struct SPacket0x794d_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT ban_until; +}; +struct NetSPacket0x794d_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket0x794d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794d_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794d_Fixed, account_id) == 2, "offsetof(NetSPacket0x794d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x794d_Fixed, account_name) == 6, "offsetof(NetSPacket0x794d_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x794d_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794d_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket0x794d_Fixed) == 34, "sizeof(NetSPacket0x794d_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794d_Fixed *network, SPacket0x794d_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->ban_until, native.ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794d_Fixed *native, NetSPacket0x794d_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->ban_until, network.ban_until); + return rv; +} + +struct RPacket0x794e_Head +{ + uint16_t packet_id; + uint16_t unused; + uint32_t string_length; +}; +struct NetRPacket0x794e_Head +{ + Little16 packet_id; + Little16 unused; + Little32 string_length; +}; +static_assert(offsetof(NetRPacket0x794e_Head, packet_id) == 0, "offsetof(NetRPacket0x794e_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x794e_Head, unused) == 2, "offsetof(NetRPacket0x794e_Head, unused) == 2"); +static_assert(offsetof(NetRPacket0x794e_Head, string_length) == 4, "offsetof(NetRPacket0x794e_Head, string_length) == 4"); +static_assert(sizeof(NetRPacket0x794e_Head) == 8, "sizeof(NetRPacket0x794e_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794e_Head *network, RPacket0x794e_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794e_Head *native, NetRPacket0x794e_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct RPacket0x794e_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x794e_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x794e_Repeat, c) == 0, "offsetof(NetRPacket0x794e_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x794e_Repeat) == 1, "sizeof(NetRPacket0x794e_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x794e_Repeat *network, RPacket0x794e_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x794e_Repeat *native, NetRPacket0x794e_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x794f_Fixed +{ + uint16_t packet_id; + uint16_t error; +}; +struct NetSPacket0x794f_Fixed +{ + Little16 packet_id; + Little16 error; +}; +static_assert(offsetof(NetSPacket0x794f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794f_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x794f_Fixed, error) == 2, "offsetof(NetSPacket0x794f_Fixed, error) == 2"); +static_assert(sizeof(NetSPacket0x794f_Fixed) == 4, "sizeof(NetSPacket0x794f_Fixed) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x794f_Fixed *network, SPacket0x794f_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->error, native.error); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x794f_Fixed *native, NetSPacket0x794f_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->error, network.error); + return rv; +} + +struct RPacket0x7950_Fixed +{ + uint16_t packet_id; + AccountName account_name; + HumanTimeDiff valid_add; +}; +struct NetRPacket0x7950_Fixed +{ + Little16 packet_id; + NetString account_name; + NetHumanTimeDiff valid_add; +}; +static_assert(offsetof(NetRPacket0x7950_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7950_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7950_Fixed, account_name) == 2, "offsetof(NetRPacket0x7950_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket0x7950_Fixed, valid_add) == 26, "offsetof(NetRPacket0x7950_Fixed, valid_add) == 26"); +static_assert(sizeof(NetRPacket0x7950_Fixed) == 38, "sizeof(NetRPacket0x7950_Fixed) == 38"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7950_Fixed *network, RPacket0x7950_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_add, native.valid_add); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7950_Fixed *native, NetRPacket0x7950_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_add, network.valid_add); + return rv; +} + +struct SPacket0x7951_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountName account_name; + TimeT valid_until; +}; +struct NetSPacket0x7951_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket0x7951_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7951_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7951_Fixed, account_id) == 2, "offsetof(NetSPacket0x7951_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7951_Fixed, account_name) == 6, "offsetof(NetSPacket0x7951_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket0x7951_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7951_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket0x7951_Fixed) == 34, "sizeof(NetSPacket0x7951_Fixed) == 34"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7951_Fixed *network, SPacket0x7951_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->valid_until, native.valid_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7951_Fixed *native, NetSPacket0x7951_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->valid_until, network.valid_until); + return rv; +} + +struct RPacket0x7952_Fixed +{ + uint16_t packet_id; + AccountName account_name; +}; +struct NetRPacket0x7952_Fixed +{ + Little16 packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket0x7952_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7952_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7952_Fixed, account_name) == 2, "offsetof(NetRPacket0x7952_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket0x7952_Fixed) == 26, "sizeof(NetRPacket0x7952_Fixed) == 26"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7952_Fixed *network, RPacket0x7952_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7952_Fixed *native, NetRPacket0x7952_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} + +struct SPacket0x7953_Head +{ + uint16_t packet_id; + uint32_t account_id; + GmLevel gm_level; + AccountName account_name; + SEX id; + uint32_t login_count; + uint32_t state; + timestamp_seconds_buffer error_message; + timestamp_milliseconds_buffer last_login_string; + VString<15> ip_string; + AccountEmail email; + TimeT connect_until; + TimeT ban_until; + uint16_t string_length; +}; +struct NetSPacket0x7953_Head +{ + Little16 packet_id; + Little32 account_id; + Byte gm_level; + NetString account_name; + Byte id; + Little32 login_count; + Little32 state; + NetString error_message; + NetString last_login_string; + NetString)> ip_string; + NetString email; + Little32 connect_until; + Little32 ban_until; + Little16 string_length; +}; +static_assert(offsetof(NetSPacket0x7953_Head, packet_id) == 0, "offsetof(NetSPacket0x7953_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x7953_Head, account_id) == 2, "offsetof(NetSPacket0x7953_Head, account_id) == 2"); +static_assert(offsetof(NetSPacket0x7953_Head, gm_level) == 6, "offsetof(NetSPacket0x7953_Head, gm_level) == 6"); +static_assert(offsetof(NetSPacket0x7953_Head, account_name) == 7, "offsetof(NetSPacket0x7953_Head, account_name) == 7"); +static_assert(offsetof(NetSPacket0x7953_Head, id) == 31, "offsetof(NetSPacket0x7953_Head, id) == 31"); +static_assert(offsetof(NetSPacket0x7953_Head, login_count) == 32, "offsetof(NetSPacket0x7953_Head, login_count) == 32"); +static_assert(offsetof(NetSPacket0x7953_Head, state) == 36, "offsetof(NetSPacket0x7953_Head, state) == 36"); +static_assert(offsetof(NetSPacket0x7953_Head, error_message) == 40, "offsetof(NetSPacket0x7953_Head, error_message) == 40"); +static_assert(offsetof(NetSPacket0x7953_Head, last_login_string) == 60, "offsetof(NetSPacket0x7953_Head, last_login_string) == 60"); +static_assert(offsetof(NetSPacket0x7953_Head, ip_string) == 84, "offsetof(NetSPacket0x7953_Head, ip_string) == 84"); +static_assert(offsetof(NetSPacket0x7953_Head, email) == 100, "offsetof(NetSPacket0x7953_Head, email) == 100"); +static_assert(offsetof(NetSPacket0x7953_Head, connect_until) == 140, "offsetof(NetSPacket0x7953_Head, connect_until) == 140"); +static_assert(offsetof(NetSPacket0x7953_Head, ban_until) == 144, "offsetof(NetSPacket0x7953_Head, ban_until) == 144"); +static_assert(offsetof(NetSPacket0x7953_Head, string_length) == 148, "offsetof(NetSPacket0x7953_Head, string_length) == 148"); +static_assert(sizeof(NetSPacket0x7953_Head) == 150, "sizeof(NetSPacket0x7953_Head) == 150"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7953_Head *network, SPacket0x7953_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->id, native.id); + rv &= native_to_network(&network->login_count, native.login_count); + rv &= native_to_network(&network->state, native.state); + rv &= native_to_network(&network->error_message, native.error_message); + rv &= native_to_network(&network->last_login_string, native.last_login_string); + rv &= native_to_network(&network->ip_string, native.ip_string); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + rv &= native_to_network(&network->ban_until, native.ban_until); + rv &= native_to_network(&network->string_length, native.string_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7953_Head *native, NetSPacket0x7953_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->id, network.id); + rv &= network_to_native(&native->login_count, network.login_count); + rv &= network_to_native(&native->state, network.state); + rv &= network_to_native(&native->error_message, network.error_message); + rv &= network_to_native(&native->last_login_string, network.last_login_string); + rv &= network_to_native(&native->ip_string, network.ip_string); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + rv &= network_to_native(&native->ban_until, network.ban_until); + rv &= network_to_native(&native->string_length, network.string_length); + return rv; +} + +struct SPacket0x7953_Repeat +{ + uint8_t c; +}; +struct NetSPacket0x7953_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetSPacket0x7953_Repeat, c) == 0, "offsetof(NetSPacket0x7953_Repeat, c) == 0"); +static_assert(sizeof(NetSPacket0x7953_Repeat) == 1, "sizeof(NetSPacket0x7953_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x7953_Repeat *network, SPacket0x7953_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x7953_Repeat *native, NetSPacket0x7953_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x7954_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x7954_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x7954_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7954_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x7954_Fixed, account_id) == 2, "offsetof(NetRPacket0x7954_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x7954_Fixed) == 6, "sizeof(NetRPacket0x7954_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7954_Fixed *network, RPacket0x7954_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7954_Fixed *native, NetRPacket0x7954_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x7955_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x7955_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x7955_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7955_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x7955_Fixed) == 2, "sizeof(NetRPacket0x7955_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x7955_Fixed *network, RPacket0x7955_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x7955_Fixed *native, NetRPacket0x7955_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + + +#endif // TMWA_PROTO2_LOGIN_ADMIN_HPP diff --git a/src/proto2/login-admin_test.cpp b/src/proto2/login-admin_test.cpp new file mode 100644 index 0000000..5bd9566 --- /dev/null +++ b/src/proto2/login-admin_test.cpp @@ -0,0 +1,23 @@ +#include "login-admin.hpp" +// login-admin_test.cpp - TMWA network protocol: login/admin +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/login-char.hpp b/src/proto2/login-char.hpp new file mode 100644 index 0000000..a594207 --- /dev/null +++ b/src/proto2/login-char.hpp @@ -0,0 +1,941 @@ +#ifndef TMWA_PROTO2_LOGIN_CHAR_HPP +#define TMWA_PROTO2_LOGIN_CHAR_HPP +// login-char.hpp - TMWA network protocol: login/char +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is an internal protocol, and can be changed without notice + +struct RPacket0x2709_Fixed +{ + uint16_t packet_id; +}; +struct NetRPacket0x2709_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetRPacket0x2709_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2709_Fixed, packet_id) == 0"); +static_assert(sizeof(NetRPacket0x2709_Fixed) == 2, "sizeof(NetRPacket0x2709_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2709_Fixed *network, RPacket0x2709_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2709_Fixed *native, NetRPacket0x2709_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct RPacket0x2712_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint32_t login_id1; + uint32_t login_id2; + SEX sex; + IP4Address ip; +}; +struct NetRPacket0x2712_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 login_id1; + Little32 login_id2; + Byte sex; + IP4Address ip; +}; +static_assert(offsetof(NetRPacket0x2712_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2712_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2712_Fixed, account_id) == 2, "offsetof(NetRPacket0x2712_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2712_Fixed, login_id1) == 6, "offsetof(NetRPacket0x2712_Fixed, login_id1) == 6"); +static_assert(offsetof(NetRPacket0x2712_Fixed, login_id2) == 10, "offsetof(NetRPacket0x2712_Fixed, login_id2) == 10"); +static_assert(offsetof(NetRPacket0x2712_Fixed, sex) == 14, "offsetof(NetRPacket0x2712_Fixed, sex) == 14"); +static_assert(offsetof(NetRPacket0x2712_Fixed, ip) == 15, "offsetof(NetRPacket0x2712_Fixed, ip) == 15"); +static_assert(sizeof(NetRPacket0x2712_Fixed) == 19, "sizeof(NetRPacket0x2712_Fixed) == 19"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2712_Fixed *network, RPacket0x2712_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->login_id1, native.login_id1); + rv &= native_to_network(&network->login_id2, native.login_id2); + rv &= native_to_network(&network->sex, native.sex); + rv &= native_to_network(&network->ip, native.ip); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2712_Fixed *native, NetRPacket0x2712_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->login_id1, network.login_id1); + rv &= network_to_native(&native->login_id2, network.login_id2); + rv &= network_to_native(&native->sex, network.sex); + rv &= network_to_native(&native->ip, network.ip); + return rv; +} + +struct SPacket0x2713_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t invalid; + AccountEmail email; + TimeT connect_until; +}; +struct NetSPacket0x2713_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte invalid; + NetString email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket0x2713_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2713_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2713_Fixed, account_id) == 2, "offsetof(NetSPacket0x2713_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2713_Fixed, invalid) == 6, "offsetof(NetSPacket0x2713_Fixed, invalid) == 6"); +static_assert(offsetof(NetSPacket0x2713_Fixed, email) == 7, "offsetof(NetSPacket0x2713_Fixed, email) == 7"); +static_assert(offsetof(NetSPacket0x2713_Fixed, connect_until) == 47, "offsetof(NetSPacket0x2713_Fixed, connect_until) == 47"); +static_assert(sizeof(NetSPacket0x2713_Fixed) == 51, "sizeof(NetSPacket0x2713_Fixed) == 51"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2713_Fixed *network, SPacket0x2713_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->invalid, native.invalid); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2713_Fixed *native, NetSPacket0x2713_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->invalid, network.invalid); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + return rv; +} + +struct RPacket0x2714_Fixed +{ + uint16_t packet_id; + uint32_t users; +}; +struct NetRPacket0x2714_Fixed +{ + Little16 packet_id; + Little32 users; +}; +static_assert(offsetof(NetRPacket0x2714_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2714_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2714_Fixed, users) == 2, "offsetof(NetRPacket0x2714_Fixed, users) == 2"); +static_assert(sizeof(NetRPacket0x2714_Fixed) == 6, "sizeof(NetRPacket0x2714_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2714_Fixed *network, RPacket0x2714_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->users, native.users); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2714_Fixed *native, NetRPacket0x2714_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->users, network.users); + return rv; +} + +struct RPacket0x2715_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail email; +}; +struct NetRPacket0x2715_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString email; +}; +static_assert(offsetof(NetRPacket0x2715_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2715_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2715_Fixed, account_id) == 2, "offsetof(NetRPacket0x2715_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2715_Fixed, email) == 6, "offsetof(NetRPacket0x2715_Fixed, email) == 6"); +static_assert(sizeof(NetRPacket0x2715_Fixed) == 46, "sizeof(NetRPacket0x2715_Fixed) == 46"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2715_Fixed *network, RPacket0x2715_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->email, native.email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2715_Fixed *native, NetRPacket0x2715_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->email, network.email); + return rv; +} + +struct RPacket0x2716_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x2716_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2716_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2716_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2716_Fixed, account_id) == 2, "offsetof(NetRPacket0x2716_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x2716_Fixed) == 6, "sizeof(NetRPacket0x2716_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2716_Fixed *network, RPacket0x2716_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2716_Fixed *native, NetRPacket0x2716_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2717_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail email; + TimeT connect_until; +}; +struct NetSPacket0x2717_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket0x2717_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2717_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2717_Fixed, account_id) == 2, "offsetof(NetSPacket0x2717_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2717_Fixed, email) == 6, "offsetof(NetSPacket0x2717_Fixed, email) == 6"); +static_assert(offsetof(NetSPacket0x2717_Fixed, connect_until) == 46, "offsetof(NetSPacket0x2717_Fixed, connect_until) == 46"); +static_assert(sizeof(NetSPacket0x2717_Fixed) == 50, "sizeof(NetSPacket0x2717_Fixed) == 50"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2717_Fixed *network, SPacket0x2717_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->email, native.email); + rv &= native_to_network(&network->connect_until, native.connect_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2717_Fixed *native, NetSPacket0x2717_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->email, network.email); + rv &= network_to_native(&native->connect_until, network.connect_until); + return rv; +} + +struct RPacket0x2720_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetRPacket0x2720_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2720_Head, packet_id) == 0, "offsetof(NetRPacket0x2720_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2720_Head, packet_length) == 2, "offsetof(NetRPacket0x2720_Head, packet_length) == 2"); +static_assert(offsetof(NetRPacket0x2720_Head, account_id) == 4, "offsetof(NetRPacket0x2720_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket0x2720_Head) == 8, "sizeof(NetRPacket0x2720_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2720_Head *network, RPacket0x2720_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2720_Head *native, NetRPacket0x2720_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2720_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2720_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2720_Repeat, c) == 0, "offsetof(NetRPacket0x2720_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2720_Repeat) == 1, "sizeof(NetRPacket0x2720_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2720_Repeat *network, RPacket0x2720_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2720_Repeat *native, NetRPacket0x2720_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct SPacket0x2721_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + GmLevel gm_level; +}; +struct NetSPacket0x2721_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 gm_level; +}; +static_assert(offsetof(NetSPacket0x2721_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2721_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2721_Fixed, account_id) == 2, "offsetof(NetSPacket0x2721_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2721_Fixed, gm_level) == 6, "offsetof(NetSPacket0x2721_Fixed, gm_level) == 6"); +static_assert(sizeof(NetSPacket0x2721_Fixed) == 10, "sizeof(NetSPacket0x2721_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2721_Fixed *network, SPacket0x2721_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2721_Fixed *native, NetSPacket0x2721_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct RPacket0x2722_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountEmail old_email; + AccountEmail new_email; +}; +struct NetRPacket0x2722_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString old_email; + NetString new_email; +}; +static_assert(offsetof(NetRPacket0x2722_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2722_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2722_Fixed, account_id) == 2, "offsetof(NetRPacket0x2722_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2722_Fixed, old_email) == 6, "offsetof(NetRPacket0x2722_Fixed, old_email) == 6"); +static_assert(offsetof(NetRPacket0x2722_Fixed, new_email) == 46, "offsetof(NetRPacket0x2722_Fixed, new_email) == 46"); +static_assert(sizeof(NetRPacket0x2722_Fixed) == 86, "sizeof(NetRPacket0x2722_Fixed) == 86"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2722_Fixed *network, RPacket0x2722_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->old_email, native.old_email); + rv &= native_to_network(&network->new_email, native.new_email); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2722_Fixed *native, NetRPacket0x2722_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->old_email, network.old_email); + rv &= network_to_native(&native->new_email, network.new_email); + return rv; +} + +struct SPacket0x2723_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + SEX sex; +}; +struct NetSPacket0x2723_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte sex; +}; +static_assert(offsetof(NetSPacket0x2723_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2723_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2723_Fixed, account_id) == 2, "offsetof(NetSPacket0x2723_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2723_Fixed, sex) == 6, "offsetof(NetSPacket0x2723_Fixed, sex) == 6"); +static_assert(sizeof(NetSPacket0x2723_Fixed) == 7, "sizeof(NetSPacket0x2723_Fixed) == 7"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2723_Fixed *network, SPacket0x2723_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->sex, native.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2723_Fixed *native, NetSPacket0x2723_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->sex, network.sex); + return rv; +} + +struct RPacket0x2724_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint32_t status; +}; +struct NetRPacket0x2724_Fixed +{ + Little16 packet_id; + Little32 account_id; + Little32 status; +}; +static_assert(offsetof(NetRPacket0x2724_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2724_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2724_Fixed, account_id) == 2, "offsetof(NetRPacket0x2724_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2724_Fixed, status) == 6, "offsetof(NetRPacket0x2724_Fixed, status) == 6"); +static_assert(sizeof(NetRPacket0x2724_Fixed) == 10, "sizeof(NetRPacket0x2724_Fixed) == 10"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2724_Fixed *network, RPacket0x2724_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2724_Fixed *native, NetRPacket0x2724_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->status, network.status); + return rv; +} + +struct RPacket0x2725_Head +{ + uint16_t packet_id; + uint32_t account_id; + HumanTimeDiff deltas; +}; +struct NetRPacket0x2725_Head +{ + Little16 packet_id; + Little32 account_id; + NetHumanTimeDiff deltas; +}; +static_assert(offsetof(NetRPacket0x2725_Head, packet_id) == 0, "offsetof(NetRPacket0x2725_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2725_Head, account_id) == 2, "offsetof(NetRPacket0x2725_Head, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2725_Head, deltas) == 6, "offsetof(NetRPacket0x2725_Head, deltas) == 6"); +static_assert(sizeof(NetRPacket0x2725_Head) == 18, "sizeof(NetRPacket0x2725_Head) == 18"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2725_Head *network, RPacket0x2725_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->deltas, native.deltas); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2725_Head *native, NetRPacket0x2725_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->deltas, network.deltas); + return rv; +} + +struct RPacket0x2725_Repeat +{ + uint8_t c; +}; +struct NetRPacket0x2725_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket0x2725_Repeat, c) == 0, "offsetof(NetRPacket0x2725_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket0x2725_Repeat) == 1, "sizeof(NetRPacket0x2725_Repeat) == 1"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2725_Repeat *network, RPacket0x2725_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2725_Repeat *native, NetRPacket0x2725_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +struct RPacket0x2727_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x2727_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2727_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2727_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2727_Fixed, account_id) == 2, "offsetof(NetRPacket0x2727_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x2727_Fixed) == 6, "sizeof(NetRPacket0x2727_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2727_Fixed *network, RPacket0x2727_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2727_Fixed *native, NetRPacket0x2727_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2728_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetRPacket0x2728_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x2728_Head, packet_id) == 0, "offsetof(NetRPacket0x2728_Head, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2728_Head, packet_length) == 2, "offsetof(NetRPacket0x2728_Head, packet_length) == 2"); +static_assert(offsetof(NetRPacket0x2728_Head, account_id) == 4, "offsetof(NetRPacket0x2728_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket0x2728_Head) == 8, "sizeof(NetRPacket0x2728_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2728_Head *network, RPacket0x2728_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2728_Head *native, NetRPacket0x2728_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct RPacket0x2728_Repeat +{ + VarName name; + uint32_t value; +}; +struct NetRPacket0x2728_Repeat +{ + NetString name; + Little32 value; +}; +static_assert(offsetof(NetRPacket0x2728_Repeat, name) == 0, "offsetof(NetRPacket0x2728_Repeat, name) == 0"); +static_assert(offsetof(NetRPacket0x2728_Repeat, value) == 32, "offsetof(NetRPacket0x2728_Repeat, value) == 32"); +static_assert(sizeof(NetRPacket0x2728_Repeat) == 36, "sizeof(NetRPacket0x2728_Repeat) == 36"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2728_Repeat *network, RPacket0x2728_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->value, native.value); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2728_Repeat *native, NetRPacket0x2728_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->value, network.value); + return rv; +} + +struct SPacket0x2729_Head +{ + uint16_t packet_id; + uint16_t packet_length; + uint32_t account_id; +}; +struct NetSPacket0x2729_Head +{ + Little16 packet_id; + Little16 packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetSPacket0x2729_Head, packet_id) == 0, "offsetof(NetSPacket0x2729_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2729_Head, packet_length) == 2, "offsetof(NetSPacket0x2729_Head, packet_length) == 2"); +static_assert(offsetof(NetSPacket0x2729_Head, account_id) == 4, "offsetof(NetSPacket0x2729_Head, account_id) == 4"); +static_assert(sizeof(NetSPacket0x2729_Head) == 8, "sizeof(NetSPacket0x2729_Head) == 8"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2729_Head *network, SPacket0x2729_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2729_Head *native, NetSPacket0x2729_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2729_Repeat +{ + VarName name; + uint32_t value; +}; +struct NetSPacket0x2729_Repeat +{ + NetString name; + Little32 value; +}; +static_assert(offsetof(NetSPacket0x2729_Repeat, name) == 0, "offsetof(NetSPacket0x2729_Repeat, name) == 0"); +static_assert(offsetof(NetSPacket0x2729_Repeat, value) == 32, "offsetof(NetSPacket0x2729_Repeat, value) == 32"); +static_assert(sizeof(NetSPacket0x2729_Repeat) == 36, "sizeof(NetSPacket0x2729_Repeat) == 36"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2729_Repeat *network, SPacket0x2729_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->name, native.name); + rv &= native_to_network(&network->value, native.value); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2729_Repeat *native, NetSPacket0x2729_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->name, network.name); + rv &= network_to_native(&native->value, network.value); + return rv; +} + +struct RPacket0x272a_Fixed +{ + uint16_t packet_id; + uint32_t account_id; +}; +struct NetRPacket0x272a_Fixed +{ + Little16 packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket0x272a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x272a_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x272a_Fixed, account_id) == 2, "offsetof(NetRPacket0x272a_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket0x272a_Fixed) == 6, "sizeof(NetRPacket0x272a_Fixed) == 6"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x272a_Fixed *network, RPacket0x272a_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x272a_Fixed *native, NetRPacket0x272a_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + return rv; +} + +struct SPacket0x2730_Fixed +{ + uint16_t packet_id; +}; +struct NetSPacket0x2730_Fixed +{ + Little16 packet_id; +}; +static_assert(offsetof(NetSPacket0x2730_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2730_Fixed, packet_id) == 0"); +static_assert(sizeof(NetSPacket0x2730_Fixed) == 2, "sizeof(NetSPacket0x2730_Fixed) == 2"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2730_Fixed *network, SPacket0x2730_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2730_Fixed *native, NetSPacket0x2730_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + return rv; +} + +struct SPacket0x2731_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t ban_not_status; + TimeT status_or_ban_until; +}; +struct NetSPacket0x2731_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte ban_not_status; + Little32 status_or_ban_until; +}; +static_assert(offsetof(NetSPacket0x2731_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2731_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2731_Fixed, account_id) == 2, "offsetof(NetSPacket0x2731_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6, "offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6"); +static_assert(offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7, "offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7"); +static_assert(sizeof(NetSPacket0x2731_Fixed) == 11, "sizeof(NetSPacket0x2731_Fixed) == 11"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2731_Fixed *network, SPacket0x2731_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->ban_not_status, native.ban_not_status); + rv &= native_to_network(&network->status_or_ban_until, native.status_or_ban_until); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2731_Fixed *native, NetSPacket0x2731_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->ban_not_status, network.ban_not_status); + rv &= network_to_native(&native->status_or_ban_until, network.status_or_ban_until); + return rv; +} + +struct SPacket0x2732_Head +{ + uint16_t packet_id; + uint16_t packet_length; +}; +struct NetSPacket0x2732_Head +{ + Little16 packet_id; + Little16 packet_length; +}; +static_assert(offsetof(NetSPacket0x2732_Head, packet_id) == 0, "offsetof(NetSPacket0x2732_Head, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2732_Head, packet_length) == 2, "offsetof(NetSPacket0x2732_Head, packet_length) == 2"); +static_assert(sizeof(NetSPacket0x2732_Head) == 4, "sizeof(NetSPacket0x2732_Head) == 4"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2732_Head *network, SPacket0x2732_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->packet_length, native.packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2732_Head *native, NetSPacket0x2732_Head network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->packet_length, network.packet_length); + return rv; +} + +struct SPacket0x2732_Repeat +{ + uint32_t account_id; + GmLevel gm_level; +}; +struct NetSPacket0x2732_Repeat +{ + Little32 account_id; + Byte gm_level; +}; +static_assert(offsetof(NetSPacket0x2732_Repeat, account_id) == 0, "offsetof(NetSPacket0x2732_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket0x2732_Repeat, gm_level) == 4, "offsetof(NetSPacket0x2732_Repeat, gm_level) == 4"); +static_assert(sizeof(NetSPacket0x2732_Repeat) == 5, "sizeof(NetSPacket0x2732_Repeat) == 5"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2732_Repeat *network, SPacket0x2732_Repeat native) +{ + bool rv = true; + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->gm_level, native.gm_level); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2732_Repeat *native, NetSPacket0x2732_Repeat network) +{ + bool rv = true; + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->gm_level, network.gm_level); + return rv; +} + +struct RPacket0x2740_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + AccountPass old_pass; + AccountPass new_pass; +}; +struct NetRPacket0x2740_Fixed +{ + Little16 packet_id; + Little32 account_id; + NetString old_pass; + NetString new_pass; +}; +static_assert(offsetof(NetRPacket0x2740_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2740_Fixed, packet_id) == 0"); +static_assert(offsetof(NetRPacket0x2740_Fixed, account_id) == 2, "offsetof(NetRPacket0x2740_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket0x2740_Fixed, old_pass) == 6, "offsetof(NetRPacket0x2740_Fixed, old_pass) == 6"); +static_assert(offsetof(NetRPacket0x2740_Fixed, new_pass) == 30, "offsetof(NetRPacket0x2740_Fixed, new_pass) == 30"); +static_assert(sizeof(NetRPacket0x2740_Fixed) == 54, "sizeof(NetRPacket0x2740_Fixed) == 54"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket0x2740_Fixed *network, RPacket0x2740_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->old_pass, native.old_pass); + rv &= native_to_network(&network->new_pass, native.new_pass); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket0x2740_Fixed *native, NetRPacket0x2740_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->old_pass, network.old_pass); + rv &= network_to_native(&native->new_pass, network.new_pass); + return rv; +} + +struct SPacket0x2741_Fixed +{ + uint16_t packet_id; + uint32_t account_id; + uint8_t status; +}; +struct NetSPacket0x2741_Fixed +{ + Little16 packet_id; + Little32 account_id; + Byte status; +}; +static_assert(offsetof(NetSPacket0x2741_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2741_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x2741_Fixed, account_id) == 2, "offsetof(NetSPacket0x2741_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket0x2741_Fixed, status) == 6, "offsetof(NetSPacket0x2741_Fixed, status) == 6"); +static_assert(sizeof(NetSPacket0x2741_Fixed) == 7, "sizeof(NetSPacket0x2741_Fixed) == 7"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x2741_Fixed *network, SPacket0x2741_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->status, native.status); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x2741_Fixed *native, NetSPacket0x2741_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->status, network.status); + return rv; +} + + +#endif // TMWA_PROTO2_LOGIN_CHAR_HPP diff --git a/src/proto2/login-char_test.cpp b/src/proto2/login-char_test.cpp new file mode 100644 index 0000000..9ae0f5a --- /dev/null +++ b/src/proto2/login-char_test.cpp @@ -0,0 +1,23 @@ +#include "login-char.hpp" +// login-char_test.cpp - TMWA network protocol: login/char +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/login-user.hpp b/src/proto2/login-user.hpp new file mode 100644 index 0000000..4c71e8a --- /dev/null +++ b/src/proto2/login-user.hpp @@ -0,0 +1,31 @@ +#ifndef TMWA_PROTO2_LOGIN_USER_HPP +#define TMWA_PROTO2_LOGIN_USER_HPP +// login-user.hpp - TMWA network protocol: login/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + + +#endif // TMWA_PROTO2_LOGIN_USER_HPP diff --git a/src/proto2/login-user_test.cpp b/src/proto2/login-user_test.cpp new file mode 100644 index 0000000..3b623b6 --- /dev/null +++ b/src/proto2/login-user_test.cpp @@ -0,0 +1,23 @@ +#include "login-user.hpp" +// login-user_test.cpp - TMWA network protocol: login/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp new file mode 100644 index 0000000..da59c40 --- /dev/null +++ b/src/proto2/map-user.hpp @@ -0,0 +1,81 @@ +#ifndef TMWA_PROTO2_MAP_USER_HPP +#define TMWA_PROTO2_MAP_USER_HPP +// map-user.hpp - TMWA network protocol: map/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +# include "fwd.hpp" + +# include "types.hpp" + +// This is a public protocol, and changes require client cooperation + +struct SPacket0x0212_Fixed +{ + uint16_t packet_id; + BlockId npc_id; + uint16_t command; + BlockId id; + uint16_t x; + uint16_t y; +}; +struct NetSPacket0x0212_Fixed +{ + Little16 packet_id; + Little32 npc_id; + Little16 command; + Little32 id; + Little16 x; + Little16 y; +}; +static_assert(offsetof(NetSPacket0x0212_Fixed, packet_id) == 0, "offsetof(NetSPacket0x0212_Fixed, packet_id) == 0"); +static_assert(offsetof(NetSPacket0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket0x0212_Fixed, npc_id) == 2"); +static_assert(offsetof(NetSPacket0x0212_Fixed, command) == 6, "offsetof(NetSPacket0x0212_Fixed, command) == 6"); +static_assert(offsetof(NetSPacket0x0212_Fixed, id) == 8, "offsetof(NetSPacket0x0212_Fixed, id) == 8"); +static_assert(offsetof(NetSPacket0x0212_Fixed, x) == 12, "offsetof(NetSPacket0x0212_Fixed, x) == 12"); +static_assert(offsetof(NetSPacket0x0212_Fixed, y) == 14, "offsetof(NetSPacket0x0212_Fixed, y) == 14"); +static_assert(sizeof(NetSPacket0x0212_Fixed) == 16, "sizeof(NetSPacket0x0212_Fixed) == 16"); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->npc_id, native.npc_id); + rv &= native_to_network(&network->command, native.command); + rv &= native_to_network(&network->id, native.id); + rv &= native_to_network(&network->x, native.x); + rv &= native_to_network(&network->y, native.y); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->npc_id, network.npc_id); + rv &= network_to_native(&native->command, network.command); + rv &= network_to_native(&native->id, network.id); + rv &= network_to_native(&native->x, network.x); + rv &= network_to_native(&native->y, network.y); + return rv; +} + + +#endif // TMWA_PROTO2_MAP_USER_HPP diff --git a/src/proto2/map-user_test.cpp b/src/proto2/map-user_test.cpp new file mode 100644 index 0000000..adbdf6f --- /dev/null +++ b/src/proto2/map-user_test.cpp @@ -0,0 +1,23 @@ +#include "map-user.hpp" +// map-user_test.cpp - TMWA network protocol: map/user +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +// This is a generated file, edit tools/protocol.py instead + +#include "../poison.hpp" diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp new file mode 100644 index 0000000..f69d943 --- /dev/null +++ b/src/proto2/types.hpp @@ -0,0 +1,264 @@ +#ifndef TMWA_PROTO2_TYPES_HPP +#define TMWA_PROTO2_TYPES_HPP +// proto2/types.hpp - Forward declarations of packet component types +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 3 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, see . + +# include "fwd.hpp" + +//TODO split the includes +# include +# include "../ints/little.hpp" +# include "../strings/vstring.hpp" +# include "../net/ip.hpp" +# include "../mmo/enums.hpp" +# include "../mmo/human_time_diff.hpp" +# include "../mmo/ids.hpp" +# include "../mmo/strs.hpp" +# include "../mmo/utils.hpp" +# include "../mmo/version.hpp" +template +bool native_to_network(T *network, T native) +{ + *network = native; + return true; +} +template +bool network_to_native(T *native, T network) +{ + *native = network; + return true; +} +template +struct NetString +{ + char data[N]; +}; +template +bool native_to_network(NetString *network, VString native) +{ + // basically WBUF_STRING + char *const begin = network->data; + char *const end = begin + N; + char *const mid = std::copy(native.begin(), native.end(), begin); + std::fill(mid, end, '\0'); + return true; +} +template +bool network_to_native(VString *native, NetString network) +{ + // basically RBUF_STRING + const char *const begin = network.data; + const char *const end = begin + N; + const char *const mid = std::find(begin, end, '\0'); + *native = XString(begin, mid, nullptr); + return true; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(Byte *network, SEX native) +{ + bool rv = true; + uint8_t tmp = static_cast(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(SEX *native, Byte network) +{ + bool rv = true; + uint8_t tmp; + rv &= network_to_native(&tmp, network); + *native = static_cast(tmp); + // TODO this is what really should be doing a checked cast + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little16 *network, Species native) +{ + bool rv = true; + uint16_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Species *native, Little16 network) +{ + bool rv = true; + uint16_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, AccountId native) +{ + bool rv = true; + uint32_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(AccountId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, CharId native) +{ + bool rv = true; + uint32_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(CharId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, PartyId native) +{ + bool rv = true; + uint32_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(PartyId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little16 *network, ItemNameId native) +{ + bool rv = true; + uint16_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(ItemNameId *native, Little16 network) +{ + bool rv = true; + uint16_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, BlockId native) +{ + bool rv = true; + uint32_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(BlockId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +struct NetHumanTimeDiff +{ + Little16 year; + Little16 month; + Little16 day; + Little16 hour; + Little16 minute; + Little16 second; +}; +inline __attribute__((warn_unused_result)) +bool native_to_network(NetHumanTimeDiff *network, HumanTimeDiff native) +{ + bool rv = true; + uint16_t year = native.year; rv &= native_to_network(&network->year, year); + uint16_t month = native.month; rv &= native_to_network(&network->month, month); + uint16_t day = native.day; rv &= native_to_network(&network->day, day); + uint16_t hour = native.hour; rv &= native_to_network(&network->hour, hour); + uint16_t minute = native.minute; rv &= native_to_network(&network->minute, minute); + uint16_t second = native.second; rv &= native_to_network(&network->second, second); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(HumanTimeDiff *native, NetHumanTimeDiff network) +{ + bool rv = true; + uint16_t year; rv &= network_to_native(&year, network.year); native->year = year; + uint16_t month; rv &= network_to_native(&month, network.month); native->month = month; + uint16_t day; rv &= network_to_native(&day, network.day); native->day = day; + uint16_t hour; rv &= network_to_native(&hour, network.hour); native->hour = hour; + uint16_t minute; rv &= network_to_native(&minute, network.minute); native->minute = minute; + uint16_t second; rv &= network_to_native(&second, network.second); native->second = second; + return rv; +} + +struct NetVersion +{ + Byte major; + Byte minor; + Byte patch; + Byte devel; + Byte flags; + Byte which; + Little16 vend; +}; +inline __attribute__((warn_unused_result)) +bool native_to_network(NetVersion *network, Version native) +{ + bool rv = true; + uint8_t major = native.major; rv &= native_to_network(&network->major, major); + uint8_t minor = native.minor; rv &= native_to_network(&network->minor, minor); + uint8_t patch = native.patch; rv &= native_to_network(&network->patch, patch); + uint8_t devel = native.devel; rv &= native_to_network(&network->devel, devel); + uint8_t flags = native.flags; rv &= native_to_network(&network->flags, flags); + uint8_t which = native.which; rv &= native_to_network(&network->which, which); + uint16_t vend = native.vend; rv &= native_to_network(&network->vend, vend); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Version *native, NetVersion network) +{ + bool rv = true; + uint8_t major; rv &= network_to_native(&major, network.major); native->major = major; + uint8_t minor; rv &= network_to_native(&minor, network.minor); native->minor = minor; + uint8_t patch; rv &= network_to_native(&patch, network.patch); native->patch = patch; + uint8_t devel; rv &= network_to_native(&devel, network.devel); native->devel = devel; + uint8_t flags; rv &= network_to_native(&flags, network.flags); native->flags = flags; + uint8_t which; rv &= network_to_native(&which, network.which); native->which = which; + uint16_t vend; rv &= network_to_native(&vend, network.vend); native->vend = vend; + return rv; +} + +#endif // TMWA_PROTO2_TYPES_HPP -- cgit v1.2.3-70-g09d2