xref: /libbtbb/lib/src/pcapng-bt.h (revision 0e05cc66941848f923f732577ce647fb6724596a)
18f3e7eeaSChristopher Kilgour /* -*- c -*- */
28f3e7eeaSChristopher Kilgour /*
38f3e7eeaSChristopher Kilgour  * Copyright 2014 Christopher D. Kilgour techie AT whiterocker.com
48f3e7eeaSChristopher Kilgour  *
58f3e7eeaSChristopher Kilgour  * This file is part of libbtbb
68f3e7eeaSChristopher Kilgour  *
78f3e7eeaSChristopher Kilgour  * This program is free software; you can redistribute it and/or modify
88f3e7eeaSChristopher Kilgour  * it under the terms of the GNU General Public License as published by
98f3e7eeaSChristopher Kilgour  * the Free Software Foundation; either version 2, or (at your option)
108f3e7eeaSChristopher Kilgour  * any later version.
118f3e7eeaSChristopher Kilgour  *
128f3e7eeaSChristopher Kilgour  * This program is distributed in the hope that it will be useful,
138f3e7eeaSChristopher Kilgour  * but WITHOUT ANY WARRANTY; without even the implied warranty of
148f3e7eeaSChristopher Kilgour  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158f3e7eeaSChristopher Kilgour  * GNU General Public License for more details.
168f3e7eeaSChristopher Kilgour  *
178f3e7eeaSChristopher Kilgour  * You should have received a copy of the GNU General Public License
188f3e7eeaSChristopher Kilgour  * along with libbtbb; see the file COPYING.  If not, write to
198f3e7eeaSChristopher Kilgour  * the Free Software Foundation, Inc., 51 Franklin Street,
208f3e7eeaSChristopher Kilgour  * Boston, MA 02110-1301, USA.
218f3e7eeaSChristopher Kilgour  */
228f3e7eeaSChristopher Kilgour #ifndef PCAPNG_BT_DOT_H
238f3e7eeaSChristopher Kilgour #define PCAPNG_BT_DOT_H
248f3e7eeaSChristopher Kilgour 
258f3e7eeaSChristopher Kilgour #include "pcap-common.h"
268f3e7eeaSChristopher Kilgour #include "pcapng.h"
278f3e7eeaSChristopher Kilgour 
288f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
298f3e7eeaSChristopher Kilgour 	uint32_t centre_freq;
308f3e7eeaSChristopher Kilgour 	uint32_t analog_bandwidth;
318f3e7eeaSChristopher Kilgour 	int32_t  intermediate_freq;
328f3e7eeaSChristopher Kilgour 	uint32_t sampling_bandwidth;
338f3e7eeaSChristopher Kilgour } bt_wideband_rf_info;
348f3e7eeaSChristopher Kilgour 
358f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
368f3e7eeaSChristopher Kilgour   option_header header;
378f3e7eeaSChristopher Kilgour   bt_wideband_rf_info wideband_rf_info;
388f3e7eeaSChristopher Kilgour } bt_wideband_rf_option;
398f3e7eeaSChristopher Kilgour 
408f3e7eeaSChristopher Kilgour #define PCAPNG_BT_WIDEBAND_RF_INFO 0xd300
418f3e7eeaSChristopher Kilgour 
428f3e7eeaSChristopher Kilgour /* --------------------------------- BR/EDR ----------------------------- */
438f3e7eeaSChristopher Kilgour 
448f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
458f3e7eeaSChristopher Kilgour   enhanced_packet_block blk_header;
468f3e7eeaSChristopher Kilgour   pcap_bluetooth_bredr_bb_header bredr_bb_header;
47*0e05cc66SDominic Spill   uint8_t bredr_payload[BREDR_MAX_PAYLOAD];
488f3e7eeaSChristopher Kilgour } pcapng_bredr_packet;
498f3e7eeaSChristopher Kilgour 
508f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
518f3e7eeaSChristopher Kilgour   uint8_t bd_addr[6];
528f3e7eeaSChristopher Kilgour   uint8_t uap_mask;
538f3e7eeaSChristopher Kilgour   uint8_t nap_valid;
548f3e7eeaSChristopher Kilgour } bredr_bd_addr_info;
558f3e7eeaSChristopher Kilgour 
568f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
578f3e7eeaSChristopher Kilgour   option_header header;
588f3e7eeaSChristopher Kilgour   bredr_bd_addr_info bd_addr_info;
598f3e7eeaSChristopher Kilgour } bredr_br_addr_option;
608f3e7eeaSChristopher Kilgour 
618f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
628f3e7eeaSChristopher Kilgour   uint64_t ts;
638f3e7eeaSChristopher Kilgour   uint32_t lap_uap;
648f3e7eeaSChristopher Kilgour   uint32_t clk;
658f3e7eeaSChristopher Kilgour   uint32_t clk_mask;
668f3e7eeaSChristopher Kilgour } bredr_clk_info;
678f3e7eeaSChristopher Kilgour 
688f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
698f3e7eeaSChristopher Kilgour   option_header header;
708f3e7eeaSChristopher Kilgour   bredr_clk_info clock_info;
718f3e7eeaSChristopher Kilgour } bredr_clk_option;
728f3e7eeaSChristopher Kilgour 
738f3e7eeaSChristopher Kilgour #define PCAPNG_BREDR_OPTION_BD_ADDR           0xd340
748f3e7eeaSChristopher Kilgour #define PCAPNG_BREDR_OPTION_MASTER_CLOCK_INFO 0xd341
758f3e7eeaSChristopher Kilgour 
768f3e7eeaSChristopher Kilgour /* --------------------------------- Low Energy ---------------------------- */
778f3e7eeaSChristopher Kilgour 
788f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
798f3e7eeaSChristopher Kilgour   enhanced_packet_block blk_header;
808f3e7eeaSChristopher Kilgour   pcap_bluetooth_le_ll_header le_ll_header;
81*0e05cc66SDominic Spill   uint8_t le_packet[LE_MAX_PAYLOAD];
828f3e7eeaSChristopher Kilgour } pcapng_le_packet;
838f3e7eeaSChristopher Kilgour 
848f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
858f3e7eeaSChristopher Kilgour   uint64_t ns;
868f3e7eeaSChristopher Kilgour   union {
878f3e7eeaSChristopher Kilgour     struct {
888f3e7eeaSChristopher Kilgour       uint8_t InitA[6];
898f3e7eeaSChristopher Kilgour       uint8_t AdvA[6];
908f3e7eeaSChristopher Kilgour       uint8_t AA[4];
918f3e7eeaSChristopher Kilgour       uint8_t CRCInit[3];
928f3e7eeaSChristopher Kilgour       uint8_t WinSize;
938f3e7eeaSChristopher Kilgour       uint8_t WinOffset[2];
948f3e7eeaSChristopher Kilgour       uint8_t Interval[2];
958f3e7eeaSChristopher Kilgour       uint8_t Latency[2];
968f3e7eeaSChristopher Kilgour       uint8_t Timeout[2];
978f3e7eeaSChristopher Kilgour       uint8_t ChM[5];
988f3e7eeaSChristopher Kilgour       uint8_t HopSCA;
998f3e7eeaSChristopher Kilgour     } fields;
1008f3e7eeaSChristopher Kilgour     uint8_t bytes[0];
1018f3e7eeaSChristopher Kilgour   } pdu;
1028f3e7eeaSChristopher Kilgour } le_ll_connection_info;
1038f3e7eeaSChristopher Kilgour 
1048f3e7eeaSChristopher Kilgour typedef struct __attribute__((packed)) {
1058f3e7eeaSChristopher Kilgour   option_header header;
1068f3e7eeaSChristopher Kilgour   le_ll_connection_info connection_info;
1078f3e7eeaSChristopher Kilgour } le_ll_connection_info_option;
1088f3e7eeaSChristopher Kilgour 
1098f3e7eeaSChristopher Kilgour #define PCAPNG_LE_LL_CONNECTION_INFO 0xd380
1108f3e7eeaSChristopher Kilgour 
1118f3e7eeaSChristopher Kilgour #endif /* PCAPNG_BT_DOT_H */
112