1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

Clean up th ecompile process by centralizing the include files

- code compile tested, but due to a yet unresolved problem with
          parse.h's creation, compile not completed...
This commit is contained in:
Marc G. Fournier
1996-08-28 07:27:54 +00:00
parent 907c884fe8
commit 870be9fa8e
195 changed files with 97 additions and 13583 deletions

View File

@@ -1,49 +0,0 @@
/*-------------------------------------------------------------------------
*
* auth.h--
* Definitions for network authentication routines
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: auth.h,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef AUTH_H
#define AUTH_H
#include "c.h"
#include "libpq/pqcomm.h"
/*----------------------------------------------------------------
* Common routines and definitions
*----------------------------------------------------------------
*/
/* what we call "no authentication system" */
#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);
extern int be_getauthsvc(MsgType msgtype);
/* the value that matches any dbName value when doing
host based authentication*/
#define ALL_DBNAME "*"
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
#define PG_KRB5_VERSION "PGVER5.1"
#endif /* AUTH_H */

View File

@@ -1,32 +0,0 @@
/*-------------------------------------------------------------------------
*
* be-fsstubs.h--
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: be-fsstubs.h,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef BE_FSSTUBS_H
#define BE_FSSTUBS_H
extern Oid lo_import(text *filename);
extern int4 lo_export(Oid lobjId, text *filename);
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 struct varlena *LOread(int fd, int len);
extern int LOwrite(int fd, struct varlena *wbuf);
#endif /* BE_FSSTUBS_H */

View File

@@ -1,51 +0,0 @@
/*-------------------------------------------------------------------------
*
* libpq-be.h--
* 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.1.1.1 1996/07/09 06:21:30 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQ_BE_H
#define LIBPQ_BE_H
/* ----------------
* include stuff common to fe and be
* ----------------
*/
#include "libpq/libpq.h"
#include "access/htup.h"
#include "access/tupdesc.h"
/* ----------------
* declarations for backend libpq support routines
* ----------------
*/
/* in be-dumpdata.c */
extern void be_portalinit(void);
extern void be_portalpush(PortalEntry *entry);
extern PortalEntry *be_portalpop(void);
extern PortalEntry *be_currentportal();
extern PortalEntry *be_newportal(void);
extern void be_typeinit(PortalEntry *entry, TupleDesc attrs,
int natts);
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 char *strmake(char *str, int len);
extern int pqtest_PQfn(char *q);
extern int32 pqtest(struct varlena *vlena);
#endif /* LIBPQ_BE_H */

View File

@@ -1,119 +0,0 @@
/*-------------------------------------------------------------------------
*
* libpq-fs.h--
* definitions for using Inversion file system routines
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fs.h,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQ_FS_H
#define LIBPQ_FS_H
#include "lib/dllist.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h> /* for O_ on some */
#ifndef WIN32
#include <unistd.h> /* for SEEK_ on most */
#endif /* WIN32 */
#ifndef SEEK_SET
#include <stdio.h> /* for SEEK_ on others */
#endif /* SEEK_SET */
/* UNIX compatibility junk. This should be in all systems' include files,
but this is not always the case. */
#ifndef MAXNAMLEN
#define MAXNAMLEN 255
#endif /* MAXNAMLEN */
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
* 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 */
/* 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_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_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)
#endif /* S_IRUSR */
/*
* Inversion doesn't have links.
*/
#ifndef S_ISLNK
#define S_ISLNK(x) 0
#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.
*/
#define INV_SMGRMASK 0x0000ffff
#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 */

View File

