libini_config  0.2.91
 All Data Structures Functions Groups Pages
ini_config_priv.h
1 /*
2  INI LIBRARY
3 
4  Header for the internal structures used by INI interface.
5 
6  Copyright (C) Dmitri Pal <dpal@redhat.com> 2010
7 
8  INI Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  INI Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with INI Library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef INI_CONFIG_PRIV_H
23 #define INI_CONFIG_PRIV_H
24 
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #include "collection.h"
29 
30 /* Configuration object */
31 struct ini_cfgobj {
32  /* For now just a collection */
33  struct collection_item *cfg;
34  /* Boundary */
35  uint32_t boundary;
36  /*... */
37  /* Statistics? Timestamps? When created? Modified? - TBD */
38  /*... */
39 };
40 
41 
42 /* Configuration file object */
43 struct ini_cfgfile {
44  /***********************************/
45  /* Externally controlled variables */
46  /***********************************/
47  /* File name for the configuration file */
48  char *filename;
49  /* File stream */
50  FILE *file;
51  /* Error level */
52  int error_level;
53  /* Collision flags - define how to merge things */
54  uint32_t collision_flags;
55  /* What meta data to collect */
56  uint32_t metadata_flags;
57  /**********************/
58  /* Internal variables */
59  /**********************/
60  /* Collection of errors detected during parsing */
61  struct collection_item *error_list;
62  /* File stats */
63  struct stat file_stats;
64  /* Count of error lines */
65  unsigned count;
66 };
67 
68 /* Parsing error */
69 struct ini_parse_error {
70  unsigned line;
71  int error;
72 };
73 
74 /* Internal cleanup callback */
75 void ini_cleanup_cb(const char *property,
76  int property_len,
77  int type,
78  void *data,
79  int length,
80  void *custom_data);
81 
82 /* Get parsing error */
83 const char *ini_get_error_str(int parsing_error, int family);
84 
85 /* Check if collision flags are valid */
86 int valid_collision_flags(uint32_t collision_flags);
87 
88 /* Empty section */
89 int empty_section(struct collection_item *sec);
90 
91 
92 
93 #endif