blob: 842f3bfcd0d4f2e00412954b7b32dc203bf81930 [file] [log] [blame]
ptrkrysik82bd1172015-01-15 09:35:03 +01001/* -*- c++ -*- */
2/* @file
3 * @author Piotr Krysik <ptrkrysik@gmail.com>
4 * @section LICENSE
5 *
6 * Gr-gsm is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3, or (at your option)
9 * any later version.
10 *
11 * Gr-gsm is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with gr-gsm; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifdef HAVE_CONFIG_H
24#include "config.h"
25#endif
26
27#include <gnuradio/io_signature.h>
28#include "tmsi_dumper_impl.h"
ptrkrysik258bbb82015-01-15 11:31:47 +010029#include "grgsm/gsmtap.h"
30#include <stdio.h>
ptrkrysik82bd1172015-01-15 09:35:03 +010031
32namespace gr {
33 namespace gsm {
ptrkrysik258bbb82015-01-15 11:31:47 +010034
35 void tmsi_dumper_impl::dump_tmsi(pmt::pmt_t msg)
36 {
37 pmt::pmt_t message_plus_header_blob = pmt::cdr(msg);
38 uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob);
39 size_t message_plus_header_len=pmt::blob_length(message_plus_header_blob);
40
41 gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header;
42
43 for(int ii=sizeof(gsmtap_hdr); ii<message_plus_header_len; ii++)
44 {
45 printf(" %02x", message_plus_header[ii]);
46 }
47 std::cout << std::endl;
48 }
49
ptrkrysik82bd1172015-01-15 09:35:03 +010050 tmsi_dumper::sptr
51 tmsi_dumper::make()
52 {
53 return gnuradio::get_initial_sptr
54 (new tmsi_dumper_impl());
55 }
56
57 /*
58 * The private constructor
59 */
60 tmsi_dumper_impl::tmsi_dumper_impl()
61 : gr::block("tmsi_dumper",
ptrkrysik91629222015-01-15 10:28:14 +010062 gr::io_signature::make(0, 0, 0),
63 gr::io_signature::make(0, 0, 0))
ptrkrysik258bbb82015-01-15 11:31:47 +010064 {
65 message_port_register_in(pmt::mp("msgs"));
66 set_msg_handler(pmt::mp("msgs"), boost::bind(&tmsi_dumper_impl::dump_tmsi, this, _1));
67 }
ptrkrysik82bd1172015-01-15 09:35:03 +010068
69 /*
70 * Our virtual destructor.
71 */
72 tmsi_dumper_impl::~tmsi_dumper_impl()
73 {
74 }
ptrkrysik82bd1172015-01-15 09:35:03 +010075 } /* namespace gsm */
76} /* namespace gr */
77