ArpaNameLogSupportImpl.mesa
Copyright © 1987 by Xerox Corporation. All rights reserved.
John Larson, October 31, 1987 3:06:22 pm PST
DIRECTORY
Arpa,
ArpaName USING [AddressToName],
ArpaNameCache USING [AddressEntry, AliasEntry, BogusAddressEntry, BogusNameEntry, DownAddressEntry, DownNameEntry, DownServerEntry, MXEntry, NameEntry, SoaEntry, ZoneEntry],
ArpaNameSupport,
ArpaNameLogSupport,
ArpaNameQuery USING [MailForwardRecord],
BasicTime USING [GMT, Now, Period],
Convert USING [RopeFromTime],
IO USING [PutFR],
Rope USING [Cat, ROPE];
ArpaNameLogSupportImpl: CEDAR PROGRAM
IMPORTS ArpaName, ArpaNameSupport, BasicTime, Convert, IO, Rope
EXPORTS ArpaNameLogSupport =
BEGIN
ROPE: TYPE = Rope.ROPE;
NameSummaryLine: PUBLIC PROC [entry: ArpaNameCache.NameEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "];
};
Put[entry.key];
IF entry.addresses # NIL THEN Put[" => "];
FOR list: LIST OF Arpa.Address ← entry.addresses, list.rest UNTIL list = NIL DO
IF list # entry.addresses THEN Put[", "];
Put[ArpaNameSupport.AddressToRope[list.first]];
ENDLOOP;
Put[IO.PutFR[", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[", %G", [integer[ttl]]]];
Put[IO.PutFR[", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
MXSummaryLine: PUBLIC PROC [entry: ArpaNameCache.MXEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "];
};
Put[entry.key];
IF entry.mxList # NIL THEN Put[" => "];
FOR list: LIST OF ArpaNameQuery.MailForwardRecord ← entry.mxList, list.rest UNTIL list = NIL DO
IF list # entry.mxList THEN Put[" "];
Put[list.first.host];
Put[IO.PutFR[", Pref: %G", [integer[list.first.preference]]]];
Put[IO.PutFR[", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[", %G", [integer[ttl]]]];
Put[IO.PutFR[", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
ENDLOOP;
log[line]};
AliasSummaryLine: PUBLIC PROC [entry: ArpaNameCache.AliasEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[" => "];
Put[entry.canonicalName];
Put[IO.PutFR[", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[", %G", [integer[ttl]]]];
Put[IO.PutFR[", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
BogusNameSummaryLine: PUBLIC PROC [entry: ArpaNameCache.BogusNameEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[IO.PutFR[ " => bogus name, %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[", %G", [integer[ttl]]]];
Put[IO.PutFR[", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
DownNameSummaryLine: PUBLIC PROC [entry: ArpaNameCache.DownNameEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[IO.PutFR[ " => down name, %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put["\n"];
log[line]};
AddressSummaryLine: PUBLIC PROC [entry: ArpaNameCache.AddressEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[" => "];
FOR list: LIST OF ROPE ← entry.names, list.rest UNTIL list = NIL DO
IF list # entry.names THEN Put[", "];
Put[list.first];
ENDLOOP;
Put[IO.PutFR[ ", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put[IO.PutFR[ ", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
BogusAddressSummaryLine: PUBLIC PROC [entry: ArpaNameCache.BogusAddressEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[IO.PutFR[ " => bogus address, %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
DownAddressSummaryLine: PUBLIC PROC [entry: ArpaNameCache.DownAddressEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[IO.PutFR[ " => down address, %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put["\n"];
log[line]};
DownServerSummaryLine: PUBLIC PROC [entry: ArpaNameCache.DownServerEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[IO.PutFR[ " => down server, %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put["\n"];
log[line]};
ZoneSummaryLine: PUBLIC PROC [entry: ArpaNameCache.ZoneEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE ← ArpaName.AddressToName[entry.source].name;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[" is served by "];
FOR list: LIST OF ROPE ← entry.servers, list.rest UNTIL list = NIL DO
IF list # entry.servers THEN Put[", "];
Put[list.first];
ENDLOOP;
Put[IO.PutFR[ ", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put[IO.PutFR[ ", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
SoaSummaryLine: PUBLIC PROC [entry: ArpaNameCache.SoaEntry, time: BOOLEAN, showttl: BOOLEANFALSE, log: PROC[ROPE]] = {
now: BasicTime.GMT ← BasicTime.Now[];
expires: INT;
ttl: INT;
source: ROPE;
line: ROPE;
Put: PROC [r1, r2, r3, r4: ROPENIL] = {line ← Rope.Cat[line, r1, r2, r3, r4]};
IF entry = NIL THEN RETURN;
expires ← BasicTime.Period[from: now, to: entry.expires];
ttl ← entry.ttl;
source ← ArpaName.AddressToName[entry.source].name;
IF time THEN {
Put[Convert.RopeFromTime[from: now, start: hours, end: seconds, useAMPM: FALSE, includeZone: FALSE]];
Put[" "]};
Put[entry.key];
Put[", Soa with domain contact: "];
Put[entry.soaRef.domainContact];
Put[", primary server: "];
Put[entry.soaRef.primaryServer];
Put[IO.PutFR[ ", %G", [integer[expires]]]];
IF showttl THEN Put[IO.PutFR[ ", %G", [integer[ttl]]]];
Put[IO.PutFR[ ", %G", [rope[source]]]];
IF ~entry.authoritative THEN Put[", Not Auth"];
Put["\n"];
log[line]};
END.