prefilter: show prefilter capability in --list-keywords

pull/2310/head
Victor Julien 9 years ago
parent 56239690d0
commit f80623fd73

@ -4020,8 +4020,10 @@ int SigGroupCleanup (DetectEngineCtx *de_ctx)
return 0; return 0;
} }
static inline void PrintFeatureList(int flags, char sep) static void PrintFeatureList(const SigTableElmt *e, char sep)
{ {
const uint8_t flags = e->flags;
int prev = 0; int prev = 0;
if (flags & SIGMATCH_NOOPT) { if (flags & SIGMATCH_NOOPT) {
printf("No option"); printf("No option");
@ -4045,18 +4047,24 @@ static inline void PrintFeatureList(int flags, char sep)
printf("payload inspecting keyword"); printf("payload inspecting keyword");
prev = 1; prev = 1;
} }
if (e->SupportsPrefilter) {
if (prev == 1)
printf("%c", sep);
printf("prefilter");
prev = 1;
}
if (prev == 0) { if (prev == 0) {
printf("none"); printf("none");
} }
} }
static inline void SigMultilinePrint(int i, char *prefix) static void SigMultilinePrint(int i, char *prefix)
{ {
if (sigmatch_table[i].desc) { if (sigmatch_table[i].desc) {
printf("%sDescription: %s\n", prefix, sigmatch_table[i].desc); printf("%sDescription: %s\n", prefix, sigmatch_table[i].desc);
} }
printf("%sFeatures: ", prefix); printf("%sFeatures: ", prefix);
PrintFeatureList(sigmatch_table[i].flags, ','); PrintFeatureList(&sigmatch_table[i], ',');
if (sigmatch_table[i].url) { if (sigmatch_table[i].url) {
printf("\n%sDocumentation: %s", prefix, sigmatch_table[i].url); printf("\n%sDocumentation: %s", prefix, sigmatch_table[i].url);
} }
@ -4079,7 +4087,7 @@ void SigTableList(const char *keyword)
} }
} }
} }
} else if (!strcmp("csv", keyword)) { } else if (strcmp("csv", keyword) == 0) {
printf("name;description;app layer;features;documentation\n"); printf("name;description;app layer;features;documentation\n");
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (sigmatch_table[i].name != NULL) { if (sigmatch_table[i].name != NULL) {
@ -4092,7 +4100,7 @@ void SigTableList(const char *keyword)
} }
/* Build feature */ /* Build feature */
printf(";Unset;"); // this used to be alproto printf(";Unset;"); // this used to be alproto
PrintFeatureList(sigmatch_table[i].flags, ':'); PrintFeatureList(&sigmatch_table[i], ':');
printf(";"); printf(";");
if (sigmatch_table[i].url) { if (sigmatch_table[i].url) {
printf("%s", sigmatch_table[i].url); printf("%s", sigmatch_table[i].url);
@ -4101,7 +4109,7 @@ void SigTableList(const char *keyword)
printf("\n"); printf("\n");
} }
} }
} else if (!strcmp("all", keyword)) { } else if (strcmp("all", keyword) == 0) {
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (sigmatch_table[i].name != NULL) { if (sigmatch_table[i].name != NULL) {
printf("%s:\n", sigmatch_table[i].name); printf("%s:\n", sigmatch_table[i].name);
@ -4111,7 +4119,7 @@ void SigTableList(const char *keyword)
} else { } else {
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if ((sigmatch_table[i].name != NULL) && if ((sigmatch_table[i].name != NULL) &&
!strcmp(sigmatch_table[i].name, keyword)) { strcmp(sigmatch_table[i].name, keyword) == 0) {
printf("= %s =\n", sigmatch_table[i].name); printf("= %s =\n", sigmatch_table[i].name);
if (sigmatch_table[i].flags & SIGMATCH_NOT_BUILT) { if (sigmatch_table[i].flags & SIGMATCH_NOT_BUILT) {
printf("Not built-in\n"); printf("Not built-in\n");

Loading…
Cancel
Save