sockcommon.h

00001 /*
00002     socklibpp library
00003     Copyright (C) 2005  Daniel K. O. <danielosmari at users.sf.net>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00020 
00024 #ifndef SOCKCOMMON_H
00025 #define SOCKCOMMON_H 1
00026 
00027 
00028 #ifdef WIN32
00029 #include <winsock2.h>
00030 namespace socklibpp {
00031 typedef unsigned socket_type;
00032 }
00033 #else
00034 // *nix
00035 
00036 #include <sys/types.h>
00037 #include <sys/socket.h>
00038 #include <netdb.h>
00039 #include <netinet/in.h>
00040 #include <arpa/inet.h>
00041 #include <unistd.h>
00042 #include <netinet/tcp.h>
00043 #include <sys/ioctl.h>
00044 #include <errno.h>
00045 
00046 namespace socklibpp {
00047 typedef int     socket_type;
00048 }
00049 
00050 #ifndef INVALID_SOCKET
00051 # define INVALID_SOCKET          -1
00052 #endif
00053 #ifndef SOCKET_ERROR
00054 # define SOCKET_ERROR            -1
00055 #endif
00056 
00057 // let's define here all the BSD socket possible errors as Winsock defines
00058 
00059 
00060 #define WSAEINTR                EINTR
00061 #define WSAEBADF                EBADF
00062 #define WSAEACCES               EACCES
00063 #define WSAEFAULT               EFAULT
00064 #define WSAEINVAL               EINVAL
00065 #define WSAEMFILE               EMFILE
00066 #define WSAEWOULDBLOCK          EWOULDBLOCK
00067 #define WSAEINPROGRESS          EINPROGRESS
00068 #define WSAEALREADY             EALREADY
00069 #define WSAENOTSOCK             ENOTSOCK
00070 #define WSAEDESTADDRREQ         EDESTADDRREQ
00071 #define WSAEMSGSIZE             EMSGSIZE
00072 #define WSAEPROTOTYPE           EPROTOTYPE
00073 #define WSAENOPROTOOPT          ENOPROTOOPT
00074 #define WSAEPROTONOSUPPORT      EPROTONOSUPPORT
00075 #define WSAESOCKTNOSUPPORT      ESOCKTNOSUPPORT
00076 #define WSAEOPNOTSUPP           EOPNOTSUPP
00077 #define WSAEPFNOSUPPORT         EPFNOSUPPORT
00078 #define WSAEAFNOSUPPORT         EAFNOSUPPORT
00079 #define WSAEADDRINUSE           EADDRINUSE
00080 #define WSAEADDRNOTAVAIL        EADDRNOTAVAIL
00081 #define WSAENETDOWN             ENETDOWN
00082 #define WSAENETUNREACH          ENETUNREACH
00083 #define WSAENETRESET            ENETRESET
00084 #define WSAECONNABORTED         ECONNABORTED
00085 #define WSAECONNRESET           ECONNRESET
00086 #define WSAENOBUFS              ENOBUFS
00087 #define WSAEISCONN              EISCONN
00088 #define WSAENOTCONN             ENOTCONN
00089 #define WSAESHUTDOWN            ESHUTDOWN
00090 #define WSAETOOMANYREFS         ETOOMANYREFS
00091 #define WSAETIMEDOUT            ETIMEDOUT
00092 #define WSAECONNREFUSED         ECONNREFUSED
00093 #define WSAELOOP                ELOOP
00094 #define WSAENAMETOOLONG         ENAMETOOLONG
00095 #define WSAEHOSTDOWN            EHOSTDOWN
00096 #define WSAEHOSTUNREACH         EHOSTUNREACH
00097 #define WSAHOST_NOT_FOUND       HOST_NOT_FOUND
00098 #define WSATRY_AGAIN            TRY_AGAIN
00099 #define WSANO_RECOVERY          NO_RECOVERY
00100 #define WSANO_DATA              NO_DATA
00101 
00102 #endif
00103 
00104 
00105 namespace socklibpp {
00106 #ifdef WIN32
00107 extern int __WinSock_dummy_int;
00108 
00109 namespace {
00110         int __other_dummy = __WinSock_dummy_int;
00111 };
00112 #endif // WIN32
00113 
00114 } // socklib
00115 
00116 #endif

Generated on Thu Jan 18 19:26:35 2007 for socklib++ by  doxygen 1.5.1