automotive-dlt
dlt_config_file_parser.h File Reference
#include <search.h>
Include dependency graph for dlt_config_file_parser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DltConfigFileSection
 
struct  DltConfigFile
 

Macros

#define DLT_CONFIG_FILE_PATH_MAX_LEN   100 /* absolute path including filename */
 
#define DLT_CONFIG_FILE_ENTRY_MAX_LEN   100 /* Entry for section, key and value */
 
#define DLT_CONFIG_FILE_LINE_MAX_LEN   210
 
#define DLT_CONFIG_FILE_SECTIONS_MAX   100
 
#define DLT_CONFIG_FILE_KEYS_MAX   25 /* Maximal keys per section */
 

Functions

DltConfigFiledlt_config_file_init (char *file_name)
 
void dlt_config_file_release (DltConfigFile *file)
 
int dlt_config_file_get_section_name (const DltConfigFile *file, int num, char *name)
 
int dlt_config_file_get_num_sections (const DltConfigFile *file, int *num)
 
int dlt_config_file_get_value (const DltConfigFile *file, const char *section, const char *key, char *value)
 

Detailed Description

Author
Christoph Lipka clipk.nosp@m.a@jp.nosp@m..adit.nosp@m.-jv..nosp@m.com

Definition in file dlt_config_file_parser.h.

Macro Definition Documentation

#define DLT_CONFIG_FILE_KEYS_MAX   25 /* Maximal keys per section */
#define DLT_CONFIG_FILE_LINE_MAX_LEN   210

Definition at line 67 of file dlt_config_file_parser.h.

Referenced by dlt_config_file_read_file().

#define DLT_CONFIG_FILE_PATH_MAX_LEN   100 /* absolute path including filename */

Definition at line 65 of file dlt_config_file_parser.h.

Referenced by dlt_config_file_init().

#define DLT_CONFIG_FILE_SECTIONS_MAX   100

Definition at line 68 of file dlt_config_file_parser.h.

Referenced by dlt_config_file_init(), and dlt_config_file_set_section().

Function Documentation

int dlt_config_file_get_num_sections ( const DltConfigFile file,
int *  num 
)

dlt_config_file_get_num_sections

Get the number of sections inside configuration file

Parameters
[in]fileDltConfigFile
[out]numNumber of sections inside configuration file
Returns
0 on success, else -1

Definition at line 524 of file dlt_config_file_parser.c.

References NULL, and DltConfigFile::num_sections.

Referenced by dlt_gateway_configure(), and dlt_logstorage_store_filters().

int dlt_config_file_get_section_name ( const DltConfigFile file,
int  num,
char *  name 
)

dlt_config_file_get_section_name

Get name of section number.

Parameters
[in]fileDltConfigFile
[in]numNumber of section
[out]sectionSection name
Returns
0 on success, else -1

Definition at line 512 of file dlt_config_file_parser.c.

References DLT_CONFIG_FILE_ENTRY_MAX_LEN, NULL, DltConfigFile::num_sections, and DltConfigFile::sections.

Referenced by dlt_gateway_configure(), and dlt_logstorage_store_filters().

int dlt_config_file_get_value ( const DltConfigFile file,
const char *  section,
const char *  key,
char *  value 
)

dlt_config_file_get_value

Get value of key in specified section.

Parameters
[in]fileDltConfigFile
[in]sectionName of section
[in]keyKey
[out]valueValue
Returns
0 on success, else -1

Definition at line 534 of file dlt_config_file_parser.c.

References DltConfigFileSection::data, DLT_CONFIG_FILE_ENTRY_MAX_LEN, dlt_config_file_find_section(), dlt_log(), NULL, and DltConfigFile::sections.

Referenced by dlt_daemon_setup_filter_properties(), and dlt_gateway_configure().

DltConfigFile* dlt_config_file_init ( char *  file_name)

dlt_config_file_init

Load the configuration file and stores all data in internal data structures.

Parameters
file_nameFile to be opened
Returns
Pointer to DltConfigFile object or NULL on error

Definition at line 441 of file dlt_config_file_parser.c.

References DLT_CONFIG_FILE_PATH_MAX_LEN, dlt_config_file_read_file(), DLT_CONFIG_FILE_SECTIONS_MAX, dlt_log(), NULL, and DltConfigFile::sections.

Referenced by dlt_gateway_configure(), and dlt_logstorage_store_filters().

void dlt_config_file_release ( DltConfigFile file)

dlt_config_file_release

Release config file and frees all internal data. Has to be called after after all data is read.

Parameters
fileDltConfigFile

Definition at line 477 of file dlt_config_file_parser.c.

References DltConfigFileSection::data, DLT_CONFIG_FILE_ENTRY_MAX_LEN, DltConfigFileSection::keys, DltConfigFileSection::name, NULL, DltConfigFileSection::num_entries, DltConfigFile::num_sections, and DltConfigFile::sections.

Referenced by dlt_gateway_configure(), and dlt_logstorage_store_filters().