85 #if __BYTE_ORDER == __LITTLE_ENDIAN
105 const uint8_t *buf, uint32_t buflen);
108 const uint8_t *buf, uint32_t buflen);
111 const uint8_t *buf, uint32_t buflen);
114 const uint8_t *buf, uint32_t buflen);
117 const uint8_t *buf, uint32_t buflen);
120 const uint8_t *buf, uint32_t buflen);
123 const uint8_t *buf, uint32_t buflen);
127 const uint8_t *buf, uint32_t buflen);
130 const uint8_t *buf, uint32_t buflen);
133 const uint8_t *buf, uint32_t buflen);
136 const uint8_t *buf, uint32_t buflen);
139 const uint8_t *buf, uint32_t buflen);
142 const uint8_t *buf, uint32_t buflen);
145 static void SCACTileDestroyInitCtx(
MpmCtx *mpm_ctx);
149 #define SC_AC_TILE_FAIL (-1)
151 #define STATE_QUEUE_CONTAINER_SIZE 65536
168 static void SCACTileGetConfig(
void)
179 static inline void SCACTileHistogramAlphabet(
SCACTileCtx *ctx,
182 for (
int i = 0; i < p->
len; i++) {
189 static void SCACTileInitTranslateTable(
SCACTileCtx *ctx)
195 for (
int i = 0; i < 256; i++) {
197 if (i >=
'A' && i <=
'Z') {
209 for (
int i =
'A'; i <=
'Z'; i++)
232 static void SCACTileReallocOutputTable(
SCACTileCtx *ctx,
int new_state_count)
246 static void SCACTileReallocState(
SCACTileCtx *ctx,
int new_state_count)
258 SCACTileReallocOutputTable(ctx, new_state_count);
269 static inline int SCACTileInitNewState(
MpmCtx *mpm_ctx)
314 for (i = 0; i < output_state->no_of_entries; i++) {
315 if (output_state->patterns[i] == pindex)
325 SCFree(output_state->patterns);
326 output_state->patterns = NULL;
329 output_state->patterns = ptmp;
331 output_state->patterns[output_state->no_of_entries - 1] = pindex;
344 static void SCACTileEnter(uint8_t *pattern, uint16_t pattern_len,
351 int32_t newstate = 0;
358 for (i = 0; i < pattern_len; i++) {
367 for (p = i; p < pattern_len; p++) {
368 newstate = SCACTileInitNewState(mpm_ctx);
376 SCACTileSetOutputState(state, pindex, mpm_ctx);
385 static void SCACTileCreateGotoTable(
MpmCtx *mpm_ctx)
406 static inline int SCACTileStateQueueIsEmpty(
StateQueue *q)
414 static inline void SCACTileEnqueue(
StateQueue *q, int32_t state)
419 for (i = q->
bot; i < q->top; i++) {
420 if (q->
store[i] == state)
430 FatalError(
"Just ran out of space in the queue. "
431 "Fatal Error. Exiting. Please file a bug report on this");
435 static inline int32_t SCACTileDequeue(
StateQueue *q)
442 "Fatal Error. Exiting. Please file a bug report on this");
457 static void SCACTileClubOutputStates(int32_t dst_state,
471 for (i = 0; i < output_src_state->no_of_entries; i++) {
472 for (j = 0; j < output_dst_state->no_of_entries; j++) {
473 if (output_src_state->patterns[i] == output_dst_state->patterns[j]) {
477 if (j == output_dst_state->no_of_entries) {
480 ptmp =
SCRealloc(output_dst_state->patterns,
481 (output_dst_state->no_of_entries *
sizeof(uint32_t)));
483 SCFree(output_dst_state->patterns);
484 output_dst_state->patterns = NULL;
487 output_dst_state->patterns = ptmp;
489 output_dst_state->patterns[output_dst_state->no_of_entries - 1] =
490 output_src_state->patterns[i];
501 static void SCACTileCreateFailureTable(
MpmCtx *mpm_ctx)
526 if (temp_state != 0) {
527 SCACTileEnqueue(&q, temp_state);
532 while (!SCACTileStateQueueIsEmpty(&q)) {
534 r_state = SCACTileDequeue(&q);
536 int32_t temp_state = ctx->
goto_table[r_state][aa];
539 SCACTileEnqueue(&q, temp_state);
545 SCACTileClubOutputStates(temp_state, ctx->
failure_table[temp_state],
554 static void SCACTileSetState1Byte(
SCACTileCtx *ctx,
int state,
int aa,
555 int next_state,
int outputs)
559 uint8_t encoded_next_state = (uint8_t)next_state;
566 encoded_next_state |= (1 << 7);
574 static void SCACTileSetState2Bytes(
SCACTileCtx *ctx,
int state,
int aa,
575 int next_state,
int outputs)
577 uint16_t *state_table = (uint16_t*)ctx->
state_table;
579 uint16_t encoded_next_state = (uint16_t)next_state;
586 encoded_next_state |= (1 << 15);
594 static void SCACTileSetState4Bytes(
SCACTileCtx *ctx,
int state,
int aa,
595 int next_state,
int outputs)
597 uint32_t *state_table = (uint32_t*)ctx->
state_table;
598 uint32_t encoded_next_state = next_state;
605 encoded_next_state |= (1UL << 31);
616 static inline void SCACTileCreateDeltaTable(
MpmCtx *mpm_ctx)
688 SCACTileEnqueue(&q, temp_state);
691 while (!SCACTileStateQueueIsEmpty(&q)) {
692 r_state = SCACTileDequeue(&q);
695 int temp_state = ctx->
goto_table[r_state][aa];
697 SCACTileEnqueue(&q, temp_state);
706 static void SCACTileClubOutputStatePresenceWithDeltaTable(
MpmCtx *mpm_ctx)
717 if (
unlikely(state_table == NULL)) {
720 memset(state_table, 0, size);
726 SCLogDebug(
"Delta Table size %d, alphabet: %d, %d-byte states: %d",
733 for (state = 0; state < ctx->
state_count; state++) {
737 ctx->
SetNextState(ctx, state, aa, next_state, next_state_outputs);
742 static inline void SCACTileInsertCaseSensitiveEntriesForPatterns(
MpmCtx *mpm_ctx)
750 for (state = 0; state < ctx->
state_count; state++) {
765 static void SCACTilePrintDeltaTable(
MpmCtx *mpm_ctx)
772 printf(
"##############Delta Table##############\n");
776 if (SCACTileGetDelta(i, j, mpm_ctx) != 0) {
777 printf(
" %c -> %d\n", j, SCACTileGetDelta(i, j, mpm_ctx));
789 static void SCACTilePrepareStateTable(
MpmCtx *mpm_ctx)
795 SCACTileInitTranslateTable(ctx);
798 SCACTileInitNewState(mpm_ctx);
801 SCACTileCreateGotoTable(mpm_ctx);
803 SCACTileCreateFailureTable(mpm_ctx);
805 SCACTileCreateDeltaTable(mpm_ctx);
807 SCACTileClubOutputStatePresenceWithDeltaTable(mpm_ctx);
810 SCACTileInsertCaseSensitiveEntriesForPatterns(mpm_ctx);
813 SCACTilePrintDeltaTable(mpm_ctx);
831 static void SCACTilePrepareSearch(
MpmCtx *mpm_ctx)
860 SCACTileDestroyInitCtx(mpm_ctx);
873 SCLogDebug(
"no patterns supplied to this mpm_ctx");
878 SCLogDebug(
"no patterns supplied to this mpm_ctx");
890 uint32_t i = 0, p = 0;
893 while(node != NULL) {
897 SCACTileHistogramAlphabet(ctx, node);
911 size_t string_space_needed = 0;
915 uint32_t space = ((ctx->
parray[i]->
len + 7) / 8) * 8;
916 string_space_needed += space;
921 size_t mem_size = string_space_needed + pattern_list_size;
922 void *mem_block =
SCCalloc(1, mem_size);
923 if (mem_block == NULL) {
930 uint8_t *string_space = mem_block + pattern_list_size;
936 uint32_t space = ((
len + 7) / 8) * 8;
940 string_space += space;
954 SCACTilePrepareStateTable(mpm_ctx);
957 SCACTilePrepareSearch(mpm_ctx);
976 if (mpm_thread_ctx->
ctx == NULL) {
991 if (mpm_ctx->
ctx != NULL)
996 if (mpm_ctx->
ctx == NULL) {
1008 if (search_ctx->
init_ctx == NULL) {
1025 SCACTileGetConfig();
1038 if (mpm_thread_ctx->
ctx != NULL) {
1040 mpm_thread_ctx->
ctx = NULL;
1046 static void SCACTileDestroyInitCtx(
MpmCtx *mpm_ctx)
1059 if (ctx->
parray != NULL) {
1062 if (ctx->
parray[i] != NULL) {
1081 for (state = 0; state < ctx->
state_count; state++) {
1114 if (search_ctx == NULL)
1118 SCACTileDestroyInitCtx(mpm_ctx);
1134 for (state = 0; state < search_ctx->
state_count; state++) {
1143 mpm_ctx->
ctx = NULL;
1153 #define SCHECK(x) ((x) > 0)
1154 #define BUF_TYPE int32_t
1156 #define BYTE0(x) (((x) & 0x000000ff) >> 0)
1157 #define BYTE1(x) (((x) & 0x0000ff00) >> 8)
1158 #define BYTE2(x) (((x) & 0x00ff0000) >> 16)
1159 #define BYTE3(x) (((x) & 0xff000000) >> 24)
1160 #define EXTRA 4 // need 4 extra bytes to avoid OOB reads
1163 const uint8_t *buf, uint32_t buflen,
1164 uint16_t state,
int i,
int matches,
1165 uint8_t *mpm_bitarray)
1168 const uint8_t *buf_offset = buf + i + 1;
1173 for (k = 0; k < no_of_entries; k++) {
1175 if (mpm_bitarray[pindex / 8] & (1 << (pindex % 8))) {
1192 if (patterns[k] >> 31) {
1193 const uint16_t patlen = pat->
patlen;
1194 if (
SCMemcmp(pat->
cs, buf_offset - patlen, patlen) != 0) {
1200 mpm_bitarray[pindex / 8] |= (1 << (pindex % 8));
1205 PrefilterAddSids(pmq, pattern_list[pindex].sids,
1206 pattern_list[pindex].sids_size);
1234 return search_ctx->
Search(search_ctx, mpm_thread_ctx, pmq, buf, buflen);
1240 const uint8_t *buf, uint32_t buflen)
1249 register int state = 0;
1250 int32_t (*state_table_u32)[256] = ctx->
state_table;
1251 for (i = 0; i < buflen; i++) {
1252 state = state_table_u32[state & 0x00FFFFFF][xlate[buf[i]]];
1255 matches = CheckMatch(ctx, pmq, buf, buflen, (uint16_t)state, i, matches, mpm_bitarray);
1267 #define SINDEX_INTERNAL(y, x, log_mult, width) \
1268 ((1<<log_mult) * (x & ((1<<width) - 1)))
1271 #define STYPE int16_t
1272 #define SLOAD(x) *(STYPE * restrict)(x)
1274 #define FUNC_NAME SCACTileSearchSmall256
1276 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 8, 15)
1282 #define FUNC_NAME SCACTileSearchSmall128
1284 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 7, 15)
1290 #define FUNC_NAME SCACTileSearchSmall64
1292 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 6, 15)
1298 #define FUNC_NAME SCACTileSearchSmall32
1300 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 5, 15)
1306 #define FUNC_NAME SCACTileSearchSmall16
1308 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 4, 15)
1314 #define FUNC_NAME SCACTileSearchSmall8
1316 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 3, 15)
1324 #define STYPE int8_t
1328 #define FUNC_NAME SCACTileSearchTiny256
1330 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 8, 7)
1336 #define FUNC_NAME SCACTileSearchTiny128
1338 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 7, 7)
1344 #define FUNC_NAME SCACTileSearchTiny64
1346 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 6, 7)
1352 #define FUNC_NAME SCACTileSearchTiny32
1354 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 5, 7)
1360 #define FUNC_NAME SCACTileSearchTiny16
1362 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 4, 7)
1368 #define FUNC_NAME SCACTileSearchTiny8
1370 #define SINDEX(y,x) SINDEX_INTERNAL(y, x, 3, 7)
1392 uint16_t
offset, uint16_t depth, uint32_t pid,
1418 uint16_t
offset, uint16_t depth, uint32_t pid,
1427 #ifdef SC_AC_TILE_COUNTERS
1429 printf(
"AC Thread Search stats (ctx %p)\n", ctx);
1430 printf(
"Total calls: %" PRIu32
"\n", ctx->
total_calls);
1440 printf(
"MPM AC Information:\n");
1441 printf(
"Memory allocs: %" PRIu32
"\n", mpm_ctx->
memory_cnt);
1442 printf(
"Memory alloced: %" PRIu32
"\n", mpm_ctx->
memory_size);
1443 printf(
" Sizeof:\n");
1444 printf(
" MpmCtx %" PRIuMAX
"\n", (uintmax_t)
sizeof(
MpmCtx));
1445 printf(
" SCACTileCtx: %" PRIuMAX
"\n", (uintmax_t)
sizeof(
SCACTileCtx));
1446 printf(
" MpmPattern %" PRIuMAX
"\n", (uintmax_t)
sizeof(
MpmPattern));
1447 printf(
" MpmPattern %" PRIuMAX
"\n", (uintmax_t)
sizeof(
MpmPattern));
1448 printf(
"Unique Patterns: %" PRIu32
"\n", mpm_ctx->
pattern_cnt);
1449 printf(
"Smallest: %" PRIu32
"\n", mpm_ctx->
minlen);
1450 printf(
"Largest: %" PRIu32
"\n", mpm_ctx->
maxlen);
1451 printf(
"Total states in the state table: %u\n", ctx->
state_count);
1483 static int SCACTileTest01(
void)
1490 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1501 const char *buf =
"abcdefghjiklmnopqrstuvwxyz";
1504 (uint8_t *)buf, strlen(buf));
1509 printf(
"1 != %" PRIu32
" ",cnt);
1517 static int SCACTileTest02(
void)
1524 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1535 const char *buf =
"abcdefghjiklmnopqrstuvwxyz";
1537 (uint8_t *)buf, strlen(buf));
1542 printf(
"0 != %" PRIu32
" ",cnt);
1550 static int SCACTileTest03(
void)
1557 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1572 const char *buf =
"abcdefghjiklmnopqrstuvwxyz";
1574 (uint8_t *)buf, strlen(buf));
1579 printf(
"3 != %" PRIu32
" ",cnt);
1587 static int SCACTileTest04(
void)
1594 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1606 const char *buf =
"abcdefghjiklmnopqrstuvwxyz";
1608 (uint8_t *)buf, strlen(buf));
1613 printf(
"1 != %" PRIu32
" ",cnt);
1621 static int SCACTileTest05(
void)
1628 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1640 const char *buf =
"abcdefghjiklmnopqrstuvwxyz";
1642 (uint8_t *)buf, strlen(buf));
1647 printf(
"3 != %" PRIu32
" ",cnt);
1655 static int SCACTileTest06(
void)
1662 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1672 const char *buf =
"abcd";
1674 (uint8_t *)buf, strlen(buf));
1679 printf(
"1 != %" PRIu32
" ",cnt);
1687 static int SCACTileTest07(
void)
1694 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1708 MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"AAAAAAAAAA", 10, 0, 0, 4, 0, 0);
1710 MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
1717 const char *buf =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
1719 (uint8_t *)buf, strlen(buf));
1724 printf(
"135 != %" PRIu32
" ",cnt);
1732 static int SCACTileTest08(
void)
1739 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1756 printf(
"0 != %" PRIu32
" ",cnt);
1764 static int SCACTileTest09(
void)
1771 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1783 (uint8_t *)
"ab", 2);
1788 printf(
"1 != %" PRIu32
" ",cnt);
1796 static int SCACTileTest10(
void)
1803 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1814 const char *buf =
"01234567890123456789012345678901234567890123456789"
1815 "01234567890123456789012345678901234567890123456789"
1817 "01234567890123456789012345678901234567890123456789"
1818 "01234567890123456789012345678901234567890123456789";
1820 (uint8_t *)buf, strlen(buf));
1825 printf(
"1 != %" PRIu32
" ",cnt);
1833 static int SCACTileTest11(
void)
1840 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
1845 if (
MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"he", 2, 0, 0, 1, 0, 0) == -1)
1847 if (
MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"she", 3, 0, 0, 2, 0, 0) == -1)
1849 if (
MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"his", 3, 0, 0, 3, 0, 0) == -1)
1851 if (
MpmAddPatternCS(&mpm_ctx, (uint8_t *)
"hers", 4, 0, 0, 4, 0, 0) == -1)
1860 const char *buf =
"he";
1861 result &= (
SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq, (uint8_t *)buf,
1864 result &= (
SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq, (uint8_t *)buf,
1867 result &= (
SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq, (uint8_t *)buf,
1870 result &= (
SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq, (uint8_t *)buf,
1880 static int SCACTileTest12(
void)
1887 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1900 const char *buf =
"abcdefghijklmnopqrstuvwxyz";
1902 (uint8_t *)buf, strlen(buf));
1907 printf(
"2 != %" PRIu32
" ",cnt);
1915 static int SCACTileTest13(
void)
1922 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1928 const char pat[] =
"abcdefghijklmnopqrstuvwxyzABCD";
1929 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
1934 const char *buf =
"abcdefghijklmnopqrstuvwxyzABCD";
1936 (uint8_t *)buf, strlen(buf));
1941 printf(
"1 != %" PRIu32
" ",cnt);
1949 static int SCACTileTest14(
void)
1956 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1962 const char pat[] =
"abcdefghijklmnopqrstuvwxyzABCDE";
1963 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
1968 const char *buf =
"abcdefghijklmnopqrstuvwxyzABCDE";
1970 (uint8_t *)buf, strlen(buf));
1975 printf(
"1 != %" PRIu32
" ",cnt);
1983 static int SCACTileTest15(
void)
1990 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
1996 const char pat[] =
"abcdefghijklmnopqrstuvwxyzABCDEF";
1997 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2002 const char *buf =
"abcdefghijklmnopqrstuvwxyzABCDEF";
2004 (uint8_t *)buf, strlen(buf));
2009 printf(
"1 != %" PRIu32
" ",cnt);
2017 static int SCACTileTest16(
void)
2024 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2030 const char pat[] =
"abcdefghijklmnopqrstuvwxyzABC";
2031 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2036 const char *buf =
"abcdefghijklmnopqrstuvwxyzABC";
2038 (uint8_t *)buf, strlen(buf));
2043 printf(
"1 != %" PRIu32
" ",cnt);
2051 static int SCACTileTest17(
void)
2058 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2064 const char pat[] =
"abcdefghijklmnopqrstuvwxyzAB";
2065 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2070 const char *buf =
"abcdefghijklmnopqrstuvwxyzAB";
2072 (uint8_t *)buf, strlen(buf));
2077 printf(
"1 != %" PRIu32
" ",cnt);
2085 static int SCACTileTest18(
void)
2092 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2098 const char pat[] =
"abcde"
2104 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2109 const char *buf =
"abcde""fghij""klmno""pqrst""uvwxy""z";
2111 (uint8_t *)buf, strlen(buf));
2116 printf(
"1 != %" PRIu32
" ",cnt);
2124 static int SCACTileTest19(
void)
2131 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2137 const char pat[] =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
2138 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2143 const char *buf =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
2145 (uint8_t *)buf, strlen(buf));
2150 printf(
"1 != %" PRIu32
" ",cnt);
2158 static int SCACTileTest20(
void)
2165 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2171 const char pat[] =
"AAAAA"
2178 MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat,
sizeof(pat) - 1, 0, 0, 0, 0, 0);
2183 const char *buf =
"AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA";
2185 (uint8_t *)buf, strlen(buf));
2190 printf(
"1 != %" PRIu32
" ",cnt);
2198 static int SCACTileTest21(
void)
2205 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2217 (uint8_t *)
"AA", 2);
2222 printf(
"1 != %" PRIu32
" ",cnt);
2230 static int SCACTileTest22(
void)
2237 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2250 const char *buf =
"abcdefghijklmnopqrstuvwxyz";
2252 (uint8_t *)buf, strlen(buf));
2257 printf(
"2 != %" PRIu32
" ",cnt);
2265 static int SCACTileTest23(
void)
2272 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2284 (uint8_t *)
"aa", 2);
2289 printf(
"1 != %" PRIu32
" ",cnt);
2297 static int SCACTileTest24(
void)
2304 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2316 (uint8_t *)
"aa", 2);
2321 printf(
"1 != %" PRIu32
" ",cnt);
2329 static int SCACTileTest25(
void)
2336 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2348 const char *buf =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
2350 (uint8_t *)buf, strlen(buf));
2355 printf(
"3 != %" PRIu32
" ",cnt);
2363 static int SCACTileTest26(
void)
2370 memset(&mpm_ctx, 0x00,
sizeof(
MpmCtx));
2381 const char *buf =
"works";
2383 (uint8_t *)buf, strlen(buf));
2388 printf(
"3 != %" PRIu32
" ",cnt);
2396 static int SCACTileTest27(
void)
2403 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
2414 const char *buf =
"tone";
2416 (uint8_t *)buf, strlen(buf));
2421 printf(
"0 != %" PRIu32
" ",cnt);
2429 static int SCACTileTest28(
void)
2436 memset(&mpm_ctx, 0,
sizeof(
MpmCtx));
2447 const char *buf =
"tONE";
2449 (uint8_t *)buf, strlen(buf));
2454 printf(
"0 != %" PRIu32
" ",cnt);
2462 static int SCACTileTest29(
void)
2464 uint8_t buf[] =
"onetwothreefourfivesixseveneightnine";
2465 uint16_t buflen =
sizeof(buf) - 1;
2471 memset(&th_v, 0,
sizeof(th_v));
2481 "(content:\"onetwothreefourfivesixseveneightnine\"; sid:1;)");
2485 "(content:\"onetwothreefourfivesixseveneightnine\"; fast_pattern:3,3; sid:2;)");
2494 printf(
"if (PacketAlertCheck(p, 1) != 1) failure\n");
2498 printf(
"if (PacketAlertCheck(p, 1) != 2) failure\n");