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: BOOL ← FALSE,
key: ROPE ← NIL,
ttl: INT ← 0,
v:
SELECT cache: CacheType
FROM
name => [addresses: LIST OF Arpa.Address ← NIL],
alias => [canonicalName: ROPE ← NIL],
mx => [mxList: LIST OF ArpaNameQuery.MailForwardRecord ← NIL],
zone => [servers: LIST OF ROPE ← NIL],
address => [names: LIST OF ROPE ← NIL],
soa => [soaRef: REF ArpaNameQuery.SourceOfAuthRecord ← NIL],
downName => [null: REF ROPE← NIL], -- variant mechanism requires field
downAddress => [null: REF ROPE← NIL],
downServer => [null: REF ROPE← NIL],
bogusName => [null: REF ROPE← NIL],
bogusAddress => [null: REF ROPE← NIL],
ENDCASE
];
FlushAll:
PROC;
flush all caches
FlushCache:
PROC[cache: CacheType];
flush specified cache
EnumerateProc: TYPE = PROC [key: ROPE, val: Entry] RETURNS [quit: BOOL←FALSE];
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:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: Entry];
FetchName:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: NameEntry];
FetchAlias:
PROC [alias:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AliasEntry];
FetchMX:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: MXEntry];
FetchZone:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: ZoneEntry];
FetchSoa:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: SoaEntry];
FetchDownName:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownNameEntry];
FetchBogusName:
PROC [name:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusNameEntry];
FetchAddress:
PROC [addr: Arpa.Address, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AddressEntry];
FetchAddressRope:
PROC [addrRope:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: AddressEntry];
FetchDownAddress:
PROC [addr: Arpa.Address, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownAddressEntry];
FetchDownAddressRope:
PROC [addrRope:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownAddressEntry];
FetchBogusAddress:
PROC [addr: Arpa.Address, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusAddressEntry];
FetchBogusAddressRope:
PROC [addrRope:
ROPE, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: BogusAddressEntry];
FetchDownServer:
PROC [addr: Arpa.Address, acceptOld:
BOOL ←
TRUE]
RETURNS [found: BOOL, expired: BOOL, entry: DownServerEntry];
FetchDownServerRope:
PROC [addrRope:
ROPE, acceptOld:
BOOL ←
TRUE]
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 ANY ← NIL]
RETURNS [entry: ZoneEntry];
UpdateSoa:
PROC [name:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: SoaEntry];
UpdateDownName:
PROC [name:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: DownNameEntry];
UpdateBogusName:
PROC [name:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
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 ANY ← NIL]
RETURNS [entry: DownAddressEntry];
UpdateDownAddressRope:
PROC [addrRope:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: DownAddressEntry];
UpdateBogusAddress:
PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: BogusAddressEntry];
UpdateBogusAddressRope:
PROC [addrRope:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: BogusAddressEntry];
UpdateDownServer:
PROC [addr: Arpa.Address,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: DownServerEntry];
UpdateDownServerRope:
PROC [addrRope:
ROPE,
source: Arpa.Address, ttl: INT, auth: BOOL, data: REF ANY ← NIL]
RETURNS [entry: DownServerEntry];
END.