wireshark: add Option for different link types

This commit is contained in:
Bastian Bloessl
2013-06-16 07:06:00 +02:00
parent 0256fe7e77
commit b60a133ac8
4 changed files with 30 additions and 12 deletions
+16 -1
View File
@@ -4,7 +4,22 @@
<key>foo_wireshark_connector</key>
<category>Foo</category>
<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>
<name>Debug</name>
+6 -1
View File
@@ -23,12 +23,17 @@
namespace gr {
namespace foo {
enum LinkType {
WIFI = 127,
ZIGBEE = 195
};
class FOO_API wireshark_connector : virtual public gr::block
{
public:
typedef boost::shared_ptr<wireshark_connector> sptr;
static sptr make(bool debug= false);
static sptr make(LinkType type, bool debug= false);
};
} // namespace foo
+6 -5
View File
@@ -27,12 +27,13 @@ using namespace gr::foo;
#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",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(uint8_t))),
d_msg_offset(0),
d_debug(debug) {
d_debug(debug),
d_link(type) {
message_port_register_in(pmt::mp("in"));
@@ -43,7 +44,7 @@ wireshark_connector_impl::wireshark_connector_impl(bool debug) :
hdr->thiszone = 0;
hdr->sigfigs = 0;
hdr->snaplen = 65535;
hdr->network = ZIGBEE;
hdr->network = d_link;
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::make(bool debug) {
return gnuradio::get_initial_sptr(new wireshark_connector_impl(debug));
wireshark_connector::make(LinkType type, bool debug) {
return gnuradio::get_initial_sptr(new wireshark_connector_impl(type, debug));
}
+2 -5
View File
@@ -29,8 +29,9 @@ namespace foo {
int d_msg_offset;
int d_msg_len;
char d_msg[256];
LinkType d_link;
public:
wireshark_connector_impl(bool debug);
wireshark_connector_impl(LinkType type, bool debug);
virtual ~wireshark_connector_impl();
int general_work(int noutput, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
@@ -38,10 +39,6 @@ namespace foo {
void copy_message(const char *buf, int len);
};
enum LINK_LAYER_PROTOCOL {
ZIGBEE = 195
};
struct pcap_global {
uint32_t magic_number; /* magic number */
uint16_t version_major; /* major version number */