automotive-dlt
dlt_config_file_parser.h
Go to the documentation of this file.
1 /*
2  * @licence app begin@
3  * SPDX license identifier: MPL-2.0
4  *
5  * Copyright (C) 2015, Advanced Driver Information Technology
6  * This code is developed by Advanced Driver Information Technology.
7  * Copyright of Advanced Driver Information Technology, Bosch and DENSO.
8  *
9  * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
10  *
11  * This Source Code Form is subject to the terms of the
12  * Mozilla Public License (MPL), v. 2.0.
13  * If a copy of the MPL was not distributed with this file,
14  * You can obtain one at http://mozilla.org/MPL/2.0/.
15  *
16  * For further information see http://www.genivi.org/.
17  * @licence end@
18  */
19 
30 /*******************************************************************************
31 ** **
32 ** SRC-MODULE: dlt_config_file_parser.h **
33 ** **
34 ** TARGET : linux **
35 ** **
36 ** PROJECT : DLT **
37 ** **
38 ** AUTHOR : Christoph Lipka clipka@jp.adit-jv.com **
39 ** **
40 ** PURPOSE : **
41 ** **
42 ** REMARKS : **
43 ** **
44 ** PLATFORM DEPENDANT [yes/no]: yes **
45 ** **
46 ** TO BE CHANGED BY USER [yes/no]: no **
47 ** **
48 *******************************************************************************/
49 
50 /*******************************************************************************
51 ** Author Identity **
52 ********************************************************************************
53 ** **
54 ** Initials Name Company **
55 ** -------- ------------------------- ---------------------------------- **
56 ** cl Christoph Lipka ADIT **
57 *******************************************************************************/
58 
59 #ifndef _DLT_CONFIG_FILE_PARSER_H_
60 #define _DLT_CONFIG_FILE_PARSER_H_
61 
62 #include <search.h>
63 
64 /* definitions */
65 #define DLT_CONFIG_FILE_PATH_MAX_LEN 100 /* absolute path including filename */
66 #define DLT_CONFIG_FILE_ENTRY_MAX_LEN 100 /* Entry for section, key and value */
67 #define DLT_CONFIG_FILE_LINE_MAX_LEN 210
68 #define DLT_CONFIG_FILE_SECTIONS_MAX 100
69 #define DLT_CONFIG_FILE_KEYS_MAX 25 /* Maximal keys per section */
70 
71 /* Config file section structure */
72 typedef struct
73 {
74  int num_entries; /* number of entries */
75  char *name; /* name of section */
76  char *keys; /* keys */
77  struct hsearch_data data; /* hash table object used by hsearch_r */
79 
80 typedef struct
81 {
82  int num_sections; /* number of sections */
83  DltConfigFileSection *sections; /* sections */
85 
95 DltConfigFile *dlt_config_file_init(char *file_name);
96 
106 
118  int num,
119  char *name);
120 
130 int dlt_config_file_get_num_sections(const DltConfigFile *file, int *num);
131 
144  const char *section,
145  const char *key,
146  char *value);
147 #endif
DltConfigFile * dlt_config_file_init(char *file_name)
int dlt_config_file_get_num_sections(const DltConfigFile *file, int *num)
int dlt_config_file_get_section_name(const DltConfigFile *file, int num, char *name)
DltConfigFileSection * sections
static char data[kDataSize]
Definition: city-test.cc:40
void dlt_config_file_release(DltConfigFile *file)
int dlt_config_file_get_value(const DltConfigFile *file, const char *section, const char *key, char *value)