public HLPacket(Packet parent, int headerLen) { var i = parent; for (; i.PayloadPacket != null; i = i.PayloadPacket) ; header = new PacketDotNet.Utils.ByteArraySegment(i.Bytes, i.Header.Length, headerLen); i.PayloadPacket = this; }
private void m_adapter_OnPacketArrival(object sender, CaptureEventArgs e) { if (e.Packet.LinkLayerType != PacketDotNet.LinkLayers.Ethernet) { return; } PacketDotNet.Utils.ByteArraySegment bas = new PacketDotNet.Utils.ByteArraySegment(e.Packet.Data); PacketDotNet.EthernetPacket ethP = new PacketDotNet.EthernetPacket(bas); if (ethP.Type != (PacketDotNet.EthernetPacketType) 0x8892 && ethP.Type != PacketDotNet.EthernetPacketType.VLanTaggedFrame) { return; } if (ethP.PayloadPacket != null && ethP.PayloadPacket is PacketDotNet.Ieee8021QPacket) { if (((PacketDotNet.Ieee8021QPacket)ethP.PayloadPacket).Type != (PacketDotNet.EthernetPacketType) 0x8892) { return; } if (((PacketDotNet.Ieee8021QPacket)ethP.PayloadPacket).PayloadData == null) { Trace.TraceWarning("Empty vlan package"); return; } m_adapter_OnProfinetArrival(new ConnectionInfoEthernet(this, ethP.DestinationHwAddress, ethP.SourceHwAddress), new MemoryStream(((PacketDotNet.Ieee8021QPacket)ethP.PayloadPacket).PayloadData, false)); } else { if (ethP.PayloadData == null) { Trace.TraceWarning("Empty ethernet package"); return; } m_adapter_OnProfinetArrival(new ConnectionInfoEthernet(this, ethP.DestinationHwAddress, ethP.SourceHwAddress), new MemoryStream(ethP.PayloadData, false)); } }
/// <summary> /// Creates an End Of LLDPDU TLV /// </summary> public EndOfLLDPDU() { var bytes = new byte[TLVTypeLength.TypeLengthLength]; var offset = 0; var length = bytes.Length; tlvData = new PacketDotNet.Utils.ByteArraySegment(bytes, offset, length); Type = 0; Length = 0; }
/// <summary> /// Creates an End Of LLDPDU TLV /// </summary> public EndOfLLDPDU() { var bytes = new Byte[TLVTypeLength.TypeLengthLength]; var offset = 0; var length = bytes.Length; tlvData = new PacketDotNet.Utils.ByteArraySegment(bytes, offset, length); Type = 0; Length = 0; }