Stuart Stanley's ISIS dissection support.
[obnox/wireshark/wip.git] / packet-fddi.c
index e5513a7b77d0c246cf2abe31c3bf9917b3b3904c..cdfae657b53bed80f6415d124324bb5849ee912e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Laurent Deniel <deniel@worldnet.fr>
  *
- * $Id: packet-fddi.c,v 1.23 1999/10/16 19:36:56 deniel Exp $
+ * $Id: packet-fddi.c,v 1.25 1999/11/16 11:42:30 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -43,6 +43,8 @@ static int hf_fddi_fc = -1;
 static int hf_fddi_dst = -1;
 static int hf_fddi_src = -1;
 
+static gint ett_fddi = -1;
+
 /* FDDI Frame Control values */
 
 #define FDDI_FC_VOID           0x00            /* Void frame */
@@ -254,7 +256,7 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree,
   proto_tree *fh_tree;
   proto_item *ti;
   gchar      *fc_str;
-  u_char     src[6], dst[6];
+  static u_char src[6], dst[6];
   u_char     src_swapped[6], dst_swapped[6];
 
   if (fd->cap_len < FDDI_HEADER_SIZE) {
@@ -275,14 +277,13 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree,
   fc = (int) pd[FDDI_P_FC];
   fc_str = fddifc_to_str(fc);
 
-  if (check_col(fd, COL_RES_DL_SRC))
-    col_add_str(fd, COL_RES_DL_SRC, get_ether_name(src));
-  if (check_col(fd, COL_RES_DL_DST))
-    col_add_str(fd, COL_RES_DL_DST, get_ether_name(dst));
-  if (check_col(fd, COL_UNRES_DL_SRC))
-    col_add_str(fd, COL_UNRES_DL_SRC, ether_to_str(src));
-  if (check_col(fd, COL_UNRES_DL_DST))
-    col_add_str(fd, COL_UNRES_DL_DST, ether_to_str(dst));
+  /* XXX - copy them to some buffer associated with "pi", rather than
+     just making "src" and "dst" static? */
+  SET_ADDRESS(&pi.dl_src, AT_ETHER, 6, &src[0]);
+  SET_ADDRESS(&pi.src, AT_ETHER, 6, &src[0]);
+  SET_ADDRESS(&pi.dl_dst, AT_ETHER, 6, &dst[0]);
+  SET_ADDRESS(&pi.dst, AT_ETHER, 6, &dst[0]);
+
   if (check_col(fd, COL_PROTOCOL))
     col_add_str(fd, COL_PROTOCOL, "FDDI");
   if (check_col(fd, COL_INFO))
@@ -297,7 +298,7 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree,
       swap_mac_addr(dst_swapped, (u_char*)&pd[FDDI_P_DHOST]);
       swap_mac_addr(src_swapped, (u_char*)&pd[FDDI_P_SHOST]);
 
-      fh_tree = proto_item_add_subtree(ti, ETT_FDDI);
+      fh_tree = proto_item_add_subtree(ti, ett_fddi);
       proto_tree_add_item(fh_tree, hf_fddi_fc, FDDI_P_FC, 1, fc);
       proto_tree_add_item(fh_tree, hf_fddi_dst, FDDI_P_DHOST, 6, dst);
       proto_tree_add_item(fh_tree, hf_fddi_src, FDDI_P_SHOST, 6, src);
@@ -359,7 +360,11 @@ proto_register_fddi(void)
                { "Source",             "fddi.src", FT_ETHER, BASE_NONE, NULL, 0x0,
                        "" }},
        };
+       static gint *ett[] = {
+               &ett_fddi,
+       };
 
        proto_fddi = proto_register_protocol ("Fiber Distributed Data Interface", "fddi" );
        proto_register_field_array(proto_fddi, hf, array_length(hf));
+       proto_register_subtree_array(ett, array_length(ett));
 }