DIRECTORY Rope USING [ROPE], XNS USING [Address, Host, Net, unknownSocket, Socket]; XNSName: CEDAR DEFINITIONS ~ { ROPE: TYPE ~ Rope.ROPE; Name: TYPE ~ Rope.ROPE; Address: TYPE ~ XNS.Address; Net: TYPE ~ XNS.Net; Host: TYPE ~ XNS.Host; Socket: TYPE ~ XNS.Socket; MyAddress: PROC RETURNS [Address]; MyName: PROC RETURNS [Name]; MyRope: PROC [format: Format _ productSoftware] RETURNS [ROPE]; AddressFromName: PROC [name: Name, default: Socket _ XNS.unknownSocket] RETURNS [Address]; AddressFromRope: PROC [rope: ROPE, default: Socket _ XNS.unknownSocket] RETURNS [Address]; AddressesFromName: PROC [name: Name, default: Socket _ XNS.unknownSocket] RETURNS [LIST OF Address]; Format: TYPE ~ { octal, hex, productSoftware }; RopeFromAddress: PROC [address: Address, format: Format _ productSoftware] RETURNS [ROPE]; NameFromAddress: PROC [address: Address, ignoreSocket: BOOL _ TRUE] RETURNS [Name]; NetFromRope: PROC [rope: ROPE] RETURNS [Net]; HostFromRope: PROC [rope: ROPE] RETURNS [Host]; SocketFromRope: PROC [rope: ROPE] RETURNS [Socket]; RopeFromNet: PROC [net: Net, format: Format _ productSoftware] RETURNS [ROPE]; RopeFromHost: PROC [host: Host, format: Format _ productSoftware] RETURNS [ROPE]; RopeFromSocket: PROC [socket: Socket, format: Format _ productSoftware] RETURNS [ROPE]; ErrorCode: TYPE = { syntax, noResponse, errorFromServer, other }; Error: ERROR [code: ErrorCode, text: ROPE]; }. ŠXNSName.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Demers, May 8, 1986 5:34:44 pm PDT Translations between ROPEs and XNS.Addresses. Naming This module implements the XNSName address translation interface. A fully specified address string is of the form .. or ## A number can have one of several forms: 1) Decimal: a sequence of characters in ['0..'9] optionally followed by 'D or 'd. The string may also have '- characters embedded, implying product format. A leading '- is not allowed. 2) Octal: a sequence of characters in ['0..'7] followed by 'B or 'b. 3) Hex: a sequence of characters in {in['0..'9], in ['A..'F], in['a..'f]} beginning with a digit and optionally followed by 'H or 'h. Several additional forms are allowed for nostNumber: 4) The special string "ME" (in upper case), which is equivalent to specifing the Processor ID (XNS Host number) of the host where the code is running. 5) The special string "*", which is equivalent to specifing the broadcast XNS Host number. 6) A nonempty string not in any of the above formats, which we try to interpret as a Clearinghouse distinguished name: The string is broken into its local, domain, and organization (org) components by looking for either ': or '@ characters. Both separators are not allowed in the same string. Clients are advised to only use ': as separator characters. If the string does not contain a domain and/or org field, default values for those fields will be supplied. See the documentation for exact details. The resulting Clearinghouse name is looked up in the CH. The name must denote (or be an alias for) one of a specific set of CH objects for the lookup to succeed. Refer to the release documentation for the currently supported set of allowed CH objects. The hostNumber must always be supplied. Both netNumber and socketNumber can be defaulted. The translation routine will translate any string that is well formed and unambiguous. Acceptable examples: 74B#25200000016#2 Lassen:OSBU North 25200000016 60.Lassen ME * 74.*. #Lassen:Bayhill:Xerox#2B #25200000016#2 Ambiguous (because pair could mean net#host or host#socket): 74#2 Local name Return best address for this machine. Socket will be unknownSocket. Tries to get a human-readable name for the local machine, e.g "Shark". This is hard to do in the XNS world, so for now it just calls MyRope. Returns a ROPE of the form "3.313.". There are no possible errors. NIL might happen if there are no drivers active. Name/Address translation The implementation might use a local cache, so all those sorts of problems can happen. The servers already have a cache, and the Dicentras sometimes don't notice updates as fast as they should, so local caching shouldn't make things much more complicated. Returns the best address for this machine to use when contacting the specified target. (Remember, it might have more than one interface.) "ME" (must be upper case) is a special hack for the local machine. The Clearinghouse won't be contacted if the string is a valid address constant; AddressFromRope[name] will be called instead. ERRORs: Error - noRoute, noResponse, errorFromServer. BUT NONE OF THESE CAN HAPPEN YET!! ??? If name (or the database) doesn't specify any socket number, then default will be used. The idea is that programs like Chat will call NameLookup["Ivy", XNSWKS.telnet]. That lets a wizard use things like "Chat Ivy+1000" to specify a special socket number for debugging. An alias for AddressFromName. Like AddressFromName, except it returns all the addresses, closest first. Controls the format in which a network address gets expanded by RopeFromAddress or NameFromAddress. "Octal" and "hex" do the obvious; "productSoftware" converts each field to decimal and inserts a '-' every 3 digits, starting from the right. Returns a ROPE of the form "1.12.123". Hack: unknownSocket => "1.12." (no trailing 0). This is hard to do in the XNS world. For now it just calls RopeFromAddress. If ignoreSocket is TRUE, then unknownSocket is used in place of address.socket. Errors For now we're not using Clearinghouse, so most of these "can't happen". ʉ˜codešœ ™ Kšœ Ïmœ1™