bool init(struct lfc *lfc, void **pdata) { mmatic *mm; struct ndpi *ndpi; IPOQUE_PROTOCOL_BITMASK all; mm = mmatic_create(); ndpi = mmatic_zalloc(mm, sizeof *ndpi); ndpi->mm = mm; ndpi->ids = thash_create_intkey(NULL, mm); // TODO: null ffn? ndpi->ipq = ipoque_init_detection_module(1000, ma, db); // TODO: 1000? if (!ndpi->ipq) { dbg(0, "ipoque_init_detection_module() failed\n"); return false; } IPOQUE_BITMASK_SET_ALL(all); ipoque_set_protocol_detection_bitmask2(ndpi->ipq, &all); *pdata = ndpi; printf("%%%% ndpi 0.1 - nDPI\n"); printf("@attribute ndpi_proto string\n"); return true; }
int init_dpi(){ /// init dpi dection module // param1: dpi tick time frquency ( times per second) // param2: custom malloc wrapper function // param3: defaut to NULL // return: ipoque_struct ipoque_struct = ipoque_init_detection_module(detection_tick_resolution,malloc_wrapper,NULL); IPOQUE_PROTOCOL_BITMASK http; IPOQUE_BITMASK_SET_ALL(http);//TODO modify all protocol to http protocol BITMASK ipoque_set_protocol_detection_bitmask2(ipoque_struct,&http); return 0; }
void initL7DeviceDiscovery(int deviceId) { IPOQUE_PROTOCOL_BITMASK all; u32 detection_tick_resolution = 1000; myGlobals.device[deviceId].l7.l7handler = ipoque_init_detection_module(detection_tick_resolution, malloc_wrapper, debug_printf); if(myGlobals.device[deviceId].l7.l7handler == NULL) { traceEvent(CONST_TRACE_ERROR, "Unable to initialize L7 engine: disabling L7 discovery for deviceId %u", deviceId); return; } // enable all protocols IPOQUE_BITMASK_SET_ALL(all); ipoque_set_protocol_detection_bitmask2(myGlobals.device[deviceId].l7.l7handler, &all); /* ************************** */ createMutex(&myGlobals.device[deviceId].l7.l7Mutex); }