- Timestamp:
- 03/26/07 11:47:31 (15 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:
- 38f9537
- Parents:
- be22b51
- Location:
- lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_pcap.c
rd5a27e8 rf0c639b 513 513 if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB)) 514 514 return pcapptr->len+4; /* Include the missing FCS */ 515 else 516 return pcapptr->len; 515 else if (packet->type==pcap_dlt_to_rt(TRACE_DLT_IEEE802_11_RADIO)) { 516 /* If the packet is Radiotap and the flags field indicates 517 * that the FCS is not included in the 802.11 frame, then 518 * we need to add 4 to the wire-length to account for it. 519 */ 520 uint16_t flags; 521 trace_get_wireless_flags(trace_get_link(packet), trace_get_link_type(packet), &flags); 522 if ((flags & TRACE_RADIOTAP_F_FCS) == 0) 523 return pcapptr->len + 4; 524 } 525 return pcapptr->len; 517 526 } 518 527 -
lib/format_pcapfile.c
rc85b715 rf0c639b 432 432 /* Include the missing FCS */ 433 433 return swapl(packet->trace,pcapptr->wirelen)+4; 434 else 435 return swapl(packet->trace,pcapptr->wirelen); 434 else if (packet->type==pcap_dlt_to_rt(TRACE_DLT_IEEE802_11_RADIO)) { 435 /* If the packet is Radiotap and the flags field indicates 436 * that the FCS is not included in the 802.11 frame, then 437 * we need to add 4 to the wire-length to account for it. 438 */ 439 uint16_t flags; 440 trace_get_wireless_flags(trace_get_link(packet), trace_get_link_type(packet), &flags); 441 if ((flags & TRACE_RADIOTAP_F_FCS) == 0) 442 return swapl(packet->trace,pcapptr->wirelen)+4; 443 } 444 return swapl(packet->trace,pcapptr->wirelen); 436 445 } 437 446 -
lib/libtrace.h.in
rbe22b51 rf0c639b 347 347 TRACE_RADIOTAP_DB_ANTSIGNAL = 12, /**< Signal power in dB from a fixed reference (uint8) */ 348 348 TRACE_RADIOTAP_DB_ANTNOISE = 13, /**< Noise power in dB from a fixed reference (uint8) */ 349 TRACE_RADIOTAP_FCS = 14, /**< Received frame check sequence (uint32) */350 349 TRACE_RADIOTAP_EXT = 31 351 350 } libtrace_radiotap_field_t; … … 1625 1624 libtrace_linktype_t linktype, uint8_t *antenna); 1626 1625 1627 /** Get the wireless Frame Check Sequence field1628 * @param link the wireless header1629 * @param linktype the linktype of the wireless header passed in1630 * @param[out] fcs the Frame Check Sequence of the frame.1631 * @return true if the field was available, false if not.1632 */1633 DLLEXPORT bool trace_get_wireless_fcs(void *linkptr,1634 libtrace_linktype_t linktype, uint32_t *fcs);1635 1636 1626 /*@}*/ 1637 1627 -
lib/libtrace_int.h
rd5a27e8 rf0c639b 457 457 void duck_constructor(void); 458 458 459 459 /* Used internally by get_wire_length() methods */ 460 bool trace_get_wireless_flags(void *link, libtrace_linktype_t linktype, uint8_t *flags); 461 #define TRACE_RADIOTAP_F_FCS 0x10 460 462 461 463 #ifdef __cplusplus -
lib/link_wireless.c
rd5a27e8 rf0c639b 156 156 if (field == TRACE_RADIOTAP_DB_ANTNOISE) 157 157 return (void *) p; 158 /* 158 159 if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DB_ANTNOISE)) 159 160 p+= sizeof (uint8_t); 160 161 if (field == TRACE_RADIOTAP_FCS) 162 ALIGN_NATURAL_32(p,s); 163 return (void *)p; 161 */ 164 162 165 163 /* Unknown field */ … … 198 196 * for now. Maybe it will be included in the API later if it becomes useful 199 197 * and we come up with a suitable abstraction. 200 */ 201 static 198 * This function isn't marked static as the various format modules need to 199 * access it for get_wire_length(). It's not meant to be exported though. 200 */ 202 201 bool trace_get_wireless_flags(void *link, 203 202 libtrace_linktype_t linktype, uint8_t *flags) … … 591 590 } 592 591 593 DLLEXPORT bool trace_get_wireless_fcs(void *link,594 libtrace_linktype_t linktype, uint32_t *fcs)595 {596 uint32_t *p;597 void *l;598 uint16_t type;599 600 if (link == NULL || fcs == NULL) return false;601 switch (linktype) {602 case TRACE_TYPE_80211_RADIO:603 if ((p = (uint32_t *) trace_get_radiotap_field(link,604 TRACE_RADIOTAP_FCS))) {605 *fcs = bswap_le_to_host32(*p);606 return true;607 } else break;608 case TRACE_TYPE_LINUX_SLL:609 l = trace_get_payload_from_linux_sll(link, &type, NULL);610 return trace_get_wireless_fcs(l, arphrd_type_to_libtrace(type), fcs);611 default:612 return false;613 }614 return false;615 }616
Note: See TracChangeset
for help on using the changeset viewer.