summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-15 17:50:51 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-12 21:18:04 +0300
commit175de7f89d615491f2aa3a2d6bdd3f08bb24ae49 (patch)
tree43b00e788a02ece52383627282aa3bc3c5a08943 /src/login
parent6988272675e7e3e1e6f117e93ff0fdf8f59559d2 (diff)
downloadhercules-175de7f89d615491f2aa3a2d6bdd3f08bb24ae49.tar.gz
hercules-175de7f89d615491f2aa3a2d6bdd3f08bb24ae49.tar.bz2
hercules-175de7f89d615491f2aa3a2d6bdd3f08bb24ae49.tar.xz
hercules-175de7f89d615491f2aa3a2d6bdd3f08bb24ae49.zip
Rename structs packet_* into PACKET_*
Diffstat (limited to 'src/login')
-rw-r--r--src/login/lclif.c38
-rw-r--r--src/login/lclif.p.h69
2 files changed, 51 insertions, 56 deletions
diff --git a/src/login/lclif.c b/src/login/lclif.c
index a54d9f11c..f0d711303 100644
--- a/src/login/lclif.c
+++ b/src/login/lclif.c
@@ -49,7 +49,7 @@ struct lclif_interface *lclif;
/// @copydoc lclif_interface::connection_error()
static void lclif_connection_error(int fd, uint8 error)
{
- struct packet_SC_NOTIFY_BAN *packet = NULL;
+ struct PACKET_SC_NOTIFY_BAN *packet = NULL;
WFIFOHEAD(fd, sizeof(*packet));
packet = WP2PTR(fd);
packet->packet_id = HEADER_SC_NOTIFY_BAN;
@@ -68,7 +68,7 @@ static enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct l
static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd)
{
- const struct packet_CA_EXE_HASHCHECK *packet = RP2PTR(fd);
+ const struct PACKET_CA_EXE_HASHCHECK *packet = RP2PTR(fd);
sd->has_client_hash = 1;
memcpy(sd->client_hash, packet->hash_value, 16);
return PACKET_VALID;
@@ -78,7 +78,7 @@ static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_se
static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -97,7 +97,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_da
static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN2 *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN2 *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -113,7 +113,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_d
static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN3 *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN3 *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -131,7 +131,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_d
static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN4 *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN4 *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -149,7 +149,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_d
static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN_PCBANG *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN_PCBANG *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -171,7 +171,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_ses
static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd)
{
- const struct packet_CA_LOGIN_HAN *packet = RP2PTR(fd);
+ const struct PACKET_CA_LOGIN_HAN *packet = RP2PTR(fd);
sd->version = packet->version;
sd->clienttype = packet->clienttype;
@@ -194,11 +194,11 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_sessio
static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd)
{
- const struct packet_CA_SSO_LOGIN_REQ *packet = RP2PTR(fd);
+ const struct PACKET_CA_SSO_LOGIN_REQ *packet = RP2PTR(fd);
int tokenlen = (int)RFIFOREST(fd) - (int)sizeof(*packet);
if (tokenlen > PASSWD_LEN || tokenlen < 1) {
- ShowError("packet_CA_SSO_LOGIN_REQ: Token length is not between allowed password length, kicking player ('%s')", packet->id);
+ ShowError("PACKET_CA_SSO_LOGIN_REQ: Token length is not between allowed password length, kicking player ('%s')", packet->id);
sockt->eof(fd);
return PACKET_VALID;
}
@@ -220,7 +220,7 @@ static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_se
static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd)
{
- //const struct packet_CA_LOGIN_OTP *packet = RP2PTR(fd);
+ //const struct PACKET_CA_LOGIN_OTP *packet = RP2PTR(fd);
login->client_login_otp(fd, sd);
return PACKET_VALID;
}
@@ -271,7 +271,7 @@ static bool lclif_send_server_list(struct login_session_data *sd)
{
int server_num = 0, i, n, length;
uint32 ip;
- struct packet_AC_ACCEPT_LOGIN *packet = NULL;
+ struct PACKET_AC_ACCEPT_LOGIN *packet = NULL;
for (i = 0; i < ARRAYLENGTH(login->dbs->server); ++i) {
if (sockt->session_is_active(login->dbs->server[i].fd))
@@ -328,13 +328,13 @@ static bool lclif_send_server_list(struct login_session_data *sd)
static void lclif_send_auth_failed(int fd, time_t ban, uint32 error)
{
#if PACKETVER >= 20180627
- struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL;
+ struct PACKET_AC_REFUSE_LOGIN_R2 *packet = NULL;
int packet_id = HEADER_AC_REFUSE_LOGIN_R3;
#elif PACKETVER >= 20101123
- struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL;
+ struct PACKET_AC_REFUSE_LOGIN_R2 *packet = NULL;
int packet_id = HEADER_AC_REFUSE_LOGIN_R2;
#else
- struct packet_AC_REFUSE_LOGIN *packet = NULL;
+ struct PACKET_AC_REFUSE_LOGIN *packet = NULL;
int packet_id = HEADER_AC_REFUSE_LOGIN;
#endif
WFIFOHEAD(fd, sizeof(*packet));
@@ -351,7 +351,7 @@ static void lclif_send_auth_failed(int fd, time_t ban, uint32 error)
/// @copydoc lclif_interface::login_error()
static void lclif_send_login_error(int fd, uint8 error)
{
- struct packet_AC_REFUSE_LOGIN *packet = NULL;
+ struct PACKET_AC_REFUSE_LOGIN *packet = NULL;
WFIFOHEAD(fd, sizeof(*packet));
packet = WP2PTR(fd);
packet->packet_id = HEADER_AC_REFUSE_LOGIN;
@@ -364,7 +364,7 @@ static void lclif_send_login_error(int fd, uint8 error)
static void lclif_send_coding_key(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static void lclif_send_coding_key(int fd, struct login_session_data *sd)
{
- struct packet_AC_ACK_HASH *packet = NULL;
+ struct PACKET_AC_ACK_HASH *packet = NULL;
int16 size = sizeof(*packet) + sd->md5keylen;
WFIFOHEAD(fd, size);
@@ -519,7 +519,7 @@ static void packetdb_loaddb(void)
int16 packet_len;
LoginParseFunc **pFunc;
} packet[] = {
-#define packet_def(name) { HEADER_ ## name, sizeof(struct packet_ ## name), &lclif->p->parse_ ## name }
+#define packet_def(name) { HEADER_ ## name, sizeof(struct PACKET_ ## name), &lclif->p->parse_ ## name }
#define packet_def2(name, len) { HEADER_ ## name, (len), &lclif->p->parse_ ## name }
packet_def(CA_CONNECT_INFO_CHANGED),
packet_def(CA_EXE_HASHCHECK),
@@ -553,7 +553,7 @@ static void packetdb_loaddb(void)
}
//Explict case, we will save character login packet in position 0 which is unused and not valid by normal
- lclif->p->dbs->packet_db[0].len = sizeof(struct packet_CA_CHARSERVERCONNECT);
+ lclif->p->dbs->packet_db[0].len = sizeof(struct PACKET_CA_CHARSERVERCONNECT);
lclif->p->dbs->packet_db[0].pFunc = &lclif->p->parse_CA_CHARSERVERCONNECT;
}
diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h
index 6fe3e050c..f383998dc 100644
--- a/src/login/lclif.p.h
+++ b/src/login/lclif.p.h
@@ -76,7 +76,7 @@ enum login_packet_id {
/**
* Packet structure for CA_LOGIN.
*/
-struct packet_CA_LOGIN {
+struct PACKET_CA_LOGIN {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -87,7 +87,7 @@ struct packet_CA_LOGIN {
/**
* Packet structure for CA_LOGIN2.
*/
-struct packet_CA_LOGIN2 {
+struct PACKET_CA_LOGIN2 {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN2)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -98,7 +98,7 @@ struct packet_CA_LOGIN2 {
/**
* Packet structure for CA_LOGIN3.
*/
-struct packet_CA_LOGIN3 {
+struct PACKET_CA_LOGIN3 {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN3)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -110,7 +110,7 @@ struct packet_CA_LOGIN3 {
/**
* Packet structure for CA_LOGIN4.
*/
-struct packet_CA_LOGIN4 {
+struct PACKET_CA_LOGIN4 {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN4)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -122,7 +122,7 @@ struct packet_CA_LOGIN4 {
/**
* Packet structure for CA_LOGIN_PCBANG.
*/
-struct packet_CA_LOGIN_PCBANG {
+struct PACKET_CA_LOGIN_PCBANG {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_PCBANG)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -135,7 +135,7 @@ struct packet_CA_LOGIN_PCBANG {
/**
* Packet structure for CA_LOGIN_HAN.
*/
-struct packet_CA_LOGIN_HAN {
+struct PACKET_CA_LOGIN_HAN {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_HAN)
uint32 version; ///< Client Version
char id[24]; ///< Username
@@ -151,7 +151,7 @@ struct packet_CA_LOGIN_HAN {
*
* Variable-length packet.
*/
-struct packet_CA_SSO_LOGIN_REQ {
+struct PACKET_CA_SSO_LOGIN_REQ {
int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ)
int16 packet_len; ///< Length (variable length)
uint32 version; ///< Clientver
@@ -176,9 +176,6 @@ struct PACKET_CA_ACK_MOBILE_OTP {
char code[6]; ///< Code
} __attribute__((packed));
DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3);
-
-// for enum login_packet_id
-#define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP
#endif
#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO)
@@ -187,14 +184,12 @@ struct PACKET_CA_OTP_CODE {
char code[9]; ///< Code
} __attribute__((packed));
DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0);
-
-#define packet_CA_OTP_CODE PACKET_CA_OTP_CODE
#endif
/**
* Packet structure for CA_LOGIN_OTP.
*/
-struct packet_CA_LOGIN_OTP {
+struct PACKET_CA_LOGIN_OTP {
int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_OTP)
#if PACKETVER >= 20171113
uint32 devFlags; ///< flags including dev flag
@@ -205,7 +200,7 @@ struct packet_CA_LOGIN_OTP {
} __attribute__((packed));
#if 0 // Unused
-struct packet_CA_SSO_LOGIN_REQa {
+struct PACKET_CA_SSO_LOGIN_REQa {
int16 packet_id;
int16 packet_len;
uint32 version;
@@ -222,7 +217,7 @@ struct packet_CA_SSO_LOGIN_REQa {
*
* New alive packet. Used to verify if client is always alive.
*/
-struct packet_CA_CONNECT_INFO_CHANGED {
+struct PACKET_CA_CONNECT_INFO_CHANGED {
int16 packet_id; ///< Packet ID (#HEADER_CA_CONNECT_INFO_CHANGED)
char id[24]; ///< account.userid
} __attribute__((packed));
@@ -232,7 +227,7 @@ struct packet_CA_CONNECT_INFO_CHANGED {
*
* (kRO 2004-05-31aSakexe langtype 0 and 6)
*/
-struct packet_CA_EXE_HASHCHECK {
+struct PACKET_CA_EXE_HASHCHECK {
int16 packet_id; ///< Packet ID (#HEADER_CA_EXE_HASHCHECK)
uint8 hash_value[16]; ///< Client MD5 hash
} __attribute__((packed));
@@ -240,7 +235,7 @@ struct packet_CA_EXE_HASHCHECK {
/**
* Packet structure for CA_REQ_HASH.
*/
-struct packet_CA_REQ_HASH {
+struct PACKET_CA_REQ_HASH {
int16 packet_id; ///< Packet ID (#HEADER_CA_REQ_HASH)
} __attribute__((packed));
@@ -249,7 +244,7 @@ struct packet_CA_REQ_HASH {
*
* This packet is used internally, to signal a char-server connection.
*/
-struct packet_CA_CHARSERVERCONNECT {
+struct PACKET_CA_CHARSERVERCONNECT {
int16 packet_id; ///< Packet ID (#HEADER_CA_CHARSERVERCONNECT)
char userid[24]; ///< Username
char password[24]; ///< Password
@@ -265,7 +260,7 @@ struct packet_CA_CHARSERVERCONNECT {
/**
* Packet structure for SC_NOTIFY_BAN.
*/
-struct packet_SC_NOTIFY_BAN {
+struct PACKET_SC_NOTIFY_BAN {
int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN)
uint8 error_code; ///< Error code
} __attribute__((packed));
@@ -273,7 +268,7 @@ struct packet_SC_NOTIFY_BAN {
/**
* Packet structure for AC_REFUSE_LOGIN.
*/
-struct packet_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
@@ -282,7 +277,7 @@ struct packet_AC_REFUSE_LOGIN {
/**
* Packet structure for AC_REFUSE_LOGIN_R2.
*/
-struct packet_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
@@ -293,7 +288,7 @@ struct packet_AC_REFUSE_LOGIN_R2 {
*
* Variable-length packet.
*/
-struct packet_AC_ACCEPT_LOGIN {
+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
@@ -324,7 +319,7 @@ struct packet_AC_ACCEPT_LOGIN {
*
* Variable-length packet
*/
-struct packet_AC_ACK_HASH {
+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
@@ -361,20 +356,20 @@ struct lclif_interface_private {
*/
enum parsefunc_rcode (*parse_sub)(int fd, struct login_session_data *sd);
- LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED; ///< Packet handler for #packet_CA_CONNECT_INFO_CHANGED.
- LoginParseFunc *parse_CA_EXE_HASHCHECK; ///< Packet handler for #packet_CA_EXE_HASHCHECK.
- LoginParseFunc *parse_CA_LOGIN; ///< Packet handler for #packet_CA_LOGIN.
- LoginParseFunc *parse_CA_LOGIN2; ///< Packet handler for #packet_CA_LOGIN2.
- LoginParseFunc *parse_CA_LOGIN3; ///< Packet handler for #packet_CA_LOGIN3.
- LoginParseFunc *parse_CA_LOGIN4; ///< Packet handler for #packet_CA_LOGIN4.
- LoginParseFunc *parse_CA_LOGIN_PCBANG; ///< Packet handler for #packet_CA_LOGIN_PCBANG.
- LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #packet_CA_LOGIN_HAN.
- LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #packet_CA_SSO_LOGIN_REQ.
- LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #packet_CA_LOGIN_OTP.
- LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #packet_CA_ACK_MOBILE_OTP.
- LoginParseFunc *parse_CA_OTP_CODE; ///< Packet handler for #packet_CA_OTP_CODE.
- LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #packet_CA_REQ_HASH.
- LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #packet_CA_CHARSERVERCONNECT.
+ LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED; ///< Packet handler for #PACKET_CA_CONNECT_INFO_CHANGED.
+ LoginParseFunc *parse_CA_EXE_HASHCHECK; ///< Packet handler for #PACKET_CA_EXE_HASHCHECK.
+ LoginParseFunc *parse_CA_LOGIN; ///< Packet handler for #PACKET_CA_LOGIN.
+ LoginParseFunc *parse_CA_LOGIN2; ///< Packet handler for #PACKET_CA_LOGIN2.
+ LoginParseFunc *parse_CA_LOGIN3; ///< Packet handler for #PACKET_CA_LOGIN3.
+ LoginParseFunc *parse_CA_LOGIN4; ///< Packet handler for #PACKET_CA_LOGIN4.
+ LoginParseFunc *parse_CA_LOGIN_PCBANG; ///< Packet handler for #PACKET_CA_LOGIN_PCBANG.
+ LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #PACKET_CA_LOGIN_HAN.
+ LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #PACKET_CA_SSO_LOGIN_REQ.
+ LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #PACKET_CA_LOGIN_OTP.
+ LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #PACKET_CA_ACK_MOBILE_OTP.
+ LoginParseFunc *parse_CA_OTP_CODE; ///< Packet handler for #PACKET_CA_OTP_CODE.
+ LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #PACKET_CA_REQ_HASH.
+ LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #PACKET_CA_CHARSERVERCONNECT.
};
#endif // LOGIN_LCLIF_P_H