wireshark: When using the ZIGBEE_TAP link type, fill the LQI TLV if the "lqi" pdu dict key is present
This commit is contained in:
committed by
Bastian Bloessl
parent
4190fcd94a
commit
0a34f68565
@@ -148,7 +148,7 @@ wireshark_connector_impl::handle_pdu(pmt::pmt_t pdu) {
|
|||||||
|
|
||||||
case ZIGBEE_TAP:{
|
case ZIGBEE_TAP:{
|
||||||
|
|
||||||
const size_t max_extra_size = sizeof(tap_hdr) + sizeof(tap_tlv_fcs) + sizeof(tap_tlv_channel);
|
const size_t max_extra_size = sizeof(tap_hdr) + sizeof(tap_tlv_fcs) + sizeof(tap_tlv_channel) + sizeof(tap_tlv_lqi);
|
||||||
size_t extra_size = sizeof(tap_hdr) + sizeof(tap_tlv_fcs);
|
size_t extra_size = sizeof(tap_hdr) + sizeof(tap_tlv_fcs);
|
||||||
d_msg = reinterpret_cast<char*>(std::malloc(len + sizeof(pcap_hdr) + max_extra_size));
|
d_msg = reinterpret_cast<char*>(std::malloc(len + sizeof(pcap_hdr) + max_extra_size));
|
||||||
|
|
||||||
@@ -175,7 +175,6 @@ wireshark_connector_impl::handle_pdu(pmt::pmt_t pdu) {
|
|||||||
}
|
}
|
||||||
offset += sizeof(tap_tlv_fcs);
|
offset += sizeof(tap_tlv_fcs);
|
||||||
|
|
||||||
|
|
||||||
pmt::pmt_t dict = pmt::car(pdu);
|
pmt::pmt_t dict = pmt::car(pdu);
|
||||||
if(pmt::dict_has_key(dict, pmt::mp("channel"))) {
|
if(pmt::dict_has_key(dict, pmt::mp("channel"))) {
|
||||||
pmt::pmt_t s = pmt::dict_ref(dict, pmt::mp("channel"), pmt::PMT_NIL);
|
pmt::pmt_t s = pmt::dict_ref(dict, pmt::mp("channel"), pmt::PMT_NIL);
|
||||||
@@ -191,6 +190,21 @@ wireshark_connector_impl::handle_pdu(pmt::pmt_t pdu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(pmt::dict_has_key(dict, pmt::mp("lqi"))) {
|
||||||
|
pmt::pmt_t s = pmt::dict_ref(dict, pmt::mp("lqi"), pmt::PMT_NIL);
|
||||||
|
if(pmt::is_integer(s)) {
|
||||||
|
tap_tlv_lqi *lqi = reinterpret_cast<tap_tlv_lqi*>(d_msg + offset);
|
||||||
|
lqi->type = 10; // LQI
|
||||||
|
lqi->length = 1;
|
||||||
|
lqi->lqi = (uint8_t)pmt::to_long(s);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
lqi->padding[i] = 0;
|
||||||
|
}
|
||||||
|
offset += sizeof(tap_tlv_lqi);
|
||||||
|
extra_size += sizeof(tap_tlv_lqi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tap->length = extra_size;
|
tap->length = extra_size;
|
||||||
hdr->incl_len = len + extra_size;
|
hdr->incl_len = len + extra_size;
|
||||||
hdr->orig_len = len + extra_size;
|
hdr->orig_len = len + extra_size;
|
||||||
|
|||||||
@@ -104,6 +104,15 @@ namespace foo {
|
|||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
struct tap_tlv_lqi {
|
||||||
|
uint16_t type; // LQI_TYPE = 10
|
||||||
|
uint16_t length; // 1
|
||||||
|
uint8_t lqi;
|
||||||
|
uint8_t padding[3]; // Should be 0 padded
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
} // namespace foo
|
} // namespace foo
|
||||||
} // namespace gr
|
} // namespace gr
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user