<<>> <> <> <> <> <> <> <> DIRECTORY SRPCCalls USING [ ExportSunRPCInterface ], SunRPC, ThrushSunRPC, VoiceRopeServerSunExport, VoiceRopeServerSunRPC, VoiceRopeServerSunRPCServer ; VoiceRopeServerSunRPCServerStub: CEDAR PROGRAM IMPORTS SRPCCalls, SunRPC, VoiceRopeServerSunRPCServer EXPORTS VoiceRopeServerSunExport ~ { OPEN VoiceRopeServerSunRPC, VoiceRopeServerSunRPCServer; <> Handle: TYPE ~ SunRPC.Handle; ForgetCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; class: ROPE; refID: ROPE; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { class _ SunRPC.GetRope[h]; }; { refID _ SunRPC.GetRope[h]; }; [nb] _ Forget[h, shhh, vr, class, refID]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; PlayCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; voiceRope: VoiceRope; credentials: ThrushSunRPC.Credentials; serviceID: CARD32; intID: CARD32; queueIt: BOOLEAN; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { voiceRope.ropeID _ SunRPC.GetRope[h]; voiceRope.start _ SunRPC.GetInt32[h]; voiceRope.length _ SunRPC.GetInt32[h]; }; { credentials.partyID _ SunRPC.GetCard32[h]; credentials.smartsID _ SunRPC.GetCard32[h]; credentials.convID _ SunRPC.GetCard32[h]; credentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; credentials.stateID _ SunRPC.GetCard32[h]; }; { serviceID _ SunRPC.GetCard32[h]; }; { intID _ SunRPC.GetCard32[h]; }; { queueIt _ SunRPCGetBool[h]; }; [nb] _ Play[h, shhh, voiceRope, credentials, serviceID, intID, queueIt]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; RecordCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; credentials: ThrushSunRPC.Credentials; serviceID: CARD32; recordedParty: CARD32; intID: CARD32; queueIt: BOOLEAN; nb: ROPE; voiceRope: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { credentials.partyID _ SunRPC.GetCard32[h]; credentials.smartsID _ SunRPC.GetCard32[h]; credentials.convID _ SunRPC.GetCard32[h]; credentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; credentials.stateID _ SunRPC.GetCard32[h]; }; { serviceID _ SunRPC.GetCard32[h]; }; { recordedParty _ SunRPC.GetCard32[h]; }; { intID _ SunRPC.GetCard32[h]; }; { queueIt _ SunRPCGetBool[h]; }; [nb, voiceRope] _ Record[h, shhh, credentials, serviceID, recordedParty, intID, queueIt]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, voiceRope.ropeID]; SunRPC.PutInt32[h, voiceRope.start]; SunRPC.PutInt32[h, voiceRope.length]; }; }; CatCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; callerRName: ROPE; vr1: VoiceRope; vr2: VoiceRope; vr3: VoiceRope; vr4: VoiceRope; vr5: VoiceRope; nb: ROPE; new: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { callerRName _ SunRPC.GetRope[h]; }; { vr1.ropeID _ SunRPC.GetRope[h]; vr1.start _ SunRPC.GetInt32[h]; vr1.length _ SunRPC.GetInt32[h]; }; { vr2.ropeID _ SunRPC.GetRope[h]; vr2.start _ SunRPC.GetInt32[h]; vr2.length _ SunRPC.GetInt32[h]; }; { vr3.ropeID _ SunRPC.GetRope[h]; vr3.start _ SunRPC.GetInt32[h]; vr3.length _ SunRPC.GetInt32[h]; }; { vr4.ropeID _ SunRPC.GetRope[h]; vr4.start _ SunRPC.GetInt32[h]; vr4.length _ SunRPC.GetInt32[h]; }; { vr5.ropeID _ SunRPC.GetRope[h]; vr5.start _ SunRPC.GetInt32[h]; vr5.length _ SunRPC.GetInt32[h]; }; [nb, new] _ Cat[h, shhh, callerRName, vr1, vr2, vr3, vr4, vr5]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, new.ropeID]; SunRPC.PutInt32[h, new.start]; SunRPC.PutInt32[h, new.length]; }; }; StopCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; creentials: ThrushSunRPC.Credentials; serviceID: CARD32; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { creentials.partyID _ SunRPC.GetCard32[h]; creentials.smartsID _ SunRPC.GetCard32[h]; creentials.convID _ SunRPC.GetCard32[h]; creentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; creentials.stateID _ SunRPC.GetCard32[h]; }; { serviceID _ SunRPC.GetCard32[h]; }; [nb] _ Stop[h, shhh, creentials, serviceID]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; SubstrCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; callerRName: ROPE; vr: VoiceRope; start: INT32; len: INT32; nb: ROPE; new: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { callerRName _ SunRPC.GetRope[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { start _ SunRPC.GetInt32[h]; }; { len _ SunRPC.GetInt32[h]; }; [nb, new] _ Substr[h, shhh, callerRName, vr, start, len]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, new.ropeID]; SunRPC.PutInt32[h, new.start]; SunRPC.PutInt32[h, new.length]; }; }; ReplaceCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; callerRName: ROPE; vr: VoiceRope; start: INT32; len: INT32; with: VoiceRope; nb: ROPE; new: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { callerRName _ SunRPC.GetRope[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { start _ SunRPC.GetInt32[h]; }; { len _ SunRPC.GetInt32[h]; }; { with.ropeID _ SunRPC.GetRope[h]; with.start _ SunRPC.GetInt32[h]; with.length _ SunRPC.GetInt32[h]; }; [nb, new] _ Replace[h, shhh, callerRName, vr, start, len, with]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, new.ropeID]; SunRPC.PutInt32[h, new.start]; SunRPC.PutInt32[h, new.length]; }; }; DescribeRopeCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; minSilence: INT32; nb: ROPE; length: INT32; noise: IntervalSpecs; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { minSilence _ SunRPC.GetInt32[h]; }; [nb, length, noise] _ DescribeRope[h, shhh, vr, minSilence]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutInt32[h, length]; }; { MProc18[h, noise]; }; }; SetPermissionsCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; callerRName: ROPE; vr: VoiceRope; playAccess: Users; editAccess: Users; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { callerRName _ SunRPC.GetRope[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { playAccess _ UProc19[h]; }; { editAccess _ UProc19[h]; }; [nb] _ SetPermissions[h, shhh, callerRName, vr, playAccess, editAccess]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; PauseCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; cedentials: ThrushSunRPC.Credentials; serviceID: CARD32; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { cedentials.partyID _ SunRPC.GetCard32[h]; cedentials.smartsID _ SunRPC.GetCard32[h]; cedentials.convID _ SunRPC.GetCard32[h]; cedentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; cedentials.stateID _ SunRPC.GetCard32[h]; }; { serviceID _ SunRPC.GetCard32[h]; }; [nb] _ Pause[h, shhh, cedentials, serviceID]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; ResumeCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; credentials: ThrushSunRPC.Credentials; serviceID: CARD32; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { credentials.partyID _ SunRPC.GetCard32[h]; credentials.smartsID _ SunRPC.GetCard32[h]; credentials.convID _ SunRPC.GetCard32[h]; credentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; credentials.stateID _ SunRPC.GetCard32[h]; }; { serviceID _ SunRPC.GetCard32[h]; }; [nb] _ Resume[h, shhh, credentials, serviceID]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; GetEnergiesCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; samplesPerSegment: CARD16; nb: ROPE; energies: EnergySequence; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { samplesPerSegment _ SunRPC.GetCard32[h]; }; [nb, energies] _ GetEnergies[h, shhh, vr, samplesPerSegment]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { MProc20[h, energies]; }; }; GetPermissionsCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; nb: ROPE; playAccess: Users; editAccess: Users; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; [nb, playAccess, editAccess] _ GetPermissions[h, shhh, vr]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { MProc21[h, playAccess]; }; { MProc21[h, editAccess]; }; }; LengthCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; nb: ROPE; len: INT32; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; [nb, len] _ Length[h, shhh, vr]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutInt32[h, len]; }; }; GetByInterestCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; class: ROPE; refID: ROPE; nb: ROPE; voiceRope: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { class _ SunRPC.GetRope[h]; }; { refID _ SunRPC.GetRope[h]; }; [nb, voiceRope] _ GetByInterest[h, shhh, class, refID]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, voiceRope.ropeID]; SunRPC.PutInt32[h, voiceRope.start]; SunRPC.PutInt32[h, voiceRope.length]; }; }; StoreBlockCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; block: VoiceBlock; key: ThrushSunRPC.Key; nb: ROPE; voiceRope: VoiceRope; { shhh _ SunRPC.GetCard32[h]; }; { block _ UProc22[h]; }; { FOR i23: CARDINAL IN [0..3) DO key[i23] _ SunRPC.GetCard32[h]; ENDLOOP; }; [nb, voiceRope] _ StoreBlock[h, shhh, block, key]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { SunRPC.PutRope[h, voiceRope.ropeID]; SunRPC.PutInt32[h, voiceRope.start]; SunRPC.PutInt32[h, voiceRope.length]; }; }; RetainCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; callerRName: ROPE; vr: VoiceRope; class: ROPE; refID: ROPE; other: ROPE; nb: ROPE; { shhh _ SunRPC.GetCard32[h]; }; { callerRName _ SunRPC.GetRope[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { class _ SunRPC.GetRope[h]; }; { refID _ SunRPC.GetRope[h]; }; { other _ SunRPC.GetRope[h]; }; [nb] _ Retain[h, shhh, callerRName, vr, class, refID, other]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; }; FetchBlockCaller: PROC [h: Handle, beginReturn: SunRPCBeginReturnProc] ~ { shhh: CARD32; vr: VoiceRope; start: INT32; len: INT32; decrypt: BOOLEAN; nb: ROPE; block: VoiceBlock; { shhh _ SunRPC.GetCard32[h]; }; { vr.ropeID _ SunRPC.GetRope[h]; vr.start _ SunRPC.GetInt32[h]; vr.length _ SunRPC.GetInt32[h]; }; { start _ SunRPC.GetInt32[h]; }; { len _ SunRPC.GetInt32[h]; }; { decrypt _ SunRPCGetBool[h]; }; [nb, block] _ FetchBlock[h, shhh, vr, start, len, decrypt]; beginReturn[h]; { SunRPC.PutRope[h, nb]; }; { MProc24[h, block]; }; }; SunRPCBeginReturnProc: TYPE ~ PROC [h: Handle]; Server: SunRPC.ServerProc ~ { <<[h: Handle, c: Conversation, proc: CARD, clientData: REF] RETURNS [doReply: BOOL, replyTimeToLive: CARDINAL]>> ENABLE { }; beginReturn: SunRPCBeginReturnProc ~ { SunRPC.StartReply[h]; <> <> <> }; doReply _ TRUE; replyTimeToLive _ 2; SELECT proc FROM 7 => ForgetCaller[h, beginReturn]; 2 => PlayCaller[h, beginReturn]; 1 => RecordCaller[h, beginReturn]; 9 => CatCaller[h, beginReturn]; 3 => StopCaller[h, beginReturn]; 10 => SubstrCaller[h, beginReturn]; 11 => ReplaceCaller[h, beginReturn]; 13 => DescribeRopeCaller[h, beginReturn]; 17 => SetPermissionsCaller[h, beginReturn]; 4 => PauseCaller[h, beginReturn]; 5 => ResumeCaller[h, beginReturn]; 14 => GetEnergiesCaller[h, beginReturn]; 18 => GetPermissionsCaller[h, beginReturn]; 12 => LengthCaller[h, beginReturn]; 8 => GetByInterestCaller[h, beginReturn]; 16 => StoreBlockCaller[h, beginReturn]; 6 => RetainCaller[h, beginReturn]; 15 => FetchBlockCaller[h, beginReturn]; ENDCASE => ERROR SunRPC.Error[$wrongProc]; <> < { NULL };>> }; <> SunRPCGetBool: PROC [h: SunRPC.Handle] RETURNS [BOOL] ~ INLINE { RETURN [SunRPC.GetCard32[h] # 0] }; SunRPCPutBool: PROC [h: SunRPC.Handle, bool: BOOL] ~ INLINE { SunRPC.PutCard32[h, IF bool THEN 1 ELSE 0] }; MProc21: PROC [h: Handle, val: Users] ~ { SunRPC.PutCard32[h, val.length]; FOR i25: CARDINAL IN [0..val.length) DO SunRPC.PutRope[h, val.body[i25]]; ENDLOOP; }; MProc18: PROC [h: Handle, val: IntervalSpecs] ~ { SunRPC.PutCard32[h, val.length]; FOR i26: CARDINAL IN [0..val.length) DO SunRPC.PutInt32[h, val.body[i26].start]; SunRPC.PutInt32[h, val.body[i26].length]; ENDLOOP; }; MProc20: PROC [h: Handle, val: EnergySequence] ~ { SunRPC.PutCard32[h, val.length]; FOR i27: CARDINAL IN [0..val.length) DO SunRPC.PutCard32[h, val.body[i27]]; ENDLOOP; }; MProc24: PROC [h: Handle, val: VoiceBlock] ~ { SunRPC.PutCard32[h, val.length]; FOR i28: CARDINAL IN [0..val.length) DO SunRPC.PutCard32[h, val.body[i28]]; ENDLOOP; }; UProc19: PROC [h: Handle] RETURNS [res: Users] ~ { { length30: CARDINAL ~ SunRPC.GetCard32[h]; res _ NEW[UsersObject[length30]]; FOR i29: CARDINAL IN [0..length30) DO res.body[i29] _ SunRPC.GetRope[h]; ENDLOOP; }; }; UProc22: PROC [h: Handle] RETURNS [res: VoiceBlock] ~ { { length32: CARDINAL ~ SunRPC.GetCard32[h]; res _ NEW[VoiceBlockObject[length32]]; FOR i31: CARDINAL IN [0..length32) DO res.body[i31] _ SunRPC.GetCard32[h]; ENDLOOP; }; }; <> sunPgm: CARD _ 390912; -- decimal program number sunPgmVersion: CARD _ 1; ExportInterface: PUBLIC PROC [port: CARD_0] RETURNS [uniquePort: CARD] ~ { uniquePort _ SRPCCalls.ExportSunRPCInterface[port, Server, sunPgm, sunPgmVersion]; }; }... <> <> <> <> <> <> <>