2016-11-07 10:59:09 +00:00
|
|
|
#ifndef OD_SCHEME_H_
|
|
|
|
#define OD_SCHEME_H_
|
|
|
|
|
|
|
|
/*
|
2016-11-08 11:18:58 +00:00
|
|
|
* odissey.
|
|
|
|
*
|
|
|
|
* PostgreSQL connection pooler and request router.
|
2016-11-07 10:59:09 +00:00
|
|
|
*/
|
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
typedef struct od_schemeserver_t od_schemeserver_t;
|
2017-01-23 14:29:37 +00:00
|
|
|
typedef struct od_schemeroute_t od_schemeroute_t;
|
|
|
|
typedef struct od_schemeuser_t od_schemeuser_t;
|
|
|
|
typedef struct od_scheme_t od_scheme_t;
|
2016-11-07 10:59:09 +00:00
|
|
|
|
2016-11-07 14:19:12 +00:00
|
|
|
typedef enum {
|
|
|
|
OD_PUNDEF,
|
|
|
|
OD_PSESSION,
|
|
|
|
OD_PTRANSACTION
|
2016-11-29 13:09:16 +00:00
|
|
|
} od_pooling_t;
|
2016-11-07 14:19:12 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
OD_RUNDEF,
|
2016-11-16 15:42:30 +00:00
|
|
|
OD_RFORWARD
|
2016-11-29 13:09:16 +00:00
|
|
|
} od_routing_t;
|
2016-11-07 14:19:12 +00:00
|
|
|
|
2017-01-23 14:49:26 +00:00
|
|
|
typedef enum {
|
2017-01-23 14:58:18 +00:00
|
|
|
OD_AUNDEF,
|
2017-01-24 10:28:43 +00:00
|
|
|
OD_ANONE,
|
2017-01-23 14:49:26 +00:00
|
|
|
OD_ACLEAR_TEXT,
|
|
|
|
OD_AMD5
|
|
|
|
} od_auth_t;
|
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
struct od_schemeserver_t {
|
2016-11-29 13:03:39 +00:00
|
|
|
int id;
|
|
|
|
char *name;
|
|
|
|
char *host;
|
|
|
|
int port;
|
|
|
|
int is_default;
|
|
|
|
od_list_t link;
|
2016-11-07 10:59:09 +00:00
|
|
|
};
|
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
struct od_schemeroute_t {
|
|
|
|
od_schemeserver_t *server;
|
2016-11-11 10:27:31 +00:00
|
|
|
int is_default;
|
2016-11-11 10:13:44 +00:00
|
|
|
char *target;
|
2016-11-07 14:19:12 +00:00
|
|
|
char *route;
|
|
|
|
char *database;
|
|
|
|
char *user;
|
2017-01-27 11:46:44 +00:00
|
|
|
int user_len;
|
2016-11-07 14:19:12 +00:00
|
|
|
char *password;
|
2017-01-27 11:12:12 +00:00
|
|
|
int password_len;
|
2016-11-15 12:07:58 +00:00
|
|
|
int ttl;
|
2017-02-16 10:08:16 +00:00
|
|
|
int cancel;
|
2017-02-14 15:33:08 +00:00
|
|
|
int discard;
|
2017-02-16 09:53:44 +00:00
|
|
|
int rollback;
|
2016-11-07 14:19:12 +00:00
|
|
|
int client_max;
|
2017-02-01 13:03:34 +00:00
|
|
|
int pool_size;
|
2017-02-02 09:03:03 +00:00
|
|
|
int pool_timeout;
|
2016-11-29 13:03:39 +00:00
|
|
|
od_list_t link;
|
2016-11-07 10:59:09 +00:00
|
|
|
};
|
|
|
|
|
2017-01-23 14:29:37 +00:00
|
|
|
struct od_schemeuser_t {
|
2017-01-24 11:50:59 +00:00
|
|
|
char *auth;
|
|
|
|
od_auth_t auth_mode;
|
2017-01-23 14:29:37 +00:00
|
|
|
char *user;
|
|
|
|
char *password;
|
2017-01-24 13:33:40 +00:00
|
|
|
int password_len;
|
2017-01-24 12:04:32 +00:00
|
|
|
int is_default;
|
2017-01-24 12:09:22 +00:00
|
|
|
int is_deny;
|
2017-01-23 14:29:37 +00:00
|
|
|
od_list_t link;
|
|
|
|
};
|
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
struct od_scheme_t {
|
2016-11-11 10:27:31 +00:00
|
|
|
char *config_file;
|
|
|
|
int server_id;
|
2016-11-07 10:59:09 +00:00
|
|
|
/* main */
|
2016-11-11 10:27:31 +00:00
|
|
|
int daemonize;
|
2016-12-26 13:04:37 +00:00
|
|
|
int log_verbosity;
|
2016-11-11 10:27:31 +00:00
|
|
|
char *log_file;
|
|
|
|
char *pid_file;
|
2016-11-28 14:38:19 +00:00
|
|
|
int syslog;
|
|
|
|
char *syslog_ident;
|
|
|
|
char *syslog_facility;
|
2016-11-11 10:27:31 +00:00
|
|
|
char *pooling;
|
2016-11-29 13:09:16 +00:00
|
|
|
od_pooling_t pooling_mode;
|
2016-11-07 10:59:09 +00:00
|
|
|
/* listen */
|
2016-11-11 10:27:31 +00:00
|
|
|
char *host;
|
|
|
|
int port;
|
2016-11-28 12:07:34 +00:00
|
|
|
int backlog;
|
2016-11-28 12:27:40 +00:00
|
|
|
int nodelay;
|
2016-11-28 12:36:55 +00:00
|
|
|
int keepalive;
|
2016-11-11 10:27:31 +00:00
|
|
|
int workers;
|
|
|
|
int client_max;
|
2016-11-07 10:59:09 +00:00
|
|
|
/* servers */
|
2016-11-29 13:03:39 +00:00
|
|
|
od_list_t servers;
|
2016-11-07 10:59:09 +00:00
|
|
|
/* routing */
|
2016-11-11 10:27:31 +00:00
|
|
|
char *routing;
|
2016-11-29 13:09:16 +00:00
|
|
|
od_routing_t routing_mode;
|
|
|
|
od_schemeroute_t *routing_default;
|
2016-11-29 13:03:39 +00:00
|
|
|
od_list_t routing_table;
|
2017-01-23 14:29:37 +00:00
|
|
|
/* users */
|
|
|
|
od_list_t users;
|
2017-01-24 12:04:32 +00:00
|
|
|
od_schemeuser_t *users_default;
|
2016-11-07 10:59:09 +00:00
|
|
|
};
|
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
void od_schemeinit(od_scheme_t*);
|
|
|
|
void od_schemefree(od_scheme_t*);
|
|
|
|
int od_schemevalidate(od_scheme_t*, od_log_t*);
|
|
|
|
void od_schemeprint(od_scheme_t*, od_log_t*);
|
2016-11-07 10:59:09 +00:00
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
od_schemeserver_t*
|
|
|
|
od_schemeserver_add(od_scheme_t*);
|
2016-11-07 12:59:29 +00:00
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
od_schemeserver_t*
|
|
|
|
od_schemeserver_match(od_scheme_t*, char*);
|
2016-11-07 14:19:12 +00:00
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
od_schemeroute_t*
|
|
|
|
od_schemeroute_add(od_scheme_t*);
|
2016-11-07 13:25:12 +00:00
|
|
|
|
2016-11-29 13:09:16 +00:00
|
|
|
od_schemeroute_t*
|
|
|
|
od_schemeroute_match(od_scheme_t*, char*);
|
2016-11-11 10:13:44 +00:00
|
|
|
|
2017-01-23 14:29:37 +00:00
|
|
|
od_schemeuser_t*
|
|
|
|
od_schemeuser_add(od_scheme_t*);
|
|
|
|
|
|
|
|
od_schemeuser_t*
|
|
|
|
od_schemeuser_match(od_scheme_t*, char*);
|
|
|
|
|
2016-11-07 10:59:09 +00:00
|
|
|
#endif
|