SunYPBindServerImpl.mesa
Demers, September 8, 1987 2:37:39 pm PDT
DIRECTORY
Arpa USING [nullAddress],
SunYPBind USING [Binding, DomainProc, NullProc, SetdomProc],
SunYPBindServer USING [],
SymTab USING [Create, Fetch, Ref, Store, Val]
;
SunYPBindServerImpl: CEDAR PROGRAM
IMPORTS SymTab
EXPORTS SunYPBindServer
~ {
Types
Binding: TYPE ~ SunYPBind.Binding;
Binding Table
Table: TYPE ~ SymTab.Ref;
BindingEntry: TYPE ~ REF BindingObject;
BindingObject: TYPE ~ RECORD [
binding: Binding,
version: CARD
];
bindingTable: Table ← SymTab.Create[];
Procedures
Null: PUBLIC SunYPBind.NullProc -- [h: Handle, c: Conversation] -- ~ { NULL };
Domain: PUBLIC SunYPBind.DomainProc -- [h: Handle, c: Conversation, domainName: DomainName] RETURNS [resp: ResponseBinding] -- ~ {
b: BindingEntry;
val: SymTab.Val;
[val~val] ← SymTab.Fetch[bindingTable, domainName];
b ← NARROW[val];
IF (b # NIL) AND (b.binding.address # Arpa.nullAddress)
THEN RETURN [ [success[b.binding]] ];
Here would insert an attempt to locate a server?
RETURN [ [failure[noServer]] ]
};
Setdom: PUBLIC SunYPBind.SetdomProc -- [h: Handle, c: Conversation, req: RequestDomainBinding] -- ~ {
There should be some authentication here.
[] ← SymTab.Store[bindingTable, req.domainName, NEW[BindingObject ← [req.binding, req.version]]];
};
}...