summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/os2/tcpip.h
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-01-30 00:19:41 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-01-30 00:19:41 +0000
commitde069631fd3bce2e513ee8613a94038f23afe1b3 (patch)
tree0b8d9d99cdfb52e8d0c3f85c45859a42ed004bd3 /gnu/usr.bin/cvs/os2/tcpip.h
parent2b9936f3f7ab47a89436d4fa3b70e4c09dd2398e (diff)
Upgrade to 1.7.1 snapshot
Diffstat (limited to 'gnu/usr.bin/cvs/os2/tcpip.h')
-rw-r--r--gnu/usr.bin/cvs/os2/tcpip.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/os2/tcpip.h b/gnu/usr.bin/cvs/os2/tcpip.h
new file mode 100644
index 00000000000..4d19448650a
--- /dev/null
+++ b/gnu/usr.bin/cvs/os2/tcpip.h
@@ -0,0 +1,107 @@
+/****************************************************************
+ *
+ * TCPIP.H - Portable TCP/IP header file
+ *
+ * TCP/IP on OS/2 is an add-on and thus is not fully integrated
+ * with the operating system. To ensure portability, follow
+ * these rules:
+ *
+ * * Always call SockInit() at the beginning of your program
+ * and check that it returns TRUE.
+ *
+ * * Use SockSend() & SockRecv() instead of read(), write(),
+ * send(), or recv() when working with sockets.
+ *
+ * * Use SockClose() instead of close() with sockets.
+ *
+ * * Use SOCK_ERRNO when using functions that use or return
+ * sockets, such as SockSend() or accept().
+ *
+ * * Use HOST_ERRNO when using gethostbyname() or gethostbyaddr()
+ * functions.
+ *
+ * * As far as I can tell, getservbyname() and related functions
+ * never set any error variable.
+ *
+ * * Use SockStrError() & HostStrError() to convert SOCK_ERRNO
+ * and HOST_ERRNO to error strings.
+ *
+ * * In .MAK files, include $(TCPIP_MAK) & use $(TCPIPLIB)
+ * when linking applications using TCP/IP.
+ *
+ ****************************************************************/
+
+#if !defined( IN_TCPIP_H )
+#define IN_TCPIP_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <errno.h>
+
+#if defined( TCPIP_IBM )
+# include <types.h>
+# if !defined( TCPIP_IBM_NOHIDE )
+# define send IbmSockSend
+# define recv IbmSockRecv
+# endif
+#endif
+
+#if defined( TCPIP_IBM )
+# define BSD_SELECT
+# include <sys/select.h>
+# include <sys/time.h>
+# include <nerrno.h>
+# include <utils.h>
+# if defined( MICROSOFT )
+# define SOCK_ERRNO (tcperrno())
+# else
+# define SOCK_ERRNO (sock_errno())
+# endif
+# define HOST_ERRNO (h_errno)
+# define SockClose(S) soclose(S)
+# define SockInit() (!sock_init())
+# define SockSend IbmSockSend
+# define SockRecv IbmSockRecv
+
+const char *HostStrError(int HostErrno);
+const char *SockStrError(int SockErrno);
+
+int IbmSockSend (int Socket, const void *Buffer, int Len, int Flags);
+int IbmSockRecv (int Socket, const void *Buffer, int Len, int Flags);
+
+#if !defined( h_errno )
+extern int h_errno; /* IBM forgot to declare this in current header files */
+#endif
+
+#elif defined( __unix )
+# if defined( sgi ) /* SGI incorrectly defines FD_ZERO in sys/select.h */
+# include <bstring.h>
+# endif
+# if defined( sunos )
+extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+# else
+# include <sys/select.h>
+# endif
+# include <sys/time.h>
+# include <errno.h>
+# include <arpa/inet.h>
+# define SOCK_ERRNO errno
+# define HOST_ERRNO h_errno
+# define SockClose(S) close(S)
+# define SockInit() TRUE
+# define SockSend send
+# define SockRecv recv
+# define SockStrError(E) strerror(E)
+
+const char *HostStrError( int HostErrno );
+
+#else
+# error Undefined version of TCP/IP specified
+
+#endif
+
+#endif