1 | /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | |
3 | This program is free software; you can redistribute it and/or modify |
4 | it under the terms of the GNU General Public License as published by |
5 | the Free Software Foundation; version 2 of the License. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU General Public License |
13 | along with this program; if not, write to the Free Software |
14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ |
15 | |
16 | /* |
17 | This file is also used to make handling of sockets and ioctl() |
18 | portable across systems. |
19 | |
20 | */ |
21 | |
22 | #ifndef _my_net_h |
23 | #define _my_net_h |
24 | |
25 | C_MODE_START |
26 | |
27 | #include <errno.h> |
28 | #ifdef HAVE_SYS_SOCKET_H |
29 | #include <sys/socket.h> |
30 | #endif |
31 | #ifdef HAVE_NETINET_IN_H |
32 | #include <netinet/in.h> |
33 | #endif |
34 | #ifdef HAVE_ARPA_INET_H |
35 | #include <arpa/inet.h> |
36 | #endif |
37 | #if defined(HAVE_POLL_H) |
38 | #include <poll.h> |
39 | #elif defined(HAVE_SYS_POLL_H) |
40 | #include <sys/poll.h> |
41 | #endif /* defined(HAVE_POLL_H) */ |
42 | #ifdef HAVE_SYS_IOCTL_H |
43 | #include <sys/ioctl.h> |
44 | #endif |
45 | |
46 | #if !defined(__WIN__) |
47 | #include <netinet/in_systm.h> |
48 | #include <netinet/in.h> |
49 | #include <netinet/ip.h> |
50 | #if !defined(alpha_linux_port) |
51 | #include <netinet/tcp.h> |
52 | #endif |
53 | #endif |
54 | |
55 | #if defined(__WIN__) |
56 | #define O_NONBLOCK 1 /* For emulation of fcntl() */ |
57 | |
58 | /* |
59 | SHUT_RDWR is called SD_BOTH in windows and |
60 | is defined to 2 in winsock2.h |
61 | #define SD_BOTH 0x02 |
62 | */ |
63 | #define SHUT_RDWR 0x02 |
64 | #else |
65 | #include <netdb.h> /* getaddrinfo() & co */ |
66 | #endif |
67 | |
68 | /* |
69 | On OSes which don't have the in_addr_t, we guess that using uint32 |
70 | is the best possible choice. We guess this from the fact that on |
71 | HP-UX64bit & FreeBSD64bit & Solaris64bit, in_addr_t is equivalent to |
72 | uint32. And on Linux32bit too. |
73 | */ |
74 | #ifndef HAVE_IN_ADDR_T |
75 | #define in_addr_t uint32 |
76 | #endif |
77 | |
78 | |
79 | C_MODE_END |
80 | #endif |
81 | |