Add support for sending DSICommand requests.
This commit is contained in:
parent
83c702fcbb
commit
275f3456ba
|
@ -138,7 +138,15 @@ void DoSPCloseSession(Session *sess, ASPCloseSessionRec *commandRec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSPCommand(Session *sess, ASPCommandRec *commandRec) {
|
void DoSPCommand(Session *sess, ASPCommandRec *commandRec) {
|
||||||
// TODO
|
sess->request.flags = DSI_REQUEST;
|
||||||
|
sess->request.command = DSICommand;
|
||||||
|
sess->request.requestID = htons(sess->nextRequestID++);
|
||||||
|
sess->request.writeOffset = 0;
|
||||||
|
sess->request.totalDataLength = htonl(commandRec->cmdBlkLength);
|
||||||
|
sess->replyBuf = (void*)commandRec->replyBufferAddr;
|
||||||
|
sess->replyBufLen = commandRec->replyBufferLen;
|
||||||
|
|
||||||
|
SendDSIMessage(sess, &sess->request, (void*)commandRec->cmdBlkAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSPWrite(Session *sess, ASPWriteRec *commandRec) {
|
void DoSPWrite(Session *sess, ASPWriteRec *commandRec) {
|
||||||
|
@ -154,7 +162,7 @@ void FinishASPCommand(Session *sess) {
|
||||||
// The IIgs ASP interfaces can't represent lengths over 64k.
|
// The IIgs ASP interfaces can't represent lengths over 64k.
|
||||||
// This should be detected as an error earlier, but let's make sure.
|
// This should be detected as an error earlier, but let's make sure.
|
||||||
sess->spCommandRec->result = aspSizeErr;
|
sess->spCommandRec->result = aspSizeErr;
|
||||||
return;
|
goto complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(sess->spCommandRec->command) {
|
switch(sess->spCommandRec->command) {
|
||||||
|
@ -176,7 +184,8 @@ void FinishASPCommand(Session *sess) {
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
complete:
|
||||||
CompleteCommand(sess);
|
CompleteCommand(sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,5 +205,6 @@ void CompleteCommand(Session *sess) {
|
||||||
memset(sess, 0, sizeof(*sess));
|
memset(sess, 0, sizeof(*sess));
|
||||||
} else {
|
} else {
|
||||||
sess->commandPending = FALSE;
|
sess->commandPending = FALSE;
|
||||||
|
InitReadTCP(sess, DSI_HEADER_SIZE, &sess->reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
dsitest.c
16
dsitest.c
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
ASPGetStatusRec getStatusRec;
|
ASPGetStatusRec getStatusRec;
|
||||||
ASPOpenSessionRec openSessionRec;
|
ASPOpenSessionRec openSessionRec;
|
||||||
|
ASPCommandRec commandRec;
|
||||||
ASPCloseSessionRec closeSessionRec;
|
ASPCloseSessionRec closeSessionRec;
|
||||||
Byte replyBuffer[1024];
|
Byte replyBuffer[1024];
|
||||||
|
|
||||||
|
@ -81,6 +82,21 @@ int main(int argc, char **argv)
|
||||||
if (openSessionRec.result)
|
if (openSessionRec.result)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
commandRec.async = AT_SYNC;
|
||||||
|
commandRec.command = aspCommandCommand;
|
||||||
|
commandRec.completionPtr = 0;
|
||||||
|
commandRec.refNum = openSessionRec.refNum;
|
||||||
|
// FIXME this sends meaningless garbage, not a real AFP request
|
||||||
|
commandRec.cmdBlkLength = 10;
|
||||||
|
commandRec.cmdBlkAddr = (LongWord)&openSessionRec;
|
||||||
|
commandRec.replyBufferLen = sizeof(replyBuffer);
|
||||||
|
commandRec.replyBufferAddr = (LongWord)&replyBuffer;
|
||||||
|
|
||||||
|
printf("Sending command...\n");
|
||||||
|
DispatchASPCommand((SPCommandRec *)&commandRec);
|
||||||
|
printf("result code = %04x, command result = %08lx\n",
|
||||||
|
commandRec.result, commandRec.cmdResult);
|
||||||
|
|
||||||
closeSessionRec.async = AT_SYNC;
|
closeSessionRec.async = AT_SYNC;
|
||||||
closeSessionRec.command = aspCloseSessionCommand;
|
closeSessionRec.command = aspCloseSessionCommand;
|
||||||
closeSessionRec.completionPtr = 0;
|
closeSessionRec.completionPtr = 0;
|
||||||
|
|
|
@ -15,7 +15,7 @@ ntohs entry
|
||||||
|
|
||||||
htonl start
|
htonl start
|
||||||
ntohl entry
|
ntohl entry
|
||||||
lda 4,s
|
lda 4,s
|
||||||
xba
|
xba
|
||||||
tax
|
tax
|
||||||
lda 6,s
|
lda 6,s
|
||||||
|
|
Loading…
Reference in New Issue