8#ifndef __N_CONFIG_FILE__
9#define __N_CONFIG_FILE__
25#define MAX_CONFIG_LINE_LEN 1024
27#define CONFIG_SECTION_HASH_TABLE_LEN 16
55#define config_foreach(__config, __section_name, __key, __val) \
56 if (!__config || !__config->sections) { \
57 n_log(LOG_ERR, "No config file for %s", #__config); \
59 list_foreach(listnode, __config->sections) { \
60 CONFIG_FILE_SECTION* __section = (CONFIG_FILE_SECTION*)listnode->ptr; \
61 __section_name = __section->section_name; \
62 ht_foreach(entry, __section->entries) { \
63 HASH_NODE* htnode = (HASH_NODE*)entry->ptr; \
64 if (htnode && htnode->data.ptr) { \
65 __key = htnode->key; \
66 __val = htnode->data.ptr;
69#define config_endfor \
CONFIG_FILE * load_config_file(char *filename, int *errors)
load a config file
int write_config_file(CONFIG_FILE *cfg_file, char *filename)
write a config file
size_t get_nb_config_file_sections_entries(CONFIG_FILE *cfg_file, char *section_name, size_t section_position, char *entry)
Get the number of config file with section_name.
int destroy_config_file(CONFIG_FILE **cfg_file)
Destroy a loaded config file.
char * get_config_section_value(CONFIG_FILE *cfg_file, char *section_name, size_t section_position, char *entry, size_t entry_position)
Function to parse sections and get entries values.
size_t get_nb_config_file_sections(CONFIG_FILE *cfg_file, char *section_name)
Get the number of config file with section_name.
Structure of a config file.
Structure of a config section.
structure of a hash table
Structure of a generic LIST container.
Hash functions and table.
N_STR and string function declaration.