2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
23 #define DEFAULT_CONFIG_FILE "./prox.cfg"
25 /* configuration file line parser procedure */
26 typedef int (*cfg_parser)(unsigned sindex, char *str, void *data);
28 #define CFG_INDEXED 0x80000000 /* section contains index [name #] */
32 const char *name; /* section name without [] */
33 cfg_parser parser; /* section parser function */
34 void *data; /* data to be passed to the parser */
35 /* set by parsing procedure */
36 unsigned indexp[MAX_INDEX];
37 int raw_lines; /* if set, do not remove text after ';' */
42 #define MAX_CFG_STRING_LEN (3 * MAX_PKT_SIZE)
43 #define STRING_TERMINATOR_LEN 4
50 /* set in case of any error */
54 char cur_line[MAX_CFG_STRING_LEN + STRING_TERMINATOR_LEN];
57 struct cfg_file *cfg_open(const char *cfg_name);
58 int cfg_parse(struct cfg_file *pcfg, struct cfg_section *psec);
59 int cfg_close(struct cfg_file *pcfg);
61 #endif /* _CFGFILE_H_ */