Ticket #65: libtrace3_radiotap_support.patch
File libtrace3_radiotap_support.patch, 22.4 KB (added by smr26@…, 16 years ago) |
---|
-
lib/protocols.c
170 170 uint16_t *type, uint32_t *remaining) 171 171 { 172 172 libtrace_pflog_header_t *pflog = (libtrace_pflog_header_t*)link; 173 173 if (remaining) { 174 174 if (*remaining<sizeof(*pflog)) 175 175 return NULL; 176 176 *remaining-=sizeof(*pflog); … … 187 187 return (void*)((char*)pflog+ sizeof(*pflog)); 188 188 } 189 189 190 /* Returns the 'payload' of the prism header, which is the 802.11 frame */ 191 static void *trace_get_payload_from_prism (void *link, 192 uint16_t *type, uint32_t *remaining) 193 { 194 if (remaining) { 195 if (*remaining<144) 196 return NULL; 197 *remaining-=144; 198 } 199 200 if (type) *type = 0; 201 202 return (void *) ((char*)link+144); 203 } 204 205 /* Returns the 'payload' of the radiotap header, which is the 802.11 frame */ 206 static void *trace_get_payload_from_radiotap (void *link, 207 uint16_t *type, uint32_t *remaining) 208 { 209 struct libtrace_radiotap_t *rtap = (struct libtrace_radiotap_t*)link; 210 if (remaining) { 211 if (*remaining<rtap->it_len) 212 return NULL; 213 *remaining-=rtap->it_len; 214 } 215 216 if (type) *type = 0; 217 218 return (void*) ((char*)link + rtap->it_len); 219 } 220 190 221 void *trace_get_payload_from_link(void *link, libtrace_linktype_t linktype, 191 222 uint16_t *type, uint32_t *remaining) 192 223 { 224 void *l; 225 193 226 switch(linktype) { 194 227 case TRACE_TYPE_80211_PRISM: 195 return trace_get_payload_from_80211((char*)link+144, 196 type,remaining); 228 l = trace_get_payload_from_prism(link,type,remaining); 229 l ? trace_get_payload_from_80211(l,type,remaining) : NULL; 230 case TRACE_TYPE_80211_RADIO: 231 l = trace_get_payload_from_radiotap(link,type,remaining); 232 l ? trace_get_payload_from_80211(l,type,remaining) : NULL ; 197 233 case TRACE_TYPE_80211: 198 234 return trace_get_payload_from_80211(link,type,remaining); 199 235 case TRACE_TYPE_ETH: -
lib/libtrace.h.in
216 216 TRACE_DLT_ATM_RFC1483 = 11, 217 217 TRACE_DLT_IEEE802_11 = 105, 218 218 TRACE_DLT_LINUX_SLL = 113, 219 TRACE_DLT_PFLOG = 117 219 TRACE_DLT_PFLOG = 117, 220 TRACE_DLT_IEEE802_11_RADIO = 127 /**< Radiotap */ 220 221 } libtrace_dlt_t ; 221 222 222 223 /** Enumeration of link layer types supported by libtrace */ … … 235 236 /* TRACE_TYPE_LEGACY_ETH Obsolete */ 236 237 TRACE_TYPE_80211_PRISM = 12, 237 238 TRACE_TYPE_AAL5 = 13, 238 TRACE_TYPE_DUCK = 14 /**< Pseudo link layer for DUCK packets */ 239 TRACE_TYPE_DUCK = 14, /**< Pseudo link layer for DUCK packets */ 240 TRACE_TYPE_80211_RADIO = 15 /**< Radiotap + 802.11 */ 239 241 } libtrace_linktype_t; 240 242 241 243 /** Trace directions … … 814 816 uint32_t *remaining); 815 817 816 818 817 /** Gets a pointer to the payload given a pointer to the IP header 819 /** Gets a pointer to the payload given a pointer to the Radiotap header 820 * @param link a pointer to the Radiotap header 821 * @param[out] type An output variable of the ethernet type 822 * @param[in,out] remaining Updated with the number of bytes remaining 823 * 824 * @return a pointer to the 802.11 header, or NULL if header isn't 825 * present. 826 * 827 * Remaining may be NULL. If Remaining is not NULL it must point to the number 828 * of bytes captured of the linklayer and beyond. It will be updated after 829 * this function to the number of bytes remaining after the Radiotap header has been 830 * removed. 831 * 832 * type may be NULL if not needed. 833 */ 834 DLLEXPORT void *trace_get_payload_from_radiotap(void *link, 835 uint16_t *type, uint32_t *remaining); 836 837 838 /** Gets a pointer to the payload given a pointer to the Prism monitoring header 839 * @param link a pointer to the Prism monitoring header 840 * @param[out] type An output variable of the ethernet type 841 * @param[in,out] remaining Updated with the number of bytes remaining 842 * 843 * @return a pointer to the 802.11 header, or NULL if header isn't 844 * present. 845 * 846 * Remaining may be NULL. If Remaining is not NULL it must point to the number 847 * of bytes captured of the linklayer and beyond. It will be updated after 848 * this function to the number of bytes remaining after the Radiotap header has been 849 * removed. 850 * 851 * type may be NULL if not needed. 852 */ 853 DLLEXPORT void *trace_get_payload_from_prism(void *link, 854 uint16_t *type, uint32_t *remaining); 855 856 857 /** Gets a pointer to the payload given a pointer to the link header 818 858 * @param ip The link pointer 819 859 * @param[out] type An output variable of the ethernet type 820 860 * @param[in,out] remaining Updated with the number of bytes remaining … … 828 868 * IP options) have been removed. 829 869 * 830 870 * type may be NULL if not needed. 871 * 831 872 */ 832 873 DLLEXPORT void *trace_get_payload_from_link(void *link, 833 874 libtrace_linktype_t linktype, … … 1298 1339 void trace_construct_packet(libtrace_packet_t *packet, 1299 1340 libtrace_linktype_t linktype, const void *data, uint16_t len); 1300 1341 1342 /*@}*/ 1301 1343 1344 /** @name Wireless trace support 1345 * Members to deal with wireless traces, such as radiotap 1346 * 1347 * @{ 1348 */ 1349 1350 1351 #ifndef ARPHRD_80211_RADIOTAP 1352 /* libc doesn't define this yet, but it seems to be what everyone is using 1353 */ 1354 #define ARPHRD_80211_RADIOTAP 803 1355 #endif 1356 1357 /** Radiotap field selectors 1358 */ 1359 enum libtrace_radiotap_type { 1360 IEEE80211_RADIOTAP_TSFT = 0, 1361 IEEE80211_RADIOTAP_FLAGS = 1, 1362 IEEE80211_RADIOTAP_RATE = 2, 1363 IEEE80211_RADIOTAP_CHANNEL = 3, 1364 IEEE80211_RADIOTAP_FHSS = 4, 1365 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, 1366 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, 1367 IEEE80211_RADIOTAP_LOCK_QUALITY = 7, 1368 IEEE80211_RADIOTAP_TX_ATTENUATION = 8, 1369 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, 1370 IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 1371 IEEE80211_RADIOTAP_ANTENNA = 11, 1372 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 1373 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 1374 IEEE80211_RADIOTAP_FCS = 14, 1375 IEEE80211_RADIOTAP_EXT = 31, 1376 }; 1377 1378 /** The Radiotap header pre-amble 1379 * 1380 * All Radiotap headers start with this pre-amble, followed by the fields 1381 * specified in the it_present bitmask. If bit 31 of it_present is set, then 1382 * another bitmask follows. 1383 * NB: All of the radiotap data fields are in little-endian byte-order. 1384 */ 1385 struct libtrace_radiotap_t { 1386 uint8_t it_version; /**< Radiotap version */ 1387 uint8_t it_pad; /**< Padding for natural alignment */ 1388 uint16_t it_len; /**< Length in bytes of the entire Radiotap header */ 1389 uint32_t it_present; /**< Which Radiotap fields are present */ 1390 } PACKED libtrace_radiotap_t; 1391 1392 /** Get the Radiotap Timer Syncronisation Function field 1393 * @param link the Radiotap header 1394 * @return A pointer to a value in microseconds indicating when the first bit 1395 * of the MPDU was received by the MAC. NULL if the Radiotap header does not 1396 * contain this field. 1397 */ 1398 DLLEXPORT uint64_t *trace_radiotap_get_tsft(void *link); 1399 1400 /** Get the Radiotap Flags field 1401 * @param link the Radiotap header 1402 * @return A pointer to a field specifying properties of the frame. NULL if 1403 * the Radiotap header does not contain this field. 1404 */ 1405 DLLEXPORT uint8_t *trace_radiotap_get_flags(void *link); 1406 1407 /** Get the Radiotap Rate field 1408 * @param link the Radiotap header 1409 * @return A pointer to a value specifying the data-rate of the frame in 1410 * units of 500kbps. NULL if the Radiotap header does not contain this field. 1411 */ 1412 DLLEXPORT uint8_t *trace_radiotap_get_rate(void *link); 1413 1414 /** Get the Radiotap Channel Frequency field 1415 * @param link the Radiotap header 1416 * @return A pointer to a value specifying the frequency in MHz of the 1417 * channel the frame was trasmitted or received on. NULL if the Radiotap 1418 * header does not contain this field. 1419 */ 1420 DLLEXPORT uint16_t *trace_radiotap_get_chan_freq(void *link); 1421 1422 /** Get the Radiotap Channel Flags field 1423 * @param link the Radiotap header 1424 * @return A pointer to a field containing flags that specify the properties 1425 * of the channel in use. NULL if the Radiotap header does not contain this 1426 * field. 1427 */ 1428 DLLEXPORT uint16_t *trace_radiotap_get_chan_flags(void *link); 1429 1430 /** Get the Radiotap FHSS Hop Set field 1431 * @param link the Radiotap header 1432 * @return A pointer to a value specifying the FHSS Hop Set this frame was 1433 * transmitted or received on. NULL if the Radiotap header does not contain 1434 * this field. 1435 */ 1436 DLLEXPORT uint8_t *trace_radiotap_get_fhss_hopset(void *link); 1437 1438 /** Get the Radiotap FHSS Hop Pattern field 1439 * @param link the Radiotap header 1440 * @return A pointer to a value specifying the FHSS Hop Pattern this frame was 1441 * transmitted or received on. NULL if the Radiotap header does not contain 1442 * this field. 1443 */ 1444 DLLEXPORT uint8_t *trace_radiotap_get_fhss_hoppattern(void *link); 1445 1446 /** Get the Radiotap DBM Antenna Signal field 1447 * @param link the Radiotap header 1448 * @return A pointer to a value specifying the RF signal power at the antenna, 1449 * in dB difference from 1mW. NULL if the Radiotap header does not contain 1450 * this field. 1451 */ 1452 DLLEXPORT int8_t *trace_radiotap_get_dbm_antsignal(void *link); 1453 1454 /** Get the Radiotap DBM Antenna Noise field 1455 * @param link the Radiotap header 1456 * @return A pointer to a value specifying the RF noise power at the antenna, 1457 * in dB difference from 1mW. NULL if the Radiotap header does not contain 1458 * this field. 1459 */ 1460 DLLEXPORT int8_t *trace_radiotap_get_dbm_antnoise(void *link); 1461 1462 /** Get the Radiotap Lock Quality field 1463 * @param link the Radiotap header 1464 * @return A pointer to a value specifying the quality of the Barker Code lock. 1465 * NULL if the Radiotap header does not contain this field. 1466 */ 1467 DLLEXPORT uint16_t *trace_radiotap_get_lock_quality(void *link); 1468 1469 /** Get the Radiotap TX Attenuation field 1470 * @param link the Radiotap header 1471 * @return A pointer to a value specifying the transmit power as a unitless 1472 * distance from maximum power set at factory calibration. 0 indicates maximum 1473 * transmission power. 1474 * NULL if the Radiotap header does not contain this field. 1475 */ 1476 DLLEXPORT uint16_t *trace_radiotap_get_tx_attenuation(void *link); 1477 1478 /** Get the Radiotap DB TX Attenuation field 1479 * @param link the Radiotap header 1480 * @return A pointer to a value specifying the transmit power as dB difference 1481 * from maximum power set at factory calibration. 0 indicates maximum power. 1482 * NULL if the Radiotap header does not contain this field. 1483 */ 1484 DLLEXPORT uint16_t *trace_radiotap_get_db_tx_attenuation(void *link); 1485 1486 /** Get the Radiotap DBM TX Power field 1487 * @param link the Radiotap header 1488 * @return A pointer to a value specifying the transmit power as dB from a 1mW 1489 * reference. This is the absolute power level measured at the antenna port. 1490 * NULL if the Radiotap header does not contain this field. 1491 */ 1492 DLLEXPORT int8_t *trace_radiotap_get_dbm_tx_power(void *link); 1493 1494 /** Get the Radiotap Antenna field 1495 * @param link the Radiotap header 1496 * @return A pointer to a value specifying which antenna was used to transmit 1497 * or receive the frame. NULL if the Radiotap header does not contain this 1498 * field. 1499 */ 1500 DLLEXPORT uint8_t *trace_radiotap_get_antenna(void *link); 1501 1502 /** Get the Radiotap DB Antenna Signal field 1503 * @param link the Radiotap header 1504 * @return A pointer to a value specifying the RF signal power at the antenna, 1505 * in dB difference from a fixed reference. NULL if 1506 * the Radiotap header does not contain this field. 1507 */ 1508 DLLEXPORT uint8_t *trace_radiotap_get_db_antsignal(void *link); 1509 1510 /** Get the Radiotap DB Antenna Noise field 1511 * @param link the Radiotap header 1512 * @return A pointer to a value specifying the RF noise power at the antenna, 1513 * in dB difference from a fixed reference. NULL if 1514 * the Radiotap header does not contain this field. 1515 */ 1516 DLLEXPORT uint8_t *trace_radiotap_get_db_antsignal(void *link); 1517 1518 /** Get the Radiotap Frame Check Sequence field 1519 * @param link the Radiotap header 1520 * @return A pointer to the Frame Check Sequence of the frame. NULL if the 1521 * Radiotap header does not contain this field. 1522 */ 1523 DLLEXPORT uint32_t *trace_radiotap_get_fcs(void *link); 1524 1525 /*@}*/ 1526 1302 1527 #ifdef __cplusplus 1303 1528 } /* extern "C" */ 1304 1529 #endif /* #ifdef __cplusplus */ -
lib/format_linux.c
50 50 #include <sys/ioctl.h> 51 51 #include <errno.h> 52 52 53 53 54 struct libtrace_format_data_t { 54 55 int fd; 55 56 int snaplen; … … 308 309 return TRACE_TYPE_ETH; 309 310 case ARPHRD_PPP: 310 311 return TRACE_TYPE_NONE; 312 case ARPHRD_80211_RADIOTAP: 313 return TRACE_TYPE_80211_RADIO; 311 314 default: /* shrug, beyond me! */ 312 315 printf("unknown Linux ARPHRD type 0x%04x\n",linktype); 313 316 return (libtrace_linktype_t)~0U; -
lib/link_radiotap.c
1 /* 2 * This file is part of libtrace 3 * 4 * link_radiotap.c 5 * Implements the trace_radiotap_* methods defined in libtrace.h 6 * 7 * Copyright (c) 2006 The University of Waikato, Hamilton, New Zealand. 8 * Authors: Scott Raynel 9 * Perry Lorier 10 * 11 * All rights reserved. 12 * 13 * This code has been developed by the University of Waikato WAND 14 * research group. For further information please see http://www.wand.net.nz/ 15 * 16 * libtrace is free software; you can redistribute it and/or modify 17 * it under the terms of the GNU General Public License as published by 18 * the Free Software Foundation; either version 2 of the License, or 19 * (at your option) any later version. 20 * 21 * libtrace is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details. 25 * 26 * You should have received a copy of the GNU General Public License 27 * along with libtrace; if not, write to the Free Software 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 * 30 */ 31 32 #include "libtrace.h" 33 34 #define ALIGN_NATURAL_64(_p,_s) \ 35 while ( (_p - _s) & (sizeof(uint64_t) * 8 - 1) != 0) _p++ 36 #define ALIGN_NATURAL_32(_p,_s) \ 37 while ( (_p - _s) & (sizeof(uint32_t) * 8 - 1) != 0) _p++ 38 #define ALIGN_NATURAL_16(_p,_s) \ 39 while ( (_p - _s) & (sizeof(uint16_t) * 8 - 1) != 0) _p++ 40 41 static void *trace_radiotap_get_field(void *link, enum libtrace_radiotap_type field) 42 { 43 struct libtrace_radiotap_t *rtap = (struct libtrace_radiotap_t *)link; 44 uint8_t *p; 45 uint8_t *s; 46 47 /* Check if the field exists in the radiotap header before proceeding 48 */ 49 if (rtap->it_present & (1 << field) == 0) return NULL; 50 51 /* Skip over any extended bitmasks */ 52 p = (uint8_t *) &(rtap->it_present); 53 54 while ( *((uint32_t*)p) & (1 << IEEE80211_RADIOTAP_EXT) ) { 55 p += sizeof (uint32_t); 56 } 57 58 /* Point p at the first field of radiotap data and remember it for later 59 * when we're doing field alignment 60 */ 61 p += sizeof(uint32_t); 62 s = p; 63 64 if (field == IEEE80211_RADIOTAP_TSFT) 65 /* Always aligned */ 66 return (void*)p; 67 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_TSFT)) 68 p += sizeof (uint64_t); 69 70 if (field == IEEE80211_RADIOTAP_FLAGS) 71 /* Always aligned */ 72 return (void*)p; 73 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_FLAGS)) 74 p += sizeof (uint8_t); 75 76 if (field == IEEE80211_RADIOTAP_RATE) 77 /* Always aligned */ 78 return (void*)p; 79 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_RATE)) 80 p+= sizeof (uint8_t); 81 82 if (field == IEEE80211_RADIOTAP_CHANNEL) 83 { 84 ALIGN_NATURAL_32(p,s); 85 return (void *)p; 86 } 87 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_CHANNEL)) 88 p+= sizeof (uint32_t); 89 90 if (field == IEEE80211_RADIOTAP_FHSS) 91 { 92 ALIGN_NATURAL_16(p,s); 93 return (void *)p; 94 } 95 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_FHSS)) 96 p+= sizeof (uint16_t); 97 98 if (field == IEEE80211_RADIOTAP_DBM_ANTSIGNAL) 99 return (void *)p; 100 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) 101 p+= sizeof (uint8_t); 102 103 if (field == IEEE80211_RADIOTAP_DBM_ANTNOISE) 104 return (void *)p; 105 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)) 106 p+= sizeof (uint8_t); 107 108 if (field == IEEE80211_RADIOTAP_LOCK_QUALITY) 109 { 110 ALIGN_NATURAL_16(p,s); 111 return (void *)p; 112 } 113 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_LOCK_QUALITY)) 114 p+= sizeof (uint16_t); 115 116 if (field == IEEE80211_RADIOTAP_TX_ATTENUATION) 117 { 118 ALIGN_NATURAL_16(p,s); 119 return (void *)p; 120 } 121 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_TX_ATTENUATION)) 122 p+= sizeof (uint16_t); 123 124 if (field == IEEE80211_RADIOTAP_DB_TX_ATTENUATION) 125 { 126 ALIGN_NATURAL_16(p,s); 127 return (void *)p; 128 } 129 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DB_TX_ATTENUATION)) 130 p+= sizeof (uint16_t); 131 132 if (field == IEEE80211_RADIOTAP_DBM_TX_POWER) 133 return (void *)p; 134 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DBM_TX_POWER)) 135 p+= sizeof (uint8_t); 136 137 if (field == IEEE80211_RADIOTAP_ANTENNA) 138 return (void *)p; 139 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_ANTENNA)) 140 p+= sizeof (uint8_t); 141 142 if (field == IEEE80211_RADIOTAP_DB_ANTSIGNAL) 143 return (void *)p; 144 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 145 p+= sizeof (uint8_t); 146 147 if (field == IEEE80211_RADIOTAP_DB_ANTNOISE) 148 return (void *) p; 149 if (rtap->it_present & (1 << IEEE80211_RADIOTAP_DB_ANTNOISE)) 150 p+= sizeof (uint8_t); 151 152 if (field == IEEE80211_RADIOTAP_FCS) 153 ALIGN_NATURAL_32(p,s); 154 return (void *)p; 155 156 /* Unknown field */ 157 return NULL; 158 } 159 160 DLLEXPORT uint64_t *trace_radiotap_get_tsft(void *link) 161 { 162 return (uint64_t *) trace_radiotap_get_field(link, 163 IEEE80211_RADIOTAP_TSFT); 164 } 165 166 DLLEXPORT uint8_t *trace_radiotap_get_flags(void *link) 167 { 168 return (uint8_t *) trace_radiotap_get_field(link, 169 IEEE80211_RADIOTAP_FLAGS); 170 } 171 172 DLLEXPORT uint8_t *trace_radiotap_get_rate(void *link) 173 { 174 return (uint8_t *) trace_radiotap_get_field(link, 175 IEEE80211_RADIOTAP_RATE); 176 } 177 178 DLLEXPORT uint16_t *trace_radiotap_get_chan_freq(void *link) 179 { 180 /* NB: The channel field is actually two 16 bit fields. 181 * The chan_freq field is the first of those two, so we 182 * just cast it to a uint16_t. 183 */ 184 return (uint16_t *) trace_radiotap_get_field(link, 185 IEEE80211_RADIOTAP_CHANNEL); 186 } 187 188 DLLEXPORT uint16_t *trace_radiotap_get_chan_flags(void *link) 189 { 190 /* NB: The channel field is actually two 16 bit fields. 191 * The chan_flags field is the second of the two, so we need 192 * to take the pointer returned by getting the channel field 193 * and increment it. 194 */ 195 uint16_t *p = (uint16_t *) trace_radiotap_get_field(link, 196 IEEE80211_RADIOTAP_CHANNEL); 197 p ? p++ : NULL; 198 } 199 200 DLLEXPORT uint8_t *trace_radiotap_get_fhss_hopset(void *link) 201 { 202 /* NB: As above with the channel field, the fhss field is 203 * similar. 204 */ 205 return (uint8_t *) trace_radiotap_get_field(link, 206 IEEE80211_RADIOTAP_FHSS); 207 } 208 209 DLLEXPORT uint8_t *trace_radiotap_get_fhss_hoppattern(void *link) 210 { 211 uint8_t *p = (uint8_t *) trace_radiotap_get_field(link, 212 IEEE80211_RADIOTAP_FHSS); 213 p ? p++ : NULL; 214 } 215 216 DLLEXPORT int8_t *trace_radiotap_get_dbm_antsignal(void *link) 217 { 218 return (int8_t *) trace_radiotap_get_field(link, 219 IEEE80211_RADIOTAP_DBM_ANTSIGNAL); 220 } 221 222 DLLEXPORT int8_t *trace_radiotap_get_dbm_antnoise(void *link) 223 { 224 return (int8_t *) trace_radiotap_get_field(link, 225 IEEE80211_RADIOTAP_DBM_ANTNOISE); 226 } 227 228 DLLEXPORT uint16_t *trace_radiotap_get_lock_quality(void *link) 229 { 230 return (uint16_t *) trace_radiotap_get_field(link, 231 IEEE80211_RADIOTAP_LOCK_QUALITY); 232 } 233 234 DLLEXPORT uint16_t *trace_radiotap_get_tx_attenuation(void *link) 235 { 236 return (uint16_t *) trace_radiotap_get_field(link, 237 IEEE80211_RADIOTAP_TX_ATTENUATION); 238 } 239 240 DLLEXPORT uint16_t *trace_radiotap_get_db_tx_attenuation(void *link) 241 { 242 return (uint16_t *) trace_radiotap_get_field(link, 243 IEEE80211_RADIOTAP_DB_TX_ATTENUATION); 244 } 245 246 DLLEXPORT int8_t *trace_radiotap_get_dbm_tx_power(void *link) 247 { 248 return (int8_t *) trace_radiotap_get_field(link, 249 IEEE80211_RADIOTAP_DBM_TX_POWER); 250 } 251 252 253 DLLEXPORT uint8_t *trace_radiotap_get_antenna(void *link) 254 { 255 return (uint8_t *) trace_radiotap_get_field(link, 256 IEEE80211_RADIOTAP_ANTENNA); 257 } 258 259 DLLEXPORT uint8_t *trace_radiotap_get_db_antsignal(void *link) 260 { 261 return (uint8_t *) trace_radiotap_get_field(link, 262 IEEE80211_RADIOTAP_DB_ANTSIGNAL); 263 } 264 265 DLLEXPORT uint8_t *trace_radiotap_get_db_antnoise(void *link) 266 { 267 return (uint8_t *) trace_radiotap_get_field(link, 268 IEEE80211_RADIOTAP_DB_ANTNOISE); 269 } 270 271 DLLEXPORT uint32_t *trace_radiotap_get_fcs(void *link) 272 { 273 return (uint32_t *) trace_radiotap_get_field(link, 274 IEEE80211_RADIOTAP_FCS); 275 } 276 -
lib/linktypes.c
35 35 case TRACE_DLT_IEEE802_11: return TRACE_TYPE_80211; 36 36 case TRACE_DLT_LINUX_SLL: return TRACE_TYPE_LINUX_SLL; 37 37 case TRACE_DLT_PFLOG: return TRACE_TYPE_PFLOG; 38 case TRACE_DLT_IEEE802_11_RADIO: return TRACE_TYPE_80211_RADIO; 38 39 } 39 40 return ~0; 40 41 } … … 48 49 case TRACE_TYPE_80211: return TRACE_DLT_IEEE802_11; 49 50 case TRACE_TYPE_LINUX_SLL: return TRACE_DLT_LINUX_SLL; 50 51 case TRACE_TYPE_PFLOG: return TRACE_DLT_PFLOG; 52 case TRACE_TYPE_80211_RADIO: return TRACE_DLT_IEEE802_11_RADIO; 51 53 } 52 54 return ~0; 53 55 } -
lib/Makefile.am
19 19 format_rt.c format_helper.c format_helper.h format_pcapfile.c \ 20 20 format_duck.c $(NATIVEFORMATS) \ 21 21 parse_cmd.c parse_cmd.h libtrace_int.h lt_inttypes.h \ 22 linktypes.c protocols.c libtraceio.h 22 linktypes.c protocols.c libtraceio.h link_radiotap.c 23 23 24 24 if DAG2_4 25 25 nodist_libtrace_la_SOURCES = dagopts.c dagapi.c