Input index event predicate

This commit is contained in:
Vftdan 2024-08-17 14:28:38 +02:00
parent a46131716e
commit 20a97dbba7
3 changed files with 9 additions and 2 deletions

View File

@ -266,6 +266,9 @@ parse_event_predicate_type(const char *name)
if (strcmp(name, "payload") == 0) { if (strcmp(name, "payload") == 0) {
return EVPRED_PAYLOAD; return EVPRED_PAYLOAD;
} }
if (strcmp(name, "input_index") == 0) {
return EVPRED_INPUT_INDEX;
}
if (strcmp(name, "conjunction") == 0 || strcmp(name, "and") == 0) { if (strcmp(name, "conjunction") == 0 || strcmp(name, "and") == 0) {
return EVPRED_CONJUNCTION; return EVPRED_CONJUNCTION;
} }
@ -295,7 +298,7 @@ load_single_predicate(const config_setting_t * setting, EventPredicateHandleRegi
return -1; return -1;
case EVPRED_ACCEPT: case EVPRED_ACCEPT:
break; break;
case EVPRED_CODE_NS...EVPRED_PAYLOAD: case EVPRED_CODE_NS...EVPRED_INPUT_INDEX:
{ {
int64_t min_value = INT64_MIN; int64_t min_value = INT64_MIN;
int64_t max_value = INT64_MAX; int64_t max_value = INT64_MAX;

View File

@ -109,7 +109,7 @@ event_predicate_apply(EventPredicateHandle handle, EventNode * event)
case EVPRED_ACCEPT: case EVPRED_ACCEPT:
accepted = true; accepted = true;
break; break;
case EVPRED_CODE_NS...EVPRED_PAYLOAD: case EVPRED_CODE_NS...EVPRED_INPUT_INDEX:
if (!event) { if (!event) {
return EVPREDRES_DISABLED; return EVPREDRES_DISABLED;
} }
@ -128,6 +128,9 @@ event_predicate_apply(EventPredicateHandle handle, EventNode * event)
case EVPRED_PAYLOAD: case EVPRED_PAYLOAD:
actual = event->data.payload; actual = event->data.payload;
break; break;
case EVPRED_INPUT_INDEX:
actual = event->input_index;
break;
default: default:
return EVPREDRES_DISABLED; return EVPREDRES_DISABLED;
} }

View File

@ -14,6 +14,7 @@ typedef enum {
EVPRED_CODE_MAJOR, EVPRED_CODE_MAJOR,
EVPRED_CODE_MINOR, EVPRED_CODE_MINOR,
EVPRED_PAYLOAD, EVPRED_PAYLOAD,
EVPRED_INPUT_INDEX,
// Aggregation // Aggregation
EVPRED_CONJUNCTION, EVPRED_CONJUNCTION,
EVPRED_DISJUNCTION, EVPRED_DISJUNCTION,