MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_net.h
1 /* Copyright (c) 2000, 2011, 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 /*
17  This file is also used to make handling of sockets and ioctl()
18  portable accross systems.
19 
20 */
21 
22 #ifndef _my_net_h
23 #define _my_net_h
24 
25 #include "my_global.h" /* C_MODE_START, C_MODE_END */
26 
27 C_MODE_START
28 
29 #include <errno.h>
30 
31 #ifdef HAVE_SYS_SOCKET_H
32 #include <sys/socket.h>
33 #endif
34 
35 #ifdef HAVE_NETINET_IN_H
36 #include <netinet/in.h>
37 #endif
38 
39 #ifdef HAVE_ARPA_INET_H
40 #include <arpa/inet.h>
41 #endif
42 
43 #ifdef HAVE_POLL
44 #include <sys/poll.h>
45 #endif
46 
47 #ifdef HAVE_SYS_IOCTL_H
48 #include <sys/ioctl.h>
49 #endif
50 
51 #if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES)
52 #include <netinet/in_systm.h>
53 #include <netinet/in.h>
54 #include <netinet/ip.h>
55 # if !defined(alpha_linux_port)
56 # include <netinet/tcp.h>
57 # endif
58 #endif
59 
60 #if defined(__WIN__)
61 #define O_NONBLOCK 1 /* For emulation of fcntl() */
62 
63 /*
64  SHUT_RDWR is called SD_BOTH in windows and
65  is defined to 2 in winsock2.h
66  #define SD_BOTH 0x02
67 */
68 #define SHUT_RDWR 0x02
69 #else
70 #include <netdb.h> /* getaddrinfo() & co */
71 #endif
72 
73 /*
74  On OSes which don't have the in_addr_t, we guess that using uint32 is the best
75  possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit
76  & Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too.
77 */
78 #ifndef HAVE_IN_ADDR_T
79 #define in_addr_t uint32
80 #endif
81 
82 
83 C_MODE_END
84 #endif