Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Documentation : 9.6. How to produce protocol stats

From: wsgd <wsgd@xxxxxxx>
Date: Sun, 20 Dec 2020 10:32:48 +0100
Hello all,


Questions/remarks about https://www.wireshark.org/docs/wsdg_html_chunked/ChDissectStats.html


1) An include is missing :
Solution :
Add #include <epan/stats_tree.h>


2) msgtypevalues does not exist
Solution :
Replace "msgtypevalues" by "packettypenames"
 to be conform with previous § 9.2.3. Improving the dissection information (https://www.wireshark.org/docs/wsdg_html_chunked/ChDissectAdd.html)


3) st_node_packets = stats_tree_create_node(st, st_str_packets, 0, TRUE); does not compile
Solution :
Replace it by :
    st_node_packets = stats_tree_create_node(st, st_str_packets, 0, STAT_DT_INT, TRUE);


4) foo_stats_tree_packet has bad prototype
Solution :
foo_stats_tree_packet should return tap_packet_status / TAP_PACKET_REDRAW (instead of int / 1)



About register_foo_stat_trees

5) WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void) does not compile : 1>T:\wireshark\dev\build_sources_3.4--win64\wireshark\plugins\epan\foo\packet-foo.c(192,1): error C2491: 'plugin_register_tap_listener' : définition de fonction dllimport non autorisée
1>Génération du projet "foo.vcxproj" terminée -- ÉCHEC.
"Solution" :
Use __declspec(dllexport) instead of WS_DLL_PUBLIC_DEF


6) __declspec(dllexport) void plugin_register_tap_listener(void) is never called
Solution ? :
- remove it
- call directly register_foo_stat_trees(); from proto_reg_handoff_foo

It is the good way to do ?


Thanks,
Olivier