1 /* -*- c -*- */ 2 /* 3 * Copyright 2007 - 2012 Mike Ryan, Dominic Spill, Michael Ossmann 4 * Copyright 2005, 2006 Free Software Foundation, Inc. 5 * 6 * This file is part of libbtbb 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2, or (at your option) 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with libbtbb; see the file COPYING. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, 21 * Boston, MA 02110-1301, USA. 22 */ 23 #ifndef INCLUDED_BLUETOOTH_LE_PACKET_H 24 #define INCLUDED_BLUETOOTH_LE_PACKET_H 25 26 #include <stdint.h> 27 #include <stdio.h> 28 #include <stdlib.h> 29 30 #define MAX_LE_SYMBOLS 64 31 32 #define ADV_IND 0 33 #define ADV_DIRECT_IND 1 34 #define ADV_NONCONN_IND 2 35 #define SCAN_REQ 3 36 #define SCAN_RSP 4 37 #define CONNECT_REQ 5 38 #define ADV_SCAN_IND 6 39 40 struct lell_packet { 41 // raw unwhitened bytes of packet, including access address 42 uint8_t symbols[MAX_LE_SYMBOLS]; 43 44 uint32_t access_address; 45 46 // channel index 47 uint8_t channel_idx; 48 uint8_t channel_k; 49 50 // number of symbols 51 int length; 52 53 uint32_t clk100ns; 54 55 // advertising packet header info 56 uint8_t adv_type; 57 int adv_tx_add; 58 int adv_rx_add; 59 60 unsigned access_address_offenses; 61 uint32_t refcount; 62 63 /* flags */ 64 union { 65 struct { 66 uint32_t access_address_ok : 1; 67 } as_bits; 68 uint32_t as_word; 69 } flags; 70 }; 71 72 #endif /* INCLUDED_BLUETOOTH_LE_PACKET_H */ 73