xref: /haiku/src/system/libnetwork/netresolv/port_before.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
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 
18 /* $Id: port_before.h.in,v 1.31 2008/02/28 05:36:10 marka Exp $ */
19 
20 #ifndef port_before_h
21 #define port_before_h
22 #include <config.h>
23 
24 #ifdef NEED_SUN4PROTOS
25 #define _PARAMS(x) x
26 #endif
27 
28 #ifdef __HAIKU__
29 #	include <sys/sockio.h>
30 #	define ETOOMANYREFS EBADF
31 
32 // inet_*() are just weak symbols
33 #	define	inet_addr		__inet_addr
34 #	define	inet_aton		__inet_aton
35 #	define	inet_lnaof		__inet_lnaof
36 #	define	inet_makeaddr	__inet_makeaddr
37 #	define	inet_neta		__inet_neta
38 #	define	inet_netof		__inet_netof
39 #	define	inet_network	__inet_network
40 #	define	inet_net_ntop	__inet_net_ntop
41 #	define	inet_net_pton	__inet_net_pton
42 #	define	inet_cidr_ntop	__inet_cidr_ntop
43 #	define	inet_cidr_pton	__inet_cidr_pton
44 #	define	inet_ntoa		__inet_ntoa
45 #	define	inet_pton		__inet_pton
46 #	define	inet_ntop		__inet_ntop
47 #	define	inet_nsap_addr	__inet_nsap_addr
48 #	define	inet_nsap_ntoa	__inet_nsap_ntoa
49 #endif
50 
51 struct group;           /* silence warning */
52 struct passwd;          /* silence warning */
53 struct timeval;         /* silence warning */
54 struct timezone;        /* silence warning */
55 
56 #ifdef HAVE_SYS_TIMERS_H
57 #include <sys/timers.h>
58 #endif
59 #include <limits.h>
60 
61 #ifdef ISC_PLATFORM_NEEDTIMESPEC
62 #include <time.h>		/* For time_t */
63 struct timespec {
64 	time_t  tv_sec;         /* seconds */
65 	long    tv_nsec;        /* nanoseconds */
66 };
67 #endif
68 #ifndef HAVE_MEMMOVE
69 #define memmove(a,b,c) bcopy(b,a,c)
70 #endif
71 
72 #undef WANT_IRS_GR
73 #undef WANT_IRS_NIS
74 #undef WANT_IRS_PW
75 
76 #undef BSD_COMP
77 #undef HAVE_POLL
78 #undef HAVE_MD5
79 #undef SOLARIS2
80 
81 #define DO_PTHREADS
82 #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
83 #define GETNETBYADDR_ADDR_T long
84 #define SETPWENT_VOID 1
85 #define SETGRENT_VOID 1
86 
87 #define NET_R_ARGS char *buf, int buflen
88 #define NET_R_BAD NULL
89 #define NET_R_COPY buf, buflen
90 #define NET_R_COPY_ARGS NET_R_ARGS
91 #define NET_R_END_RESULT(x) /*empty*/
92 #define NET_R_END_RETURN void
93 #undef NET_R_ENT_ARGS /*empty*/
94 #define NET_R_OK nptr
95 #define NET_R_RETURN struct netent *
96 #undef NET_R_SET_RESULT /*empty*/
97 #undef NET_R_SETANSWER
98 #define NET_R_SET_RETURN void
99 #undef NETENT_DATA
100 
101 
102 #define GROUP_R_SET_RETURN void
103 #undef GROUP_R_SET_RESULT /*empty*/
104 #define GROUP_R_END_RETURN void
105 #define GROUP_R_END_RESULT(x) /*empty*/
106 
107 #define GROUP_R_ENT_ARGS void
108 
109 
110 
111 #define HOST_R_ARGS char *buf, int buflen, int *h_errnop
112 #define HOST_R_BAD NULL
113 #define HOST_R_COPY buf, buflen
114 #define HOST_R_COPY_ARGS char *buf, int buflen
115 #define HOST_R_END_RESULT(x) /*empty*/
116 #define HOST_R_END_RETURN void
117 #undef HOST_R_ENT_ARGS /*empty*/
118 #define HOST_R_ERRNO *h_errnop = h_errno
119 #define HOST_R_OK hptr
120 #define HOST_R_RETURN struct hostent *
121 #undef HOST_R_SETANSWER
122 #undef HOST_R_SET_RESULT
123 #define HOST_R_SET_RETURN void
124 #undef HOSTENT_DATA
125 
126 #define NGR_R_ARGS char *buf, int buflen
127 #define NGR_R_BAD (0)
128 #define NGR_R_COPY buf, buflen
129 #define NGR_R_COPY_ARGS NGR_R_ARGS
130 #define NGR_R_CONST
131 #define NGR_R_END_RESULT(x)  /*empty*/
132 #define NGR_R_END_RETURN void
133 #undef NGR_R_END_ARGS /*empty*/
134 #define NGR_R_OK 1
135 #define NGR_R_RETURN int
136 #define NGR_R_SET_CONST const
137 #undef NGR_R_SET_RESULT /*empty*/
138 #define NGR_R_SET_RETURN void
139 #undef NGR_R_SET_ARGS
140 
141 
142 #if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
143 #define NGR_R_SET_ARGS NGR_R_END_ARGS
144 #endif
145 
146 #define PROTO_R_ARGS char *buf, int buflen
147 #define PROTO_R_BAD NULL
148 #define PROTO_R_COPY buf, buflen
149 #define PROTO_R_COPY_ARGS PROTO_R_ARGS
150 #define PROTO_R_END_RESULT(x) /*empty*/
151 #define PROTO_R_END_RETURN void
152 #undef PROTO_R_ENT_ARGS /*empty*/
153 #undef PROTO_R_ENT_UNUSED
154 #define PROTO_R_OK pptr
155 #undef PROTO_R_SETANSWER
156 #define PROTO_R_RETURN struct protoent *
157 #undef PROTO_R_SET_RESULT
158 #define PROTO_R_SET_RETURN void
159 #undef PROTOENT_DATA
160 
161 
162 
163 
164 
165 #define PASS_R_END_RESULT(x) /*empty*/
166 #define PASS_R_END_RETURN void
167 #undef PASS_R_ENT_ARGS
168 
169 
170 #undef PASS_R_SET_RESULT /*empty*/
171 #define PASS_R_SET_RETURN void
172 
173 #define SERV_R_ARGS char *buf, int buflen
174 #define SERV_R_BAD NULL
175 #define SERV_R_COPY buf, buflen
176 #define SERV_R_COPY_ARGS SERV_R_ARGS
177 #define SERV_R_END_RESULT(x) /*empty*/
178 #define SERV_R_END_RETURN void
179 #undef SERV_R_ENT_ARGS /*empty*/
180 #undef SERV_R_ENT_UNUSED /*empty*/
181 #define SERV_R_OK sptr
182 #undef SERV_R_SETANSWER
183 #define SERV_R_RETURN struct servent *
184 #undef SERV_R_SET_RESULT
185 #define SERV_R_SET_RETURN void
186 
187 
188 
189 #define DE_CONST(konst, var) \
190 	do { \
191 		union { const void *k; void *v; } _u; \
192 		_u.k = konst; \
193 		var = _u.v; \
194 	} while (0)
195 
196 #define UNUSED(x) (x) = (x)
197 
198 #undef NEED_SOLARIS_BITTYPES
199 #define ISC_SOCKLEN_T socklen_t
200 
201 #ifdef __GNUC__
202 #define ISC_FORMAT_PRINTF(fmt, args) \
203 	__attribute__((__format__(__printf__, fmt, args)))
204 #else
205 #define ISC_FORMAT_PRINTF(fmt, args)
206 #endif
207 
208 /* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
209 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
210 #include <sys/byteorder.h>
211 #endif
212 
213 #endif
214 
215 /*! \file */
216