I have a plugin code for older wireshark version, when I use it in V-1.99 it gives these errors
how shall I solve them? asked 12 Jun '14, 12:08 aman edited 12 Jun '14, 13:31 Guy Harris ♦♦ |
One Answer:
First of all check_col function does not exist anymore so you should remove its call (and assume that it always returns true). Then decode_boolean_bitfield function was also removed. I guess it is used by some call to proto_tree_add_text right? Replace it by a FT_BOOLEAN filterable hf entry instead. Or build the string yourself (the old code for this function can be found here). Finally check new_dissector_t definition in epan\packet.h (hint: the return type differs and you miss 1 parameter). answered 12 Jun '14, 13:22 Pascal Quantin showing 5 of 16 show 11 more comments |
"New-style" dissectors now take an additional "private data" argument. You would have to change any such dissectors to take an additional
void *
argument; you don't have to use the argument.for check_col I have code
if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo,COL_INFO,"Indicator_Update "); }
how shall I make it compatible with current version?
Yes, decode_boolean_bitfield function is used by proto_tree_add_text. when I replace decode_boolean_bitfield with FT_boolean it says no such function found.
As per the instructions from @Pascal Quantin, assume check_col returns true, so either replace it with "1" or remove the conditional entirely, i.e. simply a call to
col_append_fstr(...)
.In the call to
proto_tree_add_text()
you have to add an hf element whose type is FT_BOOLEAN. If you post the relevant piece of code we can help further.thats the part..
if (tempValue & G711_ULAW64) proto_tree_add_text(reg_codec, tvb, offset+36, 4, "%s", decode_boolean_bitfield(tempValue, G711_ULAW64, 32, "G.711 PCMU",""));
@grahamb I can see an update 10 mins ago here, but no comment. please re post your last comment.
For the bitfield, you would first need to declare
and then declare a header field variable
and then, in your dissector's
hf[]
array containing the named fields for your protocol, addand then do
"myprotocolname" is the same name for the protocol that you are using for other named fields.
I have done the declaration part but cant figure out where to use the hf[] code in packet.h file.
If your dissector already has a call to
proto_register_field_array()
, it already has anhf[]
array; just add it to that array.If your dissector does not already have a call to
proto_register_field_array()
, it presumably was using onlyproto_tree_add_text()
, and it needs to be fixed to use named fields. Read thedoc/README.dissector
document, which discusses how to create a dissector that uses named fields.I have declared
I am getting this:
You did put
in the exact same place in your code where the
was before, right?
If not, do so.
yes I did..
Then your code probably wouldn’t have compiled even with an older version of Wireshark, because, if you really did replace
with
so that both of those sequences of code are in exactly the same place in your code, the references to
tempValue
andreg_codec
are the same, and would therefore get exactly the same errors.the above part of code you wrote doesnt run in the code too.. I am getting parameter error with tempValue and proto* tree
I don’t know what you mean by “the above part of code you wrote doesnt run in the code too”.
The
part is a direct copy and paste (other than tweaking the formatting) of code you said, in a comment above, was the code using
decode_boolean_bitfield()
. Are you saying that code doesn’t “run”? If so, then, as I said, your dissector wouldn’t have worked even with an older version of Wireshark.It might help if you just put your entire dissector up on a site such as pastebin, so we can see all of the code, in context, rather than seeing snippets taken out of context.
@aman: You had a lot of problems compiling Wireshark and your dissector in the last couple of days.
Wouldn’t it be much easier if you upload your dissector code to github, google code, sourceforge, or similar? Maybe that speeds up things, if you find a person that is willing to help you with the code and the problems you are facing.
@guy thanks alot, I fixed it.. there was some parameter issue.. thanks for your help.. @kurt for sure, it I have any further problems, I ll update it on github and consult you guys.. thanks for help..