mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Open Transport stuff now actually compiles.
Various stuff caught up to latest versions. [originally from svn r192]
This commit is contained in:
parent
d6b7448ab8
commit
9eec9c9f90
10
Makefile.mpw
10
Makefile.mpw
@ -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
|
||||
|
10
mac.c
10
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");
|
||||
|
5
mac.h
5
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
|
||||
|
||||
|
46
opentpt.c
46
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.
|
||||
@ -26,11 +26,12 @@
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
@ -39,18 +40,19 @@
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user