Eneboo - Documentación para desarrolladores
|
00001 /*------------------------------------------------------------------------- 00002 * 00003 * libpq_be.h 00004 * This file contains definitions for structures and externs used 00005 * by the postmaster during client authentication. 00006 * 00007 * Note that this is backend-internal and is NOT exported to clients. 00008 * Structs that need to be client-visible are in pqcomm.h. 00009 * 00010 * 00011 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group 00012 * Portions Copyright (c) 1994, Regents of the University of California 00013 * 00014 * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.53.2.1 2005/11/22 18:23:28 momjian Exp $ 00015 * 00016 *------------------------------------------------------------------------- 00017 */ 00018 #ifndef LIBPQ_BE_H 00019 #define LIBPQ_BE_H 00020 00021 #ifdef HAVE_SYS_TIME_H 00022 #include <sys/time.h> 00023 #endif 00024 #ifdef USE_SSL 00025 #include <openssl/ssl.h> 00026 #include <openssl/err.h> 00027 #endif 00028 #ifdef HAVE_NETINET_TCP_H 00029 #include <netinet/tcp.h> 00030 #endif 00031 00032 #include "libpq/hba.h" 00033 #include "libpq/pqcomm.h" 00034 00035 00036 typedef enum CAC_state 00037 { 00038 CAC_OK, CAC_STARTUP, CAC_SHUTDOWN, CAC_RECOVERY, CAC_TOOMANY 00039 } CAC_state; 00040 00041 /* 00042 * This is used by the postmaster in its communication with frontends. It 00043 * contains all state information needed during this communication before the 00044 * backend is run. The Port structure is kept in malloc'd memory and is 00045 * still available when a backend is running (see MyProcPort). The data 00046 * it points to must also be malloc'd, or else palloc'd in TopMemoryContext, 00047 * so that it survives into PostgresMain execution! 00048 */ 00049 00050 typedef struct Port 00051 { 00052 int sock; /* File descriptor */ 00053 ProtocolVersion proto; /* FE/BE protocol version */ 00054 SockAddr laddr; /* local addr (postmaster) */ 00055 SockAddr raddr; /* remote addr (client) */ 00056 char *remote_host; /* name (or ip addr) of remote host */ 00057 char *remote_port; /* text rep of remote port */ 00058 CAC_state canAcceptConnections; /* postmaster connection status */ 00059 00060 /* 00061 * Information that needs to be saved from the startup packet and passed 00062 * into backend execution. "char *" fields are NULL if not set. 00063 * guc_options points to a List of alternating option names and values. 00064 */ 00065 char *database_name; 00066 char *user_name; 00067 char *cmdline_options; 00068 List *guc_options; 00069 00070 /* 00071 * Information that needs to be held during the authentication cycle. 00072 */ 00073 UserAuth auth_method; 00074 char *auth_arg; 00075 char md5Salt[4]; /* Password salt */ 00076 char cryptSalt[2]; /* Password salt */ 00077 00078 /* 00079 * Information that really has no business at all being in struct Port, 00080 * but since it gets used by elog.c in the same way as database_name and 00081 * other members of this struct, we may as well keep it here. 00082 */ 00083 struct timeval session_start; /* for session duration logging */ 00084 00085 /* 00086 * TCP keepalive settings. 00087 * 00088 * default values are 0 if AF_UNIX or not yet known; current values are 0 00089 * if AF_UNIX or using the default. Also, -1 in a default value means we 00090 * were unable to find out the default (getsockopt failed). 00091 */ 00092 int default_keepalives_idle; 00093 int default_keepalives_interval; 00094 int default_keepalives_count; 00095 int keepalives_idle; 00096 int keepalives_interval; 00097 int keepalives_count; 00098 00099 /* 00100 * SSL structures 00101 */ 00102 #ifdef USE_SSL 00103 SSL *ssl; 00104 X509 *peer; 00105 char peer_dn[128 + 1]; 00106 char peer_cn[SM_USER + 1]; 00107 unsigned long count; 00108 #endif 00109 } Port; 00110 00111 00112 extern ProtocolVersion FrontendProtocol; 00113 00114 /* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */ 00115 00116 extern int pq_getkeepalivesidle(Port *port); 00117 extern int pq_getkeepalivesinterval(Port *port); 00118 extern int pq_getkeepalivescount(Port *port); 00119 00120 extern int pq_setkeepalivesidle(int idle, Port *port); 00121 extern int pq_setkeepalivesinterval(int interval, Port *port); 00122 extern int pq_setkeepalivescount(int count, Port *port); 00123 00124 #endif /* LIBPQ_BE_H */