2017-05-24 11:57:15 +00:00
|
|
|
#ifndef OD_SCHEME_H
|
|
|
|
#define OD_SCHEME_H
|
|
|
|
|
|
|
|
/*
|
2017-07-05 12:42:49 +00:00
|
|
|
* Odissey.
|
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
|
|
|
*/
|
|
|
|
|
2017-06-21 12:18:48 +00:00
|
|
|
typedef struct od_schemestorage od_schemestorage_t;
|
2017-07-03 14:32:48 +00:00
|
|
|
typedef struct od_schemedb od_schemedb_t;
|
2017-06-21 12:18:48 +00:00
|
|
|
typedef struct od_schemeuser od_schemeuser_t;
|
|
|
|
typedef struct od_scheme od_scheme_t;
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-06-22 12:29:39 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
OD_SREMOTE,
|
|
|
|
OD_SLOCAL
|
|
|
|
} od_storagetype_t;
|
|
|
|
|
2017-05-24 11:57:15 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
OD_PSESSION,
|
|
|
|
OD_PTRANSACTION
|
|
|
|
} od_pooling_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
OD_AUNDEF,
|
2017-07-04 12:12:07 +00:00
|
|
|
OD_ABLOCK,
|
2017-05-24 11:57:15 +00:00
|
|
|
OD_ANONE,
|
|
|
|
OD_ACLEAR_TEXT,
|
|
|
|
OD_AMD5
|
|
|
|
} od_auth_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
OD_TDISABLE,
|
|
|
|
OD_TALLOW,
|
|
|
|
OD_TREQUIRE,
|
|
|
|
OD_TVERIFY_CA,
|
|
|
|
OD_TVERIFY_FULL
|
|
|
|
} od_tls_t;
|
|
|
|
|
2017-06-21 12:18:48 +00:00
|
|
|
struct od_schemestorage
|
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;
|
|
|
|
od_tls_t tls_verify;
|
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;
|
|
|
|
int is_default;
|
2017-07-13 12:13:55 +00:00
|
|
|
int refs;
|
2017-07-14 13:40:31 +00:00
|
|
|
int version;
|
2017-06-22 12:29:39 +00:00
|
|
|
od_list_t link;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
2017-07-03 14:32:48 +00:00
|
|
|
struct od_schemedb
|
2017-05-24 11:57:15 +00:00
|
|
|
{
|
2017-07-03 14:32:48 +00:00
|
|
|
char *name;
|
|
|
|
od_list_t users;
|
|
|
|
od_schemeuser_t *user_default;
|
|
|
|
int is_default;
|
2017-07-13 12:58:32 +00:00
|
|
|
int refs;
|
2017-07-14 13:40:31 +00:00
|
|
|
int version;
|
2017-07-03 14:32:48 +00:00
|
|
|
od_list_t link;
|
|
|
|
};
|
2017-07-03 10:56:47 +00:00
|
|
|
|
2017-07-03 14:32:48 +00:00
|
|
|
struct od_schemeuser
|
|
|
|
{
|
|
|
|
od_schemedb_t *db;
|
|
|
|
/* user */
|
|
|
|
char *user;
|
2017-07-04 12:33:56 +00:00
|
|
|
int user_len;
|
2017-07-03 14:32:48 +00:00
|
|
|
char *user_password;
|
|
|
|
int user_password_len;
|
|
|
|
/* auth */
|
|
|
|
char *auth;
|
|
|
|
od_auth_t auth_mode;
|
|
|
|
/* storage */
|
|
|
|
od_schemestorage_t *storage;
|
|
|
|
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_discard;
|
|
|
|
int pool_rollback;
|
2017-07-03 14:32:48 +00:00
|
|
|
/* limits */
|
|
|
|
int client_max_set;
|
|
|
|
int client_max;
|
|
|
|
int is_default;
|
2017-06-21 12:18:48 +00:00
|
|
|
od_list_t link;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct od_scheme
|
|
|
|
{
|
|
|
|
/* main */
|
2017-07-03 14:32:48 +00:00
|
|
|
int daemonize;
|
|
|
|
int log_debug;
|
|
|
|
int log_config;
|
|
|
|
int log_session;
|
|
|
|
char *log_file;
|
|
|
|
int log_statistics;
|
|
|
|
char *pid_file;
|
|
|
|
int syslog;
|
|
|
|
char *syslog_ident;
|
|
|
|
char *syslog_facility;
|
|
|
|
int readahead;
|
|
|
|
int server_pipelining;
|
2017-05-24 11:57:15 +00:00
|
|
|
/* listen */
|
2017-07-03 14:32:48 +00:00
|
|
|
char *host;
|
|
|
|
int port;
|
|
|
|
int backlog;
|
|
|
|
int nodelay;
|
|
|
|
int keepalive;
|
|
|
|
int workers;
|
|
|
|
int client_max_set;
|
|
|
|
int client_max;
|
|
|
|
od_tls_t tls_verify;
|
|
|
|
char *tls;
|
|
|
|
char *tls_ca_file;
|
|
|
|
char *tls_key_file;
|
|
|
|
char *tls_cert_file;
|
|
|
|
char *tls_protocols;
|
2017-06-21 12:18:48 +00:00
|
|
|
/* storages */
|
2017-07-03 14:32:48 +00:00
|
|
|
od_list_t storages;
|
|
|
|
/* db */
|
|
|
|
od_list_t dbs;
|
|
|
|
od_schemedb_t *db_default;
|
2017-05-24 11:57:15 +00:00
|
|
|
};
|
|
|
|
|
2017-05-24 12:13:44 +00:00
|
|
|
void od_scheme_init(od_scheme_t*);
|
|
|
|
void od_scheme_free(od_scheme_t*);
|
|
|
|
int od_scheme_validate(od_scheme_t*, od_log_t*);
|
|
|
|
void od_scheme_print(od_scheme_t*, od_log_t*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-06-21 12:18:48 +00:00
|
|
|
od_schemestorage_t*
|
2017-07-14 13:40:31 +00:00
|
|
|
od_schemestorage_add(od_scheme_t*, int);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-06-21 12:18:48 +00:00
|
|
|
od_schemestorage_t*
|
2017-07-14 13:55:01 +00:00
|
|
|
od_schemestorage_match(od_scheme_t*, char*, int);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-07-03 14:32:48 +00:00
|
|
|
od_schemedb_t*
|
2017-07-14 13:40:31 +00:00
|
|
|
od_schemedb_add(od_scheme_t*, int);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-07-03 14:32:48 +00:00
|
|
|
od_schemedb_t*
|
2017-07-14 13:55:01 +00:00
|
|
|
od_schemedb_match(od_scheme_t*, char*, int);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
|
|
|
od_schemeuser_t*
|
2017-07-03 14:32:48 +00:00
|
|
|
od_schemeuser_add(od_schemedb_t*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
|
|
|
od_schemeuser_t*
|
2017-07-03 14:32:48 +00:00
|
|
|
od_schemeuser_match(od_schemedb_t*, char*);
|
2017-05-24 11:57:15 +00:00
|
|
|
|
2017-07-14 13:40:31 +00:00
|
|
|
void od_schemestorage_ref(od_schemestorage_t*);
|
|
|
|
void od_schemestorage_unref(od_schemestorage_t*);
|
|
|
|
void od_schemedb_ref(od_schemedb_t*);
|
|
|
|
void od_schemedb_unref(od_schemedb_t*);
|
2017-07-13 12:58:32 +00:00
|
|
|
void od_schemeuser_ref(od_schemeuser_t*);
|
|
|
|
void od_schemeuser_unref(od_schemeuser_t*);
|
|
|
|
|
2017-05-24 11:57:15 +00:00
|
|
|
#endif /* OD_SCHEME_H */
|