00001
00002
00003
00004
00005
00006
00007 #ifndef SOKINTRF_H
00008 #define SOKINTRF_H
00009
00010 #include "rcs_defs.hh"
00011
00012 #ifdef __cplusplus
00013 extern "C"
00014 {
00015 #endif
00016
00017 #ifndef UNDER_CE
00018 #include <errno.h>
00019 #endif
00020
00021
00022 #ifdef VXWORKS
00023 #include <vxWorks.h>
00024 #define FD_SET_DEFINED
00025 #include <netinet/in.h>
00026 #define SOCKADDR_IN_DEFINED
00027 #define IN_ADDR_DEFINED
00028 #include <sys/times.h>
00029 #define TIMEVAL_DEFINED
00030 #include <sys/socket.h>
00031 #define SOCKADDR_DEFINED
00032 #define MSGHDR_DEFINED
00033 #include <ioLib.h>
00034 #include <net/uio.h>
00035 #define IOVEC_DEFINED
00036 #include <hostLib.h>
00037 #include <sockLib.h>
00038 #include <ioLib.h>
00039 #endif
00040
00041 #ifdef UNIX_LIKE_PLAT
00042 #include <sys/types.h>
00043 #define FD_SET_DEFINED
00044 #include <sys/socket.h>
00045 #define SOCKADDR_DEFINED
00046 #define MSGHDR_DEFINED
00047 #ifdef sunos5
00048 #include <sys/select.h>
00049
00050 #endif
00051 #include <netinet/in.h>
00052 #define IN_ADDR_DEFINED
00053 #define SOCKADDR_IN_DEFINED
00054 #include <netdb.h>
00055 #define HOSTENT_DEFINED
00056 #include <sys/time.h>
00057 #define TIMEVAL_DEFINED
00058 #include <sys/uio.h>
00059 #define IOVEC_DEFINED
00060 #include <sys/ioctl.h>
00061 #include <unistd.h>
00062
00063 #endif
00064
00065
00066 #ifdef _WINDOWS
00067 #ifndef gnuwin32
00068 #ifdef USE_OLD_WINSOCK
00069 #ifdef UNDER_CE
00070 #include <windows.h>
00071 #endif
00072 #include <winsock.h>
00073 #else
00074 #include <winsock2.h>
00075 #endif
00076
00077 #define SOCKET_DEFINED
00078 #define IN_ADDR_DEFINED
00079 #define SOCKADDR_IN_DEFINED
00080 #define SOCKADDR_DEFINED
00081 #define TIMEVAL_DEFINED
00082 #define FD_SET_DEFINED
00083 #define HOSTENT_DEFINED
00084 #else
00085 #include <sys/types.h>
00086 #define FD_SET_DEFINED
00087 #include <sys/socket.h>
00088 #define SOCKADDR_DEFINED
00089 #define MSGHDR_DEFINED
00090 #include <netinet/in.h>
00091 #define IN_ADDR_DEFINED
00092 #define SOCKADDR_IN_DEFINED
00093 #include <netdb.h>
00094 #define HOSTENT_DEFINED
00095 #include <sys/time.h>
00096 #define TIMEVAL_DEFINED
00097 #include <sys/uio.h>
00098 #define IOVEC_DEFINED
00099 #include <sys/ioctl.h>
00100 #include <unistd.h>
00101 #endif
00102 #endif
00103
00104
00105 #ifdef SUN
00106 #include <sys/filio.h>
00107 #endif
00108
00109
00110 #ifndef MSGHDR_DEFINED
00111 #include "msghdr.h"
00112 #endif
00113
00114 #ifndef SOCKET_DEFINED
00115 #define SOCKET_DEFINED
00116 typedef unsigned int SOCKET;
00117 #endif
00118
00119
00120 typedef int (RCS_PASCAL RCS_FAR * PTR_TO_WSAGETLASTERROR) (void);
00121 extern PTR_TO_WSAGETLASTERROR ptr_to_wsa_getlasterror;
00122 extern void RCS_FAR *socket_library_instance;
00123
00124
00125
00126 int RCS_EXPORT load_socket_interface ();
00127 void RCS_EXPORT unload_socket_interface ();
00128
00129
00130
00131 int RCS_EXPORT dl_accept (SOCKET s, struct sockaddr *name, int *plen);
00132 int RCS_EXPORT dl_bind (SOCKET, struct sockaddr *, int);
00133 int RCS_EXPORT dl_closesocket (SOCKET);
00134 int RCS_EXPORT dl_connect (SOCKET, struct sockaddr *, int);
00135 int RCS_EXPORT dl_ioctlsocket (SOCKET s, long, unsigned long RCS_FAR *);
00136 unsigned long RCS_EXPORT dl_htonl (unsigned long hostlong);
00137 unsigned short RCS_EXPORT dl_htons (unsigned short hostshort);
00138 unsigned long RCS_EXPORT dl_ntohl (unsigned long netlong);
00139 unsigned short RCS_EXPORT dl_ntohs (unsigned short netshort);
00140 unsigned long RCS_EXPORT dl_inet_addr (char *);
00141 RCS_EXPORT char *dl_inet_ntoa (struct in_addr);
00142 int RCS_EXPORT dl_inet_netof (struct in_addr);
00143 struct in_addr dl_inet_makeaddr (const int net, const int lna);
00144 int RCS_EXPORT dl_gethostname (char *hostname, int maxlen);
00145 int RCS_EXPORT dl_listen (SOCKET, int);
00146 int RCS_EXPORT dl_recv (SOCKET, char *, int, int);
00147 int RCS_EXPORT dl_recvfrom (SOCKET, char *, int, int, struct sockaddr *,
00148 int *);
00149 int RCS_EXPORT dl_select (int, fd_set *, fd_set *, fd_set *,
00150 struct timeval *);
00151 int RCS_EXPORT dl_send (SOCKET, char *, int, int);
00152 int RCS_EXPORT dl_sendto (SOCKET, char *, int, int, struct sockaddr *, int);
00153 SOCKET RCS_EXPORT dl_socket (int, int, int);
00154 #ifndef VXWORKS
00155 int RCS_EXPORT dl_gethostbyname (char *, struct hostent **);
00156 #endif
00157 int RCS_EXPORT dl_setsockopt (SOCKET s, int level, int opt,
00158 char RCS_FAR * optval, int len);
00159 int RCS_EXPORT dl_fd_isset (SOCKET s, fd_set RCS_FAR * set);
00160 #ifdef _WINDOWS
00161 int RCS_EXPORT dl_WSAGetLastError (void);
00162 #endif
00163
00164 extern int WSA_count;
00165
00166 #ifdef __cplusplus
00167 }
00168 #endif
00169
00170
00171 #ifdef WIN32
00172 #define RCS_FD_SET(x,y) FD_SET(((SOCKET) x),y)
00173 #define RCS_FD_CLR(x,y) FD_CLR(((SOCKET) x),y)
00174 #else
00175 #define RCS_FD_SET FD_SET
00176 #define RCS_FD_CLR FD_CLR
00177 #endif
00178
00179
00180 #endif