[Top]
[First]
[Previous]
[Next]
Identifying The Protocol Stack Dynamically
As you saw, we assumed that the captured data was an IP packet.
libpcap enables us to find the actual protocol at run-time:
int datalink = pcap_datalink(pc);
Example values:
DLT_EN10MB
Ethernet protocol.
DLT_RAW
IP protocol.
Originally written by
guy keren