summaryrefslogtreecommitdiff
path: root/src/proto2/any-user.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-05-18 02:43:55 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-05-19 17:10:09 -0700
commit2410aeb608329ed57a31315effdfd5a751788616 (patch)
tree4b961100e9aec99c16c6ccae7f1857e763d58b14 /src/proto2/any-user.hpp
parentfccd01bd0fba297531595b51ffb8db044ed6f22c (diff)
downloadtmwa-2410aeb608329ed57a31315effdfd5a751788616.tar.gz
tmwa-2410aeb608329ed57a31315effdfd5a751788616.tar.bz2
tmwa-2410aeb608329ed57a31315effdfd5a751788616.tar.xz
tmwa-2410aeb608329ed57a31315effdfd5a751788616.zip
Convert login/char and login/admin server components to proto-v2
Diffstat (limited to 'src/proto2/any-user.hpp')
-rw-r--r--src/proto2/any-user.hpp102
1 files changed, 55 insertions, 47 deletions
diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp
index f2847ef..037171c 100644
--- a/src/proto2/any-user.hpp
+++ b/src/proto2/any-user.hpp
@@ -7,16 +7,16 @@
// 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
+// it under the terms of the GNU Affero 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.
+// GNU Affero General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
+// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// This is a generated file, edit tools/protocol.py instead
@@ -27,85 +27,93 @@
// This is a public protocol, and changes require client cooperation
-struct RPacket0x7530_Fixed
+struct RPacket_0x7530_Fixed
{
- uint16_t packet_id;
+ using NetType = NetRPacket_0x7530_Fixed;
+ static const uint16_t PACKET_ID = 0x7530;
+
+ uint16_t magic_packet_id = PACKET_ID;
+};
+struct SPacket_0x7531_Fixed
+{
+ using NetType = NetSPacket_0x7531_Fixed;
+ static const uint16_t PACKET_ID = 0x7531;
+
+ uint16_t magic_packet_id = PACKET_ID;
+ Version version = {};
+};
+struct RPacket_0x7532_Fixed
+{
+ using NetType = NetRPacket_0x7532_Fixed;
+ static const uint16_t PACKET_ID = 0x7532;
+
+ uint16_t magic_packet_id = PACKET_ID;
+};
+
+struct NetRPacket_0x7530_Fixed
+{
+ Little16 magic_packet_id;
+};
+static_assert(offsetof(NetRPacket_0x7530_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7530_Fixed, magic_packet_id) == 0");
+static_assert(sizeof(NetRPacket_0x7530_Fixed) == 2, "sizeof(NetRPacket_0x7530_Fixed) == 2");
+struct NetSPacket_0x7531_Fixed
+{
+ Little16 magic_packet_id;
+ NetVersion version;
};
-struct NetRPacket0x7530_Fixed
+static_assert(offsetof(NetSPacket_0x7531_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7531_Fixed, magic_packet_id) == 0");
+static_assert(offsetof(NetSPacket_0x7531_Fixed, version) == 2, "offsetof(NetSPacket_0x7531_Fixed, version) == 2");
+static_assert(sizeof(NetSPacket_0x7531_Fixed) == 10, "sizeof(NetSPacket_0x7531_Fixed) == 10");
+struct NetRPacket_0x7532_Fixed
{
- Little16 packet_id;
+ Little16 magic_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");
+static_assert(offsetof(NetRPacket_0x7532_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7532_Fixed, magic_packet_id) == 0");
+static_assert(sizeof(NetRPacket_0x7532_Fixed) == 2, "sizeof(NetRPacket_0x7532_Fixed) == 2");
+
inline __attribute__((warn_unused_result))
-bool native_to_network(NetRPacket0x7530_Fixed *network, RPacket0x7530_Fixed native)
+bool native_to_network(NetRPacket_0x7530_Fixed *network, RPacket_0x7530_Fixed native)
{
bool rv = true;
- rv &= native_to_network(&network->packet_id, native.packet_id);
+ rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id);
return rv;
}
inline __attribute__((warn_unused_result))
-bool network_to_native(RPacket0x7530_Fixed *native, NetRPacket0x7530_Fixed network)
+bool network_to_native(RPacket_0x7530_Fixed *native, NetRPacket_0x7530_Fixed network)
{
bool rv = true;
- rv &= network_to_native(&native->packet_id, network.packet_id);
+ rv &= network_to_native(&native->magic_packet_id, network.magic_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 native_to_network(NetSPacket_0x7531_Fixed *network, SPacket_0x7531_Fixed native)
{
bool rv = true;
- rv &= native_to_network(&network->packet_id, native.packet_id);
+ rv &= native_to_network(&network->magic_packet_id, native.magic_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 network_to_native(SPacket_0x7531_Fixed *native, NetSPacket_0x7531_Fixed network)
{
bool rv = true;
- rv &= network_to_native(&native->packet_id, network.packet_id);
+ rv &= network_to_native(&native->magic_packet_id, network.magic_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 native_to_network(NetRPacket_0x7532_Fixed *network, RPacket_0x7532_Fixed native)
{
bool rv = true;
- rv &= native_to_network(&network->packet_id, native.packet_id);
+ rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id);
return rv;
}
inline __attribute__((warn_unused_result))
-bool network_to_native(RPacket0x7532_Fixed *native, NetRPacket0x7532_Fixed network)
+bool network_to_native(RPacket_0x7532_Fixed *native, NetRPacket_0x7532_Fixed network)
{
bool rv = true;
- rv &= network_to_native(&native->packet_id, network.packet_id);
+ rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id);
return rv;
}
-
#endif // TMWA_PROTO2_ANY_USER_HPP