Pass through calls we don’t handle to the original AppleTalk stack.
It is now possible to have AFP volumes mounted over both AppleTalk and TCP/IP simultaneously.
This commit is contained in:
parent
6c6dff0e18
commit
3b2f1b6a25
|
@ -4,7 +4,7 @@ COMMAND = $(!eq,$(CMNDNAME),$(CC) $(CMNDNAME) $(USEORCALIBS)&&$(CC)) $(CMNDARGS)
|
||||||
|
|
||||||
CFLAGS = -i -w -O95
|
CFLAGS = -i -w -O95
|
||||||
|
|
||||||
DSITEST_OBJS = dsitest.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o cmdproc.o
|
DSITEST_OBJS = dsitest.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o cmdproc.o installcmds.o
|
||||||
DSITEST_PROG = dsitest
|
DSITEST_PROG = dsitest
|
||||||
|
|
||||||
AFPMOUNTER_OBJS = afpmounter.o callat.o endian.o
|
AFPMOUNTER_OBJS = afpmounter.o callat.o endian.o
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "readtcp.h"
|
#include "readtcp.h"
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
#include "cmdproc.h"
|
#include "cmdproc.h"
|
||||||
|
#include "installcmds.h"
|
||||||
|
#include "atipmapping.h"
|
||||||
|
|
||||||
typedef struct FPReadRec {
|
typedef struct FPReadRec {
|
||||||
Word CommandCode; /* includes pad byte */
|
Word CommandCode; /* includes pad byte */
|
||||||
|
@ -35,7 +37,7 @@ static void DoSPWrite(Session *sess, ASPWriteRec *commandRec);
|
||||||
Session sessionTbl[MAX_SESSIONS];
|
Session sessionTbl[MAX_SESSIONS];
|
||||||
|
|
||||||
#pragma databank 1
|
#pragma databank 1
|
||||||
void DispatchASPCommand(SPCommandRec *commandRec) {
|
LongWord DispatchASPCommand(SPCommandRec *commandRec) {
|
||||||
Session *sess;
|
Session *sess;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Word stateReg;
|
Word stateReg;
|
||||||
|
@ -45,6 +47,13 @@ void DispatchASPCommand(SPCommandRec *commandRec) {
|
||||||
if (commandRec->command == aspGetStatusCommand
|
if (commandRec->command == aspGetStatusCommand
|
||||||
|| commandRec->command==aspOpenSessionCommand)
|
|| commandRec->command==aspOpenSessionCommand)
|
||||||
{
|
{
|
||||||
|
if (((ASPGetStatusRec*)commandRec)->slsNet != atipMapping.networkNumber
|
||||||
|
|| ((ASPGetStatusRec*)commandRec)->slsNode != atipMapping.node
|
||||||
|
|| ((ASPGetStatusRec*)commandRec)->slsSocket != atipMapping.socket)
|
||||||
|
{
|
||||||
|
goto callOrig;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_SESSIONS; i++) {
|
for (i = 0; i < MAX_SESSIONS; i++) {
|
||||||
if (sessionTbl[i].dsiStatus == unused)
|
if (sessionTbl[i].dsiStatus == unused)
|
||||||
break;
|
break;
|
||||||
|
@ -57,16 +66,14 @@ void DispatchASPCommand(SPCommandRec *commandRec) {
|
||||||
sess->spCommandRec = commandRec;
|
sess->spCommandRec = commandRec;
|
||||||
|
|
||||||
if (!StartTCPConnection(sess)) {
|
if (!StartTCPConnection(sess)) {
|
||||||
FlagFatalError(sess, 0);
|
FlagFatalError(sess, commandRec->result);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
sess->dsiStatus = awaitingHeader;
|
sess->dsiStatus = awaitingHeader;
|
||||||
InitReadTCP(sess, DSI_HEADER_SIZE, &sess->reply);
|
InitReadTCP(sess, DSI_HEADER_SIZE, &sess->reply);
|
||||||
} else {
|
} else {
|
||||||
if (commandRec->refNum < SESSION_NUM_START) {
|
if (commandRec->refNum < SESSION_NUM_START) {
|
||||||
// TODO call original AppleTalk routine (or do it earlier)
|
goto callOrig;
|
||||||
commandRec->result = atInvalidCmdErr;
|
|
||||||
goto ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -135,6 +142,11 @@ void DispatchASPCommand(SPCommandRec *commandRec) {
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
RestoreStateReg(stateReg);
|
RestoreStateReg(stateReg);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
callOrig:
|
||||||
|
RestoreStateReg(stateReg);
|
||||||
|
return oldCmds[commandRec->command];
|
||||||
}
|
}
|
||||||
#pragma databank 0
|
#pragma databank 0
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
extern Session sessionTbl[MAX_SESSIONS];
|
extern Session sessionTbl[MAX_SESSIONS];
|
||||||
|
|
||||||
void DispatchASPCommand(SPCommandRec *commandRec);
|
LongWord DispatchASPCommand(SPCommandRec *commandRec);
|
||||||
void CompleteASPCommand(Session *sess, Word result);
|
void CompleteASPCommand(Session *sess, Word result);
|
||||||
void FinishASPCommand(Session *sess);
|
void FinishASPCommand(Session *sess);
|
||||||
void FlagFatalError(Session *sess, Word errorCode);
|
void FlagFatalError(Session *sess, Word errorCode);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "atipmapping.h"
|
#include "atipmapping.h"
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
#include "aspinterface.h"
|
#include "aspinterface.h"
|
||||||
|
#include "installcmds.h"
|
||||||
|
|
||||||
struct ATIPMapping atipMapping;
|
struct ATIPMapping atipMapping;
|
||||||
|
|
||||||
|
@ -25,11 +26,11 @@ static int nextSocket = 1;
|
||||||
commandRec->result = (x); \
|
commandRec->result = (x); \
|
||||||
commandRec->actualMatch = 0; \
|
commandRec->actualMatch = 0; \
|
||||||
RestoreStateReg(stateReg); \
|
RestoreStateReg(stateReg); \
|
||||||
return; \
|
return 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#pragma databank 1
|
#pragma databank 1
|
||||||
void DoLookupName(NBPLookupNameRec *commandRec) {
|
LongWord DoLookupName(NBPLookupNameRec *commandRec) {
|
||||||
cvtRec hostInfo;
|
cvtRec hostInfo;
|
||||||
dnrBuffer dnrInfo;
|
dnrBuffer dnrInfo;
|
||||||
Byte *curr, *dest;
|
Byte *curr, *dest;
|
||||||
|
@ -146,11 +147,11 @@ haveMapping:
|
||||||
commandRec->actualMatch = 1;
|
commandRec->actualMatch = 1;
|
||||||
commandRec->result = 0;
|
commandRec->result = 0;
|
||||||
RestoreStateReg(stateReg);
|
RestoreStateReg(stateReg);
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
passThrough:
|
passThrough:
|
||||||
// TODO pass through to actual NBP
|
RestoreStateReg(stateReg);
|
||||||
return_error(nbpNameErr);
|
return oldCmds[commandRec->command];
|
||||||
}
|
}
|
||||||
#pragma databank 0
|
#pragma databank 0
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@ typedef struct ATIPMapping {
|
||||||
|
|
||||||
extern struct ATIPMapping atipMapping;
|
extern struct ATIPMapping atipMapping;
|
||||||
|
|
||||||
void DoLookupName(NBPLookupNameRec *commandRec);
|
LongWord DoLookupName(NBPLookupNameRec *commandRec);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
43
cmdproc.asm
43
cmdproc.asm
|
@ -1,4 +1,5 @@
|
||||||
case on
|
case on
|
||||||
|
mcopy cmdproc.macros
|
||||||
|
|
||||||
RamGoComp gequ $E1100C
|
RamGoComp gequ $E1100C
|
||||||
RamForbid gequ $E11018
|
RamForbid gequ $E11018
|
||||||
|
@ -14,27 +15,41 @@ compPtr gequ $84
|
||||||
|
|
||||||
* AppleTalk command procedure (which acts as a dispatcher for all commands)
|
* AppleTalk command procedure (which acts as a dispatcher for all commands)
|
||||||
cmdProc start
|
cmdProc start
|
||||||
lda 3,s
|
lda cmdRecPtr+2
|
||||||
pha
|
|
||||||
lda 3,s
|
|
||||||
pha
|
pha
|
||||||
lda cmdRecPtr
|
lda cmdRecPtr
|
||||||
sta 4,s
|
pha
|
||||||
lda cmdRecPtr+2
|
jsl DispatchASPCommand
|
||||||
sta 6,s
|
cmp #0
|
||||||
jml DispatchASPCommand
|
bne doOrig
|
||||||
|
cpx #0
|
||||||
|
bne doOrig
|
||||||
|
rtl
|
||||||
|
doOrig short i ;push original procedure ptr
|
||||||
|
phx
|
||||||
|
long i
|
||||||
|
dec a
|
||||||
|
pha
|
||||||
|
rtl ;jump to it
|
||||||
end
|
end
|
||||||
|
|
||||||
nbpCmdProc start
|
nbpCmdProc start
|
||||||
lda 3,s
|
lda cmdRecPtr+2
|
||||||
pha
|
|
||||||
lda 3,s
|
|
||||||
pha
|
pha
|
||||||
lda cmdRecPtr
|
lda cmdRecPtr
|
||||||
sta 4,s
|
pha
|
||||||
lda cmdRecPtr+2
|
jsl DoLookupName
|
||||||
sta 6,s
|
cmp #0
|
||||||
jml DoLookupName
|
bne doOrig
|
||||||
|
cpx #0
|
||||||
|
bne doOrig
|
||||||
|
rtl
|
||||||
|
doOrig short i ;push original procedure ptr
|
||||||
|
phx
|
||||||
|
long i
|
||||||
|
dec a
|
||||||
|
pha
|
||||||
|
rtl ;jump to it
|
||||||
end
|
end
|
||||||
|
|
||||||
CallCompletionRoutine start
|
CallCompletionRoutine start
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
macro
|
||||||
|
&l long &a,&b
|
||||||
|
lclb &i
|
||||||
|
lclb &m
|
||||||
|
&a amid &a,1,1
|
||||||
|
&m setb ("&a"="M").or.("&a"="m")
|
||||||
|
&i setb ("&a"="I").or.("&a"="i")
|
||||||
|
aif c:&b=0,.a
|
||||||
|
&b amid &b,1,1
|
||||||
|
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||||
|
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||||
|
.a
|
||||||
|
&l rep #&m*32+&i*16
|
||||||
|
aif .not.&m,.b
|
||||||
|
longa on
|
||||||
|
.b
|
||||||
|
aif .not.&i,.c
|
||||||
|
longi on
|
||||||
|
.c
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&l short &a,&b
|
||||||
|
lclb &i
|
||||||
|
lclb &m
|
||||||
|
&a amid &a,1,1
|
||||||
|
&m setb ("&a"="M").or.("&a"="m")
|
||||||
|
&i setb ("&a"="I").or.("&a"="i")
|
||||||
|
aif c:&b=0,.a
|
||||||
|
&b amid &b,1,1
|
||||||
|
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||||
|
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||||
|
.a
|
||||||
|
&l sep #&m*32+&i*16
|
||||||
|
aif .not.&m,.b
|
||||||
|
longa off
|
||||||
|
.b
|
||||||
|
aif .not.&i,.c
|
||||||
|
longi off
|
||||||
|
.c
|
||||||
|
mend
|
|
@ -4,6 +4,7 @@
|
||||||
#include <AppleTalk.h>
|
#include <AppleTalk.h>
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
#include "cmdproc.h"
|
#include "cmdproc.h"
|
||||||
|
#include "installcmds.h"
|
||||||
|
|
||||||
typedef struct NewCmd {
|
typedef struct NewCmd {
|
||||||
Word cmdNum;
|
Word cmdNum;
|
||||||
|
@ -22,8 +23,6 @@ NewCmd newCmds[] = {
|
||||||
|
|
||||||
LongWord *cmdTable = (LongWord *)0xE1D600;
|
LongWord *cmdTable = (LongWord *)0xE1D600;
|
||||||
|
|
||||||
#define MAX_CMD rpmFlushSessionCommand
|
|
||||||
|
|
||||||
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
|
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
|
||||||
|
|
||||||
void installCmds(void) {
|
void installCmds(void) {
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#ifndef INSTALLCMDS_H
|
#ifndef INSTALLCMDS_H
|
||||||
#define INSTALLCMDS_H
|
#define INSTALLCMDS_H
|
||||||
|
|
||||||
|
#include <AppleTalk.h>
|
||||||
|
|
||||||
|
#define MAX_CMD rpmFlushSessionCommand
|
||||||
|
|
||||||
|
extern LongWord oldCmds[MAX_CMD + 1];
|
||||||
|
|
||||||
void installCmds(void);
|
void installCmds(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,14 +22,6 @@ BOOLEAN StartTCPConnection(Session *sess) {
|
||||||
|
|
||||||
commandRec = (ASPOpenSessionRec *)sess->spCommandRec;
|
commandRec = (ASPOpenSessionRec *)sess->spCommandRec;
|
||||||
|
|
||||||
if (commandRec->slsNet != atipMapping.networkNumber
|
|
||||||
|| commandRec->slsNode != atipMapping.node
|
|
||||||
|| commandRec->slsSocket != atipMapping.socket)
|
|
||||||
{
|
|
||||||
commandRec->result = aspNetworkErr;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
sess->atipMapping = atipMapping;
|
sess->atipMapping = atipMapping;
|
||||||
|
|
||||||
if (TCPIPGetConnectStatus() == FALSE) {
|
if (TCPIPGetConnectStatus() == FALSE) {
|
||||||
|
|
Loading…
Reference in New Issue