1 /* -*- c -*- */ 2 /* 3 * Copyright 2014 Christopher D. Kilgour techie AT whiterocker.com 4 * 5 * This file is part of libbtbb 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with libbtbb; see the file COPYING. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, 20 * Boston, MA 02110-1301, USA. 21 */ 22 #ifndef PCAPNG_BT_DOT_H 23 #define PCAPNG_BT_DOT_H 24 25 #include "pcap-common.h" 26 #include "pcapng.h" 27 28 typedef struct __attribute__((packed)) { 29 uint32_t centre_freq; 30 uint32_t analog_bandwidth; 31 int32_t intermediate_freq; 32 uint32_t sampling_bandwidth; 33 } bt_wideband_rf_info; 34 35 typedef struct __attribute__((packed)) { 36 option_header header; 37 bt_wideband_rf_info wideband_rf_info; 38 } bt_wideband_rf_option; 39 40 #define PCAPNG_BT_WIDEBAND_RF_INFO 0xd300 41 42 /* --------------------------------- BR/EDR ----------------------------- */ 43 44 typedef struct __attribute__((packed)) { 45 enhanced_packet_block blk_header; 46 pcap_bluetooth_bredr_bb_header bredr_bb_header; 47 uint8_t bredr_payload[BREDR_MAX_PAYLOAD]; 48 } pcapng_bredr_packet; 49 50 typedef struct __attribute__((packed)) { 51 uint8_t bd_addr[6]; 52 uint8_t uap_mask; 53 uint8_t nap_valid; 54 } bredr_bd_addr_info; 55 56 typedef struct __attribute__((packed)) { 57 option_header header; 58 bredr_bd_addr_info bd_addr_info; 59 } bredr_br_addr_option; 60 61 typedef struct __attribute__((packed)) { 62 uint64_t ts; 63 uint32_t lap_uap; 64 uint32_t clk; 65 uint32_t clk_mask; 66 } bredr_clk_info; 67 68 typedef struct __attribute__((packed)) { 69 option_header header; 70 bredr_clk_info clock_info; 71 } bredr_clk_option; 72 73 #define PCAPNG_BREDR_OPTION_BD_ADDR 0xd340 74 #define PCAPNG_BREDR_OPTION_MASTER_CLOCK_INFO 0xd341 75 76 /* --------------------------------- Low Energy ---------------------------- */ 77 78 typedef struct __attribute__((packed)) { 79 enhanced_packet_block blk_header; 80 pcap_bluetooth_le_ll_header le_ll_header; 81 uint8_t le_packet[LE_MAX_PAYLOAD]; 82 83 /* Force 32 bit alignment for options and blk_tot_length. */ 84 uint8_t pad[2]; 85 86 /* Add space for OPTIONS and BLOCK_TOTAL_LENGTH at end of 87 block. These won't be at this position in the structure unless 88 the LE PDU is the full 39 bytes. */ 89 uint32_t options; 90 uint32_t blk_tot_length; 91 } pcapng_le_packet; 92 93 typedef struct __attribute__((packed)) { 94 uint64_t ns; 95 union { 96 struct { 97 uint8_t InitA[6]; 98 uint8_t AdvA[6]; 99 uint8_t AA[4]; 100 uint8_t CRCInit[3]; 101 uint8_t WinSize; 102 uint8_t WinOffset[2]; 103 uint8_t Interval[2]; 104 uint8_t Latency[2]; 105 uint8_t Timeout[2]; 106 uint8_t ChM[5]; 107 uint8_t HopSCA; 108 } fields; 109 uint8_t bytes[0]; 110 } pdu; 111 } le_ll_connection_info; 112 113 typedef struct __attribute__((packed)) { 114 option_header header; 115 le_ll_connection_info connection_info; 116 } le_ll_connection_info_option; 117 118 #define PCAPNG_LE_LL_CONNECTION_INFO 0xd380 119 120 #endif /* PCAPNG_BT_DOT_H */ 121