Hi. I have two custom dissectors that i have written. The two protocols i dissect have fields that are very similar to eachother. The headers are different and some other things, but 1 quite large part of the protocol is identical. In my code i have a quite big while-loop that extracts data and adds it to the proto tree, and this loop is identical in both dissectors. Is there an easy way to avoid this duplicated code when writing dissectors? /Kit asked 04 Jul '13, 07:34 Kitg |
One Answer:
In one dissector extract the loop into its own function, parametrise accordingly, and declare the function in a header file for that dissector. In the other dissector, include the header file from the first one and call the function with the appropriate parameters. answered 04 Jul '13, 08:00 grahamb ♦ |
Thanks alot, will do that.