]> git.8kb.co.uk Git - pgpool-ii/pgpool-ii_2.2.5/blob - pcp/pcp.h
Attempt to send a proper failure message to frontend when authentication
[pgpool-ii/pgpool-ii_2.2.5] / pcp / pcp.h
1 /*
2  * $Header: /cvsroot/pgpool/pgpool-II/pcp/pcp.h,v 1.4 2008/12/31 10:25:40 t-ishii Exp $
3  *
4  * pgpool: a language independent connection pool server for PostgreSQL 
5  * written by Tatsuo Ishii
6  *
7  * Copyright (c) 2003-2008      PgPool Global Development Group
8  *
9  * Permission to use, copy, modify, and distribute this software and
10  * its documentation for any purpose and without fee is hereby
11  * granted, provided that the above copyright notice appear in all
12  * copies and that both that copyright notice and this permission
13  * notice appear in supporting documentation, and that the name of the
14  * author not be used in advertising or publicity pertaining to
15  * distribution of the software without specific, written prior
16  * permission. The author makes no representations about the
17  * suitability of this software for any purpose.  It is provided "as
18  * is" without express or implied warranty.
19  *
20  *
21  * pcp.h - master header file.
22  */
23
24 #ifndef PCP_H
25 #define PCP_H
26
27 #include "pool_type.h"
28
29 #define MAX_USER_PASSWD_LEN    128
30
31 typedef enum {
32         UNKNOWNERR = 1,         /* shouldn't happen */
33         EOFERR,                         /* EOF read by read() */
34         NOMEMERR,                       /* could not allocate memory */
35         READERR,                        /* read() error */
36         WRITEERR,                       /* flush() error */
37         TIMEOUTERR,                     /* select() timeout */
38         INVALERR,                       /* invalid command-line argument(s) number, length, range, etc. */
39         CONNERR,                        /* thrown by connect() */
40         NOCONNERR,                      /* not connected to server */
41         SOCKERR,                        /* thrown by socket() or setsockopt() */
42         HOSTERR,                        /* thrown by gethostbyname() */
43         BACKENDERR,                     /* server dependent error */
44         AUTHERR                         /* authorization faiure */
45 } ErrorCode;
46
47 /* --------------------------------
48  * pcp.c
49  * --------------------------------
50  */
51 extern struct timeval pcp_timeout;
52 extern int pcp_connect(char *hostname, int port, char *username, char *password);
53 extern void pcp_disconnect(void);
54 extern int pcp_terminate_pgpool(char mode);
55 extern int pcp_node_count(void);
56 extern BackendInfo *pcp_node_info(int nid);
57 extern int *pcp_process_count(int *process_count);
58 extern ProcessInfo *pcp_process_info(int pid, int *array_size);
59 extern SystemDBInfo *pcp_systemdb_info(void);
60 extern void free_systemdb_info(SystemDBInfo * si);
61 extern int pcp_detach_node(int nid);
62 extern int pcp_attach_node(int nid);
63 extern void pcp_set_timeout(long sec);
64 extern int pcp_recovery_node(int nid);
65 extern void pcp_enable_debug(void);
66 extern void pcp_disable_debug(void);
67
68 /* ------------------------------
69  * pcp_error.c
70  * ------------------------------
71  */
72 extern ErrorCode errorcode;
73 extern void pcp_errorstr(ErrorCode e);
74
75 #endif /* PCP_H */