70 if (node->
val && strcmp(node->
val,
"eve-log") == 0) {
73 const char *ethernet =
100 SCLogError(
"Unable to allocate MacSet memory");
120static inline void MacUpdateEntry(
123 switch (ms->
state[side]) {
132 if (ms->
buf[side] == NULL) {
146 memcpy(ms->
buf[side] + 1, addr,
sizeof(
MacAddr));
160 if (ms->
last[side] > 0) {
165 for (
int i = ms->
last[side] - 1; i >= 0; i--) {
166 uint8_t *addr2 = (uint8_t*) ((ms->
buf[side]) + i);
183 uint16_t ctr_src, uint16_t ctr_dst)
200 switch (ms->
state[side]) {
204 ret = IterFunc((uint8_t*) ms->
singles[side], side, data);
210 for (
int i = 0; i < ms->
last[side]; i++) {
211 ret = IterFunc((uint8_t*) ms->
buf[side][i], side, data);
227 ret = MacSetIterateSide(ms, IterFunc,
MAC_SET_SRC, data);
231 return MacSetIterateSide(ms, IterFunc,
MAC_SET_DST, data);
236 switch (ms->
state[side]) {
240 return (uint8_t *)ms->
singles[side];
242 return (uint8_t *)ms->
buf[side][0];
280 size_t total_free = 0;
292 total_free +=
sizeof(*ms);
298static int CheckTest1Membership(uint8_t *addr,
MacSetSide side,
void *data)
300 int *i = (
int*) data;
303 if (addr[5] != 1)
return 1;
306 if (addr[5] != 2)
return 1;
309 if (addr[5] != 3)
return 1;
316static int MacSetTest01(
void)
320 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
321 addr2 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
322 addr3 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x3};
349static int MacSetTest02(
void)
359 for (i = 1; i < 100; i++) {
360 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
361 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x2};
373static int MacSetTest03(
void)
382 for (uint8_t i = 1; i < 100; i++) {
383 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
384 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
395static int MacSetTest04(
void)
406static int MacSetTest05(
void)
416 for (uint8_t i = 1; i < 100; i++) {
417 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
418 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
433static int MacSetTest06(
void)
444 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 },
445 addr3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 }, addr4 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x4 };
struct HtpBodyChunk_ * next
SCConfNode * SCConfGetNode(const char *name)
Get a SCConfNode by name.
int SCConfValIsTrue(const char *val)
Check if a value is true.
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x)
Sets a value of type double to the local counter.
FlowStorageId FlowStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
#define FLOW_CHECK_MEMCAP(size)
check if a memory alloc would fit in the memcap
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define PASS
Pass the test.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define TAILQ_FOREACH(var, head, field)
Per thread variable structure.
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
#define SCLogError(...)
Macro used to log ERROR messages.
void MacSetFree(MacSet *ms)
uint8_t * MacSetGetFirst(const MacSet *ms, MacSetSide side)
FlowStorageId g_macset_storage_id
FlowStorageId MacSetGetFlowStorageID(void)
void MacSetRegisterTests(void)
MacSet * MacSetInit(int size)
bool MacSetFlowStorageEnabled(void)
void MacSetRegisterFlowStorage(void)
void MacSetAdd(MacSet *ms, const uint8_t *src_addr, const uint8_t *dst_addr)
void MacSetAddWithCtr(MacSet *ms, const uint8_t *src_addr, const uint8_t *dst_addr, ThreadVars *tv, uint16_t ctr_src, uint16_t ctr_dst)
int MacSetForEach(const MacSet *ms, MacSetIteratorFunc IterFunc, void *data)
int MacSetSize(const MacSet *ms)
int(* MacSetIteratorFunc)(uint8_t *addr, MacSetSide side, void *)