improved the developer documentation

* tvb_*_length mentioned in README.dissector
* fixed typos in README.dissector
* using stats_tree_register_plugin in the stats_tree examples both in README.stats_tree and the dev guide
* removed the version information and the #endif from the stats tree section in README.dissector

Change-Id: I27df0b5dfd66a7c0ac5b0fe1bdc882b3e9ffda74
Reviewed-on: https://code.wireshark.org/review/12908
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Barbu Paul - Gheorghe 2015-12-29 11:20:49 +02:00 committed by Michael Mann
parent d1b46d9d54
commit cef51084f2
4 changed files with 43 additions and 27 deletions

View File

@ -3669,6 +3669,10 @@ Guillaume Autran <gautran[AT]clearpathrobotics.com> {
TCPROS support TCPROS support
} }
Barbu Paul - Gheorghe <barbu.paul.gheorghe[AT]gmail.com> {
Developer documentation improvements
}
and by: and by:

View File

@ -41,6 +41,7 @@ Laurent Deniel <laurent.deniel[AT]free.fr>
Gerald Combs <gerald[AT]wireshark.org> Gerald Combs <gerald[AT]wireshark.org>
Guy Harris <guy[AT]alum.mit.edu> Guy Harris <guy[AT]alum.mit.edu>
Ulf Lamping <ulf.lamping[AT]web.de> Ulf Lamping <ulf.lamping[AT]web.de>
Barbu Paul - Gheorghe <barbu.paul.gheorghe[AT]gmail.com>
1. Setting up your protocol dissector code. 1. Setting up your protocol dissector code.
@ -405,6 +406,16 @@ Pointer-retrieval:
*/ */
guint8* tvb_get_ptr(tvbuff_t *tvb, gint offset, gint length); guint8* tvb_get_ptr(tvbuff_t *tvb, gint offset, gint length);
Length query:
Get amount of captured data in the buffer (which is *NOT* necessarily the
length of the packet). You probably want tvb_reported_length instead:
guint tvb_captured_length(const tvbuff_t *tvb);
Get reported length of buffer:
guint tvb_reported_length(const tvbuff_t *tvb);
1.4 Functions to handle columns in the traffic summary window. 1.4 Functions to handle columns in the traffic summary window.
@ -2695,7 +2706,7 @@ upon the conversation index and values inside the request packets.
NOTE: This sections assumes that all information is available to NOTE: This sections assumes that all information is available to
create a complete conversation, source port/address and create a complete conversation, source port/address and
destination port/address. If either the destination port or destination port/address. If either the destination port or
address is know, see section 2.4 Dynamic server port dissector address is known, see section 2.4 Dynamic server port dissector
registration. registration.
For protocols that negotiate a secondary port connection, for example For protocols that negotiate a secondary port connection, for example

View File

@ -111,7 +111,7 @@ WS_DLL_PUBLIC_DEF const gchar version[] = "0.0";
WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void) { WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void) {
stats_tree_register("udp", /* the proto we are going to "tap" */ stats_tree_register_plugin("udp", /* the proto we are going to "tap" */
"udp_terms", /* the abbreviation for this tree (to be used as -z udp_terms,tree) */ "udp_terms", /* the abbreviation for this tree (to be used as -z udp_terms,tree) */
st_str_udp_term, /* the name of the menu and window (use "/" for sub menus)*/ st_str_udp_term, /* the name of the menu and window (use "/" for sub menus)*/
0, /* tap listener flags for per-packet callback */ 0, /* tap listener flags for per-packet callback */
@ -132,6 +132,9 @@ the stats_tree API
stats_tree_register( tapname, abbr, name, flags, packet_cb, init_cb, cleanup_cb); stats_tree_register( tapname, abbr, name, flags, packet_cb, init_cb, cleanup_cb);
registers a new stats tree registers a new stats tree
stats_tree_register_plugin(tapname, abbr, name, flags, packet_cb, init_cb, cleanup_cb);
registers a new stats tree from a plugin
stats_tree_parent_id_by_name( st, parent_name) stats_tree_parent_id_by_name( st, parent_name)
returns the id of a candidate parent node given its name returns the id of a candidate parent node given its name

View File

@ -1060,18 +1060,14 @@ Here is a mechanism to produce statistics from the above TAP interface.
---- ----
/* register all http trees */ /* register all http trees */
static void register_foo_stat_trees(void) { static void register_foo_stat_trees(void) {
stats_tree_register("foo", "foo", "Foo/Packet Types", stats_tree_register_plugin("foo", "foo", "Foo/Packet Types", 0,
foo_stats_tree_packet, foo_stats_tree_init, NULL); foo_stats_tree_packet, foo_stats_tree_init, NULL);
} }
WS_DLL_PUBLIC_DEF const gchar version[] = "0.0";
WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void) WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void)
{ {
register_foo_stat_trees(); register_foo_stat_trees();
} }
#endif
---- ----
==== ====
@ -1079,8 +1075,8 @@ Working from the bottom up, first the plugin interface entry point is defined,
+plugin_register_tap_listener()+. This simply calls the initialisation function +plugin_register_tap_listener()+. This simply calls the initialisation function
+register_foo_stat_trees()+. +register_foo_stat_trees()+.
This in turn calls the +stats_tree_register()+ function, which takes three This in turn calls the +stats_tree_register_plugin()+ function, which takes three
strings, and three functions. strings, an integer, and three callback functions.
. This is the tap name that is registered. . This is the tap name that is registered.
@ -1088,6 +1084,8 @@ strings, and three functions.
. The name of the stats module. A $$'/'$$ character can be used to make sub menus. . The name of the stats module. A $$'/'$$ character can be used to make sub menus.
. Flags for per-packet callback
. The function that will called to generate the stats. . The function that will called to generate the stats.
. A function that can be called to initialise the stats data. . A function that can be called to initialise the stats data.