Skip to content

Commit

Permalink
fixup!enip
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Oct 31, 2024
1 parent d7b275c commit f9fdc96
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/app-layer-enip.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,18 @@ static uint64_t ENIPGetTxCnt(void *alstate)
return ((ENIPState *)alstate)->transaction_max;
}

static int ENIPStateGetEventInfo(const char *event_name, int *event_id, AppLayerEventType *event_type)
static int ENIPStateGetEventInfo(
const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)
{
*event_id = SCMapEnumNameToValue(event_name, enip_decoder_event_table);

if (*event_id == -1) {
SCLogError("event \"%s\" not present in "
"enip's enum map table.",
event_name);
/* yes this is fatal */
return -1;
if (SCAppLayerGetEventIdByName(event_name, enip_decoder_event_table, event_id)) {
*event_type = APP_LAYER_EVENT_TYPE_TRANSACTION;
return 0;
}

*event_type = APP_LAYER_EVENT_TYPE_TRANSACTION;

return 0;
return -1;
}

static int ENIPStateGetEventInfoById(int event_id, const char **event_name,
AppLayerEventType *event_type)
static int ENIPStateGetEventInfoById(
uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
{
*event_name = SCMapEnumValueToName(event_id, enip_decoder_event_table);
if (*event_name == NULL) {
Expand Down

0 comments on commit f9fdc96

Please sign in to comment.