checkFailureRatio().
- Added more stuff to net_db.c.
- Fixed memory leak in stat_ipcache_get().
- Changed __P back to _PARAMS.
-Changes to squid-1.1.beta3 ():
+Changes to squid-1.1.beta4 ():
+
+ - Fixed coredump in icpStateFree() when calling
+ checkFailureRatio().
+ - Added more stuff to net_db.c.
+ - Fixed memory leak in stat_ipcache_get().
+ - Changed __P back to _PARAMS.
+
+Changes to squid-1.1.beta3 (September 16, 1996):
- s/()/(void)/
- Fixed 8k page leak in icmpRecv().
- Includes squid-1.0 changes up to 1.0.16.
- s/__STRICT_ANSI__/__STDC__/g
-Changes to squid-1.1.beta2 (September 16, 1996):
+Changes to squid-1.1.beta2 (September 12, 1996):
- Switched to ANSI style coding.
- Fixed UDP_HIT_OBJ objects ignoring 'proxy-only' setting.
#ifndef _TEMPNAM_H
#define _TEMPNAM_H
-extern char *tempnam __P((const char *, const char *));
+extern char *tempnam _PARAMS((const char *, const char *));
#endif /* _TEMPNAM_H */
/*
- * $Id: util.h,v 1.19 1996/09/18 22:44:39 wessels Exp $
+ * $Id: util.h,v 1.20 1996/09/20 06:28:18 wessels Exp $
*
* AUTHOR: Harvest Derived
*
#endif
#if !HAVE_STRDUP
-extern char *strdup __P((char *));
+extern char *strdup _PARAMS((char *));
#endif
-extern char *xstrdup __P((char *)); /* Duplicate a string */
+extern char *xstrdup _PARAMS((char *)); /* Duplicate a string */
/* from xmalloc.c */
-void *xmalloc __P((size_t)); /* Wrapper for malloc(3) */
-void *xrealloc __P((void *, size_t)); /* Wrapper for realloc(3) */
-void *xcalloc __P((int, size_t)); /* Wrapper for calloc(3) */
-void xfree __P((void *)); /* Wrapper for free(3) */
-void xxfree __P((void *)); /* Wrapper for free(3) */
-char *xstrdup __P((char *));
-char *xstrerror __P((void));
-char *getfullhostname __P((void));
-void xmemcpy __P((void *, void *, int));
+void *xmalloc _PARAMS((size_t)); /* Wrapper for malloc(3) */
+void *xrealloc _PARAMS((void *, size_t)); /* Wrapper for realloc(3) */
+void *xcalloc _PARAMS((int, size_t)); /* Wrapper for calloc(3) */
+void xfree _PARAMS((void *)); /* Wrapper for free(3) */
+void xxfree _PARAMS((void *)); /* Wrapper for free(3) */
+char *xstrdup _PARAMS((char *));
+char *xstrerror _PARAMS((void));
+char *getfullhostname _PARAMS((void));
+void xmemcpy _PARAMS((void *, void *, int));
#if XMALLOC_STATISTICS
-void malloc_statistics __P((void (*)__P((int, int, void *)), void *));
+void malloc_statistics _PARAMS((void (*)_PARAMS((int, int, void *)), void *));
#endif
/* from debug.c */
{if (debug_ok_fast((section),(level))) {Log X;}}
#endif
-void debug_flag __P((char *));
+void debug_flag _PARAMS((char *));
-char *mkhttpdlogtime __P((time_t *));
-extern char *mkrfc850 __P((time_t));
-extern time_t parse_rfc850 __P((char *str));
-extern void init_log3 __P((char *pn, FILE * a, FILE * b));
-extern void debug_init __P((void));
-extern void log_errno2 __P((char *, int, char *));
+char *mkhttpdlogtime _PARAMS((time_t *));
+extern char *mkrfc850 _PARAMS((time_t));
+extern time_t parse_rfc850 _PARAMS((char *str));
+extern void init_log3 _PARAMS((char *pn, FILE * a, FILE * b));
+extern void debug_init _PARAMS((void));
+extern void log_errno2 _PARAMS((char *, int, char *));
#if __STDC__
-extern void Log __P((char *,...));
-extern void errorlog __P((char *,...));
+extern void Log _PARAMS((char *,...));
+extern void errorlog _PARAMS((char *,...));
#else
-extern void Log __P(());
-extern void errorlog __P(());
+extern void Log _PARAMS(());
+extern void errorlog _PARAMS(());
#endif /* __STDC__ */
-extern void Tolower __P((char *));
+extern void Tolower _PARAMS((char *));
-extern char *uudecode __P((char *));
+extern char *uudecode _PARAMS((char *));
#endif /* ndef _UTIL_H_ */
#include "ansiproto.h"
-static void base64_init __P((void));
+static void base64_init _PARAMS((void));
static int base64_initialized = 0;
int base64_value[256];
/*
- * $Id: util.c,v 1.18 1996/09/17 16:54:00 wessels Exp $
+ * $Id: util.c,v 1.19 1996/09/20 06:28:22 wessels Exp $
*
* DEBUG:
* AUTHOR: Harvest Derived
#include "ansiproto.h"
#include "util.h"
-void (*failure_notify) __P((char *)) = NULL;
+void (*failure_notify) _PARAMS((char *)) = NULL;
static char msg[128];
extern int sys_nerr;
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.41 1996/09/18 21:39:26 wessels Exp $
+# $Id: Makefile.in,v 1.42 1996/09/20 06:28:23 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
client_side.o comm.o debug.o disk.o dns.o \
fdstat.o filemap.o ftp.o fqdncache.o gopher.o \
hash.o http.o icmp.o icp.o ident.o ipcache.o \
- main.o mime.o neighbors.o objcache.o \
+ main.o mime.o neighbors.o net_db.o objcache.o \
proto.o redirect.o send-announce.o ssl.o stack.o stat.o stmem.o \
store.o store_clean.o storetoString.o tools.o ttl.o \
url.o wais.o $(XTRA_OBJS)
/*
- * $Id: acl.cc,v 1.42 1996/09/18 21:39:27 wessels Exp $
+ * $Id: acl.cc,v 1.43 1996/09/20 06:28:24 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
static struct _acl *AclList = NULL;
static struct _acl **AclListTail = &AclList;
-static void aclDestroyAclList __P((struct _acl_list * list));
-static void aclDestroyIpList __P((struct _acl_ip_data * data));
-static void aclDestroyRegexList __P((struct _relist * data));
-static void aclDestroyTimeList __P((struct _acl_time_data * data));
-static int aclMatchDomainList __P((wordlist *, char *));
-static int aclMatchAclList __P((struct _acl_list *, aclCheck_t *));
-static int aclMatchInteger __P((intlist * data, int i));
-static int aclMatchIp __P((struct _acl_ip_data * data, struct in_addr c));
-static int aclMatchRegex __P((relist * data, char *word));
-static int aclMatchTime __P((struct _acl_time_data * data, time_t when));
-static intlist *aclParseIntlist __P((void));
-static struct _acl_ip_data *aclParseIpList __P((void));
-static intlist *aclParseMethodList __P((void));
-static intlist *aclParseProtoList __P((void));
-static struct _relist *aclParseRegexList __P((void));
-static struct _acl_time_data *aclParseTimeSpec __P((void));
-static wordlist *aclParseWordList __P((void));
-static wordlist *aclParseDomainList __P((void));
-static squid_acl aclType __P((char *s));
-static int decode_addr __P((char *, struct in_addr *, struct in_addr *));
+static void aclDestroyAclList _PARAMS((struct _acl_list * list));
+static void aclDestroyIpList _PARAMS((struct _acl_ip_data * data));
+static void aclDestroyRegexList _PARAMS((struct _relist * data));
+static void aclDestroyTimeList _PARAMS((struct _acl_time_data * data));
+static int aclMatchDomainList _PARAMS((wordlist *, char *));
+static int aclMatchAclList _PARAMS((struct _acl_list *, aclCheck_t *));
+static int aclMatchInteger _PARAMS((intlist * data, int i));
+static int aclMatchIp _PARAMS((struct _acl_ip_data * data, struct in_addr c));
+static int aclMatchRegex _PARAMS((relist * data, char *word));
+static int aclMatchTime _PARAMS((struct _acl_time_data * data, time_t when));
+static intlist *aclParseIntlist _PARAMS((void));
+static struct _acl_ip_data *aclParseIpList _PARAMS((void));
+static intlist *aclParseMethodList _PARAMS((void));
+static intlist *aclParseProtoList _PARAMS((void));
+static struct _relist *aclParseRegexList _PARAMS((void));
+static struct _acl_time_data *aclParseTimeSpec _PARAMS((void));
+static wordlist *aclParseWordList _PARAMS((void));
+static wordlist *aclParseDomainList _PARAMS((void));
+static squid_acl aclType _PARAMS((char *s));
+static int decode_addr _PARAMS((char *, struct in_addr *, struct in_addr *));
static squid_acl
aclType(char *s)
/*
- * $Id: cache_cf.cc,v 1.95 1996/09/18 21:41:07 wessels Exp $
+ * $Id: cache_cf.cc,v 1.96 1996/09/20 06:28:27 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
char config_input_line[BUFSIZ];
int config_lineno = 0;
-static char *safe_xstrdup __P((char *p));
-static void parseOnOff __P((int *));
-static void parseIntegerValue __P((int *));
+static char *safe_xstrdup _PARAMS((char *p));
+static void parseOnOff _PARAMS((int *));
+static void parseIntegerValue _PARAMS((int *));
static char fatal_str[BUFSIZ];
-static void configDoConfigure __P((void));
-static void configFreeMemory __P((void));
-static void configSetFactoryDefaults __P((void));
-static void parseAccessLogLine __P((void));
-static void parseAddressLine __P((struct in_addr *));
-static void parseAnnounceToLine __P((void));
-static void parseAppendDomainLine __P((void));
-static void parseCacheAnnounceLine __P((void));
-static void parseCacheHostLine __P((void));
-static void parseDebugOptionsLine __P((void));
-static void parseDnsProgramLine __P((void));
-static void parseEffectiveUserLine __P((void));
-static void parseErrHtmlLine __P((void));
-static void parseFtpLine __P((void));
-static void parseFtpOptionsLine __P((void));
-static void parseFtpProgramLine __P((void));
-static void parseFtpUserLine __P((void));
-static void parseGopherLine __P((void));
-static void parseWordlist __P((wordlist **));
-static void parseHostAclLine __P((void));
-static void parseHostDomainLine __P((void));
-static void parseHotVmFactorLine __P((void));
-static void parseHttpLine __P((void));
-static void parseHttpPortLine __P((void));
-static void parseHttpdAccelLine __P((void));
-static void parseIPLine __P((ip_acl ** list));
-static void parseIcpPortLine __P((void));
-static void parseLocalDomainFile __P((char *fname));
-static void parseLocalDomainLine __P((void));
-static void parseLogLine __P((void));
-static void parseMemLine __P((void));
-static void parseMgrLine __P((void));
-static void parsePidFilenameLine __P((void));
-static void parseRequestSizeLine __P((void));
-static void parseStoreLogLine __P((void));
-static void parseSwapLine __P((void));
-static void parseTTLPattern __P((int icase, int force));
-static void parseVisibleHostnameLine __P((void));
-static void parseWAISRelayLine __P((void));
-static void parseMinutesLine __P((int *));
-static void ip_acl_destroy __P((ip_acl **));
+static void configDoConfigure _PARAMS((void));
+static void configFreeMemory _PARAMS((void));
+static void configSetFactoryDefaults _PARAMS((void));
+static void parseAccessLogLine _PARAMS((void));
+static void parseAddressLine _PARAMS((struct in_addr *));
+static void parseAnnounceToLine _PARAMS((void));
+static void parseAppendDomainLine _PARAMS((void));
+static void parseCacheAnnounceLine _PARAMS((void));
+static void parseCacheHostLine _PARAMS((void));
+static void parseDebugOptionsLine _PARAMS((void));
+static void parseDnsProgramLine _PARAMS((void));
+static void parseEffectiveUserLine _PARAMS((void));
+static void parseErrHtmlLine _PARAMS((void));
+static void parseFtpLine _PARAMS((void));
+static void parseFtpOptionsLine _PARAMS((void));
+static void parseFtpProgramLine _PARAMS((void));
+static void parseFtpUserLine _PARAMS((void));
+static void parseGopherLine _PARAMS((void));
+static void parseWordlist _PARAMS((wordlist **));
+static void parseHostAclLine _PARAMS((void));
+static void parseHostDomainLine _PARAMS((void));
+static void parseHotVmFactorLine _PARAMS((void));
+static void parseHttpLine _PARAMS((void));
+static void parseHttpPortLine _PARAMS((void));
+static void parseHttpdAccelLine _PARAMS((void));
+static void parseIPLine _PARAMS((ip_acl ** list));
+static void parseIcpPortLine _PARAMS((void));
+static void parseLocalDomainFile _PARAMS((char *fname));
+static void parseLocalDomainLine _PARAMS((void));
+static void parseLogLine _PARAMS((void));
+static void parseMemLine _PARAMS((void));
+static void parseMgrLine _PARAMS((void));
+static void parsePidFilenameLine _PARAMS((void));
+static void parseRequestSizeLine _PARAMS((void));
+static void parseStoreLogLine _PARAMS((void));
+static void parseSwapLine _PARAMS((void));
+static void parseTTLPattern _PARAMS((int icase, int force));
+static void parseVisibleHostnameLine _PARAMS((void));
+static void parseWAISRelayLine _PARAMS((void));
+static void parseMinutesLine _PARAMS((int *));
+static void ip_acl_destroy _PARAMS((ip_acl **));
void
self_destruct(void)
}
static void
-ip_acl_destroy(a)
- ip_acl **a;
+ip_acl_destroy(ip_acl ** a)
{
ip_acl *b;
ip_acl *n;
/*
- * $Id: cachemgr.cc,v 1.27 1996/09/18 21:39:29 wessels Exp $
+ * $Id: cachemgr.cc,v 1.28 1996/09/20 06:28:29 wessels Exp $
*
* DEBUG: Section 0 CGI Cache Manager
* AUTHOR: Harvest Derived
char *script_name = "/cgi-bin/cachemgr.cgi";
char *progname = NULL;
-static int client_comm_connect __P((int sock, char *dest_host, u_short dest_port));
+static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port));
void
print_trailer(void)
/*
- * $Id: client.cc,v 1.10 1996/09/15 05:04:15 wessels Exp $
+ * $Id: client.cc,v 1.11 1996/09/20 06:28:30 wessels Exp $
*
* DEBUG: section 0 WWW Client
* AUTHOR: Harvest Derived
#endif
/* Local functions */
-static int client_comm_connect __P((int sock, char *dest_host, u_short dest_port));
-static void usage __P((char *progname));
+static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port));
+static void usage _PARAMS((char *progname));
static void
usage(char *progname)
/*
- * $Id: client_side.cc,v 1.34 1996/09/18 21:41:08 wessels Exp $
+ * $Id: client_side.cc,v 1.35 1996/09/20 06:28:30 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
#include "squid.h"
-static void clientRedirectDone __P((void *data, char *result));
-static int icpHandleIMSReply __P((int fd, StoreEntry * entry, void *data));
-static void clientLookupDstIPDone __P((int fd, struct hostent * hp, void *data));
-static void clientLookupSrcFQDNDone __P((int fd, char *fqdn, void *data));
+static void clientRedirectDone _PARAMS((void *data, char *result));
+static int icpHandleIMSReply _PARAMS((int fd, StoreEntry * entry, void *data));
+static void clientLookupDstIPDone _PARAMS((int fd, struct hostent * hp, void *data));
+static void clientLookupSrcFQDNDone _PARAMS((int fd, char *fqdn, void *data));
static void
/*
- * $Id: comm.cc,v 1.75 1996/09/18 21:39:30 wessels Exp $
+ * $Id: comm.cc,v 1.76 1996/09/20 06:28:32 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
FD_ENTRY *fd_table = NULL; /* also used in disk.c */
/* STATIC */
-static void checkTimeouts __P((void));
-static void checkLifetimes __P((void));
-static void Reserve_More_FDs __P((void));
-static void commSetReuseAddr __P((int));
-static int examine_select __P((fd_set *, fd_set *, fd_set *));
-static void commSetNoLinger __P((int));
-static void comm_select_incoming __P((void));
-static int commBind __P((int s, struct in_addr, u_short port));
-static void RWStateCallbackAndFree __P((int fd, int code));
+static void checkTimeouts _PARAMS((void));
+static void checkLifetimes _PARAMS((void));
+static void Reserve_More_FDs _PARAMS((void));
+static void commSetReuseAddr _PARAMS((int));
+static int examine_select _PARAMS((fd_set *, fd_set *, fd_set *));
+static void commSetNoLinger _PARAMS((int));
+static void comm_select_incoming _PARAMS((void));
+static int commBind _PARAMS((int s, struct in_addr, u_short port));
+static void RWStateCallbackAndFree _PARAMS((int fd, int code));
#ifdef TCP_NODELAY
-static void commSetTcpNoDelay __P((int));
+static void commSetTcpNoDelay _PARAMS((int));
#endif
-static void commSetTcpRcvbuf __P((int, int));
+static void commSetTcpRcvbuf _PARAMS((int, int));
static int *fd_lifetime = NULL;
static struct timeval zero_tv;
if (maxfd++ == 0)
return;
if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) > 0) {
+ getCurrentTime();
for (i = 0; i < N; i++) {
fd = fds[i];
if (FD_ISSET(fd, &read_mask)) {
poll_time.tv_usec = 0;
#endif
num = select(maxfd, &readfds, &writefds, &exceptfds, &poll_time);
+ getCurrentTime();
if (num >= 0)
break;
if (errno == EINTR)
}
int
-comm_get_select_handler(int fd, unsigned int type, int (**handler_ptr) (), void **client_data_ptr)
+comm_get_select_handler(int fd,
+ unsigned int type,
+ int (**handler_ptr) _PARAMS((int, void *)),
+ void **client_data_ptr)
{
if (type & COMM_SELECT_TIMEOUT) {
*handler_ptr = fd_table[fd].timeout_handler;
/*
- * $Id: debug.cc,v 1.26 1996/09/18 22:44:49 wessels Exp $
+ * $Id: debug.cc,v 1.27 1996/09/20 06:28:33 wessels Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
#define MAX_DEBUG_SECTIONS 50
static int debugLevels[MAX_DEBUG_SECTIONS];
-#if __STDC__
+#if __STDC__
void
_db_print(int section, int level, char *format,...)
{
if (debug_log == NULL)
return;
-#if __STDC__
+#if __STDC__
va_start(args, format);
#else
va_start(args);
/*
- * $Id: disk.cc,v 1.27 1996/09/17 16:32:37 wessels Exp $
+ * $Id: disk.cc,v 1.28 1996/09/20 06:28:35 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
/* Open a disk file. Return a file descriptor */
int
-file_open(char *path, int (*handler) (), int mode)
+file_open(char *path, int (*handler) _PARAMS((void)), int mode)
{
FD_ENTRY *conn;
int fd;
char *ptr_to_buf,
int len,
int access_code,
- void (*handle) (),
+ void (*handle) _PARAMS((int, int, StoreEntry *)),
void *handle_data,
- void (*free_func) (void *))
+ void (*free_func) _PARAMS((void *)))
{
dwrite_q *wq = NULL;
/*
- * $Id: dns.cc,v 1.12 1996/09/17 16:32:38 wessels Exp $
+ * $Id: dns.cc,v 1.13 1996/09/20 06:28:36 wessels Exp $
*
* DEBUG: section 34 Dnsserver interface
* AUTHOR: Harvest Derived
void *data;
};
-static int dnsOpenServer __P((char *command));
+static int dnsOpenServer _PARAMS((char *command));
static dnsserver_t **dns_child_table = NULL;
static int NDnsServersAlloc = 0;
/*
- * $Id: errorpage.cc,v 1.40 1996/09/17 16:32:39 wessels Exp $
+ * $Id: errorpage.cc,v 1.41 1996/09/20 06:28:37 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
<P>\n\
You may take a look at\n\
<PRE> <A HREF=\"%s\">%s</A></PRE>\n\
-or check with the cache administrator if you\n\
-believe this is incorrect.\n\
+or check with the\n\
+<A HREF=\"mailto:%s\">cache administrator</A>\n\
+if you believe this is incorrect.\n\
<P>\n\
%s\n\
<HR>\n\
url,
redirect,
redirect,
+ Config.adminEmail,
Config.errHtmlText,
appname,
version_string,
/*
- * $Id: filemap.cc,v 1.10 1996/09/15 05:04:23 wessels Exp $
+ * $Id: filemap.cc,v 1.11 1996/09/20 06:28:41 wessels Exp $
*
* DEBUG: section 8 Swap File Bitmap
* AUTHOR: Harvest Derived
#define ALL_ONES (unsigned long) 0xFFFFFFFF
#endif
-extern int storeGetSwapSpace __P((int));
-extern void fatal_dump __P((char *));
+extern int storeGetSwapSpace _PARAMS((int));
+extern void fatal_dump _PARAMS((char *));
static fileMap *fm = NULL;
/*
- * $Id: fqdncache.cc,v 1.20 1996/09/17 02:29:55 wessels Exp $
+ * $Id: fqdncache.cc,v 1.21 1996/09/20 06:28:42 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
int ghba_calls; /* # calls to blocking gethostbyaddr() */
} FqdncacheStats;
-static int fqdncache_compareLastRef __P((fqdncache_entry **, fqdncache_entry **));
-static int fqdncache_dnsHandleRead __P((int, dnsserver_t *));
-static fqdncache_entry *fqdncache_parsebuffer __P((char *buf, dnsserver_t *));
-static int fqdncache_purgelru __P((void));
-static void fqdncache_release __P((fqdncache_entry *));
-static fqdncache_entry *fqdncache_GetFirst __P((void));
-static fqdncache_entry *fqdncache_GetNext __P((void));
-static fqdncache_entry *fqdncache_create __P((void));
-static void fqdncache_add_to_hash __P((fqdncache_entry *));
-static void fqdncache_call_pending __P((fqdncache_entry *));
-static void fqdncache_call_pending_badname __P((int fd, FQDNH handler, void *));
-static void fqdncache_add __P((char *, fqdncache_entry *, struct hostent *, int));
-static int fqdncacheHasPending __P((fqdncache_entry *));
-static fqdncache_entry *fqdncache_get __P((char *));
-static void dummy_handler __P((int, char *, void *));
-static int fqdncacheExpiredEntry __P((fqdncache_entry *));
-static void fqdncacheAddPending __P((fqdncache_entry *, int fd, FQDNH, void *));
-static void fqdncacheEnqueue __P((fqdncache_entry *));
-static void *fqdncacheDequeue __P((void));
-static void fqdncache_dnsDispatch __P((dnsserver_t *, fqdncache_entry *));
+static int fqdncache_compareLastRef _PARAMS((fqdncache_entry **, fqdncache_entry **));
+static int fqdncache_dnsHandleRead _PARAMS((int, dnsserver_t *));
+static fqdncache_entry *fqdncache_parsebuffer _PARAMS((char *buf, dnsserver_t *));
+static int fqdncache_purgelru _PARAMS((void));
+static void fqdncache_release _PARAMS((fqdncache_entry *));
+static fqdncache_entry *fqdncache_GetFirst _PARAMS((void));
+static fqdncache_entry *fqdncache_GetNext _PARAMS((void));
+static fqdncache_entry *fqdncache_create _PARAMS((void));
+static void fqdncache_add_to_hash _PARAMS((fqdncache_entry *));
+static void fqdncache_call_pending _PARAMS((fqdncache_entry *));
+static void fqdncache_call_pending_badname _PARAMS((int fd, FQDNH handler, void *));
+static void fqdncache_add _PARAMS((char *, fqdncache_entry *, struct hostent *, int));
+static int fqdncacheHasPending _PARAMS((fqdncache_entry *));
+static fqdncache_entry *fqdncache_get _PARAMS((char *));
+static void dummy_handler _PARAMS((int, char *, void *));
+static int fqdncacheExpiredEntry _PARAMS((fqdncache_entry *));
+static void fqdncacheAddPending _PARAMS((fqdncache_entry *, int fd, FQDNH, void *));
+static void fqdncacheEnqueue _PARAMS((fqdncache_entry *));
+static void *fqdncacheDequeue _PARAMS((void));
+static void fqdncache_dnsDispatch _PARAMS((dnsserver_t *, fqdncache_entry *));
static HashID fqdn_table = 0;
static struct fqdncacheQueueData *fqdncacheQueueHead = NULL;
/*
- * $Id: ftp.cc,v 1.59 1996/09/18 21:39:31 wessels Exp $
+ * $Id: ftp.cc,v 1.60 1996/09/20 06:28:43 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
} FtpData;
/* Local functions */
-static int ftpStateFree __P((int fd, FtpData * ftpState));
-static void ftpProcessReplyHeader __P((FtpData * data, char *buf, int size));
-static void ftpServerClosed __P((int fd, void *nodata));
-static void ftp_login_parser __P((char *login, FtpData * data));
-static char *ftpTransferMode __P((char *urlpath));
+static int ftpStateFree _PARAMS((int fd, FtpData * ftpState));
+static void ftpProcessReplyHeader _PARAMS((FtpData * data, char *buf, int size));
+static void ftpServerClosed _PARAMS((int fd, void *nodata));
+static void ftp_login_parser _PARAMS((char *login, FtpData * data));
+static char *ftpTransferMode _PARAMS((char *urlpath));
/* Global functions not declared in ftp.h */
void ftpLifetimeExpire(int fd, FtpData * data);
void ftpServerClose(void);
/* External functions */
-extern char *base64_decode __P((char *coded));
+extern char *base64_decode _PARAMS((char *coded));
static int
ftpStateFree(int fd, FtpData * ftpState)
/*
- * $Id: gopher.cc,v 1.49 1996/09/18 21:39:32 wessels Exp $
+ * $Id: gopher.cc,v 1.50 1996/09/20 06:28:46 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
char *buf; /* pts to a 4k page */
} GopherStateData;
-static int gopherStateFree __P((int fd, GopherStateData *));
-static void gopher_mime_content __P((char *buf, char *name, char *def));
-static void gopherMimeCreate __P((GopherStateData *));
+static int gopherStateFree _PARAMS((int fd, GopherStateData *));
+static void gopher_mime_content _PARAMS((char *buf, char *name, char *def));
+static void gopherMimeCreate _PARAMS((GopherStateData *));
static int gopher_url_parser(char *url,
char *host,
int *port,
char *type_id,
char *request);
-static void gopherEndHTML __P((GopherStateData *));
-static void gopherToHTML __P((GopherStateData *, char *inbuf, int len));
-static int gopherReadReplyTimeout __P((int fd, GopherStateData *));
-static void gopherLifetimeExpire __P((int fd, GopherStateData *));
-static void gopherReadReply __P((int fd, GopherStateData *));
+static void gopherEndHTML _PARAMS((GopherStateData *));
+static void gopherToHTML _PARAMS((GopherStateData *, char *inbuf, int len));
+static int gopherReadReplyTimeout _PARAMS((int fd, GopherStateData *));
+static void gopherLifetimeExpire _PARAMS((int fd, GopherStateData *));
+static void gopherReadReply _PARAMS((int fd, GopherStateData *));
static void gopherSendComplete(int fd,
char *buf,
int size,
int errflag,
void *data);
-static void gopherSendRequest __P((int fd, GopherStateData *));
-static GopherStateData *CreateGopherStateData __P((void));
+static void gopherSendRequest _PARAMS((int fd, GopherStateData *));
+static GopherStateData *CreateGopherStateData _PARAMS((void));
static char def_gopher_bin[] = "www/unknown";
static char def_gopher_text[] = "text/plain";
/*
- * $Id: http.cc,v 1.78 1996/09/18 21:39:33 wessels Exp $
+ * $Id: http.cc,v 1.79 1996/09/20 06:28:49 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
int ctype;
} ReplyHeaderStats;
-static int httpStateFree __P((int fd, HttpStateData *));
-static void httpReadReplyTimeout __P((int fd, HttpStateData *));
-static void httpLifetimeExpire __P((int fd, HttpStateData *));
-static void httpMakePublic __P((StoreEntry *));
-static void httpMakePrivate __P((StoreEntry *));
-static void httpCacheNegatively __P((StoreEntry *));
-static void httpReadReply __P((int fd, HttpStateData *));
-static void httpSendComplete __P((int fd, char *, int, int, void *));
-static void httpSendRequest __P((int fd, HttpStateData *));
-static void httpConnInProgress __P((int fd, HttpStateData *));
-static void httpConnect __P((int fd, struct hostent *, void *));
+static int httpStateFree _PARAMS((int fd, HttpStateData *));
+static void httpReadReplyTimeout _PARAMS((int fd, HttpStateData *));
+static void httpLifetimeExpire _PARAMS((int fd, HttpStateData *));
+static void httpMakePublic _PARAMS((StoreEntry *));
+static void httpMakePrivate _PARAMS((StoreEntry *));
+static void httpCacheNegatively _PARAMS((StoreEntry *));
+static void httpReadReply _PARAMS((int fd, HttpStateData *));
+static void httpSendComplete _PARAMS((int fd, char *, int, int, void *));
+static void httpSendRequest _PARAMS((int fd, HttpStateData *));
+static void httpConnInProgress _PARAMS((int fd, HttpStateData *));
+static void httpConnect _PARAMS((int fd, struct hostent *, void *));
static int
httpStateFree(int fd, HttpStateData * httpState)
len += strlen(post_buf);
xfree(post_buf);
}
- debug(11, 6, "httpSendRequest: FD %d: buf '%s'\n", fd, buf);
+ debug(11, 6, "httpSendRequest: FD %d:\n%s\n", fd, buf);
comm_write(fd,
buf,
len,
/*
- * $Id: icmp.cc,v 1.6 1996/09/17 16:32:40 wessels Exp $
+ * $Id: icmp.cc,v 1.7 1996/09/20 06:28:51 wessels Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
char *msg;
int len;
struct _icmpQueueData *next;
- void (*free) __P((void *));
+ void (*free) _PARAMS((void *));
} icmpQueueData;
#define MAX_PAYLOAD (8192 - sizeof(struct icmphdr) - sizeof (char) - sizeof(struct timeval) - 1)
"Out of Range Type"
};
-static int in_cksum __P((unsigned short *ptr, int size));
-static void icmpRecv __P((int, void *));
-static void icmpQueueSend __P((struct in_addr,
+static int in_cksum _PARAMS((unsigned short *ptr, int size));
+static void icmpRecv _PARAMS((int, void *));
+static void icmpQueueSend _PARAMS((struct in_addr,
char *msg,
int len,
- void (*free) __P((void *))));
-static void icmpSend __P((int fd, icmpQueueData * queue));
-static void icmpLog __P((struct icmphdr * icmp,
+ void (*free) _PARAMS((void *))));
+static void icmpSend _PARAMS((int fd, icmpQueueData * queue));
+static void icmpLog _PARAMS((struct icmphdr * icmp,
struct in_addr addr,
int rtt,
int hops));
-static int ipHops __P((int ttl));
-static void icmpProcessReply __P((struct sockaddr_in * from,
+static int ipHops _PARAMS((int ttl));
+static void icmpProcessReply _PARAMS((struct sockaddr_in * from,
struct icmphdr * icmp,
int hops));
-static void icmpHandleSourcePing __P((struct sockaddr_in * from, char *buf));
+static void icmpHandleSourcePing _PARAMS((struct sockaddr_in * from, char *buf));
void
icmpOpen(void)
icmpHandleSourcePing(from, echo->payload);
break;
case S_ICMP_DOM:
+ netdbHandlePingReply(from, hops, rtt);
break;
default:
debug(37, 0, "icmpProcessReply: Bad opcode: %d\n", (int) echo->opcode);
icmpQueueSend(struct in_addr to,
char *pkt,
int len,
- void (*free) __P((void *)))
+ void (*free) _PARAMS((void *)))
{
icmpQueueData *q = NULL;
icmpQueueData **H = NULL;
/*
- * $Id: ident.cc,v 1.15 1996/09/17 16:32:41 wessels Exp $
+ * $Id: ident.cc,v 1.16 1996/09/20 06:28:54 wessels Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
#define IDENT_PORT 113
-static void identRequestComplete __P((int, char *, int, int, void *));
-static void identReadReply __P((int, icpStateData *));
-static void identClose __P((int, icpStateData *));
+static void identRequestComplete _PARAMS((int, char *, int, int, void *));
+static void identReadReply _PARAMS((int, icpStateData *));
+static void identClose _PARAMS((int, icpStateData *));
static void
identClose(int fd, icpStateData * icpState)
/*
- * $Id: ipcache.cc,v 1.63 1996/09/18 21:39:36 wessels Exp $
+ * $Id: ipcache.cc,v 1.64 1996/09/20 06:28:55 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
int ghbn_calls; /* # calls to blocking gethostbyname() */
} IpcacheStats;
-static int ipcache_testname __P((void));
-static int ipcache_compareLastRef __P((ipcache_entry **, ipcache_entry **));
-static int ipcache_reverseLastRef __P((ipcache_entry **, ipcache_entry **));
-static int ipcache_dnsHandleRead __P((int, dnsserver_t *));
-static ipcache_entry *ipcache_parsebuffer __P((char *buf, dnsserver_t *));
-static void ipcache_release __P((ipcache_entry *));
-static ipcache_entry *ipcache_GetFirst __P((void));
-static ipcache_entry *ipcache_GetNext __P((void));
-static ipcache_entry *ipcache_create __P((void));
-static void ipcache_add_to_hash __P((ipcache_entry *));
-static void ipcache_call_pending __P((ipcache_entry *));
-static void ipcache_add __P((char *, ipcache_entry *, struct hostent *, int));
-static int ipcacheHasPending __P((ipcache_entry *));
-static ipcache_entry *ipcache_get __P((char *));
-static void dummy_handler __P((int, struct hostent * hp, void *));
-static int ipcacheExpiredEntry __P((ipcache_entry *));
-static void ipcacheAddPending __P((ipcache_entry *, int fd, IPH, void *));
-static void ipcacheEnqueue __P((ipcache_entry *));
-static void *ipcacheDequeue __P((void));
-static void ipcache_dnsDispatch __P((dnsserver_t *, ipcache_entry *));
-static struct hostent *ipcacheCheckNumeric __P((char *name));
-static void ipcacheStatPrint __P((ipcache_entry *, StoreEntry *));
-static void ipcacheUnlockEntry __P((ipcache_entry *));
-static void ipcacheLockEntry __P((ipcache_entry *));
+static int ipcache_testname _PARAMS((void));
+static int ipcache_compareLastRef _PARAMS((ipcache_entry **, ipcache_entry **));
+static int ipcache_reverseLastRef _PARAMS((ipcache_entry **, ipcache_entry **));
+static int ipcache_dnsHandleRead _PARAMS((int, dnsserver_t *));
+static ipcache_entry *ipcache_parsebuffer _PARAMS((char *buf, dnsserver_t *));
+static void ipcache_release _PARAMS((ipcache_entry *));
+static ipcache_entry *ipcache_GetFirst _PARAMS((void));
+static ipcache_entry *ipcache_GetNext _PARAMS((void));
+static ipcache_entry *ipcache_create _PARAMS((void));
+static void ipcache_add_to_hash _PARAMS((ipcache_entry *));
+static void ipcache_call_pending _PARAMS((ipcache_entry *));
+static void ipcache_add _PARAMS((char *, ipcache_entry *, struct hostent *, int));
+static int ipcacheHasPending _PARAMS((ipcache_entry *));
+static ipcache_entry *ipcache_get _PARAMS((char *));
+static void dummy_handler _PARAMS((int, struct hostent * hp, void *));
+static int ipcacheExpiredEntry _PARAMS((ipcache_entry *));
+static void ipcacheAddPending _PARAMS((ipcache_entry *, int fd, IPH, void *));
+static void ipcacheEnqueue _PARAMS((ipcache_entry *));
+static void *ipcacheDequeue _PARAMS((void));
+static void ipcache_dnsDispatch _PARAMS((dnsserver_t *, ipcache_entry *));
+static struct hostent *ipcacheCheckNumeric _PARAMS((char *name));
+static void ipcacheStatPrint _PARAMS((ipcache_entry *, StoreEntry *));
+static void ipcacheUnlockEntry _PARAMS((ipcache_entry *));
+static void ipcacheLockEntry _PARAMS((ipcache_entry *));
static struct hostent *static_result = NULL;
static HashID ip_table = 0;
N = 0;
for (i = ipcache_GetFirst(); i; i = ipcache_GetNext()) {
*(list + N) = i;
- if (++N > meta_data.ipcache_count)
- fatal_dump("stat_ipcache_get: meta_data.ipcache_count mismatch");
+ if (++N > meta_data.ipcache_count) {
+ debug_trap("stat_ipcache_get: meta_data.ipcache_count mismatch");
+ break;
+ }
}
qsort((char *) list,
N,
for (k = 0; k < N; k++)
ipcacheStatPrint(*(list + k), sentry);
storeAppendPrintf(sentry, close_bracket);
+ xfree(list);
}
static void
/*
- * $Id: main.cc,v 1.82 1996/09/18 21:39:37 wessels Exp $
+ * $Id: main.cc,v 1.83 1996/09/20 06:28:56 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
char *dash_str = "-";
/* for error reporting from xmalloc and friends */
-extern void (*failure_notify) __P((char *));
+extern void (*failure_notify) _PARAMS((char *));
-volatile static int rotate_pending = 0; /* set by SIGUSR1 handler */
+static volatile int rotate_pending = 0; /* set by SIGUSR1 handler */
static int httpPortNumOverride = 1;
static int icpPortNumOverride = 1; /* Want to detect "-u 0" */
#if MALLOC_DBG
static time_t next_announce;
static time_t next_ip_purge;
-static void rotate_logs __P((int));
-static void reconfigure __P((int));
-static void mainInitialize __P((void));
-static void mainReinitialize __P((void));
-static time_t mainMaintenance __P((void));
-static void usage __P((void));
-static void mainParseOptions __P((int, char **));
-static void sendSignal __P((void));
+static void rotate_logs _PARAMS((int));
+static void reconfigure _PARAMS((int));
+static void mainInitialize _PARAMS((void));
+static void mainReinitialize _PARAMS((void));
+static time_t mainMaintenance _PARAMS((void));
+static void usage _PARAMS((void));
+static void mainParseOptions _PARAMS((int, char **));
+static void sendSignal _PARAMS((void));
static void
usage(void)
}
#if USE_ICMP
icmpOpen();
+ netdbInit();
#endif
}
/*
- * $Id: neighbors.cc,v 1.56 1996/09/18 21:39:37 wessels Exp $
+ * $Id: neighbors.cc,v 1.57 1996/09/20 06:28:58 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
#include "squid.h"
-static int edgeWouldBePinged __P((edge *, request_t *));
-static void neighborRemove __P((edge *));
-static edge *whichEdge __P((icp_common_t *, struct sockaddr_in *));
+static int edgeWouldBePinged _PARAMS((edge *, request_t *));
+static void neighborRemove _PARAMS((edge *));
+static edge *whichEdge _PARAMS((icp_common_t *, struct sockaddr_in *));
static neighbors *friends = NULL;
static struct neighbor_cf *Neighbor_cf = NULL;
+#if USE_ICMP
+
#include "squid.h"
-#define NET_DB_TTL 3600
+#define NET_DB_TTL 5
+
+static HashID addr_table;
+static HashID host_table;
-static HashID table;
+static struct in_addr networkFromInaddr _PARAMS((struct in_addr a));
+
+void
+netdbInit(void)
+{
+ addr_table = hash_create(strcmp, 229, hash_string);
+ host_table = hash_create(strcmp, 467, hash_string);
+}
static void
-netdbHashInsert(netdbEntry * n, char *key)
+netdbHashInsert(netdbEntry * n, struct in_addr addr)
{
- hash_insert(table, key, n);
+ strncpy(n->network, inet_ntoa(networkFromInaddr(addr)), 15);
+ n->key = n->network;
+ hash_join(addr_table, (hash_link *) n);
meta_data.netdb++;
- n->link_count++;
}
static void
-netdbHashDelete(netdbEntry * n, char *key)
+netdbHashDelete(struct in_addr addr)
{
- hash_link *hptr = hash_lookup(table, key);
+ char *key = inet_ntoa(networkFromInaddr(addr));
+ hash_link *hptr = hash_lookup(addr_table, key);
if (hptr == NULL) {
debug_trap("netdbHashDelete: key not found");
return;
}
- hash_delete_link(table, hptr);
+ hash_delete_link(addr_table, hptr);
+ meta_data.netdb--;
+}
+
+static void
+netdbHashLink(netdbEntry * n, char *hostname)
+{
+ struct _net_db_name *x = xcalloc(1, sizeof(struct _net_db_name));
+ x->name = xstrdup(hostname);
+ x->next = n->hosts;
+ n->hosts = x;
+ hash_insert(host_table, x->name, n);
+ n->link_count++;
+}
+
+static void
+netdbHashUnlink(char *key)
+{
+ netdbEntry *n;
+ hash_link *hptr = hash_lookup(host_table, key);
+ if (hptr == NULL) {
+ debug_trap("netdbHashUnlink: key not found");
+ return;
+ }
+ hash_delete(host_table, hptr);
meta_data.netdb--;
+ n = (netdbEntry *) hptr->item;
n->link_count--;
}
static netdbEntry *
-netdbCreate(char *network)
+netdbLookupHost(char *key)
{
- netdbEntry *n = xcalloc(1, sizeof(netdbEntry));
- strncpy(n->network, network, 15);
- n->expires = squid_curtime + NET_DB_TTL;
- return n;
+ hash_link *hptr = hash_lookup(host_table, key);
+ return hptr ? (netdbEntry *) hptr->item : NULL;
}
-netdbEntry *
-netdbLookup(char *key)
+static netdbEntry *
+netdbLookupAddr(struct in_addr addr)
{
- hash_link *hptr = hash_lookup(table, key);
- return hptr ? (netdbEntry *) hptr->item : NULL;
+ char *key = inet_ntoa(networkFromInaddr(addr));
+ return (netdbEntry *) hash_lookup(addr_table, key);
}
-static void
-netdbAdd(int fdunused, struct hostent *hp, void *data)
+static netdbEntry *
+netdbAdd(struct in_addr addr, char *hostname)
{
netdbEntry *n;
- LOCAL_ARRAY(char, network, 16);
- char *hostname = data;
- if (hp == NULL)
- return;
- strcpy(network, inet_ntoa(inaddrFromHostent(hp)));
- if ((n = netdbLookup(network)) == NULL) {
- n = netdbCreate(network);
- netdbHashInsert(n, network);
+ if ((n = netdbLookupAddr(addr)) == NULL) {
+ n = xcalloc(1, sizeof(netdbEntry));
+ netdbHashInsert(n, addr);
}
- netdbHashInsert(n, hostname);
- xfree(hostname);
+ netdbHashLink(n, hostname);
+ return n;
}
static void
-netdbMaybeAdd(char *hostname)
+netdbSendPing(int fdunused, struct hostent *hp, void *data)
{
+ struct in_addr addr;
+ char *hostname = data;
netdbEntry *n;
- if ((n = netdbLookup(hostname)) != NULL)
+ if (hp == NULL)
return;
+ addr = inaddrFromHostent(hp);
+ if ((n = netdbLookupHost(hostname)) == NULL)
+ n = netdbAdd(addr, hostname);
+ debug(37, 0, "netdbSendPing: pinging %s\n", hostname);
+ icmpDomainPing(addr, hostname);
+ n->next_ping_time = squid_curtime + NET_DB_TTL;
+ xfree(hostname);
+}
+
+void
+netdbPingSite(char *hostname)
+{
ipcache_nbgethostbyname(hostname,
-1,
- netdbAdd,
+ netdbSendPing,
(void *) xstrdup(hostname));
}
+
+void
+netdbHandlePingReply(struct sockaddr_in *from, int hops, int rtt)
+{
+ netdbEntry *n;
+ int N;
+ debug(37, 0, "netdbHandlePingReply: from %s\n", inet_ntoa(from->sin_addr));
+ if ((n = netdbLookupAddr(from->sin_addr)) == NULL)
+ return;
+ N = ++n->n;
+ if (N > 100)
+ N = 100;
+ n->hops = ((n->hops * (N - 1)) + hops) / N;
+ n->rtt = ((n->rtt * (N - 1)) + rtt) / N;
+ debug(37, 0, "netdbHandlePingReply: %s; rtt=%5.1f hops=%4.1f\n",
+ n->network,
+ n->rtt,
+ n->hops);
+}
+
+static struct in_addr
+networkFromInaddr(struct in_addr a)
+{
+ struct in_addr b = a;
+ if (IN_CLASSC(b.s_addr))
+ b.s_addr &= IN_CLASSC_NET;
+ else if (IN_CLASSB(b.s_addr))
+ b.s_addr &= IN_CLASSB_NET;
+ else if (IN_CLASSA(b.s_addr))
+ b.s_addr &= IN_CLASSA_NET;
+ return b;
+}
+
+static int
+sortByHops(netdbEntry ** n1, netdbEntry ** n2)
+{
+ if ((*n1)->hops > (*n2)->hops)
+ return 1;
+ else if ((*n1)->hops < (*n2)->hops)
+ return -1;
+ else
+ return 0;
+}
+
+void
+netdbDump(StoreEntry * sentry)
+{
+ netdbEntry *n;
+ netdbEntry **list;
+ struct _net_db_name *x;
+ int k;
+ int i;
+ storeAppendPrintf(sentry, "{Network DB Statistics:\n");
+ storeAppendPrintf(sentry, "{%-16.16s %7s %5s %s}\n",
+ "Network",
+ "RTT",
+ "Hops",
+ "Hostnames");
+ list = xcalloc(meta_data.netdb, sizeof(netdbEntry *));
+ n = (netdbEntry *) hash_first(addr_table);
+ i = 0;
+ while (n) {
+ *(list + i++) = n;
+ n = (netdbEntry *) hash_next(addr_table);
+ }
+ qsort((char *) list,
+ i,
+ sizeof(netdbEntry *),
+ (QS) sortByHops);
+ for (k = 0; k < i; k++) {
+ n = *(list + k);
+ storeAppendPrintf(sentry, "{%-16.16s %7.1f %5.1f",
+ n->network,
+ n->rtt,
+ n->hops);
+ for (x = n->hosts; x; x = x->next)
+ storeAppendPrintf(sentry, " %s", x->name);
+ storeAppendPrintf(sentry, close_bracket);
+ }
+ storeAppendPrintf(sentry, close_bracket);
+ xfree(list);
+}
+
+#endif /* USE_ICMP */
/*
- * $Id: recv-announce.cc,v 1.9 1996/09/17 02:30:01 wessels Exp $
+ * $Id: recv-announce.cc,v 1.10 1996/09/20 06:29:04 wessels Exp $
*
* DEBUG: section 0 Announement Server
* AUTHOR: Harvest Derived
#define RECV_BUF_SIZE 8192
-extern void xmemcpy __P((void *from, void *to, int len));
+extern void xmemcpy _PARAMS((void *from, void *to, int len));
/*
* This program must be run from inetd. First add something like this
/*
- * $Id: redirect.cc,v 1.18 1996/09/17 02:30:02 wessels Exp $
+ * $Id: redirect.cc,v 1.19 1996/09/20 06:29:05 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
redirectStateData *redirectState;
};
-static redirector_t *GetFirstAvailable __P((void));
-static int redirectCreateRedirector __P((char *command));
-static int redirectHandleRead __P((int, redirector_t *));
-static redirectStateData *Dequeue __P((void));
-static void Enqueue __P((redirectStateData *));
-static void redirectDispatch __P((redirector_t *, redirectStateData *));
+static redirector_t *GetFirstAvailable _PARAMS((void));
+static int redirectCreateRedirector _PARAMS((char *command));
+static int redirectHandleRead _PARAMS((int, redirector_t *));
+static redirectStateData *Dequeue _PARAMS((void));
+static void Enqueue _PARAMS((redirectStateData *));
+static void redirectDispatch _PARAMS((redirector_t *, redirectStateData *));
static redirector_t **redirect_child_table = NULL;
sprintf(buf, "%s %s/%s %s %s\n",
r->orig_url,
inet_ntoa(r->client_addr),
- dash_str,
+ fqdn,
r->client_ident,
r->method_s);
len = strlen(buf);
/*
- * $Id: squid.h,v 1.56 1996/09/18 22:44:51 wessels Exp $
+ * $Id: squid.h,v 1.57 1996/09/20 06:29:06 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#include <aio.h>
#endif
-#if __STDC__
+#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include "tempnam.h"
#endif
-extern void serverConnectionsClose __P((void));
-extern void shut_down __P((int));
+extern void serverConnectionsClose _PARAMS((void));
+extern void shut_down _PARAMS((int));
extern time_t squid_starttime; /* main.c */
#define CONNECT_PORT 443
-extern int objcacheStart __P((int, char *, StoreEntry *));
-extern void send_announce __P((void));
-extern int sslStart __P((int fd, char *, request_t *, char *, int *sz));
-extern char *storeToString __P((StoreEntry *));
-extern void ttlSet __P((StoreEntry *));
-extern void ttlFreeList __P((void));
-extern void ttlAddToList __P((char *, int, int, time_t, int, time_t));
-extern void ttlAddToForceList __P((char *, time_t, time_t));
-extern int waisStart __P((int, char *, method_t, char *, StoreEntry *));
-extern void storeDirClean __P((void));
+extern int objcacheStart _PARAMS((int, char *, StoreEntry *));
+extern void send_announce _PARAMS((void));
+extern int sslStart _PARAMS((int fd, char *, request_t *, char *, int *sz));
+extern char *storeToString _PARAMS((StoreEntry *));
+extern void ttlSet _PARAMS((StoreEntry *));
+extern void ttlFreeList _PARAMS((void));
+extern void ttlAddToList _PARAMS((char *, int, int, time_t, int, time_t));
+extern void ttlAddToForceList _PARAMS((char *, time_t, time_t));
+extern int waisStart _PARAMS((int, char *, method_t, char *, StoreEntry *));
+extern void storeDirClean _PARAMS((void));
extern char *dash_str;
/*
- * $Id: ssl.cc,v 1.17 1996/09/18 20:12:22 wessels Exp $
+ * $Id: ssl.cc,v 1.18 1996/09/20 06:29:07 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
static char conn_established[] = "HTTP/1.0 200 Connection established\r\n\r\n";
-static void sslLifetimeExpire __P((int fd, SslStateData * sslState));
-static void sslReadTimeout __P((int fd, SslStateData * sslState));
-static void sslReadServer __P((int fd, SslStateData * sslState));
-static void sslReadClient __P((int fd, SslStateData * sslState));
-static void sslWriteServer __P((int fd, SslStateData * sslState));
-static void sslWriteClient __P((int fd, SslStateData * sslState));
-static void sslConnected __P((int fd, SslStateData * sslState));
-static void sslProxyConnected __P((int fd, SslStateData * sslState));
-static void sslConnect __P((int fd, struct hostent *, void *));
-static void sslConnInProgress __P((int fd, SslStateData * sslState));
-static void sslErrorComplete __P((int, char *, int, int, void *));
-static void sslClose __P((SslStateData * sslState));
-static int sslClientClosed __P((int fd, SslStateData * sslState));
+static void sslLifetimeExpire _PARAMS((int fd, SslStateData * sslState));
+static void sslReadTimeout _PARAMS((int fd, SslStateData * sslState));
+static void sslReadServer _PARAMS((int fd, SslStateData * sslState));
+static void sslReadClient _PARAMS((int fd, SslStateData * sslState));
+static void sslWriteServer _PARAMS((int fd, SslStateData * sslState));
+static void sslWriteClient _PARAMS((int fd, SslStateData * sslState));
+static void sslConnected _PARAMS((int fd, SslStateData * sslState));
+static void sslProxyConnected _PARAMS((int fd, SslStateData * sslState));
+static void sslConnect _PARAMS((int fd, struct hostent *, void *));
+static void sslConnInProgress _PARAMS((int fd, SslStateData * sslState));
+static void sslErrorComplete _PARAMS((int, char *, int, int, void *));
+static void sslClose _PARAMS((SslStateData * sslState));
+static int sslClientClosed _PARAMS((int fd, SslStateData * sslState));
static void
sslClose(SslStateData * sslState)
/*
- * $Id: stat.cc,v 1.73 1996/09/18 20:12:23 wessels Exp $
+ * $Id: stat.cc,v 1.74 1996/09/20 06:29:09 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
volatile unsigned long ntcpconn = 0;
volatile unsigned long nudpconn = 0;
struct _iostats IOStats;
-
-char *stat_describe();
-char *mem_describe();
-char *ttl_describe();
-char *flags_describe();
-char *elapsed_time();
-char *diskFileName();
-
-/* LOCALS */
char *open_bracket = "{\n";
char *close_bracket = "}\n";
-static void dummyhandler __P((cacheinfo *, StoreEntry *));
-static void info_get __P((cacheinfo *, StoreEntry *));
-static void logReadEndHandler __P((int, int, log_read_data_t *));
-static void log_clear __P((cacheinfo *, StoreEntry *));
-static void log_disable __P((cacheinfo *, StoreEntry *));
-static void log_enable __P((cacheinfo *, StoreEntry *));
-static void log_get_start __P((cacheinfo *, StoreEntry *));
-static void log_status_get __P((cacheinfo *, StoreEntry *));
-static void parameter_get __P((cacheinfo *, StoreEntry *));
-static void proto_count __P((cacheinfo *, protocol_t, log_type));
-static void proto_newobject __P((cacheinfo *, protocol_t, int, int));
-static void proto_purgeobject __P((cacheinfo *, protocol_t, int));
-static void proto_touchobject __P((cacheinfo *, protocol_t, int));
-static void server_list __P((cacheinfo *, StoreEntry *));
-static void squidReadEndHandler __P((int, int, squid_read_data_t *));
-static void squid_get_start __P((cacheinfo *, StoreEntry *));
-static void statFiledescriptors __P((StoreEntry *));
-static void stat_get __P((cacheinfo *, char *req, StoreEntry *));
-static void stat_io_get __P((StoreEntry *));
-static void stat_objects_get __P((cacheinfo *, StoreEntry *, int vm_or_not));
-static void stat_utilization_get __P((cacheinfo *, StoreEntry *, char *desc));
-static int cache_size_get __P((cacheinfo *));
-static int logReadHandler __P((int, char *, int, log_read_data_t *));
-static int squidReadHandler __P((int, char *, int, squid_read_data_t *));
-static int memoryAccounted __P((void));
+extern char *diskFileName _PARAMS((int));
+
+/* LOCALS */
+static char *stat_describe _PARAMS((StoreEntry * entry));
+static char *mem_describe _PARAMS((StoreEntry * entry));
+static char *ttl_describe _PARAMS((StoreEntry * entry));
+static char *flags_describe _PARAMS((StoreEntry * entry));
+static char *elapsed_time _PARAMS((StoreEntry * entry, int since, char *TTL));
+static void dummyhandler _PARAMS((cacheinfo *, StoreEntry *));
+static void info_get _PARAMS((cacheinfo *, StoreEntry *));
+static void logReadEndHandler _PARAMS((int, int, log_read_data_t *));
+static void log_clear _PARAMS((cacheinfo *, StoreEntry *));
+static void log_disable _PARAMS((cacheinfo *, StoreEntry *));
+static void log_enable _PARAMS((cacheinfo *, StoreEntry *));
+static void log_get_start _PARAMS((cacheinfo *, StoreEntry *));
+static void log_status_get _PARAMS((cacheinfo *, StoreEntry *));
+static void parameter_get _PARAMS((cacheinfo *, StoreEntry *));
+static void proto_count _PARAMS((cacheinfo *, protocol_t, log_type));
+static void proto_newobject _PARAMS((cacheinfo *, protocol_t, int, int));
+static void proto_purgeobject _PARAMS((cacheinfo *, protocol_t, int));
+static void proto_touchobject _PARAMS((cacheinfo *, protocol_t, int));
+static void server_list _PARAMS((cacheinfo *, StoreEntry *));
+static void squidReadEndHandler _PARAMS((int, int, squid_read_data_t *));
+static void squid_get_start _PARAMS((cacheinfo *, StoreEntry *));
+static void statFiledescriptors _PARAMS((StoreEntry *));
+static void stat_get _PARAMS((cacheinfo *, char *req, StoreEntry *));
+static void stat_io_get _PARAMS((StoreEntry *));
+static void stat_objects_get _PARAMS((cacheinfo *, StoreEntry *, int vm_or_not));
+static void stat_utilization_get _PARAMS((cacheinfo *, StoreEntry *, char *desc));
+static int cache_size_get _PARAMS((cacheinfo *));
+static int logReadHandler _PARAMS((int, char *, int, log_read_data_t *));
+static int squidReadHandler _PARAMS((int, char *, int, squid_read_data_t *));
+static int memoryAccounted _PARAMS((void));
#ifdef UNUSED_CODE
-static int mallinfoTotal __P((void));
+static int mallinfoTotal _PARAMS((void));
#endif
#ifdef XMALLOC_STATISTICS
-static void info_get_mallstat __P((int, int, StoreEntry *));
+static void info_get_mallstat _PARAMS((int, int, StoreEntry *));
#endif
/* process utilization information */
httpReplyHeaderStats(sentry);
} else if (strcmp(req, "filedescriptors") == 0) {
statFiledescriptors(sentry);
+#if USE_ICMP
+ } else if (strcmp(req, "netdb") == 0) {
+ netdbDump(sentry);
+#endif
}
}
*object = obj;
}
-char *
+static char *
stat_describe(StoreEntry * entry)
{
LOCAL_ARRAY(char, state, 256);
return (state);
}
-char *
+static char *
mem_describe(StoreEntry * entry)
{
LOCAL_ARRAY(char, where, 100);
}
-char *
+static char *
ttl_describe(StoreEntry * entry)
{
int hh, mm, ss;
return (TTL);
}
-char *
+static char *
elapsed_time(StoreEntry * entry, int since, char *TTL)
{
int hh, mm, ss, ttl;
}
-char *
+static char *
flags_describe(StoreEntry * entry)
{
LOCAL_ARRAY(char, FLAGS, 32);
/*
- * $Id: stmem.cc,v 1.25 1996/09/18 21:41:08 wessels Exp $
+ * $Id: stmem.cc,v 1.26 1996/09/20 06:29:11 wessels Exp $
*
* DEBUG: section 19 Memory Primitives
* AUTHOR: Harvest Derived
#define USE_MEMALIGN 0
#endif
-static void *get_free_thing __P((stmem_stats * thing));
-static void put_free_thing __P((stmem_stats * thing, void *p));
+static void *get_free_thing _PARAMS((stmem_stats * thing));
+static void put_free_thing _PARAMS((stmem_stats * thing, void *p));
void
}
void
-put_free_request_t(req)
- void *req;
+put_free_request_t(void *req)
{
put_free_thing(&request_pool, req);
}
/*
- * $Id: store.cc,v 1.116 1996/09/18 22:44:53 wessels Exp $
+ * $Id: store.cc,v 1.117 1996/09/20 06:29:13 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
int store_rebuilding = STORE_REBUILDING_SLOW;
/* Static Functions */
-static int storeSwapInStart __P((StoreEntry *, SIH, void *));
-static void destroy_MemObject __P((MemObject *));
-static void destroy_MemObjectData __P((MemObject *));
-static void destroy_StoreEntry __P((StoreEntry *));
-static MemObject *new_MemObject __P((void));
-static mem_ptr new_MemObjectData __P((void));
-static StoreEntry *new_StoreEntry __P((int mem_obj_flag));
-static int storeCheckPurgeMem __P((StoreEntry * e));
-static int storeCheckExpired __P((StoreEntry * e));
-static void storeSwapLog __P((StoreEntry *));
-static int storeHashDelete __P((StoreEntry *));
-static char *storeDescribeStatus __P((StoreEntry *));
-static int compareLastRef __P((StoreEntry ** e1, StoreEntry ** e2));
-static int compareSize __P((StoreEntry ** e1, StoreEntry ** e2));
-static int storeClientListSearch __P((MemObject *, int fd));
-static void storeHashMemInsert __P((StoreEntry *));
-static void storeHashMemDelete __P((StoreEntry *));
-static int storeCopy __P((StoreEntry *, int, int, char *, int *));
-static int storeGetMemSpace __P((int size));
+static int storeSwapInStart _PARAMS((StoreEntry *, SIH, void *));
+static void destroy_MemObject _PARAMS((MemObject *));
+static void destroy_MemObjectData _PARAMS((MemObject *));
+static void destroy_StoreEntry _PARAMS((StoreEntry *));
+static MemObject *new_MemObject _PARAMS((void));
+static mem_ptr new_MemObjectData _PARAMS((void));
+static StoreEntry *new_StoreEntry _PARAMS((int mem_obj_flag));
+static int storeCheckPurgeMem _PARAMS((StoreEntry * e));
+static int storeCheckExpired _PARAMS((StoreEntry * e));
+static void storeSwapLog _PARAMS((StoreEntry *));
+static int storeHashDelete _PARAMS((StoreEntry *));
+static char *storeDescribeStatus _PARAMS((StoreEntry *));
+static int compareLastRef _PARAMS((StoreEntry ** e1, StoreEntry ** e2));
+static int compareSize _PARAMS((StoreEntry ** e1, StoreEntry ** e2));
+static int storeClientListSearch _PARAMS((MemObject *, int fd));
+static void storeHashMemInsert _PARAMS((StoreEntry *));
+static void storeHashMemDelete _PARAMS((StoreEntry *));
+static int storeCopy _PARAMS((StoreEntry *, int, int, char *, int *));
+static int storeGetMemSpace _PARAMS((int size));
/* Now, this table is inaccessible to outsider. They have to use a method
* to access a value in internal storage data structure. */
InvokeHandlers(e);
}
-#if __STDC__
+#if __STDC__
void
storeAppendPrintf(StoreEntry * e, char *fmt,...)
{
/*
- * $Id: tools.cc,v 1.61 1996/09/17 16:32:49 wessels Exp $
+ * $Id: tools.cc,v 1.62 1996/09/20 06:29:17 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
}
void
-squid_signal(int sig, void (*func) (), int flags)
+squid_signal(int sig, void (*func) _PARAMS((int)), int flags)
{
#if HAVE_SIGACTION
struct sigaction sa;
/*
- * $Id: tunnel.cc,v 1.17 1996/09/18 20:12:22 wessels Exp $
+ * $Id: tunnel.cc,v 1.18 1996/09/20 06:29:07 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
static char conn_established[] = "HTTP/1.0 200 Connection established\r\n\r\n";
-static void sslLifetimeExpire __P((int fd, SslStateData * sslState));
-static void sslReadTimeout __P((int fd, SslStateData * sslState));
-static void sslReadServer __P((int fd, SslStateData * sslState));
-static void sslReadClient __P((int fd, SslStateData * sslState));
-static void sslWriteServer __P((int fd, SslStateData * sslState));
-static void sslWriteClient __P((int fd, SslStateData * sslState));
-static void sslConnected __P((int fd, SslStateData * sslState));
-static void sslProxyConnected __P((int fd, SslStateData * sslState));
-static void sslConnect __P((int fd, struct hostent *, void *));
-static void sslConnInProgress __P((int fd, SslStateData * sslState));
-static void sslErrorComplete __P((int, char *, int, int, void *));
-static void sslClose __P((SslStateData * sslState));
-static int sslClientClosed __P((int fd, SslStateData * sslState));
+static void sslLifetimeExpire _PARAMS((int fd, SslStateData * sslState));
+static void sslReadTimeout _PARAMS((int fd, SslStateData * sslState));
+static void sslReadServer _PARAMS((int fd, SslStateData * sslState));
+static void sslReadClient _PARAMS((int fd, SslStateData * sslState));
+static void sslWriteServer _PARAMS((int fd, SslStateData * sslState));
+static void sslWriteClient _PARAMS((int fd, SslStateData * sslState));
+static void sslConnected _PARAMS((int fd, SslStateData * sslState));
+static void sslProxyConnected _PARAMS((int fd, SslStateData * sslState));
+static void sslConnect _PARAMS((int fd, struct hostent *, void *));
+static void sslConnInProgress _PARAMS((int fd, SslStateData * sslState));
+static void sslErrorComplete _PARAMS((int, char *, int, int, void *));
+static void sslClose _PARAMS((SslStateData * sslState));
+static int sslClientClosed _PARAMS((int fd, SslStateData * sslState));
static void
sslClose(SslStateData * sslState)
/*
- * $Id: wais.cc,v 1.43 1996/09/18 20:12:25 wessels Exp $
+ * $Id: wais.cc,v 1.44 1996/09/20 06:29:19 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
char request[MAX_URL + 1];
} WaisStateData;
-static int waisStateFree __P((int, WaisStateData *));
-static void waisReadReplyTimeout __P((int, WaisStateData *));
-static void waisLifetimeExpire __P((int, WaisStateData *));
-static void waisReadReply __P((int, WaisStateData *));
-static void waisSendComplete __P((int, char *, int, int, void *));
-static void waisSendRequest __P((int, WaisStateData *));
-static void waisConnInProgress __P((int, WaisStateData *));
-static void waisConnect __P((int, struct hostent *, void *));
+static int waisStateFree _PARAMS((int, WaisStateData *));
+static void waisReadReplyTimeout _PARAMS((int, WaisStateData *));
+static void waisLifetimeExpire _PARAMS((int, WaisStateData *));
+static void waisReadReply _PARAMS((int, WaisStateData *));
+static void waisSendComplete _PARAMS((int, char *, int, int, void *));
+static void waisSendRequest _PARAMS((int, WaisStateData *));
+static void waisConnInProgress _PARAMS((int, WaisStateData *));
+static void waisConnect _PARAMS((int, struct hostent *, void *));
static int
waisStateFree(int fd, WaisStateData * waisState)