SunYPBindClientStub.mesa
Demers, September 8, 1987 9:51:42 pm PDT
DIRECTORY
Arpa USING [Address],
SunRPC USING [Error, GetCard32, GetF, PutCard32, PutF, PutRope, ReleaseReply, SendCallAndReceiveReply, StartCall],
SunYPBind USING [domain, DomainProc, ErrorCode, null, NullProc, program, programVersion, ResponseCode, setdom, SetdomProc],
SunYPBindClient USING []
;
SunYPBindClientStub: CEDAR PROGRAM
IMPORTS SunRPC
EXPORTS SunYPBindClient
~ {
Parameters
fastTimeout: CARD ← 200;
mediumTimeout: CARD ← 1000;
slowTimeout: CARD ← 5000;
defaultRetries: CARD ← 5;
noRetries: CARD ← 0;
Procedures
Null: PUBLIC SunYPBind.NullProc -- [h: Handle, c: Conversation] -- ~ {
SunRPC.StartCall[h, c, SunYPBind.program, SunYPBind.programVersion, SunYPBind.null];
[] ← SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
Domain: PUBLIC SunYPBind.DomainProc -- [h: Handle, c: Conversation, domainName: DomainName] RETURNS [resp: ResponseBinding] -- ~ {
SunRPC.StartCall[h, c, SunYPBind.program, SunYPBind.programVersion, SunYPBind.domain];
SunRPC.PutRope[h, domainName];
[] ← SunRPC.SendCallAndReceiveReply[h, slowTimeout, defaultRetries];
SELECT SunRPC.GetCard32[h] FROM
SunYPBind.ResponseCode.success.ORD => {
address: Arpa.Address ← LOOPHOLE[SunRPC.GetF[h]];
port: CARD32 ← SunRPC.GetCard32[h];
SunRPC.ReleaseReply[h];
RETURN [[success[binding~[address, port]]]];
};
SunYPBind.ResponseCode.failure.ORD => {
errorCode: SunYPBind.ErrorCode ← VAL[CARDINAL[SunRPC.GetCard32[h]]];
SunRPC.ReleaseReply[h];
RETURN [[failure[errorCode]]];
};
ENDCASE => ERROR SunRPC.Error[$protocolError];
};
Setdom: PUBLIC SunYPBind.SetdomProc -- [h: Handle, c: Conversation, req: RequestDomainBinding] -- ~ {
SunRPC.StartCall[h, c, SunYPBind.program, SunYPBind.programVersion, SunYPBind.setdom];
SunRPC.PutRope[h, req.domainName];
SunRPC.PutF[h, LOOPHOLE[req.binding.address]];
SunRPC.PutCard32[h, req.binding.port];
SunRPC.PutCard32[h, req.version];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
}...