diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-19 21:47:38 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-19 21:47:38 +0000 |
commit | cd1952d2ecdb3604545458074f7575b64f93e5ee (patch) | |
tree | 454ecd0ada3d85ba12f7dfe525a717c54219a890 /packet-raw.c | |
parent | 14d71d89864c847654382f55f2063e4d3e70d524 (diff) | |
download | wireshark-cd1952d2ecdb3604545458074f7575b64f93e5ee.tar.gz wireshark-cd1952d2ecdb3604545458074f7575b64f93e5ee.tar.bz2 wireshark-cd1952d2ecdb3604545458074f7575b64f93e5ee.zip |
Convert dissect_raw() to use tvbuff's.
svn path=/trunk/; revision=1987
Diffstat (limited to 'packet-raw.c')
-rw-r--r-- | packet-raw.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/packet-raw.c b/packet-raw.c index 5a3497751d..7730d27436 100644 --- a/packet-raw.c +++ b/packet-raw.c @@ -1,7 +1,7 @@ /* packet-raw.c * Routines for raw packet disassembly * - * $Id: packet-raw.c,v 1.15 2000/05/19 05:29:42 guy Exp $ + * $Id: packet-raw.c,v 1.16 2000/05/19 21:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -57,27 +57,31 @@ capture_raw( const u_char *pd, packet_counts *ld ) { } void -dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { - proto_tree *fh_tree; - proto_item *ti; +dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *fh_tree; + proto_item *ti; + tvbuff_t *next_tvb; + const guint8 *next_pd; + int next_offset; /* load the top pane info. This should be overwritten by the next protocol in the stack */ - if(check_col(fd, COL_RES_DL_SRC)) - col_add_str(fd, COL_RES_DL_SRC, "N/A" ); - if(check_col(fd, COL_RES_DL_DST)) - col_add_str(fd, COL_RES_DL_DST, "N/A" ); - if(check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "N/A" ); - if(check_col(fd, COL_INFO)) - col_add_str(fd, COL_INFO, "Raw packet data" ); + if(check_col(pinfo->fd, COL_RES_DL_SRC)) + col_add_str(pinfo->fd, COL_RES_DL_SRC, "N/A" ); + if(check_col(pinfo->fd, COL_RES_DL_DST)) + col_add_str(pinfo->fd, COL_RES_DL_DST, "N/A" ); + if(check_col(pinfo->fd, COL_PROTOCOL)) + col_add_str(pinfo->fd, COL_PROTOCOL, "N/A" ); + if(check_col(pinfo->fd, COL_INFO)) + col_add_str(pinfo->fd, COL_INFO, "Raw packet data" ); /* populate a tree in the second pane with the status of the link layer (ie none) */ - if(tree) { - ti = proto_tree_add_text(tree, NullTVB, 0, 0, "Raw packet data" ); + if (tree) { + ti = proto_tree_add_text(tree, tvb, 0, 0, "Raw packet data" ); fh_tree = proto_item_add_subtree(ti, ett_raw); - proto_tree_add_text(fh_tree, NullTVB, 0, 0, "No link information available"); + proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); } /* So far, the only time we get raw connection types are with Linux and @@ -88,10 +92,15 @@ dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header * sometimes. This check should be removed when 2.2 is out. */ - if (pd[0] == 0xff && pd[1] == 0x03) - dissect_ip(pd, 4, fd, tree); - else - dissect_ip(pd, 0, fd, tree); + if (tvb_get_ntohs(tvb, 0) == 0xff03) { + next_tvb = tvb_new_subset(tvb, 4, -1, -1); + tvb_compat(next_tvb, &next_pd, &next_offset); + } + else { + tvb_compat(tvb, &next_pd, &next_offset); + } + + dissect_ip(next_pd, next_offset, pinfo->fd, tree); } void |