xref: /haiku/src/system/libnetwork/netresolv/port_before.h (revision 830f67ef991407f287dbc1238aa5f5906d90c991)
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 
50 #define	__weak_alias(alias, sym) __asm(".weak " #alias "\n" #alias " = " #sym);
51 
52 /* From nameser.h: Private data structure - do not use from outside library. */
53 struct _ns_flagdata {  int mask, shift;  };
54 extern struct _ns_flagdata _ns_flagdata[];
55 #endif
56 
57 struct group;           /* silence warning */
58 struct passwd;          /* silence warning */
59 struct timeval;         /* silence warning */
60 struct timezone;        /* silence warning */
61 
62 #ifdef HAVE_SYS_TIMERS_H
63 #include <sys/timers.h>
64 #endif
65 #include <limits.h>
66 
67 #ifdef ISC_PLATFORM_NEEDTIMESPEC
68 #include <time.h>		/* For time_t */
69 struct timespec {
70 	time_t  tv_sec;         /* seconds */
71 	long    tv_nsec;        /* nanoseconds */
72 };
73 #endif
74 #ifndef HAVE_MEMMOVE
75 #define memmove(a,b,c) bcopy(b,a,c)
76 #endif
77 
78 #undef WANT_IRS_GR
79 #undef WANT_IRS_NIS
80 #undef WANT_IRS_PW
81 
82 #undef BSD_COMP
83 #undef HAVE_POLL
84 #undef HAVE_MD5
85 #undef SOLARIS2
86 
87 #define DO_PTHREADS
88 #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
89 #define GETNETBYADDR_ADDR_T long
90 #define SETPWENT_VOID 1
91 #define SETGRENT_VOID 1
92 
93 #define NET_R_ARGS char *buf, int buflen
94 #define NET_R_BAD NULL
95 #define NET_R_COPY buf, buflen
96 #define NET_R_COPY_ARGS NET_R_ARGS
97 #define NET_R_END_RESULT(x) /*empty*/
98 #define NET_R_END_RETURN void
99 #undef NET_R_ENT_ARGS /*empty*/
100 #define NET_R_OK nptr
101 #define NET_R_RETURN struct netent *
102 #undef NET_R_SET_RESULT /*empty*/
103 #undef NET_R_SETANSWER
104 #define NET_R_SET_RETURN void
105 #undef NETENT_DATA
106 
107 
108 #define GROUP_R_SET_RETURN void
109 #undef GROUP_R_SET_RESULT /*empty*/
110 #define GROUP_R_END_RETURN void
111 #define GROUP_R_END_RESULT(x) /*empty*/
112 
113 #define GROUP_R_ENT_ARGS void
114 
115 
116 
117 #define HOST_R_ARGS char *buf, int buflen, int *h_errnop
118 #define HOST_R_BAD NULL
119 #define HOST_R_COPY buf, buflen
120 #define HOST_R_COPY_ARGS char *buf, int buflen
121 #define HOST_R_END_RESULT(x) /*empty*/
122 #define HOST_R_END_RETURN void
123 #undef HOST_R_ENT_ARGS /*empty*/
124 #define HOST_R_ERRNO *h_errnop = h_errno
125 #define HOST_R_OK hptr
126 #define HOST_R_RETURN struct hostent *
127 #undef HOST_R_SETANSWER
128 #undef HOST_R_SET_RESULT
129 #define HOST_R_SET_RETURN void
130 #undef HOSTENT_DATA
131 
132 #define NGR_R_ARGS char *buf, int buflen
133 #define NGR_R_BAD (0)
134 #define NGR_R_COPY buf, buflen
135 #define NGR_R_COPY_ARGS NGR_R_ARGS
136 #define NGR_R_CONST
137 #define NGR_R_END_RESULT(x)  /*empty*/
138 #define NGR_R_END_RETURN void
139 #undef NGR_R_END_ARGS /*empty*/
140 #define NGR_R_OK 1
141 #define NGR_R_RETURN int
142 #define NGR_R_SET_CONST const
143 #undef NGR_R_SET_RESULT /*empty*/
144 #define NGR_R_SET_RETURN void
145 #undef NGR_R_SET_ARGS
146 
147 
148 #if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
149 #define NGR_R_SET_ARGS NGR_R_END_ARGS
150 #endif
151 
152 #define PROTO_R_ARGS char *buf, int buflen
153 #define PROTO_R_BAD NULL
154 #define PROTO_R_COPY buf, buflen
155 #define PROTO_R_COPY_ARGS PROTO_R_ARGS
156 #define PROTO_R_END_RESULT(x) /*empty*/
157 #define PROTO_R_END_RETURN void
158 #undef PROTO_R_ENT_ARGS /*empty*/
159 #undef PROTO_R_ENT_UNUSED
160 #define PROTO_R_OK pptr
161 #undef PROTO_R_SETANSWER
162 #define PROTO_R_RETURN struct protoent *
163 #undef PROTO_R_SET_RESULT
164 #define PROTO_R_SET_RETURN void
165 #undef PROTOENT_DATA
166 
167 
168 
169 
170 
171 #define PASS_R_END_RESULT(x) /*empty*/
172 #define PASS_R_END_RETURN void
173 #undef PASS_R_ENT_ARGS
174 
175 
176 #undef PASS_R_SET_RESULT /*empty*/
177 #define PASS_R_SET_RETURN void
178 
179 #define SERV_R_ARGS char *buf, int buflen
180 #define SERV_R_BAD NULL
181 #define SERV_R_COPY buf, buflen
182 #define SERV_R_COPY_ARGS SERV_R_ARGS
183 #define SERV_R_END_RESULT(x) /*empty*/
184 #define SERV_R_END_RETURN void
185 #undef SERV_R_ENT_ARGS /*empty*/
186 #undef SERV_R_ENT_UNUSED /*empty*/
187 #define SERV_R_OK sptr
188 #undef SERV_R_SETANSWER
189 #define SERV_R_RETURN struct servent *
190 #undef SERV_R_SET_RESULT
191 #define SERV_R_SET_RETURN void
192 
193 
194 
195 #define DE_CONST(konst, var) \
196 	do { \
197 		union { const void *k; void *v; } _u; \
198 		_u.k = konst; \
199 		var = _u.v; \
200 	} while (0)
201 
202 #define UNUSED(x) (x) = (x)
203 
204 #undef NEED_SOLARIS_BITTYPES
205 #define ISC_SOCKLEN_T socklen_t
206 
207 #ifdef __GNUC__
208 #define ISC_FORMAT_PRINTF(fmt, args) \
209 	__attribute__((__format__(__printf__, fmt, args)))
210 #else
211 #define ISC_FORMAT_PRINTF(fmt, args)
212 #endif
213 
214 /* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
215 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
216 #include <sys/byteorder.h>
217 #endif
218 
219 #endif
220 
221 /*! \file */
222