add a tcp_tree field to packet_info so that we can access the tree from tcp_dissect_p...
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>
Sun, 22 Oct 2006 00:21:40 +0000 (00:21 -0000)
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>
Sun, 22 Oct 2006 00:21:40 +0000 (00:21 -0000)
in tcp_dissect_pdus()  add a field ( tcp.pdu.size ) to the tree that displays the pdu size.

svn path=/trunk/; revision=19655

epan/dissectors/packet-tcp.c
epan/packet.c
epan/packet_info.h

index aa1ffa69a547b66865331c181d2dc3da2df59267..efa8c43aabfe73259724fe0dbacf6a170a0cd341 100644 (file)
@@ -112,6 +112,7 @@ static int hf_tcp_analysis_zero_window_probe = -1;
 static int hf_tcp_analysis_zero_window_probe_ack = -1;
 static int hf_tcp_continuation_to = -1;
 static int hf_tcp_pdu_time = -1;
+static int hf_tcp_pdu_size = -1;
 static int hf_tcp_pdu_last_frame = -1;
 static int hf_tcp_reassembled_in = -1;
 static int hf_tcp_segments = -1;
@@ -1429,6 +1430,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   guint plen;
   guint length;
   tvbuff_t *next_tvb;
+  proto_item *item=NULL;
 
   while (tvb_reported_length_remaining(tvb, offset) != 0) {
     /*
@@ -1478,6 +1480,13 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
       show_reported_bounds_error(tvb, pinfo, tree);
       return;
     }
+    /*
+     * Display the PDU length as a field 
+     */ 
+    item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size, tvb, 0, 0, plen);
+    PROTO_ITEM_SET_GENERATED(item);
+        
+
 
     /* give a hint to TCP where the next PDU starts
      * so that it can attempt to find it in case it starts
@@ -2095,6 +2104,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
            ti = proto_tree_add_item(tree, proto_tcp, tvb, 0, -1, FALSE);
     }
     tcp_tree = proto_item_add_subtree(ti, ett_tcp);
+    pinfo->tcp_tree=tcp_tree;
+
     proto_tree_add_uint_format(tcp_tree, hf_tcp_srcport, tvb, offset, 2, tcph->th_sport,
        "Source port: %s (%u)", get_tcp_port(tcph->th_sport), tcph->th_sport);
     proto_tree_add_uint_format(tcp_tree, hf_tcp_dstport, tvb, offset + 2, 2, tcph->th_dport,
@@ -2832,6 +2843,10 @@ proto_register_tcp(void)
                { &hf_tcp_pdu_time,
                  { "Time until the last segment of this PDU", "tcp.pdu.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
                    "How long time has passed until the last frame of this PDU", HFILL}},
+               { &hf_tcp_pdu_size,
+                 { "PDU Size", "tcp.pdu.size", FT_UINT32, BASE_DEC, NULL, 0x0,
+                   "The size of this PDU", HFILL}},
+
                { &hf_tcp_pdu_last_frame,
                  { "Last frame of this PDU", "tcp.pdu.last_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
                        "This is the last frame of the PDU starting in this segment", HFILL }},
index a68f05e04c42c8b525f9bb62404b39272202674a..1df36c61bf2d4e5de6fbfe8aca862d6aa0458193 100644 (file)
@@ -317,6 +317,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
        edt->pi.annex_a_used = MTP2_ANNEX_A_USED_UNKNOWN;
        edt->pi.profinet_type = 0;
         edt->pi.usb_conv_info = NULL;
+        edt->pi.tcp_tree = NULL;
 
        TRY {
                edt->tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len);
index 53707077e0eb7324c9e91f7a86c76d5db12352c7..43f2d673d3efc6acc33c6c22799fe96d40d06fad 100644 (file)
@@ -175,6 +175,7 @@ typedef struct _packet_info {
   gchar   annex_a_used;
   guint16 profinet_type;       /* the type of PROFINET packet (0: not a PROFINET packet) */
   void *usb_conv_info;
+  void *tcp_tree;              /* proto_tree for the tcp layer */
 } packet_info;
 
 #endif /* __PACKET_INFO_H__ */