SunPMapLocalImpl.mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Demers, November 2, 1988 10:35:38 am PST
Willie-Sue, March 16, 1989 6:55:00 pm PST
Willie-s, August 21, 1991 12:39 pm PDT
Chauser, January 3, 1992 10:56 am PST
DIRECTORY
Arpa,
Basics,
SunPMap,
SunPMapClient,
SunPMapLocal,
SunRPC,
SunRPCOnUDP,
SunRPCAuth
;
SunPMapLocalImpl: CEDAR PROGRAM
IMPORTS Basics, SunPMapClient, SunRPC, SunRPCOnUDP, SunRPCAuth
EXPORTS SunPMapLocal
~ {
Types
RPCHandle: TYPE ~ SunRPC.Handle;
Conversation: TYPE ~ SunRPCAuth.Conversation;
MapEntry: TYPE ~ SunPMap.MapEntry;
Procedures
Error: ERROR ~ CODE;
InnerProc: TYPE ~ PROC [rpcH: RPCHandle, c: Conversation];
CallSelf: PROC [proc: InnerProc] ~ {
rpcH: SunRPC.Handle ¬ NIL;
c: SunRPCAuth.Conversation ¬ NIL;
Cleanup: PROC ~ {
IF rpcH # NIL THEN { SunRPC.Destroy[rpcH]; rpcH ¬ NIL };
IF c # NIL THEN { SunRPCAuth.Terminate[c]; c ¬ NIL };
};
{
ENABLE {
UNWIND => Cleanup[];
SunRPC.Error, SunRPCAuth.Error => ERROR Error;
};
rpcH ¬ SunRPCOnUDP.Create[
remoteAddress~Arpa.nullAddress, -- ME
remotePort~Basics.HFromCard16[CARD16[SunPMap.udpPort]]
];
c ¬ SunRPCAuth.Initiate[];
proc[rpcH, c];
};
Cleanup[];
};
SetLocal: PUBLIC PROC [program, version, protocol, port: CARD32]
RETURNS [success: BOOL] ~ {
SetLocalInner: InnerProc ~ {
success ¬ SunPMapClient.Set[rpcH, c, program, version, protocol, port];
};
CallSelf[ SetLocalInner ! Error => { success ¬ FALSE; CONTINUE }];
};
UnsetLocal: PUBLIC PROC [program, version: CARD32]
RETURNS [success: BOOL] ~ {
UnsetLocalInner: InnerProc ~ {
success ¬ SunPMapClient.Unset[rpcH, c, program, version];
};
CallSelf[ UnsetLocalInner ! Error => { success ¬ FALSE; CONTINUE }];
};
GetPortLocal: PUBLIC PROC [program, version, protocol: CARD32]
RETURNS [port: CARD32] ~ {
GetPortLocalInner: InnerProc ~ {
port ¬ SunPMapClient.GetPort[rpcH, c, program, version, protocol];
};
CallSelf[ GetPortLocalInner ! Error => { port ¬ 0; CONTINUE }];
};
DumpLocal: PUBLIC PROC [eachMapEntry: PROC[MapEntry]] ~ {
DumpLocalInner: InnerProc ~ {
SunPMapClient.Dump[rpcH, c, eachMapEntry];
};
CallSelf[ DumpLocalInner ! Error => { CONTINUE }];
};
CallItLocal: PUBLIC PROC [program, version, proc: CARD32, args: REF TEXT, timeout: CARD, retries: CARD] RETURNS [port: CARD32, result: REF TEXT] ~ {
CallItLocalInner: InnerProc ~ {
[port, result] ¬ SunPMapClient.Callit[rpcH, c, program, version, proc, args, timeout];
};
CallSelf[ CallItLocalInner ! Error => { port ¬ 0; result ¬ NIL; CONTINUE }];
};
}.