]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Open Transport stuff now actually compiles.
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 2 Aug 1999 22:32:39 +0000 (22:32 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Mon, 2 Aug 1999 22:32:39 +0000 (22:32 +0000)
Various stuff caught up to latest versions.

[originally from svn r192]

Makefile.mpw
mac.c
mac.h
opentpt.c
putty.h

index 5a8eb61a7f501f1691db1b14db5904a1004de998..cbe29d30af4b7e48227379fd9ee8e834726b389e 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.mpw,v 1.1.2.13 1999/08/02 08:04:31 ben Exp $
+# $Id: Makefile.mpw,v 1.1.2.14 1999/08/02 22:32:38 ben Exp $
 # This is the Makefile for building PuTTY for the Mac OS.
 # Users of non-Mac systems will see some pretty strange characters around.
 
@@ -16,7 +16,7 @@ Objects
                dnr.c.o ¶
                mac.c.o ¶
                maccfg.c.o ¶
-#              macnet.c.o ¶
+#              mactcp.c.o ¶
                macterm.c.o ¶
                misc.c.o ¶
                opentpt.c.o ¶
@@ -35,7 +35,7 @@ Objects
                dnr.c.x ¶
                mac.c.x ¶
                maccfg.c.x ¶
-               macnet.c.x ¶
+#              mactcp.c.x ¶
                macterm.c.x ¶
                misc.c.x ¶
                opentpt.c.x ¶
@@ -56,6 +56,7 @@ Libs
                "{Libraries}IntEnv.o" ¶
                "{Libraries}Interface.o" ¶
                "{Libraries}OpenTransport.o" ¶
+               "{Libraries}OpenTransportApp.o" ¶
                "{Libraries}OpenTptInet.o"
 
 Libs¥PPC  =    "{SharedLibraries}InterfaceLib" ¶
@@ -146,11 +147,12 @@ PuTTY 
 dnr.c.o                dnr.c.x         Ä
 mac.c.o        mac.c.x         Ä putty.h mac.h macresid.h
 maccfg.c.o     maccfg.c.x      Ä putty.h mac.h macresid.h
-macnet.c.o     macnet.c.x      Ä putty.h
+mactcp.c.o     mactcp.c.x      Ä putty.h
 macterm.c.o    macterm.c.x     Ä putty.h mac.h
 misc.c.o       misc.c.x        Ä putty.h
 opentpt.c.o    opentpt.c.x     Ä putty.h mac.h
 ssh.c.o                ssh.c.x         Ä putty.h ssh.h
+sshblowf.c.o   sshblowf.c.x    Ä ssh.h
 sshcrc.c.o     sshcrc.c.x      Ä
 sshdes.c.o     sshdes.c.x      Ä ssh.h 
 sshmd5.c.o     sshmd5.c.x      Ä ssh.h
diff --git a/mac.c b/mac.c
index 6de3768575ed406b93a052ec2ff3f177cc0cd32f..6ccb38391e091d2e28363444868f641735b6aa35 100644 (file)
--- a/mac.c
+++ b/mac.c
@@ -1,4 +1,4 @@
-/* $Id: mac.c,v 1.1.2.25 1999/08/02 08:04:31 ben Exp $ */
+/* $Id: mac.c,v 1.1.2.26 1999/08/02 22:32:38 ben Exp $ */
 /*
  * Copyright (c) 1999 Ben Harris
  * All rights reserved.
@@ -148,13 +148,13 @@ static void mac_startup(void) {
 
     /* Initialise networking */
 #ifdef WITH_OPENTRANSPORT
-    if ((*opentpt_stack.init)() == 0)
-       net_stack = &opentpt_stack;
+    if ((*otpt_stack.init)() == 0)
+       net_stack = &otpt_stack;
     else 
 #endif
 #ifdef WITH_MACTCP
-    if ((*mactcp_stack.init)() == 0)
-       net_stack = &mactcp_stack;
+    if ((*mtcp_stack.init)() == 0)
+       net_stack = &mtcp_stack;
     else
 #endif
        fatalbox("No useful TCP/IP stack found");
diff --git a/mac.h b/mac.h
index ea14783a9e7f80c609feed64825aa9b3f662cd39..d187dfcdb3616ccbe29a4b3a6f36673dfb7c6db9 100644 (file)
--- a/mac.h
+++ b/mac.h
@@ -10,6 +10,9 @@
 #include <Gestalt.h>
 #include <MacWindows.h>
 
+/* config.h or somesuch? */
+#define WITH_OPENTRANSPORT
+
 struct mac_gestalts {
     long qdvers;
     long apprvers;
@@ -36,7 +39,7 @@ extern void mac_loadconfig(Config *);
 /* from macnet.c */
 extern void macnet_eventcheck(void);
 /* from opentpt.c */
-extern void opentpt_shutdown(void);
+extern Network_Stack otpt_stack;
 
 #endif
 
index 116d1f0befbb0cae843e8088f3c832da711d5242..05004ee8ced36a4045410f12d2fb21720b8e79dd 100644 (file)
--- a/opentpt.c
+++ b/opentpt.c
@@ -1,4 +1,4 @@
-/* $Id: opentpt.c,v 1.1.2.1 1999/08/02 08:06:32 ben Exp $ */
+/* $Id: opentpt.c,v 1.1.2.2 1999/08/02 22:32:39 ben Exp $ */
 /*
  * Copyright (c) 1999 Ben Harris
  * All rights reserved.
  */
 
 #include <MacTypes.h>
+#include <CodeFragments.h>
 #include <OpenTransport.h>
 #include <OpenTptInternet.h>
-#incldue <Processes.h>
 
-#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 
 #include "putty.h"
 
 struct otpt_socket {
     EndpointRef ep;
     Session *sess;
-    OTLIFO *sendq;
-    OTLIFO *eventq;
+    OTLIFO sendq;
+    OTLIFO eventq;
     long eventhandler;
 };
 
 struct otpt_netevent {
-    OTLink *next;
+    OTLink next;
     Net_Event_Type type;
 };
 
-static int otpt_probe(void);
-static void otpt_init(void);
+static int otpt_init(void);
+static void otpt_shutdown(void);
+static void otpt_poll(void);
 static void *otpt_open(Session *, char const *, int);
 static int otpt_recv(void *, void *, int, int);
 static int otpt_send(void *, void *, int, int);
@@ -65,11 +67,14 @@ Network_Stack otpt_stack = {
     otpt_destroy, otpt_shutdown
 };
 
-static OTConfiguration *otpt_config = kOTInvalidCOnfigurationPtr;
+static OTConfiguration *otpt_config = kOTInvalidConfigurationPtr;
 
 static int otpt_init(void) {
     OSErr err;
 
+    /* Check that the OpenTransport libraries were there (really just ppc) */
+    if (&InitOpenTransport == kUnresolvedCFragSymbolAddress)
+       return 1;
     err = InitOpenTransport();
     if (err != noErr)
        return err;
@@ -107,7 +112,7 @@ static void *otpt_open(Session *sess, char const *host, int port) {
     err = OTInstallNotifier(s->ep, otpt_notifier, (void *)s);
     if (err != kOTNoError) goto splat;
     s->eventhandler = OTCreateSystemTask(&otpt_rcvevent, (void *)s);
-    if (s->eventhandler = 0) goto splat;
+    if (s->eventhandler == 0) goto splat;
 
     /* Bind to any local address */
     err = OTBind(s->ep, NULL, NULL);
@@ -116,7 +121,8 @@ static void *otpt_open(Session *sess, char const *host, int port) {
     remoteaddr = smalloc(sizeof(*remoteaddr) - sizeof(remoteaddr->fName) +
                         strlen(host) + 7); /* allow space for port no. */
     remote.addr.buf = (UInt8 *)remoteaddr;
-    remote.addr.len = OTInitDNSAddress(remoteaddr, host);
+    /* XXX: I don't _think_ OTInitDNSAddress can modify the hostname. */
+    remote.addr.len = OTInitDNSAddress(remoteaddr, (char *)host);
     remote.addr.len += sprintf(&remoteaddr->fName[strlen(remoteaddr->fName)],
                               ":%d", port);
     /* Asynchronous blocking mode, so we don't have to wait */
@@ -137,14 +143,14 @@ static void *otpt_open(Session *sess, char const *host, int port) {
 static int otpt_recv(void *sock, void *buf, int buflen, int flags) {
     struct otpt_socket *s = (struct otpt_socket *)sock;
     OTResult result;
-    OTFlags flags;
+    OTFlags otflags;
 
     OTSetNonBlocking(s->ep);
     OTSetSynchronous(s->ep);
-    result = OTRcv(s->ep, buf, buflen, flags);
+    result = OTRcv(s->ep, buf, buflen, &otflags);
     if (result >= 0)
        return result;
-    else if (result == kOTNoDataError)
+    else if (result == kOTNoDataErr)
        return 0;
     else /* confusion! */
        return 0;
@@ -203,9 +209,9 @@ static void otpt_destroy(void *sock) {
        OTDestroySystemTask(s->eventhandler);
 
     /* Flush the event and send queues */
-    while ((link = OTLIFODequeue(s->eventq)) != NULL)
+    while ((link = OTLIFODequeue(&s->eventq)) != NULL)
        OTFreeMem(link);
-    while ((link = OTLIFODequeue(s->sendq)) != NULL)
+    while ((link = OTLIFODequeue(&s->sendq)) != NULL)
        OTFreeMem(link);
 
     /* Finally, free the socket record itself */
@@ -302,13 +308,11 @@ static pascal void otpt_rcvevent(void *arg) {
     OTLink *link;
     struct otpt_netevent *ne;
 
-    /* idiom stolen from "Networking With Open Transport".  Blame Apple. */
-
-    while ((link = OTLIFOStealList(s->eventq)) != NULL) {
+    while ((link = OTLIFOStealList(&s->eventq)) != NULL) {
        link = OTReverseList(link);
        while (link != NULL) {
            ne = (struct otpt_netevent *)link;
-           link = ne->next;
+           link = ne->next.fNext;
            switch (ne->type) {
              default:
                (s->sess->back->msg)(s->sess, s, ne->type);
@@ -317,7 +321,7 @@ static pascal void otpt_rcvevent(void *arg) {
            OTFreeMem(ne);
        }
     }
-    
+}    
 
 /*
  * Local Variables:
diff --git a/putty.h b/putty.h
index 0ddcb2fcf68bc3f9034d574fecdd935ac456245e..99961fdafc4ddd428173991efbc490423875eafe 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -155,6 +155,7 @@ typedef struct {
     int close_on_exit;
     /* SSH options */
     int nopty;
+    enum { CIPHER_3DES, CIPHER_BLOWFISH } cipher;
     /* Telnet options */
     char termtype[32];
     char termspeed[32];