diff options
author | Haru <haru@dotalux.com> | 2016-04-14 13:38:12 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-04-16 07:41:09 +0200 |
commit | ceef84e730a89b9ff462862bba66e2da1c25617e (patch) | |
tree | f7a7028d15fd3d9bc1b48418dd4a9c577cdcb239 /src | |
parent | c8ff1e77501d3edd9bf79fa7ab0281092906735c (diff) | |
download | hercules-ceef84e730a89b9ff462862bba66e2da1c25617e.tar.gz hercules-ceef84e730a89b9ff462862bba66e2da1c25617e.tar.bz2 hercules-ceef84e730a89b9ff462862bba66e2da1c25617e.tar.xz hercules-ceef84e730a89b9ff462862bba66e2da1c25617e.zip |
HPM Hooks Update
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/common/HPMDataCheck.h | 6 | ||||
-rw-r--r-- | src/common/HPMSymbols.inc.h | 6 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 81 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 21 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 499 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.sources.inc | 1 |
6 files changed, 379 insertions, 235 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 7e88b5a34..048855edb 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -270,6 +270,12 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define LOGIN_ACCOUNT_H #endif // LOGIN_ACCOUNT_H + #ifdef LOGIN_LCLIF_H + { "lclif_interface", sizeof(struct lclif_interface), SERVER_TYPE_LOGIN }, + { "login_packet_db", sizeof(struct login_packet_db), SERVER_TYPE_LOGIN }, + #else + #define LOGIN_LCLIF_H + #endif // LOGIN_LCLIF_H #ifdef LOGIN_LOGIN_H { "Login_Config", sizeof(struct Login_Config), SERVER_TYPE_LOGIN }, { "client_hash_node", sizeof(struct client_hash_node), SERVER_TYPE_LOGIN }, diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index b06c43bf8..be758a055 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -129,6 +129,9 @@ struct irc_bot_interface *ircbot; #ifdef MAP_ITEMDB_H /* itemdb */ struct itemdb_interface *itemdb; #endif // MAP_ITEMDB_H +#ifdef LOGIN_LCLIF_H /* lclif */ +struct lclif_interface *lclif; +#endif // LOGIN_LCLIF_H #ifdef COMMON_CONF_H /* libconfig */ struct libconfig_interface *libconfig; #endif // COMMON_CONF_H @@ -358,6 +361,9 @@ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("ircbot", ircbot)) return "ir #ifdef MAP_ITEMDB_H /* itemdb */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("itemdb", itemdb)) return "itemdb"; #endif // MAP_ITEMDB_H +#ifdef LOGIN_LCLIF_H /* lclif */ +if ((server_type&(SERVER_TYPE_LOGIN)) && !HPM_SYMBOL("lclif", lclif)) return "lclif"; +#endif // LOGIN_LCLIF_H #ifdef COMMON_CONF_H /* libconfig */ if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("libconfig", libconfig)) return "libconfig"; #endif // COMMON_CONF_H diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 67257883f..537c88936 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -90,6 +90,28 @@ struct { struct HPMHookPoint *HP_DB_init_post; struct HPMHookPoint *HP_DB_final_pre; struct HPMHookPoint *HP_DB_final_post; + struct HPMHookPoint *HP_lclif_init_pre; + struct HPMHookPoint *HP_lclif_init_post; + struct HPMHookPoint *HP_lclif_final_pre; + struct HPMHookPoint *HP_lclif_final_post; + struct HPMHookPoint *HP_lclif_connection_error_pre; + struct HPMHookPoint *HP_lclif_connection_error_post; + struct HPMHookPoint *HP_lclif_server_list_pre; + struct HPMHookPoint *HP_lclif_server_list_post; + struct HPMHookPoint *HP_lclif_auth_failed_pre; + struct HPMHookPoint *HP_lclif_auth_failed_post; + struct HPMHookPoint *HP_lclif_login_error_pre; + struct HPMHookPoint *HP_lclif_login_error_post; + struct HPMHookPoint *HP_lclif_coding_key_pre; + struct HPMHookPoint *HP_lclif_coding_key_post; + struct HPMHookPoint *HP_lclif_packet_pre; + struct HPMHookPoint *HP_lclif_packet_post; + struct HPMHookPoint *HP_lclif_parse_packet_pre; + struct HPMHookPoint *HP_lclif_parse_packet_post; + struct HPMHookPoint *HP_lclif_parse_pre; + struct HPMHookPoint *HP_lclif_parse_post; + struct HPMHookPoint *HP_lclif_parse_sub_pre; + struct HPMHookPoint *HP_lclif_parse_sub_post; struct HPMHookPoint *HP_libconfig_read_pre; struct HPMHookPoint *HP_libconfig_read_post; struct HPMHookPoint *HP_libconfig_write_pre; @@ -308,32 +330,18 @@ struct { struct HPMHookPoint *HP_login_fromchar_parse_accinfo_post; struct HPMHookPoint *HP_login_parse_fromchar_pre; struct HPMHookPoint *HP_login_parse_fromchar_post; - struct HPMHookPoint *HP_login_connection_problem_pre; - struct HPMHookPoint *HP_login_connection_problem_post; struct HPMHookPoint *HP_login_kick_pre; struct HPMHookPoint *HP_login_kick_post; struct HPMHookPoint *HP_login_auth_ok_pre; struct HPMHookPoint *HP_login_auth_ok_post; struct HPMHookPoint *HP_login_auth_failed_pre; struct HPMHookPoint *HP_login_auth_failed_post; - struct HPMHookPoint *HP_login_login_error_pre; - struct HPMHookPoint *HP_login_login_error_post; - struct HPMHookPoint *HP_login_parse_ping_pre; - struct HPMHookPoint *HP_login_parse_ping_post; - struct HPMHookPoint *HP_login_parse_client_md5_pre; - struct HPMHookPoint *HP_login_parse_client_md5_post; - struct HPMHookPoint *HP_login_parse_client_login_pre; - struct HPMHookPoint *HP_login_parse_client_login_post; - struct HPMHookPoint *HP_login_send_coding_key_pre; - struct HPMHookPoint *HP_login_send_coding_key_post; - struct HPMHookPoint *HP_login_parse_request_coding_key_pre; - struct HPMHookPoint *HP_login_parse_request_coding_key_post; + struct HPMHookPoint *HP_login_client_login_pre; + struct HPMHookPoint *HP_login_client_login_post; struct HPMHookPoint *HP_login_char_server_connection_status_pre; struct HPMHookPoint *HP_login_char_server_connection_status_post; struct HPMHookPoint *HP_login_parse_request_connection_pre; struct HPMHookPoint *HP_login_parse_request_connection_post; - struct HPMHookPoint *HP_login_parse_login_pre; - struct HPMHookPoint *HP_login_parse_login_post; struct HPMHookPoint *HP_login_config_set_defaults_pre; struct HPMHookPoint *HP_login_config_set_defaults_post; struct HPMHookPoint *HP_login_config_read_pre; @@ -691,6 +699,28 @@ struct { int HP_DB_init_post; int HP_DB_final_pre; int HP_DB_final_post; + int HP_lclif_init_pre; + int HP_lclif_init_post; + int HP_lclif_final_pre; + int HP_lclif_final_post; + int HP_lclif_connection_error_pre; + int HP_lclif_connection_error_post; + int HP_lclif_server_list_pre; + int HP_lclif_server_list_post; + int HP_lclif_auth_failed_pre; + int HP_lclif_auth_failed_post; + int HP_lclif_login_error_pre; + int HP_lclif_login_error_post; + int HP_lclif_coding_key_pre; + int HP_lclif_coding_key_post; + int HP_lclif_packet_pre; + int HP_lclif_packet_post; + int HP_lclif_parse_packet_pre; + int HP_lclif_parse_packet_post; + int HP_lclif_parse_pre; + int HP_lclif_parse_post; + int HP_lclif_parse_sub_pre; + int HP_lclif_parse_sub_post; int HP_libconfig_read_pre; int HP_libconfig_read_post; int HP_libconfig_write_pre; @@ -909,32 +939,18 @@ struct { int HP_login_fromchar_parse_accinfo_post; int HP_login_parse_fromchar_pre; int HP_login_parse_fromchar_post; - int HP_login_connection_problem_pre; - int HP_login_connection_problem_post; int HP_login_kick_pre; int HP_login_kick_post; int HP_login_auth_ok_pre; int HP_login_auth_ok_post; int HP_login_auth_failed_pre; int HP_login_auth_failed_post; - int HP_login_login_error_pre; - int HP_login_login_error_post; - int HP_login_parse_ping_pre; - int HP_login_parse_ping_post; - int HP_login_parse_client_md5_pre; - int HP_login_parse_client_md5_post; - int HP_login_parse_client_login_pre; - int HP_login_parse_client_login_post; - int HP_login_send_coding_key_pre; - int HP_login_send_coding_key_post; - int HP_login_parse_request_coding_key_pre; - int HP_login_parse_request_coding_key_post; + int HP_login_client_login_pre; + int HP_login_client_login_post; int HP_login_char_server_connection_status_pre; int HP_login_char_server_connection_status_post; int HP_login_parse_request_connection_pre; int HP_login_parse_request_connection_post; - int HP_login_parse_login_pre; - int HP_login_parse_login_post; int HP_login_config_set_defaults_pre; int HP_login_config_set_defaults_post; int HP_login_config_read_pre; @@ -1231,6 +1247,7 @@ struct { struct console_interface console; struct core_interface core; struct db_interface DB; + struct lclif_interface lclif; struct libconfig_interface libconfig; struct login_interface login; struct malloc_interface iMalloc; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 50efba987..a5adac2d0 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -61,6 +61,18 @@ struct HookingPointData HookingPoints[] = { { HP_POP(DB->data2ptr, HP_DB_data2ptr) }, { HP_POP(DB->init, HP_DB_init) }, { HP_POP(DB->final, HP_DB_final) }, +/* lclif_interface */ + { HP_POP(lclif->init, HP_lclif_init) }, + { HP_POP(lclif->final, HP_lclif_final) }, + { HP_POP(lclif->connection_error, HP_lclif_connection_error) }, + { HP_POP(lclif->server_list, HP_lclif_server_list) }, + { HP_POP(lclif->auth_failed, HP_lclif_auth_failed) }, + { HP_POP(lclif->login_error, HP_lclif_login_error) }, + { HP_POP(lclif->coding_key, HP_lclif_coding_key) }, + { HP_POP(lclif->packet, HP_lclif_packet) }, + { HP_POP(lclif->parse_packet, HP_lclif_parse_packet) }, + { HP_POP(lclif->parse, HP_lclif_parse) }, + { HP_POP(lclif->parse_sub, HP_lclif_parse_sub) }, /* libconfig_interface */ { HP_POP(libconfig->read, HP_libconfig_read) }, { HP_POP(libconfig->write, HP_libconfig_write) }, @@ -172,19 +184,12 @@ struct HookingPointData HookingPoints[] = { { HP_POP(login->fromchar_parse_wrong_pincode, HP_login_fromchar_parse_wrong_pincode) }, { HP_POP(login->fromchar_parse_accinfo, HP_login_fromchar_parse_accinfo) }, { HP_POP(login->parse_fromchar, HP_login_parse_fromchar) }, - { HP_POP(login->connection_problem, HP_login_connection_problem) }, { HP_POP(login->kick, HP_login_kick) }, { HP_POP(login->auth_ok, HP_login_auth_ok) }, { HP_POP(login->auth_failed, HP_login_auth_failed) }, - { HP_POP(login->login_error, HP_login_login_error) }, - { HP_POP(login->parse_ping, HP_login_parse_ping) }, - { HP_POP(login->parse_client_md5, HP_login_parse_client_md5) }, - { HP_POP(login->parse_client_login, HP_login_parse_client_login) }, - { HP_POP(login->send_coding_key, HP_login_send_coding_key) }, - { HP_POP(login->parse_request_coding_key, HP_login_parse_request_coding_key) }, + { HP_POP(login->client_login, HP_login_client_login) }, { HP_POP(login->char_server_connection_status, HP_login_char_server_connection_status) }, { HP_POP(login->parse_request_connection, HP_login_parse_request_connection) }, - { HP_POP(login->parse_login, HP_login_parse_login) }, { HP_POP(login->config_set_defaults, HP_login_config_set_defaults) }, { HP_POP(login->config_read, HP_login_config_read) }, /* malloc_interface */ diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index bd33f0d42..b7ff2b77b 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -917,6 +917,298 @@ void HP_DB_final(void) { } return; } +/* lclif_interface */ +void HP_lclif_init(void) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_init_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_init_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.init(); + } + if( HPMHooks.count.HP_lclif_init_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_lclif_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.final(); + } + if( HPMHooks.count.HP_lclif_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_lclif_connection_error(int fd, uint8 error) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_connection_error_pre ) { + void (*preHookFunc) (int *fd, uint8 *error); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_connection_error_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_connection_error_pre[hIndex].func; + preHookFunc(&fd, &error); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.connection_error(fd, error); + } + if( HPMHooks.count.HP_lclif_connection_error_post ) { + void (*postHookFunc) (int *fd, uint8 *error); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_connection_error_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_connection_error_post[hIndex].func; + postHookFunc(&fd, &error); + } + } + return; +} +bool HP_lclif_server_list(struct login_session_data *sd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_lclif_server_list_pre ) { + bool (*preHookFunc) (struct login_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_server_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_server_list_pre[hIndex].func; + retVal___ = preHookFunc(sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.lclif.server_list(sd); + } + if( HPMHooks.count.HP_lclif_server_list_post ) { + bool (*postHookFunc) (bool retVal___, struct login_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_server_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_server_list_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd); + } + } + return retVal___; +} +void HP_lclif_auth_failed(int fd, time_t ban, uint32 error) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_auth_failed_pre ) { + void (*preHookFunc) (int *fd, time_t *ban, uint32 *error); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_auth_failed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_auth_failed_pre[hIndex].func; + preHookFunc(&fd, &ban, &error); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.auth_failed(fd, ban, error); + } + if( HPMHooks.count.HP_lclif_auth_failed_post ) { + void (*postHookFunc) (int *fd, time_t *ban, uint32 *error); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_auth_failed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_auth_failed_post[hIndex].func; + postHookFunc(&fd, &ban, &error); + } + } + return; +} +void HP_lclif_login_error(int fd, uint8 error) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_login_error_pre ) { + void (*preHookFunc) (int *fd, uint8 *error); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_login_error_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_login_error_pre[hIndex].func; + preHookFunc(&fd, &error); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.login_error(fd, error); + } + if( HPMHooks.count.HP_lclif_login_error_post ) { + void (*postHookFunc) (int *fd, uint8 *error); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_login_error_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_login_error_post[hIndex].func; + postHookFunc(&fd, &error); + } + } + return; +} +void HP_lclif_coding_key(int fd, struct login_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_lclif_coding_key_pre ) { + void (*preHookFunc) (int *fd, struct login_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_coding_key_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_coding_key_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.lclif.coding_key(fd, sd); + } + if( HPMHooks.count.HP_lclif_coding_key_post ) { + void (*postHookFunc) (int *fd, struct login_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_coding_key_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_coding_key_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +const struct login_packet_db* HP_lclif_packet(int16 packet_id) { + int hIndex = 0; + const struct login_packet_db* retVal___ = NULL; + if( HPMHooks.count.HP_lclif_packet_pre ) { + const struct login_packet_db* (*preHookFunc) (int16 *packet_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_packet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_packet_pre[hIndex].func; + retVal___ = preHookFunc(&packet_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.lclif.packet(packet_id); + } + if( HPMHooks.count.HP_lclif_packet_post ) { + const struct login_packet_db* (*postHookFunc) (const struct login_packet_db* retVal___, int16 *packet_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_packet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_packet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &packet_id); + } + } + return retVal___; +} +enum parsefunc_rcode HP_lclif_parse_packet(const struct login_packet_db *lpd, int fd, struct login_session_data *sd) { + int hIndex = 0; + enum parsefunc_rcode retVal___ = PACKET_UNKNOWN; + if( HPMHooks.count.HP_lclif_parse_packet_pre ) { + enum parsefunc_rcode (*preHookFunc) (const struct login_packet_db *lpd, int *fd, struct login_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_packet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_parse_packet_pre[hIndex].func; + retVal___ = preHookFunc(lpd, &fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.lclif.parse_packet(lpd, fd, sd); + } + if( HPMHooks.count.HP_lclif_parse_packet_post ) { + enum parsefunc_rcode (*postHookFunc) (enum parsefunc_rcode retVal___, const struct login_packet_db *lpd, int *fd, struct login_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_packet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_parse_packet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, lpd, &fd, sd); + } + } + return retVal___; +} +int HP_lclif_parse(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_lclif_parse_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_parse_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.lclif.parse(fd); + } + if( HPMHooks.count.HP_lclif_parse_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_parse_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +enum parsefunc_rcode HP_lclif_parse_sub(int fd, struct login_session_data *sd) { + int hIndex = 0; + enum parsefunc_rcode retVal___ = PACKET_UNKNOWN; + if( HPMHooks.count.HP_lclif_parse_sub_pre ) { + enum parsefunc_rcode (*preHookFunc) (int *fd, struct login_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_lclif_parse_sub_pre[hIndex].func; + retVal___ = preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.lclif.parse_sub(fd, sd); + } + if( HPMHooks.count.HP_lclif_parse_sub_post ) { + enum parsefunc_rcode (*postHookFunc) (enum parsefunc_rcode retVal___, int *fd, struct login_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_lclif_parse_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_lclif_parse_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, sd); + } + } + return retVal___; +} /* libconfig_interface */ int HP_libconfig_read(struct config_t *config, FILE *stream) { int hIndex = 0; @@ -3844,32 +4136,6 @@ int HP_login_parse_fromchar(int fd) { } return retVal___; } -void HP_login_connection_problem(int fd, uint8 status) { - int hIndex = 0; - if( HPMHooks.count.HP_login_connection_problem_pre ) { - void (*preHookFunc) (int *fd, uint8 *status); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_connection_problem_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_connection_problem_pre[hIndex].func; - preHookFunc(&fd, &status); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.connection_problem(fd, status); - } - if( HPMHooks.count.HP_login_connection_problem_post ) { - void (*postHookFunc) (int *fd, uint8 *status); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_connection_problem_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_connection_problem_post[hIndex].func; - postHookFunc(&fd, &status); - } - } - return; -} void HP_login_kick(struct login_session_data *sd) { int hIndex = 0; if( HPMHooks.count.HP_login_kick_pre ) { @@ -3948,93 +4214,15 @@ void HP_login_auth_failed(struct login_session_data *sd, int result) { } return; } -void HP_login_login_error(int fd, uint8 status) { - int hIndex = 0; - if( HPMHooks.count.HP_login_login_error_pre ) { - void (*preHookFunc) (int *fd, uint8 *status); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_login_error_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_login_error_pre[hIndex].func; - preHookFunc(&fd, &status); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.login_error(fd, status); - } - if( HPMHooks.count.HP_login_login_error_post ) { - void (*postHookFunc) (int *fd, uint8 *status); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_login_error_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_login_error_post[hIndex].func; - postHookFunc(&fd, &status); - } - } - return; -} -void HP_login_parse_ping(int fd, struct login_session_data *sd) { - int hIndex = 0; - if( HPMHooks.count.HP_login_parse_ping_pre ) { - void (*preHookFunc) (int *fd, struct login_session_data *sd); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_ping_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_parse_ping_pre[hIndex].func; - preHookFunc(&fd, sd); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.parse_ping(fd, sd); - } - if( HPMHooks.count.HP_login_parse_ping_post ) { - void (*postHookFunc) (int *fd, struct login_session_data *sd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_ping_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_parse_ping_post[hIndex].func; - postHookFunc(&fd, sd); - } - } - return; -} -void HP_login_parse_client_md5(int fd, struct login_session_data *sd) { - int hIndex = 0; - if( HPMHooks.count.HP_login_parse_client_md5_pre ) { - void (*preHookFunc) (int *fd, struct login_session_data *sd); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_client_md5_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_parse_client_md5_pre[hIndex].func; - preHookFunc(&fd, sd); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.parse_client_md5(fd, sd); - } - if( HPMHooks.count.HP_login_parse_client_md5_post ) { - void (*postHookFunc) (int *fd, struct login_session_data *sd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_client_md5_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_parse_client_md5_post[hIndex].func; - postHookFunc(&fd, sd); - } - } - return; -} -bool HP_login_parse_client_login(int fd, struct login_session_data *sd, const char *ip) { +bool HP_login_client_login(int fd, struct login_session_data *sd) { int hIndex = 0; bool retVal___ = false; - if( HPMHooks.count.HP_login_parse_client_login_pre ) { - bool (*preHookFunc) (int *fd, struct login_session_data *sd, const char *ip); + if( HPMHooks.count.HP_login_client_login_pre ) { + bool (*preHookFunc) (int *fd, struct login_session_data *sd); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_client_login_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_parse_client_login_pre[hIndex].func; - retVal___ = preHookFunc(&fd, sd, ip); + for(hIndex = 0; hIndex < HPMHooks.count.HP_login_client_login_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_login_client_login_pre[hIndex].func; + retVal___ = preHookFunc(&fd, sd); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -4042,69 +4230,17 @@ bool HP_login_parse_client_login(int fd, struct login_session_data *sd, const ch } } { - retVal___ = HPMHooks.source.login.parse_client_login(fd, sd, ip); + retVal___ = HPMHooks.source.login.client_login(fd, sd); } - if( HPMHooks.count.HP_login_parse_client_login_post ) { - bool (*postHookFunc) (bool retVal___, int *fd, struct login_session_data *sd, const char *ip); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_client_login_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_parse_client_login_post[hIndex].func; - retVal___ = postHookFunc(retVal___, &fd, sd, ip); + if( HPMHooks.count.HP_login_client_login_post ) { + bool (*postHookFunc) (bool retVal___, int *fd, struct login_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_login_client_login_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_login_client_login_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, sd); } } return retVal___; } -void HP_login_send_coding_key(int fd, struct login_session_data *sd) { - int hIndex = 0; - if( HPMHooks.count.HP_login_send_coding_key_pre ) { - void (*preHookFunc) (int *fd, struct login_session_data *sd); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_send_coding_key_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_send_coding_key_pre[hIndex].func; - preHookFunc(&fd, sd); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.send_coding_key(fd, sd); - } - if( HPMHooks.count.HP_login_send_coding_key_post ) { - void (*postHookFunc) (int *fd, struct login_session_data *sd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_send_coding_key_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_send_coding_key_post[hIndex].func; - postHookFunc(&fd, sd); - } - } - return; -} -void HP_login_parse_request_coding_key(int fd, struct login_session_data *sd) { - int hIndex = 0; - if( HPMHooks.count.HP_login_parse_request_coding_key_pre ) { - void (*preHookFunc) (int *fd, struct login_session_data *sd); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_request_coding_key_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_parse_request_coding_key_pre[hIndex].func; - preHookFunc(&fd, sd); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.login.parse_request_coding_key(fd, sd); - } - if( HPMHooks.count.HP_login_parse_request_coding_key_post ) { - void (*postHookFunc) (int *fd, struct login_session_data *sd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_request_coding_key_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_parse_request_coding_key_post[hIndex].func; - postHookFunc(&fd, sd); - } - } - return; -} void HP_login_char_server_connection_status(int fd, struct login_session_data *sd, uint8 status) { int hIndex = 0; if( HPMHooks.count.HP_login_char_server_connection_status_pre ) { @@ -4157,33 +4293,6 @@ void HP_login_parse_request_connection(int fd, struct login_session_data *sd, co } return; } -int HP_login_parse_login(int fd) { - int hIndex = 0; - int retVal___ = 0; - if( HPMHooks.count.HP_login_parse_login_pre ) { - int (*preHookFunc) (int *fd); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_login_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_login_parse_login_pre[hIndex].func; - retVal___ = preHookFunc(&fd); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.login.parse_login(fd); - } - if( HPMHooks.count.HP_login_parse_login_post ) { - int (*postHookFunc) (int retVal___, int *fd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_login_parse_login_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_login_parse_login_post[hIndex].func; - retVal___ = postHookFunc(retVal___, &fd); - } - } - return retVal___; -} void HP_login_config_set_defaults(void) { int hIndex = 0; if( HPMHooks.count.HP_login_config_set_defaults_pre ) { diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index bbc1cecbc..871facdc1 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -28,6 +28,7 @@ memcpy(&HPMHooks.source.cmdline, cmdline, sizeof(struct cmdline_interface)); memcpy(&HPMHooks.source.console, console, sizeof(struct console_interface)); memcpy(&HPMHooks.source.core, core, sizeof(struct core_interface)); memcpy(&HPMHooks.source.DB, DB, sizeof(struct db_interface)); +memcpy(&HPMHooks.source.lclif, lclif, sizeof(struct lclif_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.login, login, sizeof(struct login_interface)); memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); |