suricata
|
#include "detect.h"
Go to the source code of this file.
Data Structures | |
struct | SCRConfReference_ |
Holds a reference from the file - reference.config. More... | |
Macros | |
#define | REFERENCE_SYSTEM_NAME_MAX 64 |
#define | REFERENCE_CONTENT_NAME_MAX 1024 |
Typedefs | |
typedef struct SCRConfReference_ | SCRConfReference |
Holds a reference from the file - reference.config. More... | |
Functions | |
SCRConfReference * | SCRConfAllocSCRConfReference (const char *, const char *) |
Returns a new SCRConfReference instance. The reference string is converted into lowercase, before being assigned to the instance. More... | |
void | SCRConfDeAllocSCRConfReference (SCRConfReference *) |
Frees a SCRConfReference instance. More... | |
int | SCRConfLoadReferenceConfigFile (DetectEngineCtx *, FILE *) |
Loads the Reference info from the reference.config file. More... | |
void | SCRConfDeInitContext (DetectEngineCtx *) |
Releases de_ctx resources related to Reference Config API. More... | |
SCRConfReference * | SCRConfGetReference (const char *, DetectEngineCtx *) |
Gets the reference config from the corresponding hash table stored in the Detection Engine Context's reference conf ht, given the reference name. More... | |
int | SCRConfAddReference (DetectEngineCtx *de_ctx, const char *line) |
Parses a line from the reference config file and adds it to Reference Config hash table DetectEngineCtx->reference_conf_ht. More... | |
void | SCRConfRegisterTests (void) |
This function registers unit tests for Reference Config API. More... | |
FILE * | SCRConfGenerateValidDummyReferenceConfigFD01 (void) |
Creates a dummy reference config, with all valid references, for testing purposes. More... | |
FILE * | SCRConfGenerateInValidDummyReferenceConfigFD02 (void) |
Creates a dummy reference config, with some valid references and a couple of invalid references, for testing purposes. More... | |
FILE * | SCRConfGenerateInValidDummyReferenceConfigFD03 (void) |
Creates a dummy reference config, with all invalid references, for testing purposes. More... | |
void | SCReferenceConfInit (void) |
void | SCReferenceConfDeinit (void) |
Definition in file util-reference-config.h.
#define REFERENCE_CONTENT_NAME_MAX 1024 |
Definition at line 31 of file util-reference-config.h.
#define REFERENCE_SYSTEM_NAME_MAX 64 |
Definition at line 30 of file util-reference-config.h.
typedef struct SCRConfReference_ SCRConfReference |
Holds a reference from the file - reference.config.
int SCRConfAddReference | ( | DetectEngineCtx * | de_ctx, |
const char * | line | ||
) |
Parses a line from the reference config file and adds it to Reference Config hash table DetectEngineCtx->reference_conf_ht.
rawstr | Pointer to the string to be parsed. |
de_ctx | Pointer to the Detection Engine Context. |
0 | On success. |
-1 | On failure. |
Definition at line 228 of file util-reference-config.c.
References REFERENCE_CONTENT_NAME_MAX, and REFERENCE_SYSTEM_NAME_MAX.
SCRConfReference* SCRConfAllocSCRConfReference | ( | const char * | system, |
const char * | url | ||
) |
Returns a new SCRConfReference instance. The reference string is converted into lowercase, before being assigned to the instance.
system | Pointer to the system. |
url | Pointer to the reference url. |
ref | Pointer to the new instance of SCRConfReference. |
Definition at line 352 of file util-reference-config.c.
References SCLogError, SCMalloc, and SCRConfReference_::system.
Referenced by SCRConfGetReference().
void SCRConfDeAllocSCRConfReference | ( | SCRConfReference * | ref | ) |
Frees a SCRConfReference instance.
Pointer | to the SCRConfReference instance that has to be freed. |
Definition at line 386 of file util-reference-config.c.
References SCFree, SCRConfReference_::system, and SCRConfReference_::url.
Referenced by SCRConfGetReference(), and SCRConfReferenceHashFree().
void SCRConfDeInitContext | ( | DetectEngineCtx * | ) |
Releases de_ctx resources related to Reference Config API.
Definition at line 185 of file util-reference-config.c.
References de_ctx, HashTableFree(), and DetectEngineCtx_::reference_conf_ht.
Referenced by DetectEngineCtxFree().
FILE* SCRConfGenerateInValidDummyReferenceConfigFD02 | ( | void | ) |
Creates a dummy reference config, with some valid references and a couple of invalid references, for testing purposes.
Definition at line 564 of file util-reference-config.c.
References SCFmemopen, and SCLogDebug.
FILE* SCRConfGenerateInValidDummyReferenceConfigFD03 | ( | void | ) |
Creates a dummy reference config, with all invalid references, for testing purposes.
Definition at line 584 of file util-reference-config.c.
References SCFmemopen, and SCLogDebug.
FILE* SCRConfGenerateValidDummyReferenceConfigFD01 | ( | void | ) |
Creates a dummy reference config, with all valid references, for testing purposes.
Definition at line 544 of file util-reference-config.c.
References SCFmemopen, and SCLogDebug.
SCRConfReference* SCRConfGetReference | ( | const char * | rconf_name, |
DetectEngineCtx * | de_ctx | ||
) |
Gets the reference config from the corresponding hash table stored in the Detection Engine Context's reference conf ht, given the reference name.
ct_name | Pointer to the reference name that has to be looked up. |
de_ctx | Pointer to the Detection Engine Context. |
lookup_rconf_info | Pointer to the SCRConfReference instance from the hash table on success; NULL on failure. |
Definition at line 522 of file util-reference-config.c.
References de_ctx, HashTableLookup(), DetectEngineCtx_::reference_conf_ht, SCRConfAllocSCRConfReference(), and SCRConfDeAllocSCRConfReference().
int SCRConfLoadReferenceConfigFile | ( | DetectEngineCtx * | de_ctx, |
FILE * | fd | ||
) |
Loads the Reference info from the reference.config file.
The reference.config file contains references that can be used in Signatures. Each line of the file should have the following format - config reference: system_name, reference_url.
de_ctx | Pointer to the Detection Engine Context that should be updated with reference information. |
0 | On success. |
-1 | On failure. |
Definition at line 491 of file util-reference-config.c.
void SCRConfRegisterTests | ( | void | ) |
This function registers unit tests for Reference Config API.
Definition at line 781 of file util-reference-config.c.
References UtRegisterTest().
void SCReferenceConfDeinit | ( | void | ) |
Definition at line 76 of file util-reference-config.c.
void SCReferenceConfInit | ( | void | ) |
Definition at line 56 of file util-reference-config.c.
Referenced by LLVMFuzzerTestOneInput(), PostConfLoadedDetectSetup(), and RunUnittests().