Changeset f00c146
- Timestamp:
- 11/30/12 16:24:15 (9 years ago)
- 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
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_bpf.c
r2627439 rf00c146 384 384 uint32_t flags = 0; 385 385 386 packet->type = bpf_linktype_to_rt(swapl(libtrace, 387 FORMATIN(libtrace)->linktype)); 386 packet->type = bpf_linktype_to_rt(ntohs(FORMATIN(libtrace)->linktype)); 388 387 389 388 /* Read from the BPF interface into our capture buffer */ -
lib/libtrace_int.h
rf440dc0 rf00c146 790 790 libtrace_dlt_t rt_to_pcap_linktype(libtrace_rt_types_t rt_type); 791 791 792 /** Converts a PCAP DLT into an RT protocol type for the BPF format. 793 * 794 * @param linktype The PCAP DLT to be converted 795 * @return The RT type that is equivalent to the provided DLT for BPF 796 */ 797 libtrace_rt_types_t bpf_linktype_to_rt(libtrace_dlt_t linktype); 798 792 799 /** Converts an ERF type into a libtrace link type. 793 800 * -
lib/linktypes.c
r2627439 rf00c146 137 137 } 138 138 139 libtrace_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 139 144 libtrace_dlt_t rt_to_pcap_linktype(libtrace_rt_types_t rt_type) 140 145 { 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 143 157 } 144 158
Note: See TracChangeset
for help on using the changeset viewer.