UpdateMachineMap.mesa
Gifford, July 19, 1985 4:44:53 pm PDT
Donahue, May 21, 1986 11:32:52 am PDT
Ewan Tempero September 2, 1986 10:27:17 am PDT
DIRECTORY
Commander,
Convert USING [RopeFromRope],
IO,
FingerOps,
FS,
PupNet,
Rope;
UpdateMachineMap: CEDAR PROGRAM
IMPORTS Commander, Convert, FS, FingerOps, PupNet, IO, Rope = {
f: IO.STREAMNIL;
GetNetNameTokenRope: PROC [stream: IO.STREAM] RETURNS [token: Rope.ROPE] ~ {
... returns the next symbolic net name found in stream.
breakNet: IO.BreakProc = {
[char: CHAR] RETURNS [IO.CharClass]
SELECT char FROM
'# => RETURN [IO.CharClass.break];
ENDCASE => RETURN [IO.CharClass.other]
}; -- breakNet
RETURN [IO.GetTokenRope[stream: stream, breakProc: breakNet].token]
}; -- GetNetNameTokenRope
OnThisNetwork: PROC [netAddress, network: Rope.ROPE] RETURNS [BOOLEAN]
... determines whether netAddress is on network. netAddress is really a list of net addresses of the from num1#num2# separated by spaces. network must match num1. --edt
~ {
breakNetAddress: IO.BreakProc = {
[char: CHAR] RETURNS [IO.CharClass]
SELECT char FROM
' => RETURN [IO.CharClass.break]; -- ie break on a space
ENDCASE => RETURN [IO.CharClass.other]
}; -- breakNetAddress
na, net: Rope.ROPENIL;
stream: IO.STREAMIO.RIS[rope: netAddress];
BEGIN
ENABLE IO.EndOfStream => CONTINUE;
DO
get a net address
na ← IO.GetTokenRope[stream: stream, breakProc: breakNetAddress].token;
get the net that this net address is on
net ← GetNetNameTokenRope[IO.RIS[rope: na]];
IF Rope.Equal[s1: net, s2: network, case: FALSE] THEN RETURN [TRUE]
ENDLOOP;
END;
RETURN [FALSE]
}; -- OnThisNetwork
CSLFilter: PROC [name, owner, location, netAddress: Rope.ROPE, gateway, network: BOOLEAN] RETURNS [dataOK: BOOLEAN]
... decides whether the data given by the arguments is something we want in the finger database. This is decided by looking at netAddress and deciding whether it is on one of the networks that I believe is used in PARC. No promises are made that every network mentioned is only used by PARC, nor do I guarentee that all networks used by PARC are actually tested for here.
Note that if the machine is really a network then we check name rather than netAddress. --edt
~ {
dataOK ← IF network THEN
(Rope.Equal[name, "Parc-Net3"] OR Rope.Equal[name, "35-Ethernet"] OR Rope.Equal[name, "Parc-Net5"] OR Rope.Equal[name, "Parc-Net6"] OR Rope.Equal[name, "Parc-Net24"] OR Rope.Equal[name, "Parc-2ndFloor-North"] OR Rope.Equal[name, "Bldg35-2ndFloor"] OR Rope.Equal[name, "Bldg35-3rdFloor"] OR Rope.Equal[name, "LarkSpur"] OR Rope.Equal[name, "Bldg35-1stFloor"])
ELSE
(OnThisNetwork[netAddress, "3"] OR OnThisNetwork[netAddress, "5"] OR OnThisNetwork[netAddress, "6"] OR OnThisNetwork[netAddress, "24"] OR OnThisNetwork[netAddress, "64"] OR OnThisNetwork[netAddress, "131"] OR OnThisNetwork[netAddress, "142"] OR OnThisNetwork[netAddress, "173"] OR OnThisNetwork[netAddress, "204"]);
}; -- CSLFilter
pn: Commander.CommandProc = {
o: IO.STREAM ← cmd.out;
p: PupNet.P = {
IF CSLFilter[name, owner, location, netAddress, gateway, network] THEN {
f.PutF["%g\n\"Owner\" %g\n\"Location\" %g\n\"Net Address\" %g\n\"Gateway\" \"%g\"",
IO.rope[Convert.RopeFromRope[name]], IO.rope[Convert.RopeFromRope[owner]], IO.rope[Convert.RopeFromRope[location]], IO.rope[Convert.RopeFromRope[netAddress]], IO.bool[gateway]];
f.PutF["\n\"Network\" \"%g\"\n\n", IO.bool[network]]; }
};
f ← FS.StreamOpen["///Temp/pup-net.text", $create];
f.PutF["\"Owner\" $NoIndex \"Location\" $Index \"Net Address\" $Index \"Gateway\" $NoNukes \"Network\" $NoIndex\n"];
o.PutF["///Temp/pup-net.text "];
PupNet.ReadFile["[Indigo]<Portola>Pup-Network.txt", p, o];
o.PutF["created.\nFinger database "];
f.Close[];
FingerOps.ReadMachineMap["///Temp/pup-net.text", TRUE];
o.PutF["updated.\n"];
};
Commander.Register["pup-to-finger", pn, "Update Finger Database from Pup-Network.txt"];
}..
Ewan Tempero August 6, 1986 4:19:30 pm PDT
UpdateMachineMap now filters its input so that only those machines that we are interested in ( we being CSL ) go into the database.
changes to: OnThisNetwork and CSLFilter added.