@@ -1,261 +0,0 @@
/*-------------------------------------------------------------------------
*
* libpq.h--
* POSTGRES LIBPQ buffer structure definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq.h,v 1.1.1.1 1996/07/09 06:21:30 scrappy 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
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQ_H
#define LIBPQ_H
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#ifdef WIN32
#include <winsock.h>
#else
#include <netinet/in.h>
#endif /* WIN32 */
#include "lib/dllist.h"
#include "utils/exc.h"
#include "postgres.h"
#include "libpq/pqcomm.h"
/* ----------------
* PQArgBlock --
* 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;
/* ----------------
* TypeBlock --
* 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;
/* ----------------
* TupleBlock --
* 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;
/* ----------------
* GroupBuffer --
* 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;
/* ----------------
* PortalBuffer --
* 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;
/* ----------------
* PortalEntry --
* 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.
* ----------------
*/
#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;
#define PORTALS_INITIAL_SIZE 32
#define PORTALS_GROW_BY 32
/* in portalbuf.c */
extern PortalEntry** portals;
extern size_t portals_array_size;
/*
* 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;
/*
* Exceptions.
*/
#define libpq_raise(X, Y) ExcRaise((Exception *)(X), (ExcDetail) (Y),\
(ExcData)0, (ExcMessage) 0)
/* in portal.c */
extern Exception MemoryError, PortalError, PostquelError, ProtocolError;
/*
* POSTGRES backend dependent Constants.
*/
/* ERROR_MSG_LENGTH should really be the same as ELOG_MAXLEN in utils/elog.h*/
#define ERROR_MSG_LENGTH 4096
#define COMMAND_LENGTH 20
#define REMARK_LENGTH 80
extern char PQerrormsg[ERROR_MSG_LENGTH]; /* in portal.c */
/*
* External functions.
*/
/*
* 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 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 PQNotifyList *PQnotifies(void);
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 PortalBuffer *pbuf_addPortal(void);
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 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 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 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 */

View File

@@ -1,124 +0,0 @@
/*-------------------------------------------------------------------------
*
* pqcomm.h--
* Parameters for the communication module
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pqcomm.h,v 1.1.1.1 1996/07/09 06:21:31 scrappy Exp $
*
* NOTES
* Some of this should move to libpq.h
*
*-------------------------------------------------------------------------
*/
#ifndef PQCOMM_H
#define PQCOMM_H
#include <sys/types.h>
#ifdef WIN32
#include <winsock.h>
#else
#include <netinet/in.h>
#endif /* WIN32 */
#include "postgres.h"
/*
* startup msg parameters: path length, argument string length
*/
#define PATH_SIZE 64
#define ARGV_SIZE 64
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 */
/* insert new values here -- DO NOT REORDER OR DELETE ENTRIES */
} MsgType;
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;
/* amount of available data in a packet buffer */
#define MESSAGE_SIZE sizeof(StartupInfo) + 5
/* I/O can be blocking or non-blocking */
#define BLOCKING (FALSE)
#define NON_BLOCKING (TRUE)
/* a PacketBuf gets shipped from client to server so be careful
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
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
*/
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
/* no multi-packet messages yet */
#define MAX_PACKET_BACKLOG 1
#define DEFAULT_STRING ""
extern FILE *Pfout, *Pfin;
extern int PQAsyncNotifyWaiting;
/*
* prototypes for functions in pqpacket.c
*/
extern int PacketReceive(Port *port, PacketBuf *buf, bool nonBlocking);
extern int PacketSend(Port *port, PacketBuf *buf,
PacketLen len, bool nonBlocking);
/* extern PacketBuf* StartupInfo2PacketBuf(StartupInfo*); */
/* extern StartupInfo* PacketBuf2StartupInfo(PacketBuf*); */
#endif /* PQCOMM_H */

View File

@@ -1,32 +0,0 @@
/*-------------------------------------------------------------------------
*
* pqsignal.h--
* prototypes for the reliable BSD-style signal(2) routine.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pqsignal.h,v 1.1.1.1 1996/07/09 06:21:31 scrappy Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
* things need it...
*
*-------------------------------------------------------------------------
*/
#ifndef PQSIGNAL_H
#define PQSIGNAL_H
#include <signal.h>
#include "c.h"
typedef void (*pqsigfunc)(int);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
#if defined(USE_POSIX_SIGNALS)
#define signal(signo, handler) pqsignal(signo, (pqsigfunc)(handler))
#endif /* USE_POSIX_SIGNALS */
#endif /* PQSIGNAL_H */