Changeset 114b8d6 for lib/linktypes.c


Ignore:
Timestamp:
04/22/06 00:43:32 (16 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:
2d96bf2
Parents:
a4bfbf0
Message:

Remove reliance on pcap.h for DLT_'s (and while we're here, make them a pretty
enum, so we get warnings if we forget one somewhere)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/linktypes.c

    r088533a r114b8d6  
    1515 */
    1616
    17 libtrace_linktype_t pcap_dlt_to_libtrace(int dlt)
     17libtrace_linktype_t pcap_dlt_to_libtrace(libtrace_dlt_t dlt)
    1818{
    1919        switch(dlt) {
    20 #if HAVE_PCAP
    21                 case DLT_NULL: return TRACE_TYPE_NONE;
    22                 case DLT_EN10MB: return TRACE_TYPE_ETH;
    23                 case DLT_ATM_RFC1483: return TRACE_TYPE_ATM;
    24                 case DLT_IEEE802_11: return TRACE_TYPE_80211;
    25 #ifdef DLT_LINUX_SLL
    26                 case DLT_LINUX_SLL: return TRACE_TYPE_LINUX_SLL;
    27 #endif
    28 #ifdef DLT_PFLOG
    29                 case DLT_PFLOG: return TRACE_TYPE_PFLOG;
    30 #endif
    31 #else
     20                case TRACE_DLT_NULL: return TRACE_TYPE_NONE;
     21                case TRACE_DLT_EN10MB: return TRACE_TYPE_ETH;
     22                case TRACE_DLT_ATM_RFC1483: return TRACE_TYPE_ATM;
     23                case TRACE_DLT_IEEE802_11: return TRACE_TYPE_80211;
     24                case TRACE_DLT_LINUX_SLL: return TRACE_TYPE_LINUX_SLL;
     25                case TRACE_DLT_PFLOG: return TRACE_TYPE_PFLOG;
    3226                default:
    3327                                assert(!"No pcap support");
    34 #endif
    3528        }
    3629        return -1;
     
    4033{
    4134        switch(type) {
    42 #ifdef HAVE_PCAP
    43                 case TRACE_TYPE_NONE: return DLT_NULL;
    44                 case TRACE_TYPE_ETH: return DLT_EN10MB;
    45                 case TRACE_TYPE_ATM: return DLT_ATM_RFC1483;
    46                 case TRACE_TYPE_80211: return DLT_IEEE802_11;
    47 #ifdef DLT_LINUX_SLL
    48                 case TRACE_TYPE_LINUX_SLL: return DLT_LINUX_SLL;
    49 #endif
    50 #ifdef DLT_PFLOG
    51                 case TRACE_TYPE_PFLOG: return DLT_PFLOG;
    52 #endif
    53 #endif
     35                case TRACE_TYPE_NONE: return TRACE_DLT_NULL;
     36                case TRACE_TYPE_ETH: return TRACE_DLT_EN10MB;
     37                case TRACE_TYPE_ATM: return TRACE_DLT_ATM_RFC1483;
     38                case TRACE_TYPE_80211: return TRACE_DLT_IEEE802_11;
     39                case TRACE_TYPE_LINUX_SLL: return TRACE_DLT_LINUX_SLL;
     40                case TRACE_TYPE_PFLOG: return TRACE_DLT_PFLOG;
    5441        }
    5542        return -1;
Note: See TracChangeset for help on using the changeset viewer.