-- fixed some Xcode analyzer issues
-- pulled in cmake updates from Josh
-- pulled in nhttp updates from Tom
+-- applied cmake inc dir order patch from Josh
122
-- pulled thread pinning from Josh
)
set(EXTERNAL_INCLUDES
- ${LUAJIT_INCLUDE_DIR}
${DAQ_INCLUDE_DIR}
${PCAP_INCLUDE_DIR}
${PCRE_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
CACHE INTERNAL "external INCLUDES" FORCE
)
-include_directories(BEFORE SYSTEM ${EXTERNAL_INCLUDES})
+include_directories(BEFORE ${LUAJIT_INCLUDE_DIR})
+include_directories(SYSTEM ${EXTERNAL_INCLUDES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#include "chunk.h"
#include <lua.hpp>
+extern "C"
+{
+ int lua_load(lua_State*, lua_Reader, void*, const char*);
+}
#include "managers/ips_manager.h"
#include "hash/sfhashfcn.h"
bool done;
};
-static const char* load(lua_State*, void* ud, size_t* size)
+static const char* ldchunk(lua_State*, void* ud, size_t* size)
{
Loader* ldr = (Loader*)ud;
Loader ldr(chunk);
// first load the chunk
- if ( lua_load(L, load, &ldr, name) )
+ if ( lua_load(L, (lua_Reader)ldchunk, (void*)&ldr, name) )
{
ParseError("%s luajit failed to load chunk %s", name, lua_tostring(L, -1));
return;
loaded = true;
}
-void Shell::install(const char* name, const luaL_reg* reg)
+void Shell::install(const char* name, const luaL_Reg* reg)
{
if ( !strcmp(name, "snort") )
luaL_register(lua, "_G", reg);
{
Module* mod;
const BaseApi* api;
- luaL_reg* reg;
+ luaL_Reg* reg;
ModHook(Module*, const BaseApi*);
~ModHook();
n++;
// constructing reg here may seem like overkill
- // ... why not just typedef Command to luaL_reg?
+ // ... why not just typedef Command to luaL_Reg?
// because the help would not be supplied or it
// would be out of date, out of sync, etc. QED
- reg = new luaL_reg[++n];
+ reg = new luaL_Reg[++n];
unsigned k = 0;
while ( k < n )
* array.
*
****************************************************************/
+// FIXIT-L eliminate mSplit(); create iterator service if needed
char ** mSplit(const char *str, const char *sep_chars, const int max_toks,
int *num_toks, const char meta_char)
{
#define PPM_PKT_CNT() ppm_pt->pktcnt
#define PPM_PKT_LOG(p) if (ppm_abort_this_pkt) ppm_pkt_log(&snort_conf->ppm_cfg,p)
#define PPM_RULE_LOG(cnt,p) ppm_rule_log(&snort_conf->ppm_cfg,cnt,p)
-#define PPM_ACCUM_PKT_TIME() ppm_stats.tot_pkt_time += ppm_pt->tot;
+#define PPM_ACCUM_PKT_TIME() \
+if ( ppm_pt ) \
+{ \
+ ppm_stats.tot_pkt_time += ppm_pt->tot; \
+}
#define PPM_ACCUM_RULE_TIME() \
- ppm_stats.tot_rule_time += ppm_rt->tot; \
- ppm_stats.tot_rules++;
+if ( ppm_rt ) \
+{ \
+ ppm_stats.tot_rule_time += ppm_rt->tot; \
+ ppm_stats.tot_rules++; \
+}
#define PPM_ACCUM_NC_RULE_TIME() \
ppm_stats.tot_nc_rule_time += ppm_rt->tot; \
ppm_stats.tot_nc_rules++;
#define PROFILE_VARS_NAMED(name) uint64_t name##_ticks_start, name##_ticks_end
#define PROFILE_VARS PROFILE_VARS_NAMED(snort)
-// we could use PROFILE_START_NAMED(node) instead
-// but that confuses static analysis
-#define PROFILE_START_NODE \
- get_clockticks(node_ticks_start)
-
#define PROFILE_START_NAMED(name) \
get_clockticks(name##_ticks_start)
#define PROFILING_RULES ScProfileRules()
#endif
-#define NODE_PROFILE_VARS uint64_t node_ticks_start, node_ticks_end, node_ticks_delta, node_deltas = 0
+#define NODE_PROFILE_VARS \
+ uint64_t node_ticks_start = 0, node_ticks_end, node_ticks_delta, node_deltas = 0
#define NODE_PROFILE_START(node) \
if (PROFILING_RULES) { \
unsigned id = get_instance_id(); \
node->state[id].checks++; \
- PROFILE_START_NODE; \
+ PROFILE_START_NAMED(node); \
}
#define NODE_PROFILE_END_MATCH(node) \
#define NODE_PROFILE_TMPSTART(node) \
if (PROFILING_RULES) { \
- PROFILE_START_NODE; \
+ PROFILE_START_NAMED(node); \
}
#define NODE_PROFILE_TMPEND(node) \