+#include "ssh.h"
+
+struct macnet_stack {
+ SockAddr (*namelookup)(char const *, char **);
+ SockAddr (*nonamelookup)(char const *);
+ void (*getaddr)(SockAddr, char *, int);
+ int (*hostname_is_local)(char *);
+ int (*address_is_local)(SockAddr);
+ int (*addrtype)(SockAddr);
+ void (*addrcopy)(SockAddr, char *);
+ void (*addr_free)(SockAddr);
+ Socket (*skregister)(void *, Plug); /* "register" is a reserved word */
+ Socket (*new)(SockAddr, int, int, int, int, int, Plug);
+ Socket (*newlistener)(char *, int, Plug, int, int);
+ char *(*addr_error)(SockAddr);
+ void (*poll)(void);
+ void (*cleanup)(void);
+};
+
+static struct macnet_stack *stack;
+
+static struct macnet_stack ot = {
+ ot_namelookup, ot_nonamelookup, ot_getaddr, ot_hostname_is_local,
+ ot_address_is_local, ot_addrtype, ot_addrcopy, ot_addr_free,
+ ot_register, ot_new, ot_newlistener, ot_addr_error, ot_poll, ot_cleanup
+};
+
+#if !TARGET_API_MAC_CARBON
+static struct macnet_stack mactcp = {
+ mactcp_namelookup, mactcp_nonamelookup, mactcp_getaddr,
+ mactcp_hostname_is_local, mactcp_address_is_local, mactcp_addrtype,
+ mactcp_addrcopy, mactcp_addr_free, mactcp_register, mactcp_new,
+ mactcp_newlistener, mactcp_addr_error, mactcp_poll, mactcp_cleanup
+};
+#endif
+
+void sk_init(void)
+{
+
+#ifndef NO_OT
+ if (ot_init() == noErr)
+ stack = &ot;
+ else
+#endif
+#if !TARGET_API_MAC_CARBON
+ if (mactcp_init() == noErr)
+ stack = &mactcp;
+ else
+#endif
+ stack = NULL;
+}