ArpaEthernetOneTranslation.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, August 23, 1987 11:00:09 am PDT
This is a dummy to be used until we get our act together on RARP, ICMP Subnet Mask, ...
DIRECTORY
Arpa USING [Address],
ArpaExtras USING [IsBroadcastWithMask],
ArpaTranslation USING [DetermineAddressAndSubnetMaskForInterface, GetSubnetMask],
CommBuffer USING [],
CommDriver USING [Buffer, GetNetworkChain, InsertReceiveProc, Network, RecvProc],
CommDriverType USING [Encapsulation],
Pup USING [allHosts, Host]
;
ArpaEthernetOneTranslation:
CEDAR
MONITOR
IMPORTS ArpaExtras, ArpaTranslation, CommDriver
EXPORTS CommBuffer
~ {
Address: TYPE ~ Arpa.Address;
Buffer: TYPE ~ CommDriver.Buffer;
Network: TYPE ~ CommDriver.Network;
Encapsulation: PUBLIC TYPE ~ CommDriverType.Encapsulation; -- exported to CommBuffer
Encapsulating Arpa Packets
GetEncapsulation:
PROC [network: Network, address: Address]
RETURNS [Encapsulation] ~ {
Pup host to use is just low order byte of Arpa address, unless broadcast.
dest: Pup.Host ← [address.d];
IF ArpaExtras.IsBroadcastWithMask[address, ArpaTranslation.GetSubnetMask[network]]
THEN dest ← Pup.allHosts;
TRUSTED {
RETURN[ [ethernetOne[etherSpare1~[0,0], etherSpare2~[0,0], etherSpare3~[0,0], etherSpare4~[0,0], etherSpare5~[0,0], ethernetOneDest~dest, ethernetOneSource~network.pup.host, ethernetOneType~arpa]] ]
};
};
Processing Received Translation Packets
translationPacketsReceived: CARD ← 0;
RecvTranslation: CommDriver.RecvProc
[network: Network, buffer: Buffer, bytes: NAT] RETURNS [Buffer]
~ {
translationPacketsReceived ← translationPacketsReceived + 1;
RETURN[buffer];
};
Initialization
Init:
PROC = {
Install self for each ethernetOne on the chain.
FOR network: Network ← CommDriver.GetNetworkChain[], network.next
UNTIL network =
NIL
DO
IF network.type # ethernetOne
THEN LOOP;
IF NOT ArpaTranslation.DetermineAddressAndSubnetMaskForInterface[network].ok
THEN LOOP;
network.arpa.getEncapsulation ← GetEncapsulation;
CommDriver.InsertReceiveProc[network~network, type~arpaTranslate, proc~RecvTranslation];
ENDLOOP;
};
Init[];
}.