NMSGetPutImpl.mesa
Please do not edit this file.
It was generated using CedarRPCGen.
DIRECTORY
Rope,
SunRPC,
MS,
NS,
MSGetPut,
NSGetPut,
NMS,
NMSGetPut;
NMSGetPutImpl: CEDAR PROGRAM
IMPORTS SunRPC, MSGetPut, NSGetPut EXPORTS NMS, NMSGetPut =
BEGIN
Handle: TYPE = SunRPC.Handle;
ROPE: TYPE = Rope.ROPE;
ReturnCodesNames: PUBLIC ARRAY NMS.ReturnCodes OF ROPE ← [
"Success",
"NotMaintained"
];
GetReturnCodes: PUBLIC PROC[h: Handle] RETURNS [res: NMS.ReturnCodes] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutReturnCodes: PUBLIC PROC[h: Handle, in: NMS.ReturnCodes] = {
SunRPC.PutInt32[h, ORD[in]];
};
ClaimStateNames: PUBLIC ARRAY NMS.ClaimState OF ROPE ← [
"notClaimed",
"checking",
"claimed"
];
GetClaimState: PUBLIC PROC[h: Handle] RETURNS [res: NMS.ClaimState] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutClaimState: PUBLIC PROC[h: Handle, in: NMS.ClaimState] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetQueryCentralNMSargs: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryCentralNMSargs] = {
res.host ← SunRPC.GetRope[h];
res.state ← GetClaimState[h];
};
PutQueryCentralNMSargs: PUBLIC PROC[h: Handle, in: NMS.QueryCentralNMSargs] = {
SunRPC.PutRope[h, in.host];
PutClaimState[h, in.state];
};
GetQueryCentralNMSreturn: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryCentralNMSreturn] = {
res.state ← GetClaimState[h];
res.count ← SunRPC.GetInt32[h];
};
PutQueryCentralNMSreturn: PUBLIC PROC[h: Handle, in: NMS.QueryCentralNMSreturn] = {
PutClaimState[h, in.state];
SunRPC.PutInt32[h, in.count];
};
UpdateTypeNames: PUBLIC ARRAY NMS.UpdateType OF ROPE ← [
"add",
"replace"
];
GetUpdateType: PUBLIC PROC[h: Handle] RETURNS [res: NMS.UpdateType] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutUpdateType: PUBLIC PROC[h: Handle, in: NMS.UpdateType] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetUpdateObjectRecord: PUBLIC PROC[h: Handle] RETURNS [res: NMS.UpdateObjectRecord] = {
res.obj ← NSGetPut.GetObject[h];
res.uid ← NSGetPut.GetString[h];
};
PutUpdateObjectRecord: PUBLIC PROC[h: Handle, in: NMS.UpdateObjectRecord] = {
NSGetPut.PutObject[h, in.obj];
NSGetPut.PutString[h, in.uid];
};
GetUpdateObject: PUBLIC PROC[h: Handle] RETURNS [res: NMS.UpdateObject] = {
IF SunRPC.GetInt32[h] # 0 THEN {
res ← NEW[NMS.UpdateObjectRecord];
res^ ← GetUpdateObjectRecord[h];
}
ELSE
res ← NIL;
};
PutUpdateObject: PUBLIC PROC[h: Handle, in: NMS.UpdateObject] = {
IF in = NIL THEN {
SunRPC.PutInt32[h, 0];
}
ELSE {
SunRPC.PutInt32[h, 1];
PutUpdateObjectRecord[h, in^];
};
};
GetUpdateCentralNMSargs: PUBLIC PROC[h: Handle] RETURNS [res: NMS.UpdateCentralNMSargs] = {
res.host ← NSGetPut.GetString[h];
res.how ← GetUpdateType[h];
{
len: INT ← SunRPC.GetInt32[h];
res.objs ← NEW[NMS.SeqType0Object[len]];
FOR i: INT IN [0..len) DO
res.objs[i] ← GetUpdateObject[h];
ENDLOOP;
};
};
PutUpdateCentralNMSargs: PUBLIC PROC[h: Handle, in: NMS.UpdateCentralNMSargs] = {
NSGetPut.PutString[h, in.host];
PutUpdateType[h, in.how];
SunRPC.PutInt32[h, in.objs.size];
FOR i: INT IN [0..in.objs.size) DO
PutUpdateObject[h, in.objs[i]];
ENDLOOP;
};
GetQueryLocalNMSargs: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryLocalNMSargs] = {
res.centralHost ← SunRPC.GetRope[h];
};
PutQueryLocalNMSargs: PUBLIC PROC[h: Handle, in: NMS.QueryLocalNMSargs] = {
SunRPC.PutRope[h, in.centralHost];
};
GetQueryLocalNMSreturn: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryLocalNMSreturn] = {
{
len: INT ← SunRPC.GetInt32[h];
res.objs ← NEW[NMS.SeqType1Object[len]];
FOR i: INT IN [0..len) DO
res.objs[i] ← GetUpdateObject[h];
ENDLOOP;
};
};
PutQueryLocalNMSreturn: PUBLIC PROC[h: Handle, in: NMS.QueryLocalNMSreturn] = {
SunRPC.PutInt32[h, in.objs.size];
FOR i: INT IN [0..in.objs.size) DO
PutUpdateObject[h, in.objs[i]];
ENDLOOP;
};
GetQueryMaintainargs: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryMaintainargs] = {
res.idStr ← SunRPC.GetRope[h];
};
PutQueryMaintainargs: PUBLIC PROC[h: Handle, in: NMS.QueryMaintainargs] = {
SunRPC.PutRope[h, in.idStr];
};
GetQueryMaintainreturn: PUBLIC PROC[h: Handle] RETURNS [res: NMS.QueryMaintainreturn] = {
tag: NMS.ReturnCodes;
tag ← GetReturnCodes[h];
SELECT tag FROM
Success => {
v: REF Success NMS.QueryMaintainreturnObject ← NEW[Success NMS.QueryMaintainreturnObject];
v.pid ← SunRPC.GetInt32[h];
res ← v;
};
NotMaintained => {
v: REF NotMaintained NMS.QueryMaintainreturnObject ← NEW[NotMaintained NMS.QueryMaintainreturnObject];
res ← v;
};
ENDCASE => NULL;
};
PutQueryMaintainreturn: PUBLIC PROC[h: Handle, in: NMS.QueryMaintainreturn] = {
PutReturnCodes[h, in.returnCode];
SELECT in.returnCode FROM
Success => {
v: REF Success NMS.QueryMaintainreturnObject ← NARROW[in];
SunRPC.PutInt32[h, v.pid];
};
NotMaintained => {
v: REF NotMaintained NMS.QueryMaintainreturnObject ← NARROW[in];
};
ENDCASE => NULL;
};
END.