EXTRA_DIST = auth \
context query_cache\
- parser pool.h pcp pool_type.h pool_config.h protocol rewrite version.h utils watchdog config.h config.h.in pool_config_variables.h
+ parser pool.h pcp pool_type.h pool_config.h protocol rewrite version.h utils watchdog config.h config.h.in pool_config_variables.h pgproto
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = auth \
context query_cache\
- parser pool.h pcp pool_type.h pool_config.h protocol rewrite version.h utils watchdog config.h config.h.in pool_config_variables.h
+ parser pool.h pcp pool_type.h pool_config.h protocol rewrite version.h utils watchdog config.h config.h.in pool_config_variables.h pgproto
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
*/
#include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
#include <libpq-fe.h>
-#include "read.h"
-#include "buffer.h"
+#include "pgproto/read.h"
+#include "pgproto/buffer.h"
/*
* Read integer field and returns it. The pointer in the buffer afer reading
+++ /dev/null
-/*
- * Copyright (c) 2017 Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef BUFFER_H
-
-#define BUFFER_H
-
-#define SKIP_TABS(p) while (*p == '\t') {p++;}
-
-extern int buffer_read_int(char *buf, char **bufp);
-extern char *buffer_read_string(char *buf, char **bufp);
-extern char buffer_read_char(char *buf, char **bufp);
-
-#endif
*/
#include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
#include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
-#include "extended_query.h"
-#include "buffer.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
+#include "pgproto/extended_query.h"
+#include "pgproto/buffer.h"
/*
* Send parse messae. "conn" should at the point right after the message kind
+++ /dev/null
-/*
- * Copyright (c) 2017 Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * Process Parse, Bind, Execute message.
- */
-
-#ifndef EXTENDED_QUERY_H
-#define EXTENDED_QUERY_H
-
-extern void process_parse(char *buf, PGconn *conn);
-extern void process_bind(char *buf, PGconn *conn);
-extern void process_execute(char *buf, PGconn *conn);
-extern void process_describe(char *buf, PGconn *conn);
-extern void process_close(char *buf, PGconn *conn);
-
-#endif
#include <stdint.h>
#include <string.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
static inline void *
pg_malloc_internal(size_t size, int flags)
+++ /dev/null
-/*
- * fe_memutils.h
- * memory management support for frontend code
- *
- * Copyright (c) 2003-2017, PostgreSQL Global Development Group
- *
- * src/include/common/fe_memutils.h
- */
-#ifndef FE_MEMUTILS_H
-#define FE_MEMUTILS_H
-
-typedef size_t Size;
-
-/*
- * Flags for pg_malloc_extended and palloc_extended, deliberately named
- * the same as the backend flags.
- */
-#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) not
- * actually used for frontends */
-#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */
-#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */
-
-/*
- * "Safe" memory allocation functions --- these exit(1) on failure
- * (except pg_malloc_extended with MCXT_ALLOC_NO_OOM)
- */
-extern char *pg_strdup(const char *in);
-extern void *pg_malloc(size_t size);
-extern void *pg_malloc0(size_t size);
-extern void *pg_malloc_extended(size_t size, int flags);
-extern void *pg_realloc(void *pointer, size_t size);
-extern void pg_free(void *pointer);
-
-/* Equivalent functions, deliberately named the same as backend functions */
-extern char *pstrdup(const char *in);
-extern void *palloc(Size size);
-extern void *palloc0(Size size);
-extern void *palloc_extended(Size size, int flags);
-extern void *repalloc(void *pointer, Size size);
-extern void pfree(void *pointer);
-
-#ifdef NOT_USED
-/* sprintf into a palloc'd buffer --- these are in psprintf.c */
-extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
-extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
-#endif
-
-#define MEMSET_LOOP_LIMIT 1024
-
-/*
- * MemSet
- * Exactly the same as standard library function memset(), but considerably
- * faster for zeroing small word-aligned structures (such as parsetree nodes).
- * This has to be a macro because the main point is to avoid function-call
- * overhead. However, we have also found that the loop is faster than
- * native libc memset() on some platforms, even those with assembler
- * memset() functions. More research needs to be done, perhaps with
- * MEMSET_LOOP_LIMIT tests in configure.
- */
-#define MemSet(start, val, len) \
- do \
- { \
- /* must be void* because we don't know if it is integer aligned yet */ \
- void *_vstart = (void *) (start); \
- int _val = (val); \
- Size _len = (len); \
-\
- if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
- (_len & LONG_ALIGN_MASK) == 0 && \
- _val == 0 && \
- _len <= MEMSET_LOOP_LIMIT && \
- /* \
- * If MEMSET_LOOP_LIMIT == 0, optimizer should find \
- * the whole "if" false at compile time. \
- */ \
- MEMSET_LOOP_LIMIT != 0) \
- { \
- long *_start = (long *) _vstart; \
- long *_stop = (long *) ((char *) _start + _len); \
- while (_start < _stop) \
- *_start++ = 0; \
- } \
- else \
- memset(_vstart, _val, _len); \
- } while (0)
-
-/* originaly gettext staff */
-#define _(x) x
-
-/* Get a bit mask of the bits set in non-long aligned addresses */
-#define LONG_ALIGN_MASK (sizeof(long) - 1)
-
-#endif /* FE_MEMUTILS_H */
*/
#include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
#include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
-#include "buffer.h"
-#include "extended_query.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
+#include "pgproto/buffer.h"
+#include "pgproto/extended_query.h"
#undef DEBUG
+++ /dev/null
-/*
- * Copyright (c) 2017-2018 Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef PGPROTO_H
-#define PGPROTO_H
-
-/*
- * The default file name for protocol data to be sent from frontend to backend
- */
-#define PGPROTODATA "pgproto.data"
-
-#define MAXENTRIES 128
-
-/*
- * Protocol data representation read from the data file.
- * We assume that the protocol version is V3.
- */
-typedef struct
-{
- char type; /* message type */
- int size; /* message length excluding this (in host
- * order) */
- char message[1]; /* actual message (variable length) */
-} PROTO_DATA;
-
-extern int read_nap;
-
-#endif /* PGPROTO_H */
*/
#include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
#include <libpq-fe.h>
-#include "read.h"
+#include "pgproto/read.h"
static char read_char(PGconn *conn);
static int read_int32(PGconn *conn);
+++ /dev/null
-/*
- * Copyright (c) 2017 Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef READ_H
-#define READ_H
-
-extern void read_until_ready_for_query(PGconn *conn, int check_input);
-#endif
*/
#include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <arpa/inet.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
#include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
/*
* Send a character to the connection.
+++ /dev/null
-/*
- * Copyright (c) 2017 Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef SEND_H
-#define SEND_H
-
-extern void send_char(char c, PGconn *conn);
-extern void send_int(int intval, PGconn *conn);
-extern void send_int16(short shortval, PGconn *conn);
-extern void send_string(char *buf, PGconn *conn);
-extern void send_byte(char *buf, int len, PGconn *conn);
-
-#endif