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 } pcapng_bredr_packet; 48 49 typedef struct __attribute__((packed)) { 50 uint8_t bd_addr[6]; 51 uint8_t uap_mask; 52 uint8_t nap_valid; 53 } bredr_bd_addr_info; 54 55 typedef struct __attribute__((packed)) { 56 option_header header; 57 bredr_bd_addr_info bd_addr_info; 58 } bredr_br_addr_option; 59 60 typedef struct __attribute__((packed)) { 61 uint64_t ts; 62 uint32_t lap_uap; 63 uint32_t clk; 64 uint32_t clk_mask; 65 } bredr_clk_info; 66 67 typedef struct __attribute__((packed)) { 68 option_header header; 69 bredr_clk_info clock_info; 70 } bredr_clk_option; 71 72 #define PCAPNG_BREDR_OPTION_BD_ADDR 0xd340 73 #define PCAPNG_BREDR_OPTION_MASTER_CLOCK_INFO 0xd341 74 75 /* --------------------------------- Low Energy ---------------------------- */ 76 77 typedef struct __attribute__((packed)) { 78 enhanced_packet_block blk_header; 79 pcap_bluetooth_le_ll_header le_ll_header; 80 uint8_t le_packet[LE_MAX_PAYLOAD]; 81 82 /* Force 32 bit alignment for options and blk_tot_length. */ 83 uint8_t pad[2]; 84 85 /* Add space for OPTIONS and BLOCK_TOTAL_LENGTH at end of 86 block. These won't be at this position in the structure unless 87 the LE PDU is the full 39 bytes. */ 88 uint32_t options; 89 uint32_t blk_tot_length; 90 } pcapng_le_packet; 91 92 typedef struct __attribute__((packed)) { 93 uint64_t ns; 94 union { 95 struct { 96 uint8_t InitA[6]; 97 uint8_t AdvA[6]; 98 uint8_t AA[4]; 99 uint8_t CRCInit[3]; 100 uint8_t WinSize; 101 uint8_t WinOffset[2]; 102 uint8_t Interval[2]; 103 uint8_t Latency[2]; 104 uint8_t Timeout[2]; 105 uint8_t ChM[5]; 106 uint8_t HopSCA; 107 } fields; 108 uint8_t bytes[0]; 109 } pdu; 110 } le_ll_connection_info; 111 112 typedef struct __attribute__((packed)) { 113 option_header header; 114 le_ll_connection_info connection_info; 115 } le_ll_connection_info_option; 116 117 #define PCAPNG_LE_LL_CONNECTION_INFO 0xd380 118 119 #endif /* PCAPNG_BT_DOT_H */ 120