mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-03 21:52:24 +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.
|
# This is the Makefile for building PuTTY for the Mac OS.
|
||||||
# Users of non-Mac systems will see some pretty strange characters around.
|
# Users of non-Mac systems will see some pretty strange characters around.
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ Objects
|
|||||||
dnr.c.o ¶
|
dnr.c.o ¶
|
||||||
mac.c.o ¶
|
mac.c.o ¶
|
||||||
maccfg.c.o ¶
|
maccfg.c.o ¶
|
||||||
# macnet.c.o ¶
|
# mactcp.c.o ¶
|
||||||
macterm.c.o ¶
|
macterm.c.o ¶
|
||||||
misc.c.o ¶
|
misc.c.o ¶
|
||||||
opentpt.c.o ¶
|
opentpt.c.o ¶
|
||||||
@ -35,7 +35,7 @@ Objects
|
|||||||
dnr.c.x ¶
|
dnr.c.x ¶
|
||||||
mac.c.x ¶
|
mac.c.x ¶
|
||||||
maccfg.c.x ¶
|
maccfg.c.x ¶
|
||||||
macnet.c.x ¶
|
# mactcp.c.x ¶
|
||||||
macterm.c.x ¶
|
macterm.c.x ¶
|
||||||
misc.c.x ¶
|
misc.c.x ¶
|
||||||
opentpt.c.x ¶
|
opentpt.c.x ¶
|
||||||
@ -56,6 +56,7 @@ Libs
|
|||||||
"{Libraries}IntEnv.o" ¶
|
"{Libraries}IntEnv.o" ¶
|
||||||
"{Libraries}Interface.o" ¶
|
"{Libraries}Interface.o" ¶
|
||||||
"{Libraries}OpenTransport.o" ¶
|
"{Libraries}OpenTransport.o" ¶
|
||||||
|
"{Libraries}OpenTransportApp.o" ¶
|
||||||
"{Libraries}OpenTptInet.o"
|
"{Libraries}OpenTptInet.o"
|
||||||
|
|
||||||
Libs¥PPC = "{SharedLibraries}InterfaceLib" ¶
|
Libs¥PPC = "{SharedLibraries}InterfaceLib" ¶
|
||||||
@ -146,11 +147,12 @@ PuTTY
|
|||||||
dnr.c.o dnr.c.x Ä
|
dnr.c.o dnr.c.x Ä
|
||||||
mac.c.o mac.c.x Ä putty.h mac.h macresid.h
|
mac.c.o mac.c.x Ä putty.h mac.h macresid.h
|
||||||
maccfg.c.o maccfg.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
|
macterm.c.o macterm.c.x Ä putty.h mac.h
|
||||||
misc.c.o misc.c.x Ä putty.h
|
misc.c.o misc.c.x Ä putty.h
|
||||||
opentpt.c.o opentpt.c.x Ä putty.h mac.h
|
opentpt.c.o opentpt.c.x Ä putty.h mac.h
|
||||||
ssh.c.o ssh.c.x Ä putty.h ssh.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 Ä
|
sshcrc.c.o sshcrc.c.x Ä
|
||||||
sshdes.c.o sshdes.c.x Ä ssh.h
|
sshdes.c.o sshdes.c.x Ä ssh.h
|
||||||
sshmd5.c.o sshmd5.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
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -148,13 +148,13 @@ static void mac_startup(void) {
|
|||||||
|
|
||||||
/* Initialise networking */
|
/* Initialise networking */
|
||||||
#ifdef WITH_OPENTRANSPORT
|
#ifdef WITH_OPENTRANSPORT
|
||||||
if ((*opentpt_stack.init)() == 0)
|
if ((*otpt_stack.init)() == 0)
|
||||||
net_stack = &opentpt_stack;
|
net_stack = &otpt_stack;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_MACTCP
|
#ifdef WITH_MACTCP
|
||||||
if ((*mactcp_stack.init)() == 0)
|
if ((*mtcp_stack.init)() == 0)
|
||||||
net_stack = &mactcp_stack;
|
net_stack = &mtcp_stack;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
fatalbox("No useful TCP/IP stack found");
|
fatalbox("No useful TCP/IP stack found");
|
||||||
|
5
mac.h
5
mac.h
@ -10,6 +10,9 @@
|
|||||||
#include <Gestalt.h>
|
#include <Gestalt.h>
|
||||||
#include <MacWindows.h>
|
#include <MacWindows.h>
|
||||||
|
|
||||||
|
/* config.h or somesuch? */
|
||||||
|
#define WITH_OPENTRANSPORT
|
||||||
|
|
||||||
struct mac_gestalts {
|
struct mac_gestalts {
|
||||||
long qdvers;
|
long qdvers;
|
||||||
long apprvers;
|
long apprvers;
|
||||||
@ -36,7 +39,7 @@ extern void mac_loadconfig(Config *);
|
|||||||
/* from macnet.c */
|
/* from macnet.c */
|
||||||
extern void macnet_eventcheck(void);
|
extern void macnet_eventcheck(void);
|
||||||
/* from opentpt.c */
|
/* from opentpt.c */
|
||||||
extern void opentpt_shutdown(void);
|
extern Network_Stack otpt_stack;
|
||||||
|
|
||||||
#endif
|
#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
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -26,11 +26,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
|
#include <CodeFragments.h>
|
||||||
#include <OpenTransport.h>
|
#include <OpenTransport.h>
|
||||||
#include <OpenTptInternet.h>
|
#include <OpenTptInternet.h>
|
||||||
#incldue <Processes.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
|
|
||||||
@ -39,18 +40,19 @@
|
|||||||
struct otpt_socket {
|
struct otpt_socket {
|
||||||
EndpointRef ep;
|
EndpointRef ep;
|
||||||
Session *sess;
|
Session *sess;
|
||||||
OTLIFO *sendq;
|
OTLIFO sendq;
|
||||||
OTLIFO *eventq;
|
OTLIFO eventq;
|
||||||
long eventhandler;
|
long eventhandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct otpt_netevent {
|
struct otpt_netevent {
|
||||||
OTLink *next;
|
OTLink next;
|
||||||
Net_Event_Type type;
|
Net_Event_Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int otpt_probe(void);
|
static int otpt_init(void);
|
||||||
static void otpt_init(void);
|
static void otpt_shutdown(void);
|
||||||
|
static void otpt_poll(void);
|
||||||
static void *otpt_open(Session *, char const *, int);
|
static void *otpt_open(Session *, char const *, int);
|
||||||
static int otpt_recv(void *, void *, int, int);
|
static int otpt_recv(void *, void *, int, int);
|
||||||
static int otpt_send(void *, void *, int, int);
|
static int otpt_send(void *, void *, int, int);
|
||||||
@ -65,11 +67,14 @@ Network_Stack otpt_stack = {
|
|||||||
otpt_destroy, otpt_shutdown
|
otpt_destroy, otpt_shutdown
|
||||||
};
|
};
|
||||||
|
|
||||||
static OTConfiguration *otpt_config = kOTInvalidCOnfigurationPtr;
|
static OTConfiguration *otpt_config = kOTInvalidConfigurationPtr;
|
||||||
|
|
||||||
static int otpt_init(void) {
|
static int otpt_init(void) {
|
||||||
OSErr err;
|
OSErr err;
|
||||||
|
|
||||||
|
/* Check that the OpenTransport libraries were there (really just ppc) */
|
||||||
|
if (&InitOpenTransport == kUnresolvedCFragSymbolAddress)
|
||||||
|
return 1;
|
||||||
err = InitOpenTransport();
|
err = InitOpenTransport();
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
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);
|
err = OTInstallNotifier(s->ep, otpt_notifier, (void *)s);
|
||||||
if (err != kOTNoError) goto splat;
|
if (err != kOTNoError) goto splat;
|
||||||
s->eventhandler = OTCreateSystemTask(&otpt_rcvevent, (void *)s);
|
s->eventhandler = OTCreateSystemTask(&otpt_rcvevent, (void *)s);
|
||||||
if (s->eventhandler = 0) goto splat;
|
if (s->eventhandler == 0) goto splat;
|
||||||
|
|
||||||
/* Bind to any local address */
|
/* Bind to any local address */
|
||||||
err = OTBind(s->ep, NULL, NULL);
|
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) +
|
remoteaddr = smalloc(sizeof(*remoteaddr) - sizeof(remoteaddr->fName) +
|
||||||
strlen(host) + 7); /* allow space for port no. */
|
strlen(host) + 7); /* allow space for port no. */
|
||||||
remote.addr.buf = (UInt8 *)remoteaddr;
|
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)],
|
remote.addr.len += sprintf(&remoteaddr->fName[strlen(remoteaddr->fName)],
|
||||||
":%d", port);
|
":%d", port);
|
||||||
/* Asynchronous blocking mode, so we don't have to wait */
|
/* 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) {
|
static int otpt_recv(void *sock, void *buf, int buflen, int flags) {
|
||||||
struct otpt_socket *s = (struct otpt_socket *)sock;
|
struct otpt_socket *s = (struct otpt_socket *)sock;
|
||||||
OTResult result;
|
OTResult result;
|
||||||
OTFlags flags;
|
OTFlags otflags;
|
||||||
|
|
||||||
OTSetNonBlocking(s->ep);
|
OTSetNonBlocking(s->ep);
|
||||||
OTSetSynchronous(s->ep);
|
OTSetSynchronous(s->ep);
|
||||||
result = OTRcv(s->ep, buf, buflen, flags);
|
result = OTRcv(s->ep, buf, buflen, &otflags);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
return result;
|
return result;
|
||||||
else if (result == kOTNoDataError)
|
else if (result == kOTNoDataErr)
|
||||||
return 0;
|
return 0;
|
||||||
else /* confusion! */
|
else /* confusion! */
|
||||||
return 0;
|
return 0;
|
||||||
@ -203,9 +209,9 @@ static void otpt_destroy(void *sock) {
|
|||||||
OTDestroySystemTask(s->eventhandler);
|
OTDestroySystemTask(s->eventhandler);
|
||||||
|
|
||||||
/* Flush the event and send queues */
|
/* Flush the event and send queues */
|
||||||
while ((link = OTLIFODequeue(s->eventq)) != NULL)
|
while ((link = OTLIFODequeue(&s->eventq)) != NULL)
|
||||||
OTFreeMem(link);
|
OTFreeMem(link);
|
||||||
while ((link = OTLIFODequeue(s->sendq)) != NULL)
|
while ((link = OTLIFODequeue(&s->sendq)) != NULL)
|
||||||
OTFreeMem(link);
|
OTFreeMem(link);
|
||||||
|
|
||||||
/* Finally, free the socket record itself */
|
/* Finally, free the socket record itself */
|
||||||
@ -302,13 +308,11 @@ static pascal void otpt_rcvevent(void *arg) {
|
|||||||
OTLink *link;
|
OTLink *link;
|
||||||
struct otpt_netevent *ne;
|
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);
|
link = OTReverseList(link);
|
||||||
while (link != NULL) {
|
while (link != NULL) {
|
||||||
ne = (struct otpt_netevent *)link;
|
ne = (struct otpt_netevent *)link;
|
||||||
link = ne->next;
|
link = ne->next.fNext;
|
||||||
switch (ne->type) {
|
switch (ne->type) {
|
||||||
default:
|
default:
|
||||||
(s->sess->back->msg)(s->sess, s, ne->type);
|
(s->sess->back->msg)(s->sess, s, ne->type);
|
||||||
@ -317,7 +321,7 @@ static pascal void otpt_rcvevent(void *arg) {
|
|||||||
OTFreeMem(ne);
|
OTFreeMem(ne);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
|
1
putty.h
1
putty.h
@ -155,6 +155,7 @@ typedef struct {
|
|||||||
int close_on_exit;
|
int close_on_exit;
|
||||||
/* SSH options */
|
/* SSH options */
|
||||||
int nopty;
|
int nopty;
|
||||||
|
enum { CIPHER_3DES, CIPHER_BLOWFISH } cipher;
|
||||||
/* Telnet options */
|
/* Telnet options */
|
||||||
char termtype[32];
|
char termtype[32];
|
||||||
char termspeed[32];
|
char termspeed[32];
|
||||||
|
Loading…
Reference in New Issue
Block a user