static void AppIdInit(struct _SnortConfig *sc, char *args) { static int once = 0; tSfPolicyId policy_id = _dpd.getParserPolicy(sc); if (!once) { _dpd.addPreprocExit(AppIdCleanExit, NULL, PRIORITY_LAST, PP_APP_ID); # ifdef PERF_PROFILING _dpd.addPreprocProfileFunc("fwApp", &appMatchPerfStats, 0, _dpd.totalPerfStats, NULL); _dpd.addPreprocProfileFunc("fwAppTP", &tpPerfStats, 1, &appMatchPerfStats, NULL); _dpd.addPreprocProfileFunc("fwLibAppTP", &tpLibPerfStats, 2, &tpPerfStats, NULL); _dpd.addPreprocProfileFunc("fwHTTP", &httpPerfStats, 2, &tpPerfStats, NULL); _dpd.addPreprocProfileFunc("fwClientPat", &clientMatchPerfStats, 1, &appMatchPerfStats, NULL); _dpd.addPreprocProfileFunc("fwHTTP", &httpPerfStats, 2, &clientMatchPerfStats, NULL); _dpd.addPreprocProfileFunc("fwServicePat", &serviceMatchPerfStats, 1, &appMatchPerfStats, NULL); _dpd.addPreprocProfileFunc("luaDetectors", &luaDetectorsPerfStats, 1, &appMatchPerfStats, NULL); _dpd.addPreprocProfileFunc("cisco", &luaCiscoPerfStats, 2, &luaDetectorsPerfStats, NULL); _dpd.addPreprocProfileFunc("custom", &luaCustomPerfStats, 2, &luaDetectorsPerfStats, NULL); # endif appid_preproc_status_bit = _dpd.sessionAPI->get_preprocessor_status_bit(); appIdConfigParse(args); AppIdCommonInit(&appidStaticConfig); ThirdPartyAppIDInit(appidStaticConfig.appid_thirdparty_dir); if (appidStaticConfig.app_id_dump_ports) { dumpPorts(stdout, pAppidActiveConfig); appInfoTableDump(pAppidActiveConfig); exit(0); } _dpd.addPreprocResetStats(AppIdResetStats, NULL, PRIORITY_LAST, PP_APP_ID); _dpd.registerPreprocStats(PREPROC_NAME, AppIdDumpStats); /* Hook into control socket to handle reload */ _dpd.controlSocketRegisterHandler(73, AppIdReconfigure, AppIdReconfigureSwap, AppIdReconfigureFree); _dpd.controlSocketRegisterHandler(74, AppIdDebug, NULL, NULL); _dpd.controlSocketRegisterHandler(56, NULL, ThirdPartyReload, NULL); _dpd.registerIdleHandler(appIdIdleProcessing); _dpd.registerGetAppId(getOpenAppId); if (!thirdparty_appid_module) _dpd.streamAPI->register_http_header_callback(httpHeaderCallback); _dpd.registerSslAppIdLookup(sslAppGroupIdLookup); if (_dpd.streamAPI->service_event_subscribe(PP_SIP, SIP_EVENT_TYPE_SIP_DIALOG, SipSessionSnortCallback) == false) DynamicPreprocessorFatalMessage("failed to subscribe to SIP_DIALOG\n"); appIdApiInit(_dpd.appIdApi); once = 1; } _dpd.addPreprocConfCheck(sc, AppIDCheckConfig); if (policy_id == _dpd.getDefaultPolicy()) AppIdAddPortsToStream5Filter(sc, policy_id); }
/** * List all input and output ports. * Also refreshes the port list in case a device was plugged in or unplugged. */ void bang(long inlet) { refreshPorts(); dumpPorts(m_outlets[OUTLET_INPORTS], inPortMap, inPortName); dumpPorts(m_outlets[OUTLET_OUTPORTS], outPortMap, outPortName); }