GNU Radio's FOO Package: wireshark_connector_impl.h Source File

GNU Radio's FOO Package

wireshark_connector_impl.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#ifndef INCLUDED_FOO_WIRESHARK_CONNECTOR_IMPL_H
18#define INCLUDED_FOO_WIRESHARK_CONNECTOR_IMPL_H
19
20#include <foo/wireshark_connector.h>
21#include <boost/cstdint.hpp>
22
23namespace gr {
24namespace foo {
25
26 class wireshark_connector_impl : public wireshark_connector {
27 private:
28 uint8_t encoding_to_rate(uint64_t encoding);
29 void handle_pdu(pmt::pmt_t pdu);
30
31 bool d_debug;
32 int d_msg_offset;
33 int d_msg_len;
34 char* d_msg;
35 LinkType d_link;
36 public:
37 wireshark_connector_impl(LinkType type, bool debug);
38 int general_work(int noutput, gr_vector_int& ninput_items,
39 gr_vector_const_void_star& input_items,
40 gr_vector_void_star& output_items );
41 };
42
43 #pragma pack(push, 1)
44 struct pcap_file_hdr {
45 uint32_t magic_number; /* magic number */
46 uint16_t version_major; /* major version number */
47 uint16_t version_minor; /* minor version number */
48 int32_t thiszone; /* GMT to local correction */
49 uint32_t sigfigs; /* accuracy of timestamps */
50 uint32_t snaplen; /* max length of captured packets, in octets */
51 uint32_t network; /* data link type */
52 };
53 #pragma pack(pop)
54
55 #pragma pack(push, 1)
56 struct pcap_hdr {
57 uint32_t ts_sec; /* timestamp seconds */
58 uint32_t ts_usec; /* timestamp microseconds */
59 uint32_t incl_len; /* number of octets of packet saved in file */
60 uint32_t orig_len; /* actual length of packet */
61 };
62 #pragma pack(pop)
63
64 #pragma pack(push, 1)
65 struct radiotap_hdr {
66 uint16_t version;
67 uint16_t hdr_length;
68 uint32_t bitmap;
69 uint8_t flags;
70 uint8_t rate;
71 uint32_t channel;
72 uint8_t signal;
73 uint8_t noise;
74 uint8_t antenna;
75 };
76 #pragma pack(pop)
77
78 #pragma pack(push, 1)
79 // An 802.15.4 TAP header as defined in https://gitlab.com/exegin/ieee802-15-4-tap/
80 struct tap_hdr {
81 uint8_t version;
82 uint8_t reserved;
83 uint16_t length;
84 };
85 #pragma pack(pop)
86
87
88 #pragma pack(push, 1)
89 struct tap_tlv_fcs {
90 uint16_t type; // FCS_TYPE = 0
91 uint16_t length; // 1
92 uint8_t fcs_type; // 0 = None, 1 = 16-bit CRC, 2 = 32-bit CRC
93 uint8_t padding[3]; // Should be 0 padded
94 };
95 #pragma pack(pop)
96
97 #pragma pack(push, 1)
98 struct tap_tlv_channel {
99 uint16_t type; // CHANNEL_ASSIGNMENT = 3
100 uint16_t length; // 3
101 uint16_t channel_number;
102 uint8_t channel_page;
103 uint8_t padding; // Should be 0 padded
104 };
105 #pragma pack(pop)
106
107 #pragma pack(push, 1)
108 struct tap_tlv_lqi {
109 uint16_t type; // LQI_TYPE = 10
110 uint16_t length; // 1
111 uint8_t lqi;
112 uint8_t padding[3]; // Should be 0 padded
113 };
114 #pragma pack(pop)
115
116} // namespace foo
117} // namespace gr
118
119#endif /* INCLUDED_FOO_WIRESHARK_CONNECTOR_IMPL_H */
gr::foo::wireshark_connector_impl::wireshark_connector_impl
wireshark_connector_impl(LinkType type, bool debug)
gr::foo::wireshark_connector_impl::general_work
int general_work(int noutput, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
gr::foo::wireshark_connector
Definition wireshark_connector.h:33
gr::foo
Definition burst_tagger.h:28
gr::foo::LinkType
LinkType
Definition wireshark_connector.h:26
gr
Definition burst_tagger.h:27
gr::foo::pcap_file_hdr
Definition wireshark_connector_impl.h:44
gr::foo::pcap_file_hdr::version_major
uint16_t version_major
Definition wireshark_connector_impl.h:46
gr::foo::pcap_file_hdr::snaplen
uint32_t snaplen
Definition wireshark_connector_impl.h:50
gr::foo::pcap_file_hdr::network
uint32_t network
Definition wireshark_connector_impl.h:51
gr::foo::pcap_file_hdr::thiszone
int32_t thiszone
Definition wireshark_connector_impl.h:48
gr::foo::pcap_file_hdr::magic_number
uint32_t magic_number
Definition wireshark_connector_impl.h:45
gr::foo::pcap_file_hdr::version_minor
uint16_t version_minor
Definition wireshark_connector_impl.h:47
gr::foo::pcap_file_hdr::sigfigs
uint32_t sigfigs
Definition wireshark_connector_impl.h:49
gr::foo::pcap_hdr
Definition wireshark_connector_impl.h:56
gr::foo::pcap_hdr::ts_sec
uint32_t ts_sec
Definition wireshark_connector_impl.h:57
gr::foo::pcap_hdr::incl_len
uint32_t incl_len
Definition wireshark_connector_impl.h:59
gr::foo::pcap_hdr::orig_len
uint32_t orig_len
Definition wireshark_connector_impl.h:60
gr::foo::pcap_hdr::ts_usec
uint32_t ts_usec
Definition wireshark_connector_impl.h:58
gr::foo::radiotap_hdr
Definition wireshark_connector_impl.h:65
gr::foo::radiotap_hdr::signal
uint8_t signal
Definition wireshark_connector_impl.h:72
gr::foo::radiotap_hdr::hdr_length
uint16_t hdr_length
Definition wireshark_connector_impl.h:67
gr::foo::radiotap_hdr::channel
uint32_t channel
Definition wireshark_connector_impl.h:71
gr::foo::radiotap_hdr::rate
uint8_t rate
Definition wireshark_connector_impl.h:70
gr::foo::radiotap_hdr::bitmap
uint32_t bitmap
Definition wireshark_connector_impl.h:68
gr::foo::radiotap_hdr::noise
uint8_t noise
Definition wireshark_connector_impl.h:73
gr::foo::radiotap_hdr::version
uint16_t version
Definition wireshark_connector_impl.h:66
gr::foo::radiotap_hdr::flags
uint8_t flags
Definition wireshark_connector_impl.h:69
gr::foo::radiotap_hdr::antenna
uint8_t antenna
Definition wireshark_connector_impl.h:74
gr::foo::tap_hdr
Definition wireshark_connector_impl.h:80
gr::foo::tap_hdr::length
uint16_t length
Definition wireshark_connector_impl.h:83
gr::foo::tap_hdr::reserved
uint8_t reserved
Definition wireshark_connector_impl.h:82
gr::foo::tap_hdr::version
uint8_t version
Definition wireshark_connector_impl.h:81
gr::foo::tap_tlv_channel
Definition wireshark_connector_impl.h:98
gr::foo::tap_tlv_channel::channel_number
uint16_t channel_number
Definition wireshark_connector_impl.h:101
gr::foo::tap_tlv_channel::length
uint16_t length
Definition wireshark_connector_impl.h:100
gr::foo::tap_tlv_channel::padding
uint8_t padding
Definition wireshark_connector_impl.h:103
gr::foo::tap_tlv_channel::channel_page
uint8_t channel_page
Definition wireshark_connector_impl.h:102
gr::foo::tap_tlv_channel::type
uint16_t type
Definition wireshark_connector_impl.h:99
gr::foo::tap_tlv_fcs
Definition wireshark_connector_impl.h:89
gr::foo::tap_tlv_fcs::padding
uint8_t padding[3]
Definition wireshark_connector_impl.h:93
gr::foo::tap_tlv_fcs::length
uint16_t length
Definition wireshark_connector_impl.h:91
gr::foo::tap_tlv_fcs::type
uint16_t type
Definition wireshark_connector_impl.h:90
gr::foo::tap_tlv_fcs::fcs_type
uint8_t fcs_type
Definition wireshark_connector_impl.h:92
gr::foo::tap_tlv_lqi
Definition wireshark_connector_impl.h:108
gr::foo::tap_tlv_lqi::length
uint16_t length
Definition wireshark_connector_impl.h:110
gr::foo::tap_tlv_lqi::type
uint16_t type
Definition wireshark_connector_impl.h:109
gr::foo::tap_tlv_lqi::padding
uint8_t padding[3]
Definition wireshark_connector_impl.h:112
gr::foo::tap_tlv_lqi::lqi
uint8_t lqi
Definition wireshark_connector_impl.h:111
wireshark_connector.h