I am trying to recognize LLC, RAW and SNAP type of packet in C#.
For Ethernet i have this code if (packet.DataLink.Kind == DataLinkKind.Ethernet
But I do not know how to recognize other (LLC,RAW,SNAP). Can you help me?
Asked
Active
Viewed 136 times
2

cimmanon
- 67,211
- 17
- 165
- 171

Tomáš Čičman
- 281
- 1
- 5
- 17
1 Answers
0
The IDataLink.Kind
property returns an Enum value for the datalink when it can translate it to one (otherwise it throws an exception).
The RAW datalink Kind is DataLinkKind.IpV4
.
If the packet was received, you can probably down cast the IDataLink
instance you have to PcapDataLink
and use either the PcapDataLink.Name
property or the PcapDataLink.Value
property to get the string or integer value for the datalink.
If you have packets with datalinks that don't have a Kind value, you're welcome to provide .pcap samples for them in Pcap.Net Q&A group so I can add support for them.

brickner
- 6,595
- 3
- 41
- 54