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
}
Barbu Paul - Gheorghe <barbu.paul.gheorghe[AT]gmail.com> {
Developer documentation improvements
}
and by:

View File

@ -41,6 +41,7 @@ Laurent Deniel <laurent.deniel[AT]free.fr>
Gerald Combs <gerald[AT]wireshark.org>
Guy Harris <guy[AT]alum.mit.edu>
Ulf Lamping <ulf.lamping[AT]web.de>
Barbu Paul - Gheorghe <barbu.paul.gheorghe[AT]gmail.com>
1. Setting up your protocol dissector code.
@ -405,6 +406,16 @@ Pointer-retrieval:
*/
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.
@ -2695,7 +2706,7 @@ upon the conversation index and values inside the request packets.
NOTE: This sections assumes that all information is available to
create a complete conversation, source port/address and
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.
For protocols that negotiate a secondary port connection, for example

View File

@ -111,13 +111,13 @@ WS_DLL_PUBLIC_DEF const gchar version[] = "0.0";
WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void) {
stats_tree_register("udp", /* the proto we are going to "tap" */
"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)*/
0, /* tap listener flags for per-packet callback */
udp_term_stats_tree_packet, /* the per packet callback */
udp_term_stats_tree_init, /* the init callback */
NULL ); /* the cleanup callback (in this case there isn't) */
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) */
st_str_udp_term, /* the name of the menu and window (use "/" for sub menus)*/
0, /* tap listener flags for per-packet callback */
udp_term_stats_tree_packet, /* the per packet callback */
udp_term_stats_tree_init, /* the init callback */
NULL ); /* the cleanup callback (in this case there isn't) */
}
#endif
@ -132,6 +132,9 @@ the stats_tree API
stats_tree_register( tapname, abbr, name, flags, packet_cb, init_cb, cleanup_cb);
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)
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 */
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);
}
WS_DLL_PUBLIC_DEF const gchar version[] = "0.0";
WS_DLL_PUBLIC_DEF void plugin_register_tap_listener(void)
{
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
+register_foo_stat_trees()+.
This in turn calls the +stats_tree_register()+ function, which takes three
strings, and three functions.
This in turn calls the +stats_tree_register_plugin()+ function, which takes three
strings, an integer, and three callback functions.
. 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.
. Flags for per-packet callback
. The function that will called to generate the stats.
. A function that can be called to initialise the stats data.