GrapevineUser: Client access to the R-Server database
GVNames.mesa
Andrew Birrell June 22, 1983 5:58 pm
DIRECTORY
GVBasics USING[ Connect, GVString, oldestTime, Password, MakeKey, Remark, RName, Timestamp ],
Rope USING[ ROPE ];
GVNames:
CEDAR
DEFINITIONS
IMPORTS GVBasics =
BEGIN
Outcome:
TYPE = {
-- possible outcomes of RS operations --
noChange, -- updates and timestamped enquiries --
group, individual, notFound, -- any --
protocolError, wrongServer, allDown, -- any --
badPwd, -- authentication and updates --
outOfDate, notAllowed -- updates --
};
NameType: TYPE = Outcome[noChange..badPwd]; -- outcomes for enquiries --
-- "RLists" are sequences of R-Names returned from the server --
RListHandle: TYPE = LIST OF GVBasics.RName;
"Expand" returns mailbox site names for individuals, membership list
for groups. If the old stamp is still current, returns "noChange". Will
-- not return "noChange" if the old stamp is defaulted. --
ExpandInfo:
TYPE =
RECORD[
SELECT type: NameType[noChange..allDown]
FROM
noChange => NULL,
group => [ members: RListHandle,
stamp: GVBasics.Timestamp,
count: INT ],
individual => [ sites: RListHandle,
stamp: GVBasics.Timestamp,
count: INT ],
notFound => NULL,
protocolError => NULL,
wrongServer => NULL,
allDown => NULL,
ENDCASE ];
Expand:
PROC[name: GVBasics.RName, oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime]
RETURNS[ ExpandInfo ];
"GetMembers" returns the membership list for a group. If the old stamp
is still current, returns "noChange". Will not return "noChange" if
-- the old stamp is defaulted. --
MemberInfo:
TYPE =
RECORD[
SELECT type: NameType[noChange..allDown]
FROM
noChange => NULL,
group => [ members: RListHandle,
stamp: GVBasics.Timestamp,
count: INT ],
individual => NULL,
notFound => NULL,
protocolError => NULL,
wrongServer => NULL,
allDown => NULL,
ENDCASE ];
GetMembers:
PROC[name: GVBasics.RName,
oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime]
RETURNS[ MemberInfo ] = INLINE
{ RETURN[ GetList[name, oldStamp, members] ] };
GetOwners:
PROC[name: GVBasics.RName,
oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime]
RETURNS[ MemberInfo ] = INLINE
{ RETURN[ GetList[name, oldStamp, owners] ] };
GetFriends:
PROC[name: GVBasics.RName,
oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime]
RETURNS[ MemberInfo ] = INLINE
{ RETURN[ GetList[name, oldStamp, friends] ] };
GetList:
PROC[name: GVBasics.RName, oldStamp: GVBasics.Timestamp, list: ListType, reporter: ReporterProc ←
NIL]
RETURNS[MemberInfo];
"CheckStamp" performs basic name validation, also telling the caller the name type. If the old stamp is still current, returns "noChange". Will not return "noChange" if the old stamp is defaulted.
StampInfo: TYPE = NameType[noChange..allDown];
CheckStamp:
PROC[name: GVBasics.RName, oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime]
RETURNS[ StampInfo ];
"GetConnect" returns the connect-site for an individual. The connect-site is either an NLS name or a net-address.
ConnectInfo: TYPE = NameType[group..allDown];
GetConnect:
PROC[name: GVBasics.RName]
RETURNS[ info: ConnectInfo, connect: GVBasics.Connect ];
"GetRemark" returns the remark for a group. The remark is a human readable string..
RemarkInfo: TYPE = NameType[group..allDown];
GetRemark:
PROC[name: GVBasics.RName]
RETURNS[ info: RemarkInfo, remark: GVBasics.Remark ];
"GetEntry" is mainly for use by Maintain. It returns the entire contents of a database entry. Consult a wizard before using GetEntry
GetEntryInfo:
TYPE =
RECORD[
name: GVBasics.RName,
stamp: GVBasics.Timestamp,
body:
SELECT type: *
FROM
group => [
remark: GVBasics.Remark,
remarkStamp: GVBasics.Timestamp,
members: GetEntryList,
owners: GetEntryList,
friends: GetEntryList],
individual => [
password: GVBasics.Password,
passwordStamp: GVBasics.Timestamp,
connect: GVBasics.Connect,
connectStamp: GVBasics.Timestamp,
forward: GetEntryList,
sites: GetEntryList],
notFound => NULL,
dead => NULL,
ENDCASE ];
GetEntryList:
TYPE =
RECORD[
current: RListHandle,
currentStamps: LIST OF GVBasics.Timestamp,
deleted: RListHandle,
deletedStamps: LIST OF GVBasics.Timestamp];
GetEntry:
PRIVATE PROC[name: GVBasics.RName, reporter: ReporterProc ←
NIL]
RETURNS[rc: NameType[group..allDown], info:
REF GetEntryInfo];
"Authenticate" checks a user name and password.
AuthenticateInfo: TYPE = NameType[group..badPwd];
Authenticate:
PROC[name: GVBasics.RName, password: Rope.
ROPE]
RETURNS[ AuthenticateInfo ] = INLINE
{ RETURN[ AuthenticateKey[name, GVBasics.MakeKey[password]] ] };
AuthenticateKey:
PROC[name: GVBasics.RName, key: GVBasics.Password]
RETURNS[ AuthenticateInfo ];
Access control primitives
Membership: TYPE = { yes, no, notGroup, allDown };
IsMemberDirect:
PROC[name: GVBasics.RName, member: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, member, direct, self, members]] };
IsOwnerDirect:
PROC[name: GVBasics.RName, owner: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, owner, direct, self, owners]] };
IsFriendDirect:
PROC[name: GVBasics.RName, friend: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, friend, direct, self, friends]] };
IsMemberClosure:
PROC[name: GVBasics.RName, member: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, member, closure, self, members]] };
IsOwnerClosure:
PROC[name: GVBasics.RName, owner: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, owner, closure, self, owners]] };
IsFriendClosure:
PROC[name: GVBasics.RName, friend: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, friend, closure, self, friends]] };
IsMemberUpArrow:
PROC[name: GVBasics.RName, member: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, member, upArrow, self, members]] };
IsOwnerUpArrow:
PROC[name: GVBasics.RName, owner: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, owner, upArrow, self, owners]] };
IsFriendUpArrow:
PROC[name: GVBasics.RName, friend: GVBasics.RName]
RETURNS[ Membership ] = INLINE
{ RETURN[IsInList[name, friend, upArrow, self, friends]] };
MembershipLevel: TYPE = MACHINE DEPENDENT { direct(0), closure(1), upArrow(2) };
MembershipGrade: TYPE = MACHINE DEPENDENT { self(0), registry(1) };
ListType: TYPE = MACHINE DEPENDENT { members(0), owners(1), friends(2) };
IsInList:
PROC[name: GVBasics.RName, member: GVBasics.RName,
level: MembershipLevel, grade: MembershipGrade, acl: ListType]
RETURNS[Membership];
Updates
Creation and Deletion
CreateIndividual:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, newPwd: GVBasics.Password ]
RETURNS[Outcome] = INLINE
{ RETURN[ Update[user, password, CreateIndividual, individual, NIL, newPwd] ] };
DeleteIndividual:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteIndividual, individual] ] };
CreateGroup:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, CreateGroup, group] ] };
DeleteGroup:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteGroup, group] ] };
Updates to single-valued components
SetPassword:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, newPwd: GVBasics.Password]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, ChangePassword, individual, NIL, newPwd] ] };
SetConnect:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, connect: GVBasics.Connect]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, ChangeConnect, individual, connect] ] };
SetRemark:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, remark: GVBasics.Remark]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, ChangeRemark, group, remark] ] };
Adding to list-valued components
AddMailbox:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, site: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, AddMailBox, individual, site] ] };
AddForward:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, dest: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, AddForward, individual, dest] ] };
AddMember:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, member: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, AddMember, group, member] ] };
AddOwner:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, owner: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, AddOwner, group, owner] ] };
AddFriend:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, friend: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, AddFriend, group, friend] ] };
-- Removing from list-valued components --
RemoveMailbox:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, site: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteMailBox, individual, site] ] };
RemoveForward:
PROC[user: GVBasics.RName, password: GVBasics.Password, individual: GVBasics.RName, dest: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteForward, individual, dest] ] };
RemoveMember:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, member: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteMember, group, member] ] };
RemoveOwner:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, owner: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteOwner, group, owner] ] };
RemoveFriend:
PROC[user: GVBasics.RName, password: GVBasics.Password, group: GVBasics.RName, friend: GVBasics.RName]
RETURNS[Outcome] =
INLINE
{ RETURN[ Update[user, password, DeleteFriend, group, friend] ] };
Update:
PROC[
user: GVBasics.RName,
password: GVBasics.Password,
op: RSOperation,
target: GVBasics.RName,
value: GVBasics.GVString ← NIL,
newPwd: GVBasics.Password ← NULL,
reporter: ReporterProc ← NIL]
RETURNS[Outcome];
RSOperation:
TYPE =
MACHINE
DEPENDENT {
NoOp(0),
Enquiries (also 60..69)
Expand(1),
ReadMembers(2),
ReadOwners(3),
ReadFriends(4),
ReadEntry(5),
CheckStamp(6),
ReadConnect(7),
ReadRemark(8),
Authenticate(9),
Updates
CreateRegistry(10), -- not implemented
DeleteRegistry(11), -- not implemented
CreateIndividual(12),
DeleteIndividual(13),
CreateGroup(14),
DeleteGroup(15),
ChangePassword(16),
ChangeConnect(17),
ChangeRemark(18),
AddMember(19),
AddMailBox(20),
AddForward(21),
AddOwner(22),
AddFriend(23),
DeleteMember(24),
DeleteMailBox(25),
DeleteForward(26),
DeleteOwner(27),
DeleteFriend(28),
AddSelf(29),
DeleteSelf(30),
AddListOfMembers(31),
NewName(32),
IdentifyCaller(33),--internal to GVNamesImpl
IsMemberDirect(40), -- archaic
IsOwnerDirect(41), -- archaic
IsFriendDirect(42), -- archaic
IsMemberClosure(43), -- archaic
IsOwnerClosure(44), -- archaic
IsFriendClosure(45), -- archaic
IsInList(46),
60..69 reserved for more enquiries
ReadMailboxes(60), -- not implemented
(255)
};
"ReporterProc" is primarily to allow Maintain to report progress
to its user. Consult a wizard before using this facility.
ReporterProc: TYPE = PROC[Rope.ROPE];
"SetServer" provides a server hint, primarily used by Maintain.
Consult a wizard before using this facility.
SetServerInfo: TYPE = { badName, allDown, noRoute, ok };
SetServer:
PROC[Rope.
ROPE]
RETURNS[ SetServerInfo ];
END.