Copied Types and Constants
CARD: TYPE ~ LONG CARDINAL;
BYTE: TYPE ~ Endian.BYTE;
FWORD: TYPE ~ Endian.FWORD;
HWORD: TYPE ~ Endian.HWORD;
bytesPerWord: CARDINAL ~ Endian.bytesPerHWord;
Courier Message Types
courierVersionNum: CARDINAL ~ 3;
Header of a Courier session.
SessionHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
lowVersion: HWORD,
highVersion: HWORD
];
sessionHdrBytes: CARDINAL ~ SIZE[SessionHdr]*bytesPerWord; -- should be BYTES
sessionHdrHWords: CARDINAL ~ SIZE[SessionHdr];
Header of a Courier message.
MsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgType: HWORD
];
callMsgType: CARDINAL ~ 0;
rejectMsgType: CARDINAL ~ 1;
returnMsgType: CARDINAL ~ 2;
abortMsgType: CARDINAL ~ 3;
msgHdrBytes: CARDINAL ~ SIZE[MsgHdr]*bytesPerWord; -- should be BYTES
msgHdrHWords: CARDINAL ~ SIZE[MsgHdr];
Header of a call message.
CallHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD,
pgmNum: FWORD,
pgmVersion: HWORD,
procNum: HWORD
];
callHdrBytes: CARDINAL ~ SIZE[CallHdr]*bytesPerWord; -- should be BYTES
callHdrHWords: CARDINAL ~ SIZE[CallHdr];
Body of a call message is program-specific.
Header of a reject message.
RejectHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD,
rejectReason: HWORD -- noSuchProgram(0), noSuchVersion(1), noSuchProcedure(2), invalidArgument(3), unspecifiedReject(ffffH),
];
rejectHdrBytes: CARDINAL ~ SIZE[RejectHdr]*bytesPerWord; -- should be BYTES
rejectHdrHWords: CARDINAL ~ SIZE[RejectHdr];
Body of a reject message.
RejectBody:
TYPE ~
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
noSuchProgram => [],
noSuchVersion => [
lowPgmVersion: HWORD,
highPgmVersion: HWORD],
noSuchProcedure => [],
invalidArgument => [],
unspecifiedReject => []
ENDCASE
];
Header of a return message.
ReturnHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD
];
returnHdrBytes: CARDINAL ~ SIZE[ReturnHdr]*bytesPerWord; -- should be BYTES
returnHdrHWords: CARDINAL ~ SIZE[ReturnHdr];
Body of a return message is program-specific.
Header of an abort message.
AbortHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD,
errNum: HWORD
];
abortHdrBytes: CARDINAL ~ SIZE[AbortHdr]*bytesPerWord; -- should be BYTES
abortHdrHWords: CARDINAL ~ SIZE[AbortHdr];
Body of an abort message is program-specific.
Implementing Client Stubs
CreateClientHandleProc:
TYPE ~
PROC [
remote: XNS.Address,
timeoutMsec: INT
] RETURNS [Handle];
Proc to create a client Object handle associated with the given remote address. The interesting operations on the handle are implemented by the ClientProcs object handle.procs^.
RegisterCreateClientHandleProc:
PROC [
class: HandleClass,
proc: CreateClientHandleProc];
Register a CreateClientHandleProc for the given class.
NewClientObject:
PROC [class: HandleClass, marshallProcs:
REF MarshallProcs,
procs:
REF ClientProcs, data:
REF
ANY ←
NIL, clientData:
REF
ANY ←
NIL]
RETURNS [Handle];
Allocate a new client object initialized from the arguments. Finalization is enabled, with number of package references set to 0. The finalizer just calls handle.clientProcs.finalize[handle]. This is the only approved way for a class implementor to provide Object finalization.
Implementing Server Stubs
CreateListenerProc:
TYPE ~
PROC [socket:
XNS.Socket];
Transport-specific proc to create a listener at a specified socket. Default of XNS.unknownSocket should be interpreted as a well-known socket if possible. May be called more than once with the same socket value.
RegisterCreateListenerProc:
PROC [
class: HandleClass,
createListenerProc: CreateListenerProc];
LookUpServerProc:
PROC [pgm:
CARD, pgmVersion:
CARDINAL]
RETURNS [serverProc: ServerProc];
Look up a registered ServerProc for the given pgm/version. Return NIL if none exists. Intended to be called by (the process forked by) a Listener that has received a call message.
}.