1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* libpq_be.h
|
2001-11-12 06:43:25 +01:00
|
|
|
* This file contains definitions for structures and externs used
|
|
|
|
* by the postmaster during client authentication.
|
|
|
|
*
|
|
|
|
* Note that this is backend-internal and is NOT exported to clients.
|
|
|
|
* Structs that need to be client-visible are in pqcomm.h.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2004-08-29 06:13:13 +02:00
|
|
|
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2004-08-29 07:07:03 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.48 2004/08/29 05:06:56 momjian Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef LIBPQ_BE_H
|
|
|
|
#define LIBPQ_BE_H
|
|
|
|
|
2004-06-24 20:55:21 +02:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
2004-02-21 07:29:58 +01:00
|
|
|
#include <sys/time.h>
|
2004-06-24 20:55:21 +02:00
|
|
|
#endif
|
1999-09-27 05:13:16 +02:00
|
|
|
#ifdef USE_SSL
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
#endif
|
|
|
|
|
2004-02-21 07:29:58 +01:00
|
|
|
#include "libpq/hba.h"
|
|
|
|
#include "libpq/pqcomm.h"
|
|
|
|
|
1998-01-26 02:42:53 +01:00
|
|
|
|
2003-12-20 18:31:21 +01:00
|
|
|
typedef enum CAC_state
|
|
|
|
{
|
|
|
|
CAC_OK, CAC_STARTUP, CAC_SHUTDOWN, CAC_RECOVERY, CAC_TOOMANY
|
|
|
|
} CAC_state;
|
|
|
|
|
1998-01-26 02:42:53 +01:00
|
|
|
/*
|
2002-08-29 05:22:01 +02:00
|
|
|
* This is used by the postmaster in its communication with frontends. It
|
1998-01-26 02:42:53 +01:00
|
|
|
* contains all state information needed during this communication before the
|
2003-08-04 02:43:34 +02:00
|
|
|
* backend is run. The Port structure is kept in malloc'd memory and is
|
|
|
|
* still available when a backend is running (see MyProcPort). The data
|
2003-04-18 00:26:02 +02:00
|
|
|
* it points to must also be malloc'd, or else palloc'd in TopMemoryContext,
|
|
|
|
* so that it survives into PostgresMain execution!
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
1998-02-26 05:46:47 +01:00
|
|
|
|
|
|
|
typedef struct Port
|
|
|
|
{
|
|
|
|
int sock; /* File descriptor */
|
2003-04-18 00:26:02 +02:00
|
|
|
ProtocolVersion proto; /* FE/BE protocol version */
|
2001-11-12 06:43:25 +01:00
|
|
|
SockAddr laddr; /* local addr (postmaster) */
|
|
|
|
SockAddr raddr; /* remote addr (client) */
|
2004-08-29 07:07:03 +02:00
|
|
|
char *remote_host; /* name (or ip addr) of remote host */
|
|
|
|
char *remote_port; /* text rep of remote port */
|
2003-12-20 18:31:21 +01:00
|
|
|
CAC_state canAcceptConnections; /* postmaster connection status */
|
1998-01-26 02:42:53 +01:00
|
|
|
|
|
|
|
/*
|
2003-08-04 02:43:34 +02:00
|
|
|
* Information that needs to be saved from the startup packet and
|
|
|
|
* passed into backend execution. "char *" fields are NULL if not
|
|
|
|
* set. guc_options points to a List of alternating option names and
|
|
|
|
* values.
|
1998-01-26 02:42:53 +01:00
|
|
|
*/
|
2003-04-18 00:26:02 +02:00
|
|
|
char *database_name;
|
|
|
|
char *user_name;
|
|
|
|
char *cmdline_options;
|
|
|
|
List *guc_options;
|
1998-01-26 02:42:53 +01:00
|
|
|
|
2003-04-18 00:26:02 +02:00
|
|
|
/*
|
|
|
|
* Information that needs to be held during the authentication cycle.
|
|
|
|
*/
|
1998-01-26 02:42:53 +01:00
|
|
|
UserAuth auth_method;
|
2003-04-18 00:26:02 +02:00
|
|
|
char *auth_arg;
|
|
|
|
char md5Salt[4]; /* Password salt */
|
|
|
|
char cryptSalt[2]; /* Password salt */
|
1999-09-27 05:13:16 +02:00
|
|
|
|
2004-03-19 03:23:59 +01:00
|
|
|
/*
|
2004-08-29 07:07:03 +02:00
|
|
|
* Information that really has no business at all being in struct
|
|
|
|
* Port, but since it gets used by elog.c in the same way as
|
|
|
|
* database_name and other members of this struct, we may as well keep
|
|
|
|
* it here.
|
2004-03-19 03:23:59 +01:00
|
|
|
*/
|
2004-08-29 07:07:03 +02:00
|
|
|
const char *commandTag; /* current command tag */
|
|
|
|
struct timeval session_start; /* for session duration logging */
|
2004-03-19 03:23:59 +01:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
|
|
|
* SSL structures
|
1999-09-27 05:13:16 +02:00
|
|
|
*/
|
|
|
|
#ifdef USE_SSL
|
2000-04-12 19:17:23 +02:00
|
|
|
SSL *ssl;
|
2002-06-14 06:36:58 +02:00
|
|
|
X509 *peer;
|
|
|
|
char peer_dn[128 + 1];
|
|
|
|
char peer_cn[SM_USER + 1];
|
2002-06-14 06:33:53 +02:00
|
|
|
unsigned long count;
|
1999-09-27 05:13:16 +02:00
|
|
|
#endif
|
1998-01-26 02:42:53 +01:00
|
|
|
} Port;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-01-26 02:42:53 +01:00
|
|
|
extern ProtocolVersion FrontendProtocol;
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* LIBPQ_BE_H */
|