diff options
author | Haru <haru@dotalux.com> | 2019-03-11 03:48:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-11 03:48:54 +0100 |
commit | 23b515f67f912078268767ec2d28b65711d39b2f (patch) | |
tree | ca7ef86914fd19a7fba137feb8daf668d6411b63 | |
parent | c2bf96805ea5fdbd8d88bb1ddaf9f0e47a24fd08 (diff) | |
parent | 63062f9ddbc2c2a2384bfbbd496fc0572318a9e0 (diff) | |
download | hercules-23b515f67f912078268767ec2d28b65711d39b2f.tar.gz hercules-23b515f67f912078268767ec2d28b65711d39b2f.tar.bz2 hercules-23b515f67f912078268767ec2d28b65711d39b2f.tar.xz hercules-23b515f67f912078268767ec2d28b65711d39b2f.zip |
Merge pull request #2378 from 4144/interfaces
Different interfaces fixes
-rw-r--r-- | src/common/socket.c | 13 | ||||
-rw-r--r-- | src/common/socket.h | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 3 | ||||
-rw-r--r-- | src/map/atcommand.h | 4 | ||||
-rw-r--r-- | src/map/map.h | 79 | ||||
-rw-r--r-- | src/map/mapdefines.h | 103 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 27 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 27 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 |
16 files changed, 217 insertions, 85 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 95d8bf578..faf57f412 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -79,8 +79,6 @@ static struct socket_interface sockt_s; struct socket_interface *sockt; -static const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf"; - #ifdef SEND_SHORTLIST // Add a fd to the shortlist so that it'll be recognized as a fd that needs // sending done on it. @@ -462,7 +460,7 @@ static int recv_to_fifo(int fd) socket_data_ci += len; } #endif // SHOW_SERVER_STATS - return 0; + return (int)len; } static int send_from_fifo(int fd) @@ -648,7 +646,7 @@ static int make_listen_bind(uint32 ip, uint16 port) if(sockt->fd_max <= fd) sockt->fd_max = fd + 1; - create_session(fd, connect_client, null_send, null_parse); + create_session(fd, sockt->connect_client, null_send, null_parse); sockt->session[fd]->client_addr = 0; // just listens sockt->session[fd]->rdata_tick = 0; // disable timeouts on this socket return fd; @@ -1505,7 +1503,7 @@ static bool socket_config_read(const char *filename, bool imported) // import should overwrite any previous configuration, so it should be called last if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) { - if (strcmp(import, filename) == 0 || strcmp(import, SOCKET_CONF_FILENAME) == 0) { + if (strcmp(import, filename) == 0 || strcmp(import, sockt->SOCKET_CONF_FILENAME) == 0) { ShowWarning("socket_config_read: Loop detected! Skipping 'import'...\n"); } else { if (!socket_config_read(import, true)) @@ -1714,7 +1712,7 @@ static void socket_init(void) // Get initial local ips sockt->naddr_ = sockt->getips(sockt->addr_,16); - socket_config_read(SOCKET_CONF_FILENAME, false); + socket_config_read(sockt->SOCKET_CONF_FILENAME, false); #ifndef SOCKET_EPOLL // Select based Event Dispatcher: @@ -2143,6 +2141,8 @@ void socket_defaults(void) { sockt = &sockt_s; + sockt->SOCKET_CONF_FILENAME = "conf/common/socket.conf"; + sockt->fd_max = 0; /* */ sockt->stall_time = 60; @@ -2177,6 +2177,7 @@ void socket_defaults(void) /* */ sockt->flush = flush_fifo; sockt->flush_fifos = flush_fifos; + sockt->connect_client = connect_client; sockt->set_nonblocking = set_nonblocking; sockt->set_defaultparse = set_defaultparse; sockt->host2ip = host2ip; diff --git a/src/common/socket.h b/src/common/socket.h index 5e4251989..193b22645 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -178,6 +178,7 @@ struct socket_interface { time_t stall_time; time_t last_tick; + const char *SOCKET_CONF_FILENAME; /* */ uint32 addr_[16]; // ip addresses of local host (host byte order) int naddr_; // # of ip addresses @@ -212,6 +213,7 @@ struct socket_interface { /* */ void (*flush) (int fd); void (*flush_fifos) (void); + int (*connect_client) (int listen_fd); void (*set_nonblocking) (int fd, unsigned long yes); void (*set_defaultparse) (ParseFunc defaultparse); /* hostname/ip conversion functions */ diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 87be6ab1b..a9f63fe13 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10716,6 +10716,9 @@ void atcommand_defaults(void) { atcommand = &atcommand_s; + atcommand->atcmd_output = &atcmd_output; + atcommand->atcmd_player_name = &atcmd_player_name; + atcommand->db = NULL; atcommand->alias_db = NULL; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 3bbbefa20..1783e5dc6 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -21,9 +21,11 @@ #ifndef MAP_ATCOMMAND_H #define MAP_ATCOMMAND_H +#include "map/mapdefines.h" #include "map/pc_groups.h" #include "common/hercules.h" #include "common/db.h" +#include "common/mmo.h" #include <stdarg.h> @@ -90,6 +92,8 @@ struct atcmd_binding_data { * Interface **/ struct atcommand_interface { + char (*atcmd_output)[CHAT_SIZE_MAX]; + char (*atcmd_player_name)[NAME_LENGTH]; unsigned char at_symbol; unsigned char char_symbol; /* atcommand binding */ diff --git a/src/map/map.h b/src/map/map.h index ace2a35a1..1f70680e8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -45,42 +45,6 @@ enum E_MAPSERVER_ST { MAPSERVER_ST_LAST }; -#define MAX_NPC_PER_MAP 512 -#define AREA_SIZE (battle->bc->area_size) -#define CHAT_AREA_SIZE (battle->bc->chat_area_size) -#define DEAD_AREA_SIZE (battle->bc->dead_area_size) -#define DAMAGELOG_SIZE 30 -#define LOOTITEM_SIZE 10 -#define MAX_MOBSKILL 50 -#define MAX_MOB_LIST_PER_MAP 100 -#define MAX_EVENTQUEUE 2 -#define MAX_EVENTTIMER 32 -#define NATURAL_HEAL_INTERVAL 500 -#define MIN_FLOORITEM 2 -#define MAX_FLOORITEM START_ACCOUNT_NUM -#define MAX_IGNORE_LIST 20 // official is 14 -#define MAX_VENDING 12 -#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo] - -#define BLOCK_SIZE 8 -#define block_free_max 1048576 -#define BL_LIST_MAX 1048576 - -// The following system marks a different job ID system used by the map server, -// which makes a lot more sense than the normal one. [Skotlex] -// These marks the "level" of the job. -#define JOBL_2_1 0x0100 -#define JOBL_2_2 0x0200 -#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 -#define JOBL_UPPER 0x1000 -#define JOBL_BABY 0x2000 -#define JOBL_THIRD 0x4000 - -// For filtering and quick checking. -#define MAPID_BASEMASK 0x00ff -#define MAPID_UPPERMASK 0x0fff -#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) - //First Jobs //Note the oddity of the novice: //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type. @@ -344,36 +308,6 @@ enum { STATIC_ASSERT(((MAPID_1_1_MAX - 1) | MAPID_BASEMASK) == MAPID_BASEMASK, "First class map IDs do not fit into MAPID_BASEMASK"); -// Max size for inputs to Graffiti, Talkie Box and Vending text prompts -#define MESSAGE_SIZE (79 + 1) -// String length you can write in the 'talking box' -#define CHATBOX_SIZE (70 + 1) -// Chatroom-related string sizes -#define CHATROOM_TITLE_SIZE (36 + 1) -#define CHATROOM_PASS_SIZE (8 + 1) -// Max allowed chat text length -#define CHAT_SIZE_MAX (255 + 1) -// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS -#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) -#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) -// Specifies maps where players may hit each other -#define map_flag_vs(m) ( \ - map->list[m].flag.pvp \ - || map->list[m].flag.gvg_dungeon \ - || map->list[m].flag.gvg \ - || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ - || map->list[m].flag.battleground \ - || map->list[m].flag.cvc \ - ) -// Specifies maps that have special GvG/WoE restrictions -#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) -// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) -#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) -// No Kill Steal Protection -#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground) -// No ViewID -#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) - //This stackable implementation does not means a BL can be more than one type at a time, but it's // meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] enum bl_type { @@ -392,9 +326,6 @@ enum bl_type { BL_ALL = 0xFFF, }; -// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. -#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) - enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; /** @@ -748,16 +679,6 @@ enum map_zone_merge_type { MZMT_NEVERMERGE, ///< Cannot merge with any zones. }; -#define MAP_ZONE_NAME_LENGTH 60 -#define MAP_ZONE_ALL_NAME "All" -#define MAP_ZONE_NORMAL_NAME "Normal" -#define MAP_ZONE_PVP_NAME "PvP" -#define MAP_ZONE_GVG_NAME "GvG" -#define MAP_ZONE_BG_NAME "Battlegrounds" -#define MAP_ZONE_CVC_NAME "CvC" -#define MAP_ZONE_PK_NAME "PK Mode" -#define MAP_ZONE_MAPFLAG_LENGTH 65 - struct map_zone_data { char name[MAP_ZONE_NAME_LENGTH];/* 20'd */ enum map_zone_merge_type merge_type; diff --git a/src/map/mapdefines.h b/src/map/mapdefines.h new file mode 100644 index 000000000..df9e9bccb --- /dev/null +++ b/src/map/mapdefines.h @@ -0,0 +1,103 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2012-2018 Hercules Dev Team + * Copyright (C) Athena Dev Teams + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef MAP_MAPDEFINES_H +#define MAP_MAPDEFINES_H + +#define MAX_NPC_PER_MAP 512 +#define AREA_SIZE (battle->bc->area_size) +#define CHAT_AREA_SIZE (battle->bc->chat_area_size) +#define DEAD_AREA_SIZE (battle->bc->dead_area_size) +#define DAMAGELOG_SIZE 30 +#define LOOTITEM_SIZE 10 +#define MAX_MOBSKILL 50 +#define MAX_MOB_LIST_PER_MAP 100 +#define MAX_EVENTQUEUE 2 +#define MAX_EVENTTIMER 32 +#define NATURAL_HEAL_INTERVAL 500 +#define MIN_FLOORITEM 2 +#define MAX_FLOORITEM START_ACCOUNT_NUM +#define MAX_IGNORE_LIST 20 // official is 14 +#define MAX_VENDING 12 +#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo] + +#define BLOCK_SIZE 8 +#define block_free_max 1048576 +#define BL_LIST_MAX 1048576 + +// The following system marks a different job ID system used by the map server, +// which makes a lot more sense than the normal one. [Skotlex] +// These marks the "level" of the job. +#define JOBL_2_1 0x0100 +#define JOBL_2_2 0x0200 +#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 +#define JOBL_UPPER 0x1000 +#define JOBL_BABY 0x2000 +#define JOBL_THIRD 0x4000 + +// For filtering and quick checking. +#define MAPID_BASEMASK 0x00ff +#define MAPID_UPPERMASK 0x0fff +#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) + +// Max size for inputs to Graffiti, Talkie Box and Vending text prompts +#define MESSAGE_SIZE (79 + 1) +// String length you can write in the 'talking box' +#define CHATBOX_SIZE (70 + 1) +// Chatroom-related string sizes +#define CHATROOM_TITLE_SIZE (36 + 1) +#define CHATROOM_PASS_SIZE (8 + 1) +// Max allowed chat text length +#define CHAT_SIZE_MAX (255 + 1) +// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS +#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) +#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) +// Specifies maps where players may hit each other +#define map_flag_vs(m) ( \ + map->list[m].flag.pvp \ + || map->list[m].flag.gvg_dungeon \ + || map->list[m].flag.gvg \ + || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ + || map->list[m].flag.battleground \ + || map->list[m].flag.cvc \ + ) +// Specifies maps that have special GvG/WoE restrictions +#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) +// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) +#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) +// No Kill Steal Protection +#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground) +// No ViewID +#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) + +// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. +#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) + +#define MAP_ZONE_NAME_LENGTH 60 +#define MAP_ZONE_ALL_NAME "All" +#define MAP_ZONE_NORMAL_NAME "Normal" +#define MAP_ZONE_PVP_NAME "PvP" +#define MAP_ZONE_GVG_NAME "GvG" +#define MAP_ZONE_BG_NAME "Battlegrounds" +#define MAP_ZONE_CVC_NAME "CvC" +#define MAP_ZONE_PK_NAME "PK Mode" +#define MAP_ZONE_MAPFLAG_LENGTH 65 + +#endif /* MAP_MAPDEFINES_H */ diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7cc5ef2b1..c764d0290 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7538,6 +7538,8 @@ typedef void (*HPMHOOK_pre_sockt_flush) (int *fd); typedef void (*HPMHOOK_post_sockt_flush) (int fd); typedef void (*HPMHOOK_pre_sockt_flush_fifos) (void); typedef void (*HPMHOOK_post_sockt_flush_fifos) (void); +typedef int (*HPMHOOK_pre_sockt_connect_client) (int *listen_fd); +typedef int (*HPMHOOK_post_sockt_connect_client) (int retVal___, int listen_fd); typedef void (*HPMHOOK_pre_sockt_set_nonblocking) (int *fd, unsigned long *yes); typedef void (*HPMHOOK_post_sockt_set_nonblocking) (int fd, unsigned long yes); typedef void (*HPMHOOK_pre_sockt_set_defaultparse) (ParseFunc *defaultparse); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index a8b4860f3..dbabf8ed4 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1422,6 +1422,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -3059,6 +3061,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 56c5bcfb7..f666ad1fd 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -758,6 +758,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 0bd61ba15..edffe7c11 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -18686,6 +18686,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 7293e8fc4..ba0fe05c2 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -584,6 +584,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -1383,6 +1385,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 825e049b1..1e3548621 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -326,6 +326,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 044ee2df2..080fb75ff 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -7495,6 +7495,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b323d77e6..70604ff9e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -6042,6 +6042,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -12711,6 +12713,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3c09aba59..f081fd520 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -3089,6 +3089,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 8242b9797..d18b4f360 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -80816,6 +80816,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { |