| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
#include "simplebuffer.h" |
| 30 |
#include "ini_comment.h" |
| 31 |
|
| 32 |
|
| 33 |
struct ini_cfgobj { |
| 34 |
|
| 35 |
struct collection_item *cfg; |
| 36 |
|
| 37 |
uint32_t boundary; |
| 38 |
|
| 39 |
struct ini_comment *last_comment; |
| 40 |
|
| 41 |
char *section; |
| 42 |
char *name; |
| 43 |
int section_len; |
| 44 |
int name_len; |
| 45 |
struct collection_iterator *iterator; |
| 46 |
|
| 47 |
struct collection_item *error_list; |
| 48 |
|
| 49 |
unsigned count; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
}; |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
struct ini_cfgfile { |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
char *filename; |
| 64 |
|
| 65 |
FILE *file; |
| 66 |
|
| 67 |
uint32_t metadata_flags; |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
struct stat file_stats; |
| 73 |
|
| 74 |
int stats_read; |
| 75 |
|
| 76 |
struct simplebuffer *file_data; |
| 77 |
|
| 78 |
enum index_utf_t bom; |
| 79 |
}; |
| 80 |
|
| 81 |
|
| 82 |
struct ini_parse_error { |
| 83 |
unsigned line; |
| 84 |
int error; |
| 85 |
}; |
| 86 |
|
| 87 |
|
| 88 |
void ini_cleanup_cb(const char *property, |
| 89 |
int property_len, |
| 90 |
int type, |
| 91 |
void *data, |
| 92 |
int length, |
| 93 |
void *custom_data); |
| 94 |
|
| 95 |
|
| 96 |
const char *ini_get_error_str(int parsing_error, int family); |
| 97 |
|
| 98 |
|
| 99 |
int valid_collision_flags(uint32_t collision_flags); |
| 100 |
|
| 101 |
|
| 102 |
int empty_section(struct collection_item *sec); |
| 103 |
|
| 104 |
|
| 105 |
int access_check_int(struct stat *file_stats, |
| 106 |
uint32_t flags, |
| 107 |
uid_t uid, |
| 108 |
gid_t gid, |
| 109 |
mode_t mode, |
| 110 |
mode_t mask); |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
int ini_config_serialize(struct ini_cfgobj *ini_config, |
| 127 |
struct simplebuffer *sbobj); |
| 128 |
|
| 129 |
|
| 130 |
int value_serialize(struct value_obj *vo, |
| 131 |
const char *key, |
| 132 |
struct simplebuffer *sbobj); |
| 133 |
|
| 134 |
|
| 135 |
int ini_comment_serialize(struct ini_comment *ic, |
| 136 |
struct simplebuffer *sbobj); |
| 137 |
|
| 138 |
struct ini_errmsg; |
| 139 |
|
| 140 |
struct ini_errobj { |
| 141 |
size_t count; |
| 142 |
struct ini_errmsg *first_msg; |
| 143 |
struct ini_errmsg *last_msg; |
| 144 |
struct ini_errmsg *cur_msg; |
| 145 |
}; |
| 146 |
|
| 147 |
struct ini_errmsg { |
| 148 |
char *str; |
| 149 |
struct ini_errmsg *next; |
| 150 |
}; |
| 151 |
|
| 152 |
#endif |