On Windows, put Ethereal configuration files under the "Application
[obnox/wireshark/wip.git] / packet-sna.c
index 6e1adcab54149ed813ab35f558dbfd5e8213c68d..3333d68c17dcc6a72383b965fa408ea56c9247fe 100644 (file)
@@ -2,12 +2,11 @@
  * 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.31 2001/07/03 04:56:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@unicom.net>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
- *
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -34,7 +33,8 @@
 
 #include <glib.h>
 #include "packet.h"
-#include "packet-sna.h"
+#include "llcsaps.h"
+#include "sna-utils.h"
 
 /*
  * http://www.wanresources.com/snacell.html
@@ -110,7 +110,15 @@ static int hf_sna_rh_csi = -1;
 static int hf_sna_rh_edi = -1;
 static int hf_sna_rh_pdi = -1;
 static int hf_sna_rh_cebi = -1;
-static int hf_sna_ru = -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[] = {
@@ -136,21 +144,24 @@ static const value_string sna_th_mpf_vals[] = {
 /* Expedited Flow Indicator */
 static const value_string sna_th_efi_vals[] = {
        { 0, "Normal Flow" },
-       { 1, "Expedited Flow" }
+       { 1, "Expedited Flow" },
+       { 0x0,  NULL }
 };
 
 /* Request/Response Indicator */
 static const value_string sna_rh_rri_vals[] = {
        { 0, "Request" },
-       { 1, "Response" }
+       { 1, "Response" },
+       { 0x0,  NULL }
 };
 
 /* Request/Response Unit Category */
 static const value_string sna_rh_ru_category_vals[] = {
-       { 0x00, "Function Management Data (FMD)" },
-       { 0x01, "Network Control (NC)" },
-       { 0x10, "Data Flow Control (DFC)" },
-       { 0x11, "Session Control (SC)" },
+       { 0, "Function Management Data (FMD)" },
+       { 1, "Network Control (NC)" },
+       { 2, "Data Flow Control (DFC)" },
+       { 3, "Session Control (SC)" },
+       { 0x0,  NULL }
 };
 
 /* Format Indicator */
@@ -188,66 +199,76 @@ static const true_false_string sna_rh_qri_truth =
 /* Code Selection Indicator */
 static const value_string sna_rh_csi_vals[] = {
        { 0, "EBCDIC" },
-       { 1, "ASCII" }
+       { 1, "ASCII" },
+       { 0x0,  NULL }
 };
 
 /* TG Sweep */
 static const value_string sna_th_tg_sweep_vals[] = {
        { 0, "This PIU may overtake any PU ahead of it." },
-       { 1, "This PIU does not ovetake any PIU ahead of it." }
+       { 1, "This PIU does not ovetake any PIU ahead of it." },
+       { 0x0,  NULL }
 };
 
 /* ER_VR_SUPP_IND */
 static const value_string sna_th_er_vr_supp_ind_vals[] = {
        { 0, "Each node supports ER and VR protocols" },
-       { 1, "Includes at least one node that does not support ER and VR protocols"  }
+       { 1, "Includes at least one node that does not support ER and VR protocols"  },
+       { 0x0,  NULL }
 };
 
 /* VR_PAC_CNT_IND */
 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
        { 0, "Pacing count on the VR has not reached 0" },
-       { 1, "Pacing count on the VR has reached 0" }
+       { 1, "Pacing count on the VR has reached 0" },
+       { 0x0,  NULL }
 };
 
 /* NTWK_PRTY */
 static const value_string sna_th_ntwk_prty_vals[] = {
        { 0, "PIU flows at a lower priority" },
-       { 1, "PIU flows at network priority (highest transmission priority)" }
+       { 1, "PIU flows at network priority (highest transmission priority)" },
+       { 0x0,  NULL }
 };
 
 /* TGSF */
 static const value_string sna_th_tgsf_vals[] = {
-       { 0x00, "Not segmented" },
-       { 0x01, "Last segment" },
-       { 0x10, "First segment" },
-       { 0x11, "Middle segment" }
+       { 0, "Not segmented" },
+       { 1, "Last segment" },
+       { 2, "First segment" },
+       { 3, "Middle segment" },
+       { 0x0,  NULL }
 };
 
 /* PIUBF */
 static const value_string sna_th_piubf_vals[] = {
-       { 0x00, "Single PIU frame" },
-       { 0x01, "Last PIU of a multiple PIU frame" },
-       { 0x10, "First PIU of a multiple PIU frame" },
-       { 0x11, "Middle PIU of a multiple PIU frame" }
+       { 0, "Single PIU frame" },
+       { 1, "Last PIU of a multiple PIU frame" },
+       { 2, "First PIU of a multiple PIU frame" },
+       { 3, "Middle PIU of a multiple PIU frame" },
+       { 0x0,  NULL }
 };
 
 /* NLPOI */
 static const value_string sna_th_nlpoi_vals[] = {
-       { 0x0, "NLP starts within this FID4 TH" },
-       { 0x1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
+       { 0, "NLP starts within this FID4 TH" },
+       { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
+       { 0x0,  NULL }
 };
 
 /* TPF */
 static const value_string sna_th_tpf_vals[] = {
-       { 0x00, "Low Priority" },
-       { 0x01, "Medium Priority" },
-       { 0x10, "High Priority" },
+       { 0, "Low Priority" },
+       { 1, "Medium Priority" },
+       { 2, "High Priority" },
+       { 0x0,  NULL }
 };
 
 /* VR_CWI */
 static const value_string sna_th_vr_cwi_vals[] = {
-       { 0x0, "Increment window size" },
-       { 0x1, "Decrement window size" },
+       { 0, "Increment window size" },
+       { 1, "Decrement window size" },
+       { 0x0,  NULL }
 };
 
 /* TG_NONFIFO_IND */
@@ -256,9 +277,10 @@ static const true_false_string sna_th_tg_nonfifo_ind_truth =
 
 /* VR_SQTI */
 static const value_string sna_th_vr_sqti_vals[] = {
-       { 0x00, "Non-sequenced, Non-supervisory" },
-       { 0x01, "Non-sequenced, Supervisory" },
-       { 0x10, "Singly-sequenced" },
+       { 0, "Non-sequenced, Non-supervisory" },
+       { 1, "Non-sequenced, Supervisory" },
+       { 2, "Singly-sequenced" },
+       { 0x0,  NULL }
 };
 
 /* VRPRQ */
@@ -277,6 +299,7 @@ static const true_false_string sna_th_vrprs_truth = {
 static const value_string sna_th_vr_cwri_vals[] = {
        { 0, "Increment window size by 1" },
        { 1, "Decrement window size by 1" },
+       { 0x0,  NULL }
 };
 
 /* VR_RWI */
@@ -285,464 +308,451 @@ static const true_false_string sna_th_vr_rwi_truth = {
        "Do not reset window size",
 };
 
-static int  dissect_fid0_1 (const u_char*, int, frame_data*, proto_tree*);
-static int  dissect_fid2 (const u_char*, int, frame_data*, proto_tree*);
-static int  dissect_fid3 (const u_char*, int, frame_data*, proto_tree*);
-static int  dissect_fid4 (const u_char*, int, frame_data*, proto_tree*);
-static int  dissect_fid5 (const u_char*, int, frame_data*, proto_tree*);
-static int  dissect_fidf (const u_char*, int, frame_data*, proto_tree*);
-static void dissect_rh (const u_char*, int, frame_data*, proto_tree*);
+static int  dissect_fid0_1 (tvbuff_t*, packet_info*, proto_tree*);
+static int  dissect_fid2 (tvbuff_t*, packet_info*, proto_tree*);
+static int  dissect_fid3 (tvbuff_t*, proto_tree*);
+static int  dissect_fid4 (tvbuff_t*, packet_info*, proto_tree*);
+static int  dissect_fid5 (tvbuff_t*, proto_tree*);
+static int  dissect_fidf (tvbuff_t*, proto_tree*);
+static void dissect_rh (tvbuff_t*, int, proto_tree*);
 
-void
-dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
+static void
+dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
 
        proto_tree      *sna_tree = NULL, *th_tree = NULL, *rh_tree = NULL;
        proto_item      *sna_ti = NULL, *th_ti = NULL, *rh_ti = NULL;
        guint8          th_fid;
        int             sna_header_len = 0, th_header_len = 0;
+       int             offset;
 
-       if (IS_DATA_IN_FRAME(offset)) {
-               /* Transmission Header Format Identifier */
-               th_fid = hi_nibble(pd[offset]);
-       }
-       else {
-               /* If our first byte isn't here, stop dissecting */
-               return;
-       }
+       if (check_col(pinfo->fd, COL_PROTOCOL))
+               col_set_str(pinfo->fd, COL_PROTOCOL, "SNA");
+       if (check_col(pinfo->fd, COL_INFO))
+               col_clear(pinfo->fd, COL_INFO);
+
+       /* SNA data should be printed in EBCDIC, not ASCII */
+       pinfo->fd->flags.encoding = CHAR_EBCDIC;
+
+       /* Transmission Header Format Identifier */
+       th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
 
        /* Summary information */
-       if (check_col(fd, COL_PROTOCOL))
-               col_add_str(fd, COL_PROTOCOL, "SNA");
-       if (check_col(fd, COL_INFO))
-               col_add_str(fd, COL_INFO, val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
+       if (check_col(pinfo->fd, COL_INFO))
+               col_add_str(pinfo->fd, COL_INFO,
+                               val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
 
        if (tree) {
 
                /* 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_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, 0, FALSE);
+               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_ti = proto_tree_add_item(sna_tree, hf_sna_th, tvb,  0, 0, FALSE);
+               th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
        }
 
        /* Get size of TH */
        switch(th_fid) {
                case 0x0:
                case 0x1:
-                       th_header_len = dissect_fid0_1(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
                        break;
                case 0x2:
-                       th_header_len = dissect_fid2(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fid2(tvb, pinfo, th_tree);
                        break;
                case 0x3:
-                       th_header_len = dissect_fid3(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fid3(tvb, th_tree);
                        break;
                case 0x4:
-                       th_header_len = dissect_fid4(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fid4(tvb, pinfo, th_tree);
                        break;
                case 0x5:
-                       th_header_len = dissect_fid5(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fid5(tvb, th_tree);
                        break;
                case 0xf:
-                       th_header_len = dissect_fidf(pd, offset, fd, th_tree);
+                       th_header_len = dissect_fidf(tvb, th_tree);
                        break;
                default:
-                       dissect_data(pd, offset+1, fd, tree);
+                       dissect_data(tvb, 1, pinfo, tree);
        }
 
        sna_header_len += th_header_len;
-       offset += th_header_len;
+       offset = th_header_len;
 
        if (tree) {
                proto_item_set_len(th_ti, th_header_len);
 
                /* --- 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);
-                       dissect_rh(pd, offset, fd, rh_tree);
-                       sna_header_len += 3;
-                       offset += 3;
-               }
-               else {
-                       /* If our first byte isn't here, stop dissecting */
-                       return;
-               }
+               rh_ti = proto_tree_add_item(sna_tree, hf_sna_rh, tvb, offset, 3, FALSE);
+               rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
+               dissect_rh(tvb, offset, rh_tree);
 
+               sna_header_len += 3;
+               offset += 3;
                proto_item_set_len(sna_ti, sna_header_len);
        }
        else {
-               if (BYTES_ARE_IN_FRAME(offset, 3)) {
-                       sna_header_len += 3;
-                       offset += 3;
-               }
-
+               sna_header_len += 3;
+               offset += 3;
        }
 
-       if (IS_DATA_IN_FRAME(offset+1)) {
-               dissect_data(pd, offset, fd, tree);
+       if (tvb_offset_exists(tvb, offset+1)) {
+               dissect_data(tvb, offset, pinfo, tree);
        }
 }
 
+#define SNA_FID01_ADDR_LEN     2
+
 /* FID Types 0 and 1 */
 static int
-dissect_fid0_1 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
        guint8          th_0;
-       guint16         daf, oaf, snf, dcf;
+       const guint8    *ptr;
 
-       static int bytes_in_header = 10;
+       const int bytes_in_header = 10;
 
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
+       if (tree) {
+               /* Byte 0 */
+               th_0 = tvb_get_guint8(tvb, 0);
+               bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       th_0 = pd[offset+0];
-       daf = pntohs(&pd[offset+2]);
-       oaf = pntohs(&pd[offset+4]);
-       snf = pntohs(&pd[offset+6]);
-       dcf = pntohs(&pd[offset+8]);
+               proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
+               proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
+               proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
 
-       SET_ADDRESS(&pi.net_src, AT_SNA, 2, &pd[offset+4]);
-       SET_ADDRESS(&pi.src, AT_SNA, 2, &pd[offset+4]);
-       SET_ADDRESS(&pi.net_dst, AT_SNA, 2, &pd[offset+2]);
-       SET_ADDRESS(&pi.dst, AT_SNA, 2, &pd[offset+2]);
+               /* Byte 1 */
+               proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
 
-       if (!tree) {
-               return bytes_in_header;
+               /* Bytes 2-3 */
+               proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, FALSE);
        }
 
-       /* 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);
+       /* Set DST addr */
+       ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
+       SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
+       SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
 
-       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);
-       proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
+       if (tree) {
+               proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, FALSE);
+       }
 
-       proto_tree_add_text(tree, offset+1, 1, "Reserved");
-       proto_tree_add_item(tree, hf_sna_th_daf ,offset+2, 1, daf);
-       proto_tree_add_item(tree, hf_sna_th_oaf ,offset+4, 1, oaf);
-       proto_tree_add_item(tree, hf_sna_th_snf ,offset+6, 2, snf);
-       proto_tree_add_item(tree, hf_sna_th_dcf ,offset+8, 2, dcf);
+       /* Set SRC addr */
+       ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
+       SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
+       SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
 
-       return bytes_in_header;
+       /* If we're not filling a proto_tree, return now */
+       if (tree) {
+               return bytes_in_header;
+       }
 
+       proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, FALSE);
+       proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, FALSE);
+
+       return bytes_in_header;
 }
 
+#define SNA_FID2_ADDR_LEN      1
 
 /* FID Type 2 */
 static int
-dissect_fid2 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
-       guint8          th_0, daf, oaf;
-       guint16         snf;
+       guint8          th_0=0, daf=0, oaf=0;
+       const guint8    *ptr;
 
-       static int bytes_in_header = 6;
+       const int bytes_in_header = 6;
 
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
+       if (tree) {
+               th_0 = tvb_get_guint8(tvb, 0);
+               daf = tvb_get_guint8(tvb, 2);
+               oaf = tvb_get_guint8(tvb, 3);
 
-       th_0 = pd[offset+0];
-       daf = pd[offset+2];
-       oaf = pd[offset+3];
+               /* Byte 0 */
+               bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       /* Addresses in FID 2 are FT_UINT8 */
-       SET_ADDRESS(&pi.net_src, AT_SNA, 1, &pd[offset+3]);
-       SET_ADDRESS(&pi.src, AT_SNA, 1, &pd[offset+3]);
-       SET_ADDRESS(&pi.net_dst, AT_SNA, 1, &pd[offset+2]);
-       SET_ADDRESS(&pi.dst, AT_SNA, 1, &pd[offset+2]);
+               proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
+               proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
+               proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0);
+               proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
 
-       if (!tree) {
-               return bytes_in_header;
+               /* Byte 1 */
+               proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
+
+               /* Byte 2 */
+               proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf,
+                               "Destination Address Field: 0x%02x", daf);
        }
 
-       snf = pntohs(&pd[offset+4]);
+       /* Set DST addr */
+       ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
+       SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
+       SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
 
-       /* 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);
-
-       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);
-       proto_tree_add_item(bf_tree, hf_sna_th_odai ,offset, 1, th_0);
-       proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
-
-       /* Addresses in FID 2 are FT_UINT8 */
-       proto_tree_add_text(tree, offset+1, 1, "Reserved");
-       proto_tree_add_item_format(tree, hf_sna_th_daf ,offset+2, 1, daf,
-                       "Destination Address Field: 0x%02x", daf);
-       proto_tree_add_item_format(tree, hf_sna_th_oaf ,offset+3, 1, oaf,
-                       "Origin Address Field: 0x%02x", oaf);
-       proto_tree_add_item(tree, hf_sna_th_snf ,offset+4, 2, snf);
+       if (tree) {
+               /* Byte 3 */
+               proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf,
+                               "Origin Address Field: 0x%02x", oaf);
+       }
+
+       /* Set SRC addr */
+       ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
+       SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
+       SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
+
+       if (tree) {
+               proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, FALSE);
+       }
 
        return bytes_in_header;
 }
 
 /* FID Type 3 */
 static int
-dissect_fid3 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
        guint8          th_0;
-       guint8          lsid;
 
-       static int bytes_in_header = 2;
-
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
+       const int bytes_in_header = 2;
 
+       /* If we're not filling a proto_tree, return now */
        if (!tree) {
                return bytes_in_header;
        }
 
-       th_0 = pd[offset+0];
-       lsid = pd[offset+1];
+       th_0 = tvb_get_guint8(tvb, 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_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
+       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);
-       proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
 
-       proto_tree_add_item(tree, hf_sna_th_lsid ,offset+1, 1, lsid);
+       proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, FALSE);
 
        return bytes_in_header;
 }
 
-/* FID Type 4 */
-
-gchar *
-sna_fid_type_4_addr_to_str(const struct sna_fid_type_4_addr *addrp)
-{
-  static gchar str[3][14];
-  static gchar *cur;
-
-  if (cur == &str[0][0]) {
-    cur = &str[1][0];
-  } else if (cur == &str[1][0]) {
-    cur = &str[2][0];
-  } else {
-    cur = &str[0][0];
-  }
-
-  sprintf(cur, "%08X.%04X", addrp->saf, addrp->ef);
-  return cur;
-}
 
 static int
-dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
+       int             offset = 0;
        guint8          th_byte, mft;
        guint16         th_word;
-       guint16         def, oef, snf, dcf;
+       guint16         def, oef;
        guint32         dsaf, osaf;
        static struct sna_fid_type_4_addr src, dst;
 
-       static int bytes_in_header = 26;
-
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
-
-       dsaf = pntohl(&pd[offset+8]);
-       osaf = pntohl(&pd[offset+12]);
-       def = pntohs(&pd[offset+18]);
-       oef = pntohs(&pd[offset+20]);
-       snf = pntohs(&pd[offset+22]);
-       dcf = pntohs(&pd[offset+24]);
-
-       /* Addresses in FID 4 are discontiguous, sigh */
-       src.saf = osaf;
-       src.ef = oef;
-       dst.saf = dsaf;
-       dst.ef = def;
-       SET_ADDRESS(&pi.net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
-           (guint8 *)&src);
-       SET_ADDRESS(&pi.src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
-           (guint8 *)&src);
-       SET_ADDRESS(&pi.net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
-           (guint8 *)&dst);
-       SET_ADDRESS(&pi.dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
-           (guint8 *)&dst);
+       const int bytes_in_header = 26;
 
+       /* If we're not filling a proto_tree, return now */
        if (!tree) {
                return bytes_in_header;
        }
 
-       th_byte = pd[offset];
+       if (tree) {
+               th_byte = tvb_get_guint8(tvb, offset);
+
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset, 1, th_byte);
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
+
+               /* Byte 0 */
+               proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb, offset, 1, th_byte);
+
+               offset += 1;
+               th_byte = tvb_get_guint8(tvb, offset);
+
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 1");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
+
+               /* Byte 1 */
+               proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1, th_byte);
+               proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1, th_byte);
+
+               mft = th_byte & 0x04;
+               offset += 1;
+               th_byte = tvb_get_guint8(tvb, offset);
+
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 2");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
+
+               /* Byte 2 */
+               if (mft) {
+                       proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb, offset, 1, th_byte);
+                       proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb, offset, 1, th_byte);
+               }
+               else {
+                       proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb, offset, 1, th_byte);
+               }
+               proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1, th_byte);
 
-       /* 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);
+               offset += 1;
+               th_byte = tvb_get_guint8(tvb, offset);
 
-       /* Byte 0 */
-       proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_tg_sweep, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_er_vr_supp_ind, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_pac_cnt_ind, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_ntwk_prty, offset, 1, th_byte);
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 3");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       offset += 1;
-       th_byte = pd[offset];
+               /* Byte 3 */
+               proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, 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);
+               offset += 1;
+               th_word = tvb_get_ntohs(tvb, offset);
 
-       /* Byte 1 */
-       proto_tree_add_item(bf_tree, hf_sna_th_tgsf, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_mft, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_piubf, offset, 1, th_byte);
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Bytes 4-5");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       mft = th_byte & 0x04;
-       offset += 1;
-       th_byte = pd[offset];
+               /* Bytes 4-5 */
+               proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb, offset, 2, th_word);
+               proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb, offset, 2, th_word);
+               proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb, offset, 2, th_word);
 
-       /* 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);
+               /* I'm not sure about byte-order on this one... */
+               proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb, offset, 2, th_word);
 
-       /* Byte 2 */
-       if (mft) {
-               proto_tree_add_item(bf_tree, hf_sna_th_nlpoi, offset, 1, th_byte);
-               proto_tree_add_item(bf_tree, hf_sna_th_nlp_cp, offset, 1, th_byte);
-       }
-       else {
-               proto_tree_add_item(bf_tree, hf_sna_th_iern, offset, 1, th_byte);
-       }
-       proto_tree_add_item(bf_tree, hf_sna_th_ern, offset, 1, th_byte);
+               offset += 2;
+               th_word = tvb_get_ntohs(tvb, offset);
 
-       offset += 1;
-       th_byte = pd[offset];
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Bytes 6-7");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       /* 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);
+               /* Bytes 6-7 */
+               proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset, 2, th_word);
+               proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset, 2, th_word);
+               proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset, 2, th_word);
+               proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset, 2, th_word);
 
-       /* Byte 3 */
-       proto_tree_add_item(bf_tree, hf_sna_th_vrn, offset, 1, th_byte);
-       proto_tree_add_item(bf_tree, hf_sna_th_tpf, offset, 1, th_byte);
+               /* I'm not sure about byte-order on this one... */
+               proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb, offset, 2, th_word);
 
-       offset += 1;
-       th_word = pntohs(&pd[offset]);
-
-       /* 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);
-
-       /* Bytes 4-5 */
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_cwi, offset, 2, th_word);
-       proto_tree_add_item(bf_tree, hf_sna_th_tg_nonfifo_ind, offset, 2, th_word);
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_sqti, offset, 2, th_word);
+               offset += 2;
+       }
 
-       /* I'm not sure about byte-order on this one... */
-       proto_tree_add_item(bf_tree, hf_sna_th_tg_snf, offset, 2, th_word);
+       dsaf = tvb_get_ntohl(tvb, 8);
+       if (tree) {
+               /* Bytes 8-11 */
+               proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
 
-       offset += 2;
-       th_word = pntohs(&pd[offset]);
+               offset += 4;
+       }
 
-       /* 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);
+       osaf = tvb_get_ntohl(tvb, 12);
+       if (tree) {
+               /* Bytes 12-15 */
+               proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
 
-       /* Bytes 6-7 */
-       proto_tree_add_item(bf_tree, hf_sna_th_vrprq, offset, 2, th_word);
-       proto_tree_add_item(bf_tree, hf_sna_th_vrprs, offset, 2, th_word);
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_cwri, offset, 2, th_word);
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_rwi, offset, 2, th_word);
+               offset += 4;
+               th_byte = tvb_get_guint8(tvb, offset);
 
-       /* I'm not sure about byte-order on this one... */
-       proto_tree_add_item(bf_tree, hf_sna_th_vr_snf_send, offset, 2, th_word);
+               /* Create the bitfield tree */
+               bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Byte 16");
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
 
-       offset += 2;
+               /* Byte 16 */
+               proto_tree_add_boolean(tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
 
-       /* Bytes 8-11 */
-       proto_tree_add_item(tree, hf_sna_th_dsaf, offset, 4, dsaf);
+               /* We luck out here because in their infinite wisdom the SNA
+                * architects placed the MPF and EFI fields in the same bitfield
+                * locations, even though for FID4 they're not in byte 0.
+                * Thank you IBM! */
+               proto_tree_add_uint(tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
+               proto_tree_add_uint(tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
 
-       offset += 4;
+               offset += 2; /* 1 for byte 16, 1 for byte 17 which is reserved */
+       }
 
-       /* Bytes 12-15 */
-       proto_tree_add_item(tree, hf_sna_th_osaf, offset, 4, osaf);
 
-       offset += 4;
-       th_byte = pd[offset];
+       def = tvb_get_ntohs(tvb, 18);
+       if (tree) {
+               /* Bytes 18-25 */
+               proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
+       }
 
-       /* 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);
+       /* Addresses in FID 4 are discontiguous, sigh */
+       dst.saf = dsaf;
+       dst.ef = def;
+       SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8* )&dst);
+       SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&dst);
 
-       /* Byte 16 */
-       proto_tree_add_item(tree, hf_sna_th_snai, offset, 1, th_byte);
 
-       /* We luck out here because in their infinite wisdom the SNA
-        * architects placed the MPF and EFI fields in the same bitfield
-        * locations, even though for FID4 they're not in byte 0.
-        * Thank you IBM! */
-       proto_tree_add_item(tree, hf_sna_th_mpf, offset, 1, th_byte);
-       proto_tree_add_item(tree, hf_sna_th_efi, offset, 1, th_byte);
+       oef = tvb_get_ntohs(tvb, 20);
+       if (tree) {
+               proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
+       }
 
-       offset += 2; /* 1 for byte 16, 1 for byte 17 which is reserved */
+       /* Addresses in FID 4 are discontiguous, sigh */
+       src.saf = osaf;
+       src.ef = oef;
+       SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&src);
+       SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&src);
 
-       /* Bytes 18-25 */
-       proto_tree_add_item(tree, hf_sna_th_def, offset+0, 2, def);
-       proto_tree_add_item(tree, hf_sna_th_oef, offset+2, 2, oef);
-       proto_tree_add_item(tree, hf_sna_th_snf, offset+4, 2, snf);
-       proto_tree_add_item(tree, hf_sna_th_snf, offset+6, 2, dcf);
+       if (tree) {
+               proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, FALSE);
+               proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, FALSE);
+       }
 
        return bytes_in_header;
 }
 
 /* FID Type 5 */
 static int
-dissect_fid5 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
        guint8          th_0;
-       guint16         snf;
-
-       static int bytes_in_header = 12;
 
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
-
-       th_0 = pd[offset+0];
-       snf = pntohs(&pd[offset+2]);
+       const int bytes_in_header = 12;
 
+       /* If we're not filling a proto_tree, return now */
        if (!tree) {
                return bytes_in_header;
        }
 
+       th_0 = tvb_get_guint8(tvb, 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_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
+       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);
-       proto_tree_add_item(bf_tree, hf_sna_th_efi, offset, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
+       proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
 
-       proto_tree_add_text(tree, offset+1, 1, "Reserved");
-       proto_tree_add_item(tree, hf_sna_th_snf, offset+2, 2, snf);
+       proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
+       proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, FALSE);
 
-       proto_tree_add_item(tree, hf_sna_th_sa, offset+4, 8, &pd[offset+4]);
+       proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, FALSE);
 
        return bytes_in_header;
 
@@ -750,45 +760,36 @@ dissect_fid5 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
 /* FID Type f */
 static int
-dissect_fidf (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
-       guint8          th_0, cmd_fmt, cmd_type;
-       guint16         cmd_sn, dcf;
+       guint8          th_0;
        
-       static int bytes_in_header = 26;
-
-       if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
-               return 0;
-       }
-
-       th_0 = pd[offset+0];
-       cmd_fmt = pd[offset+2];
-       cmd_type = pd[offset+3];
-       cmd_sn = pntohs(&pd[offset+4]);
-
-       /* Yup, bytes 6-23 are reserved! */
-       dcf = pntohs(&pd[offset+24]);
+       const int bytes_in_header = 26;
 
+       /* If we're not filling a proto_tree, return now */
        if (!tree) {
                return bytes_in_header;
        }
 
+       th_0 = tvb_get_guint8(tvb, 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_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
+       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");
+       proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
+       proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
 
-       proto_tree_add_item(tree, hf_sna_th_cmd_fmt,  offset+2, 1, cmd_fmt);
-       proto_tree_add_item(tree, hf_sna_th_cmd_type, offset+3, 1, cmd_type);
-       proto_tree_add_item(tree, hf_sna_th_cmd_sn,   offset+4, 2, cmd_sn);
+       proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb,  2, 1, FALSE);
+       proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, FALSE);
+       proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb,   4, 2, FALSE);
 
-       proto_tree_add_text(tree, offset+6, 18, "Reserved");
+       /* Yup, bytes 6-23 are reserved! */
+       proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
 
-       proto_tree_add_item(tree, hf_sna_th_dcf, offset+24, 8, dcf);
+       proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, FALSE);
 
        return bytes_in_header;
 }
@@ -796,70 +797,70 @@ dissect_fidf (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
 /* RH */
 static void
-dissect_rh (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
-
+dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
+{
        proto_tree      *bf_tree;
        proto_item      *bf_item;
        gboolean        is_response;
        guint8          rh_0, rh_1, rh_2;
 
-       rh_0 = pd[offset+0];
-       rh_1 = pd[offset+1];
-       rh_2 = pd[offset+2];
 
+       /* Create the bitfield tree for byte 0*/
+       rh_0 = tvb_get_guint8(tvb, offset);
        is_response = (rh_0 & 0x80);
 
-       /* 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_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, 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);
-       proto_tree_add_item(bf_tree, hf_sna_rh_fi, offset, 1, rh_0);
-       proto_tree_add_item(bf_tree, hf_sna_rh_sdi, offset, 1, rh_0);
-       proto_tree_add_item(bf_tree, hf_sna_rh_bci, offset, 1, rh_0);
-       proto_tree_add_item(bf_tree, hf_sna_rh_eci, offset, 1, rh_0);
+       proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
+       proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1, rh_0);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
 
        offset += 1;
+       rh_1 = tvb_get_guint8(tvb, offset);
 
        /* 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_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, 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);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb,  offset, 1, rh_1);
 
        if (!is_response) {
-               proto_tree_add_item(bf_tree, hf_sna_rh_lcci, offset, 1, rh_1);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1, rh_1);
        }
 
-       proto_tree_add_item(bf_tree, hf_sna_rh_dr2,  offset, 1, rh_1);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb,  offset, 1, rh_1);
 
        if (is_response) {
-               proto_tree_add_item(bf_tree, hf_sna_rh_rti,  offset, 1, rh_1);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb,  offset, 1, rh_1);
        }
        else {
-               proto_tree_add_item(bf_tree, hf_sna_rh_eri,  offset, 1, rh_1);
-               proto_tree_add_item(bf_tree, hf_sna_rh_rlwi, offset, 1, rh_1);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb,  offset, 1, rh_1);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1, rh_1);
        }
 
-       proto_tree_add_item(bf_tree, hf_sna_rh_qri, offset, 1, rh_1);
-       proto_tree_add_item(bf_tree, hf_sna_rh_pi,  offset, 1, rh_1);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
+       proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb,  offset, 1, rh_1);
 
        offset += 1;
+       rh_2 = tvb_get_guint8(tvb, offset);
 
        /* Create the bitfield tree for byte 2*/
-       bf_item = proto_tree_add_item(tree, hf_sna_rh_2, offset, 1, rh_2);
+       bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
 
        if (!is_response) {
-               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);
-               proto_tree_add_item(bf_tree, hf_sna_rh_cdi,  offset, 1, rh_2);
-               proto_tree_add_item(bf_tree, hf_sna_rh_csi,  offset, 1, rh_2);
-               proto_tree_add_item(bf_tree, hf_sna_rh_edi,  offset, 1, rh_2);
-               proto_tree_add_item(bf_tree, hf_sna_rh_pdi,  offset, 1, rh_2);
-               proto_tree_add_item(bf_tree, hf_sna_rh_cebi, offset, 1, rh_2);
+               bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
+
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb,  offset, 1, rh_2);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb,  offset, 1, rh_2);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb,  offset, 1, rh_2);
+               proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb,  offset, 1, rh_2);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb,  offset, 1, rh_2);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb,  offset, 1, rh_2);
+               proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1, rh_2);
        }
 
        /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
@@ -871,313 +872,330 @@ proto_register_sna(void)
         static hf_register_info hf[] = {
                 { &hf_sna_th,
                 { "Transmission Header",       "sna.th", FT_NONE, BASE_NONE, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_0,
                 { "Transmission Header Byte 0",        "sna.th.0", FT_UINT8, BASE_HEX, NULL, 0x0,
                        "Byte 0 of Tranmission Header contains FID, MPF, ODAI,"
-                       " and EFI as bitfields." }},
+                       " and EFI as bitfields.", HFILL }},
 
                 { &hf_sna_th_fid,
                 { "Format Identifer",          "sna.th.fid", FT_UINT8, BASE_HEX, VALS(sna_th_fid_vals), 0xf0,
-                       "Format Identification" }},
+                       "Format Identification", HFILL }},
 
                 { &hf_sna_th_mpf,
-                { "Mapping Field",             "sna.th.mpf", FT_UINT8, BASE_NONE, VALS(sna_th_mpf_vals), 0x0c,
+                { "Mapping Field",             "sna.th.mpf", FT_UINT8, BASE_DEC, VALS(sna_th_mpf_vals), 0x0c,
                        "The Mapping Field specifies whether the information field"
-                       " associated with the TH is a complete or partial BIU." }},
+                       " associated with the TH is a complete or partial BIU.", HFILL }},
 
                { &hf_sna_th_odai,
                { "ODAI Assignment Indicator",  "sna.th.odai", FT_UINT8, BASE_DEC, NULL, 0x02,
                        "The ODAI indicates which node assigned the OAF'-DAF' values"
-                       " carried in the TH." }},
+                       " carried in the TH.", HFILL }},
 
                 { &hf_sna_th_efi,
                 { "Expedited Flow Indicator",  "sna.th.efi", FT_UINT8, BASE_DEC, VALS(sna_th_efi_vals), 0x01,
                        "The EFI designates whether the PIU belongs to the normal"
-                       " or expedited flow." }},
+                       " or expedited flow.", HFILL }},
 
                 { &hf_sna_th_daf,
                 { "Destination Address Field", "sna.th.daf", FT_UINT16, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_oaf,
                 { "Origin Address Field",      "sna.th.oaf", FT_UINT16, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_snf,
-                { "Sequence Number Field",     "sna.th.snf", FT_UINT16, BASE_NONE, NULL, 0x0,
+                { "Sequence Number Field",     "sna.th.snf", FT_UINT16, BASE_DEC, NULL, 0x0,
                        "The Sequence Number Field contains a numerical identifier for"
-                       " the associated BIU."}},
+                       " the associated BIU.", HFILL }},
 
                 { &hf_sna_th_dcf,
                 { "Data Count Field",  "sna.th.dcf", FT_UINT16, BASE_DEC, NULL, 0x0,
                        "A binary count of the number of bytes in the BIU or BIU segment associated "
                        "with the tranmission header. The count does not include any of the bytes "
-                       "in the transmission header."}},
+                       "in the transmission header.", HFILL }},
 
                 { &hf_sna_th_lsid,
                 { "Local Session Identification",      "sna.th.lsid", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_tg_sweep,
                 { "Transmission Group Sweep",          "sna.th.tg_sweep", FT_UINT8, BASE_DEC,
                        VALS(sna_th_tg_sweep_vals), 0x08,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_er_vr_supp_ind,
                 { "ER and VR Support Indicator",       "sna.th.er_vr_supp_ind", FT_UINT8, BASE_DEC,
                        VALS(sna_th_er_vr_supp_ind_vals), 0x04,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_vr_pac_cnt_ind,
                 { "Virtual Route Pacing Count Indicator",      "sna.th.vr_pac_cnt_ind",
                        FT_UINT8, BASE_DEC, VALS(sna_th_vr_pac_cnt_ind_vals), 0x02,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_ntwk_prty,
                 { "Network Priority",  "sna.th.ntwk_prty",
                        FT_UINT8, BASE_DEC, VALS(sna_th_ntwk_prty_vals), 0x01,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_tgsf,
                 { "Transmission Group Segmenting Field",       "sna.th.tgsf",
                        FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_mft,
                 { "MPR FID4 Type",     "sna.th.mft", FT_BOOLEAN, BASE_NONE, NULL, 0x04,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_piubf,
                 { "PIU Blocking Field",        "sna.th.piubf", FT_UINT8, BASE_HEX,
                        VALS(sna_th_piubf_vals), 0x03,
-                       "Specifies whether this frame contains a single PIU or multiple PIUs." }},
+                       "Specifies whether this frame contains a single PIU or multiple PIUs.", HFILL }},
 
                 { &hf_sna_th_iern,
                 { "Initial Explicit Route Number",     "sna.th.iern", FT_UINT8, BASE_DEC, NULL, 0xf0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_nlpoi,
                 { "NLP Offset Indicator",      "sna.th.nlpoi", FT_UINT8, BASE_DEC,
                        VALS(sna_th_nlpoi_vals), 0x80,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_nlp_cp,
                 { "NLP Count or Padding",      "sna.th.nlp_cp", FT_UINT8, BASE_DEC, NULL, 0x70,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_ern,
                 { "Explicit Route Number",     "sna.th.ern", FT_UINT8, BASE_DEC, NULL, 0x0f,
-                       "The ERN in a TH identifies an explicit route direction of flow." }},
+                       "The ERN in a TH identifies an explicit route direction of flow.", HFILL }},
 
                 { &hf_sna_th_vrn,
                 { "Virtual Route Number",      "sna.th.vrn", FT_UINT8, BASE_DEC, NULL, 0xf0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_tpf,
                 { "Transmission Priority Field",       "sna.th.tpf", FT_UINT8, BASE_HEX,
                        VALS(sna_th_tpf_vals), 0x03,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_vr_cwi,
                 { "Virtual Route Change Window Indicator",     "sna.th.vr_cwi", FT_UINT16, BASE_DEC,
                        VALS(sna_th_vr_cwi_vals), 0x8000,
-                       "Used to change the window size of the virtual route by 1." }},
+                       "Used to change the window size of the virtual route by 1.", HFILL }},
 
                 { &hf_sna_th_tg_nonfifo_ind,
                 { "Transmission Group Non-FIFO Indicator",     "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
                        TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000,
                        "Indicates whether or not FIFO discipline is to enforced in "
                        "transmitting PIUs through the tranmission groups to prevent the PIUs "
-                       "getting out of sequence during transmission over the TGs." }},
+                       "getting out of sequence during transmission over the TGs.", HFILL }},
 
                 { &hf_sna_th_vr_sqti,
                 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti", FT_UINT16, BASE_HEX,
                        VALS(sna_th_vr_sqti_vals), 0x3000,
-                       "Specifies the PIU type." }},
+                       "Specifies the PIU type.", HFILL }},
 
                 { &hf_sna_th_tg_snf,
                 { "Transmission Group Sequence Number Field",  "sna.th.tg_snf", FT_UINT16, BASE_DEC,
                        NULL, 0x0fff,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_vrprq,
                 { "Virtual Route Pacing Request",      "sna.th.vrprq", FT_BOOLEAN, 16,
                        TFS(&sna_th_vrprq_truth), 0x8000,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_vrprs,
                 { "Virtual Route Pacing Response",     "sna.th.vrprs", FT_BOOLEAN, 16,
                        TFS(&sna_th_vrprs_truth), 0x4000,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_vr_cwri,
                 { "Virtual Route Change Window Reply Indicator",       "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
                        VALS(sna_th_vr_cwri_vals), 0x2000,
                        "Permits changing of the window size by 1 for PIUs received by the "
-                       "sender of this bit." }},
+                       "sender of this bit.", HFILL }},
 
                 { &hf_sna_th_vr_rwi,
                 { "Virtual Route Reset Window Indicator",      "sna.th.vr_rwi", FT_BOOLEAN, 16,
                        TFS(&sna_th_vr_rwi_truth), 0x1000,
-                       "Indicates severe congestion in a node on the virtual route." }},
+                       "Indicates severe congestion in a node on the virtual route.", HFILL }},
 
                 { &hf_sna_th_vr_snf_send,
                 { "Virtual Route Send Sequence Number Field",  "sna.th.vr_snf_send", FT_UINT16, BASE_DEC,
                        NULL, 0x0fff,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_dsaf,
                 { "Destination Subarea Address Field", "sna.th.dsaf", FT_UINT32, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_osaf,
                 { "Origin Subarea Address Field",      "sna.th.osaf", FT_UINT32, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_snai,
                 { "SNA Indicator",     "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
                        "Used to identify whether the PIU originated or is destined for "
-                       "an SNA or non-SNA device." }},
+                       "an SNA or non-SNA device.", HFILL }},
 
                 { &hf_sna_th_def,
                 { "Destination Element Field", "sna.th.def", FT_UINT16, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_oef,
                 { "Origin Element Field",      "sna.th.oef", FT_UINT16, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_sa,
                 { "Session Address",   "sna.th.sa", FT_BYTES, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_cmd_fmt,
                 { "Command Format",    "sna.th.cmd_fmt", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_cmd_type,
                 { "Command Type",      "sna.th.cmd_type", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_th_cmd_sn,
                 { "Command Sequence Number",   "sna.th.cmd_sn", FT_UINT16, BASE_DEC, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
 
                 { &hf_sna_rh,
                 { "Request/Response Header",   "sna.rh", FT_NONE, BASE_NONE, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_rh_0,
                 { "Request/Response Header Byte 0",    "sna.rh.0", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_rh_1,
                 { "Request/Response Header Byte 1",    "sna.rh.1", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_rh_2,
                 { "Request/Response Header Byte 2",    "sna.rh.2", FT_UINT8, BASE_HEX, NULL, 0x0,
-                       "" }},
+                       "", HFILL }},
 
                 { &hf_sna_rh_rri,
                 { "Request/Response Indicator",        "sna.rh.rri", FT_UINT8, BASE_DEC, VALS(sna_rh_rri_vals), 0x80,
-                       "Denotes whether this is a request or a response." }},
+                       "Denotes whether this is a request or a response.", HFILL }},
 
                 { &hf_sna_rh_ru_category,
                 { "Request/Response Unit Category",    "sna.rh.ru_category", FT_UINT8, BASE_HEX,
                        VALS(sna_rh_ru_category_vals), 0x60,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_fi,
                { "Format Indicator",           "sna.rh.fi", FT_BOOLEAN, 8, TFS(&sna_rh_fi_truth), 0x08,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_sdi,
                { "Sense Data Included",        "sna.rh.sdi", FT_BOOLEAN, 8, TFS(&sna_rh_sdi_truth), 0x04,
-                       "Indicates that a 4-byte sense data field is included in the associated RU." }},
+                       "Indicates that a 4-byte sense data field is included in the associated RU.", HFILL }},
 
                { &hf_sna_rh_bci,
                { "Begin Chain Indicator",      "sna.rh.bci", FT_BOOLEAN, 8, TFS(&sna_rh_bci_truth), 0x02,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_eci,
                { "End Chain Indicator",        "sna.rh.eci", FT_BOOLEAN, 8, TFS(&sna_rh_eci_truth), 0x01,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_dr1,
                { "Definite Response 1 Indicator",      "sna.rh.dr1", FT_BOOLEAN, 8, NULL, 0x80,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_lcci,
                { "Length-Checked Compression Indicator",       "sna.rh.lcci", FT_BOOLEAN, 8,
                        TFS(&sna_rh_lcci_truth), 0x40,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_dr2,
                { "Definite Response 2 Indicator",      "sna.rh.dr2", FT_BOOLEAN, 8, NULL, 0x20,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_eri,
                { "Exception Response Indicator",       "sna.rh.eri", FT_BOOLEAN, 8, NULL, 0x10,
                        "Used in conjunction with DR1I and DR2I to indicate, in a request, "
-                       "the form of response requested." }},
+                       "the form of response requested.", HFILL }},
 
                { &hf_sna_rh_rti,
                { "Response Type Indicator",    "sna.rh.rti", FT_BOOLEAN, 8, TFS(&sna_rh_rti_truth), 0x10,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_rlwi,
                { "Request Larger Window Indicator",    "sna.rh.rlwi", FT_BOOLEAN, 8, NULL, 0x04,
-                       "Indicates whether a larger pacing window was requested." }},
+                       "Indicates whether a larger pacing window was requested.", HFILL }},
 
                { &hf_sna_rh_qri,
                { "Queued Response Indicator",  "sna.rh.qri", FT_BOOLEAN, 8, TFS(&sna_rh_qri_truth), 0x02,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_pi,
                { "Pacing Indicator",   "sna.rh.pi", FT_BOOLEAN, 8, NULL, 0x01,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_bbi,
                { "Begin Bracket Indicator",    "sna.rh.bbi", FT_BOOLEAN, 8, NULL, 0x80,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_ebi,
                { "End Bracket Indicator",      "sna.rh.ebi", FT_BOOLEAN, 8, NULL, 0x40,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_cdi,
                { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN, 8, NULL, 0x20,
-                       "" }},
+                       "", HFILL }},
 
                { &hf_sna_rh_csi,
-               { "Code Selection Indicator",   "sna.rh.csi", FT_BOOLEAN, 8, VALS(sna_rh_csi_vals), 0x08,
-                       "Specifies the encoding used for the associated FMD RU." }},
+               { "Code Selection Indicator",   "sna.rh.csi", FT_UINT8, BASE_DEC, VALS(sna_rh_csi_vals), 0x08,
+                       "Specifies the encoding used for the associated FMD RU.", HFILL }},
 
                { &hf_sna_rh_edi,
                { "Enciphered Data Indicator",  "sna.rh.edi", FT_BOOLEAN, 8, NULL, 0x04,
                        "Indicates that information in the associated RU is enciphered under "
-                       "session-level cryptography protocols." }},
+                       "session-level cryptography protocols.", HFILL }},
 
                { &hf_sna_rh_pdi,
                { "Padded Data Indicator",      "sna.rh.pdi", FT_BOOLEAN, 8, NULL, 0x02,
                        "Indicates that the RU was padded at the end, before encipherment, to the next "
-                       "integral multiple of 8 bytes." }},
+                       "integral multiple of 8 bytes.", HFILL }},
 
                { &hf_sna_rh_cebi,
                { "Conditional End Bracket Indicator",  "sna.rh.cebi", FT_BOOLEAN, 8, NULL, 0x01,
                        "Used to indicate the beginning or end of a group of exchanged "
-                       "requests and responses called a bracket. Only used on LU-LU sessions." }},
+                       "requests and responses called a bracket. Only used on LU-LU sessions.", HFILL }},
 
-                { &hf_sna_ru,
+/*                { &hf_sna_ru,
                 { "Request/Response Unit",     "sna.ru", FT_NONE, BASE_NONE, NULL, 0x0,
-                       ""}},
+                       "", HFILL }},*/
         };
-
-        proto_sna = proto_register_protocol("Systems Network Architecture", "sna");
+       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", "sna");
        proto_register_field_array(proto_sna, hf, array_length(hf));
+       proto_register_subtree_array(ett, array_length(ett));
 }
 
+void
+proto_reg_handoff_sna(void)
+{
+       dissector_add("llc.dsap", SAP_SNA_PATHCTRL, dissect_sna,
+           proto_sna);
+}