ArpaNameSupport.mesa
Copyright © 1987 by Xerox Corporation. All rights reserved.
John Larson, October 30, 1987 5:09:25 pm PST
ArpaNameSupport:
CEDAR
DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
Misc support routines
AddressInList:
PROC [addresses:
LIST
OF Arpa.Address, address: Arpa.Address]
RETURNS [yes: BOOL];
Returns TRUE if address is in list
CountAddresses:
PROC [addresses:
LIST
OF Arpa.Address]
RETURNS [count:
INT];
Returns number of addresses in list
AppendUniqueAddress:
PROC [address: Arpa.Address, addresses:
LIST
OF Arpa.Address ←
NIL]
RETURNS [new: LIST OF Arpa.Address];
Appends address if not already in list
AppendUniqueRope:
PUBLIC
PROC [ropes:
LIST
OF
ROPE, name:
ROPE]
RETURNS [new: LIST OF ROPE];
Appends rope if not already in list
AddressToRope:
PROC [address: Arpa.Address, brackets:
BOOL ←
TRUE]
RETURNS [rope:
ROPE];
Makes rope of form "[1.2.3.4]" if brackets = TRUE else of form "1.2.3.4"
RopeToAddress:
PROC [rope:
ROPE]
RETURNS [address: Arpa.Address];
Translates rope of form "[1.2.3.4]" or "1.2.3.4" to Arpa.Address
Returns Arpa.nullAddress if invalid address format
IsAddressRope:
PROC [rope:
ROPE]
RETURNS [
BOOL];
TRUE if rope has Arpa address format, first char is '[ or numeric
AddressRopeToQueryRope:
PROC [addrRope:
ROPE]
RETURNS [queryRope:
ROPE];
If valid Arpa address rope format of form "[1.2.3.4]" or "1.2.3.4" , returns domain ptr query rope of form "4.3.2.1.IN-ADDR.ARPA", RETURNS NIL if not address format
AddressToQueryRope:
PROC [addr: Arpa.Address]
RETURNS [queryRope:
ROPE];
Given Arpa address of form [1.2.3.4] , returns domain ptr query rope of form "4.3.2.1.IN-ADDR.ARPA"
StripBrackets: PROC [inRope: ROPE] RETURNS [outRope: ROPE];
Tailed:
PROC [body, tail:
ROPE]
RETURNS [match:
BOOL];
TRUE if body has tail
StripTail:
PROC [body, tail:
ROPE]
RETURNS [new:
ROPE];
Remove tail from body
END.