wireshark: add Option for different link types
This commit is contained in:
@@ -4,7 +4,22 @@
|
|||||||
<key>foo_wireshark_connector</key>
|
<key>foo_wireshark_connector</key>
|
||||||
<category>Foo</category>
|
<category>Foo</category>
|
||||||
<import>import foo</import>
|
<import>import foo</import>
|
||||||
<make>foo.wireshark_connector($debug)</make>
|
<make>foo.wireshark_connector($tech, $debug)</make>
|
||||||
|
|
||||||
|
<param>
|
||||||
|
<name>Technology</name>
|
||||||
|
<key>tech</key>
|
||||||
|
<value>127</value>
|
||||||
|
<type>enum</type>
|
||||||
|
<option>
|
||||||
|
<name>WiFi</name>
|
||||||
|
<key>127</key>
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<name>ZigBee</name>
|
||||||
|
<key>195</key>
|
||||||
|
</option>
|
||||||
|
</param>
|
||||||
|
|
||||||
<param>
|
<param>
|
||||||
<name>Debug</name>
|
<name>Debug</name>
|
||||||
|
|||||||
@@ -23,12 +23,17 @@
|
|||||||
namespace gr {
|
namespace gr {
|
||||||
namespace foo {
|
namespace foo {
|
||||||
|
|
||||||
|
enum LinkType {
|
||||||
|
WIFI = 127,
|
||||||
|
ZIGBEE = 195
|
||||||
|
};
|
||||||
|
|
||||||
class FOO_API wireshark_connector : virtual public gr::block
|
class FOO_API wireshark_connector : virtual public gr::block
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::shared_ptr<wireshark_connector> sptr;
|
typedef boost::shared_ptr<wireshark_connector> sptr;
|
||||||
static sptr make(bool debug= false);
|
static sptr make(LinkType type, bool debug= false);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace foo
|
} // namespace foo
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ using namespace gr::foo;
|
|||||||
|
|
||||||
#define dout d_debug && std::cout
|
#define dout d_debug && std::cout
|
||||||
|
|
||||||
wireshark_connector_impl::wireshark_connector_impl(bool debug) :
|
wireshark_connector_impl::wireshark_connector_impl(LinkType type, bool debug) :
|
||||||
block ("wireshark_connector",
|
block ("wireshark_connector",
|
||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(0, 0, 0),
|
||||||
gr::io_signature::make(1, 1, sizeof(uint8_t))),
|
gr::io_signature::make(1, 1, sizeof(uint8_t))),
|
||||||
d_msg_offset(0),
|
d_msg_offset(0),
|
||||||
d_debug(debug) {
|
d_debug(debug),
|
||||||
|
d_link(type) {
|
||||||
|
|
||||||
message_port_register_in(pmt::mp("in"));
|
message_port_register_in(pmt::mp("in"));
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ wireshark_connector_impl::wireshark_connector_impl(bool debug) :
|
|||||||
hdr->thiszone = 0;
|
hdr->thiszone = 0;
|
||||||
hdr->sigfigs = 0;
|
hdr->sigfigs = 0;
|
||||||
hdr->snaplen = 65535;
|
hdr->snaplen = 65535;
|
||||||
hdr->network = ZIGBEE;
|
hdr->network = d_link;
|
||||||
d_msg_len = sizeof(pcap_global);
|
d_msg_len = sizeof(pcap_global);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +116,6 @@ wireshark_connector_impl::general_work(int noutput, gr_vector_int& ninput_items,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wireshark_connector::sptr
|
wireshark_connector::sptr
|
||||||
wireshark_connector::make(bool debug) {
|
wireshark_connector::make(LinkType type, bool debug) {
|
||||||
return gnuradio::get_initial_sptr(new wireshark_connector_impl(debug));
|
return gnuradio::get_initial_sptr(new wireshark_connector_impl(type, debug));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ namespace foo {
|
|||||||
int d_msg_offset;
|
int d_msg_offset;
|
||||||
int d_msg_len;
|
int d_msg_len;
|
||||||
char d_msg[256];
|
char d_msg[256];
|
||||||
|
LinkType d_link;
|
||||||
public:
|
public:
|
||||||
wireshark_connector_impl(bool debug);
|
wireshark_connector_impl(LinkType type, bool debug);
|
||||||
virtual ~wireshark_connector_impl();
|
virtual ~wireshark_connector_impl();
|
||||||
int general_work(int noutput, gr_vector_int& ninput_items,
|
int general_work(int noutput, gr_vector_int& ninput_items,
|
||||||
gr_vector_const_void_star& input_items,
|
gr_vector_const_void_star& input_items,
|
||||||
@@ -38,10 +39,6 @@ namespace foo {
|
|||||||
void copy_message(const char *buf, int len);
|
void copy_message(const char *buf, int len);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LINK_LAYER_PROTOCOL {
|
|
||||||
ZIGBEE = 195
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pcap_global {
|
struct pcap_global {
|
||||||
uint32_t magic_number; /* magic number */
|
uint32_t magic_number; /* magic number */
|
||||||
uint16_t version_major; /* major version number */
|
uint16_t version_major; /* major version number */
|
||||||
|
|||||||
Reference in New Issue
Block a user