00001 #ifndef CLASSLIB_SYSAPI_SOCKET_H
00002 # define CLASSLIB_SYSAPI_SOCKET_H
00003
00004
00005
00006 # include "classlib/sysapi/system.h"
00007 # ifdef _WIN32
00008 # include <windows.h>
00009 # else
00010 # include <sys/param.h>
00011 # include <sys/socket.h>
00012 # include <netinet/in.h>
00013 # include <netinet/tcp.h>
00014 # include <unistd.h>
00015 # include <fcntl.h>
00016 # if HAVE_SYS_FILIO_H
00017 # include <sys/filio.h>
00018 # endif
00019 # if HAVE_SYS_SOCKIO_H
00020 # include <sys/sockio.h>
00021 # endif
00022 # include <cerrno>
00023 # include <cstring>
00024 # endif
00025
00026
00027
00028 # ifdef _WIN32
00029 # define WS_VERSION_REQD 0x0200
00030 # define WS_VERSION_MAJOR HIBYTE(WS_VERSION_REQD)
00031 # define WS_VERSION_MINOR LOBYTE(WS_VERSION_REQD)
00032
00033 # define ERRNO WSAGetLastError()
00034 # define CLOSE ::closesocket
00035
00036 # define EWOULDBLOCK WSAEWOULDBLOCK
00037 # define ENOTCONN WSAENOTCONN
00038 # define EINPROGRESS WSAEINPROGRESS
00039
00040 # ifndef MIN_SOCKETS_REQD
00041 # define MIN_SOCKETS_REQD 1
00042 # endif
00043
00044 # define SOCKETFD() (SOCKET) fd ()
00045 # else
00046 # define ERRNO errno
00047 # define CLOSE ::close
00048 # define SOCKETFD() fd ()
00049 # endif
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #endif // CLASSLIB_SYSAPI_SOCKET_H
00060