suricata
conf-yaml-loader.c File Reference
#include <yaml.h>
#include "suricata-common.h"
#include "conf.h"
#include "conf-yaml-loader.h"
#include "util-path.h"
#include "util-debug.h"
#include "util-unittest.h"
Include dependency graph for conf-yaml-loader.c:

Go to the source code of this file.

Macros

#define YAML_VERSION_MAJOR   1
 
#define YAML_VERSION_MINOR   1
 
#define DEFAULT_NAME_LEN   16
 
#define MANGLE_ERRORS_MAX   10
 

Enumerations

enum  conf_state { CONF_KEY = 0, CONF_VAL, CONF_INCLUDE }
 

Functions

int ConfYamlLoadFile (const char *filename)
 Load configuration from a YAML file. More...
 
int ConfYamlLoadString (const char *string, size_t len)
 Load configuration from a YAML string. More...
 
int ConfYamlLoadFileWithPrefix (const char *filename, const char *prefix)
 Load configuration from a YAML file, insert in tree at 'prefix'. More...
 
void ConfYamlRegisterTests (void)
 

Detailed Description

Author
Endace Technology Limited - Jason Ish jason.nosp@m..ish.nosp@m.@enda.nosp@m.ce.c.nosp@m.om

YAML configuration loader.

Definition in file conf-yaml-loader.c.

Macro Definition Documentation

#define DEFAULT_NAME_LEN   16

Definition at line 40 of file conf-yaml-loader.c.

#define MANGLE_ERRORS_MAX   10

Definition at line 42 of file conf-yaml-loader.c.

#define YAML_VERSION_MAJOR   1

Definition at line 34 of file conf-yaml-loader.c.

#define YAML_VERSION_MINOR   1

Definition at line 35 of file conf-yaml-loader.c.

Enumeration Type Documentation

enum conf_state
Enumerator
CONF_KEY 
CONF_VAL 
CONF_INCLUDE 

Definition at line 50 of file conf-yaml-loader.c.

Function Documentation

int ConfYamlLoadFile ( const char *  filename)

Load configuration from a YAML file.

This function will load a configuration file. On failure -1 will be returned and it is suggested that the program then exit. Any errors while loading the configuration file will have already been logged.

Parameters
filenameFilename of configuration file to load.
Return values
0on success, -1 on failure.

Definition at line 404 of file conf-yaml-loader.c.

References ConfGetRootNode(), SC_ERR_FATAL, and SCLogError.

Referenced by ConfYamlLoadFileWithPrefix(), ListAppLayerProtocols(), and RegisterAllModules().

Here is the call graph for this function:

Here is the caller graph for this function:

int ConfYamlLoadFileWithPrefix ( const char *  filename,
const char *  prefix 
)

Load configuration from a YAML file, insert in tree at 'prefix'.

This function will load a configuration file and insert it into the config tree at 'prefix'. This means that if this is called with prefix "abc" and the file contains a parameter "def", it will be loaded as "abc.def".

Parameters
filenameFilename of configuration file to load.
prefixName prefix to use.
Return values
0on success, -1 on failure.

Definition at line 482 of file conf-yaml-loader.c.

References ConfCreateContextBackup(), ConfDeInit(), ConfGet(), ConfGetNode(), ConfInit(), ConfNodeIsSequence(), ConfNodeLookupChild(), ConfRestoreContextBackup(), ConfSet(), ConfSetFinal(), ConfYamlLoadFile(), ConfYamlLoadString(), ConfNode_::is_seq, ConfNode_::name, next, SC_ERR_FATAL, SCFree, SCLogError, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_NEXT, and ConfNode_::val.

Referenced by DetectEngineMultiTenantEnabled(), DetectEngineMultiTenantSetup(), DetectEngineReload(), and UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

int ConfYamlLoadString ( const char *  string,
size_t  len 
)

Load configuration from a YAML string.

Definition at line 451 of file conf-yaml-loader.c.

References ConfGetRootNode().

Referenced by ActionInitConfig(), ConfYamlLoadFileWithPrefix(), DetectEngineGetEventInfo(), HtpConfigRestoreBackup(), SCHInfoLoadFromConfig(), and SCRuleVarsGetConfVar().

Here is the call graph for this function:

Here is the caller graph for this function:

void ConfYamlRegisterTests ( void  )

Definition at line 956 of file conf-yaml-loader.c.

References UtRegisterTest().

Here is the call graph for this function: