| 1 | /*
|
|---|
| 2 | * Herein lies a set of private ugly portability
|
|---|
| 3 | * hacks for the mind-numbingly broken Unix like
|
|---|
| 4 | * things that exist out there.
|
|---|
| 5 | */
|
|---|
| 6 | #ifndef LINK_HACKS_H
|
|---|
| 7 | #define LINK_HACKS_H
|
|---|
| 8 | #include <sys/types.h>
|
|---|
| 9 | #ifdef HAVE_WINSOCK2_H
|
|---|
| 10 | # include <winsock2.h>
|
|---|
| 11 | # include <ws2tcpip.h>
|
|---|
| 12 | #else
|
|---|
| 13 | # ifdef HAVE_SYS_SOCKET_H
|
|---|
| 14 | # include <sys/socket.h>
|
|---|
| 15 | # endif
|
|---|
| 16 | # ifdef HAVE_NETINET_IN_H
|
|---|
| 17 | # include <netinet/in.h>
|
|---|
| 18 | # endif
|
|---|
| 19 | # ifdef HAVE_NETDB_H
|
|---|
| 20 | # include <netdb.h>
|
|---|
| 21 | # endif
|
|---|
| 22 | # ifdef HAVE_NETINET_TCP_H
|
|---|
| 23 | # include <netinet/tcp.h>
|
|---|
| 24 | # endif
|
|---|
| 25 | # ifdef HAVE_SYS_UN_H
|
|---|
| 26 | # include <sys/un.h>
|
|---|
| 27 | # endif
|
|---|
| 28 | # ifdef HAVE_ARPA_INET_H
|
|---|
| 29 | # include <arpa/inet.h>
|
|---|
| 30 | # endif
|
|---|
| 31 | # ifdef HAVE_ARPA_NAMESER_H
|
|---|
| 32 | # include <arpa/nameser.h>
|
|---|
| 33 | # endif
|
|---|
| 34 | # ifdef HAVE_RESOLV_H
|
|---|
| 35 | # include <resolv.h>
|
|---|
| 36 | # endif
|
|---|
| 37 | #endif
|
|---|
| 38 | #include <sys/stat.h>
|
|---|
| 39 | #include <sys/time.h>
|
|---|
| 40 | #ifdef HAVE_UNISTD_H
|
|---|
| 41 | # include <unistd.h>
|
|---|
| 42 | #endif
|
|---|
| 43 | #include <stdio.h>
|
|---|
| 44 | #include <stdlib.h>
|
|---|
| 45 | #include <limits.h>
|
|---|
| 46 | #include <time.h>
|
|---|
| 47 | #ifdef HAVE_UTIME_H
|
|---|
| 48 | # include <utime.h>
|
|---|
| 49 | #else
|
|---|
| 50 | # ifdef HAVE_SYS_UTIME_H
|
|---|
| 51 | # include <sys/utime.h>
|
|---|
| 52 | # endif
|
|---|
| 53 | #endif
|
|---|
| 54 | #include <errno.h>
|
|---|
| 55 | #include <string.h>
|
|---|
| 56 | #ifdef HAVE_LINUX_IRDA_H
|
|---|
| 57 | # include <asm/types.h>
|
|---|
| 58 | # include <linux/irda.h>
|
|---|
| 59 | #endif
|
|---|
| 60 | #ifndef MAXHOSTNAMELEN
|
|---|
| 61 | # define MAXHOSTNAMELEN 255
|
|---|
| 62 | #endif
|
|---|
| 63 | #ifdef HAVE_WINSOCK2_H
|
|---|
| 64 | /* Define fake errno values for socket stuff. These aren't defined
|
|---|
| 65 | * in the Microsoft C library. Use the WSAE* error codes as such,
|
|---|
| 66 | * as they don't overlap with errno values. Define only those that
|
|---|
| 67 | * actually are used by the linc2 code.
|
|---|
| 68 | */
|
|---|
| 69 | # ifndef ECONNREFUSED
|
|---|
| 70 | # define ECONNREFUSED WSAECONNREFUSED
|
|---|
| 71 | # endif
|
|---|
| 72 | # ifndef EADDRINUSE
|
|---|
| 73 | # define EADDRINUSE WSAEADDRINUSE
|
|---|
| 74 | # endif
|
|---|
| 75 | # ifndef EINPROGRESS
|
|---|
| 76 | # define EINPROGRESS WSAEINPROGRESS
|
|---|
| 77 | # endif
|
|---|
| 78 | /* Undefine address families that aren't really present, as the
|
|---|
| 79 | * linc code checks for these macros being defined when it
|
|---|
| 80 | * determines whether they are supported. (It would be more correct
|
|---|
| 81 | * to check at run-time.)
|
|---|
| 82 | */
|
|---|
| 83 | # undef AF_UNIX /* No Unix domain sockets */
|
|---|
| 84 | # undef AF_INET6 /* Doesn't have sockaddr_in6 */
|
|---|
| 85 | #endif
|
|---|
| 86 | #ifdef __OS2__
|
|---|
| 87 | # undef AF_INET6 /* Doesn't have sockaddr_in6 */
|
|---|
| 88 | #endif
|
|---|
| 89 | #if !defined (NI_MAXSERV) || !defined (NI_MAXHOST)
|
|---|
| 90 | # include <sys/param.h>
|
|---|
| 91 | #endif
|
|---|
| 92 | #if !defined (NI_MAXHOST)
|
|---|
| 93 | # define NI_MAXHOST MAXHOSTNAMELEN
|
|---|
| 94 | #endif
|
|---|
| 95 | #if !defined (NI_MAXSERV)
|
|---|
| 96 | # define NI_MAXSERV 64
|
|---|
| 97 | #endif
|
|---|
| 98 | #if !defined (INADDR_NONE)
|
|---|
| 99 | # define INADDR_NONE (-1)
|
|---|
| 100 | #endif
|
|---|
| 101 | #if !defined (UNIX_PATH_MAX)
|
|---|
| 102 | /* UNP: 14.2 - Posix.1g at least 100 bytes */
|
|---|
| 103 | # define LINK_UNIX_PATH_MAX 100
|
|---|
| 104 | #else
|
|---|
| 105 | # define LINK_UNIX_PATH_MAX UNIX_PATH_MAX
|
|---|
| 106 | #endif
|
|---|
| 107 | const char *link_strerror (int);
|
|---|
| 108 | #endif /* LINK_HACKS_H */
|
|---|