In the protocol tree entries for lists of fragments/segments, make the
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 27 Mar 2002 04:27:05 +0000 (04:27 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 27 Mar 2002 04:27:05 +0000 (04:27 +0000)
top-level item correspond to the reassembled data, and make the item for
each fragment/segment correspond to the part of that reassembled data
that came from that fragment/segment.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5025 f5534014-38df-0310-8fa8-9805f1628bb7

packet-clnp.c
packet-ip.c
packet-ipv6.c
packet-rpc.c
packet-smb-pipe.c
packet-smb.c
packet-tcp.c

index c1ad6ac5d54ce6392e3387ed986ae7ec26804c7e..025504622a5ae570aea7d42ec8b6d201a0503daf 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-clnp.c
  * Routines for ISO/OSI network and transport protocol packet disassembly
  *
- * $Id: packet-clnp.c,v 1.50 2002/02/27 05:45:48 guy Exp $
+ * $Id: packet-clnp.c,v 1.51 2002/03/27 04:27:03 guy Exp $
  * Laurent Deniel <deniel@worldnet.fr>
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
@@ -1832,10 +1832,25 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
       proto_tree *ft=NULL;
       proto_item *fi=NULL;
 
-      /* OK, we have the complete reassembled payload. */
+      /* OK, we have the complete reassembled payload.
+         Allocate a new tvbuff, referring to the reassembled payload. */
+      next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen,
+       fd_head->datalen);
+
+      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
+         were handed refers, so it'll get cleaned up when that tvbuff
+         is cleaned up. */
+      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+
+      /* Add the defragmented data to the data source list. */
+      add_new_data_source(pinfo->fd, next_tvb, "Reassembled CLNP");
+
+      /* It's not fragmented. */
+      pinfo->fragmented = FALSE;
+
       /* show all segments */
       fi = proto_tree_add_item(clnp_tree, hf_clnp_segments, 
-                tvb, 0, 0, FALSE);
+                next_tvb, 0, -1, FALSE);
       ft = proto_item_add_subtree(fi, ett_clnp_segments);
       for (fd = fd_head->next; fd != NULL; fd = fd->next){
         if (fd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
@@ -1854,7 +1869,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             hf = hf_clnp_segment;
           }
           fei = proto_tree_add_none_format(ft, hf, 
-                   tvb, 0, 0,
+                   next_tvb, fd->offset, fd->len,
                    "Frame:%u payload:%u-%u",
                    fd->frame,
                    fd->offset,
@@ -1863,28 +1878,28 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
           fet = proto_item_add_subtree(fei, ett_clnp_segment);
           if (fd->flags&FD_OVERLAP) {
             proto_tree_add_boolean(fet, 
-                 hf_clnp_segment_overlap, tvb, 0, 0, 
+                 hf_clnp_segment_overlap, next_tvb, 0, 0, 
                  TRUE);
           }
           if (fd->flags&FD_OVERLAPCONFLICT) {
             proto_tree_add_boolean(fet, 
-                 hf_clnp_segment_overlap_conflict, tvb, 0, 0, 
+                 hf_clnp_segment_overlap_conflict, next_tvb, 0, 0, 
                  TRUE);
           }
           if (fd->flags&FD_MULTIPLETAILS) {
             proto_tree_add_boolean(fet, 
-                 hf_clnp_segment_multiple_tails, tvb, 0, 0, 
+                 hf_clnp_segment_multiple_tails, next_tvb, 0, 0, 
                  TRUE);
           }
           if (fd->flags&FD_TOOLONGFRAGMENT) {
             proto_tree_add_boolean(fet, 
-                 hf_clnp_segment_too_long_segment, tvb, 0, 0, 
+                 hf_clnp_segment_too_long_segment, next_tvb, 0, 0, 
                  TRUE);
           }
         } else {
           /* nothing of interest for this segment */
           proto_tree_add_none_format(ft, hf_clnp_segment, 
-                   tvb, 0, 0,
+                   next_tvb, fd->offset, fd->len,
                    "Frame:%u payload:%u-%u",
                    fd->frame,
                    fd->offset,
@@ -1899,21 +1914,6 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
           update_col_info = FALSE;
         }
       }
-
-      /* Allocate a new tvbuff, referring to the reassembled payload. */
-      next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen,
-       fd_head->datalen);
-
-      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
-         were handed refers, so it'll get cleaned up when that tvbuff
-         is cleaned up. */
-      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
-
-      /* Add the defragmented data to the data source list. */
-      add_new_data_source(pinfo->fd, next_tvb, "Reassembled CLNP");
-
-      /* It's not fragmented. */
-      pinfo->fragmented = FALSE;
     } else {
       /* We don't have the complete reassembled payload. */
       next_tvb = NULL;
index e8d9f7daaa1c4e2e753d76d9a5dd20ebdb20a048..c0e5b837be687cf1d7c36e97edeb3ded31580184 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ip.c
  * Routines for IP and miscellaneous IP protocol packet disassembly
  *
- * $Id: packet-ip.c,v 1.163 2002/02/27 05:45:48 guy Exp $
+ * $Id: packet-ip.c,v 1.164 2002/03/27 04:27:03 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -984,10 +984,25 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
       proto_tree *ft=NULL;
       proto_item *fi=NULL;
 
-      /* OK, we have the complete reassembled payload. */
+      /* OK, we have the complete reassembled payload.
+         Allocate a new tvbuff, referring to the reassembled payload. */
+      next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
+       ipfd_head->datalen);
+
+      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
+         were handed refers, so it'll get cleaned up when that tvbuff
+         is cleaned up. */
+      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+
+      /* Add the defragmented data to the data source list. */
+      add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv4");
+
+      /* It's not fragmented. */
+      pinfo->fragmented = FALSE;
+
       /* show all fragments */
       fi = proto_tree_add_item(ip_tree, hf_ip_fragments, 
-                tvb, 0, 0, FALSE);
+                next_tvb, 0, -1, FALSE);
       ft = proto_item_add_subtree(fi, ett_ip_fragments);
       for (ipfd=ipfd_head->next; ipfd; ipfd=ipfd->next){
         if (ipfd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
@@ -1006,7 +1021,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
             hf = hf_ip_fragment;
           }
           fei = proto_tree_add_none_format(ft, hf, 
-                   tvb, 0, 0,
+                   next_tvb, ipfd->offset, ipfd->len,
                    "Frame:%u payload:%u-%u",
                    ipfd->frame,
                    ipfd->offset,
@@ -1015,28 +1030,28 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
           fet = proto_item_add_subtree(fei, ett_ip_fragment);
           if (ipfd->flags&FD_OVERLAP) {
             proto_tree_add_boolean(fet, 
-                 hf_ip_fragment_overlap, tvb, 0, 0, 
+                 hf_ip_fragment_overlap, next_tvb, 0, 0, 
                  TRUE);
           }
           if (ipfd->flags&FD_OVERLAPCONFLICT) {
             proto_tree_add_boolean(fet, 
-                 hf_ip_fragment_overlap_conflict, tvb, 0, 0, 
+                 hf_ip_fragment_overlap_conflict, next_tvb, 0, 0, 
                  TRUE);
           }
           if (ipfd->flags&FD_MULTIPLETAILS) {
             proto_tree_add_boolean(fet, 
-                 hf_ip_fragment_multiple_tails, tvb, 0, 0, 
+                 hf_ip_fragment_multiple_tails, next_tvb, 0, 0, 
                  TRUE);
           }
           if (ipfd->flags&FD_TOOLONGFRAGMENT) {
             proto_tree_add_boolean(fet, 
-                 hf_ip_fragment_too_long_fragment, tvb, 0, 0, 
+                 hf_ip_fragment_too_long_fragment, next_tvb, 0, 0, 
                  TRUE);
           }
         } else {
           /* nothing of interest for this fragment */
           proto_tree_add_none_format(ft, hf_ip_fragment, 
-                   tvb, 0, 0,
+                   next_tvb, ipfd->offset, ipfd->len,
                    "Frame:%u payload:%u-%u",
                    ipfd->frame,
                    ipfd->offset,
@@ -1051,21 +1066,6 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
           update_col_info = FALSE;
         }
       }
-
-      /* Allocate a new tvbuff, referring to the reassembled payload. */
-      next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
-       ipfd_head->datalen);
-
-      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
-         were handed refers, so it'll get cleaned up when that tvbuff
-         is cleaned up. */
-      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
-
-      /* Add the defragmented data to the data source list. */
-      add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv4");
-
-      /* It's not fragmented. */
-      pinfo->fragmented = FALSE;
     } else {
       /* We don't have the complete reassembled payload. */
       next_tvb = NULL;
index 2d23f17e69e1d6e95c0fb0bf8d4b9881811445e1..7bd4c257e720b087e60dba477764e789c1adc864 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ipv6.c
  * Routines for IPv6 packet disassembly
  *
- * $Id: packet-ipv6.c,v 1.78 2002/02/27 05:45:48 guy Exp $
+ * $Id: packet-ipv6.c,v 1.79 2002/03/27 04:27:03 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -823,10 +823,25 @@ again:
       proto_tree *ft = NULL;
       proto_item *fi = NULL;
 
-      /* OK, we have the complete reassembled payload. */
+      /* OK, we have the complete reassembled payload.
+         Allocate a new tvbuff, referring to the reassembled payload. */
+      next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
+       ipfd_head->datalen);
+
+      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
+         were handed refers, so it'll get cleaned up when that tvbuff
+         is cleaned up. */
+      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+
+      /* Add the defragmented data to the data source list. */
+      add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv6");
+
+      /* It's not fragmented. */
+      pinfo->fragmented = FALSE;
+
       /* show all fragments */
       fi = proto_tree_add_item(ipv6_tree, hf_ipv6_fragments,
-                tvb, 0, 0, FALSE);
+                next_tvb, 0, -1, FALSE);
       ft = proto_item_add_subtree(fi, ett_ipv6_fragments);
       for (ipfd = ipfd_head->next; ipfd; ipfd = ipfd->next){
         if (ipfd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
@@ -845,7 +860,7 @@ again:
             hf = hf_ipv6_fragment;
           }
           fei = proto_tree_add_none_format(ft, hf,
-                   tvb, 0, 0,
+                   next_tvb, ipfd->offset, ipfd->len,
                    "Frame:%u payload:%u-%u",
                    ipfd->frame,
                    ipfd->offset,
@@ -854,28 +869,28 @@ again:
           fet = proto_item_add_subtree(fei, ett_ipv6_fragment);
           if (ipfd->flags&FD_OVERLAP) {
             proto_tree_add_boolean(fet,
-                 hf_ipv6_fragment_overlap, tvb, 0, 0,
+                 hf_ipv6_fragment_overlap, next_tvb, 0, 0,
                  TRUE);
           }
           if (ipfd->flags&FD_OVERLAPCONFLICT) {
             proto_tree_add_boolean(fet,
-                 hf_ipv6_fragment_overlap_conflict, tvb, 0, 0,
+                 hf_ipv6_fragment_overlap_conflict, next_tvb, 0, 0,
                  TRUE);
           }
           if (ipfd->flags&FD_MULTIPLETAILS) {
             proto_tree_add_boolean(fet,
-                 hf_ipv6_fragment_multiple_tails, tvb, 0, 0,
+                 hf_ipv6_fragment_multiple_tails, next_tvb, 0, 0,
                  TRUE);
           }
           if (ipfd->flags&FD_TOOLONGFRAGMENT) {
             proto_tree_add_boolean(fet,
-                 hf_ipv6_fragment_too_long_fragment, tvb, 0, 0,
+                 hf_ipv6_fragment_too_long_fragment, next_tvb, 0, 0,
                  TRUE);
           }
         } else {
           /* nothing of interest for this fragment */
           proto_tree_add_none_format(ft, hf_ipv6_fragment,
-                   tvb, 0, 0,
+                   next_tvb, ipfd->offset, ipfd->len,
                    "Frame:%u payload:%u-%u",
                    ipfd->frame,
                    ipfd->offset,
@@ -890,21 +905,6 @@ again:
           update_col_info = FALSE;
         }
       }
-
-      /* Allocate a new tvbuff, referring to the reassembled payload. */
-      next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
-       ipfd_head->datalen);
-
-      /* Add the tvbuff to the list of tvbuffs to which the tvbuff we
-         were handed refers, so it'll get cleaned up when that tvbuff
-         is cleaned up. */
-      tvb_set_child_real_data_tvbuff(tvb, next_tvb);
-
-      /* Add the defragmented data to the data source list. */
-      add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv6");
-
-      /* It's not fragmented. */
-      pinfo->fragmented = FALSE;
     } else {
       /* We don't have the complete reassembled payload. */
       next_tvb = NULL;
index 108f218cfddb9d363862db54ed863a6e5183e4af..40e3ac6185b21fef014c768e3e77940593920887 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for rpc dissection
  * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
  * 
- * $Id: packet-rpc.c,v 1.87 2002/02/18 23:51:55 guy Exp $
+ * $Id: packet-rpc.c,v 1.88 2002/03/27 04:27:03 guy Exp $
  * 
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -2207,10 +2207,10 @@ show_rpc_fraginfo(tvbuff_t *tvb, tvbuff_t *frag_tvb, proto_tree *tree,
                /*
                 * Show a tree with information about all fragments.
                 */
-               si = proto_tree_add_text(tree, tvb, 0, 0, "Fragments");
+               si = proto_tree_add_text(tree, tvb, 0, -1, "Fragments");
                st = proto_item_add_subtree(si, ett_rpc_fragments);
                for (ipfd = ipfd_head->next; ipfd != NULL; ipfd = ipfd->next) {
-                       proto_tree_add_text(st, tvb, 0, 0,
+                       proto_tree_add_text(st, tvb, ipfd->offset, ipfd->len,
                            "Frame:%u [%u-%u]",
                            ipfd->frame,
                            ipfd->offset,
index ed88de56be039350622b84b4e60cd191fe9ca1b7..5cc10204655fadcf2f7d80cd189f756e1bf6e679 100644 (file)
@@ -8,7 +8,7 @@ XXX  Fixme : shouldnt show [malformed frame] for long packets
  * significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
  * Guy Harris 2001
  *
- * $Id: packet-smb-pipe.c,v 1.71 2002/03/16 04:39:28 sahlberg Exp $
+ * $Id: packet-smb-pipe.c,v 1.72 2002/03/27 04:27:03 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -3203,11 +3203,13 @@ dissect_pipe_dcerpc(tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree
                        d_tvb=new_tvb;
 
                        /* list what segments we have */
-                       it = proto_tree_add_text(tree, d_tvb, 0, 0, "Fragments");
+                       it = proto_tree_add_text(tree, d_tvb, 0, -1, "Fragments");
                        tr = proto_item_add_subtree(it, ett_smb_pipe_fragments);
                        for(fd=fd_head->next;fd;fd=fd->next){
-                               proto_tree_add_text(tr, d_tvb, 0, 0, "Frame:%u Data:%u-%u",
-                                           fd->frame, fd->offset, fd->offset+fd->len-1);
+                               proto_tree_add_text(tr, d_tvb, fd->offset, fd->len,
+                                           "Frame:%u Data:%u-%u",
+                                           fd->frame, fd->offset,
+                                           fd->offset+fd->len-1);
                        }
                }
        }
index b37770c4637fb422da0700f89f39303af2130e61..3f438615934a55cb22788d922c4c756a3517db6c 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  * 2001  Rewrite by Ronnie Sahlberg and Guy Harris
  *
- * $Id: packet-smb.c,v 1.236 2002/03/26 08:23:58 guy Exp $
+ * $Id: packet-smb.c,v 1.237 2002/03/27 04:27:04 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -7964,18 +7964,20 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
                proto_item *it;
                fragment_data *fd;
                
-               it = proto_tree_add_text(tree, tvb, 0, 0, "Fragments");
-               tr = proto_item_add_subtree(it, ett_smb_segments);
-               for(fd=r_fd->next;fd;fd=fd->next){
-                       proto_tree_add_text(tr, tvb, 0, 0, "Frame:%u Data:%u-%u",
-                                           fd->frame, fd->offset, fd->offset+fd->len-1);
-               }
-               
                pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
                                             r_fd->datalen);
                tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
                add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
                pinfo->fragmented = FALSE;
+
+               it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments");
+               tr = proto_item_add_subtree(it, ett_smb_segments);
+               for(fd=r_fd->next;fd;fd=fd->next){
+                       proto_tree_add_text(tr, pd_tvb, fd->offset, fd->len,
+                                           "Frame:%u Data:%u-%u",
+                                           fd->frame, fd->offset,
+                                           fd->offset+fd->len-1);
+               }
        }
 
 
@@ -11856,19 +11858,21 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
                proto_tree *tr;
                proto_item *it;
                fragment_data *fd;
-               
-               it = proto_tree_add_text(tree, tvb, 0, 0, "Fragments");
-               tr = proto_item_add_subtree(it, ett_smb_segments);
-               for(fd=r_fd->next;fd;fd=fd->next){
-                       proto_tree_add_text(tr, tvb, 0, 0, "Frame:%u Data:%u-%u",
-                                           fd->frame, fd->offset, fd->offset+fd->len-1);
-               }
-               
+
                pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
                                             r_fd->datalen);
                tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
                add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
                pinfo->fragmented = FALSE;
+
+               it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments");
+               tr = proto_item_add_subtree(it, ett_smb_segments);
+               for(fd=r_fd->next;fd;fd=fd->next){
+                       proto_tree_add_text(tr, pd_tvb, fd->offset, fd->len,
+                                           "Frame:%u Data:%u-%u",
+                                           fd->frame, fd->offset,
+                                           fd->offset+fd->len-1);
+               }
        }
 
 
index b0b046c3465fc67d8e958e9a34ea51a44f352da2..153cf3aa07a352b47fa5c23e09571e90b1f9393d 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-tcp.c
  * Routines for TCP packet disassembly
  *
- * $Id: packet-tcp.c,v 1.134 2002/02/24 02:59:30 guy Exp $
+ * $Id: packet-tcp.c,v 1.135 2002/03/27 04:27:05 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -471,11 +471,12 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
                                 * end may, in turn, require desegmentation),
                                 * so we show a tree with all segments.
                                 */
-                               si = proto_tree_add_text(tcp_tree, tvb, 0, 0,
-                                               "Segments");
+                               si = proto_tree_add_text(tcp_tree, next_tvb,
+                                               0, -1, "Segments");
                                st = proto_item_add_subtree(si, ett_tcp_segments);
                                for(ipfd=ipfd_head->next; ipfd; ipfd=ipfd->next){
-                                       proto_tree_add_text(st, tvb, 0, 0,
+                                       proto_tree_add_text(st, next_tvb,
+                                       ipfd->offset, ipfd->len,
                                        "Frame:%u seq#:%u-%u [%u-%u]",
                                        ipfd->frame,
                                        tsk->start_seq + ipfd->offset,