From 6343c26dec1b8e9ae36fc3b8426dfd7b7dc09d7e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 18:24:49 +0300 Subject: Move packets struct in login server into separate files for AC and CA packets. --- src/login/packets_ac_struct.h | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 src/login/packets_ac_struct.h (limited to 'src/login/packets_ac_struct.h') diff --git a/src/login/packets_ac_struct.h b/src/login/packets_ac_struct.h new file mode 100644 index 000000000..6ec92b38f --- /dev/null +++ b/src/login/packets_ac_struct.h @@ -0,0 +1,125 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016-2018 Hercules Dev Team + * + * Hercules 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 . + */ +#ifndef LOGIN_PACKETS_AC_STRUCT_H +#define LOGIN_PACKETS_AC_STRUCT_H + +#include "common/hercules.h" +#include "common/mmo.h" +#include "common/packetsstatic_len.h" + +/* Enums */ + +/// Packet IDs +enum login_ac_packet_id { + HEADER_AC_ACCEPT_LOGIN = 0x0069, + HEADER_AC_ACCEPT_LOGIN2 = 0x0ac4, + HEADER_AC_REFUSE_LOGIN = 0x006a, + HEADER_SC_NOTIFY_BAN = 0x0081, + HEADER_AC_ACK_HASH = 0x01dc, + HEADER_AC_REFUSE_LOGIN_R2 = 0x083e, + HEADER_AC_REFUSE_LOGIN_R3 = 0x0b02, +}; + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +/** + * Packet structure for SC_NOTIFY_BAN. + */ +struct PACKET_SC_NOTIFY_BAN { + int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN) + uint8 error_code; ///< Error code +} __attribute__((packed)); + +/** + * Packet structure for AC_REFUSE_LOGIN. + */ +struct PACKET_AC_REFUSE_LOGIN { + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN) + uint8 error_code; ///< Error code + char block_date[20]; ///< Ban expiration date +} __attribute__((packed)); + +/** + * Packet structure for AC_REFUSE_LOGIN_R2. + */ +struct PACKET_AC_REFUSE_LOGIN_R2 { + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN_R2) + uint32 error_code; ///< Error code + char block_date[20]; ///< Ban expiration date +} __attribute__((packed)); + +/** + * Packet structure for AC_ACCEPT_LOGIN. + * + * Variable-length packet. + */ +struct PACKET_AC_ACCEPT_LOGIN { + int16 packet_id; ///< Packet ID (#HEADER_AC_ACCEPT_LOGIN) + int16 packet_len; ///< Packet length (variable length) + int32 auth_code; ///< Authentication code + uint32 aid; ///< Account ID + uint32 user_level; ///< User level + uint32 last_login_ip; ///< Last login IP + char last_login_time[26]; ///< Last login timestamp + uint8 sex; ///< Account sex +#if PACKETVER >= 20170315 + char twitter_auth_token[16]; + uint8 twitter_flag; +#endif + struct { + uint32 ip; ///< Server IP address + int16 port; ///< Server port + char name[20]; ///< Server name + uint16 usercount; ///< Online users + uint16 state; ///< Server state + uint16 property; ///< Server property +#if PACKETVER >= 20170315 + char unknown2[128]; +#endif + } server_list[]; ///< List of charservers +} __attribute__((packed)); + +/** + * Packet structure for AC_ACK_HASH. + * + * Variable-length packet + */ +struct PACKET_AC_ACK_HASH { + int16 packet_id; ///< Packet ID (#HEADER_AC_ACK_HASH) + int16 packet_len; ///< Packet length (variable length) + uint8 secret[]; ///< Challenge string +} __attribute__((packed)); + +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) +struct PACKET_AC_REQ_MOBILE_OTP { + int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) + uint32 aid; ///< Account ID +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); +#endif + +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(pop) +#endif // not NetBSD < 6 / Solaris + +#endif // LOGIN_PACKETS_AC_STRUCT_H -- cgit v1.2.3-70-g09d2