CrRPCBackdoor.mesa
Copyright Ó 1986, 1991 by Xerox Corporation. All rights reserved.
Demers, April 24, 1990 2:16 pm PDT
Willie-Sue Orr, November 13, 1989 3:29:40 pm PST
Willie-s, December 9, 1991 1:58 pm PST
DIRECTORY
Basics USING [FWORD, HWORD],
CrRPC USING [BeginErrorProc, BeginRejectProc, BeginReturnProc, ProcsObject, Handle, HandleClass, RefAddress, ServerProc, StopServerQueryProc],
XNS USING [Host, Net];
CrRPCBackdoor: CEDAR DEFINITIONS
~ {
OPEN CrRPC;
Introduction
Backdoor interface for Courier runtime support, for use by class implementors.
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 ~ WORD16 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 ~ WORD16 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 ~ WORD16 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 ~ WORD16 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 ~ WORD16 MACHINE DEPENDENT RECORD [
tID: HWORD,
rejectReason: HWORD -- noSuchProgram(0), noSuchVersion(1), noSuchProcedure(2), invalidArgument(3), unspecifiedReject(ffffH),
];
Reject Reasons
See CrRPC
rejectHdrBytes: CARDINAL ~ BITS[RejectHdr]/BITS[BYTE];
rejectHdrHWords: CARDINAL ~ BITS[RejectHdr]/BITS[HWORD];
RejectMsgHdr: TYPE ~ WORD16 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 ~ WORD16 MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
noSuchProgram => [],
noSuchVersion => [
lowPgmVersion: HWORD,
highPgmVersion: HWORD],
noSuchProcedure => [],
invalidArgument => [],
unspecifiedReject => []
ENDCASE
];
Header of a return message.
ReturnHdr: TYPE ~ WORD16 MACHINE DEPENDENT RECORD [
tID: HWORD
];
returnHdrBytes: CARDINAL ~ BITS[ReturnHdr]/BITS[BYTE];
returnHdrHWords: CARDINAL ~ BITS[ReturnHdr]/BITS[HWORD];
ReturnMsgHdr: TYPE ~ WORD16 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 ~ WORD16 MACHINE DEPENDENT RECORD [
tID: HWORD,
errNum: HWORD
];
abortHdrBytes: CARDINAL ~ BITS[AbortHdr]/BITS[BYTE];
abortHdrHWords: CARDINAL ~ BITS[AbortHdr]/BITS[HWORD];
AbortMsgHdr: TYPE ~ WORD16 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.
Bulk Data
BulkDataDescriptorType: TYPE ~ MACHINE DEPENDENT {
null(0),
immediate(1),
passive(2),
active(3) };
BulkDataXferID: TYPE ~ RECORD [
host: XNS.Host,
hostRelativeXferID: ARRAY [0..2) OF CARDINAL];
BulkDataDescriptor: TYPE ~ RECORD [
SELECT type: BulkDataDescriptorType FROM
null => [],
immediate => [],
passive, active => [
network: XNS.Net,
host: XNS.Host,
identifier: BulkDataXferID]
ENDCASE
];
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.
Implementing Server Stubs
StartServerInstanceProc: TYPE ~ PROC [pgm: CARD32, pgmVersion: CARD16, local: RefAddress ¬ NIL];
Transport-specific proc to start a single server instance. Should use LookUpServerProcs, below. Default local of NIL should be interpreted as a well-known address if possible. May be called more than once with the same local value; this should result in multiple server instances. If local is inappropriate for the transport class, it should raise CrRPC.Error[... addressInappropriateForClass ...].
RegisterStartServerInstanceProc: PROC [
class: HandleClass,
startServerInstanceProc: StartServerInstanceProc];
LookUpServerProcs: PROC [pgm: CARD32, pgmVersion: CARD16]
RETURNS [serverProc: CrRPC.ServerProc, stopServerQueryProc: CrRPC.StopServerQueryProc];
Look up a registered ServerProc and StopServerQueryProc for the given pgm/version. The returned procs will bh the most-recently-registered ones whose version number range contains pgmVersion. Return NIL if none exists. Intended to be called by a StartServerInstanceProc.
}.