summaryrefslogtreecommitdiffstats
path: root/src/include/port-sockets.h
diff options
context:
space:
mode:
authorMarc Horowitz <marc@mit.edu>1996-07-22 20:49:46 +0000
committerMarc Horowitz <marc@mit.edu>1996-07-22 20:49:46 +0000
commitedf8b4d8a6a665c2aa150993cd813ea6c5cf12e1 (patch)
tree6c2974a97b448c040fa4a31708ec5e02f187526c /src/include/port-sockets.h
parent013bb1391582ed9e653ae706e398ddb8d08cfcc9 (diff)
downloadkrb5-edf8b4d8a6a665c2aa150993cd813ea6c5cf12e1.tar.gz
krb5-edf8b4d8a6a665c2aa150993cd813ea6c5cf12e1.tar.xz
krb5-edf8b4d8a6a665c2aa150993cd813ea6c5cf12e1.zip
this commit includes all the changes on the OV_9510_INTEGRATION and
OV_MERGE branches. This includes, but is not limited to, the new openvision admin system, and major changes to gssapi to add functionality, and bring the implementation in line with rfc1964. before committing, the code was built and tested for netbsd and solaris. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8774 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/port-sockets.h')
-rw-r--r--src/include/port-sockets.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/include/port-sockets.h b/src/include/port-sockets.h
new file mode 100644
index 0000000000..2c2fba906d
--- /dev/null
+++ b/src/include/port-sockets.h
@@ -0,0 +1,72 @@
+#ifdef _MSDOS
+
+#include <winsock.h>
+
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() win_socket_initialize()
+#define SOCKET_CLEANUP() WSACleanup()
+#define SOCKET_ERRNO (WSAGetLastError())
+#define SOCKET_SET_ERRNO(x) (WSASetLastError (x))
+#define SOCKET_NFDS(f) (0) /* select()'s first arg is ignored */
+#define SOCKET_READ(fd, b, l) (recv(fd, b, l, 0))
+#define SOCKET_WRITE(fd, b, l) (send(fd, b, l, 0))
+#define SOCKET_EINTR WSAEINTR
+
+int win_socket_initialize();
+
+#else /* not _MSDOS */
+
+/* If this source file requires it, define struct sockaddr_in
+ (and possibly other things related to network I/O). */
+
+#ifdef HAVE_MACSOCK_H /* Sockets stuff differs on Mac */
+#include "macsock.h" /* Macintosh sockets emulation library */
+
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() (WSAStartup(0x0101, (WSADATA *)0))
+#define SOCKET_CLEANUP() (WSACleanup())
+#define SOCKET_ERRNO (WSAGetLastError())
+#define SOCKET_SET_ERRNO(x) (WSASetLastError(x))
+#define SOCKET_NFDS(f) (0) /* select()'s first arg is ignored */
+#define SOCKET_READ(fd, b, l) (recv(fd, b, l, 0))
+#define SOCKET_WRITE(fd, b, l) (send(fd, b, l, 0))
+#define SOCKET_EINTR WSAEINTR
+
+#else /* ! HAVE_MACSOCK_H */ /* Sockets stuff for Unix machines */
+
+#include <netinet/in.h> /* For struct sockaddr_in and in_addr */
+#include <arpa/inet.h> /* For inet_ntoa */
+#include <netdb.h> /* For struct hostent, gethostbyname, etc */
+#include <sys/param.h> /* For MAXHOSTNAMELEN */
+#include <sys/socket.h> /* For SOCK_*, AF_*, etc */
+#include <sys/time.h> /* For struct timeval */
+#include <net/if.h> /* For struct ifconf, for localaddr.c */
+
+/*
+ * Compatability with WinSock calls on MS-Windows...
+ */
+#define SOCKET unsigned int
+#define INVALID_SOCKET ((SOCKET)~0)
+#define closesocket close
+#define ioctlsocket ioctl
+#define SOCKET_ERROR (-1)
+
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() (0) /* No error (or anything else) */
+#define SOCKET_CLEANUP() /* nothing */
+#define SOCKET_ERRNO errno
+#define SOCKET_SET_ERRNO(x) (errno = (x))
+#define SOCKET_NFDS(f) ((f)+1) /* select() arg for a single fd */
+#define SOCKET_READ read
+#define SOCKET_WRITE write
+#define SOCKET_EINTR EINTR
+
+#endif /* HAVE_MACSOCK_H */
+
+#endif /* _MSDOS */