ThrushSunRPCConvertImpl.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
This module contains procedures for translating SunRPC data types to Thrush data types and Thrush data types to SunRPC data types.
Pier, May 24, 1990 2:05:24 pm PDT
Polle Zellweger (PTZ) December 2, 1990 6:45:05 pm PST
Swinehar, June 4, 1992 8:08 pm PDT
DIRECTORY
Atom USING [GetPName, MakeAtom],
BasicTime USING [ GMT ],
IV USING [KeyTableBody],
LoganBerry USING [ Attribute ],
RefID USING [ ID ],
Rope USING [ Equal, IsEmpty, ROPE ],
RPC USING [ InterfaceName, NetAddress, VersionRange ],
ThParty,
ThPartySunRPC,
Thrush,
ThrushSunRPC,
ThrushSunRPCConvert,
VoiceRopeServer,
VoiceRopeServerSunRPC
;
ThrushSunRPCConvertImpl: CEDAR PROGRAM
IMPORTS Atom, Rope, ThrushSunRPCConvert
EXPORTS ThrushSunRPCConvert
~ {
SrToAccessList: PUBLIC PROC [srAccessList: ThPartySunRPC.AccessList]
RETURNS [accessList: ThParty.AccessList¬NIL] ~ {
FOR i: CARDINAL DECREASING IN [0..srAccessList.length) DO
accessList ¬ CONS[SrToROPE[srAccessList[i]], accessList ];
ENDLOOP;
};
AccessListToSr: PUBLIC PROC [accessList: ThParty.AccessList]
RETURNS [srAccessList: ThPartySunRPC.AccessList] ~ {
count: CARDINAL ¬ 0;
FOR a: ThParty.AccessList ¬ accessList, a.rest WHILE a # NIL DO
count ¬ count + 1;
ENDLOOP;
srAccessList ¬ NEW[ThPartySunRPC.AccessListObject[count]];
count ¬ 0;
FOR a: ThParty.AccessList ¬ accessList, a.rest WHILE a # NIL DO
srAccessList[count] ¬ ROPEToSr[a.first];
count ¬ count + 1;
ENDLOOP;
};
SrToActionReport: PUBLIC PROC [srActionReport: ThrushSunRPC.ActionReport]
RETURNS [actionReport: Thrush.ActionReport] ~ {
actionReport.self ¬ SrToCredentials[srActionReport.self];
actionReport.other ¬ SrToCredentials[srActionReport.other];
actionReport.requestingParty ¬ srActionReport.requestingParty;
actionReport.actionID ¬ srActionReport.actionID;
actionReport.actionClass ¬ SrToATOM[srActionReport.actionClass];
actionReport.actionType ¬ SrToATOM[srActionReport.actionType];
actionReport.actionInfo ¬ SrToROPE[srActionReport.actionInfo];
};
ActionReportToSr: PUBLIC PROC [actionReport: Thrush.ActionReport]
RETURNS [srActionReport: ThrushSunRPC.ActionReport] ~ {
srActionReport.self ¬ CredentialsToSr[actionReport.self];
srActionReport.other ¬ CredentialsToSr[actionReport.other];
srActionReport.requestingParty ¬ actionReport.requestingParty;
srActionReport.actionID ¬ actionReport.actionID;
srActionReport.actionClass ¬ ATOMToSr[actionReport.actionClass];
srActionReport.actionType ¬ ATOMToSr[actionReport.actionType];
srActionReport.actionInfo ¬ ROPEToSr[actionReport.actionInfo];
};
SrToAddress: PUBLIC PROC [srAddress: ThrushSunRPC.Address]
RETURNS [address: Thrush.NetAddress] ~ {
address.net ¬ [srAddress.net.net];
address.host ¬ [srAddress.host.host];
address.socket.a ¬ srAddress.socket.a;
address.socket.b ¬ srAddress.socket.b;
address.socket.c ¬ srAddress.socket.c;
address.socket.d ¬ srAddress.socket.d;
};
AddressToSr: PUBLIC PROC [address: RPC.NetAddress] RETURNS [srAddress:
ThrushSunRPC.Address] ~ {
srAddress.net.net ¬ address.net; -- remove records from Thrush.cr def?
srAddress.host.host ¬ address.host;
srAddress.socket.a ¬ address.socket.a;
srAddress.socket.b ¬ address.socket.b;
srAddress.socket.c ¬ address.socket.c;
srAddress.socket.d ¬ address.socket.d;
};
SrToATOM: PUBLIC PROC [srAtom: Rope.ROPE]
RETURNS [atom: ATOM] ~ {
atom ¬ IF Rope.IsEmpty[srAtom] THEN NIL ELSE Atom.MakeAtom[srAtom];
};
ATOMToSr: PUBLIC PROC [atom: ATOM] RETURNS [srAtom: Rope.ROPE] ~ {
srAtom ¬ IF atom=NIL THEN NIL ELSE Atom.GetPName[atom];
};
SrToAttributes: PUBLIC PROC [srAttributes: ThPartySunRPC.Attributes]
RETURNS [attributes: ThParty.Attributes¬NIL] ~ {
FOR i: CARDINAL DECREASING IN [0..srAttributes.length) DO
attr: LoganBerry.Attribute ¬ [SrToATOM[srAttributes[i].type], srAttributes[i].value];
attributes ¬ CONS[attr, attributes];
ENDLOOP;
};
AttributesToSr: PUBLIC PROC [attributes: ThParty.Attributes]
RETURNS [srAttributes: ThPartySunRPC.Attributes] ~ {
count: CARDINAL ¬ 0;
FOR a: ThParty.Attributes ¬ attributes, a.rest WHILE a # NIL DO
count ¬ count + 1;
ENDLOOP;
srAttributes ¬ NEW[ThPartySunRPC.EntryObject[count]];
count ¬ 0;
FOR a: ThParty.Attributes ¬ attributes, a.rest WHILE a # NIL DO
srAttributes[count].type ¬ ATOMToSr[a.first.type];
srAttributes[count].value ¬ a.first.value;
count ¬ count + 1;
ENDLOOP;
};
SrToCandidateList: PUBLIC PROC [srCandidates: ThPartySunRPC.CandidateList]
RETURNS [candidates: LIST OF ThParty.ConversationInfo¬NIL] ~ {
FOR i: CARDINAL DECREASING IN [0..srCandidates.length) DO
cInfo: ThParty.ConversationInfo ¬ SrToConversationInfo[srCandidates[i]];
candidates ¬ CONS[cInfo, candidates];
ENDLOOP;
};
CandidateListToSr: PUBLIC PROC [candidates: LIST OF ThParty.ConversationInfo]
RETURNS [srCandidates: ThPartySunRPC.CandidateList] ~ {
count: CARDINAL ¬ 0;
FOR a: LIST OF ThParty.ConversationInfo ¬ candidates, a.rest WHILE a # NIL DO
count ¬ count + 1;
ENDLOOP;
srCandidates ¬ NEW[ThPartySunRPC.CandidateListObject[count]];
count ¬ 0;
FOR a: LIST OF ThParty.ConversationInfo ¬ candidates, a.rest WHILE a # NIL DO
srCandidates[count] ¬ ConversationInfoToSr[a.first];
count ¬ count + 1;
ENDLOOP;
};
SrToConvEvent: PUBLIC PROC [srConvEvent: ThrushSunRPC.ConvEvent]
RETURNS [convEvent: Thrush.ConvEvent¬NIL] ~ {
IF srConvEvent.reason = ATOMToSr[$sunRPCContainerReallyNIL] THEN RETURN;
convEvent ¬ NEW[Thrush.ConvEventBody ¬ [
self: SrToCredentials[srConvEvent.self],
other: SrToCredentials[srConvEvent.other],
time: ThrushSunRPCConvert.SrToGMT[srConvEvent.time],
reason: SrToATOM[srConvEvent.reason],
comment: SrToROPE[srConvEvent.comment] ]
];
};
ConvEventToSr: PUBLIC PROC [convEvent: Thrush.ConvEvent]
RETURNS [srConvEvent: ThrushSunRPC.ConvEvent] ~ {
IF convEvent=NIL THEN
convEvent ¬ NEW[Thrush.ConvEventBody ¬ [reason: $sunRPCContainerReallyNIL]];
srConvEvent ¬ [
self: CredentialsToSr[convEvent.self],
other: CredentialsToSr[convEvent.other],
time: ThrushSunRPCConvert.GMTToSr[convEvent.time],
reason: ATOMToSr[convEvent.reason],
comment: ROPEToSr[convEvent.comment]
];
};
SrToConversationInfo: PUBLIC PROC [srCInfo: ThPartySunRPC.ConversationInfo]
RETURNS [cInfo: ThParty.ConversationInfo¬NIL] ~ {
IF srCInfo.convType = sunRPCContainerReallyNIL THEN RETURN;
cInfo ¬ NEW[ThParty.ConversationInfoRec ¬ SrToConversationInfoRec[srCInfo]];
};
ConversationInfoToSr: PUBLIC PROC [cInfo: ThParty.ConversationInfo]
RETURNS [srCInfo: ThPartySunRPC.ConversationInfo] ~ {
IF cInfo=NIL THEN cInfo ¬ NEW[ThParty.ConversationInfoRec];
srCInfo ¬ ConversationInfoRecToSr[cInfo­];
IF cInfo=NIL THEN srCInfo.convType ¬ sunRPCContainerReallyNIL;
};
SrToConversationInfoRec: PUBLIC PROC [srCInfo: ThPartySunRPC.ConversationInfo]
RETURNS [cInfoRec: ThParty.ConversationInfoRec] ~ {
cInfoRec ¬ [
convID: ThrushSunRPCConvert.SrToConvID[srCInfo.convID],
numParties: srCInfo.numParties,
numActive: srCInfo.numActive,
numIdle: srCInfo.numIdle,
originator: srCInfo.originator,
conferenceHost: SrToAddress[srCInfo.conferenceHost],
convType: ThrushSunRPCConvert.SrToConvType[srCInfo.convType],
bilateralConv: srCInfo.bilateralConv,
startTime: ThrushSunRPCConvert.SrToGMT[srCInfo.startTime],
convAttributes: SrToAttributes[srCInfo.convAttributes],
moderator: srCInfo.moderator,
commentator: srCInfo.commentator
];
};
ConversationInfoRecToSr: PUBLIC PROC [cInfoRec: ThParty.ConversationInfoRec]
RETURNS [srCInfo: ThPartySunRPC.ConversationInfo] ~ {
srCInfo ¬ [
convID: ThrushSunRPCConvert.ConvIDToSr[cInfoRec.convID],
numParties: cInfoRec.numParties,
numActive: cInfoRec.numActive,
numIdle: cInfoRec.numIdle,
originator: cInfoRec.originator,
conferenceHost: AddressToSr[cInfoRec.conferenceHost],
convType: ThrushSunRPCConvert.ConvTypeToSr[cInfoRec.convType],
bilateralConv: cInfoRec.bilateralConv,
startTime: ThrushSunRPCConvert.GMTToSr[cInfoRec.startTime],
convAttributes: AttributesToSr[cInfoRec.convAttributes],
moderator: cInfoRec.moderator,
commentator: cInfoRec.commentator
];
};
SrToCredentials: PUBLIC PROC [srCredentials: ThrushSunRPC.Credentials]
RETURNS [credentials: Thrush.Credentials] ~ {
credentials ¬ [
partyID: srCredentials.partyID,
smartsID: srCredentials.smartsID,
convID:
ThrushSunRPCConvert.SrToConvID[srCredentials.convID],
state: ThrushSunRPCConvert.SrToState[srCredentials.state],
stateID: NAT[srCredentials.stateID]
];
};
CredentialsToSr: PUBLIC PROC [credentials: Thrush.Credentials]
RETURNS [srCredentials: ThrushSunRPC.Credentials] ~ {
srCredentials ¬ [
partyID: credentials.partyID,
smartsID: credentials.smartsID,
convID: ThrushSunRPCConvert.ConvIDToSr[credentials.convID],
state: ThrushSunRPCConvert.StateToSr[credentials.state],
stateID: credentials.stateID
];
};
SrToEnergySequence: PUBLIC PROC [srEnergySequence: VoiceRopeServerSunRPC.EnergySequence]
RETURNS [energySequence: VoiceRopeServer.EnergySequence¬NIL] ~ {
IF srEnergySequence.length=0 THEN RETURN;
energySequence ¬ NEW[VoiceRopeServer.EnergySequenceRec[srEnergySequence.length]];
FOR i: CARDINAL DECREASING IN [0..srEnergySequence.length) DO
energySequence[i] ¬ srEnergySequence[i];
ENDLOOP;
};
EnergySequenceToSr: PUBLIC PROC [energySequence: VoiceRopeServer.EnergySequence]
RETURNS [srEnergySequence: VoiceRopeServerSunRPC.EnergySequence] ~ {
length: CARDINAL ¬ IF energySequence=NIL THEN 0 ELSE energySequence.length;
srEnergySequence ¬ NEW[VoiceRopeServerSunRPC.EnergySequenceObject[length]];
FOR i: CARDINAL DECREASING IN [0..length) DO
srEnergySequence[i] ¬ energySequence[i];
ENDLOOP;
};
SrToInterfaceName: PUBLIC PROC [srInterface: ThrushSunRPC.InterfaceName]
RETURNS [interface: RPC.InterfaceName] ~ {
interface.type ¬ srInterface.type;
interface.instance ¬ srInterface.instance;
interface.version ¬ SrToVersionRange[srInterface.version];
};
InterfaceNameToSr: PUBLIC PROC [interface: RPC.InterfaceName]
RETURNS [srInterface: ThrushSunRPC.InterfaceName] ~ {
srInterface.type ¬ interface.type;
srInterface.instance ¬ interface.instance;
srInterface.version ¬ VersionRangeToSr[interface.version];
};
SrToInterfaceSpec: PUBLIC PROC [srInterfaceSpec: ThrushSunRPC.InterfaceSpec]
RETURNS [interfaceSpec: Thrush.InterfaceSpec] ~ {
interfaceSpec.interfaceName ¬ SrToInterfaceName[srInterfaceSpec.interfaceName];
interfaceSpec.hostHint ¬ SrToAddress[srInterfaceSpec.hostHint];
interfaceSpec.serviceID ¬ srInterfaceSpec.serviceID;
interfaceSpec.interfaceID ¬ srInterfaceSpec.interfaceID;
};
InterfaceSpecToSr: PUBLIC PROC [interfaceSpec: Thrush.InterfaceSpec]
RETURNS [srInterfaceSpec: ThrushSunRPC.InterfaceSpec] ~ {
srInterfaceSpec.interfaceName ¬ InterfaceNameToSr[interfaceSpec.interfaceName];
srInterfaceSpec.hostHint ¬ AddressToSr[interfaceSpec.hostHint];
srInterfaceSpec.serviceID ¬ interfaceSpec.serviceID;
srInterfaceSpec.interfaceID ¬ interfaceSpec.interfaceID;
};
SrToIntervalSpecs: PUBLIC PROC [srIntervalSpecs: VoiceRopeServerSunRPC.IntervalSpecs]
RETURNS [intervalSpecs: VoiceRopeServer.IntervalSpecs¬NIL] ~ {
SrToInterval: PROC [sri: VoiceRopeServerSunRPC.Interval] RETURNS
[vri: VoiceRopeServer.Interval] ~ {
vri.start ¬ sri.start;
vri.length ¬ sri.length;
};
FOR i: CARDINAL DECREASING IN [0..srIntervalSpecs.length) DO
intervalSpecs ¬ CONS[SrToInterval[srIntervalSpecs[i]], intervalSpecs];
ENDLOOP;
};
IntervalSpecsToSr: PUBLIC PROC [intervalSpecs: VoiceRopeServer.IntervalSpecs]
RETURNS [srIntervalSpecs: VoiceRopeServerSunRPC.IntervalSpecs] ~ {
IntervalToSr: PROC [vri: VoiceRopeServer.Interval] RETURNS [sri:
VoiceRopeServerSunRPC.Interval] ~ {
sri.start ¬ vri.start;
sri.length ¬ vri.length;
};
count: CARDINAL ¬ 0;
FOR a: VoiceRopeServer.IntervalSpecs ¬ intervalSpecs, a.rest WHILE a # NIL DO
count ¬ count + 1;
ENDLOOP;
srIntervalSpecs ¬ NEW[VoiceRopeServerSunRPC.IntervalSpecsObject[count]];
count ¬ 0;
FOR a: VoiceRopeServer.IntervalSpecs ¬ intervalSpecs, a.rest WHILE a # NIL DO
srIntervalSpecs[count] ¬ IntervalToSr[a.first];
count ¬ count + 1;
ENDLOOP;
};
SrToKeyTable: PUBLIC PROC [srKeyTable: ThrushSunRPC.KeyTable]
RETURNS [keyTable: Thrush.KeyTable¬NIL] ~ {
IF srKeyTable.s.length=0 THEN RETURN;
keyTable ¬ NEW[ IV.KeyTableBody[srKeyTable.s.length] ];
FOR i: CARDINAL DECREASING IN [0..keyTable.size) DO
keyTable[i] ¬ ThrushSunRPCConvert.SrToEncryptionKey[srKeyTable.s[i] ];
ENDLOOP;
};
KeyTableToSr: PUBLIC PROC [keyTable: Thrush.KeyTable]
RETURNS [srKeyTable: ThrushSunRPC.KeyTable] ~ {
size: CARDINAL ¬ IF keyTable=NIL THEN 0 ELSE keyTable.size;
srKeyTable.s ¬ NEW[ ThrushSunRPC.KeysObject[size] ];
FOR i: CARDINAL DECREASING IN [0..size) DO
srKeyTable.s[i] ¬ ThrushSunRPCConvert.EncryptionKeyToSr[keyTable[i] ];
ENDLOOP;
};
SrToPartyInfo: PUBLIC PROC [srPInfo: ThPartySunRPC.PartyInfo]
RETURNS [pInfo: ThParty.PartyInfo¬NIL] ~ {
IF srPInfo.conversationInfo.convType = sunRPCContainerReallyNIL THEN RETURN;
pInfo ¬ NEW[ ThParty.PartyInfoSeq[srPInfo.parties.length] ];
pInfo.numParties ¬ NAT[srPInfo.numParties];
pInfo.conversationInfo ¬ SrToConversationInfoRec[srPInfo.conversationInfo];
pInfo.ixSelf ¬ NAT[srPInfo.ixSelf];
pInfo.ixOther ¬ NAT[srPInfo.ixOther];
pInfo.ixModerator ¬ NAT[srPInfo.ixModerator];
pInfo.ixCommentator ¬ NAT[srPInfo.ixCommentator];
pInfo.ixCommSock ¬ NAT[srPInfo.ixCommSock];
pInfo.ixOriginator ¬ NAT[srPInfo.ixOriginator];
FOR i: NAT DECREASING IN [0..srPInfo.parties.length) DO
pInfo.parties[i] ¬ SrToPartyInfoSpec[srPInfo.parties[i]];
ENDLOOP;
};
PartyInfoToSr: PUBLIC PROC [pInfo: ThParty.PartyInfo]
RETURNS [srPInfo: ThPartySunRPC.PartyInfo] ~ {
IF pInfo=NIL THEN pInfo ¬ NEW[ThParty.PartyInfoSeq[0]];
srPInfo.numParties ¬ pInfo.numParties;
srPInfo.conversationInfo ¬ ConversationInfoRecToSr[pInfo.conversationInfo];
srPInfo.ixSelf ¬ pInfo.ixSelf;
srPInfo.ixOther ¬ pInfo.ixOther;
srPInfo.ixModerator ¬ pInfo.ixModerator;
srPInfo.ixCommentator ¬ pInfo.ixCommentator;
srPInfo.ixCommSock ¬ pInfo.ixCommSock;
srPInfo.ixOriginator ¬ pInfo.ixOriginator;
srPInfo.parties ¬ NEW[ThPartySunRPC.PartyListObject[pInfo.len]];
FOR i: CARDINAL IN [0..pInfo.len) DO
srPInfo.parties[i] ¬ PartyInfoSpecToSr[ pInfo.parties[i] ];
ENDLOOP;
IF pInfo=NIL THEN srPInfo.conversationInfo.convType ¬ sunRPCContainerReallyNIL;
};
SrToPartyInfoSpec: PUBLIC PROC [srPartySpec: ThPartySunRPC.PartyInfoSpec]
RETURNS [partySpec: ThParty.PartyInfoSpec] ~ {
partySpec.partyID ¬ srPartySpec.partyID;
partySpec.name ¬ SrToROPE[srPartySpec.name];
partySpec.intendedPartyID ¬ srPartySpec.intendedPartyID;
partySpec.intendedName ¬ SrToROPE[srPartySpec.intendedName];
partySpec.type ¬ SrToATOM[srPartySpec.type];
partySpec.state ¬ ThrushSunRPCConvert.SrToState[srPartySpec.state];
partySpec.numConvs ¬ srPartySpec.numConvs;
partySpec.enabled ¬ srPartySpec.enabled;
partySpec.voicePath ¬ srPartySpec.voicePath;
partySpec.partyActive ¬ srPartySpec.partyActive;
partySpec.partyEngaged ¬ srPartySpec.partyEngaged;
partySpec.socket ¬ SrToAddress[srPartySpec.socket];
partySpec.partyAttributes ¬ SrToAttributes[srPartySpec.partyAttributes];
};
PartyInfoSpecToSr: PUBLIC PROC [partySpec: ThParty.PartyInfoSpec]
RETURNS [srPartySpec: ThPartySunRPC.PartyInfoSpec] ~ {
srPartySpec.partyID ¬ partySpec.partyID;
srPartySpec.name ¬ ROPEToSr[partySpec.name];
srPartySpec.intendedPartyID ¬ partySpec.intendedPartyID;
srPartySpec.intendedName ¬ ROPEToSr[partySpec.intendedName];
srPartySpec.type ¬ ATOMToSr[partySpec.type];
srPartySpec.state ¬ ThrushSunRPCConvert.StateToSr[partySpec.state];
srPartySpec.numConvs ¬ partySpec.numConvs;
srPartySpec.enabled ¬ partySpec.enabled;
srPartySpec.voicePath ¬ partySpec.voicePath;
srPartySpec.partyActive ¬ partySpec.partyActive;
srPartySpec.partyEngaged ¬ partySpec.partyEngaged;
srPartySpec.socket ¬ AddressToSr[partySpec.socket];
srPartySpec.partyAttributes ¬ AttributesToSr[partySpec.partyAttributes];
};
SrToROPE: PUBLIC PROC [srRope: Rope.ROPE]
RETURNS [rope: Rope.ROPE] ~ {
rope ¬ IF Rope.Equal[srRope, "sunRPCRopeReallyNIL"] THEN NIL ELSE srRope;
};
ROPEToSr: PUBLIC PROC [rope: Rope.ROPE]
RETURNS [srRope: Rope.ROPE] ~ {
srRope ¬ IF rope=NIL THEN "sunRPCRopeReallyNIL" ELSE rope;
};
SrToSmartsProperties: PUBLIC PROC [srProperties: ThPartySunRPC.SmartsProperties]
RETURNS [properties: ThParty.SmartsProperties] ~ {
properties.role ¬ SrToATOM[srProperties.role];
properties.netAddress ¬ SrToAddress[srProperties.netAddress];
};
SmartsPropertiesToSr: PUBLIC PROC [properties: ThParty.SmartsProperties]
RETURNS [srProperties: ThPartySunRPC.SmartsProperties] ~ {
srProperties.role ¬ ATOMToSr[properties.role];
srProperties.netAddress ¬ AddressToSr[properties.netAddress];
};
SrToUsers: PUBLIC PROC [srUsers: VoiceRopeServerSunRPC.Users]
RETURNS [users: VoiceRopeServer.Users¬NIL] ~ {
FOR i: CARDINAL DECREASING IN [0..srUsers.length) DO
users ¬ CONS[SrToROPE[srUsers[i]], users];
ENDLOOP;
};
UsersToSr: PUBLIC PROC [users: VoiceRopeServer.Users]
RETURNS [srUsers: VoiceRopeServerSunRPC.Users] ~ {
count: CARDINAL ¬ 0;
FOR u: VoiceRopeServer.Users ¬ users, u.rest WHILE u # NIL DO
count ¬ count + 1;
ENDLOOP;
srUsers ¬ NEW[VoiceRopeServerSunRPC.UsersObject[count]];
count ¬ 0;
FOR u: VoiceRopeServer.Users ¬ users, u.rest WHILE u # NIL DO
srUsers[count] ¬ ROPEToSr[u.first];
count ¬ count + 1;
ENDLOOP;
};
SrToVersionRange: PUBLIC PROC [srVersion: ThrushSunRPC.VersionRange]
RETURNS [version: RPC.VersionRange] ~ {
version.first ¬ srVersion.first;
version.last ¬ srVersion.last;
};
VersionRangeToSr: PUBLIC PROC [version: RPC.VersionRange]
RETURNS [srVersion: ThrushSunRPC.VersionRange] ~ {
srVersion.first ¬ version.first;
srVersion.last ¬ version.last;
};
SrToVisitorList: PUBLIC PROC [srVisitorList: ThPartySunRPC.VisitorList]
RETURNS [visitorList: LIST OF Thrush.PartyID¬NIL] ~ {
FOR i: CARDINAL DECREASING IN [0..srVisitorList.length) DO
partyID: Thrush.PartyID ¬ srVisitorList[i];
visitorList ¬ CONS[partyID, visitorList];
ENDLOOP;
};
VisitorListToSr: PUBLIC PROC [visitorList: LIST OF Thrush.PartyID]
RETURNS [srVisitorList: ThPartySunRPC.VisitorList] ~ {
count: CARDINAL ¬ 0;
FOR a: LIST OF Thrush.PartyID ¬ visitorList, a.rest WHILE a # NIL DO
count ¬ count + 1;
ENDLOOP;
srVisitorList ¬ NEW[ThPartySunRPC.VisitorListObject[count]];
count ¬ 0;
FOR a: LIST OF Thrush.PartyID ¬ visitorList, a.rest WHILE a # NIL DO
srVisitorList[count] ¬ a.first;
count ¬ count + 1;
ENDLOOP;
};
SrToVoiceBlock: PUBLIC PROC [srVoiceBlock: VoiceRopeServerSunRPC.VoiceBlock]
RETURNS [voiceBlock: VoiceRopeServer.VoiceBlock] ~ {
IF srVoiceBlock.length=0 THEN RETURN;
voiceBlock ¬ NEW[VoiceRopeServer.VoiceBlockRec[srVoiceBlock.length]];
FOR i: CARDINAL DECREASING IN [0..srVoiceBlock.length) DO
voiceBlock[i] ¬ srVoiceBlock[i];
ENDLOOP;
};
VoiceBlockToSr: PUBLIC PROC [voiceBlock: VoiceRopeServer.VoiceBlock]
RETURNS [srVoiceBlock: VoiceRopeServerSunRPC.VoiceBlock] ~ {
length: CARDINAL ¬ IF voiceBlock=NIL THEN 0 ELSE voiceBlock.length;
srVoiceBlock ¬ NEW[VoiceRopeServerSunRPC.VoiceBlockObject[length]];
FOR i: CARDINAL DECREASING IN [0..length) DO
srVoiceBlock[i] ¬ voiceBlock[i];
ENDLOOP;
};
SrToVoiceRope: PUBLIC PROC [srVoiceRope: VoiceRopeServerSunRPC.VoiceRope]
RETURNS [voiceRope: VoiceRopeServer.VoiceRope¬NIL] ~ {
IF Rope.Equal[srVoiceRope.ropeID, "sunRPCContainerReallyNIL"] THEN RETURN;
voiceRope ¬ NEW[VoiceRopeServer.VoiceRopeInterval];
voiceRope.ropeID ¬ SrToROPE[srVoiceRope.ropeID];
voiceRope.start ¬ srVoiceRope.start;
voiceRope.length ¬ srVoiceRope.length;
};
VoiceRopeToSr: PUBLIC PROC [voiceRope: VoiceRopeServer.VoiceRope]
RETURNS [srVoiceRope: VoiceRopeServerSunRPC.VoiceRope] ~ {
IF voiceRope=NIL THEN voiceRope ¬ NEW[VoiceRopeServer.VoiceRopeInterval ¬ [
ropeID: "sunRPCContainerReallyNIL", start: 0, length: -1] ];
srVoiceRope.ropeID ¬ ROPEToSr[voiceRope.ropeID];
srVoiceRope.start ¬ voiceRope.start;
srVoiceRope.length ¬ voiceRope.length;
};
}.
Polle Zellweger (PTZ) May 14, 1990 6:03:26 pm PDT
Atom.GetPName couldn't handle NIL, so make a new conversion routine.
new: SrToATOM, ATOMToSr
changes to: DIRECTORY, SrToAccessList, SrToActionReport, ActionReportToSr, SrToAttributes, AttributesToSr, SrToConvEvent, ConvEventToSr, SrToPartyInfoSpec, PartyInfoSpecToSr, SrToSmartsProperties, SmartsPropertiesToSr
Polle Zellweger (PTZ) May 27, 1990 5:06:21 pm PDT
changes to: ATOMToSr, SrToPartyInfo, DIRECTORY
Polle Zellweger (PTZ) May 27, 1990 4:56:57 pm PDT
SunRPC can't marshal NIL, so fill in each REF going toward the wire with a distinguishable instance of its type that means NIL (values are called sunRPCContainerReallyNIL in some flavor). Similarly, detect these values going away from the wire and turn them back into NIL. Note that ropes are not explicitly caught - NIL ropes turn into "".
Polle Zellweger (PTZ) October 29, 1990 3:26:40 pm PST
Fix NIL ropes too, via sunRPCRopeReallyNIL value.
new: ROPEToSr, SrToROPE
changes to: AccessListToSr, SrToAccessList, PartyInfoSpecToSr, SrToPartyInfoSpec, UsersToSr, SrToUsers, SrToVoiceRope, VoiceRopeToSr