Make the "Save only marked frames" button in the "Save As..." dialog box
[obnox/wireshark/wip.git] / packet-wcp.c
index a06b898b78cf3b4a139e93c00efdccff48cbc989..781884463a9fa08d9161148c5d12d0946887fa35 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Wellfleet Compression frame disassembly
  * Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
  *
- * $Id: packet-wcp.c,v 1.13 2001/11/20 22:29:04 guy Exp $
+ * $Id: packet-wcp.c,v 1.18 2001/12/03 03:59:42 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include <string.h>
 #include "packet.h"
 #include "packet-frame.h"
-#include "packet-fr.h"
 #include "conversation.h"
 #include "etypes.h"
 #include "nlpid.h"
@@ -143,8 +142,6 @@ typedef struct {
 static GMemChunk *wcp_window = NULL;
 static GMemChunk *wcp_pdata = NULL;
 
-extern dissector_table_t fr_subdissector_table;
-
 static int proto_wcp = -1;
 static int hf_wcp_cmd = -1;
 static int hf_wcp_ext_cmd = -1;
@@ -177,6 +174,8 @@ static int hf_wcp_offset = -1;
 static gint ett_wcp = -1;
 static gint ett_wcp_field = -1;
 
+static dissector_handle_t fr_handle;
+
 /*
  * Bits in the address field.
  */
@@ -277,7 +276,7 @@ dissect_wcp_reset( tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
 }
 
 
-void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo){
+static void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo){
 
        wcp_window_t *buf_ptr = 0;
        int len; 
@@ -301,17 +300,13 @@ void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo){
 }
 
 
-void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
 
        proto_tree      *wcp_tree;
        proto_item      *ti;
        int             wcp_header_len;
        guint16         temp, cmd, ext_cmd, seq;
        tvbuff_t        *next_tvb;
-       packet_info     save_pi;
-       gboolean        must_restore_pi = FALSE;
-
-       pinfo->current_proto = "WCP";
 
        if (check_col(pinfo->fd, COL_PROTOCOL))
                col_set_str(pinfo->fd, COL_PROTOCOL, "WCP");
@@ -395,12 +390,6 @@ void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
                                        "[Malformed Frame: Bad WCP compressed data]" );
                        return;
                }
-
-               /* XXX - is this still necessary?  Do we have to worry
-                  about subdissectors changing "pi", or, given that
-                  we're no longer doing so, is that no longer an issue? */
-               save_pi = pi;
-               must_restore_pi = TRUE;
        }
 
        if ( tree)                      /* add the check byte */
@@ -408,10 +397,7 @@ void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
                        tvb_reported_length( tvb)-1, 1,
                        tvb_get_guint8( tvb, tvb_reported_length(tvb)-1));
 
-       dissect_fr_uncompressed(next_tvb, pinfo, tree);
-
-       if (must_restore_pi)
-               pi = save_pi;
+       call_dissector(fr_handle, next_tvb, pinfo, tree);
 
        return;
 }
@@ -741,7 +727,14 @@ proto_register_wcp(void)
 
 void
 proto_reg_handoff_wcp(void) {
+    dissector_handle_t wcp_handle;
+
+    /*
+     * Get handle for the Frame Relay (uncompressed) dissector.
+     */
+    fr_handle = find_dissector("fr");
 
-    dissector_add("fr.ietf", NLPID_COMPRESSED, dissect_wcp, proto_wcp);
-    dissector_add("ethertype",  ETHERTYPE_WCP, dissect_wcp, proto_wcp);
+    wcp_handle = create_dissector_handle(dissect_wcp, proto_wcp);
+    dissector_add("fr.ietf", NLPID_COMPRESSED, wcp_handle);
+    dissector_add("ethertype",  ETHERTYPE_WCP, wcp_handle);
 }