diff options
author | Haru <haru@dotalux.com> | 2016-04-16 15:21:18 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-04-16 15:21:18 +0200 |
commit | 15c9710832c5a4d734559c5e1b0bb9b4a92cf73a (patch) | |
tree | cb17ee3e7f29914e999f90d2792b5d7233ac477f /src/login | |
parent | 45bbb3de140b0403d36ba5d2168c0a776869db44 (diff) | |
download | hercules-15c9710832c5a4d734559c5e1b0bb9b4a92cf73a.tar.gz hercules-15c9710832c5a4d734559c5e1b0bb9b4a92cf73a.tar.bz2 hercules-15c9710832c5a4d734559c5e1b0bb9b4a92cf73a.tar.xz hercules-15c9710832c5a4d734559c5e1b0bb9b4a92cf73a.zip |
Moved packet_db to the private interface of lclif
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/lclif.c | 18 | ||||
-rw-r--r-- | src/login/lclif.p.h | 9 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/login/lclif.c b/src/login/lclif.c index 07193ac0f..9515c5940 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -43,10 +43,9 @@ struct lclif_interface lclif_s; struct lclif_interface_private lclif_p; +struct lclif_interface_dbs lclif_dbs; struct lclif_interface *lclif; -struct login_packet_db packet_db[MAX_PACKET_DB + 1]; ///< Packet database. - /// @copydoc lclif_interface::connection_error() void lclif_connection_error(int fd, uint8 error) { @@ -462,12 +461,12 @@ enum parsefunc_rcode lclif_parse_sub(int fd, struct login_session_data *sd) const struct login_packet_db *lclif_packet(int16 packet_id) { if (packet_id == PACKET_ID_CA_CHARSERVERCONNECT) - return &packet_db[0]; + return &lclif->p->dbs->packet_db[0]; if (packet_id > MAX_PACKET_DB || packet_id < MIN_PACKET_DB) return NULL; - return &packet_db[packet_id]; + return &lclif->p->dbs->packet_db[packet_id]; } /// @copydoc lclif_interface::parse_packet() @@ -505,18 +504,18 @@ void packetdb_loaddb(void) }; int length = ARRAYLENGTH(packet); - memset(packet_db, '\0', sizeof(packet_db)); + memset(lclif->p->dbs->packet_db, '\0', sizeof(lclif->p->dbs->packet_db)); for (i = 0; i < length; ++i) { int16 packet_id = packet[i].packet_id; Assert_retb(packet_id >= MIN_PACKET_DB && packet_id < MAX_PACKET_DB); - packet_db[packet_id].len = packet[i].packet_len; - packet_db[packet_id].pFunc = packet[i].pFunc; + lclif->p->dbs->packet_db[packet_id].len = packet[i].packet_len; + lclif->p->dbs->packet_db[packet_id].pFunc = packet[i].pFunc; } //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->p->parse_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; } /// @copydoc lclif_interface::init() @@ -535,6 +534,7 @@ void lclif_defaults(void) { lclif = &lclif_s; lclif->p = &lclif_p; + lclif->p->dbs = &lclif_dbs; lclif->init = lclif_init; lclif->final = lclif_final; diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index e57c5e50d..ae9d1bc14 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -282,9 +282,18 @@ struct packet_AC_ACK_HASH { #endif // not NetBSD < 6 / Solaris /** + * Login Client Interface additional data + */ +struct lclif_interface_dbs { + struct login_packet_db packet_db[MAX_PACKET_DB + 1]; ///< Packet database. +}; + +/** * Login Client Interface Private Interface */ struct lclif_interface_private { + struct lclif_interface_dbs *dbs; + /** * Populates the packet database. */ |