00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
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
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 }
00115
00116 #endif