+Tue Mar 28 18:02:41 1995 John Gilmore (gnu at toad.com)
+
+ * Makefile.in (KRB5_HEADERS, install): Account for file renames.
+ (all-mac): Add.
+ * configure.in (CONFIG_RULES): Remove.
+ (krb5_sigtype): Define as either void or int.
+ * encryption.h: Insert parentheses in macros to avoid mis-expansion.
+ * k5-config.h: Further parameterize socket support.
+ * macsock.h: Support connect(), recv(), send(), getmyipaddr().
+ (WSAGetLastError): Fix typo -- there's no argument to this macro.
Mon Mar 27 09:33:10 1995 Chris Provenzano (proven@mit.edu)
##DOS!include $(BUILDTOP)\config\windows.in
KRB5_HEADERS = asn1.h base-defs.h ccache.h k5-config.h encryption.h \
- error_def.h errors.h ext-proto.h fieldbits.h \
+ error_def.h k5-errors.h ext-proto.h fieldbits.h \
k5-free.h func-proto.h hostaddr.h kdb.h kdb_dbm.h \
- keytab.h krb5.h libos.h los-proto.h macros.h mit-des.h \
+ keytab.h libos.h los-proto.h macros.h mit-des.h \
proto.h rcache.h safepriv.h sysincl.h wordsize.h
# these are installed here for the build from lib/krb5/error_tables but
# also need to be in the installed tree
all:: all-$(WHAT)
all-unix:: $(BUILT_HEADERS)
-
+all-mac:: $(BUILT_HEADERS)
all-windows:
copy stock\osconf.win osconf.h
echo /* not used in windows */ > autoconf.h
depend::
-install:: $(KRB5_HEADERS) config.h osconf.h autoconf.h
+install:: $(KRB5_HEADERS) osconf.h autoconf.h
@set -x; for f in $(KRB5_HEADERS) ; \
do if cmp -s $$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
then true; else \
$(RM) $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
cp $(srcdir)/$$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f ; \
fi; done
- @set -x; for f in config.h osconf.h autoconf.h ; \
+ @set -x; for f in osconf.h autoconf.h ; \
do if cmp -s $$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
then true; else \
$(RM) $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
WITH_CCOPTS
WITH_KRB5ROOT
AC_SET_BUILDTOP
-CONFIG_RULES
AC_CONFIG_HEADER(autoconf.h)
AC_PROG_LEX
AC_PROG_INSTALL
if test $krb5_cv_has_posix_signals = yes; then
AC_DEFINE(krb5_sigtype, void) AC_DEFINE(POSIX_SIGTYPE)
else
+if test $ac_cv_type_signal = void; then
+AC_DEFINE(krb5_sigtype, void)
+else
AC_DEFINE(krb5_sigtype, int)
fi
+fi
dnl
dnl
AC_HEADER_CHECK(string.h,AC_DEFINE(USE_STRING_H))
extern krb5_checksum_entry * NEAR krb5_cksumarray[];
extern int krb5_max_cksum; /* max entry in array */
-#define valid_etype(etype) ((((int) etype) <= krb5_max_cryptosystem) && (etype > 0) && krb5_csarray[etype])
+#define valid_etype(etype) ((((int) (etype)) <= krb5_max_cryptosystem) && ((etype) > 0) && krb5_csarray[etype])
-#define valid_keytype(ktype) ((((int) ktype) <= krb5_max_keytype) && (ktype > 0) && krb5_keytype_array[ktype])
+#define valid_keytype(ktype) ((((int) (ktype)) <= krb5_max_keytype) && ((ktype) > 0) && krb5_keytype_array[ktype])
-#define valid_cksumtype(cktype) ((((int) cktype) <= krb5_max_cksum) && (cktype > 0) && krb5_cksumarray[cktype])
+#define valid_cksumtype(cktype) ((((int) (cktype)) <= krb5_max_cksum) && ((cktype) > 0) && krb5_cksumarray[cktype])
#define is_coll_proof_cksum(cktype) (krb5_cksumarray[cktype]->is_collision_proof)
#define is_keyed_cksum(cktype) (krb5_cksumarray[cktype]->uses_key)
#ifdef NEED_SOCKETS
#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();
#endif
#ifdef NEED_LOWLEVEL_IO
#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 <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 /* NEED_SOCKETS */
#define PROTOTYPE(p) p
#endif
-/* The socket data structure itself. */
-struct socket {
- short fMacTCPRef; /* refnum of MacTCP driver */
- unsigned long fStream; /* MacTCP socket/stream */
-# define UDPbuflen 4096
- char fRecvBuf[UDPbuflen]; /* receive buffer area */
-};
-
-typedef struct socket *SOCKET;
-
#define WORD short
#define LOBYTE(x) ((x) & 0xFF)
#define HIBYTE(x) (((x) >> 8) & 0xFF)
/* Socket address, other styles */
#define sockaddr sockaddr_in
+#define sa_family sin_family
+
+
+/* The socket data structure itself. */
+struct socket {
+ short fMacTCPRef; /* refnum of MacTCP driver */
+ unsigned long fStream; /* MacTCP socket/stream */
+ struct sockaddr_in connect_addr; /* Address from connect call */
+# define UDPbuflen 4096
+ char fRecvBuf[UDPbuflen]; /* receive buffer area */
+};
+
+typedef struct socket *SOCKET;
/*
* Host name<->address mapping entries
sendto PROTOTYPE ((SOCKET theUDP, const char *buf, const int len, int flags,
const struct sockaddr *to, int tolen));
+/* Send a packet to a connected UDP peer. */
+extern int
+send PROTOTYPE ((SOCKET theUDP, const char *buf, const int len, int flags));
+
/* Select for sockets that are ready for I/O.
This version just remembers the timeout for a future receive...
It always reports that one socket is ready for I/O. */
recvfrom PROTOTYPE ((SOCKET theUDP, char *buf, int len, int flags,
struct sockaddr *from, int *fromlen));
+/* Receive a packet from a connected UDP peer. */
+extern int
+recv PROTOTYPE ((SOCKET theUDP, char *buf, int len, int flags));
+
extern char *
inet_ntoa PROTOTYPE ((struct in_addr ina));
extern struct hostent *
gethostbyaddr PROTOTYPE ((char *addr, int len, int type));
+extern struct hostent *
+getmyipaddr PROTOTYPE ((void));
+
/* Bypass a few other functions we don't really need. */
#define getservbyname(name,prot) 0
*/
#define INVALID_SOCKET ((SOCKET)~0)
#define SOCKET_ERROR (-1)
-#define WSAGetLastError(x) (errno)
+#define WSAGetLastError() (errno)
#define WSASetLastError(x) (errno = (x))
extern int errno;