Procedures
Null:
PUBLIC SunYP.NullProc
-- [h: Handle, c: Conversation] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.null];
[] ¬ SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
Domain:
PUBLIC SunYP.DomainProc
-- [h: Handle, c: Conversation, domain: DomainName] RETURNS [serves: BOOL] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.domain];
SunRPC.PutRope[h, domain];
[] ¬ SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
serves ¬ (SunRPC.GetCard32[h] # 0);
SunRPC.ReleaseReply[h];
};
DomainNonack:
PUBLIC
PROC [h: SunRPC.Handle, c: SunRPCAuth.Conversation, domain: SunYP.DomainName, timeout:
CARD]
RETURNS [serves:
BOOL] ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.domainNonack];
SunRPC.PutRope[h, domain];
[] ¬ SunRPC.SendCallAndReceiveReply[h, timeout, noRetries];
serves ¬ (SunRPC.GetCard32[h] # 0);
SunRPC.ReleaseReply[h];
};
Match:
PUBLIC SunYP.MatchProc
-- [h: Handle, c: Conversation, req: RequestKey] RETURNS [resp: ResponseVal] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.match];
PutRequestKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
resp ¬ GetResponseVal[h];
SunRPC.ReleaseReply[h];
};
First:
PUBLIC SunYP.FirstProc
-- [h: Handle, c: Conversation, req: RequestNoKey] RETURNS [resp: ResponseKeyVal] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.first];
PutRequestNoKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
resp ¬ GetResponseKeyVal[h];
SunRPC.ReleaseReply[h];
};
Next:
PUBLIC SunYP.NextProc
-- [h: Handle, c: Conversation, req: RequestKey] RETURNS [resp: ResponseKeyVal] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.next];
PutRequestKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
resp ¬ GetResponseKeyVal[h];
SunRPC.ReleaseReply[h];
};
All:
PUBLIC SunYP.AllProc
-- [h: Handle, c: Conversation, req: RequestNoKey, eachResponseKeyVal: EachResponseKeyValProc] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.all];
PutRequestNoKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, slowTimeout, defaultRetries];
DO
IF SunRPC.GetCard32[h] = 0 THEN EXIT;
IF NOT eachResponseKeyVal[GetResponseKeyVal[h]].continue THEN EXIT;
ENDLOOP;
SunRPC.ReleaseReply[h];
};
Master:
PUBLIC SunYP.MasterProc
-- [h: Handle, c: Conversation, req: RequestNoKey] RETURNS [resp: ResponseMaster] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.master];
PutRequestNoKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
resp.status ¬ GetStatus[h];
resp.master ¬ SunRPC.GetRope[h];
SunRPC.ReleaseReply[h];
};
Order:
PUBLIC SunYP.OrderProc
-- [h: Handle, c: Conversation, req: SunYP.RequestNoKey] RETURNS [resp: SunYP.ResponseOrder] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.order];
PutRequestNoKey[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
resp.status ¬ GetStatus[h];
resp.ordernum ¬ SunRPC.GetCard32[h];
SunRPC.ReleaseReply[h];
};
Maplist:
PUBLIC SunYP.MaplistProc
-- [h: Handle, c: Conversation, req: DomainName, eachMapName: EachMapNameProc] RETURNS [status: Status] -- ~ {
SunRPC.StartCall[h, c, SunYP.program, SunYP.programVersion, SunYP.maplist];
SunRPC.PutRope[h, req];
[] ¬ SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
status ¬ GetStatus[h];
SELECT status
FROM
true, nomore =>
DO
IF SunRPC.GetCard32[h] = 0 THEN EXIT;
IF NOT eachMapName[SunRPC.GetRope[h]].continue THEN EXIT;
ENDLOOP;
ENDCASE;
SunRPC.ReleaseReply[h];
};
GetStatus:
PROC [h: SunRPC.Handle]
RETURNS [status: SunYP.Status] ~
INLINE {
ENABLE RuntimeError.BoundsFault => ERROR SunRPC.Error[$protocolError];
RETURN [GetStatusInner[h]];
};
GetStatusInner:
PROC [h: SunRPC.Handle]
RETURNS [SunYP.Status] ~ {
x: INT ¬ SunRPC.GetInt32[h];
RETURN[VAL[CARDINAL[IF x >= 0 THEN x ELSE 1000-x]]];
};
PutRequestKey:
PROC [h: SunRPC.Handle, req: SunYP.RequestKey] ~ {
SunRPC.PutRope[h, req.domain];
SunRPC.PutRope[h, req.map];
SunRPC.PutRefText[h, req.key];
};
PutRequestNoKey:
PROC [h: SunRPC.Handle, req: SunYP.RequestNoKey] ~ {
SunRPC.PutRope[h, req.domain];
SunRPC.PutRope[h, req.map];
};
GetResponseVal:
PROC [h: SunRPC.Handle]
RETURNS [resp: SunYP.ResponseVal] ~ {
resp.status ¬ GetStatus[h];
resp.val ¬ SunRPC.GetRefText[h];
};
GetResponseKeyVal:
PROC [h: SunRPC.Handle]
RETURNS [resp: SunYP.ResponseKeyVal] ~ {
resp.status ¬ GetStatus[h];
resp.val ¬ SunRPC.GetRefText[h];
resp.key ¬ SunRPC.GetRefText[h];
};
}...