How to filter by item?
I developed a proprietary dissector and a packet contains several messages.
proto_body = proto_register_protocol("Body", "BODY", "body");
For each message, I add:
proto_item *ti_body = proto_tree_add_item(tree, proto_body, tvb, HEADER_SIZE, length-4, ENC_NA);
proto_tree *tree_body = proto_item_add_subtree(ti_body, ett_body);
Nevertheless, when I filter, it filters what a packet contain.
If each message has a name and family fields, doing body.name==alex and body.family==human
, it will filter all the packets containing these 2 conditions, but not in the same item.
Let's say it would accept a packet with 2 messages:
[0]
name=marcus
family=human --> condition OK
[1]
name=alex
family=cat --> condition OK
But I want it to filter only if the conditions are true in a single message.
[0]
name=alex --> condition OK
family=cat --> condition OK
Regards,
Thank you very much for you answers!
A frame can contain tens of "body" items, I'd be fine with a macro if I can make it more dynamic.
Or, is there a way to virtually duplicate/split a frame into several frames? I would split all the items into different frames and the filter would work. A bit in a way the packet reassembly works for TCP but opposite. I have a different parser for that but I'd like to keep one application, wireshark if possible.
Thanks!
Are you open to adding some Lua code and a menu item for users to specify the search criteria?
Oops - you could just do it in your dissector code. Add a field (could be hidden) to each
body
for a search string that combinesname
andfamily
(e.g. "alex|human"). Not pretty but probably quicker than experimenting with Chapter 12. MATE which may or may not be a possible solution.Thanks! This request is for a proprietary protocol but I might also contribute to other protocols in wireshark. Do you have a dissector name I can look at?
Adding a hidden field is also feasible for me! Good idea, thanks!
packet-imap.c:
The Ultimate PCAP hasimap
packets.Total displayed packets for
imap.isrequest==1
andimap.isrequest==0
total to displayed for justimap.isrequest
.Examples of adding a string field:
packet-asterix-template.c:
packet-gsm_um.c:
file-file.c:
Perfect! Thank you so much! That speeds up my implementation!