suricata
util-proto-name.c File Reference
#include "suricata-common.h"
#include "util-hash-string.h"
#include "util-proto-name.h"
#include "util-debug.h"
#include "util-unittest.h"
Include dependency graph for util-proto-name.c:

Go to the source code of this file.

Data Structures

struct  ProtoNameHashEntry_
 

Typedefs

typedef struct ProtoNameHashEntry_ ProtoNameHashEntry
 

Functions

void SCProtoNameInit (void)
 
void SCProtoNameRelease (void)
 
bool SCProtoNameValid (uint16_t proto)
 Function to check if the received protocol number is valid and do we have corresponding name entry for this number or not. More...
 
bool SCGetProtoByName (const char *protoname, uint8_t *proto_number)
 Function to return the protocol number for a named protocol. Note that protocol name aliases are honored. More...
 
void SCProtoNameRegisterTests (void)
 

Variables

const char * known_proto [256]
 
const char * proto_aliases [256]
 

Detailed Description

Author
Gurvinder Singh gurvi.nosp@m.nder.nosp@m.singh.nosp@m.dahi.nosp@m.ya@gm.nosp@m.ail..nosp@m.com

File to provide the protocol names based on protocol numbers defined by the IANA

Definition in file util-proto-name.c.

Typedef Documentation

◆ ProtoNameHashEntry

Function Documentation

◆ SCGetProtoByName()

bool SCGetProtoByName ( const char *  protoname,
uint8_t *  proto_number 
)

Function to return the protocol number for a named protocol. Note that protocol name aliases are honored.

Parameters
protonameProtocol name (or alias for a protocol name).
proto_numberWhere to return protocol number
Return values
retOn success returns the protocol number; else -1

Definition at line 467 of file util-proto-name.c.

References HashTableLookup(), and proto.

Here is the call graph for this function:

◆ SCProtoNameInit()

void SCProtoNameInit ( void  )

Definition at line 418 of file util-proto-name.c.

Referenced by GlobalsInitPreConfig().

Here is the caller graph for this function:

◆ SCProtoNameRegisterTests()

void SCProtoNameRegisterTests ( void  )

Definition at line 503 of file util-proto-name.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ SCProtoNameRelease()

void SCProtoNameRelease ( void  )

Definition at line 439 of file util-proto-name.c.

Referenced by GlobalsDestroy().

Here is the caller graph for this function:

◆ SCProtoNameValid()

bool SCProtoNameValid ( uint16_t  proto)

Function to check if the received protocol number is valid and do we have corresponding name entry for this number or not.

Parameters
protoProtocol number to be validated
Return values
retOn success returns true otherwise false

Definition at line 454 of file util-proto-name.c.

References known_proto, and proto.

Referenced by AlertFastLogger(), and JsonAddrInfoInit().

Here is the caller graph for this function:

Variable Documentation

◆ known_proto

const char* known_proto[256]

Lookup array to hold the information related to known protocol values

Definition at line 40 of file util-proto-name.c.

Referenced by AlertFastLogger(), JsonAddrInfoInit(), and SCProtoNameValid().

◆ proto_aliases

const char* proto_aliases[256]

Definition at line 197 of file util-proto-name.c.