forked from osmocom/wireshark
Add "uint" to the list of "u..." types not to use.
Fix the argument lists of the "proto_tree_add_" routines to include the tvbuff argument. svn path=/trunk/; revision=5738
This commit is contained in:
parent
25a058a7b1
commit
6b0931859d
|
@ -1,4 +1,4 @@
|
|||
$Id: README.developer,v 1.53 2002/06/18 20:25:12 guy Exp $
|
||||
$Id: README.developer,v 1.54 2002/06/22 21:00:53 guy Exp $
|
||||
|
||||
This file is a HOWTO for Ethereal developers. It describes how to start coding
|
||||
a Ethereal protocol dissector and the use some of the important functions and
|
||||
|
@ -42,9 +42,10 @@ defined. Also, don't assume you can use "%lld", "%llu", "%llx", or
|
|||
"%llo" to print 64-bit integral data types - not all platforms support
|
||||
"%ll" for printing them.
|
||||
|
||||
Don't use "ulong" or "ushort"; they aren't defined on all platforms. If
|
||||
you want a 32-bit unsigned quantity, use "guint32", and if you want a
|
||||
16-bit unsigned quantity, use "guint16".
|
||||
Don't use "uint", "ulong" or "ushort"; they aren't defined on all
|
||||
platforms. If you want an "int-sized" unsigned quantity, use "uint"; if
|
||||
you want a 32-bit unsigned quantity, use "guint32"; and if you want a
|
||||
16-bit unsigned quantity, use "guint16".
|
||||
|
||||
Don't use a label without a statement following it. For example,
|
||||
something such as
|
||||
|
@ -128,7 +129,7 @@ code inside
|
|||
|
||||
is needed only if you are using the "snprintf()" function.
|
||||
|
||||
The "$Id: README.developer,v 1.53 2002/06/18 20:25:12 guy Exp $"
|
||||
The "$Id: README.developer,v 1.54 2002/06/22 21:00:53 guy Exp $"
|
||||
in the comment will be updated by CVS when the file is
|
||||
checked in; it will allow the RCS "ident" command to report which
|
||||
version of the file is currently checked out.
|
||||
|
@ -138,7 +139,7 @@ version of the file is currently checked out.
|
|||
* Routines for PROTONAME dissection
|
||||
* Copyright 2000, YOUR_NAME <YOUR_EMAIL_ADDRESS>
|
||||
*
|
||||
* $Id: README.developer,v 1.53 2002/06/18 20:25:12 guy Exp $
|
||||
* $Id: README.developer,v 1.54 2002/06/22 21:00:53 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -965,139 +966,139 @@ There are several functions that the programmer can use to add either
|
|||
protocol or field labels to the proto_tree:
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_item(tree, id, start, length, little_endian);
|
||||
proto_tree_add_item(tree, id, tvb, start, length, little_endian);
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_item_hidden(tree, id, start, length, little_endian);
|
||||
proto_tree_add_item_hidden(tree, id, tvb, start, length, little_endian);
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_none_format(tree, id, start, length, format, ...);
|
||||
proto_tree_add_none_format(tree, id, tvb, start, length, format, ...);
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_protocol_format(tree, id, start, length, format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_bytes(tree, id, start, length, start_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_bytes_hidden(tree, id, start, length, start_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_bytes_format(tree, id, start, length, start_ptr,
|
||||
proto_tree_add_protocol_format(tree, id, tvb, start, length,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_time(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_bytes(tree, id, tvb, start, length, start_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_time_hidden(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_bytes_hidden(tree, id, tvb, start, length, start_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_time_format(tree, id, start, length, value_ptr,
|
||||
proto_tree_add_bytes_format(tree, id, tvb, start, length, start_ptr,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipxnet(tree, id, start, length, value);
|
||||
proto_tree_add_time(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipxnet_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_time_hidden(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipxnet_format(tree, id, start, length, value,
|
||||
proto_tree_add_time_format(tree, id, tvb, start, length, value_ptr,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv4(tree, id, start, length, value);
|
||||
proto_tree_add_ipxnet(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv4_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_ipxnet_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv4_format(tree, id, start, length, value,
|
||||
proto_tree_add_ipxnet_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv6(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ipv4(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv6_hidden(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ipv4_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ipv6_format(tree, id, start, length, value_ptr,
|
||||
proto_tree_add_ipv4_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ether(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ipv6(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ether_hidden(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ipv6_hidden(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_ether_format(tree, id, start, length, value_ptr,
|
||||
proto_tree_add_ipv6_format(tree, id, tvb, start, length, value_ptr,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_string(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ether(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_string_hidden(tree, id, start, length, value_ptr);
|
||||
proto_tree_add_ether_hidden(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_string_format(tree, id, start, length, value_ptr,
|
||||
proto_tree_add_ether_format(tree, id, tvb, start, length, value_ptr,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_boolean(tree, id, start, length, value);
|
||||
proto_tree_add_string(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_boolean_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_string_hidden(tree, id, tvb, start, length, value_ptr);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_boolean_format(tree, id, start, length, value,
|
||||
proto_tree_add_string_format(tree, id, tvb, start, length, value_ptr,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_double(tree, id, start, length, value);
|
||||
proto_tree_add_boolean(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_double_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_boolean_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_double_format(tree, id, start, length, value,
|
||||
proto_tree_add_boolean_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_uint(tree, id, start, length, value);
|
||||
proto_tree_add_double(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_uint_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_double_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_uint_format(tree, id, start, length, value,
|
||||
proto_tree_add_double_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int(tree, id, start, length, value);
|
||||
proto_tree_add_uint(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int_hidden(tree, id, start, length, value);
|
||||
proto_tree_add_uint_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int_format(tree, id, start, length, value,
|
||||
proto_tree_add_uint_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int_hidden(tree, id, tvb, start, length, value);
|
||||
|
||||
proto_item *
|
||||
proto_tree_add_int_format(tree, id, tvb, start, length, value,
|
||||
format, ...);
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_text(tree, start, length, format, ...);
|
||||
proto_tree_add_text(tree, tvb, start, length, format, ...);
|
||||
|
||||
proto_item*
|
||||
proto_tree_add_text_valist(tree, start, length, format, ap);
|
||||
proto_tree_add_text_valist(tree, tvb, start, length, format, ap);
|
||||
|
||||
The 'tree' argument is the tree to which the item is to be added. The
|
||||
'start' argument is the offset from the beginning of the frame (not the
|
||||
offset from the beginning of the part of the packet belonging to this
|
||||
protocol, but the offset from the beginning of the frame as a whole) of
|
||||
the item being added, and the 'length' argument is the length, in bytes,
|
||||
of the item.
|
||||
'tvb' argument is the tvbuff from which the item's value is being
|
||||
extracted; the 'start' argument is the offset from the beginning of that
|
||||
tvbuff of the item being added, and the 'length' argument is the length,
|
||||
in bytes, of the item.
|
||||
|
||||
The length of some items cannot be determined until the item has been
|
||||
dissected; to add such an item, add it with a length of -1, and, when the
|
||||
|
@ -1139,7 +1140,7 @@ against the parent field, the first byte of the TH.
|
|||
The code to add the FID to the tree would be;
|
||||
|
||||
guint8 th_0 = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
|
||||
proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, offset, 1, th_0);
|
||||
|
||||
Note: we do not do *any* manipulation of th_0 in order to get the FID value.
|
||||
We just pass it to proto_tree_add_item(). The proto_tree already has
|
||||
|
@ -1364,7 +1365,7 @@ the item the result of applying the arguments to the format string.
|
|||
|
||||
For example, early in the dissection, one might do:
|
||||
|
||||
ti = proto_tree_add_text(tree, offset, length, <label>);
|
||||
ti = proto_tree_add_text(tree, tvb, offset, length, <label>);
|
||||
|
||||
and later do
|
||||
|
||||
|
|
Loading…
Reference in New Issue