Use AC_PROG_INSTALL & ./install-sh
[pgbouncer.git] / include / loader.h
blob5eea1f004574206304aa20eedceb5e13f715d6e0
1 /*
2 * PgBouncer - Lightweight connection pooler for PostgreSQL.
3 *
4 * Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* configuration parsing */
20 #define CF_INT {cf_get_int, cf_set_int}
21 #define CF_STR {cf_get_str, cf_set_str}
22 #define CF_TIME {cf_get_time, cf_set_time}
24 #define CF_SECT_VARS 1 /* senction contains pre-defined key-var pairs */
25 #define CF_SECT_DATA 2 /* key-val pairs are data */
27 typedef struct ConfElem ConfElem;
29 /* callback for CF_SECT_DATA loading */
30 typedef void (*conf_data_callback_fn)(char *key, char *value);
32 typedef const char * (*conf_var_get_fn)(ConfElem *elem);
33 typedef bool (*conf_var_set_fn)(ConfElem *elem, const char *value, PgSocket *console) _MUSTCHECK;
35 typedef struct {
36 conf_var_get_fn fn_get;
37 conf_var_set_fn fn_set;
38 } ConfAccess;
40 struct ConfElem {
41 const char *name;
42 bool reloadable;
43 ConfAccess io;
44 void *dst;
45 bool allocated;
48 typedef struct ConfSection {
49 const char *name;
50 ConfElem *elem_list;
51 conf_data_callback_fn data_fn;
52 } ConfSection;
54 bool iniparser(const char *fn, ConfSection *sect_list, bool reload) _MUSTCHECK;
56 const char * cf_get_int(ConfElem *elem);
57 bool cf_set_int(ConfElem *elem, const char *value, PgSocket *console);
59 const char * cf_get_time(ConfElem *elem);
60 bool cf_set_time(ConfElem *elem, const char *value, PgSocket *console);
62 const char *cf_get_str(ConfElem *elem);
63 bool cf_set_str(ConfElem *elem, const char *value, PgSocket *console);
65 const char *conf_to_text(ConfElem *elem);
66 bool set_config_param(ConfElem *elem_list, const char *key, const char *val, bool reload, PgSocket *console) /* _MUSTCHECK */;
68 /* connstring parsing */
69 void parse_database(char *name, char *connstr);
71 /* user file parsing */
72 bool load_auth_file(const char *fn) /* _MUSTCHECK */;
73 bool loader_users_check(void) /* _MUSTCHECK */;