GNU Radio's FOOT Package
bluetooth_kismet_block.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008, 2009, 2010 Michael Ossmann
4  * Copyright 2007, 2008, 2009 Dominic Spill
5  * Copyright 2005, 2006 Free Software Foundation, Inc.
6  *
7  * This file is part of gr-bluetooth
8  *
9  * gr-bluetooth is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * gr-bluetooth is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with gr-bluetooth; see the file COPYING. If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 #ifndef INCLUDED_BLUETOOTH_KISMET_BLOCK_H
26 #define INCLUDED_BLUETOOTH_KSIMET_BLOCK_H
27 
28 #include <bluetooth_multi_block.h>
29 #include <bluetooth_packet.h>
30 #include <pthread.h>
31 #include <vector>
32 
34 typedef boost::shared_ptr<bluetooth_kismet_block> bluetooth_kismet_block_sptr;
35 
36 /*!
37  * \brief Return a shared_ptr to a new instance of bluetooth_kismet_block.
38  */
39 bluetooth_kismet_block_sptr bluetooth_make_kismet_block(double sample_rate, double center_freq, double squelch_threshold);
40 
41 /*!
42  * \brief Sniff Bluetooth packets.
43  * \ingroup block
44  */
46 {
47 private:
48  // The friend declaration allows bluetooth_make_kismet_block to
49  // access the private constructor.
50  friend bluetooth_kismet_block_sptr bluetooth_make_kismet_block(double sample_rate, double center_freq, double squelch_threshold);
51 
52  /* constructor */
53  bluetooth_kismet_block(double sample_rate, double center_freq, double squelch_threshold);
54 
55  void enqueue(bluetooth_packet_sptr packet, int channel);
56 
57 public:
58  /* destructor */
60 
61  struct usrp_bt_pkt {
62  char *data;
63  int len;
64  int channel;
65  };
66 
67  pthread_mutex_t packet_lock;
68 
69  // Packet storage, locked with packet_lock
70  vector<struct usrp_bt_pkt *> packet_queue;
71 
72  // Pending packet, locked with packet_lock
74 
75  // FD pipes
76  int fake_fd[2];
77 
78  /* handle input */
79  int work(int noutput_items,
80  gr_vector_const_void_star &input_items,
81  gr_vector_void_star &output_items);
82 };
83 
84 #endif /* INCLUDED_BLUETOOTH_KISMET_BLOCK_H */
bluetooth_kismet_block_sptr bluetooth_make_kismet_block(double sample_rate, double center_freq, double squelch_threshold)
Return a shared_ptr to a new instance of bluetooth_kismet_block.
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Sniff Bluetooth packets.
Definition: bluetooth_kismet_block.h:45
Bluetooth multi-channel parent class.
Definition: bluetooth_multi_block.h:41
int fake_fd[2]
Definition: bluetooth_kismet_block.h:76
Definition: bluetooth_kismet_block.h:61
char * data
Definition: bluetooth_kismet_block.h:62
int len
Definition: bluetooth_kismet_block.h:63
vector< struct usrp_bt_pkt * > packet_queue
Definition: bluetooth_kismet_block.h:70
friend bluetooth_kismet_block_sptr bluetooth_make_kismet_block(double sample_rate, double center_freq, double squelch_threshold)
Return a shared_ptr to a new instance of bluetooth_kismet_block.
pthread_mutex_t packet_lock
Definition: bluetooth_kismet_block.h:67
int channel
Definition: bluetooth_kismet_block.h:64
int pending_packet
Definition: bluetooth_kismet_block.h:73