-- GrapevineUser (Cedar) - Client access to the R-Server database
-- GVNames.mesa
-- Andrew Birrell August 31, 1982 9:17 am
DIRECTORY
GVBasics USING[ Connect, GVString, oldestTime, Password, MakeKey, Remark,
RName, Timestamp ],
NameInfoDefs USING[ ListType, Membership, MembershipGrade, MembershipLevel, NameType, Outcome ],
ProtocolDefs USING[ RNameType, RSOperation ],
Rope USING[ ROPE ];
GVNames: CEDAR DEFINITIONS
IMPORTS GVBasics =
BEGIN
NameType: TYPE = NameInfoDefs.NameType;
-->>> { noChange,
-->>> group, individual, notFound, allDown,
-->>> badPwd, badUser };
-- Sub-types of this represent the results of operations --
-- "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: CARDINAL ],
individual => [ sites: RListHandle,
stamp: GVBasics.Timestamp,
count: CARDINAL ],
notFound => 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: CARDINAL ],
individual => NULL,
notFound => 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]
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. --
-- The "reporter" should normally be NIL; consult a wizard before using it.
StampInfo: TYPE = NameInfoDefs.NameType[noChange..allDown];
CheckStamp: PROC[name: GVBasics.RName,
oldStamp: GVBasics.Timestamp ← GVBasics.oldestTime,
reporter: ReporterProc ← NIL]
RETURNS[ StampInfo ];
-- "GetConnect" returns the connect-site for an individual. "connect" is
-- undisturbed if the result is not "individual". The connect-site is
-- either an NLS name or a net-address. --
ConnectInfo: TYPE = NameInfoDefs.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 = NameInfoDefs.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: ProtocolDefs.RNameType 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: NameInfoDefs.NameType[group..allDown], info: REF GetEntryInfo];
-- "Authenticate" checks a user name and password (insecurely!). --
AuthenticateInfo: TYPE = NameInfoDefs.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 = NameInfoDefs.Membership;
-- { 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, closure, 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 = NameInfoDefs.MembershipLevel;
MembershipGrade: TYPE = NameInfoDefs.MembershipGrade;
ListType: TYPE = NameInfoDefs.ListType;
IsInList: PROC[name: GVBasics.RName, member: GVBasics.RName,
level: MembershipLevel, grade: MembershipGrade, acl: ListType]
RETURNS[Membership];
-- Updates --
-- Creation and Deletion --
Outcome: TYPE = NameInfoDefs.Outcome;
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: PRIVATE PROC[user: GVBasics.RName,
password: GVBasics.Password,
op: ProtocolDefs.RSOperation,
target: GVBasics.RName,
value: GVBasics.GVString ← NIL,
newPwd: GVBasics.Password ← NULL,
reporter: ReporterProc ← NIL]
RETURNS[Outcome];
-- "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: PRIVATE PROC[Rope.ROPE] RETURNS[ SetServerInfo ];
END.