NetworkName.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Demers, October 23, 1990 8:58 am PDT
DIRECTORY
Rope
;
NetworkName: CEDAR DEFINITIONS
~ {
ROPE: TYPE ~ Rope.ROPE;
Error
Error: ERROR[codes: LIST OF ATOM, msg: ROPE];
The list of codes is ordered from most general to most specific.
The msg parameter is human-readable.
Protocol Families, Service Flavors
A protocol family ($ARPA, $XNS, etc) implies a name/address space. A flavor ($SunYP, $DNS, etc) identifies a directory service for the space.
Addresses and Names
Addresses and names are represented by ropes in protocol-family-specific syntax.
An address comprises two components: a host part (identifying a host) and a port part (identifying a communications endpoint on a host). An address rope can always be parsed unambiguously into its host and port parts. There are unspecified host and port addresses, as well as a broadcast host address, in each protocol family.
In general a name may denote a host, a port, or a host-port pair. The interpretation of a name (as host, port, or pair) may depend on context. NIL is a valid name for the unspecified host or port. The protocol-family-independent ROPE broadcastHostName, below, denotes the unspecified port on the broadcast host in every protocol family.
An address ROPE can always be used where a name ROPE is expected.
Components: TYPE ~ { host, port, hostAndPort };
broadcastHostName: ROPE;
Client Lookups
In all cases a (protocol) family is specified. Lookups are done in one or more services registered as serving the specified family. If a service flavor is specified, that registered service (and no other) is used; if the service flavor is defaulted, all services registered for the family are tried in the order specified at registration (see Registration, below). This may take a long time in the (unusual) case that there are many service flavors registered for the same family.
Addresses from Names
AddressFromName: PROC [family: ATOM, name: ROPE, portHint: ROPE ¬ NIL, components: Components ¬ hostAndPort, serviceFlavor: ATOM ¬ NIL] RETURNS [addr: ROPE, responderFlavor: ATOM];
Look up given name in the name space associated with given (protocol) family.
Return an address rope containing the requested components (with unspecified for the non-requested components.
The meaning of portHint is family-specific; it will usually name a default port to use if the name lookup doesn't specify a port and the requested components include port.
! Error[$notFound ...]
! Error[$noService, ...]
! Error[$serviceError, ... ]
Names from Addresses
NameFromAddress: PROC [family: ATOM, addr: ROPE, components: Components ¬ hostAndPort, serviceFlavor: ATOM ¬ NIL] RETURNS [name: ROPE, responderFlavor: ATOM];
Try to map given address rope to a name in the name space associated with the given (protocol) family.
Return name including requested components.
! Error[$notFound ...]
! Error[$noService, ...]
! Error[$notImplemented, ...]
! Error[$serviceError, ... ]
Enumerating Registered Families
EachFamilyProc: TYPE ~ PROC [family: ATOM] RETURNS [continue: BOOL];
EnumerateFamilies: PROC [eachFamily: EachFamilyProc];
Enumerate the families for which there is at least one registered service flavor.
Registration, Implementation details ...
Register: PROC [family: ATOM, proc: RegistrationCallbackProc];
Used to register and unregister name service instances.
AddressFromNameProc: TYPE ~ PROC [r: Registration, name: ROPE, portHint: ROPE, components: Components] RETURNS [addr: ROPE];
Implements the AddressFromName operation.
NameFromAddressProc: TYPE ~ PROC [r: Registration, addr: ROPE, components: Components] RETURNS [name: ROPE];
Implements the NameFromAddress operation.
DestroyProc: TYPE ~ PROC [r: Registration];
Called just before deleting a registration (in EnumerateRegistrations) e.g. to clean up caches.
Registration: TYPE ~ REF RegistrationObject;
RegistrationObject: TYPE ~ RECORD [
family: ATOM,
flavor: ATOM,
addressFromName: AddressFromNameProc,
nameFromAddress: NameFromAddressProc ¬ NIL,
destroy: DestroyProc ¬ NIL,
clientData: REF ¬ NIL,
packageData: REF ¬ NIL -- opaque to flavor implementors
];
RegistrationAction: TYPE ~ {
continue, -- continue enumeration
abort, -- abort enumeration
insert, -- insert new registration before old one
replace, -- replace old registration with new one (call its DestroyProc)
delete -- delete old registration (call its DestroyProc)
};
RegistrationCallbackProc: TYPE ~ PROC [oldRegistration: Registration] RETURNS [action: RegistrationAction, newRegistration: Registration];
Callback for Register.
}.