summaryrefslogtreecommitdiff
path: root/src/include/libpq
diff options
context:
space:
mode:
authorBruce Momjian1997-09-07 05:04:48 +0000
committerBruce Momjian1997-09-07 05:04:48 +0000
commit1ccd423235a48739d6f7a4d7889705b5f9ecc69b (patch)
tree8001c4e839dfad8f29ceda7f8c5f5dbb8759b564 /src/include/libpq
parent8fecd4febf8357f3cc20383ed29ced484877d5ac (diff)
Massive commit to run PGINDENT on all *.c and *.h files.
Diffstat (limited to 'src/include/libpq')
-rw-r--r--src/include/libpq/auth.h38
-rw-r--r--src/include/libpq/be-fsstubs.h36
-rw-r--r--src/include/libpq/hba.h48
-rw-r--r--src/include/libpq/libpq-be.h36
-rw-r--r--src/include/libpq/libpq-fs.h109
-rw-r--r--src/include/libpq/libpq.h328
-rw-r--r--src/include/libpq/password.h5
-rw-r--r--src/include/libpq/pqcomm.h173
-rw-r--r--src/include/libpq/pqsignal.h12
9 files changed, 410 insertions, 375 deletions
diff --git a/src/include/libpq/auth.h b/src/include/libpq/auth.h
index 40a97cdfb44..a159b7a5ebd 100644
--- a/src/include/libpq/auth.h
+++ b/src/include/libpq/auth.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* auth.h--
- * Definitions for network authentication routines
+ * Definitions for network authentication routines
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: auth.h,v 1.4 1997/08/19 21:38:34 momjian Exp $
+ * $Id: auth.h,v 1.5 1997/09/07 04:58:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef AUTH_H
-#define AUTH_H
+#define AUTH_H
#include <libpq/pqcomm.h>
@@ -21,27 +21,27 @@
*/
/* what we call "no authentication system" */
-#define UNAUTHNAME "unauth"
+#define UNAUTHNAME "unauth"
/* what a frontend uses by default */
#if !defined(KRB4) && !defined(KRB5)
-#define DEFAULT_CLIENT_AUTHSVC UNAUTHNAME
-#else /* KRB4 || KRB5 */
-#define DEFAULT_CLIENT_AUTHSVC "kerberos"
-#endif /* KRB4 || KRB5 */
-
-extern int fe_sendauth(MsgType msgtype, Port *port, char *hostname);
-extern void fe_setauthsvc(char *name);
-extern MsgType fe_getauthsvc();
-extern char *fe_getauthname(void);
-extern int be_recvauth(MsgType msgtype, Port *port, char *username, StartupInfo* sp);
-extern void be_setauthsvc(char *name);
+#define DEFAULT_CLIENT_AUTHSVC UNAUTHNAME
+#else /* KRB4 || KRB5 */
+#define DEFAULT_CLIENT_AUTHSVC "kerberos"
+#endif /* KRB4 || KRB5 */
+
+extern int fe_sendauth(MsgType msgtype, Port * port, char *hostname);
+extern void fe_setauthsvc(char *name);
+extern MsgType fe_getauthsvc();
+extern char *fe_getauthname(void);
+extern int be_recvauth(MsgType msgtype, Port * port, char *username, StartupInfo * sp);
+extern void be_setauthsvc(char *name);
/* the value that matches any dbName value when doing
host based authentication*/
-#define ALL_DBNAME "*"
+#define ALL_DBNAME "*"
-#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
-#define PG_KRB5_VERSION "PGVER5.1"
+#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
+#define PG_KRB5_VERSION "PGVER5.1"
-#endif /* AUTH_H */
+#endif /* AUTH_H */
diff --git a/src/include/libpq/be-fsstubs.h b/src/include/libpq/be-fsstubs.h
index 34fda6fd60e..2ea347a9b3e 100644
--- a/src/include/libpq/be-fsstubs.h
+++ b/src/include/libpq/be-fsstubs.h
@@ -1,40 +1,40 @@
/*-------------------------------------------------------------------------
*
* be-fsstubs.h--
- *
+ *
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: be-fsstubs.h,v 1.2 1997/05/06 07:14:34 thomas Exp $
+ * $Id: be-fsstubs.h,v 1.3 1997/09/07 04:58:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef BE_FSSTUBS_H
-#define BE_FSSTUBS_H
+#ifndef BE_FSSTUBS_H
+#define BE_FSSTUBS_H
/* Redefine names LOread() and LOwrite() to be lowercase to allow calling
- * using the new v6.1 case-insensitive SQL parser. Define macros to allow
- * the existing code to stay the same. - tgl 97/05/03
+ * using the new v6.1 case-insensitive SQL parser. Define macros to allow
+ * the existing code to stay the same. - tgl 97/05/03
*/
#define LOread(f,l) loread(f,l)
#define LOwrite(f,b) lowrite(f,b)
-extern Oid lo_import(text *filename);
-extern int4 lo_export(Oid lobjId, text *filename);
+extern Oid lo_import(text * filename);
+extern int4 lo_export(Oid lobjId, text * filename);
-extern Oid lo_creat(int mode);
+extern Oid lo_creat(int mode);
-extern int lo_open(Oid lobjId, int mode);
-extern int lo_close(int fd);
-extern int lo_read(int fd, char *buf, int len);
-extern int lo_write(int fd, char *buf, int len);
-extern int lo_lseek(int fd, int offset, int whence);
-extern int lo_tell(int fd);
-extern int lo_unlink(Oid lobjId);
+extern int lo_open(Oid lobjId, int mode);
+extern int lo_close(int fd);
+extern int lo_read(int fd, char *buf, int len);
+extern int lo_write(int fd, char *buf, int len);
+extern int lo_lseek(int fd, int offset, int whence);
+extern int lo_tell(int fd);
+extern int lo_unlink(Oid lobjId);
extern struct varlena *loread(int fd, int len);
-extern int lowrite(int fd, struct varlena *wbuf);
+extern int lowrite(int fd, struct varlena * wbuf);
-#endif /* BE_FSSTUBS_H */
+#endif /* BE_FSSTUBS_H */
diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h
index 14847438b0d..c54b9938ce4 100644
--- a/src/include/libpq/hba.h
+++ b/src/include/libpq/hba.h
@@ -1,49 +1,53 @@
/*-------------------------------------------------------------------------
*
* hba.h--
- * Interface to hba.c
+ * Interface to hba.c
*
*
- * $Id: hba.h,v 1.3 1997/03/12 21:22:16 scrappy Exp $
+ * $Id: hba.h,v 1.4 1997/09/07 04:58:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef HBA_H
-#define HBA_H
+#define HBA_H
#include <libpq/pqcomm.h>
-#define CONF_FILE "pg_hba.conf"
- /* Name of the config file */
+#define CONF_FILE "pg_hba.conf"
+ /* Name of the config file */
#define MAP_FILE "pg_ident.conf"
- /* Name of the usermap file */
+ /* Name of the usermap file */
#define OLD_CONF_FILE "pg_hba"
- /* Name of the config file in prior releases of Postgres. */
+ /* Name of the config file in prior releases of Postgres. */
-#define MAX_LINES 255
- /* Maximum number of config lines that can apply to one database */
+#define MAX_LINES 255
+ /* Maximum number of config lines that can apply to one database */
-#define MAX_TOKEN 80
-/* Maximum size of one token in the configuration file */
+#define MAX_TOKEN 80
+/* Maximum size of one token in the configuration file */
-#define USERMAP_NAME_SIZE 16 /* Max size of a usermap name */
+#define USERMAP_NAME_SIZE 16 /* Max size of a usermap name */
#define IDENT_PORT 113
- /* Standard TCP port number for Ident service. Assigned by IANA */
+ /* Standard TCP port number for Ident service. Assigned by IANA */
-#define IDENT_USERNAME_MAX 512
- /* Max size of username ident server can return */
+#define IDENT_USERNAME_MAX 512
+ /* Max size of username ident server can return */
-enum Userauth {Trust, Ident, Password};
+enum Userauth
+{
+ Trust, Ident, Password
+};
extern int
-hba_recvauth(const Port *port, const char database[], const char user[],
- const char DataDir[]);
-void find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
- const char database[],
- bool *host_ok_p, enum Userauth *userauth_p,
- char usermap_name[], bool find_password_entries);
+hba_recvauth(const Port * port, const char database[], const char user[],
+ const char DataDir[]);
+void
+find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
+ const char database[],
+ bool * host_ok_p, enum Userauth * userauth_p,
+ char usermap_name[], bool find_password_entries);
#endif
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h
index 1d87f17421d..4550461d06e 100644
--- a/src/include/libpq/libpq-be.h
+++ b/src/include/libpq/libpq-be.h
@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* libpq-be.h--
- * This file contains definitions for structures and
- * externs for functions used by the POSTGRES backend.
+ * This file contains definitions for structures and
+ * externs for functions used by the POSTGRES backend.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-be.h,v 1.4 1997/08/19 21:38:37 momjian Exp $
+ * $Id: libpq-be.h,v 1.5 1997/09/07 04:58:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,33 +19,35 @@
#include <libpq/libpq.h>
/* ----------------
- * include stuff common to fe and be
+ * include stuff common to fe and be
* ----------------
*/
/* ----------------
- * declarations for backend libpq support routines
+ * declarations for backend libpq support routines
* ----------------
*/
/* in be-dumpdata.c */
-extern void be_portalinit(void);
-extern void be_portalpush(PortalEntry *entry);
+extern void be_portalinit(void);
+extern void be_portalpush(PortalEntry * entry);
extern PortalEntry *be_portalpop(void);
extern PortalEntry *be_currentportal(void);
extern PortalEntry *be_newportal(void);
-extern void be_typeinit(PortalEntry *entry, TupleDesc attrs,
+extern void
+be_typeinit(PortalEntry * entry, TupleDesc attrs,
int natts);
-extern void be_printtup(HeapTuple tuple, TupleDesc typeinfo);
+extern void be_printtup(HeapTuple tuple, TupleDesc typeinfo);
/* in be-pqexec.c */
-extern char *PQfn(int fnid, int *result_buf, int result_len, int result_is_int,
- PQArgBlock *args, int nargs);
-extern char *PQexec(char *query);
-extern int pqtest_PQexec(char *q);
-extern int pqtest_PQfn(char *q);
-extern int32 pqtest(struct varlena *vlena);
-
-#endif /* LIBPQ_BE_H */
+extern char *
+PQfn(int fnid, int *result_buf, int result_len, int result_is_int,
+ PQArgBlock * args, int nargs);
+extern char *PQexec(char *query);
+extern int pqtest_PQexec(char *q);
+extern int pqtest_PQfn(char *q);
+extern int32 pqtest(struct varlena * vlena);
+
+#endif /* LIBPQ_BE_H */
diff --git a/src/include/libpq/libpq-fs.h b/src/include/libpq/libpq-fs.h
index 4bb37e71492..4e7f4e37a2e 100644
--- a/src/include/libpq/libpq-fs.h
+++ b/src/include/libpq/libpq-fs.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* libpq-fs.h--
- * definitions for using Inversion file system routines
+ * definitions for using Inversion file system routines
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-fs.h,v 1.3 1997/02/14 04:18:33 momjian Exp $
+ * $Id: libpq-fs.h,v 1.4 1997/09/07 04:58:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,59 +18,60 @@
#ifndef MAXNAMLEN
#define MAXNAMLEN 255
-#endif /* MAXNAMLEN */
+#endif /* MAXNAMLEN */
-struct pgdirent {
- unsigned long d_ino;
- unsigned short d_namlen;
- char d_name[MAXNAMLEN+1];
+struct pgdirent
+{
+ unsigned long d_ino;
+ unsigned short d_namlen;
+ char d_name[MAXNAMLEN + 1];
};
/*
* SysV struct dirent doesn't have d_namlen.
- * This counts on d_name being last, which is moderately safe (ha) since
+ * This counts on d_name being last, which is moderately safe (ha) since
* it's the variable-length part of the structure.
*/
#ifdef SYSV_DIRENT
-#define D_NAMLEN(dp) \
- ((dp)->d_reclen - offsetof(struct dirent, d_name[0]))
-#else /* SYSV_DIRENT */
-#define D_NAMLEN(dp) \
- ((dp)->d_namlen)
-#endif /* SYSV_DIRENT */
+#define D_NAMLEN(dp) \
+ ((dp)->d_reclen - offsetof(struct dirent, d_name[0]))
+#else /* SYSV_DIRENT */
+#define D_NAMLEN(dp) \
+ ((dp)->d_namlen)
+#endif /* SYSV_DIRENT */
/* for stat(2) */
#ifndef S_IRUSR
/* file modes */
-#define S_IRWXU 00700 /* read, write, execute: owner */
-#define S_IRUSR 00400 /* read permission: owner */
-#define S_IWUSR 00200 /* write permission: owner */
-#define S_IXUSR 00100 /* execute permission: owner */
+#define S_IRWXU 00700 /* read, write, execute: owner */
+#define S_IRUSR 00400 /* read permission: owner */
+#define S_IWUSR 00200 /* write permission: owner */
+#define S_IXUSR 00100 /* execute permission: owner */
-#define S_IRWXG 00070 /* read, write, execute: group */
-#define S_IRGRP 00040 /* read permission: group */
-#define S_IWGRP 00020 /* write permission: group */
-#define S_IXGRP 00010 /* execute permission: group */
+#define S_IRWXG 00070 /* read, write, execute: group */
+#define S_IRGRP 00040 /* read permission: group */
+#define S_IWGRP 00020 /* write permission: group */
+#define S_IXGRP 00010 /* execute permission: group */
-#define S_IRWXO 00007 /* read, write, execute: other */
-#define S_IROTH 00004 /* read permission: other */
-#define S_IWOTH 00002 /* write permission: other */
-#define S_IXOTH 00001 /* execute permission: other */
+#define S_IRWXO 00007 /* read, write, execute: other */
+#define S_IROTH 00004 /* read permission: other */
+#define S_IWOTH 00002 /* write permission: other */
+#define S_IXOTH 00001 /* execute permission: other */
-#define _S_IFMT 0170000 /* type of file; sync with S_IFMT */
-#define _S_IFBLK 0060000 /* block special; sync with S_IFBLK */
-#define _S_IFCHR 0020000 /* character special sync with S_IFCHR */
-#define _S_IFDIR 0040000 /* directory; sync with S_IFDIR */
-#define _S_IFIFO 0010000 /* FIFO - named pipe; sync with S_IFIFO */
-#define _S_IFREG 0100000 /* regular; sync with S_IFREG */
+#define _S_IFMT 0170000 /* type of file; sync with S_IFMT */
+#define _S_IFBLK 0060000 /* block special; sync with S_IFBLK */
+#define _S_IFCHR 0020000 /* character special sync with S_IFCHR */
+#define _S_IFDIR 0040000 /* directory; sync with S_IFDIR */
+#define _S_IFIFO 0010000 /* FIFO - named pipe; sync with S_IFIFO */
+#define _S_IFREG 0100000 /* regular; sync with S_IFREG */
#define S_IFDIR _S_IFDIR
#define S_IFREG _S_IFREG
-#define S_ISDIR( mode ) (((mode) & _S_IFMT) == _S_IFDIR)
+#define S_ISDIR( mode ) (((mode) & _S_IFMT) == _S_IFDIR)
-#endif /* S_IRUSR */
+#endif /* S_IRUSR */
/*
* Inversion doesn't have links.
@@ -80,28 +81,28 @@ struct pgdirent {
#endif
/*
- * Flags for inversion file system large objects. Normally, creat()
- * takes mode arguments, but we don't use them in inversion, since
- * you get postgres protections. Instead, we use the low sixteen bits
- * of the integer mode argument to store the number of the storage
- * manager to be used, and the high sixteen bits for flags.
+ * Flags for inversion file system large objects. Normally, creat()
+ * takes mode arguments, but we don't use them in inversion, since
+ * you get postgres protections. Instead, we use the low sixteen bits
+ * of the integer mode argument to store the number of the storage
+ * manager to be used, and the high sixteen bits for flags.
*/
#define INV_SMGRMASK 0x0000ffff
-#define INV_ARCHIVE 0x00010000
-#define INV_WRITE 0x00020000
-#define INV_READ 0x00040000
+#define INV_ARCHIVE 0x00010000
+#define INV_WRITE 0x00020000
+#define INV_READ 0x00040000
/* Error values for p_errno */
-#define PEPERM 1 /* Not owner */
-#define PENOENT 2 /* No such file or directory */
-#define PEACCES 13 /* Permission denied */
-#define PEEXIST 17 /* File exists */
-#define PENOTDIR 20 /* Not a directory*/
-#define PEISDIR 21 /* Is a directory */
-#define PEINVAL 22 /* Invalid argument */
-#define PENAMETOOLONG 63 /* File name too long */
-#define PENOTEMPTY 66 /* Directory not empty */
-#define PEPGIO 99 /* postgres backend had problems */
-
-#endif /* LIBPQ_FS_H */
+#define PEPERM 1 /* Not owner */
+#define PENOENT 2 /* No such file or directory */
+#define PEACCES 13 /* Permission denied */
+#define PEEXIST 17 /* File exists */
+#define PENOTDIR 20 /* Not a directory */
+#define PEISDIR 21 /* Is a directory */
+#define PEINVAL 22 /* Invalid argument */
+#define PENAMETOOLONG 63 /* File name too long */
+#define PENOTEMPTY 66 /* Directory not empty */
+#define PEPGIO 99 /* postgres backend had problems */
+
+#endif /* LIBPQ_FS_H */
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index 080a1052deb..1b074cba118 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -1,18 +1,18 @@
/*-------------------------------------------------------------------------
*
* libpq.h--
- * POSTGRES LIBPQ buffer structure definitions.
+ * POSTGRES LIBPQ buffer structure definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq.h,v 1.5 1996/11/05 07:38:17 scrappy Exp $
+ * $Id: libpq.h,v 1.6 1997/09/07 04:58:24 momjian Exp $
*
* NOTES
- * This file contains definitions for structures and
- * externs for functions used by both frontend applications
- * and the POSTGRES backend. See the files libpq-fe.h and
- * libpq-be.h for frontend/backend specific information
+ * This file contains definitions for structures and
+ * externs for functions used by both frontend applications
+ * and the POSTGRES backend. See the files libpq-fe.h and
+ * libpq-be.h for frontend/backend specific information
*
*-------------------------------------------------------------------------
*/
@@ -23,118 +23,130 @@
/* ----------------
* PQArgBlock --
- * Information (pointer to array of this structure) required
- * for the PQfn() call.
+ * Information (pointer to array of this structure) required
+ * for the PQfn() call.
* ----------------
*/
-typedef struct {
- int len;
- int isint;
- union {
- int *ptr; /* can't use void (dec compiler barfs) */
- int integer;
- } u;
-} PQArgBlock;
+typedef struct
+{
+ int len;
+ int isint;
+ union
+ {
+ int *ptr; /* can't use void (dec compiler barfs) */
+ int integer;
+ } u;
+} PQArgBlock;
/* ----------------
* TypeBlock --
- * Information about an attribute.
+ * Information about an attribute.
* ----------------
*/
#define NameLength 16
-typedef struct TypeBlock {
- char name[NAMEDATALEN]; /* name of the attribute */
- int adtid; /* adtid of the type */
- int adtsize; /* adtsize of the type */
-} TypeBlock;
+typedef struct TypeBlock
+{
+ char name[NAMEDATALEN]; /* name of the attribute */
+ int adtid; /* adtid of the type */
+ int adtsize; /* adtsize of the type */
+} TypeBlock;
/* ----------------
* TupleBlock --
- * Data of a tuple.
+ * Data of a tuple.
* ----------------
*/
#define TupleBlockSize 100
-typedef struct TupleBlock {
- char **values[TupleBlockSize]; /* an array of tuples */
- int *lengths[TupleBlockSize]; /* an array of length vec. foreach
- tuple */
- struct TupleBlock *next; /* next tuple block */
- int tuple_index; /* current tuple index */
-} TupleBlock;
+typedef struct TupleBlock
+{
+ char **values[TupleBlockSize]; /* an array of tuples */
+ int *lengths[TupleBlockSize]; /* an array of length vec.
+ * foreach tuple */
+ struct TupleBlock *next; /* next tuple block */
+ int tuple_index;/* current tuple index */
+} TupleBlock;
/* ----------------
* GroupBuffer --
- * A group of tuples with the same attributes.
+ * A group of tuples with the same attributes.
* ----------------
*/
-typedef struct GroupBuffer {
- int no_tuples; /* number of tuples in this group */
- int no_fields; /* number of attributes */
- TypeBlock *types; /* types of the attributes */
- TupleBlock *tuples; /* tuples in this group */
- struct GroupBuffer *next; /* next group */
-} GroupBuffer;
+typedef struct GroupBuffer
+{
+ int no_tuples; /* number of tuples in this group */
+ int no_fields; /* number of attributes */
+ TypeBlock *types; /* types of the attributes */
+ TupleBlock *tuples; /* tuples in this group */
+ struct GroupBuffer *next; /* next group */
+} GroupBuffer;
/* ----------------
* PortalBuffer --
- * Data structure of a portal buffer.
+ * Data structure of a portal buffer.
* ----------------
*/
-typedef struct PortalBuffer {
- int rule_p; /* 1 if this is an asynchronized portal. */
- int no_tuples; /* number of tuples in this portal buffer */
- int no_groups; /* number of tuple groups */
- GroupBuffer *groups; /* linked list of tuple groups */
-} PortalBuffer;
+typedef struct PortalBuffer
+{
+ int rule_p; /* 1 if this is an asynchronized portal. */
+ int no_tuples; /* number of tuples in this portal buffer */
+ int no_groups; /* number of tuple groups */
+ GroupBuffer *groups; /* linked list of tuple groups */
+} PortalBuffer;
/* ----------------
* PortalEntry --
- * an entry in the global portal table
+ * an entry in the global portal table
*
* Note: the portalcxt is only meaningful for PQcalls made from
- * within a postgres backend. frontend apps should ignore it.
+ * within a postgres backend. frontend apps should ignore it.
* ----------------
*/
#define PortalNameLength 32
-typedef struct PortalEntry {
- char name[PortalNameLength]; /* name of this portal */
- PortalBuffer *portal; /* tuples contained in this portal */
- Pointer portalcxt; /* memory context (for backend) */
- Pointer result; /* result for PQexec */
-} PortalEntry;
+typedef struct PortalEntry
+{
+ char name[PortalNameLength]; /* name of this portal */
+ PortalBuffer *portal; /* tuples contained in this portal */
+ Pointer portalcxt; /* memory context (for backend) */
+ Pointer result; /* result for PQexec */
+} PortalEntry;
#define PORTALS_INITIAL_SIZE 32
-#define PORTALS_GROW_BY 32
+#define PORTALS_GROW_BY 32
/* in portalbuf.c */
-extern PortalEntry** portals;
-extern size_t portals_array_size;
+extern PortalEntry **portals;
+extern size_t portals_array_size;
/*
- * Asynchronous notification
+ * Asynchronous notification
*/
-typedef struct PQNotifyList {
- char relname[NAMEDATALEN]; /* name of relation containing data */
- int be_pid; /* process id of backend */
- int valid; /* has this already been handled by user. */
-/* SLNode Node; */
-} PQNotifyList;
+typedef struct PQNotifyList
+{
+ char relname[NAMEDATALEN]; /* name of relation
+ * containing data */
+ int be_pid; /* process id of backend */
+ int valid; /* has this already been handled by user. */
+/* SLNode Node; */
+} PQNotifyList;
/*
* Exceptions.
*/
#define libpq_raise(X, Y) ExcRaise((Exception *)(X), (ExcDetail) (Y),\
- (ExcData)0, (ExcMessage) 0)
+ (ExcData)0, (ExcMessage) 0)
/* in portal.c */
-extern Exception MemoryError, PortalError, PostquelError, ProtocolError;
+extern Exception MemoryError,
+ PortalError,
+ PostquelError,
+ ProtocolError;
-/*
- * POSTGRES backend dependent Constants.
+/*
+ * POSTGRES backend dependent Constants.
*/
/* ERROR_MSG_LENGTH should really be the same as ELOG_MAXLEN in utils/elog.h*/
@@ -142,107 +154,111 @@ extern Exception MemoryError, PortalError, PostquelError, ProtocolError;
#define COMMAND_LENGTH 20
#define REMARK_LENGTH 80
-extern char PQerrormsg[ERROR_MSG_LENGTH]; /* in portal.c */
+extern char PQerrormsg[ERROR_MSG_LENGTH]; /* in portal.c */
/*
* External functions.
*/
-/*
- * prototypes for functions in portal.c
+/*
+ * prototypes for functions in portal.c
*/
-extern void pqdebug(char *target, char *msg);
-extern void pqdebug2(char *target, char *msg1, char *msg2);
-extern void PQtrace(void);
-extern void PQuntrace(void);
-extern int PQnportals(int rule_p);
-extern void PQpnames(char **pnames, int rule_p);
+extern void pqdebug(char *target, char *msg);
+extern void pqdebug2(char *target, char *msg1, char *msg2);
+extern void PQtrace(void);
+extern void PQuntrace(void);
+extern int PQnportals(int rule_p);
+extern void PQpnames(char **pnames, int rule_p);
extern PortalBuffer *PQparray(char *pname);
-extern int PQrulep(PortalBuffer *portal);
-extern int PQntuples(PortalBuffer *portal);
-extern int PQninstances(PortalBuffer *portal);
-extern int PQngroups(PortalBuffer *portal);
-extern int PQntuplesGroup(PortalBuffer *portal, int group_index);
-extern int PQninstancesGroup(PortalBuffer *portal, int group_index);
-extern int PQnfieldsGroup(PortalBuffer *portal, int group_index);
-extern int PQfnumberGroup(PortalBuffer *portal, int group_index, char *field_name);
-extern char *PQfnameGroup(PortalBuffer *portal, int group_index, int field_number);
-extern int PQftypeGroup(PortalBuffer *portal, int group_index,
- int field_number);
-extern int PQfsizeGroup(PortalBuffer *portal, int group_index,
- int field_number);
-extern GroupBuffer *PQgroup(PortalBuffer *portal, int tuple_index);
-extern int PQgetgroup(PortalBuffer *portal, int tuple_index);
-extern int PQnfields(PortalBuffer *portal, int tuple_index);
-extern int PQfnumber(PortalBuffer *portal, int tuple_index, char *field_name);
- extern char *PQfname(PortalBuffer *portal, int tuple_index, int field_number);
-extern int PQftype(PortalBuffer *portal, int tuple_index, int field_number);
-extern int PQfsize(PortalBuffer *portal, int tuple_index, int field_number);
-extern int PQsametype(PortalBuffer *portal, int tuple_index1, int tuple_index2);
-extern char *PQgetvalue(PortalBuffer *portal, int tuple_index, int field_number);
-extern char *PQgetAttr(PortalBuffer *portal, int tuple_index, int field_number);
-extern int PQgetlength(PortalBuffer *portal, int tuple_index, int field_number);
-extern void PQclear(char *pname);
-extern void PQcleanNotify(void);
-extern void PQnotifies_init(void);
+extern int PQrulep(PortalBuffer * portal);
+extern int PQntuples(PortalBuffer * portal);
+extern int PQninstances(PortalBuffer * portal);
+extern int PQngroups(PortalBuffer * portal);
+extern int PQntuplesGroup(PortalBuffer * portal, int group_index);
+extern int PQninstancesGroup(PortalBuffer * portal, int group_index);
+extern int PQnfieldsGroup(PortalBuffer * portal, int group_index);
+extern int PQfnumberGroup(PortalBuffer * portal, int group_index, char *field_name);
+extern char *PQfnameGroup(PortalBuffer * portal, int group_index, int field_number);
+extern int
+PQftypeGroup(PortalBuffer * portal, int group_index,
+ int field_number);
+extern int
+PQfsizeGroup(PortalBuffer * portal, int group_index,
+ int field_number);
+extern GroupBuffer *PQgroup(PortalBuffer * portal, int tuple_index);
+extern int PQgetgroup(PortalBuffer * portal, int tuple_index);
+extern int PQnfields(PortalBuffer * portal, int tuple_index);
+extern int PQfnumber(PortalBuffer * portal, int tuple_index, char *field_name);
+extern char *PQfname(PortalBuffer * portal, int tuple_index, int field_number);
+extern int PQftype(PortalBuffer * portal, int tuple_index, int field_number);
+extern int PQfsize(PortalBuffer * portal, int tuple_index, int field_number);
+extern int PQsametype(PortalBuffer * portal, int tuple_index1, int tuple_index2);
+extern char *PQgetvalue(PortalBuffer * portal, int tuple_index, int field_number);
+extern char *PQgetAttr(PortalBuffer * portal, int tuple_index, int field_number);
+extern int PQgetlength(PortalBuffer * portal, int tuple_index, int field_number);
+extern void PQclear(char *pname);
+extern void PQcleanNotify(void);
+extern void PQnotifies_init(void);
extern PQNotifyList *PQnotifies(void);
-extern void PQremoveNotify(PQNotifyList *nPtr);
-extern void PQappendNotify(char *relname, int pid);
-/*
- * prototypes for functions in portalbuf.c
+extern void PQremoveNotify(PQNotifyList * nPtr);
+extern void PQappendNotify(char *relname, int pid);
+
+/*
+ * prototypes for functions in portalbuf.c
*/
-extern caddr_t pbuf_alloc(size_t size);
-extern void pbuf_free(caddr_t pointer);
+extern caddr_t pbuf_alloc(size_t size);
+extern void pbuf_free(caddr_t pointer);
extern PortalBuffer *pbuf_addPortal(void);
-extern GroupBuffer *pbuf_addGroup(PortalBuffer *portal);
+extern GroupBuffer *pbuf_addGroup(PortalBuffer * portal);
extern TypeBlock *pbuf_addTypes(int n);
extern TupleBlock *pbuf_addTuples(void);
-extern char **pbuf_addTuple(int n);
-extern int *pbuf_addTupleValueLengths(int n);
-extern char *pbuf_addValues(int n);
+extern char **pbuf_addTuple(int n);
+extern int *pbuf_addTupleValueLengths(int n);
+extern char *pbuf_addValues(int n);
extern PortalEntry *pbuf_addEntry(void);
-extern void pbuf_freeEntry(int i);
-extern void pbuf_freeTypes(TypeBlock *types);
-extern void pbuf_freeTuples(TupleBlock *tuples, int no_tuples, int no_fields);
-extern void pbuf_freeGroup(GroupBuffer *group);
-extern void pbuf_freePortal(PortalBuffer *portal);
-extern int pbuf_getIndex(char *pname);
-extern void pbuf_setportalinfo(PortalEntry *entry, char *pname);
+extern void pbuf_freeEntry(int i);
+extern void pbuf_freeTypes(TypeBlock * types);
+extern void pbuf_freeTuples(TupleBlock * tuples, int no_tuples, int no_fields);
+extern void pbuf_freeGroup(GroupBuffer * group);
+extern void pbuf_freePortal(PortalBuffer * portal);
+extern int pbuf_getIndex(char *pname);
+extern void pbuf_setportalinfo(PortalEntry * entry, char *pname);
extern PortalEntry *pbuf_setup(char *pname);
-extern void pbuf_close(char *pname);
-extern GroupBuffer *pbuf_findGroup(PortalBuffer *portal, int group_index);
-extern int pbuf_findFnumber(GroupBuffer *group, char *field_name);
-extern void pbuf_checkFnumber(GroupBuffer *group, int field_number);
-extern char *pbuf_findFname(GroupBuffer *group, int field_number);
-
-/*
- * prototypes for functions in pqcomm.c
+extern void pbuf_close(char *pname);
+extern GroupBuffer *pbuf_findGroup(PortalBuffer * portal, int group_index);
+extern int pbuf_findFnumber(GroupBuffer * group, char *field_name);
+extern void pbuf_checkFnumber(GroupBuffer * group, int field_number);
+extern char *pbuf_findFname(GroupBuffer * group, int field_number);
+
+/*
+ * prototypes for functions in pqcomm.c
*/
-extern void pq_init(int fd);
-extern void pq_gettty(char *tp);
-extern int pq_getport(void);
-extern void pq_close(void);
-extern void pq_flush(void);
-extern int pq_getstr(char *s, int maxlen);
-extern int PQgetline(char *s, int maxlen);
-extern int PQputline(char *s);
-extern int pq_getnchar(char *s, int off, int maxlen);
-extern int pq_getint(int b);
-extern void pq_putstr(char *s);
-extern void pq_putnchar(char *s, int n);
-extern void pq_putint(int i, int b);
-extern int pq_sendoob(char *msg, int len);
-extern int pq_recvoob(char *msgPtr, int *lenPtr);
-extern int pq_getinaddr(struct sockaddr_in *sin, char *host, int port);
-extern int pq_getinserv(struct sockaddr_in *sin, char *host, char *serv);
-extern int pq_connect(char *dbname, char *user, char *args, char *hostName,
- char *debugTty, char *execFile, short portName);
-extern int StreamOpen(char *hostName, short portName, Port *port);
-extern void pq_regoob(void (*fptr)());
-extern void pq_unregoob(void);
-extern void pq_async_notify(void);
-extern int StreamServerPort(char *hostName, short portName, int *fdP);
-extern int StreamConnection(int server_fd, Port *port);
-extern void StreamClose(int sock);
-
-#endif /* LIBPQ_H */
+extern void pq_init(int fd);
+extern void pq_gettty(char *tp);
+extern int pq_getport(void);
+extern void pq_close(void);
+extern void pq_flush(void);
+extern int pq_getstr(char *s, int maxlen);
+extern int PQgetline(char *s, int maxlen);
+extern int PQputline(char *s);
+extern int pq_getnchar(char *s, int off, int maxlen);
+extern int pq_getint(int b);
+extern void pq_putstr(char *s);
+extern void pq_putnchar(char *s, int n);
+extern void pq_putint(int i, int b);
+extern int pq_sendoob(char *msg, int len);
+extern int pq_recvoob(char *msgPtr, int *lenPtr);
+extern int pq_getinaddr(struct sockaddr_in * sin, char *host, int port);
+extern int pq_getinserv(struct sockaddr_in * sin, char *host, char *serv);
+extern int
+pq_connect(char *dbname, char *user, char *args, char *hostName,
+ char *debugTty, char *execFile, short portName);
+extern int StreamOpen(char *hostName, short portName, Port * port);
+extern void pq_regoob(void (*fptr) ());
+extern void pq_unregoob(void);
+extern void pq_async_notify(void);
+extern int StreamServerPort(char *hostName, short portName, int *fdP);
+extern int StreamConnection(int server_fd, Port * port);
+extern void StreamClose(int sock);
+
+#endif /* LIBPQ_H */
diff --git a/src/include/libpq/password.h b/src/include/libpq/password.h
index f6b62140950..2b933553d59 100644
--- a/src/include/libpq/password.h
+++ b/src/include/libpq/password.h
@@ -6,7 +6,8 @@
#define PWFILE_NAME_SIZE USERMAP_NAME_SIZE
-int verify_password(char *user, char *password, Port *port,
- char *database, char *DataDir);
+int
+verify_password(char *user, char *password, Port * port,
+ char *database, char *DataDir);
#endif
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index 53f0b970eb5..3aceb3de5b4 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -1,20 +1,20 @@
/*-------------------------------------------------------------------------
*
* pqcomm.h--
- * Parameters for the communication module
+ * Parameters for the communication module
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.h,v 1.10 1997/03/20 18:23:03 scrappy Exp $
+ * $Id: pqcomm.h,v 1.11 1997/09/07 04:58:26 momjian Exp $
*
* NOTES
- * Some of this should move to libpq.h
+ * Some of this should move to libpq.h
*
*-------------------------------------------------------------------------
*/
#ifndef PQCOMM_H
-#define PQCOMM_H
+#define PQCOMM_H
#include <stdio.h>
#include <sys/types.h>
@@ -24,126 +24,137 @@
/*
* startup msg parameters: path length, argument string length
*/
-#define PATH_SIZE 64
-#define ARGV_SIZE 64
+#define PATH_SIZE 64
+#define ARGV_SIZE 64
-/* The various kinds of startup messages are for the various kinds of
+/* The various kinds of startup messages are for the various kinds of
user authentication systems. In the beginning, there was only
STARTUP_MSG and all connections were unauthenticated. Now, there are
- several choices of authentication method (the client picks one, but
+ several choices of authentication method (the client picks one, but
the server needn't necessarily accept it). So now, the STARTUP_MSG
message means to start either an unauthenticated or a host-based
- authenticated connection, depending on what the server prefers. This
+ authenticated connection, depending on what the server prefers. This
is possible because the protocol between server and client is the same
in both cases (basically, no negotiation is required at all).
*/
-typedef enum _MsgType {
- ACK_MSG = 0, /* acknowledge a message */
- ERROR_MSG=1, /* error response to client from server */
- RESET_MSG=2, /* client must reset connection */
- PRINT_MSG=3, /* tuples for client from server */
- NET_ERROR=4, /* error in net system call */
- FUNCTION_MSG=5, /* fastpath call (unused) */
- QUERY_MSG=6, /* client query to server */
- STARTUP_MSG=7, /* initialize a connection with a backend */
- DUPLICATE_MSG=8, /* duplicate msg arrived (errors msg only) */
- INVALID_MSG=9, /* for some control functions */
- STARTUP_KRB4_MSG=10, /* krb4 session follows startup packet */
- STARTUP_KRB5_MSG=11, /* krb5 session follows startup packet */
- STARTUP_HBA_MSG=12, /* use host-based authentication */
- STARTUP_UNAUTH_MSG=13, /* use unauthenticated connection */
- STARTUP_PASSWORD_MSG=14 /* use plaintext password authentication */
- /* insert new values here -- DO NOT REORDER OR DELETE ENTRIES */
- /* also change LAST_AUTHENTICATION_TYPE below and add to the */
- /* authentication_type_name[] array in pqcomm.c */
+typedef enum _MsgType
+{
+ ACK_MSG = 0, /* acknowledge a message */
+ ERROR_MSG = 1, /* error response to client from server */
+ RESET_MSG = 2, /* client must reset connection */
+ PRINT_MSG = 3, /* tuples for client from server */
+ NET_ERROR = 4, /* error in net system call */
+ FUNCTION_MSG = 5, /* fastpath call (unused) */
+ QUERY_MSG = 6, /* client query to server */
+ STARTUP_MSG = 7, /* initialize a connection with a backend */
+ DUPLICATE_MSG = 8, /* duplicate msg arrived (errors msg only) */
+ INVALID_MSG = 9, /* for some control functions */
+ STARTUP_KRB4_MSG = 10, /* krb4 session follows startup packet */
+ STARTUP_KRB5_MSG = 11, /* krb5 session follows startup packet */
+ STARTUP_HBA_MSG = 12, /* use host-based authentication */
+ STARTUP_UNAUTH_MSG = 13, /* use unauthenticated connection */
+ STARTUP_PASSWORD_MSG = 14 /* use plaintext password authentication */
+ /* insert new values here -- DO NOT REORDER OR DELETE ENTRIES */
+ /* also change LAST_AUTHENTICATION_TYPE below and add to the */
+ /* authentication_type_name[] array in pqcomm.c */
} MsgType;
#define LAST_AUTHENTICATION_TYPE 14
-typedef char *Addr;
-typedef int PacketLen; /* packet length */
+typedef char *Addr;
+typedef int PacketLen; /* packet length */
-typedef struct StartupInfo {
-/* PacketHdr hdr; */
- char database[PATH_SIZE]; /* database name */
- char user[NAMEDATALEN]; /* user name */
- char options[ARGV_SIZE]; /* possible additional args */
- char execFile[ARGV_SIZE]; /* possible backend to use */
- char tty[PATH_SIZE]; /* possible tty for debug output*/
-} StartupInfo;
+typedef struct StartupInfo
+{
+/* PacketHdr hdr; */
+ char database[PATH_SIZE]; /* database name */
+ char user[NAMEDATALEN]; /* user name */
+ char options[ARGV_SIZE]; /* possible additional args */
+ char execFile[ARGV_SIZE]; /* possible backend to use */
+ char tty[PATH_SIZE]; /* possible tty for debug output */
+} StartupInfo;
/* amount of available data in a packet buffer */
-#define MESSAGE_SIZE sizeof(StartupInfo) + 5 /* why 5? BJM 2/11/97 */
+#define MESSAGE_SIZE sizeof(StartupInfo) + 5 /* why 5? BJM 2/11/97 */
/* I/O can be blocking or non-blocking */
-#define BLOCKING (FALSE)
+#define BLOCKING (FALSE)
#define NON_BLOCKING (TRUE)
/* a PacketBuf gets shipped from client to server so be careful
- of differences in representation.
+ of differences in representation.
Be sure to use htonl() and ntohl() on the len and msgtype fields! */
-typedef struct PacketBuf {
- int len;
- MsgType msgtype;
- char data[MESSAGE_SIZE];
-} PacketBuf;
-
-/* update the conversion routines
+typedef struct PacketBuf
+{
+ int len;
+ MsgType msgtype;
+ char data[MESSAGE_SIZE];
+} PacketBuf;
+
+/* update the conversion routines
StartupInfo2PacketBuf() and PacketBuf2StartupInfo() (decl. below)
if StartupInfo or PacketBuf structs ever change */
/*
- * socket descriptor port
- * we need addresses of both sides to do authentication calls
+ * socket descriptor port
+ * we need addresses of both sides to do authentication calls
*/
-typedef struct Port {
- int sock; /* file descriptor */
- int mask; /* select mask */
- int nBytes; /* nBytes read in so far */
- struct sockaddr_in laddr; /* local addr (us) */
- struct sockaddr_in raddr; /* remote addr (them) */
-/* PacketBufId id;*/ /* id of packet buf currently in use */
- PacketBuf buf; /* stream implementation (curr pack buf) */
-} Port;
+typedef struct Port
+{
+ int sock; /* file descriptor */
+ int mask; /* select mask */
+ int nBytes; /* nBytes read in so far */
+ struct sockaddr_in laddr; /* local addr (us) */
+ struct sockaddr_in raddr; /* remote addr (them) */
+
+ /*
+ * PacketBufId id;*//* id of packet buf currently in
+ * use
+ */
+ PacketBuf buf; /* stream implementation (curr pack buf) */
+} Port;
/* invalid socket descriptor */
#define INVALID_SOCK (-1)
#define INVALID_ID (-1)
-#define MAX_CONNECTIONS 10
-#define N_PACK_BUFS 20
+#define MAX_CONNECTIONS 10
+#define N_PACK_BUFS 20
/* no multi-packet messages yet */
-#define MAX_PACKET_BACKLOG 1
+#define MAX_PACKET_BACKLOG 1
-#define DEFAULT_STRING ""
+#define DEFAULT_STRING ""
-extern FILE *Pfout, *Pfin;
-extern int PQAsyncNotifyWaiting;
+extern FILE *Pfout,
+ *Pfin;
+extern int PQAsyncNotifyWaiting;
/* in pqcompriv.c */
-int pqGetShort(int *, FILE *);
-int pqGetLong(int *, FILE *);
-int pqGetNBytes(char *, size_t, FILE *);
-int pqGetString(char *, size_t, FILE *);
-int pqGetByte(FILE *);
-
-int pqPutShort(int, FILE *);
-int pqPutLong(int, FILE *);
-int pqPutNBytes(const char *, size_t, FILE *);
-int pqPutString(const char *, FILE *);
-int pqPutByte(int, FILE *);
+int pqGetShort(int *, FILE *);
+int pqGetLong(int *, FILE *);
+int pqGetNBytes(char *, size_t, FILE *);
+int pqGetString(char *, size_t, FILE *);
+int pqGetByte(FILE *);
+
+int pqPutShort(int, FILE *);
+int pqPutLong(int, FILE *);
+int pqPutNBytes(const char *, size_t, FILE *);
+int pqPutString(const char *, FILE *);
+int pqPutByte(int, FILE *);
/*
* prototypes for functions in pqpacket.c
*/
-extern int PacketReceive(Port *port, PacketBuf *buf, char nonBlocking);
-extern int PacketSend(Port *port, PacketBuf *buf,
- PacketLen len, char nonBlocking);
+extern int PacketReceive(Port * port, PacketBuf * buf, char nonBlocking);
+extern int
+PacketSend(Port * port, PacketBuf * buf,
+ PacketLen len, char nonBlocking);
+
/* extern PacketBuf* StartupInfo2PacketBuf(StartupInfo*); */
/* extern StartupInfo* PacketBuf2StartupInfo(PacketBuf*); */
-extern char *name_of_authentication_type(int type);
+extern char *name_of_authentication_type(int type);
-#endif /* PQCOMM_H */
+#endif /* PQCOMM_H */
diff --git a/src/include/libpq/pqsignal.h b/src/include/libpq/pqsignal.h
index 389667c859d..69bdb21df7e 100644
--- a/src/include/libpq/pqsignal.h
+++ b/src/include/libpq/pqsignal.h
@@ -1,24 +1,24 @@
/*-------------------------------------------------------------------------
*
* pqsignal.h--
- * prototypes for the reliable BSD-style signal(2) routine.
+ * prototypes for the reliable BSD-style signal(2) routine.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqsignal.h,v 1.5 1996/12/26 22:08:13 momjian Exp $
+ * $Id: pqsignal.h,v 1.6 1997/09/07 04:58:27 momjian Exp $
*
* NOTES
- * This shouldn't be in libpq, but the monitor and some other
- * things need it...
+ * This shouldn't be in libpq, but the monitor and some other
+ * things need it...
*
*-------------------------------------------------------------------------
*/
#ifndef PQSIGNAL_H
#define PQSIGNAL_H
-typedef void (*pqsigfunc)(int);
+typedef void (*pqsigfunc) (int);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
-#endif /* PQSIGNAL_H */
+#endif /* PQSIGNAL_H */