static int nbt_alias_handler(PNATState pData, int type) #endif /*VBOX*/ { int error; #ifdef VBOX if (handlers == NULL) handlers = RTMemAllocZ(4 * sizeof(struct proto_handler)); handlers[0].pri = 130; handlers[0].dir = IN|OUT; handlers[0].proto = UDP; handlers[0].fingerprint = &fingerprint1; handlers[0].protohandler = &protohandler1; handlers[1].pri = 140; handlers[1].dir = IN; handlers[1].proto = UDP; handlers[1].fingerprint = &fingerprint2; handlers[1].protohandler = &protohandler2in; handlers[2].pri = 140; handlers[2].dir = OUT; handlers[2].proto = UDP; handlers[2].fingerprint = &fingerprint2; handlers[2].protohandler = &protohandler2out; handlers[3].pri = EOH; #endif /*VBOX*/ switch (type) { case MOD_LOAD: error = 0; #ifdef VBOX LibAliasAttachHandlers(pData, handlers); #else LibAliasAttachHandlers(handlers); #endif break; case MOD_UNLOAD: error = 0; #ifdef VBOX LibAliasDetachHandlers(pData, handlers); RTMemFree(handlers); handlers = NULL; #else LibAliasDetachHandlers(handlers); #endif break; default: error = EINVAL; } return (error); }
static int ftp_alias_handler(PNATState pData, int type) #endif { int error; #ifdef VBOX if (handlers == NULL) handlers = RTMemAllocZ(2 * sizeof(struct proto_handler)); handlers[0].pri = 80; handlers[0].dir = OUT; handlers[0].proto = TCP; handlers[0].fingerprint = &fingerprint; handlers[0].protohandler = &protohandler; handlers[1].pri = EOH; #endif /* VBOX */ switch (type) { case MOD_LOAD: error = 0; #ifdef VBOX LibAliasAttachHandlers(pData, handlers); #else LibAliasAttachHandlers(handlers); #endif break; case MOD_UNLOAD: error = 0; #ifdef VBOX LibAliasDetachHandlers(pData, handlers); RTMemFree(handlers); handlers = NULL; #else LibAliasDetachHandlers(handlers); #endif break; default: error = EINVAL; } return (error); }
int LibAliasUnLoadAllModule(void) { struct dll *t; struct proto_handler *p; /* Unload all modules then reload everything. */ while ((p = first_handler()) != NULL) { LibAliasDetachHandlers(p); } while ((t = walk_dll_chain()) != NULL) { dlclose(t->handle); free(t); } return (1); }
static int mod_handler(module_t mod, int type, void *data) { int error; switch (type) { case MOD_LOAD: error = 0; LibAliasAttachHandlers(handlers); break; case MOD_UNLOAD: error = 0; LibAliasDetachHandlers(handlers); break; default: error = EINVAL; } return (error); }