summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-15 20:14:43 +0200
committerHaru <haru@dotalux.com>2016-04-16 07:45:16 +0200
commitfb262785af40bfb07918d1ef61641ec88175d559 (patch)
tree256ef5b782c8402feee784c6d1dd68ea52e93fd8 /src/login
parent37cc46c5e02bc62a8b510fb53f5c2ed0f2ee5d5f (diff)
downloadhercules-fb262785af40bfb07918d1ef61641ec88175d559.tar.gz
hercules-fb262785af40bfb07918d1ef61641ec88175d559.tar.bz2
hercules-fb262785af40bfb07918d1ef61641ec88175d559.tar.xz
hercules-fb262785af40bfb07918d1ef61641ec88175d559.zip
Added lclif packet handlers to the lclif interface
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r--src/login/lclif.c22
-rw-r--r--src/login/lclif.h4
-rw-r--r--src/login/lclif.p.h12
3 files changed, 31 insertions, 7 deletions
diff --git a/src/login/lclif.c b/src/login/lclif.c
index 9e672bab9..c869282c9 100644
--- a/src/login/lclif.c
+++ b/src/login/lclif.c
@@ -450,7 +450,7 @@ const struct login_packet_db *lclif_packet(int16 packet_id)
enum parsefunc_rcode lclif_parse_packet(const struct login_packet_db *lpd, int fd, struct login_session_data *sd)
{
int result;
- result = lpd->pFunc(fd, sd);
+ result = (*lpd->pFunc)(fd, sd);
RFIFOSKIP(fd, (lpd->len == -1) ? RFIFOW(fd, 2) : lpd->len);
return result;
}
@@ -461,10 +461,10 @@ void packetdb_loaddb(void)
struct packet {
int16 packet_id;
int16 packet_len;
- int (*pFunc)(int, struct login_session_data *);
+ LoginParseFunc **pFunc;
} packet[] = {
-#define packet_def(name) { PACKET_ID_ ## name, sizeof(struct packet_ ## name), lclif_parse_ ## name }
-#define packet_def2(name, len) { PACKET_ID_ ## name, (len), lclif_parse_ ## name }
+#define packet_def(name) { PACKET_ID_ ## name, sizeof(struct packet_ ## name), &lclif->p->parse_ ## name }
+#define packet_def2(name, len) { PACKET_ID_ ## name, (len), &lclif->p->parse_ ## name }
packet_def(CA_CONNECT_INFO_CHANGED),
packet_def(CA_EXE_HASHCHECK),
packet_def(CA_LOGIN),
@@ -491,7 +491,7 @@ void packetdb_loaddb(void)
//Explict case, we will save character login packet in position 0 which is unused and not valid by normal
packet_db[0].len = sizeof(struct packet_CA_CHARSERVERCONNECT);
- packet_db[0].pFunc = lclif_parse_CA_CHARSERVERCONNECT;
+ packet_db[0].pFunc = &lclif->p->parse_CA_CHARSERVERCONNECT;
}
void lclif_init(void)
@@ -523,4 +523,16 @@ void lclif_defaults(void)
lclif->p->packetdb_loaddb = packetdb_loaddb;
lclif->p->parse_sub = lclif_parse_sub;
+
+ lclif->p->parse_CA_CONNECT_INFO_CHANGED = lclif_parse_CA_CONNECT_INFO_CHANGED;
+ lclif->p->parse_CA_EXE_HASHCHECK = lclif_parse_CA_EXE_HASHCHECK;
+ lclif->p->parse_CA_LOGIN = lclif_parse_CA_LOGIN;
+ lclif->p->parse_CA_LOGIN2 = lclif_parse_CA_LOGIN2;
+ lclif->p->parse_CA_LOGIN3 = lclif_parse_CA_LOGIN3;
+ lclif->p->parse_CA_LOGIN4 = lclif_parse_CA_LOGIN4;
+ lclif->p->parse_CA_LOGIN_PCBANG = lclif_parse_CA_LOGIN_PCBANG;
+ lclif->p->parse_CA_LOGIN_HAN = lclif_parse_CA_LOGIN_HAN;
+ lclif->p->parse_CA_SSO_LOGIN_REQ = lclif_parse_CA_SSO_LOGIN_REQ;
+ lclif->p->parse_CA_REQ_HASH = lclif_parse_CA_REQ_HASH;
+ lclif->p->parse_CA_CHARSERVERCONNECT = lclif_parse_CA_CHARSERVERCONNECT;
}
diff --git a/src/login/lclif.h b/src/login/lclif.h
index cf6314fc8..5eb5a75aa 100644
--- a/src/login/lclif.h
+++ b/src/login/lclif.h
@@ -43,8 +43,8 @@ typedef enum parsefunc_rcode (LoginParseFunc)(int fd, struct login_session_data
/* Structs */
/// Login packet DB entry
struct login_packet_db {
- int16 len; ///< Packet length
- LoginParseFunc *pFunc; ///< Packet parsing function
+ int16 len; ///< Packet length
+ LoginParseFunc **pFunc; ///< Packet parsing function
};
struct lclif_interface {
diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h
index ad9a08e4d..b0811c7c6 100644
--- a/src/login/lclif.p.h
+++ b/src/login/lclif.p.h
@@ -259,6 +259,18 @@ struct packet_AC_ACK_HASH {
struct lclif_interface_private {
void (*packetdb_loaddb)(void);
enum parsefunc_rcode (*parse_sub)(int fd, struct login_session_data *sd);
+
+ LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED;
+ LoginParseFunc *parse_CA_EXE_HASHCHECK;
+ LoginParseFunc *parse_CA_LOGIN;
+ LoginParseFunc *parse_CA_LOGIN2;
+ LoginParseFunc *parse_CA_LOGIN3;
+ LoginParseFunc *parse_CA_LOGIN4;
+ LoginParseFunc *parse_CA_LOGIN_PCBANG;
+ LoginParseFunc *parse_CA_LOGIN_HAN;
+ LoginParseFunc *parse_CA_SSO_LOGIN_REQ;
+ LoginParseFunc *parse_CA_REQ_HASH;
+ LoginParseFunc *parse_CA_CHARSERVERCONNECT;
};
#endif // LOGIN_LCLIF_P_H