Defines | Enumerations | Functions

cfg_parser.c File Reference

SIP-router core ::Module: SIP-router core. More...

#include "cfg_parser.h"
#include "mem/mem.h"
#include "mem/shm_mem.h"
#include "dprint.h"
#include "trim.h"
#include "ut.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <libgen.h>
Include dependency graph for cfg_parser.c:

Go to the source code of this file.

Defines

Enumerations

Functions


Detailed Description

See ConfigEngine

Definition in file cfg_parser.c.


Enumeration Type Documentation

enum st
Enumerator:
ST_S 

Begin.

ST_A 

Alphanumeric.

ST_AE 

Alphanumeric escaped.

ST_Q 

Quoted.

ST_QE 

Quoted escaped.

ST_C 

Comment.

ST_CE 

Comment escaped.

ST_E 

Escaped.

Definition at line 169 of file cfg_parser.c.


Function Documentation

int cfg_get_token ( struct cfg_token token,
struct cfg_parser st,
unsigned int  flags 
)

Interface to the lexical scanner

Definition at line 311 of file cfg_parser.c.

References CFG_EXTENDED_ALPHA, cfg_parser::col, cfg_parser::file, IS_ALPHA, IS_DELIM, IS_WHITESPACE, _str::len, cfg_parser::line, PUSH, RETURN, _str::s, ST_A, ST_AE, ST_C, ST_CE, ST_E, ST_Q, ST_QE, ST_S, and cfg_token::val.

Referenced by cfg_parse_section().

Here is the caller graph for this function:

int cfg_parse_section ( void *  param,
struct cfg_parser st,
unsigned int  flags 
)

The function expects parameter param to be of type (str*). The result string is allocated using pkg_malloc and is zero terminated. To free the memory use pkg_free(((str*)param)->s)

Definition at line 539 of file cfg_parser.c.

References cfg_get_token(), CFG_STR_MALLOC, CFG_STR_PKGMEM, CFG_STR_SHMMEM, cfg_token::col, cfg_parser::col, cfg_parser::file, cfg_token::line, cfg_parser::line, and cfg_token::type.

Here is the call graph for this function:

cfg_parser_t* cfg_parser_init ( str basedir,
str filename 
) [read]
Parameters:
basedir - path to the config file name. If 0 the path (base directory) of the main ser.cfg file will be used, else basedir will be concatenated to the filename. It will be used only if filename is not an absolute path.
filename - config filename (can include path elements).
Returns:
0 on error, !=0 on success.

Definition at line 624 of file cfg_parser.c.

References cfg_parser::col, cfg_parser::f, cfg_parser::file, get_abs_pathname(), _str::len, cfg_parser::line, _str::s, and STR_FMT.

Here is the call graph for this function: