1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 21:19:01 +00:00

Added a --nsock-engine option to nmap, nping and ncat to enforce use of a

given nsock IO engine. [Henri]
This commit is contained in:
henri
2012-03-01 09:05:02 +00:00
parent ee9b9eb0a7
commit b1086ac340
8 changed files with 57 additions and 4 deletions

View File

@@ -83,8 +83,10 @@ static struct io_engine *available_engines[] = {
NULL
};
static char *engine_hint;
struct io_engine *get_io_engine(const char *engine_hint) {
struct io_engine *get_io_engine(void) {
struct io_engine *engine = NULL;
int i;
@@ -105,3 +107,13 @@ struct io_engine *get_io_engine(const char *engine_hint) {
return engine;
}
void nsock_set_default_engine(char *engine) {
if (engine_hint)
free(engine_hint);
if (engine)
engine_hint = strdup(engine);
else
engine_hint = NULL;
}

View File

@@ -81,7 +81,7 @@ static int nsocklib_initialized = 0;
/* defined in nsock_engines.h */
struct io_engine *get_io_engine(const char *engine_hint);
struct io_engine *get_io_engine(void);
/* ---- INTERNAL FUNCTIONS PROTOTYPES ---- */
static void nsock_library_initialize(void);
@@ -170,7 +170,7 @@ nsock_pool nsp_new(void *userdata) {
nsp->userdata = userdata;
nsp->engine = get_io_engine(NULL);
nsp->engine = get_io_engine();
nsp->engine->init(nsp);
/* initialize IO events lists */