Fix document creation under Windows, add ethereal-filter.html to the NSIS
[obnox/wireshark/wip.git] / packet-ipfc.c
index f61143406d1980096f270151342f8b19029b476d..22a27a0e42cf3321a4e17fb467530f812fd22232 100644 (file)
@@ -1,8 +1,11 @@
 /* packet-ipfc.c
- * Routines for Decoding FC header for IP/FC
+ * Routines for Decoding Network_Header for IP-over-FC when we only
+ * capture the frame starting at the Network_Header (as opposed to
+ * when we have the full FC frame).
+ * See RFC 2625.
  * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
  *
- * $Id: packet-ipfc.c,v 1.3 2002/12/08 22:01:20 guy Exp $
+ * $Id: packet-ipfc.c,v 1.6 2003/01/21 05:21:03 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +39,8 @@
 #include <epan/packet.h>
 #include "etypes.h"
 #include "packet-fc.h"
+#include "packet-ipfc.h"
+#include "packet-llc.h"
 
 /* Initialize the protocol and registered fields */
 static int proto_ipfc              = -1;
@@ -46,6 +51,17 @@ static int hf_ipfc_network_sa = -1;
 static gint ett_ipfc = -1;
 static dissector_handle_t llc_handle;
 
+void
+capture_ipfc (const guchar *pd, int len, packet_counts *ld)
+{
+  if (!BYTES_ARE_IN_FRAME(0, len, 16)) {
+    ld->other++;
+    return;
+  }
+
+  capture_llc(pd, 16, len, ld);
+}
+
 static void
 dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
@@ -61,8 +77,8 @@ dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/FC");
 
     if (tree) {
-        ti = proto_tree_add_text (tree, tvb, offset, 16,
-                                         "Network Header");
+        ti = proto_tree_add_protocol_format (tree, proto_ipfc, tvb, offset, 16,
+                                         "IP Over FC Network_Header");
         ipfc_tree = proto_item_add_subtree (ti, ett_ipfc);
 
         proto_tree_add_string (ipfc_tree, hf_ipfc_network_da, tvb, offset, 8,
@@ -88,10 +104,10 @@ proto_register_ipfc (void)
 /* Setup list of header fields  See Section 1.6.1 for details*/
     static hf_register_info hf[] = {
         { &hf_ipfc_network_da,
-          {"Network DA", "ipfc.nethdr.da", FT_STRING, BASE_HEX, NULL,
+          {"Network DA", "ipfc.nh.da", FT_STRING, BASE_HEX, NULL,
            0x0, "", HFILL}},
         { &hf_ipfc_network_sa,
-          {"Network SA", "ipfc.nethdr.sa", FT_STRING, BASE_HEX, NULL,
+          {"Network SA", "ipfc.nh.sa", FT_STRING, BASE_HEX, NULL,
            0x0, "", HFILL}},
     };
 
@@ -118,7 +134,6 @@ proto_reg_handoff_ipfc (void)
     dissector_handle_t ipfc_handle;
 
     ipfc_handle = create_dissector_handle (dissect_ipfc, proto_ipfc);
-    dissector_add("fc.ftype", FC_FTYPE_IP, ipfc_handle);
     dissector_add("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_handle);
 
     llc_handle = find_dissector ("llc");