/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment">A <see cref="ByteArraySegment" /></param> /// <param name="parentPacket">The parent packet.</param> public GrePacket(ByteArraySegment byteArraySegment, Packet parentPacket) { // slice off the header portion Header = new ByteArraySegment(byteArraySegment) { Length = GreFields.FlagsLength + GreFields.ProtocolLength }; if (HasCheckSum) { Header.Length += GreFields.ChecksumLength; } if (HasReserved) { Header.Length += GreFields.ReservedLength; } if (HasKey) { Header.Length += GreFields.KeyLength; } if (HasSequence) { Header.Length += GreFields.SequenceLength; } // parse the encapsulated bytes PayloadPacketOrData = new LazySlim <PacketOrByteArraySegment>(() => EthernetPacket.ParseNextSegment(Header, Protocol)); ParentPacket = parentPacket; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public LinuxSllPacket(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment) { Length = LinuxSllFields.SLLHeaderLength }; // parse the payload via an EthernetPacket method PayloadPacketOrData = new LazySlim <PacketOrByteArraySegment>(() => EthernetPacket.ParseNextSegment(Header, EthernetProtocolType)); }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public LinuxSllPacket(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment) { Length = LinuxSllFields.SLLHeaderLength }; // parse the payload via an EthernetPacket method PayloadPacketOrData = new Lazy <PacketOrByteArraySegment>(() => EthernetPacket.ParseNextSegment(Header, EthernetProtocolType), LazyThreadSafetyMode.PublicationOnly); }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public Ieee8021QPacket(ByteArraySegment byteArraySegment) { // set the header field, header field values are retrieved from this byte array Header = new ByteArraySegment(byteArraySegment) { Length = Ieee8021QFields.HeaderLength }; // parse the payload via an EthernetPacket method PayloadPacketOrData = new LazySlim <PacketOrByteArraySegment>(() => EthernetPacket.ParseNextSegment(Header, Type)); }