Ignore:
Timestamp:
04/02/07 21:44:53 (14 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
11f2df7
Parents:
02bd77e
Message:

Sooo, pcap has two types of DLT's "pure" DLT's that are platform dependant,
and "linktype" DLT's that are portable and are what are written to pcap files.

Instead of fudging the two concepts together so much, attempt to disintangle
this mess without exposing too much of the god awful mess to the end user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcapfile.c

    rf0c639b r73dd29f  
    212212        assert(libtrace->format_data);
    213213
    214         packet->type = pcap_dlt_to_rt(swapl(libtrace,
     214        packet->type = pcap_linktype_to_rt(swapl(libtrace,
    215215                                DATA(libtrace)->header.network));
    216216
     
    268268         * pop off the top header until it can be converted
    269269         */
    270         while (libtrace_to_pcap_dlt(trace_get_link_type(packet))==~0U) {
     270        while (libtrace_to_pcap_linktype(trace_get_link_type(packet))==~0U) {
    271271                if (!demote_packet(packet)) {
    272272                        trace_set_err_out(out,
     
    297297                pcaphdr.snaplen = 65536;
    298298                pcaphdr.network =
    299                         libtrace_to_pcap_dlt(trace_get_link_type(packet));
     299                        libtrace_to_pcap_linktype(trace_get_link_type(packet));
    300300
    301301                libtrace_io_write(DATAOUT(out)->file, &pcaphdr, sizeof(pcaphdr));
     
    338338{
    339339#if 0
    340         return pcap_dlt_to_libtrace(
     340        return pcap_linktype_to_libtrace(
    341341                        swapl(packet->trace,
    342342                                DATA(packet->trace)->header.network
     
    344344                        );
    345345#endif
    346         return pcap_dlt_to_libtrace(rt_to_pcap_dlt(packet->type));
     346        return pcap_linktype_to_libtrace(rt_to_pcap_linktype(packet->type));
    347347}
    348348
     
    429429        libtrace_pcapfile_pkt_hdr_t *pcapptr
    430430                = (libtrace_pcapfile_pkt_hdr_t *)packet->header;
    431         if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB))
     431        if (packet->type==pcap_linktype_to_rt(TRACE_DLT_EN10MB))
    432432                /* Include the missing FCS */
    433433                return swapl(packet->trace,pcapptr->wirelen)+4;
    434         else if (packet->type==pcap_dlt_to_rt(TRACE_DLT_IEEE802_11_RADIO)) {
     434        else if (packet->type==pcap_linktype_to_rt(TRACE_DLT_IEEE802_11_RADIO)) {
    435435                /* If the packet is Radiotap and the flags field indicates
    436436                 * that the FCS is not included in the 802.11 frame, then
Note: See TracChangeset for help on using the changeset viewer.