X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsocket_.h;h=623c98c2f17b510c6c0e0169072d80f0db06f84b;hb=a9e638f0e4d6928c12f2b374bc369bb1ecf2cdfe;hp=fbf04833393cb4109049ccebe857d34abf08faf5;hpb=ef8ddae5605f3c448460fe16d9bf790edc439182;p=gnulib.git diff --git a/lib/socket_.h b/lib/socket_.h index fbf048333..623c98c2f 100644 --- a/lib/socket_.h +++ b/lib/socket_.h @@ -1,5 +1,5 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW). - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -16,12 +16,25 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H +#ifndef _GL_SYS_SOCKET_H +#define _GL_SYS_SOCKET_H -/* This file is supposed to be used on platforms that lack - sys/socket.h. It is intended to provide definitions and prototypes - needed by an application. +/* This file is supposed to be used on platforms that lack + and on platforms where cannot be included standalone. + It is intended to provide definitions and prototypes needed by an + application. */ + +#if @HAVE_SYS_SOCKET_H@ + +/* On many platforms, assumes prior inclusion of + . */ + +# include +# include @ABSOLUTE_SYS_SOCKET_H@ + +#else + +/* A platform that lacks . Currently only MinGW is supported. See the gnulib manual regarding Windows sockets. MinGW has the header files winsock2.h and @@ -39,22 +52,34 @@ releases. */ -#if HAVE_WINSOCK2_H -# include -#endif -#if HAVE_WS2TCPIP_H -# include -#endif +# if @HAVE_WINSOCK2_H@ +# include +# endif +# if @HAVE_WS2TCPIP_H@ +# include +# endif /* For shutdown(). */ -#if !defined SHUT_RD && defined SD_RECEIVE -# define SHUT_RD SD_RECEIVE -#endif -#if !defined SHUT_WR && defined SD_SEND -# define SHUT_WR SD_SEND -#endif -#if !defined SHUT_RDWR && defined SD_BOTH -# define SHUT_RDWR SD_BOTH -#endif - -#endif /* _SYS_SOCKET_H */ +# if !defined SHUT_RD && defined SD_RECEIVE +# define SHUT_RD SD_RECEIVE +# endif +# if !defined SHUT_WR && defined SD_SEND +# define SHUT_WR SD_SEND +# endif +# if !defined SHUT_RDWR && defined SD_BOTH +# define SHUT_RDWR SD_BOTH +# endif + +# if defined _WIN32 || defined __WIN32__ +# define ENOTSOCK WSAENOTSOCK +# define EADDRINUSE WSAEADDRINUSE +# define ENETRESET WSAENETRESET +# define ECONNABORTED WSAECONNABORTED +# define ECONNRESET WSAECONNRESET +# define ENOTCONN WSAENOTCONN +# define ESHUTDOWN WSAESHUTDOWN +# endif + +#endif /* HAVE_SYS_SOCKET_H */ + +#endif /* _GL_SYS_SOCKET_H */