Revision history [back]
Capitalising hex strings in dissector field output?
Hello,
Is there a way to capitalise hex output in the field output like we can with the string formatter "0x%04X"?
I'm using that to add the details to the INFO column but not sure how to get similar formatting in the dissected fields:
PACKED_SIM_GROUP_M3UA_S (0xCFDC) from IPDU-3 to GISU-7 via EMB-0
For example, I have the field is being output like below:
DMX message number: PACKED_SIM_GROUP_M3UA_S (0xcfdc)
But I'd prefer to have the hex number printed as 0xCFDC (just makes it simpler for us to see the message number).
I am poking around the source for proto_tree_add_item to pin down where the actual hex digit printing occurs ... haven't figured it out yet.
In my dissector I'm doing this:
static const value_string dmxMessageNumber[] = {
...
{ 0xCFDC, "PACKED_SIM_GROUP_M3UA_S" },
...
};
proto_tree_add_item(dmx_tree, hf_emb_msg_header_t_number, tvb,
offset, 2, ENC_LITTLE_ENDIAN);
...
{ &hf_emb_msg_header_t_number,
{"DMX message number", "emb.dmx.number",
FT_UINT16, BASE_HEX, VALS(dmxMessageNumber),
0x0, "DX message number (message_number_t)", HFILL}},
Thanks, Brett.