xref: /libbtbb/lib/src/bluetooth_le_packet.h (revision 25d64f63a355f4c01d10cf4f69da1c2246b040d9)
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 LE_ADV_AA 0x8E89BED6
33 
34 #define ADV_IND			0
35 #define ADV_DIRECT_IND	1
36 #define ADV_NONCONN_IND	2
37 #define SCAN_REQ		3
38 #define SCAN_RSP		4
39 #define CONNECT_REQ		5
40 #define ADV_SCAN_IND	6
41 
42 struct lell_packet {
43 	// raw unwhitened bytes of packet, including access address
44 	uint8_t symbols[MAX_LE_SYMBOLS];
45 
46 	uint32_t access_address;
47 
48 	// channel index
49 	uint8_t channel_idx;
50 	uint8_t channel_k;
51 
52 	// number of symbols
53 	int length;
54 
55 	uint32_t clk100ns;
56 
57 	// advertising packet header info
58 	uint8_t adv_type;
59 	int adv_tx_add;
60 	int adv_rx_add;
61 
62 	unsigned access_address_offenses;
63 	uint32_t refcount;
64 
65 	/* flags */
66 	union {
67 		struct {
68 			uint32_t access_address_ok : 1;
69 		} as_bits;
70 		uint32_t as_word;
71 	} flags;
72 };
73 
74 #endif /* INCLUDED_BLUETOOTH_LE_PACKET_H */
75