aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/README.tvbuff16
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/README.tvbuff b/doc/README.tvbuff
index 3284e98a73..2fc0b9e494 100644
--- a/doc/README.tvbuff
+++ b/doc/README.tvbuff
@@ -1,4 +1,4 @@
-$Id: README.tvbuff,v 1.3 2000/06/08 03:03:43 gram Exp $
+$Id: README.tvbuff,v 1.4 2000/06/15 03:49:00 gram Exp $
TVBUFFs and Exceptions
@@ -168,7 +168,7 @@ not. This code snippet shows how:
....
- next_tvb = tvb_new_subset(tvb, offset_of_next_protocol, -1);
+ next_tvb = tvb_new_subset(tvb, offset_of_next_protocol, -1, -1);
tvb_compat(next_tvb, &next_pd, &next_offset);
That is, next_pd and next_offset will get assigned values relative to
@@ -183,9 +183,13 @@ to use tvbuffs. The dissector can create its own tvbuff by
using pi.compat_top_tvb, which is the top-level tvbuff created
in dissect_packet(). "compat_top_tvb" will only be available during
the conversion process; once all dissector have been converted to use
-tvbuff's, that variable will disappear. Here is an example, from
-packet-cops.c, of how to create your own tvbuff. The use of
-the #if/#endif block is optional.
+tvbuff's, that variable will disappear.
+
+A macro called tvb_create_from_top() has been provided to ease
+your work. It takes one argument --- the name of the offset variable.
+
+Here is an example, from packet-cops.c, of how to create your own
+tvbuff. The use of the #if/#endif block is optional.
/* Code to actually dissect the packets */
#if 0
@@ -198,7 +202,7 @@ dissect_cops(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
tvbuff_t *tvb;
packet_info *pinfo = π
- tvb = tvb_new_subset(pinfo->compat_top_tvb, offset, -1, -1);
+ tvb = tvb_create_from_top(offset);
#endif
Once we convert all the dissector-table dissectors, the second