2018-03-06 15:23:52 +00:00
|
|
|
#ifndef OD_CONFIG_H
|
|
|
|
#define OD_CONFIG_H
|
2017-05-24 11:57:15 +00:00
|
|
|
|
|
|
|
/*
|
2018-03-12 14:03:15 +00:00
|
|
|
* Odyssey.
|
2017-05-24 11:57:15 +00:00
|
|
|
*
|
2017-07-05 12:42:49 +00:00
|
|
|
* Advanced PostgreSQL connection pooler.
|
2017-05-24 11:57:15 +00:00
|
|
|
*/
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
typedef struct od_configstorage od_configstorage_t;
|
|
|
|
typedef struct od_configroute od_configroute_t;
|
|
|
|
typedef struct od_configlisten od_configlisten_t;
|
|
|
|
typedef struct od_config od_config_t;
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-06-22 12:29:39 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2017-07-28 13:11:52 +00:00
|
|
|
OD_STORAGETYPE_REMOTE,
|
|
|
|
OD_STORAGETYPE_LOCAL
|
2017-06-22 12:29:39 +00:00
|
|
|
} od_storagetype_t;
|
|
|
|
|
2017-05-24 11:57:15 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2017-07-28 13:13:05 +00:00
|
|
|
OD_POOLING_SESSION,
|
|
|
|
OD_POOLING_TRANSACTION
|
2017-05-24 11:57:15 +00:00
|
|
|
} od_pooling_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-07-28 13:14:21 +00:00
|
|
|
OD_AUTH_UNDEF,
|
|
|
|
OD_AUTH_NONE,
|
|
|
|
OD_AUTH_BLOCK,
|
|
|
|
OD_AUTH_CLEAR_TEXT,
|
2017-09-28 14:21:59 +00:00
|
|
|
OD_AUTH_MD5
|
2017-05-24 11:57:15 +00:00
|
|
|
} od_auth_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-07-28 13:16:46 +00:00
|
|
|
OD_TLS_DISABLE,
|
|
|
|
OD_TLS_ALLOW,
|
|
|
|
OD_TLS_REQUIRE,
|
|
|
|
OD_TLS_VERIFY_CA,
|
|
|
|
OD_TLS_VERIFY_FULL
|
2017-05-24 11:57:15 +00:00
|
|
|
} od_tls_t;
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
struct od_configstorage
|
2017-05-24 11:57:15 +00:00
|
|
|
{
|
2017-06-22 12:29:39 +00:00
|
|
|
char *name;
|
|
|
|
char *type;
|
|
|
|
od_storagetype_t storage_type;
|
|
|
|
char *host;
|
|
|
|
int port;
|
2017-07-28 13:19:53 +00:00
|
|
|
od_tls_t tls_mode;
|
2017-06-24 13:04:20 +00:00
|
|
|
char *tls;
|
2017-06-22 12:29:39 +00:00
|
|
|
char *tls_ca_file;
|
|
|
|
char *tls_key_file;
|
|
|
|
char *tls_cert_file;
|
|
|
|
char *tls_protocols;
|
|
|
|
od_list_t link;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
struct od_configroute
|
2017-05-24 11:57:15 +00:00
|
|
|
{
|
2017-07-21 14:29:01 +00:00
|
|
|
/* id */
|
|
|
|
char *db_name;
|
|
|
|
int db_name_len;
|
|
|
|
int db_is_default;
|
|
|
|
char *user_name;
|
|
|
|
int user_name_len;
|
|
|
|
int user_is_default;
|
2017-07-03 14:32:48 +00:00
|
|
|
/* auth */
|
|
|
|
char *auth;
|
|
|
|
od_auth_t auth_mode;
|
2017-09-25 14:10:44 +00:00
|
|
|
char *auth_query;
|
|
|
|
char *auth_query_db;
|
|
|
|
char *auth_query_user;
|
2017-07-21 14:29:01 +00:00
|
|
|
/* password */
|
|
|
|
char *password;
|
|
|
|
int password_len;
|
2017-07-03 14:32:48 +00:00
|
|
|
/* storage */
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configstorage_t *storage;
|
2017-07-03 14:32:48 +00:00
|
|
|
char *storage_name;
|
2017-07-03 11:33:03 +00:00
|
|
|
char *storage_db;
|
|
|
|
char *storage_user;
|
|
|
|
int storage_user_len;
|
|
|
|
char *storage_password;
|
|
|
|
int storage_password_len;
|
2017-07-03 14:32:48 +00:00
|
|
|
/* pool */
|
2017-07-03 10:56:47 +00:00
|
|
|
od_pooling_t pool;
|
2017-07-03 14:32:48 +00:00
|
|
|
char *pool_sz;
|
2017-06-21 12:18:48 +00:00
|
|
|
int pool_size;
|
|
|
|
int pool_timeout;
|
2017-06-21 13:08:33 +00:00
|
|
|
int pool_ttl;
|
2017-07-03 11:02:01 +00:00
|
|
|
int pool_cancel;
|
|
|
|
int pool_rollback;
|
2017-09-12 13:45:04 +00:00
|
|
|
/* misc */
|
|
|
|
int client_fwd_error;
|
2017-07-03 14:32:48 +00:00
|
|
|
int client_max_set;
|
|
|
|
int client_max;
|
2017-12-05 12:32:08 +00:00
|
|
|
int log_debug;
|
2017-06-21 12:18:48 +00:00
|
|
|
od_list_t link;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
struct od_configlisten
|
2017-08-28 13:59:41 +00:00
|
|
|
{
|
|
|
|
char *host;
|
|
|
|
int port;
|
|
|
|
int backlog;
|
|
|
|
od_tls_t tls_mode;
|
|
|
|
char *tls;
|
|
|
|
char *tls_ca_file;
|
|
|
|
char *tls_key_file;
|
|
|
|
char *tls_cert_file;
|
|
|
|
char *tls_protocols;
|
|
|
|
od_list_t link;
|
|
|
|
};
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
struct od_config
|
2017-05-24 11:57:15 +00:00
|
|
|
{
|
|
|
|
/* main */
|
2017-09-21 13:44:19 +00:00
|
|
|
int daemonize;
|
|
|
|
int log_to_stdout;
|
|
|
|
int log_debug;
|
|
|
|
int log_config;
|
|
|
|
int log_session;
|
2017-10-26 12:54:32 +00:00
|
|
|
int log_query;
|
2017-09-21 13:44:19 +00:00
|
|
|
char *log_file;
|
|
|
|
char *log_format;
|
|
|
|
int log_stats;
|
|
|
|
int log_syslog;
|
|
|
|
char *log_syslog_ident;
|
|
|
|
char *log_syslog_facility;
|
|
|
|
int stats_interval;
|
|
|
|
char *pid_file;
|
|
|
|
int readahead;
|
|
|
|
int nodelay;
|
|
|
|
int keepalive;
|
|
|
|
int workers;
|
2018-02-26 14:29:10 +00:00
|
|
|
int resolvers;
|
2017-09-21 13:44:19 +00:00
|
|
|
int client_max_set;
|
|
|
|
int client_max;
|
2018-02-14 11:55:38 +00:00
|
|
|
int cache;
|
|
|
|
int cache_chunk;
|
2018-02-26 14:34:06 +00:00
|
|
|
int cache_coroutine;
|
2018-02-27 15:38:53 +00:00
|
|
|
int pipeline;
|
2017-07-21 14:29:01 +00:00
|
|
|
/* temprorary storages */
|
2017-09-21 13:44:19 +00:00
|
|
|
od_list_t storages;
|
2017-07-21 14:29:01 +00:00
|
|
|
/* routes */
|
2017-09-21 13:44:19 +00:00
|
|
|
od_list_t routes;
|
2017-08-28 13:59:41 +00:00
|
|
|
/* listen servers */
|
2017-09-21 13:44:19 +00:00
|
|
|
od_list_t listen;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
void od_config_init(od_config_t*);
|
|
|
|
void od_config_free(od_config_t*);
|
|
|
|
int od_config_validate(od_config_t*, od_logger_t*);
|
|
|
|
void od_config_print(od_config_t*, od_logger_t*, int);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configlisten_t*
|
|
|
|
od_configlisten_add(od_config_t*);
|
2017-08-28 13:59:41 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configstorage_t*
|
|
|
|
od_configstorage_add(od_config_t*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configstorage_t*
|
|
|
|
od_configstorage_copy(od_configstorage_t*);
|
2018-02-22 13:43:52 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configstorage_t*
|
|
|
|
od_configstorage_match(od_config_t*, char*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
void od_configstorage_free(od_configstorage_t*);
|
2018-02-22 13:43:52 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configroute_t*
|
2018-03-21 14:36:57 +00:00
|
|
|
od_configroute_add(od_config_t*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
void od_configroute_free(od_configroute_t*);
|
2017-07-17 13:25:43 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configroute_t*
|
|
|
|
od_configroute_forward(od_config_t*, char*, char*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configroute_t*
|
|
|
|
od_configroute_match(od_config_t*, char*, char*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2018-03-06 15:23:52 +00:00
|
|
|
#endif /* OD_CONFIG_H */
|