Esempio n. 1
0
        public EthernetFrame(NetPacket pkt)
        {
            _pkt = pkt;
            int offset = 0;
            NetLib.ReadByteArray(pkt.buffer, ref offset, 6, out DestinationMAC);
            //WriteLine("eth dst MAC :" + DestinationMAC[0] + ":" + DestinationMAC[1] + ":" + DestinationMAC[2] + ":" + DestinationMAC[3] + ":" + DestinationMAC[4] + ":" + DestinationMAC[5]);
            NetLib.ReadByteArray(pkt.buffer, ref offset, 6, out SourceMAC);
            //WriteLine("src MAC :" + SourceMAC[0] + ":" + SourceMAC[1] + ":" + SourceMAC[2] + ":" + SourceMAC[3] + ":" + SourceMAC[4] + ":" + SourceMAC[5]);

            hlen = 14; //(6+6+2)

            //NOTE: we don't have to worry about the Ethernet Frame CRC as it is not included in the packet

            DataLib.ReadUInt16(pkt.buffer, ref offset, out proto);
            switch (proto) //Note, Diffrent Edian
            {
                case (UInt16)EtherFrameType.NULL:
                    break;
                case (UInt16)EtherFrameType.IPv4:
                    _pl = new IP.IPPacket(this);
                    break;
                case (UInt16)EtherFrameType.ARP:
                    _pl = new ARP.ARPPacket(this);
                    break;
                case (UInt16)EtherFrameType.VLAN_TAGGED_FRAME:
                    //Error.WriteLine("VLAN-tagged frame (IEEE 802.1Q)");
                    throw new NotImplementedException();
                //break;
                default:
                    PSE.CLR_PSE_PluginLog.WriteLine(TraceEventType.Error, (int)DEV9LogSources.ETHFrame, "Unkown Ethernet Protocol " + proto.ToString("X4"));
                    break;
            }
        }
Esempio n. 2
0
        public EthernetFrame(NetPacket pkt)
        {
            _pkt = pkt;
            int offset = 0;

            NetLib.ReadByteArray(pkt.buffer, ref offset, 6, out DestinationMAC);
            //WriteLine("eth dst MAC :" + DestinationMAC[0] + ":" + DestinationMAC[1] + ":" + DestinationMAC[2] + ":" + DestinationMAC[3] + ":" + DestinationMAC[4] + ":" + DestinationMAC[5]);
            NetLib.ReadByteArray(pkt.buffer, ref offset, 6, out SourceMAC);
            //WriteLine("src MAC :" + SourceMAC[0] + ":" + SourceMAC[1] + ":" + SourceMAC[2] + ":" + SourceMAC[3] + ":" + SourceMAC[4] + ":" + SourceMAC[5]);

            hlen = 14; //(6+6+2)

            //NOTE: we don't have to worry about the Ethernet Frame CRC as it is not included in the packet

            DataLib.ReadUInt16(pkt.buffer, ref offset, out proto);
            switch (proto) //Note, Diffrent Edian
            {
            case (UInt16)EtherFrameType.NULL:
                break;

            case (UInt16)EtherFrameType.IPv4:
                _pl = new IP.IPPacket(this);
                break;

            case (UInt16)EtherFrameType.ARP:
                _pl = new ARP.ARPPacket(this);
                break;

            case (UInt16)EtherFrameType.VLAN_TAGGED_FRAME:
                //Error.WriteLine("VLAN-tagged frame (IEEE 802.1Q)");
                //Also check if VLAN-tagged frames trigger oversized
                //warnings
                throw new NotImplementedException();

            //break;
            default:
                PSE.CLR_PSE_PluginLog.WriteLine(TraceEventType.Error, (int)DEV9LogSources.ETHFrame, "Unkown Ethernet Protocol " + proto.ToString("X4"));
                break;
            }
        }
Esempio n. 3
0
 public EthernetFrame(EthernetPayload ePL)
 {
     hlen = 14;
     _pl  = ePL;
 }
Esempio n. 4
0
 public EthernetFrame(EthernetPayload ePL)
 {
     hlen = 14;
     _pl = ePL;
 }