NetAddressing.Mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer on November 14, 1990 7:13 am PST
DIRECTORY Rope;
NetAddressing: CEDAR DEFINITIONS = {
ROPE: TYPE ~ Rope.ROPE;
Error: ERROR [codes: LIST OF ATOM, msg: ROPE];
codes are ordered general to specific; msg is human-readable.
FormatError: PROC [codes: LIST OF ATOM, msg: ROPE] RETURNS [ROPE];
Address: TYPE ~ RECORD [
protocolFamily: ATOM,
host, socket: ROPE];
A NetworkName name (not address), all packaged up.
nullAddress: Address ~ [NIL, NIL, NIL];
FormatAddress: PROC [addr: Address, socket: BOOL] RETURNS [ROPE];
Suitable for presenting to users; usually not very ambiguous or problematic to interpret, but no guarantees. If NOT socket, no attempt is made to include socket information in the result --- but it might appear anyway. Raises no errors.
ParseAddress: PROC [ROPE] RETURNS [Address];
May have problems and raise Error.
EncodeAddress: PROC [Address] RETURNS [ROPE];
DecodeAddress: PROC [ROPE] RETURNS [Address];
Uses an information-lossless code. Raises no errors or signals.
Canonicalize: PROC [Address] RETURNS [Address];
The following treat addresses in a shallow way: aliases appear different.
EqualAddrs: PROC [Address, Address] RETURNS [BOOL];
HashAddr: PROC [Address] RETURNS [CARDINAL];
EqualModSocket: PROC [a1, a2: Address] RETURNS [BOOL];
SetSocket: PROC [Address, ROPE] RETURNS [Address];
ExtractSocket: PROC [Address] RETURNS [ROPE];
EqualAddrReferents: PROC [key1, key2: REF ANY] RETURNS [BOOL];
HashAddrReferent: PROC [key: REF ANY] RETURNS [CARDINAL];
Useful for making RefTabs keyed on Addresses.
FromNnAddress: PROC [addr: ROPE, family: ATOM] RETURNS [Address];
Convert to what NetworkStream wants.
ToNnAddress: PROC [Address] RETURNS [addr: ROPE, family: ATOM];
}.