]> git.ipfire.org Git - thirdparty/squid.git/blame - include/util.h
Updated copyright
[thirdparty/squid.git] / include / util.h
CommitLineData
090089c4 1/*
2b6662ba 2 * $Id: util.h,v 1.58 2001/01/12 00:37:12 wessels Exp $
30a4f2a8 3 *
4 * AUTHOR: Harvest Derived
5 *
2b6662ba 6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
30a4f2a8 8 *
2b6662ba 9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
30a4f2a8 17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
cbdec147 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30a4f2a8 31 *
090089c4 32 */
01fe0751 33
090089c4 34#ifndef _UTIL_H_
35#define _UTIL_H_
36
37#include "config.h"
38#include <stdio.h>
39#include <time.h>
9d90e665 40#if HAVE_TIME_H
41#include <time.h>
42#endif
43#if HAVE_SYS_TIME_H
44#include <sys/time.h>
45#endif
090089c4 46
47#if !defined(SQUIDHOSTNAMELEN)
48#include <sys/param.h>
30a4f2a8 49#ifndef _SQUID_NETDB_H_ /* need protection on NEXTSTEP */
50#define _SQUID_NETDB_H_
090089c4 51#include <netdb.h>
30a4f2a8 52#endif
090089c4 53#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128)
54#define SQUIDHOSTNAMELEN 128
55#else
56#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN
57#endif
58#endif
59
c8f322d5 60#if defined(_SQUID_FREEBSD_)
61#define _etext etext
62#endif
63
f5b8bbc4 64extern const char *getfullhostname(void);
65extern const char *mkhttpdlogtime(const time_t *);
66extern const char *mkrfc1123(time_t);
67extern char *uudecode(const char *);
68extern char *xstrdup(const char *);
c68e9c6b 69extern char *xstrndup(const char *, size_t);
f5b8bbc4 70extern const char *xstrerror(void);
71extern const char *xbstrerror(int);
72extern int tvSubMsec(struct timeval, struct timeval);
73extern int tvSubUsec(struct timeval, struct timeval);
3a074b2e 74extern double tvSubDsec(struct timeval, struct timeval);
f5b8bbc4 75extern char *xstrncpy(char *, const char *, size_t);
cb69b4c7 76extern size_t xcountws(const char *str);
f5b8bbc4 77extern time_t parse_rfc1123(const char *str);
78extern void *xcalloc(int, size_t);
79extern void *xmalloc(size_t);
80extern void *xrealloc(void *, size_t);
81extern void Tolower(char *);
82extern void xfree(void *);
83extern void xxfree(void *);
30a4f2a8 84
6f483f6d 85/* rfc1738.c */
f5b8bbc4 86extern char *rfc1738_escape(const char *);
9bc73deb 87extern char *rfc1738_escape_unescaped(const char *);
88extern char *rfc1738_escape_part(const char *);
41591069 89extern void rfc1738_unescape(char *);
6f483f6d 90
10270faa 91/* html.c */
92extern char *html_quote(const char *);
93
30a4f2a8 94#if XMALLOC_STATISTICS
58cd5bbd 95extern void malloc_statistics(void (*)(int, int, int, void *), void *);
30a4f2a8 96#endif
090089c4 97
027acbaf 98#if XMALLOC_TRACE
99#define xmalloc(size) (xmalloc_func="xmalloc",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xmalloc(size))
100#define xfree(ptr) (xmalloc_func="xfree",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xfree(ptr))
101#define xxfree(ptr) (xmalloc_func="xxfree",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xxfree(ptr))
102#define xrealloc(ptr,size) (xmalloc_func="xrealloc",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xrealloc(ptr,size))
103#define xcalloc(n,size) (xmalloc_func="xcalloc",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xcalloc(n,size))
104#define xstrdup(ptr) (xmalloc_func="xstrdup",xmalloc_line=__LINE__,xmalloc_file=__FILE__,xstrdup(ptr))
105extern int xmalloc_line;
106extern char *xmalloc_file;
107extern char *xmalloc_func;
33ab18e8 108extern int xmalloc_trace;
e76fc3b6 109extern size_t xmalloc_total;
79420eee 110extern void xmalloc_find_leaks(void);
027acbaf 111#endif
112
6ad85e8a 113typedef struct in_addr SIA;
f5b8bbc4 114extern int safe_inet_addr(const char *, SIA *);
115extern time_t parse_iso3307_time(const char *buf);
116extern char *base64_decode(const char *coded);
f86a22c5 117extern const char *base64_encode(const char *decoded);
94439e4e 118extern const char *base64_encode_bin(const char *data, int len);
6ad85e8a 119
7021844c 120extern double xpercent(double part, double whole);
02922e76 121extern int xpercentInt(double part, double whole);
7021844c 122extern double xdiv(double nom, double denom);
123
de336bbe 124extern const char *xitoa(int num);
7021844c 125
da59eee6 126#if !HAVE_DRAND48
127double drand48(void);
128#endif
129
090089c4 130#endif /* ndef _UTIL_H_ */