*
* Laurent Deniel <deniel@worldnet.fr>
*
- * $Id: packet-fddi.c,v 1.20 1999/09/10 03:16:08 gram 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>
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 */
break;
default:
- return "";
+ return "Unknown frame type";
}
}
}
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) {
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))
if (tree) {
ti = proto_tree_add_item_format(tree, proto_fddi, 0, offset, NULL,
- "Fiber Distributed Data Interface, %s",
- (fc_str == NULL) ? "Unknown frame type" : fc_str);
+ "Fiber Distributed Data Interface, %s", fc_str);
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);
/* hide some bit-swapped mac address fields in the proto_tree, just in case */
proto_tree_add_item_hidden(fh_tree, hf_fddi_dst, FDDI_P_DHOST, 6, dst_swapped);
- proto_tree_add_item_hidden(fh_tree, hf_fddi_dst, FDDI_P_SHOST, 6, src_swapped);
+ proto_tree_add_item_hidden(fh_tree, hf_fddi_src, FDDI_P_SHOST, 6, src_swapped);
}
switch (fc) {
* NULL, just show the hex value, else show the string.
*/
{ &hf_fddi_fc,
- { "Frame Control", "fddi.fc", FT_UINT8, NULL }},
+ { "Frame Control", "fddi.fc", FT_UINT8, BASE_HEX, NULL, 0x0,
+ "" }},
{ &hf_fddi_dst,
- { "Destination", "fddi.dst", FT_ETHER, NULL }},
+ { "Destination", "fddi.dst", FT_ETHER, BASE_NONE, NULL, 0x0,
+ "Destination Hardware Address" }},
{ &hf_fddi_src,
- { "Source", "fddi.src", FT_ETHER, NULL }},
+ { "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));
}