00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _ASTERISK_CONFIG_H
00024 #define _ASTERISK_CONFIG_H
00025
00026 #if defined(__cplusplus) || defined(c_plusplus)
00027 extern "C" {
00028 #endif
00029
00030 #include <stdarg.h>
00031
00032 struct ast_config;
00033
00034 struct ast_category;
00035
00036 struct ast_variable {
00037 char *name;
00038 char *value;
00039 int lineno;
00040 int object;
00041 int blanklines;
00042 struct ast_comment *precomments;
00043 struct ast_comment *sameline;
00044 struct ast_variable *next;
00045 char stuff[0];
00046 };
00047
00048 typedef struct ast_config *config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, int withcomments);
00049 typedef struct ast_variable *realtime_var_get(const char *database, const char *table, va_list ap);
00050 typedef struct ast_config *realtime_multi_get(const char *database, const char *table, va_list ap);
00051 typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
00052
00053 struct ast_config_engine {
00054 char *name;
00055 config_load_func *load_func;
00056 realtime_var_get *realtime_func;
00057 realtime_multi_get *realtime_multi_func;
00058 realtime_update *update_func;
00059 struct ast_config_engine *next;
00060 };
00061
00062
00063
00064
00065
00066
00067
00068 struct ast_config *ast_config_load(const char *filename);
00069 struct ast_config *ast_config_load_with_comments(const char *filename);
00070
00071
00072
00073
00074
00075
00076 void ast_config_destroy(struct ast_config *config);
00077
00078
00079
00080
00081
00082
00083
00084
00085 char *ast_category_browse(struct ast_config *config, const char *prev);
00086
00087
00088
00089
00090
00091
00092
00093 struct ast_variable *ast_variable_browse(const struct ast_config *config, const char *category);
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 const char *ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable);
00104
00105
00106
00107
00108
00109
00110
00111
00112 struct ast_category *ast_category_get(const struct ast_config *config, const char *category_name);
00113
00114
00115
00116
00117
00118
00119
00120
00121 int ast_category_exist(const struct ast_config *config, const char *category_name);
00122
00123
00124
00125
00126
00127
00128
00129
00130 struct ast_variable *ast_load_realtime(const char *family, ...);
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 struct ast_config *ast_load_realtime_multientry(const char *family, ...);
00141
00142
00143
00144
00145
00146
00147
00148
00149 int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...);
00150
00151
00152
00153
00154
00155 int ast_check_realtime(const char *family);
00156
00157
00158
00159
00160
00161 void ast_variables_destroy(struct ast_variable *var);
00162
00163
00164 int ast_config_engine_register(struct ast_config_engine *newconfig);
00165
00166
00167 int ast_config_engine_deregister(struct ast_config_engine *del);
00168
00169 int register_config_cli(void);
00170 int read_config_maps(void);
00171
00172 struct ast_config *ast_config_new(void);
00173 struct ast_category *ast_config_get_current_category(const struct ast_config *cfg);
00174 void ast_config_set_current_category(struct ast_config *cfg, const struct ast_category *cat);
00175 const char *ast_config_option(struct ast_config *cfg, const char *cat, const char *var);
00176
00177 struct ast_category *ast_category_new(const char *name);
00178 void ast_category_append(struct ast_config *config, struct ast_category *cat);
00179 int ast_category_delete(struct ast_config *cfg, char *category);
00180 void ast_category_destroy(struct ast_category *cat);
00181 struct ast_variable *ast_category_detach_variables(struct ast_category *cat);
00182 void ast_category_rename(struct ast_category *cat, const char *name);
00183
00184 struct ast_variable *ast_variable_new(const char *name, const char *value);
00185 void ast_variable_append(struct ast_category *category, struct ast_variable *variable);
00186 int ast_variable_delete(struct ast_category *category, char *variable, char *match);
00187 int ast_variable_update(struct ast_category *category, const char *variable,
00188 const char *value, const char *match, unsigned int object);
00189
00190 int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator);
00191
00192 struct ast_config *ast_config_internal_load(const char *configfile, struct ast_config *cfg, int withcomments);
00193
00194 #if defined(__cplusplus) || defined(c_plusplus)
00195 }
00196 #endif
00197
00198 #endif