common.h revision 60737
1487SN/A/*-
2759Saefimov * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav
3487SN/A * All rights reserved.
4487SN/A *
5487SN/A * Redistribution and use in source and binary forms, with or without
6487SN/A * modification, are permitted provided that the following conditions
7487SN/A * are met:
8487SN/A * 1. Redistributions of source code must retain the above copyright
9487SN/A *    notice, this list of conditions and the following disclaimer
10487SN/A *    in this position and unchanged.
11487SN/A * 2. Redistributions in binary form must reproduce the above copyright
12487SN/A *    notice, this list of conditions and the following disclaimer in the
13487SN/A *    documentation and/or other materials provided with the distribution.
14487SN/A * 3. The name of the author may not be used to endorse or promote products
15487SN/A *    derived from this software without specific prior written permission
16487SN/A *
17487SN/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18487SN/A * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19487SN/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20487SN/A * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21487SN/A * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22487SN/A * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23487SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24487SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25487SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26487SN/A * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27487SN/A *
28759Saefimov * $FreeBSD: head/lib/libfetch/common.h 60737 2000-05-20 18:23:51Z ume $
29759Saefimov */
30487SN/A
31487SN/A#ifndef _COMMON_H_INCLUDED
32487SN/A#define _COMMON_H_INCLUDED
33487SN/A
34487SN/A/* Structure used for error message lists */
35487SN/A#define ERRCAT_
36487SN/Astruct fetcherr {
37487SN/A    const int num, cat;
38487SN/A    const char *string;
39759Saefimov};
40487SN/A
41487SN/Avoid		 _fetch_seterr(struct fetcherr *p, int e);
42487SN/Avoid		 _fetch_syserr(void);
43487SN/Aint		 _fetch_info(char *fmt, ...);
44487SN/Aint		 _fetch_connect(char *host, int port, int af, int verbose);
45487SN/Aint		 _fetch_getln(int fd, char **buf, size_t *size, size_t *len);
46487SN/Aint		 _fetch_add_entry(struct url_ent **p, int *size, int *len,
47487SN/A				  char *name, struct url_stat *stat);
48487SN/A
49487SN/A#define _ftp_seterr(n)	 _fetch_seterr(_ftp_errlist, n)
50487SN/A#define _http_seterr(n)	 _fetch_seterr(_http_errlist, n)
51487SN/A#define _netdb_seterr(n) _fetch_seterr(_netdb_errlist, n)
52487SN/A#define _url_seterr(n)	 _fetch_seterr(_url_errlist, n)
53487SN/A
54487SN/A#ifndef NDEBUG
55487SN/A#define DEBUG(x) do x; while (0)
56487SN/A#else
57487SN/A#define DEBUG(x) do { } while (0)
58487SN/A#endif
59487SN/A
60487SN/A#endif
61759Saefimov