00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _NET_COMMON_H
00022 #define _NET_COMMON_H
00023
00024 #if defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_WCE)
00025
00026 #if defined(WINNT) || defined(_WINNT) || defined(__BORLANDC__) || defined(__MINGW32__) || defined(_WIN32_WCE)
00027 #define _MSWSOCK_
00028 #include <winsock2.h>
00029 #include <ws2tcpip.h>
00030 #endif
00031 #include <windows.h>
00032 #include <string.h>
00033
00034 #define closeSocket closesocket
00035 #define EWOULDBLOCK WSAEWOULDBLOCK
00036 #define EINPROGRESS WSAEWOULDBLOCK
00037 #define EAGAIN WSAEWOULDBLOCK
00038 #define EINTR WSAEINTR
00039
00040 #if defined(_WIN32_WCE)
00041 #define NO_STRSTREAM 1
00042 #endif
00043
00044
00045 typedef __int64 int64_t;
00046 typedef unsigned __int64 u_int64_t;
00047 typedef unsigned u_int32_t;
00048 typedef unsigned short u_int16_t;
00049 typedef unsigned char u_int8_t;
00050
00051
00052 #if !defined(_MSC_STDINT_H_) && !defined(_UINTPTR_T_DEFINED) && !defined(_UINTPTR_T_DECLARED) && !defined(_UINTPTR_T)
00053 typedef unsigned uintptr_t;
00054 #endif
00055 #if !defined(_MSC_STDINT_H_) && !defined(_INTPTR_T_DEFINED) && !defined(_INTPTR_T_DECLARED) && !defined(_INTPTR_T)
00056 typedef int intptr_t;
00057 #endif
00058
00059 #elif defined(VXWORKS)
00060
00061 #include <time.h>
00062 #include <timers.h>
00063 #include <sys/times.h>
00064 #include <sockLib.h>
00065 #include <hostLib.h>
00066 #include <resolvLib.h>
00067 #include <ioLib.h>
00068
00069 typedef unsigned int u_int32_t;
00070 typedef unsigned short u_int16_t;
00071 typedef unsigned char u_int8_t;
00072
00073 #else
00074
00075 #include <sys/types.h>
00076 #include <sys/socket.h>
00077 #include <sys/time.h>
00078 #include <netinet/in.h>
00079 #include <arpa/inet.h>
00080 #include <netdb.h>
00081 #include <unistd.h>
00082 #include <string.h>
00083 #include <stdlib.h>
00084 #include <errno.h>
00085 #include <strings.h>
00086 #include <ctype.h>
00087 #include <stdint.h>
00088 #if defined(_QNX4)
00089 #include <sys/select.h>
00090 #include <unix.h>
00091 #endif
00092
00093 #define closeSocket close
00094
00095 #ifdef SOLARIS
00096 #define u_int64_t uint64_t
00097 #define u_int32_t uint32_t
00098 #define u_int16_t uint16_t
00099 #define u_int8_t uint8_t
00100 #endif
00101 #endif
00102
00103 #ifndef SOCKLEN_T
00104 #define SOCKLEN_T int
00105 #endif
00106
00107 #endif