Changeset f00c146 for lib/linktypes.c


Ignore:
Timestamp:
11/30/12 16:24:15 (8 years ago)
Author:
Shane Alcock <salcock@…>
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:
e1f3b6b
Parents:
2627439
Message:
  • Fix build errors with format_bpf.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/linktypes.c

    r2627439 rf00c146  
    137137}
    138138
     139libtrace_rt_types_t bpf_linktype_to_rt(libtrace_dlt_t linktype) {
     140        return pcap_dlt_to_pcap_linktype(linktype) + TRACE_RT_DATA_BPF;
     141
     142}
     143
    139144libtrace_dlt_t rt_to_pcap_linktype(libtrace_rt_types_t rt_type)
    140145{
    141         assert(rt_type >= TRACE_RT_DATA_DLT);
    142         return rt_type - TRACE_RT_DATA_DLT;
     146       
     147        if (rt_type >= TRACE_RT_DATA_DLT && rt_type < TRACE_RT_DATA_DLT_END) {
     148                /* RT type is in the pcap range */
     149                return rt_type - TRACE_RT_DATA_DLT;
     150        }
     151        else if (rt_type >= TRACE_RT_DATA_BPF && rt_type < TRACE_RT_DATA_BPF_END) {
     152                return rt_type - TRACE_RT_DATA_BPF;
     153        }
     154       
     155        fprintf(stderr, "Error: RT type %u cannot be converted to a pcap DLT\n", rt_type);
     156
    143157}
    144158
Note: See TracChangeset for help on using the changeset viewer.