/** * See if the flow needs to be shutdown and remove it from the * cache. This function should be placed AFTER all detection type * components. * * @param p packet * * @return 0 on success */ int CheckFlowShutdown(Packet *p) { FLOWCACHE *fcache = &s_fcache; FLOW *flowp = (FLOW *) p->flow; PROFILE_VARS; /* Use TMPSTART to not add to 'checks' */ PREPROC_PROFILE_TMPSTART(flowPerfStats); if(flowp != NULL) { if(flow_checkflag(flowp, FLOW_CLOSEME)) { /* allow all the submodules to trigger their final stand */ flow_callbacks(FLOW_SHUTDOWN, flowp, FROM_INITIATOR, p); if(flowcache_releaseflow(fcache, &flowp) != FLOW_SUCCESS) { flow_printf("Can't release flow %p\n", p->flow); PREPROC_PROFILE_TMPEND(flowPerfStats); return FLOW_BADJUJU; } } } p->flow = NULL; PREPROC_PROFILE_TMPEND(flowPerfStats); return FLOW_SUCCESS; }
/**Gets a flow flag value. * * @param Lua_State* - Lua state variable. * @param detectorFlow/stack - DetectorFlowUserData object * @param flags/stack - flags to get. * @return int - Number of elements on stack, which is 1 if successful, 0 otherwise. * @return flagValue/stack - value of a given flag. */ static int DetectorFlow_getFlowFlag( lua_State *L ) { DetectorFlowUserData *pLuaData; uint32_t flags; pLuaData = checkDetectorFlowUserData(L, 1); if (!pLuaData || !pLuaData->pDetectorFlow) { _dpd.errMsg( "getFlowFlag called without detectorFlowUserData"); return 0; } flags = lua_tonumber(L, 2); lua_pushnumber(L, flow_checkflag(pLuaData->pDetectorFlow->pFlow, flags)); return 1; }