|
|
|
|
@ -1138,8 +1138,8 @@ uint32_t SCACTileSearchLarge(const SCACTileSearchCtx *ctx, MpmThreadCtx *mpm_thr
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
int matches = 0;
|
|
|
|
|
|
|
|
|
|
uint8_t mpm_bitarray[ctx->mpm_bitarray_size];
|
|
|
|
|
memset(mpm_bitarray, 0, ctx->mpm_bitarray_size);
|
|
|
|
|
uint8_t *mpm_bitarray = (uint8_t *)mpm_thread_ctx->ctx;
|
|
|
|
|
memset(mpm_bitarray, 0, mpm_thread_ctx->memory_size);
|
|
|
|
|
|
|
|
|
|
const uint8_t* restrict xlate = ctx->translate_table;
|
|
|
|
|
register int state = 0;
|
|
|
|
|
@ -1337,6 +1337,33 @@ void SCACTilePrintInfo(MpmCtx *mpm_ctx)
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Init the mpm thread context.
|
|
|
|
|
*
|
|
|
|
|
* \param mpm_ctx Pointer to the mpm context.
|
|
|
|
|
* \param mpm_thread_ctx Pointer to the mpm thread context.
|
|
|
|
|
*/
|
|
|
|
|
static void SCACTileInitThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx)
|
|
|
|
|
{
|
|
|
|
|
uint32_t size = (mpm_ctx->pattern_cnt + 7) / 8;
|
|
|
|
|
|
|
|
|
|
uint8_t *bitarray = SCCalloc(size, sizeof(uint8_t));
|
|
|
|
|
if (bitarray == NULL) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
mpm_thread_ctx->ctx = bitarray;
|
|
|
|
|
mpm_thread_ctx->memory_cnt = 1;
|
|
|
|
|
mpm_thread_ctx->memory_size = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCACTileDestroyThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx)
|
|
|
|
|
{
|
|
|
|
|
mpm_thread_ctx->memory_cnt = 0;
|
|
|
|
|
mpm_thread_ctx->memory_size = 0;
|
|
|
|
|
SCFree(mpm_thread_ctx->ctx);
|
|
|
|
|
mpm_thread_ctx->ctx = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************** Mpm Registration ***************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -1357,6 +1384,8 @@ void MpmACTileRegister(void)
|
|
|
|
|
mpm_table[MPM_AC_KS].CacheRuleset = NULL;
|
|
|
|
|
mpm_table[MPM_AC_KS].Search = SCACTileSearch;
|
|
|
|
|
mpm_table[MPM_AC_KS].PrintCtx = SCACTilePrintInfo;
|
|
|
|
|
mpm_table[MPM_AC_KS].InitThreadCtx = SCACTileInitThreadCtx;
|
|
|
|
|
mpm_table[MPM_AC_KS].DestroyThreadCtx = SCACTileDestroyThreadCtx;
|
|
|
|
|
#ifdef UNITTESTS
|
|
|
|
|
mpm_table[MPM_AC_KS].RegisterUnittests = SCACTileRegisterTests;
|
|
|
|
|
#endif
|
|
|
|
|
@ -1385,6 +1414,7 @@ static int SCACTileTest01(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghjiklmnopqrstuvwxyz";
|
|
|
|
|
|
|
|
|
|
@ -1397,6 +1427,7 @@ static int SCACTileTest01(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1417,6 +1448,7 @@ static int SCACTileTest02(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghjiklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1428,6 +1460,7 @@ static int SCACTileTest02(void)
|
|
|
|
|
printf("0 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1452,6 +1485,7 @@ static int SCACTileTest03(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghjiklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1463,6 +1497,7 @@ static int SCACTileTest03(void)
|
|
|
|
|
printf("3 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1484,6 +1519,7 @@ static int SCACTileTest04(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghjiklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1495,6 +1531,7 @@ static int SCACTileTest04(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1516,6 +1553,7 @@ static int SCACTileTest05(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghjiklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1527,6 +1565,7 @@ static int SCACTileTest05(void)
|
|
|
|
|
printf("3 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1546,6 +1585,7 @@ static int SCACTileTest06(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcd";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1557,6 +1597,7 @@ static int SCACTileTest06(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1588,6 +1629,7 @@ static int SCACTileTest07(void)
|
|
|
|
|
/* total matches: 135: 6 unique */
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1595,6 +1637,7 @@ static int SCACTileTest07(void)
|
|
|
|
|
FAIL_IF_NOT(cnt == 6);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
@ -1615,6 +1658,7 @@ static int SCACTileTest08(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
(uint8_t *)"a", 1);
|
|
|
|
|
@ -1625,6 +1669,7 @@ static int SCACTileTest08(void)
|
|
|
|
|
printf("0 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1645,6 +1690,7 @@ static int SCACTileTest09(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
(uint8_t *)"ab", 2);
|
|
|
|
|
@ -1655,6 +1701,7 @@ static int SCACTileTest09(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1675,6 +1722,7 @@ static int SCACTileTest10(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "01234567890123456789012345678901234567890123456789"
|
|
|
|
|
"01234567890123456789012345678901234567890123456789"
|
|
|
|
|
@ -1690,6 +1738,7 @@ static int SCACTileTest10(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1717,6 +1766,7 @@ static int SCACTileTest11(void)
|
|
|
|
|
|
|
|
|
|
if (SCACTilePreparePatterns(NULL, &mpm_ctx) == -1)
|
|
|
|
|
goto end;
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
result = 1;
|
|
|
|
|
|
|
|
|
|
@ -1735,6 +1785,7 @@ static int SCACTileTest11(void)
|
|
|
|
|
|
|
|
|
|
end:
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1757,6 +1808,7 @@ static int SCACTileTest12(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1768,6 +1820,7 @@ static int SCACTileTest12(void)
|
|
|
|
|
printf("2 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1789,6 +1842,7 @@ static int SCACTileTest13(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyzABCD";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1800,6 +1854,7 @@ static int SCACTileTest13(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1821,6 +1876,7 @@ static int SCACTileTest14(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyzABCDE";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1832,6 +1888,7 @@ static int SCACTileTest14(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1853,6 +1910,7 @@ static int SCACTileTest15(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyzABCDEF";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1864,6 +1922,7 @@ static int SCACTileTest15(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1885,6 +1944,7 @@ static int SCACTileTest16(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyzABC";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1896,6 +1956,7 @@ static int SCACTileTest16(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1917,6 +1978,7 @@ static int SCACTileTest17(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyzAB";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1928,6 +1990,7 @@ static int SCACTileTest17(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1954,6 +2017,7 @@ static int SCACTileTest18(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcde""fghij""klmno""pqrst""uvwxy""z";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1965,6 +2029,7 @@ static int SCACTileTest18(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -1986,6 +2051,7 @@ static int SCACTileTest19(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -1997,6 +2063,7 @@ static int SCACTileTest19(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2024,6 +2091,7 @@ static int SCACTileTest20(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2035,6 +2103,7 @@ static int SCACTileTest20(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2055,6 +2124,7 @@ static int SCACTileTest21(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
(uint8_t *)"AA", 2);
|
|
|
|
|
@ -2065,6 +2135,7 @@ static int SCACTileTest21(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2087,6 +2158,7 @@ static int SCACTileTest22(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "abcdefghijklmnopqrstuvwxyz";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2098,6 +2170,7 @@ static int SCACTileTest22(void)
|
|
|
|
|
printf("2 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2118,6 +2191,7 @@ static int SCACTileTest23(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
(uint8_t *)"aa", 2);
|
|
|
|
|
@ -2128,6 +2202,7 @@ static int SCACTileTest23(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2148,6 +2223,7 @@ static int SCACTileTest24(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
(uint8_t *)"aa", 2);
|
|
|
|
|
@ -2158,6 +2234,7 @@ static int SCACTileTest24(void)
|
|
|
|
|
printf("1 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2179,6 +2256,7 @@ static int SCACTileTest25(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2190,6 +2268,7 @@ static int SCACTileTest25(void)
|
|
|
|
|
printf("3 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2210,6 +2289,7 @@ static int SCACTileTest26(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "works";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2221,6 +2301,7 @@ static int SCACTileTest26(void)
|
|
|
|
|
printf("3 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2241,6 +2322,7 @@ static int SCACTileTest27(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "tone";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2252,6 +2334,7 @@ static int SCACTileTest27(void)
|
|
|
|
|
printf("0 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@ -2272,6 +2355,7 @@ static int SCACTileTest28(void)
|
|
|
|
|
PmqSetup(&pmq);
|
|
|
|
|
|
|
|
|
|
SCACTilePreparePatterns(NULL, &mpm_ctx);
|
|
|
|
|
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
|
|
|
|
|
const char *buf = "tONE";
|
|
|
|
|
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
|
|
|
|
|
@ -2283,6 +2367,7 @@ static int SCACTileTest28(void)
|
|
|
|
|
printf("0 != %" PRIu32 " ",cnt);
|
|
|
|
|
|
|
|
|
|
SCACTileDestroyCtx(&mpm_ctx);
|
|
|
|
|
SCACTileDestroyThreadCtx(&mpm_ctx, &mpm_thread_ctx);
|
|
|
|
|
PmqFree(&pmq);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|