Header And Logo

PostgreSQL
| The world's most advanced open source database.

libpq.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * libpq.h
00004  *    POSTGRES LIBPQ buffer structure definitions.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/libpq/libpq.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef LIBPQ_H
00015 #define LIBPQ_H
00016 
00017 #include <sys/types.h>
00018 #include <netinet/in.h>
00019 
00020 #include "lib/stringinfo.h"
00021 #include "libpq/libpq-be.h"
00022 
00023 /* ----------------
00024  * PQArgBlock
00025  *      Information (pointer to array of this structure) required
00026  *      for the PQfn() call.  (This probably ought to go somewhere else...)
00027  * ----------------
00028  */
00029 typedef struct
00030 {
00031     int         len;
00032     int         isint;
00033     union
00034     {
00035         int        *ptr;        /* can't use void (dec compiler barfs)   */
00036         int         integer;
00037     }           u;
00038 } PQArgBlock;
00039 
00040 /*
00041  * External functions.
00042  */
00043 
00044 /*
00045  * prototypes for functions in pqcomm.c
00046  */
00047 extern int  StreamServerPort(int family, char *hostName,
00048                  unsigned short portNumber, char *unixSocketDir,
00049                  pgsocket ListenSocket[], int MaxListen);
00050 extern int  StreamConnection(pgsocket server_fd, Port *port);
00051 extern void StreamClose(pgsocket sock);
00052 extern void TouchSocketFiles(void);
00053 extern void pq_init(void);
00054 extern void pq_comm_reset(void);
00055 extern int  pq_getbytes(char *s, size_t len);
00056 extern int  pq_getstring(StringInfo s);
00057 extern int  pq_getmessage(StringInfo s, int maxlen);
00058 extern int  pq_getbyte(void);
00059 extern int  pq_peekbyte(void);
00060 extern int  pq_getbyte_if_available(unsigned char *c);
00061 extern int  pq_putbytes(const char *s, size_t len);
00062 extern int  pq_flush(void);
00063 extern int  pq_flush_if_writable(void);
00064 extern bool pq_is_send_pending(void);
00065 extern int  pq_putmessage(char msgtype, const char *s, size_t len);
00066 extern void pq_putmessage_noblock(char msgtype, const char *s, size_t len);
00067 extern void pq_startcopyout(void);
00068 extern void pq_endcopyout(bool errorAbort);
00069 
00070 /*
00071  * prototypes for functions in be-secure.c
00072  */
00073 extern char *ssl_cert_file;
00074 extern char *ssl_key_file;
00075 extern char *ssl_ca_file;
00076 extern char *ssl_crl_file;
00077 
00078 extern int  secure_initialize(void);
00079 extern bool secure_loaded_verify_locations(void);
00080 extern void secure_destroy(void);
00081 extern int  secure_open_server(Port *port);
00082 extern void secure_close(Port *port);
00083 extern ssize_t secure_read(Port *port, void *ptr, size_t len);
00084 extern ssize_t secure_write(Port *port, void *ptr, size_t len);
00085 
00086 #endif   /* LIBPQ_H */