Changeset 114b8d6 for lib


Ignore:
Timestamp:
04/22/06 00:43:32 (15 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)

Location:
lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcap.c

    rdd2eaee r114b8d6  
    408408        struct pcap_pkthdr *pcapptr = 0;
    409409        pcapptr = (struct pcap_pkthdr *)packet->header;
    410         if (packet->type==pcap_dlt_to_rt(DLT_EN10MB))
     410        if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB))
    411411                return pcapptr->len+4; /* Include the missing FCS */
    412412        else
  • lib/format_pcapfile.c

    rdd2eaee r114b8d6  
    288288        struct pcapfile_pkt_hdr_t *pcapptr
    289289                = (struct pcapfile_pkt_hdr_t *)packet->header;
    290         if (packet->type==pcap_dlt_to_rt(DLT_EN10MB))
     290        if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB))
    291291                /* Include the missing FCS */
    292292                return swapl(packet->trace,pcapptr->wirelen)+4;
  • lib/libtrace.h

    r088533a r114b8d6  
    180180        TRACE_ERR_RECV_FAILED   = -11
    181181};
     182
     183typedef enum {
     184        TRACE_DLT_NULL = 0,
     185        TRACE_DLT_EN10MB = 1,
     186        TRACE_DLT_ATM_RFC1483 = 11,
     187        TRACE_DLT_IEEE802_11 = 105,
     188        TRACE_DLT_LINUX_SLL = 113,
     189        TRACE_DLT_PFLOG = 117
     190} libtrace_dlt_t ;
     191
    182192
    183193/** @name Protocol structures
  • 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;
  • lib/rt_protocol.h

    r566e404 r114b8d6  
    33
    44#include "libtrace.h"
    5 #ifdef HAVE_PCAP
    6 #include <pcap.h>
    7 #endif
    85
    96#define CAPTURE_PORT 3434
     
    6259 RT_DATA_LINUX_NATIVE   =RT_DATA_SIMPLE + TRACE_FORMAT_LINUX_NATIVE,
    6360
    64 #ifdef HAVE_PCAP
    65  RT_DATA_PCAP_NULL              =RT_DATA_PCAP + DLT_NULL,
    66  RT_DATA_PCAP_EN10MB            =RT_DATA_PCAP + DLT_EN10MB,
    67  RT_DATA_PCAP_ATM_RFC1483       =RT_DATA_PCAP + DLT_ATM_RFC1483,
    68  RT_DATA_PCAP_IEEE802_11        =RT_DATA_PCAP + DLT_IEEE802_11,
    69 #ifdef DLT_LINUX_SLL
    70  RT_DATA_PCAP_LINUX_SLL         =RT_DATA_PCAP + DLT_LINUX_SLL,
    71 #endif
    72 #ifdef DLT_PFLOG
    73  RT_DATA_PCAP_PFLOG             =RT_DATA_PCAP + DLT_PFLOG,
    74 #endif
    75 #endif
     61 RT_DATA_PCAP_NULL              =RT_DATA_PCAP + TRACE_DLT_NULL,
     62 RT_DATA_PCAP_EN10MB            =RT_DATA_PCAP + TRACE_DLT_EN10MB,
     63 RT_DATA_PCAP_ATM_RFC1483       =RT_DATA_PCAP + TRACE_DLT_ATM_RFC1483,
     64 RT_DATA_PCAP_IEEE802_11        =RT_DATA_PCAP + TRACE_DLT_IEEE802_11,
     65 RT_DATA_PCAP_LINUX_SLL         =RT_DATA_PCAP + TRACE_DLT_LINUX_SLL,
     66 RT_DATA_PCAP_PFLOG             =RT_DATA_PCAP + TRACE_DLT_PFLOG,
    7667 RT_LAST = 3000
    7768};
  • lib/trace.c

    rdd2eaee r114b8d6  
    12321232                                buf,trace->uridata);
    12331233        }
     1234        trace->err.err_num = 0; /* "OK" */
     1235        trace->err.problem[0]='\0';
    12341236}
    12351237
Note: See TracChangeset for help on using the changeset viewer.