*/
==============================================================================
+
+compat/strsep.h, lib/strsep.c
+
+ * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
+ *
+ * The file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+
+==============================================================================
+
# Port Specific Configurations
noinst_LTLIBRARIES = libcompat.la
-
libcompat_la_SOURCES = \
assert.h \
compat.h \
compat_shared.h \
debug.h \
+ drand48.h \
+ eui64_aton.h \
fdsetsize.h \
+ getaddrinfo.h \
+ getnameinfo.h \
+ inet_ntop.h \
+ inet_pton.h \
+ initgroups.h \
osdetect.h \
stdvarargs.h \
+ strsep.h \
+ strtoll.h \
+ tempnam.h \
types.h \
unsafe.h \
valgrind.h \
#endif /* __cplusplus */
#endif /* max */
-/**
- * tempnam() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_TEMPNAM
-#include "tempnam.h"
-#endif
-
-/**
- * strsep() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_STRSEP
-#include "strsep.h"
-#endif
-
-/**
- * strtoll() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_STRTOLL
-#include "strtoll.h"
-#endif
-
/**
* Common shared definition of what whitespace consists of for string tests
*/
#define w_space " \t\n\r"
-/**
- * initgroups() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
-
#ifndef SQUID_NONBLOCK
/* REQUIRED for the below logics. If they move this needs to as well */
--- /dev/null
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_DRAND48_H
+#define _SQUID_DRAND48_H
+
+#if !HAVE_DRAND48
+#define HAVE_DRAND48 1
+SQUIDCEXTERN double drand48(void);
+#endif
+
+#endif
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+/* If we have this system file use it. Otherwise use the below definitions. */
+#if HAVE_SYS_EUI64_H
+#include <sys/eui64.h>
+#else
+
/*
* Squid Change History:
*
#ifndef _SYS_EUI64_H
#define _SYS_EUI64_H
-#include <sys/types.h>
-
/**
* Size of the ASCII representation of an EUI-64.
*/
int eui64_aton(const char *a, struct eui64 *e);
#endif /* !_SYS_EUI64_H */
+#endif /* HAVE_SYS_EUI64_H */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef _getaddrinfo_h
#define _getaddrinfo_h
* Original License and code follows.
*/
-#include "config.h"
-
/*
* This file is part of libESMTP, a library for submission of RFC 2822
* formatted electronic mail messages using the SMTP protocol described
/* Structure and prototypes taken from RFC 2553 */
-#ifdef HAVE_GETADDRINFO
-
/* These functions are provided by the OS */
-#define xgetaddrinfo getaddrinfo
-#define xfreeaddrinfo freeaddrinfo
-#define xgai_strerror gai_strerror
-
-#else /* !HAVE_GETADDRINFO */
+#if !HAVE_GETADDRINFO
/* SG 23/09/2007:
On Windows the following definitions are already available, may be that
/* RFC 2553 / Posix resolver */
SQUIDCEXTERN int xgetaddrinfo (const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
+#define getaddrinfo xgetaddrinfo
/* Free addrinfo structure and associated storage */
SQUIDCEXTERN void xfreeaddrinfo (struct addrinfo *ai);
+#define freeaddrinfo xfreeaddrinfo
/* Convert error return from getaddrinfo() to string */
SQUIDCEXTERN const char *xgai_strerror (int code);
+#define gai_strerror xgai_strerror
#endif /* HAVE_GETADDRINFO */
-
-#endif
+#endif /* _getaddrinfo_h */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef _getnameinfo_h
#define _getnameinfo_h
/*
* Reconstructed from KAME getnameinfo.c (in lib/)
- *
- * $Id$
*/
-#include "config.h"
-
-#ifdef HAVE_GETNAMEINFO
-
-/* These functions are provided by the OS */
-#define xgetnameinfo getnameinfo
-
-#else /* !HAVE_GETNAMEINFO */
+#if !HAVE_GETNAMEINFO
/* RFC 2553 / Posix resolver */
SQUIDCEXTERN int xgetnameinfo(const struct sockaddr *sa,
char *serv,
size_t servlen,
int flags );
+#define getnameinfo xgetnameinfo
#endif /* HAVE_GETNAMEINFO */
-
-#endif
+#endif /* _getnameinfo_h */
-#ifndef _INC_INET_NTOP_H
-#define _INC_INET_NTOP_H
-
+#ifndef SQUID_CONFIG_H
#include "config.h"
+#endif
-#if HAVE_INET_NTOP
+#ifndef _INC_INET_NTOP_H
+#define _INC_INET_NTOP_H
/* Use the system provided version where possible */
-#define xinet_ntop inet_ntop
-
-#else
+#if !HAVE_INET_NTOP
/* char *
* inet_ntop(af, src, dst, size)
* Paul Vixie, 1996.
*/
SQUIDCEXTERN const char * xinet_ntop(int af, const void *src, char *dst, size_t size);
+#define inet_ntop xinet_ntop
#endif
-
#endif /* _INC_INET_NTOP_H */
-#ifndef _INC_INET_PTON_H
-#define _INC_INET_PTON_H
-
+#ifndef SQUID_CONFIG_H
#include "config.h"
+#endif
-#if HAVE_INET_PTON
+#ifndef _INC_INET_PTON_H
+#define _INC_INET_PTON_H
/* Use the system provided version where possible */
-#define xinet_pton inet_pton
-
-#else
+#if !HAVE_INET_PTON
/* int
* inet_pton(af, src, dst)
* Paul Vixie, 1996.
*/
SQUIDCEXTERN int xinet_pton(int af, const char *src, void *dst);
+#define inet_pton xinet_pton
#endif
-
#endif /* _INC_INET_NTOP_H */
-/*
- * $Id$
- */
-#ifndef SQUID_INITGROUPS_H
-#define SQUID_INITGROUPS_H
-
-#include "config.h"
-
-/* if you have configure you can use this */
-#if defined(HAVE_CONFIG_H)
+#ifndef SQUID_CONFIG_H
#include "config.h"
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#ifndef SQUID_INITGROUPS_H
+#define SQUID_INITGROUPS_H
+
+#if !HAVE_INITGROUPS
SQUIDCEXTERN int initgroups(const char *user, gid_t group);
+#endif
#endif /* SQUID_INITGROPS_H */
SQUIDCEXTERN THREADLOCAL int ws32_result;
#define strerror(e) WIN32_strerror(e)
+#define HAVE_STRERROR 1
#ifdef __cplusplus
#define SQUID_NO_ALLOC_PROTECT 1
#endif
+/* NetBSD does not provide sys_errlist global for strerror */
+#define NEED_SYS_ERRLIST 1
+
#endif /* _SQUID_NETBSD_ */
#endif /* SQUID_OS_NETBSD_H */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
/* Copyright (C) 2004 Free Software Foundation, Inc.
* Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
*
#ifndef GNULIB_STRSEP_H_
#define GNULIB_STRSEP_H_
-#include "config.h"
-
#if HAVE_STRSEP
/*
#else
/**
-\par
-Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
-If one is found, it is overwritten with a NULL, and *STRINGP is advanced
-to point to the next char after it. Otherwise, *STRINGP is set to NULL.
-If *STRINGP was already NULL, nothing happens.
-Returns the old value of *STRINGP.
-\par
-This is a variant of strtok() that is multithread-safe and supports
-empty fields.
-
-\note Caveat: It modifies the original string.
-\note Caveat: These functions cannot be used on constant strings.
-\note Caveat: The identity of the delimiting character is lost.
-\note Caveat: It doesn't work with multibyte strings unless all of the delimiter
-characters are ASCII characters < 0x30.
-
-See also strtok_r().
-*/
+ *\par
+ * Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
+ * If one is found, it is overwritten with a NULL, and *STRINGP is advanced
+ * to point to the next char after it. Otherwise, *STRINGP is set to NULL.
+ * If *STRINGP was already NULL, nothing happens.
+ * Returns the old value of *STRINGP.
+ *
+ *\par
+ * This is a variant of strtok() that is multithread-safe and supports
+ * empty fields.
+ *
+ * \note Caveat: It modifies the original string.
+ * \note Caveat: These functions cannot be used on constant strings.
+ * \note Caveat: The identity of the delimiting character is lost.
+ * \note Caveat: It doesn't work with multibyte strings unless all of the delimiter
+ * characters are ASCII characters < 0x30.
+ *
+ * See also strtok_r().
+ */
SQUIDCEXTERN char *strsep(char **stringp, const char *delim);
#endif /* HAVE_STRSEP */
-
#endif /* GNULIB_STRSEP_H_ */
--- /dev/null
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_COMPAT_STRTOLL_H
+#define _SQUID_COMPAT_STRTOLL_H
+
+#if !HAVE_STRTOLL
+
+/**
+ *\par
+ * Convert a string to a int64 integer.
+ *
+ *\par
+ * Ignores `locale' stuff. Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+SQUIDCEXTERN int64_t strtoll(const char *nptr, char **endptr, int base);
+
+#endif /* !HAVE_STRTOLL */
+#endif /* _SQUID_COMPAT_STRTOLL_H */
/*
- * $Id$
- */
-
-
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+ * Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
* This file is part of the GNU C Library.
* The GNU C Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* You should have received a copy of the GNU Library General Public
* License along with the GNU C Library; see the file COPYING.LIB. If
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
- * Cambridge, MA 02139, USA. */
+ * Cambridge, MA 02139, USA.
+ */
+
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
#ifndef SQUID_TEMPNAM_H
#define SQUID_TEMPNAM_H
+
extern char *tempnam(const char *, const char *);
+
#endif /* SQUID_TEMPNAM_H */
* Hosted at http://sourceforge.net/projects/squidkerbauth
*/
#include "config.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
#if HAVE_GSSAPI
#include "util.h"
#include "base64.h"
-#include "getaddrinfo.h"
-#include "getnameinfo.h"
#if HAVE_GSSAPI_GSSAPI_H
#include <gssapi/gssapi.h>
LogTime(), PROGRAM, hostname);
return NULL;
}
- rc = xgetaddrinfo(hostname, NULL, NULL, &hres);
+ rc = getaddrinfo(hostname, NULL, NULL, &hres);
if (rc != 0) {
fprintf(stderr,
"%s| %s: ERROR: resolving hostname with getaddrinfo: %s failed\n",
- LogTime(), PROGRAM, xgai_strerror(rc));
+ LogTime(), PROGRAM, gai_strerror(rc));
return NULL;
}
hres_list = hres;
count++;
hres_list = hres_list->ai_next;
}
- rc = xgetnameinfo(hres->ai_addr, hres->ai_addrlen, hostname,
+ rc = getnameinfo(hres->ai_addr, hres->ai_addrlen, hostname,
sizeof(hostname), NULL, 0, 0);
if (rc != 0) {
fprintf(stderr,
"%s| %s: ERROR: resolving ip address with getnameinfo: %s failed\n",
- LogTime(), PROGRAM, xgai_strerror(rc));
- xfreeaddrinfo(hres);
+ LogTime(), PROGRAM, gai_strerror(rc));
+ freeaddrinfo(hres);
return NULL;
}
- xfreeaddrinfo(hres);
+ freeaddrinfo(hres);
hostname[sysconf(_SC_HOST_NAME_MAX) - 1] = '\0';
return (xstrdup(hostname));
}
+++ /dev/null
-/*
- * $Id$
- */
-#ifndef _SQUIDINC_STRTOLL_H
-#define _SQUIDINC_STRTOLL_H
-
-#include "config.h"
-
-#if HAVE_STRTOLL
-
-/*
- * Get strtoll() declaration.
- */
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#else
-
-/**
-\par
-* Convert a string to a int64 integer.
-\par
-* Ignores `locale' stuff. Assumes that the upper and lower case
-* alphabets and digits are each contiguous.
-*/
-SQUIDCEXTERN int64_t strtoll(const char *nptr, char **endptr, int base);
-
-#endif /* !HAVE_STRTOLL */
-
-#endif /* _SQUIDINC_STRTOLL_H */
SQUIDCEXTERN const char *xitoa(int num);
SQUIDCEXTERN const char *xint64toa(int64_t num);
-#if !HAVE_DRAND48
-SQUIDCEXTERN double drand48(void);
-#endif
-
typedef struct {
size_t count;
size_t bytes;
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
+#include "compat/getaddrinfo.h"
+#include "compat/inet_pton.h"
+
#if HAVE_STRING_H
#include <string.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
-
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <ws2tcpip.h>
#endif
-#include "getaddrinfo.h"
-#include "inet_pton.h"
-
static struct addrinfo *
dup_addrinfo (struct addrinfo *info, void *addr, size_t addrlen) {
struct addrinfo *ret;
return (*res == NULL) ? EAI_MEMORY : 0;
}
- /* If AI_NUMERIC is specified, use xinet_pton to translate numbers and
+ /* If AI_NUMERIC is specified, use inet_pton to translate numbers and
dots notation. */
if (hints->ai_flags & AI_NUMERICHOST) {
struct sockaddr_in sin;
sin.sin_family = result.ai_family;
sin.sin_port = htons (port);
- if (xinet_pton(result.ai_family, nodename, &sin.sin_addr))
+ if (inet_pton(result.ai_family, nodename, &sin.sin_addr))
return EAI_NONAME;
sin.sin_addr.s_addr = inet_addr (nodename);
/* Duplicate result and addr and return */
if (gethostname(buf, RFC2181_MAXHOSTNAMELEN) < 0)
return NULL;
- /** \todo convert this to a xgetaddrinfo() call */
+ /** \todo convert this to a getaddrinfo() call */
if ((hp = gethostbyname(buf)) != NULL)
xstrncpy(buf, hp->h_name, RFC2181_MAXHOSTNAMELEN);
return buf;
#ifndef HAVE_GETNAMEINFO
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
+
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#include <ws2tcpip.h>
#endif
-#include "getaddrinfo.h"
-
-#if !HAVE_INET_NTOP
-#include "inet_ntop.h"
-#endif
-
static const struct afd {
int a_af;
int a_addrlen;
}
#endif
default:
- if (xinet_ntop(afd->a_af, addr, host,
+ if (inet_ntop(afd->a_af, addr, host,
hostlen) == NULL)
return EAI_SYSTEM;
break;
int numaddrlen;
char numaddr[512];
- if (xinet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
+ if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
return EAI_SYSTEM;
numaddrlen = strlen(numaddr);
#include "config.h"
+#include "compat/initgroups.h"
#if HAVE_GRP_H
#include <grp.h>
#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
int initgroups(const char *name, gid_t basegid)
{
*/
#include "config.h"
+#include "compat/inet_pton.h"
#include "util.h"
#if HAVE_STDIO_H
((struct sockaddr_in6 *)S)->sin6_family = AF_INET6;
((struct sockaddr_in6 *)S)->sin6_port = htons(atoi(argv[var+1]));
- if ( ! xinet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) )
+ if ( ! inet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) )
perror("listen address");
return 1;
}
((struct sockaddr_in *)S)->sin_family = AF_INET;
((struct sockaddr_in *)S)->sin_port = htons(atoi(argv[var+1]));
- if ( ! xinet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) )
+ if ( ! inet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) )
perror("listen address");
return 1;
}
memset(buf, '\0', 512);
sz = 512;
- if (xinet_pton(AF_INET6, input, &junk6)) {
+ if (inet_pton(AF_INET6, input, &junk6)) {
sid = rfc1035BuildPTRQuery6(junk6, buf, &sz);
sidb=0;
- } else if (xinet_pton(AF_INET, input, &junk4)) {
+ } else if (inet_pton(AF_INET, input, &junk4)) {
sid = rfc1035BuildPTRQuery4(junk4, buf, &sz);
sidb=0;
} else {
#endif
extern int sys_nerr;
-#if NEED_SYS_ERRLIST && !defined(_SQUID_NETBSD_)
+
+#if NEED_SYS_ERRLIST
extern char *sys_errlist[];
#endif
-/*
- * $Id$
- */
-
/* Copyright (C) 2004 Free Software Foundation, Inc.
* Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
*
* USA.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Specification. */
-#include "strsep.h"
+#include "config.h"
+#include "compat/strsep.h"
#include <string.h>
char *
-strsep (char **stringp, const char *delim)
+strsep(char **stringp, const char *delim)
{
char *start = *stringp;
char *ptr;
/* modified for long long <mgd@swarm.org> 1999-08-12 */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
+#include "compat/strtoll.h"
+
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <errno.h>
#endif
-/* Specification. */
-#include "strtoll.h"
-
#ifndef INT64_MIN
/* Native 64 bit system without strtoll() */
-/*
- * $Id$
- */
-
/* A reasonably functional tmpnam. */
/* Originally by Tom Hageman, tom@basil.icce.rug.nl */
*/
#include "config.h"
+#include "compat/tempnam.h"
#if HAVE_LIBC_H
#include <libc.h>
#if HAVE_STDIO_H
#include <stdio.h>
#endif
-#if HAVE_TYPES_H
-#include <sys/types.h>
-#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
-
/*
* $Id$
*
*/
#include "squid.h"
-#include "HttpHeader.h"
-#include "HttpHdrContRange.h"
#include "acl/FilledChecklist.h"
+#include "compat/strtoll.h"
+#include "HttpHdrContRange.h"
+#include "HttpHeader.h"
#include "MemBuf.h"
static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs);
-
/*
* $Id$
*
*
*/
+#include "config.h"
+#include "compat/strtoll.h"
#include "Parsing.h"
/*
-
/*
* $Id$
*
*/
#include "squid.h"
+#include "compat/strtoll.h"
#include "SwapDir.h"
#include "StoreFileSystem.h"
#include "ConfigOption.h"
*/
#include "squid.h"
+#include "compat/getaddrinfo.h"
#include "acl/Ip.h"
#include "acl/Checklist.h"
#include "MemBuf.h"
addr2[0] = '\0';
} else if (sscanf(t, "%s", addr1) == 1) {
/*
- * Note, must use plain xgetaddrinfo() here because at startup
+ * Note, must use plain getaddrinfo() here because at startup
* ipcache hasn't been initialized
* TODO: offload this to one of the IpAddress lookups.
*/
hints.ai_flags |= AI_V4MAPPED | AI_ALL;
#endif
- int errcode = xgetaddrinfo(addr1,NULL,&hints,&hp);
+ int errcode = getaddrinfo(addr1,NULL,&hints,&hp);
if (hp == NULL) {
debugs(28, 0, "aclIpParseIpData: Bad host/IP: '" << addr1 <<
"' in '" << t << "', flags=" << hints.ai_flags <<
- " : (" << errcode << ") " << xgai_strerror(errcode) );
+ " : (" << errcode << ") " << gai_strerror(errcode) );
self_destruct();
return NULL;
}
return NULL;
}
- xfreeaddrinfo(hp);
+ freeaddrinfo(hp);
return q;
}
*/
#include "squid.h"
-#include "clientStream.h"
-#include "client_side_request.h"
-#include "auth/UserRequest.h"
-#include "HttpRequest.h"
-#include "ProtoPort.h"
#include "acl/FilledChecklist.h"
#include "acl/Gadgets.h"
-#include "client_side.h"
-#include "client_side_reply.h"
-#include "Store.h"
-#include "HttpReply.h"
-#include "MemObject.h"
-#include "ClientRequestContext.h"
-#include "SquidTime.h"
-#include "wordlist.h"
-#include "inet_pton.h"
-#include "fde.h"
-
#if USE_ADAPTATION
#include "adaptation/AccessCheck.h"
#include "adaptation/Iterator.h"
#if ICAP_CLIENT
#include "adaptation/icap/History.h"
#endif
-//static void adaptationAclCheckDoneWrapper(Adaptation::ServicePointer service, void *data);
#endif
-
+#include "auth/UserRequest.h"
+#include "clientStream.h"
+#include "client_side.h"
+#include "client_side_reply.h"
+#include "client_side_request.h"
+#include "ClientRequestContext.h"
+#include "compat/inet_pton.h"
+#include "fde.h"
+#include "HttpReply.h"
+#include "HttpRequest.h"
+#include "MemObject.h"
+#include "ProtoPort.h"
+#include "Store.h"
+#include "SquidTime.h"
+#include "wordlist.h"
#if LINGERING_CLOSE
*/
#include "config.h"
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
#if HAVE_UNISTD_H
#include <unistd.h>
hints.ai_flags = AI_CANONNAME;
for (;;) {
- xfreeaddrinfo(AI);
+ freeaddrinfo(AI);
AI = NULL;
- if ( 0 == (res = xgetaddrinfo(buf,NULL,&hints,&AI)) )
+ if ( 0 == (res = getaddrinfo(buf,NULL,&hints,&AI)) )
break;
if (res != EAI_AGAIN)
/* annoying inet_ntop breaks the nice code by requiring the in*_addr */
switch (aiptr->ai_family) {
case AF_INET:
- xinet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN);
+ inet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN);
break;
#if USE_IPV6
case AF_INET6:
- xinet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN);
+ inet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN);
break;
#endif
default:
*/
if (NULL != AI && NULL != AI->ai_addr) {
for (;;) {
- if ( 0 == (res = xgetnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) )
+ if ( 0 == (res = getnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) )
break;
if (res != EAI_AGAIN)
break;
case EAI_FAIL:
- printf("$fail DNS Domain/IP '%s' does not exist: %s.\n", buf, xgai_strerror(res));
+ printf("$fail DNS Domain/IP '%s' does not exist: %s.\n", buf, gai_strerror(res));
break;
#if defined(EAI_NODATA) || defined(EAI_NONAME)
#ifdef EAI_NONAME
case EAI_NONAME:
#endif
- printf("$fail DNS Domain/IP '%s' exists without any FQDN/IPs: %s.\n", buf, xgai_strerror(res));
+ printf("$fail DNS Domain/IP '%s' exists without any FQDN/IPs: %s.\n", buf, gai_strerror(res));
break;
#endif
default:
- printf("$fail A system error occured looking up Domain/IP '%s': %s.\n", buf, xgai_strerror(res));
+ printf("$fail A system error occured looking up Domain/IP '%s': %s.\n", buf, gai_strerror(res));
}
- xfreeaddrinfo(AI);
+ freeaddrinfo(AI);
}
/**
#if USE_SQUID_EUI
+#include "compat/eui64_aton.h"
#include "Debug.h"
#include "eui/Eui64.h"
#include "globals.h"
#include "ip/IpAddress.h"
-#if HAVE_SYS_EUI64_H
-#include <sys/eui64.h>
-#else
-#include "eui64_aton.h"
-#endif
-
bool
Eui::Eui64::decode(const char *asc)
{
*
*/
-#include "event.h"
+#include "config.h"
+#include "compat/drand48.h"
#include "CacheManager.h"
+#include "event.h"
#include "Store.h"
#include "SquidTime.h"
#include "squid.h"
#include "comm.h"
#include "comm/ListenStateData.h"
+#include "compat/strtoll.h"
#include "ConnectionDetail.h"
#include "errorpage.h"
#include "fde.h"
*/
#include "config.h"
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
#include "Debug.h"
#include "ip/IpAddress.h"
#include "util.h"
-
#if HAVE_ASSERT_H
#include <assert.h>
#endif
want.ai_family = AF_INET;
#endif
- if ( (err = xgetaddrinfo(s, NULL, &want, &res)) != 0) {
- debugs(14,3, HERE << "Given Bad IP '" << s << "': " << xgai_strerror(err) );
- /* free the memory xgetaddrinfo() dynamically allocated. */
+ if ( (err = getaddrinfo(s, NULL, &want, &res)) != 0) {
+ debugs(14,3, HERE << "Given Bad IP '" << s << "': " << gai_strerror(err) );
+ /* free the memory getaddrinfo() dynamically allocated. */
if (res) {
- xfreeaddrinfo(res);
+ freeaddrinfo(res);
res = NULL;
}
return false;
operator=(*res);
SetPort(port);
- /* free the memory xgetaddrinfo() dynamically allocated. */
- xfreeaddrinfo(res);
+ /* free the memory getaddrinfo() dynamically allocated. */
+ freeaddrinfo(res);
res = NULL;
#if USE_IPV6
if ( force == AF_INET6 || (force == AF_UNSPEC && IsIPv6()) ) {
- xinet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen);
+ inet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen);
} else if ( force == AF_INET || (force == AF_UNSPEC && IsIPv4()) ) {
struct in_addr tmp;
GetInAddr(tmp);
- xinet_ntop(AF_INET, &tmp, buf, blen);
+ inet_ntop(AF_INET, &tmp, buf, blen);
#else
if ( force == AF_UNSPEC || (force == AF_INET && IsIPv4()) ) {
- xinet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen);
+ inet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen);
#endif
} else {
debugs(14,0,"WARNING: Corrupt IP Address details OR required to display in unknown format (" <<
#ifndef _INC_IPADDRESS_H
#define _INC_IPADDRESS_H
-#include "getaddrinfo.h"
-#include "getnameinfo.h"
-#include "inet_ntop.h"
-#include "inet_pton.h"
-
+#include "config.h"
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#include "config.h"
+#include "compat/getaddrinfo.h"
#include "testIpAddress.h"
#include "ip/IpAddress.h"
IpAddress anIP = "127.0.0.1";
/* assert this just to check that getaddrinfo is working properly */
- CPPUNIT_ASSERT( xgetaddrinfo("127.0.0.1", NULL, &hints, &expect ) == 0 );
+ CPPUNIT_ASSERT( getaddrinfo("127.0.0.1", NULL, &hints, &expect ) == 0 );
anIP.GetAddrInfo(ipval);
CPPUNIT_ASSERT( memcmp( expect->ai_addr, ipval->ai_addr, expect->ai_addrlen ) == 0 );
- xfreeaddrinfo(expect);
+ freeaddrinfo(expect);
}
void
*
*/
#include "squid.h"
-#include "comm.h"
-#include "cache_snmp.h"
#include "acl/FilledChecklist.h"
+#include "cache_snmp.h"
+#include "comm.h"
+#include "compat/strsep.h"
#include "ip/IpAddress.h"
#define SNMP_REQUEST_SIZE 4096
#endif
#include "md5.h"
-
#if USE_SSL
#include "ssl_support.h"
#endif
-
#ifdef SQUID_SNMP
#include "cache_snmp.h"
#endif
-
#include "hash.h"
#include "rfc3596.h"
-
-
#include "defines.h"
#include "enums.h"
#include "typedefs.h"
#include "util.h"
#include "profiling.h"
#include "MemPool.h"
-
#include "ip/IpAddress.h"
-
-#if !HAVE_TEMPNAM
-#include "tempnam.h"
-#endif
-
-#if !HAVE_STRSEP
-#include "strsep.h"
-#endif
-
-#if !HAVE_STRTOLL
-#include "strtoll.h"
-#endif
-
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
-
#include "structs.h"
#include "protos.h"
#include "globals.h"
*/
#include "squid.h"
-#include "ProtoPort.h"
-#include "SwapDir.h"
+#include "compat/initgroups.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
+#include "compat/tempnam.h"
#include "fde.h"
+#include "ip/IpIntercept.h"
#include "MemBuf.h"
-#include "wordlist.h"
+#include "ProtoPort.h"
#include "SquidMath.h"
#include "SquidTime.h"
-#include "ip/IpIntercept.h"
+#include "SwapDir.h"
+#include "wordlist.h"
#if HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
sa.GetAddrInfo(AI);
/* we are looking for a name. */
- if (xgetnameinfo(AI->ai_addr, AI->ai_addrlen, host, SQUIDHOSTNAMELEN, NULL, 0, NI_NAMEREQD ) == 0) {
+ if (getnameinfo(AI->ai_addr, AI->ai_addrlen, host, SQUIDHOSTNAMELEN, NULL, 0, NI_NAMEREQD ) == 0) {
/* DNS lookup successful */
/* use the official name from DNS lookup */
debugs(50, 4, "getMyHostname: resolved " << sa << " to '" << host << "'");
memset(&hints, 0, sizeof(addrinfo));
hints.ai_flags = AI_CANONNAME;
- if (xgetaddrinfo(host, NULL, NULL, &AI) == 0) {
+ if (getaddrinfo(host, NULL, NULL, &AI) == 0) {
/* DNS lookup successful */
/* use the official name from DNS lookup */
debugs(50, 6, "getMyHostname: '" << host << "' has rDNS.");
/* AYJ: do we want to flag AI_ALL and cache the result anywhere. ie as our local host IPs? */
if (AI) {
- xfreeaddrinfo(AI);
+ freeaddrinfo(AI);
AI = NULL;
}
return host;
}
- if (AI) xfreeaddrinfo(AI);
+ if (AI) freeaddrinfo(AI);
debugs(50, 1, "WARNING: '" << host << "' rDNS test failed: " << xstrerror());
}
}
#if USE_WCCPv2
#include "comm.h"
+#include "compat/strsep.h"
#include "event.h"
+#include "ip/IpAddress.h"
#include "Parsing.h"
#include "Store.h"
#include "SwapDir.h"
-#include "ip/IpAddress.h"
#if HAVE_NETDB_H
#include <netdb.h>
-
#include "config.h"
-
-/*
- * On some systems, FD_SETSIZE is set to something lower than the
- * actual number of files which can be opened. IRIX is one case,
- * NetBSD is another. So here we increase FD_SETSIZE to our
- * configure-discovered maximum *before* any system includes.
- */
-#define CHANGE_FD_SETSIZE 1
-
-/* Cannot increase FD_SETSIZE on Linux */
-#if defined(_SQUID_LINUX_)
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-
-/* Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
- * to return EINVAL. */
-/* Marian Durkovic <marian@svf.stuba.sk> */
-/* Peter Wemm <peter@spinner.DIALix.COM> */
-#if defined(_SQUID_FREEBSD_)
-#include <osreldate.h>
-#if __FreeBSD_version < 220000
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-#endif
-
-/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
-#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
-#define FD_SETSIZE SQUID_MAXFD
-#endif
+#include "compat/getaddrinfo.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#include <sys/stat.h>
#endif
-#include "getaddrinfo.h"
-
#define PROXY_PORT "3128"
#define PROXY_ADDR "127.0.0.1"
#define MAX_FDS 1024
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- xgetaddrinfo(proxy_addr, proxy_port, &hints, AI);
+ getaddrinfo(proxy_addr, proxy_port, &hints, AI);
if ((s = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0) {
perror("socket");
- xfreeaddrinfo(AI);
- return -1;
+ s = -1;
}
-
- if (connect(s, AI->ai_addr, AI->ai_addrlen) < 0) {
+ else if (connect(s, AI->ai_addr, AI->ai_addrlen) < 0) {
close(s);
perror("connect");
- xfreeaddrinfo(AI);
- return -1;
+ s = -1;
}
- xfreeaddrinfo(AI);
+ freeaddrinfo(AI);
return s;
}
*/
#include "config.h"
+#include "compat/tempnam.h"
#include "rfc1738.h"
#if HAVE_UNISTD_H