59 # include <sys/socket.h> |
59 # include <sys/socket.h> |
60 # include <netinet/in.h> |
60 # include <netinet/in.h> |
61 # include <netinet/tcp.h> |
61 # include <netinet/tcp.h> |
62 # include <arpa/inet.h> |
62 # include <arpa/inet.h> |
63 # include <net/if.h> |
63 # include <net/if.h> |
64 # if !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) |
64 // According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. |
|
65 # if !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) \ |
|
66 && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) |
|
67 // If for any reason ifaddrs.h does not exist on your system, comment out |
|
68 // the following two lines and an alternative way will be used to fetch |
|
69 // the list of IPs from the system. |
65 # include <ifaddrs.h> |
70 # include <ifaddrs.h> |
66 // If for any reason ifaddrs.h does not exist on a system, remove define below |
|
67 // and an other system will be used to fetch ips from the system |
|
68 # define HAVE_GETIFADDRS |
71 # define HAVE_GETIFADDRS |
69 # else |
72 # endif |
|
73 # if defined(SUNOS) || defined(__MORPHOS__) || defined(__BEOS__) |
70 # define INADDR_NONE 0xffffffff |
74 # define INADDR_NONE 0xffffffff |
71 # endif // SUNOS |
75 # endif |
72 # if defined(__BEOS__) && !defined(BEOS_NET_SERVER) |
76 # if defined(__BEOS__) && !defined(BEOS_NET_SERVER) |
73 // needed on Zeta |
77 // needed on Zeta |
74 # include <sys/sockio.h> |
78 # include <sys/sockio.h> |
75 # endif |
79 # endif |
76 # endif // BEOS_NET_SERVER |
80 # endif // BEOS_NET_SERVER |
77 |
81 |
78 /* GLibc 2.1 does not support GetIfAddr() */ |
82 # if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) |
79 # if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1) |
|
80 # undef HAVE_GETIFADDRS |
|
81 typedef uint32_t in_addr_t; |
83 typedef uint32_t in_addr_t; |
82 # endif /* __GLIBC__ && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1) */ |
84 # endif |
83 |
85 |
84 # include <errno.h> |
86 # include <errno.h> |
85 # include <sys/time.h> |
87 # include <sys/time.h> |
86 # include <netdb.h> |
88 # include <netdb.h> |
87 #endif // UNIX |
89 #endif // UNIX |