Copied Types and Constants
FWORD: TYPE ~ Basics.FWORD;
HWORD: TYPE ~ Basics.HWORD;
bitsPerByte: CARDINAL ~ BITS[BYTE];
Courier Message Types
courierVersionNum: CARDINAL ~ 3;
Header of a Courier session.
SessionHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
lowVersion: HWORD,
highVersion: HWORD
];
sessionHdrBytes: CARDINAL ~ BITS[SessionHdr]/BITS[BYTE];
sessionHdrHWords: CARDINAL ~ BITS[SessionHdr]/BITS[HWORD];
Header of a Courier message.
MsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgType: HWORD
];
callMsgType: HWORD ~ [0, 0];
rejectMsgType: HWORD ~ [0, 1];
returnMsgType: HWORD ~ [0, 2];
abortMsgType: HWORD ~ [0, 3];
msgHdrBytes: CARDINAL ~ BITS[MsgHdr]/BITS[BYTE];
msgHdrHWords: CARDINAL ~ BITS[MsgHdr]/BITS[HWORD];
Header of a call message.
CallHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD,
pgmNum: FWORD,
pgmVersion: HWORD,
procNum: HWORD
];
callHdrBytes: CARDINAL ~ BITS[CallHdr]/BITS[BYTE];
callHdrHWords: CARDINAL ~ BITS[CallHdr]/BITS[HWORD];
CallMsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgHdr: MsgHdr,
callHdr: CallHdr
];
callMsgHdrBytes: CARDINAL ~ BITS[CallMsgHdr]/BITS[BYTE];
callMsgHdrHWords: CARDINAL ~ BITS[CallMsgHdr]/BITS[HWORD];
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 ~ BITS[RejectHdr]/BITS[BYTE];
rejectHdrHWords: CARDINAL ~ BITS[RejectHdr]/BITS[HWORD];
RejectMsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgHdr: MsgHdr,
rejectHdr: RejectHdr
];
rejectMsgHdrBytes: CARDINAL ~ BITS[RejectMsgHdr]/BITS[BYTE];
rejectMsgHdrHWords: CARDINAL ~ BITS[RejectMsgHdr]/BITS[HWORD];
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 ~ BITS[ReturnHdr]/BITS[BYTE];
returnHdrHWords: CARDINAL ~ BITS[ReturnHdr]/BITS[HWORD];
ReturnMsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgHdr: MsgHdr,
returnHdr: ReturnHdr
];
returnMsgHdrBytes: CARDINAL ~ BITS[ReturnMsgHdr]/BITS[BYTE];
returnMsgHdrHWords: CARDINAL ~ BITS[ReturnMsgHdr]/BITS[HWORD];
Body of a return message is program-specific.
Header of an abort message.
AbortHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
tID: HWORD,
errNum: HWORD
];
abortHdrBytes: CARDINAL ~ BITS[AbortHdr]/BITS[BYTE];
abortHdrHWords: CARDINAL ~ BITS[AbortHdr]/BITS[HWORD];
AbortMsgHdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
msgHdr: MsgHdr,
abortHdr: AbortHdr
];
abortMsgHdrBytes: CARDINAL ~ BITS[AbortMsgHdr]/BITS[BYTE];
abortMsgHdrHWords: CARDINAL ~ BITS[AbortMsgHdr]/BITS[HWORD];
Body of an abort message is program-specific.
Implementing Client Stubs
CreateClientHandleProc:
TYPE ~
PROC [remote: RefAddress]
RETURNS [Handle];
Proc to create a client Object handle associated with the given remote address. The remote address must be appropriate to the handle class for which the CreateClientHandleProc was registered (using RegisterCreateClientHandleProc, see below). The interesting operations on the handle are implemented by the ProcsObject handle.procs^.
RegisterCreateClientHandleProc:
PROC [
class: HandleClass,
proc: CreateClientHandleProc];
Register a CreateClientHandleProc for the given class.
NewClientObject:
PROC [class: HandleClass, procs:
REF ProcsObject, data:
REF ←
NIL, clientData:
REF ←
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 calls handle.procs.finalize[handle]. This is the only approved way for a class implementor to provide Object finalization.
RenewClientObject:
PROC [handle: Handle];
Re-enable finalization on a given object. This is the only approved way for a class implementor to provide Object finalization.
Implementing Server Stubs
CreateListenerProc:
TYPE ~
PROC [local: RefAddress];
Transport-specific proc to create a listener at a specified socket. Default of NIL should be interpreted as a well-known socket if possible. May be called more than once with the same socket value, so it has to check for this. If local is inappropriate for the transport class, it should raise CrRPC.Error[... addressInappropriateForClass ...].
RegisterCreateListenerProc:
PROC [
class: HandleClass,
createListenerProc: CreateListenerProc];
LookUpServerProc:
PROC [pgm:
CARD32, pgmVersion:
CARD16]
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.
}.