RPC: Internal interface
Andrew Birrell September 7, 1983 4:12 pm
Bob Hagmann February 8, 1985 3:33:38 pm PST
DIRECTORY
BufferDefs USING[ PupBuffer ],
DESFace USING[ Block, IV, Key ],
RPC USING[ Conversation, InterfaceName, Principal, SecurityLevel, VersionRange ],
RPCLupine USING[ DataLength, Dispatcher, RPCPkt],
RPCPkt USING[ CallCount, ConnectionID, ConversationID, DispatcherDetails, DispatcherID, ExportHandle, Header, PktConversationID, PktID, Machine];
ExportInstance:
TYPE =
RECORD[
Exporter's record of exported interface
id: RPCPkt.DispatcherID,
dispatcher: RPCLupine.Dispatcher,
mds: CARDINAL,
name: RPC.InterfaceName,
stubProtocol: RPC.VersionRange ];
ExportTable:
TYPE =
RECORD[
used: CARDINAL,
entries: SEQUENCE length: RPCPkt.ExportHandle OF ExportInstance];
exportTable: REF ExportTable;
ImportInstance:
TYPE =
RECORD[
Importer's record of successful binding
host: RPCPkt.Machine,
dispatcher: RPCPkt.DispatcherDetails ];
ConversationObject:
TYPE =
RECORD[
next: REF ConversationObject,
id: RPCPkt.ConversationID,
level: RPC.SecurityLevel,
key: DESFace.Key, -- conversation key --
iv: DESFace.IV,
originator: RPC.Principal,
responder: RPC.Principal,
authenticator: Authenticator];
Authenticator: TYPE = REF AuthenticatorObject;
AuthenticatorObject:
TYPE =
RECORD[
Allocated storage for an authenticator. For A talking to B using key CK, contains: {KY}KB, spare, { {CK}KB, spare, time, A }KY . The keys are single cipher blocks. The rest is encrypted with CBC-check using a zero IV
SEQUENCE nBlks: CARDINAL OF DESFace.Block ];
firstConversation: RPCPkt.PktConversationID; -- for unencrypted conversations --
EncryptPkt:
PROC[pkt: RPCLupine.RPCPkt, l: RPCLupine.DataLength]
RETURNS[CARDINAL];
Encrypts packet using pkt.convHandle; "l" is data length of pkt; returns Pup length of packet.
DecryptPkt:
PROC[header:
LONG
POINTER
TO RPCPkt.Header,
convHandle: RPC.Conversation]
RETURNS[ok: BOOLEAN, l: RPCLupine.DataLength];
Decrypts packet using pkt.convHandle; ok iff checksum matches; returns data length of packet
GetConnectionState:
PROC[ decrypted:
BOOLEAN, callPkt: RPCLupine.RPCPkt]
RETURNS[ ok:
BOOLEAN,
id: RPCPkt.ConnectionID,
call: RPCPkt.CallCount,
conv: RPC.Conversation,
l: RPCLupine.DataLength ];
On entry, packet is decrypted iff "decrypted". On exit, packet is decrypted if "ok". If "ok" and not "decrypted", returns pkt data length in "l". Sends RFA and accepts response; results valid iff "ok"
ReplyToRFA:
PROC[b: BufferDefs.PupBuffer,
-- incoming packet --
callHeader: LONG POINTER TO RPCPkt.Header, -- encrypted --
callPktID: RPCPkt.PktID-- clear --,
convHandle: RPC.Conversation]
RETURNS[BOOLEAN];
Generates RFA response packet if request matches thisPktID
DoSignal:
PROC[b: BufferDefs.PupBuffer, pktLength: RPCLupine.DataLength,
signalHandler: RPCLupine.Dispatcher,
convHandle: RPC.Conversation]
RETURNS[resumePkt: RPCLupine.RPCPkt,
resumeLength: RPCLupine.DataLength,
myLocalFrame: POINTER];
Called from inside PktExchange to handle signal-back packets
ServerMain:
PROCEDURE;
FORK'ed when needed by RPCPktIO, to maintain an adequate stock of them