I followed the online example here: http://www.wireshark.org/docs/wsdg_html_chunked/ChDissectAdd.html and managed to get my custom dissector working correctly. My results look like this in wireshark: Status Protocol Serial Number: 0x0000001a57004eaf Reserved: 0 Product ID: Radio Module (3) Capabilities: Unknown (52) Is there a way I can format 0x0000001a57004eaf to look like 00:00:00:1a:57:00:4e:af ? If I can turn the 8 bytes in a string and format it that might work. I'm just not sure where to stick such a function to make it work with the foo example in the tutorial above. It's all still "magic" to me since I blindly followed the tutorial. My other problem is the packets have a varying amount of capabilities. The packets can have any amount of capabilities from 1 to 5. Right now, I'm just reading the first capability because I'm not sure how to get the others. Is there a way to loop to the end of the packet, then proto_tree_add_item the entire array of capabilities? I'd like the capabilities to be on one line, if possible, like this: Capabilities: Human (4), Mobile (3), Trackable (1) But even if they have to be on separate lines, I still need a way to loop through a varying amount of capabilities. asked 31 Jul '13, 08:21 Arwen17 edited 31 Jul '13, 08:35 |
One Answer:
You might get away with calling Assuming you know the length of your overall message and the length of each of your capability items, just loop over them reading data from the tvb, adding the item to the tree and incrementing your byte count (the variable offset in most cases) until the byte count you have read matches the total message length. answered 31 Jul '13, 09:09 grahamb ♦ |
Thank you, that did help me.
http://anonsvn.wireshark.org/wireshark/trunk/epan/tvbuff.c
http://anonsvn.wireshark.org/wireshark/trunk/epan/tvbuff.h
Here's what worked for me:
FT_IPv6 cheat didn't work for me so I have to write my own string. I'm still trying to figure this out. Can I pass a string directly to
proto_tree_add_text()
orproto_tree_add_bytes_format()
? Or do I need to have it stored in atvbuff_t
type?Some example syntax of
proto_tree_add_text()
orproto_tree_add_bytes_format()
would be nice.I wish I could just:
proto_tree_add_text(tree, hf_serial_num, "String!");
EDIT: ok halfway there:
with 0 and 11 being the length of the string and NOT the serial_num.
I used
FT_STRING, BASE_NONE
for serial_num registration.Here's what finally worked for me:
and
After kicking it some more, this made things more beautiful: