pcap-ng: export linktype or convert to DLT_* #139

Closed
guyharris opened this Issue Apr 15, 2013 · 1 comment

Projects

None yet

1 participant

@guyharris
Member

Converted from SourceForge issue 3032040, submitted by georgm

for classic pcap, pcap_datalink() returns the DLT_* types (linktype is converted via linktype_to_dlt when reading a packet)

for pcap-ng, pcap_datalink() retuns the LINKTYPE_* types (linktype is not converted when reading) as described here:
http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#appendixLinkTypes

Now, these constants are not exported (defined in pcap-common.c).
In order to use a generic api for reading pcap and pcap-ng, pcap_datalink() should return the DLT_* value for pcap-ng.

As a second option, the LINKTYPE_* values should be exported to a header file and a second function (pcap_linktype() or so) should be introduced to return the LINKTYPE_* values without conversion.

@guyharris
Member

Submitted by guy_harris

I've checked a fix into the trunk and 1.x branch to convert the LINKTYPE_ value to a DLT_ value in sf-pcap-ng.c.

@guyharris guyharris closed this Apr 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment