* Routines for SNA
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-sna.c,v 1.8 1999/10/26 08:08:24 gram Exp $
+ * $Id: packet-sna.c,v 1.11 2000/01/07 22:05:39 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@unicom.net>
+ * By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
*
*
static int hf_sna_rh_cebi = -1;
static int hf_sna_ru = -1;
+static gint ett_sna = -1;
+static gint ett_sna_th = -1;
+static gint ett_sna_th_fid = -1;
+static gint ett_sna_rh = -1;
+static gint ett_sna_rh_0 = -1;
+static gint ett_sna_rh_1 = -1;
+static gint ett_sna_rh_2 = -1;
+
/* Format Identifier */
static const value_string sna_th_fid_vals[] = {
{ 0x0, "SNA device <--> Non-SNA Device" },
guint8 th_fid;
int sna_header_len = 0, th_header_len = 0;
+ /* SNA data should be printed in EBCDIC, not ASCII */
+ fd->encoding = CHAR_EBCDIC;
+
if (IS_DATA_IN_FRAME(offset)) {
/* Transmission Header Format Identifier */
th_fid = hi_nibble(pd[offset]);
/* Don't bother setting length. We'll set it later after we find
* the lengths of TH/RH/RU */
sna_ti = proto_tree_add_item(tree, proto_sna, offset, 0, NULL);
- sna_tree = proto_item_add_subtree(sna_ti, ETT_SNA);
+ sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
/* --- TH --- */
/* Don't bother setting length. We'll set it later after we find
* the length of TH */
th_ti = proto_tree_add_item(sna_tree, hf_sna_th, offset, 0, NULL);
- th_tree = proto_item_add_subtree(th_ti, ETT_SNA_TH);
+ th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
}
/* Get size of TH */
/* --- RH --- */
if (BYTES_ARE_IN_FRAME(offset, 3)) {
rh_ti = proto_tree_add_item(sna_tree, hf_sna_rh, offset, 3, NULL);
- rh_tree = proto_item_add_subtree(rh_ti, ETT_SNA_RH);
+ rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
dissect_rh(pd, offset, fd, rh_tree);
sna_header_len += 3;
offset += 3;
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_byte);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Byte 0 */
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_byte);
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 1");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Byte 1 */
proto_tree_add_item(bf_tree, hf_sna_th_tgsf, offset, 1, th_byte);
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 2");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Byte 2 */
if (mft) {
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 3");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Byte 3 */
proto_tree_add_item(bf_tree, hf_sna_th_vrn, offset, 1, th_byte);
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 4-5");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Bytes 4-5 */
proto_tree_add_item(bf_tree, hf_sna_th_vr_cwi, offset, 2, th_word);
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 6-7");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Bytes 6-7 */
proto_tree_add_item(bf_tree, hf_sna_th_vrprq, offset, 2, th_word);
/* Create the bitfield tree */
bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Byte 16");
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
/* Byte 16 */
proto_tree_add_item(tree, hf_sna_th_snai, offset, 1, th_byte);
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
/* Create the bitfield tree */
bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
proto_tree_add_text(tree, offset+1, 1, "Reserved");
/* Create the bitfield tree for byte 0*/
bf_item = proto_tree_add_item(tree, hf_sna_rh_0, offset, 1, rh_0);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_0);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
proto_tree_add_item(bf_tree, hf_sna_rh_rri, offset, 1, rh_0);
proto_tree_add_item(bf_tree, hf_sna_rh_ru_category, offset, 1, rh_0);
/* Create the bitfield tree for byte 1*/
bf_item = proto_tree_add_item(tree, hf_sna_rh_1, offset, 1, rh_1);
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_1);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
proto_tree_add_item(bf_tree, hf_sna_rh_dr1, offset, 1, rh_1);
bf_item = proto_tree_add_item(tree, hf_sna_rh_2, offset, 1, rh_2);
if (!is_response) {
- bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_2);
+ bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
proto_tree_add_item(bf_tree, hf_sna_rh_bbi, offset, 1, rh_2);
proto_tree_add_item(bf_tree, hf_sna_rh_ebi, offset, 1, rh_2);
{ "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE, NULL, 0x0,
""}},
};
+ static gint *ett[] = {
+ &ett_sna,
+ &ett_sna_th,
+ &ett_sna_th_fid,
+ &ett_sna_rh,
+ &ett_sna_rh_0,
+ &ett_sna_rh_1,
+ &ett_sna_rh_2,
+ };
proto_sna = proto_register_protocol("Systems Network Architecture", "sna");
proto_register_field_array(proto_sna, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}
-