|
How would I edit my custom dissector to make it decode bytes and display them as ASCII rather than hex or dec or any of the standard formats? |
|
ASCII is a standard format - use a field of type I had tried that...when I used field types FT_STRING and FT_STRINGZ, nothing is displayed, and when I use FT_UNIT_STRING, I get an error saying: [Dissector bug, protocol PFCP: proto.c:1115: failed assertion "DISSECTOR_ASSERT_NOT_REACHED"] I'm not sure if I possibly did something wrong. Here is my code dealing with this. { &hf_pfcp_ipAddressStr, { "PFCP IP Address String", "pfcp.ipAddressStr", FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, proto_tree_add_item(pfcp_tree, hf_pfcp_ipAddressStr, tvb, offset, 15, ENC_ASCII); offset += 15;
(01 Aug '12, 09:39)
bball2601
OK, this is a bit confusing. FT_UINT_STRING is for "counted" strings, where the string has an integral count of characters, followed by the characters. The length you specify is the length in So what format is the string in?
(01 Aug '12, 09:50)
Guy Harris ♦♦
I'm sorry I'm new to all of this, what do you mean by "what format is the string in"? And I believe the field type I'm going to be wanting to use is FT_STRING, if that makes any difference.
(01 Aug '12, 10:07)
bball2601
Is it:
(01 Aug '12, 10:15)
Guy Harris ♦♦
Its 15 bytes of ASCII, always being 15 bytes. Its supposed to represent an IP address in the 000.000.000.000 format, each byte representing a digit or a period, always making it 15 bytes.
(01 Aug '12, 11:09)
bball2601
So 127.0.0.1 would be represented as 127.000.000.001? OK, then what should work is
and
If that doesn't work, file a bug - and attach a sample capture that exhibits the problem and your dissector code, if possible, as that would make it a lot easier to debug.
(01 Aug '12, 11:49)
Guy Harris ♦♦
I finally got it working. The packets I was using I had individually created with another program, and it seems I created them wrong. Once I tested it with a proper packet, it decoded properly. Thanks for all your help.
(06 Aug '12, 10:16)
bball2601
showing 5 of 7
show 2 more comments
|
