suricata
util-enum.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SCEnumCharMap_
 

Typedefs

typedef struct SCEnumCharMap_ SCEnumCharMap
 

Functions

int SCMapEnumNameToValue (const char *, SCEnumCharMap *)
 Maps a string name to an enum value from the supplied table. Please specify the last element of any map table with a {NULL, -1}. If missing, you will be welcomed with a segfault :) More...
 
const char * SCMapEnumValueToName (int, SCEnumCharMap *)
 Maps an enum value to a string name, from the supplied table. More...
 

Detailed Description

Typedef Documentation

◆ SCEnumCharMap

typedef struct SCEnumCharMap_ SCEnumCharMap

Function Documentation

◆ SCMapEnumNameToValue()

int SCMapEnumNameToValue ( const char *  enum_name,
SCEnumCharMap table 
)

Maps a string name to an enum value from the supplied table. Please specify the last element of any map table with a {NULL, -1}. If missing, you will be welcomed with a segfault :)

Parameters
enum_nameCharacter string that has to be mapped to an enum value from the table
tableEnum-Char table, from which the mapping is retrieved
Return values
resultThe enum_value for the enum_name string or -1 on failure

Definition at line 40 of file util-enum.c.

References SCEnumCharMap_::enum_name, SCEnumCharMap_::enum_value, and SCLogDebug.

Referenced by AppLayerGetPktEventInfo(), DetectEngineGetEventInfo(), and SCLogLoadConfig().

Here is the caller graph for this function:

◆ SCMapEnumValueToName()

const char* SCMapEnumValueToName ( int  enum_value,
SCEnumCharMap table 
)

Maps an enum value to a string name, from the supplied table.

Parameters
enum_valueEnum_value that has to be mapped to a string_value from the table
tableEnum-Char table, from which the mapping is retrieved
Return values
resultThe enum_name for the enum_value supplied or NULL on failure

Definition at line 68 of file util-enum.c.

References SCEnumCharMap_::enum_name, SCEnumCharMap_::enum_value, and SCLogDebug.

Referenced by AppLayerGetEventInfoById(), and SCRuleVarsGetConfVar().

Here is the caller graph for this function: