/* What a mess.. many systems have added the (now standard) bit types
* in their own ways, so we need to scan a wide variety of headers to
* find them..
- * IMPORTANT: Keep include/squid_types.h syncronised with this list
+ * IMPORTANT: Keep compat/types.h syncronised with this list
*/
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#if STDC_HEADERS
+#if HAVE_LINUX_TYPES_H
+#include <linux/types.h>
+#endif
+#if HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#if HAVE_STDDEF_H
#include <stddef.h>
#endif
#if HAVE_INTTYPES_H
/* POSIX says that <sys/types.h> must be included (by the caller) before
* <regex.h>. */
-#ifdef VMS
- /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- * should be there. */
-#include <stddef.h>
-#endif
-
-
/* The following bits are used to determine the regexp syntax we
* recognize. The set/not-set meanings are chosen so that Emacs syntax
* remains the value 0. The bits are given in alphabetical order, and
fdsetsize.h \
osdetect.h \
stdvarargs.h \
+ types.h \
valgrind.h \
\
os/aix.h \
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if 0
#include "compat/assert.h"
/** On linux this must be defined to get PRId64 and friends */
#define __STDC_FORMAT_MACROS
-#include "squid_types.h"
+#include "compat/types.h"
/*****************************************************/
/* per-OS hacks. One file per OS. */
#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-
-typedef long pid_t;
-
#if defined __USE_FILE_OFFSET64
-typedef int64_t off_t;
typedef uint64_t ino_t;
-
#else
-typedef long off_t;
typedef unsigned long ino_t;
-
#endif
#define INT64_MAX _I64_MAX
#define FD_SETSIZE SQUID_MAXFD
#endif
-#include <stddef.h>
#include <process.h>
#include <errno.h>
#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
#pragma warning (pop)
#endif
#include <io.h>
-#include <stdlib.h>
typedef char * caddr_t;
/*
* WAS: lots of special wrappers labeled only 'protect NEXTSTEP'
- * I'm assuming its an incomplete definition problem on that OS.
- * Or a missing safety wrapper by the looks of the _SQUID_NETDB_H_
+ * I'm assuming its an incomplete definition problem on that OS
+ * or a missing safety wrapper by the looks of the original hack.
*
* Anyway, this file is included before all general non-type headers.
* doing the include here for Next and undefining HAVE_NETDB_H will
* save us from including it again in general.
*/
-// All the hacks included this first without safety wrapping, then netdb.h.
-#include <netinet/in_systm.h>
#if HAVE_NETDB_H
#include <netdb.h>
#endif
#undef HAVE_NETDB_H
#define HAVE_NETDB_H 0
-
#endif /* _SQUID_NEXT_ */
#endif /* SQUID_OS_NEXT_H */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
/*
- * $Id$
- *
* * * * * * * * Legal stuff * * * * * * *
*
* (C) 2000 Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>
* from system locations or various attempts. This is just a convenience
* header to include which takes care of proper preprocessor stuff
*
- * This file is only intended to be included via config.h, do
+ * This file is only intended to be included via compat/compat.h, do
* not include directly.
*/
#if HAVE_LINUX_TYPES_H
#include <linux/types.h>
#endif
-#if STDC_HEADERS
+#if HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#if HAVE_STDDEF_H
#include <stddef.h>
#endif
#if HAVE_INTTYPES_H
#include <netinet/in_systm.h>
#endif
+
+/******************************************************/
+/* Typedefs for missing entries on a system */
+/******************************************************/
+
+
/*
* ISO C99 Standard printf() macros for 64 bit integers
* On some 64 bit platform, HP Tru64 is one, for printf must be used
#endif
#endif
+/* int64_t */
+#ifndef HAVE_INT64_T
+#if HAVE___INT64
+typedef __int64 int64_t;
+#elif HAVE_LONG && SIZEOF_LONG == 8
+typedef long int64_t;
+#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
+typedef long long int64_t;
+#else
+#error NO 64 bit signed type available
+#endif
+#endif
+
+/* u_int64_t */
+#ifndef HAVE_U_INT64_T
+#if HAVE_UINT64_T
+typedef uint64_t u_int64_t;
+#else
+typedef unsigned int64_t u_int64_t;
+#endif
+#endif
+
+/* int32_t */
+#ifndef HAVE_INT32_T
+#if HAVE_INT && SIZEOF_INT == 4
+typedef int int32_t;
+#elif HAVE_LONG && SIZEOF_LONG == 4
+typedef long int32_t;
+#else
+#error NO 32 bit signed type available
+#endif
+#endif
+
+/* u_int32_t */
+#ifndef HAVE_U_INT32_T
+#if HAVE_UINT32_T
+typedef uint32_t u_int32_t;
+#else
+typedef unsigned int32_t u_int32_t;
+#endif
+#endif
+
+/* int16_t */
+#ifndef HAVE_INT16_T
+#if HAVE_SHORT && SIZEOF_SHORT == 2
+typedef short int16_t;
+#elif HAVE_INT && SIZEOF_INT == 2
+typedef int int16_t;
+#else
+#error NO 16 bit signed type available
+#endif
+#endif
+
+/* u_int16_t */
+#ifndef HAVE_U_INT16_T
+#if HAVE_UINT16_T
+typedef uint16_t u_int16_t;
+#else
+typedef unsigned int16_t u_int16_t;
+#endif
+#endif
+
+/* int8_t */
+#ifndef HAVE_INT8_T
+#if HAVE_CHAR && SIZEOF_CHAR == 1
+typedef char int8_t;
+#else
+#error NO 8 bit signed type available
+#endif
+#endif
+
+/* u_int8_t */
+#ifndef HAVE_U_INT8_T
+#if HAVE_UINT8_T
+typedef uint8_t u_int8_t;
+#else
+typedef unsigned char u_int8_t;
+#endif
+#endif
+
+#ifndef HAVE_PID_T
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+typedef long pid_t;
+#else
+typedef int pid_t;
+#endif
+#endif
+
+#ifndef HAVE_SIZE_T
+typedef unsigned int size_t;
+#endif
+
+#ifndef HAVE_SSIZE_T
+typedef int ssize_t;
+#endif
+
+#ifndef HAVE_OFF_T
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+typedef int64_t off_t;
+#else
+typedef long off_t;
+#endif
+#else
+typedef int off_t;
+#endif
+#endif
+
+#ifndef HAVE_MODE_T
+typedef unsigned short mode_t;
+#endif
+
+#ifndef HAVE_FD_MASK
+typedef unsigned long fd_mask;
+#endif
+
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
+#ifndef HAVE_MTYP_T
+typedef long mtyp_t;
+#endif
+
#endif /* SQUID_TYPES_H */
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#endif
-
-/* Typedefs for missing entries on a system */
-
-/* int8_t */
-#ifndef HAVE_INT8_T
-#if HAVE_CHAR && SIZEOF_CHAR == 1
-typedef char int8_t;
-#else
-#error NO 8 bit signed type available
-#endif
-#endif
-
-/* u_int8_t */
-#ifndef HAVE_U_INT8_T
-#if HAVE_UINT8_T
-typedef uint8_t u_int8_t;
-#else
-typedef unsigned char u_int8_t;
-#endif
-#endif
-
-/* int16_t */
-#ifndef HAVE_INT16_T
-#if HAVE_SHORT && SIZEOF_SHORT == 2
-typedef short int16_t;
-#elif HAVE_INT && SIZEOF_INT == 2
-typedef int int16_t;
-#else
-#error NO 16 bit signed type available
-#endif
-#endif
-
-/* u_int16_t */
-#ifndef HAVE_U_INT16_T
-#if HAVE_UINT16_T
-typedef uint16_t u_int16_t;
-#else
-typedef unsigned int16_t u_int16_t;
-#endif
-#endif
-
-/* int32_t */
-#ifndef HAVE_INT32_T
-#if HAVE_INT && SIZEOF_INT == 4
-typedef int int32_t;
-#elif HAVE_LONG && SIZEOF_LONG == 4
-typedef long int32_t;
-#else
-#error NO 32 bit signed type available
-#endif
-#endif
-
-/* u_int32_t */
-#ifndef HAVE_U_INT32_T
-#if HAVE_UINT32_T
-typedef uint32_t u_int32_t;
-#else
-typedef unsigned int32_t u_int32_t;
-#endif
-#endif
-
-/* int64_t */
-#ifndef HAVE_INT64_T
-#if HAVE___INT64
-typedef __int64 int64_t;
-#elif HAVE_LONG && SIZEOF_LONG == 8
-typedef long int64_t;
-#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
-typedef long long int64_t;
-#else
-#error NO 64 bit signed type available
-#endif
-#endif
-
-/* u_int64_t */
-#ifndef HAVE_U_INT64_T
-#if HAVE_UINT64_T
-typedef uint64_t u_int64_t;
-#else
-typedef unsigned int64_t u_int64_t;
-#endif
-#endif
-
-
-#ifndef HAVE_PID_T
-typedef int pid_t;
-#endif
-
-#ifndef HAVE_SIZE_T
-typedef unsigned int size_t;
-#endif
-
-#ifndef HAVE_SSIZE_T
-typedef int ssize_t;
-#endif
-
-#ifndef HAVE_OFF_T
-typedef int off_t;
-#endif
-
-#ifndef HAVE_MODE_T
-typedef unsigned short mode_t;
-#endif
-
-#ifndef HAVE_FD_MASK
-typedef unsigned long fd_mask;
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
-#ifndef HAVE_MTYP_T
-typedef long mtyp_t;
-#endif
-
#if !defined(CACHEMGR_HOSTNAME)
#define CACHEMGR_HOSTNAME ""
#else
*
*/
-#include "squid_types.h"
-
typedef struct SquidMD5Context {
uint32_t buf[4];
uint32_t bytes[2];
*/
#include "config.h"
-#include "squid_types.h"
/*
* Some systems define bswap_16() and bswap_32() in <byteswap.h>
*/
#include "getfullhostname.h"
-#if 0 /* we SHOULD NOT need ALL these here. */
-#if HAVE_LIBC_H
-#include <libc.h>
-#endif
-#if HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-#endif /* 0 */
-
#if HAVE_UNISTD_H
/* for gethostname() function */
#include <unistd.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect on NEXTSTEP */
-#define _SQUID_NETDB_H_
+#if HAVE_NETDB_H
/* for gethostbyname() */
#include <netdb.h>
#endif
/* for RFC 2181 constants */
#include "rfc2181.h"
-/* for xstrncpy() - may need breakign out of there. */
+/* for xstrncpy() - may need breaking out of there. */
#include "util.h"
/**
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STRING_H
#include <string.h>
#endif
#include "profiling.h"
#include "xusleep.h"
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-/*
+/**
* xusleep, as usleep but accepts longer pauses
*/
int
#include "DiskThreads.h"
#include <stdio.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include "squid.h"
#include "squid_windows.h"
+#include "CommIO.h"
#include "DiskThreads.h"
+#include "SquidTime.h"
+#include "Store.h"
#include <stdio.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <signal.h>
-#include "CommIO.h"
-#include "SquidTime.h"
-#include "Store.h"
#define RIDICULOUS_LENGTH 4096
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_MEMORY_H
#include <memory.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
-#define _SQUID_NETDB_H_
+#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_PWD_H
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#endif
#include "config.h"
#include "Icmp.h"
-#if HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "config.h"
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
/**
* Squid pinger Configuration settings
*
#if HAVE_ASSERT_H
#include <assert.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STRING_H
#include <string.h>
#endif
#if HAVE_ARPA_INET_H
-#include <arpa/inet.h> /* inet_ntoa() */
+/* for inet_ntoa() */
+#include <arpa/inet.h>
#endif
#ifdef INET6
#ifdef _SQUID_MSWIN_
#include <ws2tcpip.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
-#define _SQUID_NETDB_H_
-#ifdef _SQUID_NEXT_
-#include <netinet/in_systm.h>
-#endif
+#if HAVE_NETDB_H
#include <netdb.h>
#endif
#endif /* IPF_TRANSPARENT required headers */
#if PF_TRANSPARENT
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#endif /* PF_TRANSPARENT required headers */
#if LINUX_NETFILTER
-#include <linux/types.h>
#include <linux/netfilter_ipv4.h>
#endif
-
/*
* $Id$
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
+#include "config.h"
#include <stdio.h>
#include <fcntl.h>
-#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <signal.h>
-#include "config.h"
-
#define RECV_BUF_SIZE 8192
/*
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_MEMORY_H
#include <memory.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
-#define _SQUID_NETDB_H_
-#ifdef _SQUID_NEXT_
-#include <netinet/in_systm.h>
-#endif
+#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_PATHS_H
#if HAVE_BSTRING_H
#include <bstring.h>
#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_GETOPT_H
#include <getopt.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_MEMORY_H
#include <memory.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
-#define _SQUID_NETDB_H_
+#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_PWD_H
#if HAVE_CRYPT_H
#include <crypt.h>
#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#if HAVE_FNMATCH_H
extern "C" {
#include <fnmatch.h>
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
-#define _SQUID_NETDB_H_
+#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_SIGNAL_H
#include <getopt.h>
#endif
-#include "squid_types.h"
-
#include "util.h"
#include "ip/IpAddress.h"