public L2_VLan(PacketSpan <VLanHeader> tagVlanSpan, EthernetProtocolId tpid) { this.TagVlan = default; this.Type = tpid; this.Generic = tagVlanSpan.ToGenericSpan(); }
public L3(PacketSpan <PPPoESessionHeader> pppoeSpan) { this.IPv4 = default; this.PPPoE = default; this.Type = EthernetProtocolId.PPPoE_Session; this.Generic = pppoeSpan.ToGenericSpan(); }
public L3(PacketSpan <IPv4Header> ipv4Span) { this.IPv4 = default; this.PPPoE = default; this.Type = EthernetProtocolId.IPv4; this.Generic = ipv4Span.ToGenericSpan(); }
public void Set(ReadOnlySpan <byte> dest, ReadOnlySpan <byte> src, EthernetProtocolId protocol_EndianSafe) { SetDestAddress(dest); SetSrcAddress(src); this.Protocol = protocol_EndianSafe._Endian16(); }
public PacketParsed(ref Packet pkt, int startPin = DefaultSize, PacketParseOption?options = null, int maxPacketSize = DefaultSize, PacketParseMode mode = PacketParseMode.Layer2, EthernetProtocolId layer3ProtocolId = EthernetProtocolId.Unknown) { this.ParseOption = options ?? DefaultOption; maxPacketSize = maxPacketSize._DefaultSize(pkt.Length); switch (mode) { case PacketParseMode.Layer2: PacketSpan <EthernetHeader> etherSpan = pkt.GetSpan <EthernetHeader>(startPin._DefaultSize(pkt.PinHead), maxPacketSize: maxPacketSize); ParseL2_Ethernet(ref pkt, etherSpan); break; case PacketParseMode.Layer3: PacketSpan <GenericHeader> l3Span = pkt.GetSpan <GenericHeader>(startPin._DefaultSize(pkt.PinHead), size: 0, maxPacketSize: maxPacketSize); ParseL3(ref pkt, l3Span, layer3ProtocolId); break; } }