1/*
2 * Copyright (C) 2005-2008  Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2001  Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
16 */
17#ifndef port_before_h
18#define port_before_h
19
20#include <config.h>
21
22#ifdef __HAIKU__
23#	include <sys/sockio.h>
24#	define ETOOMANYREFS EBADF
25
26// inet_*() are just weak symbols
27#	define	inet_addr		__inet_addr
28#	define	inet_aton		__inet_aton
29#	define	inet_lnaof		__inet_lnaof
30#	define	inet_makeaddr	__inet_makeaddr
31#	define	inet_neta		__inet_neta
32#	define	inet_netof		__inet_netof
33#	define	inet_network	__inet_network
34#	define	inet_net_ntop	__inet_net_ntop
35#	define	inet_net_pton	__inet_net_pton
36#	define	inet_cidr_ntop	__inet_cidr_ntop
37#	define	inet_cidr_pton	__inet_cidr_pton
38#	define	inet_ntoa		__inet_ntoa
39#	define	inet_pton		__inet_pton
40#	define	inet_ntop		__inet_ntop
41#	define	inet_nsap_addr	__inet_nsap_addr
42#	define	inet_nsap_ntoa	__inet_nsap_ntoa
43
44#define	__weak_alias(alias, sym) __asm(".weak " #alias "\n" #alias " = " #sym);
45
46/* From nameser.h: Private data structure - do not use from outside library. */
47struct _ns_flagdata {  int mask, shift;  };
48extern struct _ns_flagdata _ns_flagdata[];
49#endif
50
51#define ISC_SOCKLEN_T socklen_t
52
53#ifdef __GNUC__
54#define ISC_FORMAT_PRINTF(fmt, args) \
55	__attribute__((__format__(__printf__, fmt, args)))
56#else
57#define ISC_FORMAT_PRINTF(fmt, args)
58#endif
59
60#define DE_CONST(konst, var) \
61	do { \
62		union { const void *k; void *v; } _u; \
63		_u.k = konst; \
64		var = _u.v; \
65	} while (0)
66
67#define UNUSED(x) (x) = (x)
68
69#endif
70