diff options
Diffstat (limited to 'src/plugins/HPMHooking/HPMHooking_char.Hooks.inc')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 199 |
1 files changed, 178 insertions, 21 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 767c7d24e..e177462e9 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2018 Hercules Dev Team + * Copyright (C) 2013-2019 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 @@ -609,15 +609,15 @@ int HP_chr_mmo_gender(const struct char_session_data *sd, const struct mmo_chars } return retVal___; } -int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { +int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int *count) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_chr_mmo_chars_fromsql_pre > 0) { - int (*preHookFunc) (struct char_session_data **sd, uint8 **buf); + int (*preHookFunc) (struct char_session_data **sd, uint8 **buf, int **count); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &buf); + retVal___ = preHookFunc(&sd, &buf, &count); } if (*HPMforce_return) { *HPMforce_return = false; @@ -625,13 +625,13 @@ int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { } } { - retVal___ = HPMHooks.source.chr.mmo_chars_fromsql(sd, buf); + retVal___ = HPMHooks.source.chr.mmo_chars_fromsql(sd, buf, count); } if (HPMHooks.count.HP_chr_mmo_chars_fromsql_post > 0) { - int (*postHookFunc) (int retVal___, struct char_session_data *sd, uint8 *buf); + int (*postHookFunc) (int retVal___, struct char_session_data *sd, uint8 *buf, int *count); for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_post; hIndex++) { postHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, buf); + retVal___ = postHookFunc(retVal___, sd, buf, count); } } return retVal___; @@ -906,13 +906,13 @@ int HP_chr_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) { } return retVal___; } -void HP_chr_mmo_char_send099d(int fd, struct char_session_data *sd) { +void HP_chr_send_HC_ACK_CHARINFO_PER_PAGE(int fd, struct char_session_data *sd) { int hIndex = 0; - if (HPMHooks.count.HP_chr_mmo_char_send099d_pre > 0) { + if (HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre > 0) { void (*preHookFunc) (int *fd, struct char_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre[hIndex].func; preHookFunc(&fd, &sd); } if (*HPMforce_return) { @@ -921,12 +921,12 @@ void HP_chr_mmo_char_send099d(int fd, struct char_session_data *sd) { } } { - HPMHooks.source.chr.mmo_char_send099d(fd, sd); + HPMHooks.source.chr.send_HC_ACK_CHARINFO_PER_PAGE(fd, sd); } - if (HPMHooks.count.HP_chr_mmo_char_send099d_post > 0) { + if (HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post > 0) { void (*postHookFunc) (int fd, struct char_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post[hIndex].func; postHookFunc(fd, sd); } } @@ -17357,6 +17357,111 @@ void HP_nullpo_assert_report(const char *file, int line, const char *func, const } return; } +/* packets_interface */ +void HP_packets_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.init(); + } + if (HPMHooks.count.HP_packets_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.final(); + } + if (HPMHooks.count.HP_packets_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLens(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLens_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLens_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLens(); + } + if (HPMHooks.count.HP_packets_addLens_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLens_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLen(int id, int len) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLen_pre > 0) { + void (*preHookFunc) (int *id, int *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLen_pre[hIndex].func; + preHookFunc(&id, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLen(id, len); + } + if (HPMHooks.count.HP_packets_addLen_post > 0) { + void (*postHookFunc) (int id, int len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLen_post[hIndex].func; + postHookFunc(id, len); + } + } + return; +} /* pincode_interface */ void HP_pincode_handle(int fd, struct char_session_data *sd) { int hIndex = 0; @@ -18317,15 +18422,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -18333,17 +18438,43 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; } +void HP_sockt_wfifohead(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_wfifohead_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_wfifohead_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.wfifohead(fd, len); + } + if (HPMHooks.count.HP_sockt_wfifohead_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_wfifohead_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} int HP_sockt_rfifoskip(int fd, size_t len) { int hIndex = 0; int retVal___ = 0; @@ -18397,6 +18528,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; |