ArpaTranslationImpl.mesa
Demers, October 9, 1987 6:31:59 pm PDT
A crude temporary hack for filling in Arpa host numbers and subnet masks. This has a compiled-in list of known hosts/networks.
DIRECTORY
Arpa USING [Address, NetNumber],
ArpaTranslation USING [NetAndSubnetMask, NetAndSubnetMaskObject],
Basics USING [HighByte, LowByte],
CommDriver USING [Network]
;
ArpaTranslationImpl: CEDAR PROGRAM
IMPORTS Arpa, Basics
EXPORTS ArpaTranslation
~ {
Address: TYPE ~ Arpa.Address;
Network: TYPE ~ CommDriver.Network;
XeroxSubnetMask: Arpa.Address ~ [0FFH, 0FFH, 0FCH, 000H];
DetermineAddressAndSubnetMaskForInterface: PUBLIC PROC [n: Network]
RETURNS [ok: BOOLTRUE] ~ {
p: ArpaTranslation.NetAndSubnetMask ← NEW[ArpaTranslation.NetAndSubnetMaskObject];
n.arpa.translation ← p;
SELECT n.type FROM
This looks stupid, since the two algorithms below are exactly the same
ethernet => ok ← DoEthernet[n, p];
ethernetOne => ok ← DoEthernetOne[n, p];
ENDCASE => ok ← FALSE;
};
DoEthernetOne: PROC [n: Network, p: ArpaTranslation.NetAndSubnetMask]
RETURNS [ok: BOOLTRUE] ~ {
This assumes that PUP has installed itself and knows its host/net number.
Simple algorithm:
8 bit network number = 13 (decimal)
14-bit subnet number = pup network number
10-bit host number = pup host number
arpaAddress: Address;
temp: CARD16;
IF (temp ← 4*CARD16[n.pup.net]) # 0
THEN arpaAddress ← [13, Basics.HighByte[temp], Basics.LowByte[temp], n.pup.host]
ELSE ok ← FALSE;
IF ok THEN {
n.arpa.host ← arpaAddress;
p.net ← Arpa.NetNumber[arpaAddress];
p.subnetMask ← XeroxSubnetMask;
};
};
DoEthernet: PROC [n: Network, p: ArpaTranslation.NetAndSubnetMask]
RETURNS [ok: BOOLTRUE] ~ {
This assumes that PUP has installed itself and knows its host/net number.
Simple algorithm:
8 bit network number = 13 (decimal)
14-bit subnet number = pup network number
10-bit host number = pup host number
arpaAddress: Address;
temp: CARD16;
IF (temp ← 4*CARD16[n.pup.net]) # 0
THEN arpaAddress ← [13, Basics.HighByte[temp], Basics.LowByte[temp], n.pup.host]
ELSE ok ← FALSE;
IF ok THEN {
n.arpa.host ← arpaAddress;
p.net ← Arpa.NetNumber[arpaAddress];
p.subnetMask ← XeroxSubnetMask;
};
};
DoEthernet: PROC [n: Network, p: ArpaTranslation.NetAndSubnetMask]
RETURNS [ok: BOOLTRUE] ~ {
xnsHost: XNS.Host ← XNS.GetThisHost[];
arpaAddress: Address;
SELECT XNS.GetThisHost[] FROM
Trilby, 131#252# 25200027475, 2-852-138-813
[0, 0, 170, 0, 47, 61] => arpaAddress ← [13, 1, 100, 170];
ArpaGateway-131, 131#350# 25200035512, 2-852-xxx-xxx
[0, 0, 170, 0, 59, 74] => arpaAddress ← [13, 1, 100, 232];
Other known hosts would go here ...
ENDCASE => ok ← FALSE;
IF ok THEN {
n.arpa.host ← arpaAddress;
p.net ← Arpa.NetNumber[arpaAddress];
p.subnetMask ← XeroxSubnetMask;
};
};
}...