ArpaNameCache.mesa
Copyright © 1987 by Xerox Corporation. All rights reserved.
John Larson, October 31, 1987 9:29:17 pm PST
DIRECTORY
BasicTime USING [GMT],
Rope USING [ROPE],
Arpa USING [Address, nullAddress],
ArpaNameQuery USING [SourceOfAuthRecord, MailForwardRecord];
ArpaNameCache: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
Arpanet Domain Data Cache
CacheType: TYPE = {name, alias, mx, zone, soa, downName, bogusName, address, downAddress, bogusAddress, downServer};
NameCacheType: TYPE = CacheType(name..bogusName);
AddressCacheType: TYPE = CacheType(address..downServer);
NameEntry: TYPE = REF name EntryRecord;
AliasEntry: TYPE = REF alias EntryRecord;
MXEntry: TYPE = REF mx EntryRecord;
ZoneEntry: TYPE = REF zone EntryRecord;
AddressEntry: TYPE = REF address EntryRecord;
SoaEntry: TYPE = REF soa EntryRecord;
DownNameEntry: TYPE = REF downName EntryRecord;
DownAddressEntry: TYPE = REF downAddress EntryRecord;
DownServerEntry: TYPE = REF downServer EntryRecord;
BogusNameEntry: TYPE = REF bogusName EntryRecord;
BogusAddressEntry: TYPE = REF bogusAddress EntryRecord;
Entry: TYPE = REF EntryRecord ← NIL;
EntryRecord: TYPE = MONITORED RECORD [
loaded: BasicTime.GMT,
referenced: BasicTime.GMT,
expires: BasicTime.GMT,
source: Arpa.Address ← Arpa.nullAddress,
authoritative: BOOLFALSE,
key: ROPENIL,
ttl: INT ← 0,
v: SELECT cache: CacheType FROM
name => [addresses: LIST OF Arpa.Address ← NIL],
alias => [canonicalName: ROPENIL],
mx => [mxList: LIST OF ArpaNameQuery.MailForwardRecord ← NIL],
zone => [servers: LIST OF ROPENIL],
address => [names: LIST OF ROPENIL],
soa => [soaRef: REF ArpaNameQuery.SourceOfAuthRecord ← NIL],
downName => [null: REF ROPENIL], -- variant mechanism requires field
downAddress => [null: REF ROPENIL],
downServer => [null: REF ROPENIL],
bogusName => [null: REF ROPENIL],
bogusAddress => [null: REF ROPENIL],
ENDCASE
];
FlushAll: PROC;
flush all caches
FlushCache: PROC[cache: CacheType];
flush specified cache
EnumerateProc: TYPE = PROC [key: ROPE, val: Entry] RETURNS [quit: BOOLFALSE];
EnumerateCache: PROC[cache: CacheType, proc: EnumerateProc];
enumerates entries currently in cache in unspecified order; applies proc to each entry until proc returns TRUE or no more entries
CountCache: PROC[cache: CacheType] RETURNS[count: INT];
Delete: PROC[key: ROPE, cache: CacheType];
delete a cache entry
Cache Fetch Operations
If found = TRUE, entry = value associated with given key; if found = FALSE, entry = NIL. If acceptOld = TRUE, expired entries will be returned with expired = TRUE, If acceptOld = FALSE an expired entry will be deleted with [FALSE,FALSE,NIL] returned.
Fetch: PROC [key: ROPE, cache: CacheType, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: Entry];
FetchName: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: NameEntry];
FetchAlias: PROC [alias: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AliasEntry];
FetchMX: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: MXEntry];
FetchZone: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: ZoneEntry];
FetchSoa: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: SoaEntry];
FetchDownName: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownNameEntry];
FetchBogusName: PROC [name: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusNameEntry];
FetchAddress: PROC [addr: Arpa.Address, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AddressEntry];
FetchAddressRope: PROC [addrRope: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AddressEntry];
FetchDownAddress: PROC [addr: Arpa.Address, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownAddressEntry];
FetchDownAddressRope: PROC [addrRope: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownAddressEntry];
FetchBogusAddress: PROC [addr: Arpa.Address, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusAddressEntry];
FetchBogusAddressRope: PROC [addrRope: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusAddressEntry];
FetchDownServer: PROC [addr: Arpa.Address, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownServerEntry];
FetchDownServerRope: PROC [addrRope: ROPE, acceptOld: BOOLTRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownServerEntry];
Cache Update Operations
These all do a SymTab.Create if cache hasn't been initialized yet.
source = source of reply. ttl = Time To Live. auth = TRUE means this is an authoritative reply from a name server. data: REF ANY is a REF to the data which should go in the variant part of the Entry record
Update: PROC [key: ROPE, cache: CacheType,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: Entry];
UpdateName: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: NameEntry];
UpdateAlias: PROC [alias: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: AliasEntry];
UpdateMX: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: MXEntry];
UpdateZone: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: ZoneEntry];
UpdateSoa: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: SoaEntry];
UpdateDownName: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: DownNameEntry];
UpdateBogusName: PROC [name: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: BogusNameEntry];
UpdateAddress: PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: AddressEntry];
UpdateAddressRope: PROC [addrRope: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: AddressEntry];
UpdateDownAddress: PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: DownAddressEntry];
UpdateDownAddressRope: PROC [addrRope: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: DownAddressEntry];
UpdateBogusAddress: PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: BogusAddressEntry];
UpdateBogusAddressRope: PROC [addrRope: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: BogusAddressEntry];
UpdateDownServer: PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: DownServerEntry];
UpdateDownServerRope: PROC [addrRope: ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANYNIL]
RETURNS [entry: DownServerEntry];
END.