1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-02-12 10:57:54 +00:00

Minor fixes, modified Ethernet to send packets as broadcasts, to match with IFS changes.

This commit is contained in:
Josh Dersch
2016-12-15 14:08:39 -08:00
parent 364034f012
commit 50f4f9e7a1
4 changed files with 24 additions and 31 deletions

View File

@@ -88,8 +88,7 @@ namespace Contralto
{
// Initialize things to defaults.
HostAddress = 0x22;
AlternateBootType = AlternateBootType.Disk;
BootAddress = 0;
BootFile = 0;
@@ -112,6 +111,13 @@ namespace Contralto
}
ReadConfiguration();
// Special case: On first startup, AlternateBoot will come back as "None" which
// is an invalid UI setting; default to Ethernet in this case.
if (AlternateBootType == AlternateBootType.None)
{
AlternateBootType = AlternateBootType.Ethernet;
}
}
/// <summary>

View File

@@ -37,8 +37,7 @@ namespace Contralto.IO
_receiverLock = new System.Threading.ReaderWriterLockSlim();
_fifo = new Queue<ushort>();
Reset();
_fifo = new Queue<ushort>();
_fifoTransmitWakeupEvent = new Event(_fifoTransmitDuration, null, OutputFifoCallback);
@@ -74,10 +73,17 @@ namespace Contralto.IO
_nextPackets = new Queue<MemoryStream>();
_inputPollEvent = new Event(_inputPollPeriod, null, InputHandler);
Reset();
}
public void Reset()
{
{
_nextPackets.Clear();
_inputPollActive = false;
_countdownWakeup = false;
_outputIndex = 0;
ResetInterface();
}

View File

@@ -95,7 +95,7 @@ namespace Contralto.IO
_callback = callback;
// Now that we have a callback we can start receiving stuff.
Open(true /* promiscuous */, int.MaxValue);
Open(false /* not promiscuous */, int.MaxValue);
BeginReceive();
}
@@ -125,7 +125,6 @@ namespace Contralto.IO
throw new InvalidOperationException("Raw packet data must contain at least two bytes for addressing.");
}
//
// Outgoing packet contains 1 extra word (2 bytes) containing
// the prepended packet length (one word)
@@ -150,7 +149,7 @@ namespace Contralto.IO
//
// Grab the source and destination host addresses from the packet we're sending
// and build 10mbit versions.
// and build 10mbit versions as necessary.
//
byte destinationHost = packetBytes[2];
byte sourceHost = packetBytes[3];
@@ -160,7 +159,7 @@ namespace Contralto.IO
Conversion.ToOctal(destinationHost),
length);
MacAddress destinationMac = Get10mbitDestinationMacFrom3mbit(destinationHost);
MacAddress destinationMac = new MacAddress(_10mbitBroadcast);
MacAddress sourceMac = new MacAddress((UInt48)(_10mbitMACPrefix | Configuration.HostAddress));
// Build the outgoing packet; place the source/dest addresses, type field and the raw data.
@@ -190,7 +189,7 @@ namespace Contralto.IO
// Filter out packets intended for the emulator, forward them on, drop everything else.
//
if ((int)p.Ethernet.EtherType == _3mbitFrameType && // encapsulated 3mbit frames
(p.Ethernet.Source.ToValue() != (UInt48)(_10mbitMACPrefix | Configuration.HostAddress))) // and not sent by this emulator
(p.Ethernet.Source.ToValue() != (UInt48)(_10mbitMACPrefix | Configuration.HostAddress))) // and not sent by this emulator
{
Log.Write(LogComponent.HostNetworkInterface, "Received encapsulated 3mbit packet.");
_callback(p.Ethernet.Payload.ToMemoryStream());
@@ -241,25 +240,7 @@ namespace Contralto.IO
Log.Write(LogComponent.HostNetworkInterface, "Receiver thread started.");
_communicator.ReceivePackets(-1, ReceiveCallback);
}
private MacAddress Get10mbitDestinationMacFrom3mbit(byte destinationHost)
{
MacAddress destinationMac;
if (destinationHost == _3mbitBroadcast)
{
// 3mbit broadcast gets translated to 10mbit broadcast
destinationMac = new MacAddress(_10mbitBroadcast);
}
else
{
// Build 10mbit address from 3mbit
destinationMac = new MacAddress((UInt48)(_10mbitMACPrefix | destinationHost)); // emulator destination address
}
return destinationMac;
}
}
private LivePacketDevice _interface;
private PacketCommunicator _communicator;
@@ -278,7 +259,6 @@ namespace Contralto.IO
/// </summary>
private UInt48 _10mbitMACPrefix = 0x0000aa010200; // 00-00-AA is the Xerox vendor code, used just to be cute.
private UInt48 _10mbitBroadcast = (UInt48)0xffffffffffff;
private const int _3mbitBroadcast = 0;
private UInt48 _10mbitBroadcast = (UInt48)0xffffffffffff;
}
}

View File

@@ -132,6 +132,7 @@ namespace Contralto.UI
// Add all interfaces that PCAP knows about.
case PacketInterfaceType.EthernetEncapsulation:
if (Configuration.HostRawEthernetInterfacesAvailable)
{
foreach (LivePacketDevice device in LivePacketDevice.AllLocalMachine)
{