public L2(PacketSpan <EthernetHeader> etherSpan) { this.Ethernet = default; this.Type = PacketL2Type.Ethernet; this.Generic = etherSpan.ToGenericSpan(); }
public L2_VLan(PacketSpan <VLanHeader> tagVlanSpan, EthernetProtocolId tpid) { this.TagVlan = default; this.Type = tpid; this.Generic = tagVlanSpan.ToGenericSpan(); }
public L7(PacketSpan <GenericHeader> l2tpPayloadSpan, L2TPPacketParsed l2tpPacketParsed) { this.L2TPPacketParsed = l2tpPacketParsed; this.Generic = l2tpPayloadSpan; this.Type = L7Type.L2TP; }
public L7(PacketSpan <GenericHeader> payloadSpan, L7Type type) { this.L2TPPacketParsed = null; this.Generic = payloadSpan; this.Type = type; }
public L4(PacketSpan <UDPHeader> udpSpan) { this.TCP = default; this.UDP = default; this.Type = IPProtocolNumber.UDP; this.Generic = udpSpan.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(); }
bool ParseL2_Ethernet(ref Packet pkt, PacketSpan <EthernetHeader> etherSpan) { if (etherSpan.IsEmpty(ref pkt)) { SetError("Insufficient header data"); return(false); } this.L2 = new L2(etherSpan); ref EthernetHeader ether = ref etherSpan.GetRefValue(ref pkt);
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; } }