1
/* Provide a sys/socket header file for systems lacking it (read: MinGW).
2
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3
Written by Simon Josefsson.
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2, or (at your option)
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software Foundation,
17
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
22
/* This file is supposed to be used on platforms that lack
23
sys/socket.h. It is intended to provide definitions and prototypes
24
needed by an application.
26
Currently only MinGW is supported. See the gnulib manual regarding
27
Windows sockets. MinGW has the header files winsock2.h and
28
ws2tcpip.h that declare the sys/socket.h definitions we need. Note
29
that you can influence which definitions you get by setting the
30
WINVER symbol before including these two files. For example,
31
getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
32
symbol is set indiriectly through WINVER). You can set this by
33
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
34
code may not run on older Windows releases then. My Windows 2000
35
box was not able to run the code, for example. The situation is
36
slightly confusing because:
37
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
38
suggests that getaddrinfo should be available on all Windows
43
# include <winsock2.h>
46
# include <ws2tcpip.h>
50
#if !defined SHUT_RD && defined SD_RECEIVE
51
# define SHUT_RD SD_RECEIVE
53
#if !defined SHUT_WR && defined SD_SEND
54
# define SHUT_WR SD_SEND
56
#if !defined SHUT_RDWR && defined SD_BOTH
57
# define SHUT_RDWR SD_BOTH
60
#endif /* _SYS_SOCKET_H */