Call subdissectors even if we're not building a protocol tree.
[obnox/wireshark/wip.git] / packet-frame.c
index 1e434fa780819b943a41b38edc2cffd87ca21758..dc904f8438ae2157a6a04cf99d3a37bec9cb4680 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type.
  *
- * $Id: packet-frame.c,v 1.36 2003/03/03 23:29:57 guy Exp $
+ * $Id: packet-frame.c,v 1.42 2003/12/06 06:09:10 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include "prefs.h"
 #include "tap.h"
 
-static int proto_frame = -1;
-static int hf_frame_arrival_time = -1;
+int proto_frame = -1;
+int hf_frame_arrival_time = -1;
 static int hf_frame_time_delta = -1;
 static int hf_frame_time_relative = -1;
-static int hf_frame_number = -1;
-static int hf_frame_packet_len = -1;
-static int hf_frame_capture_len = -1;
+int hf_frame_number = -1;
+int hf_frame_packet_len = -1;
+int hf_frame_capture_len = -1;
 static int hf_frame_p2p_dir = -1;
 static int hf_frame_file_off = -1;
 static int hf_frame_marked = -1;
+static int hf_frame_ref_time = -1;
 
 static int proto_short = -1;
 int proto_malformed = -1;
@@ -83,7 +84,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                switch (pinfo->fd->lnk_t) {
 
                case WTAP_ENCAP_WFLEET_HDLC:
-               case WTAP_ENCAP_CHDLC:
+               case WTAP_ENCAP_CHDLC_WITH_PHDR:
                case WTAP_ENCAP_PPP_WITH_PHDR:
                case WTAP_ENCAP_SDLC:
                        pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ?
@@ -131,6 +132,10 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
          proto_tree_add_boolean_hidden(fh_tree, hf_frame_marked, tvb, 0, 0,pinfo->fd->flags.marked);
 
+         if(pinfo->fd->flags.ref_time){
+               proto_tree_add_item(fh_tree, hf_frame_ref_time, tvb, 0, 0, FALSE);
+         }
+
          ts.secs = pinfo->fd->abs_secs;
          ts.nsecs = pinfo->fd->abs_usecs*1000;
 
@@ -187,18 +192,31 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        call_dissector(data_handle,tvb, pinfo, tree);
                }
        }
-       CATCH(BoundsError) {
+       CATCH_ALL {
+               show_exception(tvb, pinfo, tree, EXCEPT_CODE);
+       }
+       ENDTRY;
+
+       tap_queue_packet(frame_tap, pinfo, NULL);
+}
+
+void
+show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+    unsigned long exception)
+{
+       switch (exception) {
+
+       case BoundsError:
                if (check_col(pinfo->cinfo, COL_INFO))
                        col_append_str(pinfo->cinfo, COL_INFO, "[Short Frame]");
                proto_tree_add_protocol_format(tree, proto_short, tvb, 0, 0,
                                "[Short Frame: %s]", pinfo->current_proto);
-       }
-       CATCH(ReportedBoundsError) {
+               break;
+
+       case ReportedBoundsError:
                show_reported_bounds_error(tvb, pinfo, tree);
+               break;
        }
-       ENDTRY;
-
-       tap_queue_packet(frame_tap, pinfo, NULL);
 }
 
 void
@@ -235,17 +253,17 @@ proto_register_frame(void)
        static hf_register_info hf[] = {
                { &hf_frame_arrival_time,
                { "Arrival Time",               "frame.time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
-                       "", HFILL }},
+                       "Absolute time when this frame was captured", HFILL }},
 
                { &hf_frame_time_delta,
                { "Time delta from previous packet",    "frame.time_delta", FT_RELATIVE_TIME, BASE_NONE, NULL,
                        0x0,
-                       "", HFILL }},
+                       "Time delta since previous diplayed frame", HFILL }},
 
                { &hf_frame_time_relative,
-               { "Time relative to first packet",      "frame.time_relative", FT_RELATIVE_TIME, BASE_NONE, NULL,
+               { "Time since reference or first frame",        "frame.time_relative", FT_RELATIVE_TIME, BASE_NONE, NULL,
                        0x0,
-                       "", HFILL }},
+                       "Time relative reference or first frame", HFILL }},
 
                { &hf_frame_number,
                { "Frame Number",               "frame.number", FT_UINT32, BASE_DEC, NULL, 0x0,
@@ -270,6 +288,10 @@ proto_register_frame(void)
                { &hf_frame_marked,
                { "Frame is marked",    "frame.marked", FT_BOOLEAN, 8, NULL, 0x0,
                        "Frame is marked in the GUI", HFILL }},
+
+               { &hf_frame_ref_time,
+               { "This is a Ref Time frame",   "frame.ref_time", FT_NONE, 0, NULL, 0x0,
+                       "This frame is a Reference Time frame", HFILL }},
        };
        static gint *ett[] = {
                &ett_frame,