Hi, I recently used the asn2wrs to create a new asn1 dissector (thanks for that wonderful tool). The problem I have is that I would like to modify how an integer value is displayed in the wireshark pane for a specific field. For example, the value that is displayed is “70390700” which is the good value but I would like to display it to the user in a different way because it represents an ip address. 70390700 (decimal value) = 04 32 13 AC (hex value) –> 4 50 19 172, and I would like to have “172.19.50.4” displayed into the wireshark pane. Can you give me some help on how I could achieve that? asked 06 Nov '14, 08:48 badam71 edited 07 Nov '14, 10:25 |
One Answer:
Use the #TYPE_ATTR directive,see the sources for examples. answered 06 Nov '14, 13:46 Anders ♦ |
I added the following lines to my .cnf:
#.TYPE_ATTR Ip4AddressType TYPE = FT_IPv4 DISPLAY = BASE_NONE STRINGS = NULL
But the IP address is still displayed as "4.50.19.172" instead of "172.19.50.4".
Hmm it's the endianess thet's the problem you will have to replace the generated dissection by your own in the .cnf file.
I am not sure how do do that... My dissector (automatically generated) looks like this in the packet-foo.c file.
I found that the “dissect_per_octet_string()” function was using ENC_BIG_ENDIAN. For now I solved this issue by adding a special case for the type “FT_IPv4” which will now use ENC_LITTLE_ENDIAN instead.