I'm in the process of migrating a custom Wireshark from 1.2.6 to 2.0.3. Yes, I know a huge leap.
I'm trying to figure out use 3 format strings in proto_tree_append_text()
, however when compiling wireshark doesn't like it.
The old code is:
case MY_DECODED_ID:
attr_str = decoder (tvb, offset + 4, len); /* Refers back to the customer decoder function I have */
proto_tree_add_text(tree, tvb, offset, pack_len, "%s %u %s", str, type, attr_str);
This code addresses a value in the transform attributes. attr_str
is listed in the function variables as const char *attr_str
. When this information was decoded in wireshark 1.2.6, it showed the attribute and a 6 digit number for the value (i.e., Decoder ID: 123456).
Currently, the new code is located in the dissect_transform_..._attributes
. I've put the const gchar *attr_str
into the function variables again. So then the new code I have as:
case MY_DECODER_ID:
proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_decoder_id, tvb. offset, optlen, ENC_NA);
attr_str = decoder_id(tvb, offset + 4, len);
proto_tree_append_text(transform_attr_type_item, "%s %u %s", val_to_str(tvb_get_ntohs(tvb, offset), str, type, attr_str, "Unknown %d"));
I have tried the proto_tree_add_string()
, but that didn't help any. I'm looking for some ideas. PS, I am far from being an expert in programming, so if I'm way out of line, it's OK to let me know.
Thanks!
asked 27 May '16, 08:01
ladyslinger
1●1●2●1
accept rate: 0%
edited 27 May '16, 08:29
grahamb ♦
19.8k●3●30●206
And what error did you get?
The error I get is "too many arguments in function 'val_to_str'"