libkafs: derivation from non-DES key (rxkad-kdf)
[heimdal.git] / lib / roken / roken.h.in
blobcc5e827cc329e00edab28175087ca2ffe70a58e8
1 /* -*- C -*- */
2 /*
3 * Copyright (c) 1995-2005 Kungliga Tekniska Högskolan
4 * (Royal Institute of Technology, Stockholm, Sweden).
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the Institute nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <stdarg.h>
38 #ifdef HAVE_STDINT_H
39 #include <stdint.h>
40 #endif
41 #include <string.h>
42 #include <limits.h>
43 #include <signal.h>
45 #ifndef ROKEN_LIB_FUNCTION
46 #ifdef _WIN32
47 # define ROKEN_LIB_CALL __cdecl
48 # ifdef ROKEN_LIB_DYNAMIC
49 # define ROKEN_LIB_FUNCTION __declspec(dllimport)
50 # define ROKEN_LIB_VARIABLE __declspec(dllimport)
51 # else
52 # define ROKEN_LIB_FUNCTION
53 # define ROKEN_LIB_VARIABLE
54 # endif
55 #else
56 #define ROKEN_LIB_FUNCTION
57 #define ROKEN_LIB_CALL
58 #define ROKEN_LIB_VARIABLE
59 #endif
60 #endif
62 #ifdef HAVE_WINSOCK
63 /* Declarations for Microsoft Windows */
65 #include <winsock2.h>
66 #include <ws2tcpip.h>
69 * error codes for inet_ntop/inet_pton
71 typedef SOCKET rk_socket_t;
73 #define rk_closesocket(x) closesocket(x)
74 #define rk_INVALID_SOCKET INVALID_SOCKET
75 #define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET)
76 #define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR)
77 #define rk_SOCK_ERRNO WSAGetLastError()
79 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp);
81 #define rk_SOCK_INIT() rk_WSAStartup()
82 #define rk_SOCK_EXIT() rk_WSACleanup()
84 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void);
85 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void);
87 #else /* not WinSock */
89 typedef int rk_socket_t;
91 #define rk_closesocket(x) close(x)
92 #define rk_SOCK_IOCTL(s,c,a) ioctl((s),(c),(a))
93 #define rk_IS_BAD_SOCKET(s) ((s) < 0)
94 #define rk_IS_SOCKET_ERROR(rv) ((rv) < 0)
95 #define rk_SOCK_ERRNO errno
96 #define rk_INVALID_SOCKET (-1)
98 #define rk_SOCK_INIT() 0
99 #define rk_SOCK_EXIT() do { } while(0)
101 #endif /* WinSock */
103 #ifndef IN_LOOPBACKNET
104 #define IN_LOOPBACKNET 127
105 #endif
107 #ifdef _MSC_VER
108 #ifndef HAVE_STDINT_H
109 #include <intsafe.h>
110 #endif
112 /* Declarations for Microsoft Visual C runtime on Windows */
114 #include<process.h>
116 #include<io.h>
118 #ifndef __BIT_TYPES_DEFINED__
119 #define __BIT_TYPES_DEFINED__
121 typedef __int8 int8_t;
122 typedef __int16 int16_t;
123 typedef __int32 int32_t;
124 typedef __int64 int64_t;
125 typedef unsigned __int8 uint8_t;
126 typedef unsigned __int16 uint16_t;
127 typedef unsigned __int32 uint32_t;
128 typedef unsigned __int64 uint64_t;
129 typedef uint8_t u_int8_t;
130 typedef uint16_t u_int16_t;
131 typedef uint32_t u_int32_t;
132 typedef uint64_t u_int64_t;
134 #endif /* __BIT_TYPES_DEFINED__ */
136 #define UNREACHABLE(x) x
137 #define UNUSED_ARGUMENT(x) ((void) x)
139 #define RETSIGTYPE void
141 #define VOID_RETSIGTYPE 1
143 #ifdef VOID_RETSIGTYPE
144 #define SIGRETURN(x) return
145 #else
146 #define SIGRETURN(x) return (RETSIGTYPE)(x)
147 #endif
149 #ifndef CPP_ONLY
151 typedef int pid_t;
153 typedef unsigned int gid_t;
155 typedef unsigned int uid_t;
157 typedef unsigned short mode_t;
159 #endif
161 #ifndef __cplusplus
162 #define inline __inline
163 #endif
165 #else
167 #define UNREACHABLE(x)
168 #define UNUSED_ARGUMENT(x)
170 #endif
172 #ifdef _AIX
173 struct ether_addr;
174 struct sockaddr_dl;
175 #endif
176 #ifdef HAVE_SYS_PARAM_H
177 #include <sys/param.h>
178 #endif
179 #ifdef HAVE_INTTYPES_H
180 #include <inttypes.h>
181 #endif
182 #ifdef HAVE_SYS_TYPES_H
183 #include <sys/types.h>
184 #endif
185 #ifdef HAVE_SYS_ERRNO_H
186 #include <sys/errno.h>
187 #endif
188 #ifdef HAVE_SYS_BITYPES_H
189 #include <sys/bitypes.h>
190 #endif
191 #ifdef HAVE_BIND_BITYPES_H
192 #include <bind/bitypes.h>
193 #endif
194 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
195 #include <netinet/in6_machtypes.h>
196 #endif
197 #ifdef HAVE_UNISTD_H
198 #include <unistd.h>
199 #endif
200 #ifdef HAVE_SYS_SOCKET_H
201 #include <sys/socket.h>
202 #endif
203 #ifdef HAVE_SYS_UIO_H
204 #include <sys/uio.h>
205 #endif
206 #ifdef HAVE_GRP_H
207 #include <grp.h>
208 #endif
209 #ifdef HAVE_SYS_STAT_H
210 #include <sys/stat.h>
211 #endif
212 #ifdef HAVE_NETINET_IN_H
213 #include <netinet/in.h>
214 #endif
215 #ifdef HAVE_NETINET_IN6_H
216 #include <netinet/in6.h>
217 #endif
218 #ifdef HAVE_NETINET6_IN6_H
219 #include <netinet6/in6.h>
220 #endif
221 #ifdef HAVE_ARPA_INET_H
222 #include <arpa/inet.h>
223 #endif
224 #ifdef HAVE_NETDB_H
225 #include <netdb.h>
226 #endif
227 #ifdef HAVE_ARPA_NAMESER_H
228 #include <arpa/nameser.h>
229 #endif
230 #ifdef HAVE_RESOLV_H
231 #include <resolv.h>
232 #endif
233 #ifdef HAVE_SYSLOG_H
234 #include <syslog.h>
235 #endif
236 #ifdef HAVE_FCNTL_H
237 #include <fcntl.h>
238 #endif
239 #ifdef HAVE_ERRNO_H
240 #include <errno.h>
241 #endif
242 #include <err.h>
243 #ifdef HAVE_TERMIOS_H
244 #include <termios.h>
245 #endif
246 #ifdef HAVE_SYS_IOCTL_H
247 #include <sys/ioctl.h>
248 #endif
249 #ifdef TIME_WITH_SYS_TIME
250 #include <sys/time.h>
251 #include <time.h>
252 #elif defined(HAVE_SYS_TIME_H)
253 #include <sys/time.h>
254 #else
255 #include <time.h>
256 #endif
258 #ifdef HAVE_PATHS_H
259 #include <paths.h>
260 #endif
262 #ifdef HAVE_DIRENT_H
263 #include <dirent.h>
264 #endif
266 #ifdef HAVE_DIRECT_H
267 #include <direct.h>
268 #endif
270 #ifdef BACKSLASH_PATH_DELIM
271 #define rk_PATH_DELIM '\\'
272 #endif
274 #ifndef HAVE_SSIZE_T
275 #ifndef SSIZE_T_DEFINED
276 #ifdef ssize_t
277 #undef ssize_t
278 #endif
279 #ifdef _WIN64
280 typedef __int64 ssize_t;
281 #else
282 typedef int ssize_t;
283 #endif
284 #define SSIZE_T_DEFINED
285 #endif /* SSIZE_T_DEFINED */
286 #endif /* HAVE_SSIZE_T */
288 #include <roken-common.h>
290 ROKEN_CPP_START
292 #ifdef HAVE_UINTPTR_T
293 #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
294 #else
295 #define rk_UNCONST(x) ((void *)(unsigned long)(const void *)(x))
296 #endif
298 #if !defined(HAVE_SETSID) && defined(HAVE__SETSID)
299 #define setsid _setsid
300 #endif
302 #ifdef _MSC_VER
303 /* Additional macros for Visual C/C++ runtime */
305 #define close _close
307 #define getpid _getpid
309 #define open _open
311 #define chdir _chdir
313 #define fsync _commit
315 /* The MSVC implementation of snprintf is not C99 compliant. */
316 #define snprintf rk_snprintf
317 #define vsnprintf rk_vsnprintf
318 #define vasnprintf rk_vasnprintf
319 #define vasprintf rk_vasprintf
320 #define asnprintf rk_asnprintf
321 #define asprintf rk_asprintf
323 #define _PIPE_BUFFER_SZ 8192
324 #define pipe(fds) _pipe((fds), _PIPE_BUFFER_SZ, O_BINARY);
326 #define ftruncate(fd, sz) _chsize((fd), (sz))
328 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
329 rk_snprintf (char *str, size_t sz, const char *format, ...);
331 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
332 rk_asprintf (char **ret, const char *format, ...);
334 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
335 rk_asnprintf (char **ret, size_t max_sz, const char *format, ...);
337 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
338 rk_vasprintf (char **ret, const char *format, va_list args);
340 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
341 rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args);
343 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
344 rk_vsnprintf (char *str, size_t sz, const char *format, va_list args);
346 /* missing stat.h predicates */
348 #define S_ISREG(m) (((m) & _S_IFREG) == _S_IFREG)
350 #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
352 #define S_ISCHR(m) (((m) & _S_IFCHR) == _S_IFCHR)
354 #define S_ISFIFO(m) (((m) & _S_IFIFO) == _S_IFIFO)
356 /* The following are not implemented:
358 S_ISLNK(m)
359 S_ISSOCK(m)
360 S_ISBLK(m)
363 /* The following symbolic constants are provided for rk_mkdir mode */
365 #define S_IRWXU 00700 /* user (file owner) has read, write and execute permission */
366 #define S_IRUSR 00400 /* user has read permission */
367 #define S_IWUSR 00200 /* user has write permission */
368 #define S_IXUSR 00100 /* user has execute permission */
369 #define S_IRWXG 00070 /* group has read, write and execute permission */
370 #define S_IRGRP 00040 /* group has read permission */
371 #define S_IWGRP 00020 /* group has write permission */
372 #define S_IXGRP 00010 /* group has execute permission */
373 #define S_IRWXO 00007 /* others have read, write and execute permission */
374 #define S_IROTH 00004 /* others have read permission */
375 #define S_IWOTH 00002 /* others have write permission */
376 #define S_IXOTH 00001 /* others have execute permission */
378 #if !defined(ROKEN_NO_DEFINE_ALLOCATORS)
379 /* Ensure that a common memory allocator is used by all */
380 #define calloc rk_calloc
381 #define free rk_free
382 #define malloc rk_malloc
383 #define realloc rk_realloc
384 #define strdup rk_strdup
385 #define wcsdup rk_wcsdup
386 #endif
388 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL
389 rk_calloc(size_t, size_t);
391 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
392 rk_free(void *);
394 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL
395 rk_malloc(size_t);
397 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL
398 rk_realloc(void *, size_t);
400 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL
401 rk_strdup(const char *);
403 ROKEN_LIB_FUNCTION unsigned short * ROKEN_LIB_CALL
404 rk_wcsdup(const unsigned short *);
406 #endif /* _MSC_VER */
408 #ifdef HAVE_WINSOCK
410 /* While we are at it, define WinSock specific scatter gather socket
411 I/O. */
413 #define iovec _WSABUF
414 #define iov_base buf
415 #define iov_len len
417 struct msghdr {
418 void *msg_name;
419 socklen_t msg_namelen;
420 struct iovec *msg_iov;
421 size_t msg_iovlen;
422 void *msg_control;
423 socklen_t msg_controllen;
424 int msg_flags;
427 #define sendmsg sendmsg_w32
429 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
430 sendmsg_w32(rk_socket_t s, const struct msghdr * msg, int flags);
432 #endif /* HAVE_WINSOCK */
434 #ifndef HAVE_PUTENV
435 #define putenv rk_putenv
436 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *);
437 #endif
439 #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO)
440 #ifndef HAVE_SETENV
441 #define setenv rk_setenv
442 #endif
443 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *, const char *, int);
444 #endif
446 #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO)
447 #ifndef HAVE_UNSETENV
448 #define unsetenv rk_unsetenv
449 #endif
450 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL unsetenv(const char *);
451 #endif
453 #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO)
454 #ifndef HAVE_GETUSERSHELL
455 #define getusershell rk_getusershell
456 #define endusershell rk_endusershell
457 #endif
458 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL getusershell(void);
459 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL endusershell(void);
460 #endif
462 #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
463 #ifndef HAVE_SNPRINTF
464 #define snprintf rk_snprintf
465 #endif
466 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
467 rk_snprintf (char *, size_t, const char *, ...)
468 __attribute__ ((format (printf, 3, 4)));
469 #endif
471 #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
472 #ifndef HAVE_VSNPRINTF
473 #define vsnprintf rk_vsnprintf
474 #endif
475 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
476 rk_vsnprintf (char *, size_t, const char *, va_list)
477 __attribute__((format (printf, 3, 0)));
478 #endif
480 #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
481 #ifndef HAVE_ASPRINTF
482 #define asprintf rk_asprintf
483 #endif
484 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
485 rk_asprintf (char **, const char *, ...)
486 __attribute__ ((format (printf, 2, 3)));
487 #endif
489 #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
490 #ifndef HAVE_VASPRINTF
491 #define vasprintf rk_vasprintf
492 #endif
493 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
494 rk_vasprintf (char **, const char *, va_list)
495 __attribute__((format (printf, 2, 0)));
496 #endif
498 #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
499 #ifndef HAVE_ASNPRINTF
500 #define asnprintf rk_asnprintf
501 #endif
502 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
503 rk_asnprintf (char **, size_t, const char *, ...)
504 __attribute__ ((format (printf, 3, 4)));
505 #endif
507 #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
508 #ifndef HAVE_VASNPRINTF
509 #define vasnprintf rk_vasnprintf
510 #endif
511 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
512 vasnprintf (char **, size_t, const char *, va_list)
513 __attribute__((format (printf, 3, 0)));
514 #endif
516 #ifndef HAVE_STRDUP
517 #define strdup rk_strdup
518 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strdup(const char *);
519 #endif
521 #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO)
522 #ifndef HAVE_STRNDUP
523 #define strndup rk_strndup
524 #endif
525 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strndup(const char *, size_t);
526 #endif
528 #ifndef HAVE_STRLWR
529 #define strlwr rk_strlwr
530 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *);
531 #endif
533 #ifndef HAVE_STRNLEN
534 #define strnlen rk_strnlen
535 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strnlen(const char*, size_t);
536 #endif
538 #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO)
539 #ifndef HAVE_STRSEP
540 #define strsep rk_strsep
541 #endif
542 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strsep(char**, const char*);
543 #endif
545 #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO)
546 #ifndef HAVE_STRSEP_COPY
547 #define strsep_copy rk_strsep_copy
548 #endif
549 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char**, const char*, char*, size_t);
550 #endif
552 #ifndef HAVE_STRCASECMP
553 #define strcasecmp rk_strcasecmp
554 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strcasecmp(const char *, const char *);
555 #endif
557 #ifdef NEED_FCLOSE_PROTO
558 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fclose(FILE *);
559 #endif
561 #ifdef NEED_STRTOK_R_PROTO
562 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strtok_r(char *, const char *, char **);
563 #endif
565 #ifndef HAVE_STRUPR
566 #define strupr rk_strupr
567 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *);
568 #endif
570 #ifndef HAVE_STRLCPY
571 #define strlcpy rk_strlcpy
572 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t);
573 #endif
575 #ifndef HAVE_STRLCAT
576 #define strlcat rk_strlcat
577 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t);
578 #endif
580 #ifndef HAVE_GETDTABLESIZE
581 #define getdtablesize rk_getdtablesize
582 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
583 #endif
585 #if !defined(HAVE_STRERROR) && !defined(strerror)
586 #define strerror rk_strerror
587 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
588 #endif
590 #if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
591 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
592 #else
593 #define rk_strerror_r strerror_r
594 #endif
596 #if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO)
597 #ifndef HAVE_HSTRERROR
598 #define hstrerror rk_hstrerror
599 #endif
600 /* This causes a fatal error under Psoriasis */
601 #ifndef SunOS
602 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hstrerror(int);
603 #endif
604 #endif
606 #if !HAVE_DECL_H_ERRNO
607 extern int h_errno;
608 #endif
610 #if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO)
611 #ifndef HAVE_INET_ATON
612 #define inet_aton rk_inet_aton
613 #endif
614 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_aton(const char *, struct in_addr *);
615 #endif
617 #ifndef HAVE_INET_NTOP
618 #define inet_ntop rk_inet_ntop
619 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL
620 inet_ntop(int af, const void *src, char *dst, size_t size);
621 #endif
623 #ifndef HAVE_INET_PTON
624 #define inet_pton rk_inet_pton
625 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
626 inet_pton(int, const char *, void *);
627 #endif
629 #ifndef HAVE_GETCWD
630 #define getcwd rk_getcwd
631 ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL getcwd(char *, size_t);
632 #endif
634 #ifdef HAVE_PWD_H
635 #include <pwd.h>
636 ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwnam (const char *);
637 ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwuid (uid_t);
638 #endif
640 #ifdef POSIX_GETPWNAM_R
641 #define rk_getpwnam_r(_n, _pw, _b, _sz, _pwd) getpwnam_r(_n, _pw, _b, _sz, _pwd)
642 #else
643 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
644 rk_getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **);
645 #endif
647 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL get_default_username (void);
649 #ifndef HAVE_SETEUID
650 #define seteuid rk_seteuid
651 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL seteuid(uid_t);
652 #endif
654 #ifndef HAVE_SETEGID
655 #define setegid rk_setegid
656 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setegid(gid_t);
657 #endif
659 #ifndef HAVE_LSTAT
660 #define lstat rk_lstat
661 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL lstat(const char *, struct stat *);
662 #endif
664 #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO)
665 #ifndef HAVE_MKSTEMP
666 #define mkstemp rk_mkstemp
667 #endif
668 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *);
669 #endif
671 #ifndef HAVE_CGETENT
672 #define cgetent rk_cgetent
673 #define cgetstr rk_cgetstr
674 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **, char **, const char *);
675 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *, const char *, char **);
676 #endif
678 #ifndef HAVE_INITGROUPS
679 #define initgroups rk_initgroups
680 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL initgroups(const char *, gid_t);
681 #endif
683 #ifndef HAVE_FCHOWN
684 #define fchown rk_fchown
685 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fchown(int, uid_t, gid_t);
686 #endif
688 #ifdef RENAME_DOES_NOT_UNLINK
689 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_rename(const char *, const char *);
690 #else
691 #define rk_rename(__rk_rn_from,__rk_rn_to) rename(__rk_rn_from,__rk_rn_to)
692 #endif
694 #ifdef MKDIR_DOES_NOT_HAVE_MODE
695 #define mkdir rk_mkdir
696 #else
697 #define rk_mkdir(__rk_rn_name, __rk_rn_mode) mkdir(__rk_rn_name,__rk_rn_mode)
698 #endif
700 #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO)
701 #ifndef HAVE_DAEMON
702 #define daemon rk_daemon
703 #endif
704 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int, int);
705 #endif
707 #ifndef HAVE_CHOWN
708 #define chown rk_chown
709 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL chown(const char *, uid_t, gid_t);
710 #endif
712 #ifndef HAVE_RCMD
713 #define rcmd rk_rcmd
714 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
715 rcmd(char **, unsigned short, const char *,
716 const char *, const char *, int *);
717 #endif
719 #if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO)
720 #ifndef HAVE_INNETGR
721 #define innetgr rk_innetgr
722 #endif
723 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL innetgr(const char*, const char*,
724 const char*, const char*);
725 #endif
727 #ifndef HAVE_IRUSEROK
728 #define iruserok rk_iruserok
729 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL iruserok(unsigned, int,
730 const char *, const char *);
731 #endif
733 #if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO)
734 #ifndef HAVE_GETHOSTNAME
735 #define gethostname rk_gethostname
736 #endif
737 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gethostname(char *, int);
738 #endif
740 #ifndef HAVE_WRITEV
741 #define writev rk_writev
742 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
743 writev(int, const struct iovec *, int);
744 #endif
746 #ifndef HAVE_READV
747 #define readv rk_readv
748 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
749 readv(int, const struct iovec *, int);
750 #endif
752 #ifndef HAVE_PIDFILE
753 #ifdef NO_PIDFILES
754 #define pidfile(x) ((void) 0)
755 #else
756 #define pidfile rk_pidfile
757 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile (const char*);
758 #endif
759 #endif
761 #ifndef HAVE_BSWAP32
762 #define bswap32 rk_bswap32
763 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32(unsigned int);
764 #endif
766 #ifndef HAVE_BSWAP16
767 #define bswap16 rk_bswap16
768 ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16(unsigned short);
769 #endif
771 #ifndef HAVE_FLOCK
772 #ifndef LOCK_SH
773 #define LOCK_SH 1 /* Shared lock */
774 #endif
775 #ifndef LOCK_EX
776 #define LOCK_EX 2 /* Exclusive lock */
777 #endif
778 #ifndef LOCK_NB
779 #define LOCK_NB 4 /* Don't block when locking */
780 #endif
781 #ifndef LOCK_UN
782 #define LOCK_UN 8 /* Unlock */
783 #endif
785 #define flock(_x,_y) rk_flock(_x,_y)
786 int rk_flock(int fd, int operation);
787 #endif /* HAVE_FLOCK */
789 #ifndef HAVE_DIRFD
790 #ifdef HAVE_DIR_DD_FD
791 #define dirfd(x) ((x)->dd_fd)
792 #else
793 #ifndef _WIN32 /* Windows code never calls dirfd */
794 #error Missing dirfd() and ->dd_fd
795 #endif
796 #endif
797 #endif
799 ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int);
801 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unix_verify_user(char *, char *);
803 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *, size_t, ...);
805 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **, size_t, ...);
807 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list);
809 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
810 roken_vmconcat (char **, size_t, va_list);
812 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
813 net_write (rk_socket_t, const void *, size_t);
815 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
816 net_read (rk_socket_t, void *, size_t);
818 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
819 issuid(void);
821 #ifndef HAVE_STRUCT_WINSIZE
822 struct winsize {
823 unsigned short ws_row, ws_col;
824 unsigned short ws_xpixel, ws_ypixel;
826 #endif
828 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, int *, int *);
830 #ifndef HAVE_VSYSLOG
831 #define vsyslog rk_vsyslog
832 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int, const char *, va_list);
833 #endif
835 #ifndef HAVE_GETOPT
836 #define getopt rk_getopt
837 #define optarg rk_optarg
838 #define optind rk_optind
839 #define opterr rk_opterr
840 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
841 getopt(int nargc, char * const *nargv, const char *ostr);
842 #endif
844 #if !HAVE_DECL_OPTARG
845 ROKEN_LIB_VARIABLE extern char *optarg;
846 #endif
847 #if !HAVE_DECL_OPTIND
848 ROKEN_LIB_VARIABLE extern int optind;
849 #endif
850 #if !HAVE_DECL_OPTERR
851 ROKEN_LIB_VARIABLE extern int opterr;
852 #endif
854 #ifndef HAVE_GETIPNODEBYNAME
855 #define getipnodebyname rk_getipnodebyname
856 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL
857 getipnodebyname (const char *, int, int, int *);
858 #endif
860 #ifndef HAVE_GETIPNODEBYADDR
861 #define getipnodebyaddr rk_getipnodebyaddr
862 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL
863 getipnodebyaddr (const void *, size_t, int, int *);
864 #endif
866 #ifndef HAVE_FREEHOSTENT
867 #define freehostent rk_freehostent
868 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
869 freehostent (struct hostent *);
870 #endif
872 #ifndef HAVE_COPYHOSTENT
873 #define copyhostent rk_copyhostent
874 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL
875 copyhostent (const struct hostent *);
876 #endif
878 #ifndef HAVE_SOCKLEN_T
879 typedef int socklen_t;
880 #endif
882 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
884 #ifndef HAVE_SA_FAMILY_T
885 typedef unsigned short sa_family_t;
886 #endif
888 #ifdef HAVE_IPV6
889 #define _SS_MAXSIZE sizeof(struct sockaddr_in6)
890 #else
891 #define _SS_MAXSIZE sizeof(struct sockaddr_in)
892 #endif
894 #define _SS_ALIGNSIZE sizeof(unsigned long)
896 #if HAVE_STRUCT_SOCKADDR_SA_LEN
898 typedef unsigned char roken_sa_family_t;
900 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE)
901 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
903 struct sockaddr_storage {
904 unsigned char ss_len;
905 roken_sa_family_t ss_family;
906 char __ss_pad1[_SS_PAD1SIZE];
907 unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
910 #else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */
912 typedef unsigned short roken_sa_family_t;
914 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE)
915 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
917 struct sockaddr_storage {
918 roken_sa_family_t ss_family;
919 char __ss_pad1[_SS_PAD1SIZE];
920 unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
923 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
925 #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
927 #ifndef HAVE_STRUCT_ADDRINFO
928 struct addrinfo {
929 int ai_flags;
930 int ai_family;
931 int ai_socktype;
932 int ai_protocol;
933 size_t ai_addrlen;
934 char *ai_canonname;
935 struct sockaddr *ai_addr;
936 struct addrinfo *ai_next;
938 #endif
940 #ifndef HAVE_GETADDRINFO
941 #define getaddrinfo rk_getaddrinfo
942 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
943 getaddrinfo(const char *,
944 const char *,
945 const struct addrinfo *,
946 struct addrinfo **);
947 #endif
949 #ifndef HAVE_GETNAMEINFO
950 #define getnameinfo rk_getnameinfo
951 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
952 getnameinfo(const struct sockaddr *, socklen_t,
953 char *, size_t,
954 char *, size_t,
955 int);
956 #endif
958 #ifndef HAVE_FREEADDRINFO
959 #define freeaddrinfo rk_freeaddrinfo
960 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
961 freeaddrinfo(struct addrinfo *);
962 #endif
964 #ifndef HAVE_GAI_STRERROR
965 #define gai_strerror rk_gai_strerror
966 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL
967 gai_strerror(int);
968 #endif
970 #ifdef NO_SLEEP
972 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
973 sleep(unsigned int seconds);
975 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
976 usleep(unsigned int useconds);
978 #endif
980 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
981 getnameinfo_verified(const struct sockaddr *, socklen_t,
982 char *, size_t,
983 char *, size_t,
984 int);
986 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
987 roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **);
988 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
989 roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **);
991 #ifndef HAVE_STRFTIME
992 #define strftime rk_strftime
993 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
994 strftime (char *, size_t, const char *, const struct tm *);
995 #endif
997 #ifndef HAVE_STRPTIME
998 #define strptime rk_strptime
999 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL
1000 strptime (const char *, const char *, struct tm *);
1001 #endif
1003 #ifndef HAVE_GETTIMEOFDAY
1004 #define gettimeofday rk_gettimeofday
1005 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1006 gettimeofday (struct timeval *, void *);
1007 #endif
1009 #ifndef HAVE_EMALLOC
1010 #define emalloc rk_emalloc
1011 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t);
1012 #endif
1013 #ifndef HAVE_ECALLOC
1014 #define ecalloc rk_ecalloc
1015 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc(size_t, size_t);
1016 #endif
1017 #ifndef HAVE_EREALLOC
1018 #define erealloc rk_erealloc
1019 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *, size_t);
1020 #endif
1021 #ifndef HAVE_ESTRDUP
1022 #define estrdup rk_estrdup
1023 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *);
1024 #endif
1027 * kludges and such
1030 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1031 roken_gethostby_setup(const char*, const char*);
1032 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL
1033 roken_gethostbyname(const char*);
1034 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL
1035 roken_gethostbyaddr(const void*, size_t, int);
1037 #ifdef GETSERVBYNAME_PROTO_COMPATIBLE
1038 #define roken_getservbyname(x,y) getservbyname(x,y)
1039 #else
1040 #define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y)
1041 #endif
1043 #ifdef OPENLOG_PROTO_COMPATIBLE
1044 #define roken_openlog(a,b,c) openlog(a,b,c)
1045 #else
1046 #define roken_openlog(a,b,c) openlog((char *)a,b,c)
1047 #endif
1049 #ifdef GETSOCKNAME_PROTO_COMPATIBLE
1050 #define roken_getsockname(a,b,c) getsockname(a,b,c)
1051 #else
1052 #define roken_getsockname(a,b,c) getsockname(a, b, (void*)c)
1053 #endif
1055 #ifndef HAVE_SETPROGNAME
1056 #define setprogname rk_setprogname
1057 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setprogname(const char *);
1058 #endif
1060 #ifndef HAVE_GETPROGNAME
1061 #define getprogname rk_getprogname
1062 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void);
1063 #endif
1065 #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME
1066 extern const char *__progname;
1067 #endif
1069 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
1070 mini_inetd_addrinfo (struct addrinfo*, rk_socket_t *);
1072 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
1073 mini_inetd (int, rk_socket_t *);
1075 #ifndef HAVE_LOCALTIME_R
1076 #define localtime_r rk_localtime_r
1077 ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL
1078 localtime_r(const time_t *, struct tm *);
1079 #endif
1081 #if !defined(HAVE_STRTOLL) || defined(NEED_STRTOLL_PROTO)
1082 #ifndef HAVE_STRTOLL
1083 #define strtoll rk_strtoll
1084 #endif
1085 ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL
1086 strtoll(const char * nptr, char ** endptr, int base);
1087 #endif
1089 #if !defined(HAVE_STRTOULL) || defined(NEED_STRTOULL_PROTO)
1090 #ifndef HAVE_STRTOULL
1091 #define strtoull rk_strtoull
1092 #endif
1093 ROKEN_LIB_FUNCTION unsigned long long ROKEN_LIB_CALL
1094 strtoull(const char * nptr, char ** endptr, int base);
1095 #endif
1097 #if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
1098 #ifndef HAVE_STRSVIS
1099 #define strsvis rk_strsvis
1100 #endif
1101 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1102 strsvis(char *, const char *, int, const char *);
1103 #endif
1105 #if !defined(HAVE_STRSVISX) || defined(NEED_STRSVISX_PROTO)
1106 #ifndef HAVE_STRSVISX
1107 #define strsvisx rk_strsvisx
1108 #endif
1109 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1110 strsvisx(char *, const char *, size_t, int, const char *);
1111 #endif
1113 #if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO)
1114 #ifndef HAVE_STRUNVIS
1115 #define strunvis rk_strunvis
1116 #endif
1117 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1118 strunvis(char *, const char *);
1119 #endif
1121 #if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO)
1122 #ifndef HAVE_STRVIS
1123 #define strvis rk_strvis
1124 #endif
1125 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1126 strvis(char *, const char *, int);
1127 #endif
1129 #if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO)
1130 #ifndef HAVE_STRVISX
1131 #define strvisx rk_strvisx
1132 #endif
1133 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1134 strvisx(char *, const char *, size_t, int);
1135 #endif
1137 #if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO)
1138 #ifndef HAVE_SVIS
1139 #define svis rk_svis
1140 #endif
1141 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL
1142 svis(char *, int, int, int, const char *);
1143 #endif
1145 #if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO)
1146 #ifndef HAVE_UNVIS
1147 #define unvis rk_unvis
1148 #endif
1149 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1150 unvis(char *, int, int *, int);
1151 #endif
1153 #if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO)
1154 #ifndef HAVE_VIS
1155 #define vis rk_vis
1156 #endif
1157 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL
1158 vis(char *, int, int, int);
1159 #endif
1161 #if !defined(HAVE_CLOSEFROM)
1162 #define closefrom rk_closefrom
1163 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
1164 closefrom(int);
1165 #endif
1167 #if !defined(HAVE_TIMEGM)
1168 #define timegm rk_timegm
1169 ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL
1170 rk_timegm(struct tm *tm);
1171 #endif
1173 #ifdef NEED_QSORT
1174 #define qsort rk_qsort
1175 void
1176 rk_qsort(void *, size_t, size_t, int (*)(const void *, const void *));
1177 #endif
1179 #if defined(HAVE_ARC4RANDOM)
1180 #define rk_random() arc4random()
1181 #elif defined(HAVE_RANDOM)
1182 #define rk_random() random()
1183 #else
1184 #define rk_random() rand()
1185 #endif
1187 #ifndef HAVE_TDELETE
1188 #define tdelete(a,b,c) rk_tdelete(a,b,c)
1189 #endif
1190 #ifndef HAVE_TFIND
1191 #define tfind(a,b,c) rk_tfind(a,b,c)
1192 #endif
1193 #ifndef HAVE_TSEARCH
1194 #define tsearch(a,b,c) rk_tsearch(a,b,c)
1195 #endif
1196 #ifndef HAVE_TWALK
1197 #define twalk(a,b) rk_twalk(a,b)
1198 #endif
1200 #if defined(__linux__) && defined(SOCK_CLOEXEC) && !defined(SOCKET_WRAPPER_REPLACE) && !defined(__SOCKET_WRAPPER_H__)
1201 #undef socket
1202 #define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot)
1203 int ROKEN_LIB_FUNCTION rk_socket(int, int, int);
1204 #endif
1206 /* Microsoft VC 2010 POSIX definitions */
1207 #ifndef EAFNOSUPPORT
1208 #define EAFNOSUPPORT 102
1209 #endif
1210 #ifndef EINPROGRESS
1211 #define EINPROGRESS 112
1212 #endif
1213 #ifndef ELOOP
1214 #define ELOOP 114
1215 #endif
1216 #ifndef ENOTSOCK
1217 #define ENOTSOCK 128
1218 #endif
1219 #ifndef ENOTSUP
1220 #define ENOTSUP 129
1221 #endif
1222 #ifndef EOVERFLOW
1223 #define EOVERFLOW 132
1224 #endif
1225 #ifndef ETIMEDOUT
1226 #define ETIMEDOUT 138
1227 #endif
1228 #ifndef EWOULDBLOCK
1229 #define EWOULDBLOCK 140
1230 #endif
1233 #ifdef SOCKET_WRAPPER_REPLACE
1234 #include <socket_wrapper.h>
1235 #endif
1237 ROKEN_CPP_END