Replace the ETT_ "enum" members, declared in "packet.h", with
[obnox/wireshark/wip.git] / packet-sna.c
1 /* packet-sna.c
2  * Routines for SNA
3  * Gilbert Ramirez <gram@xiexie.org>
4  *
5  * $Id: packet-sna.c,v 1.9 1999/11/16 11:42:57 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@unicom.net>
9  * Copyright 1998 Gerald Combs
10  *
11  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
33 #endif
34
35 #include <glib.h>
36 #include "packet.h"
37 #include "packet-sna.h"
38
39 /*
40  * http://www.wanresources.com/snacell.html
41  *
42  */
43
44 static int proto_sna = -1;
45 static int hf_sna_th = -1;
46 static int hf_sna_th_0 = -1;
47 static int hf_sna_th_fid = -1;
48 static int hf_sna_th_mpf = -1;
49 static int hf_sna_th_odai = -1;
50 static int hf_sna_th_efi = -1;
51 static int hf_sna_th_daf = -1;
52 static int hf_sna_th_oaf = -1;
53 static int hf_sna_th_snf = -1;
54 static int hf_sna_th_dcf = -1;
55 static int hf_sna_th_lsid = -1;
56 static int hf_sna_th_tg_sweep = -1;
57 static int hf_sna_th_er_vr_supp_ind = -1;
58 static int hf_sna_th_vr_pac_cnt_ind = -1;
59 static int hf_sna_th_ntwk_prty = -1;
60 static int hf_sna_th_tgsf = -1;
61 static int hf_sna_th_mft = -1;
62 static int hf_sna_th_piubf = -1;
63 static int hf_sna_th_iern = -1;
64 static int hf_sna_th_nlpoi = -1;
65 static int hf_sna_th_nlp_cp = -1;
66 static int hf_sna_th_ern = -1;
67 static int hf_sna_th_vrn = -1;
68 static int hf_sna_th_tpf = -1;
69 static int hf_sna_th_vr_cwi = -1;
70 static int hf_sna_th_tg_nonfifo_ind = -1;
71 static int hf_sna_th_vr_sqti = -1;
72 static int hf_sna_th_tg_snf = -1;
73 static int hf_sna_th_vrprq = -1;
74 static int hf_sna_th_vrprs = -1;
75 static int hf_sna_th_vr_cwri = -1;
76 static int hf_sna_th_vr_rwi = -1;
77 static int hf_sna_th_vr_snf_send = -1;
78 static int hf_sna_th_dsaf = -1;
79 static int hf_sna_th_osaf = -1;
80 static int hf_sna_th_snai = -1;
81 static int hf_sna_th_def = -1;
82 static int hf_sna_th_oef = -1;
83 static int hf_sna_th_sa = -1;
84 static int hf_sna_th_cmd_fmt = -1;
85 static int hf_sna_th_cmd_type = -1;
86 static int hf_sna_th_cmd_sn = -1;
87
88 static int hf_sna_rh = -1;
89 static int hf_sna_rh_0 = -1;
90 static int hf_sna_rh_1 = -1;
91 static int hf_sna_rh_2 = -1;
92 static int hf_sna_rh_rri = -1;
93 static int hf_sna_rh_ru_category = -1;
94 static int hf_sna_rh_fi = -1;
95 static int hf_sna_rh_sdi = -1;
96 static int hf_sna_rh_bci = -1;
97 static int hf_sna_rh_eci = -1;
98 static int hf_sna_rh_dr1 = -1;
99 static int hf_sna_rh_lcci = -1;
100 static int hf_sna_rh_dr2 = -1;
101 static int hf_sna_rh_eri = -1;
102 static int hf_sna_rh_rti = -1;
103 static int hf_sna_rh_rlwi = -1;
104 static int hf_sna_rh_qri = -1;
105 static int hf_sna_rh_pi = -1;
106 static int hf_sna_rh_bbi = -1;
107 static int hf_sna_rh_ebi = -1;
108 static int hf_sna_rh_cdi = -1;
109 static int hf_sna_rh_csi = -1;
110 static int hf_sna_rh_edi = -1;
111 static int hf_sna_rh_pdi = -1;
112 static int hf_sna_rh_cebi = -1;
113 static int hf_sna_ru = -1;
114
115 static gint ett_sna = -1;
116 static gint ett_sna_th = -1;
117 static gint ett_sna_th_fid = -1;
118 static gint ett_sna_rh = -1;
119 static gint ett_sna_rh_0 = -1;
120 static gint ett_sna_rh_1 = -1;
121 static gint ett_sna_rh_2 = -1;
122
123 /* Format Identifier */
124 static const value_string sna_th_fid_vals[] = {
125         { 0x0,  "SNA device <--> Non-SNA Device" },
126         { 0x1,  "Subarea Nodes, without ER or VR" },
127         { 0x2,  "Subarea Node <--> PU2" },
128         { 0x3,  "Subarea Node or SNA host <--> Subarea Node" },
129         { 0x4,  "Subarea Nodes, supporting ER and VR" },
130         { 0x5,  "HPR RTP endpoint nodes" },
131         { 0xf,  "Adjaced Subarea Nodes, supporting ER and VR" },
132         { 0x0,  NULL }
133 };
134
135 /* Mapping Field */
136 static const value_string sna_th_mpf_vals[] = {
137         { 0, "Middle segment of a BIU" },
138         { 1, "Last segment of a BIU" },
139         { 2, "First segment of a BIU" },
140         { 3 , "Whole BIU" },
141         { 0,   NULL }
142 };
143
144 /* Expedited Flow Indicator */
145 static const value_string sna_th_efi_vals[] = {
146         { 0, "Normal Flow" },
147         { 1, "Expedited Flow" }
148 };
149
150 /* Request/Response Indicator */
151 static const value_string sna_rh_rri_vals[] = {
152         { 0, "Request" },
153         { 1, "Response" }
154 };
155
156 /* Request/Response Unit Category */
157 static const value_string sna_rh_ru_category_vals[] = {
158         { 0x00, "Function Management Data (FMD)" },
159         { 0x01, "Network Control (NC)" },
160         { 0x10, "Data Flow Control (DFC)" },
161         { 0x11, "Session Control (SC)" },
162 };
163
164 /* Format Indicator */
165 static const true_false_string sna_rh_fi_truth =
166         { "FM Header", "No FM Header" };
167
168 /* Sense Data Included */
169 static const true_false_string sna_rh_sdi_truth =
170         { "Included", "Not Included" };
171
172 /* Begin Chain Indicator */
173 static const true_false_string sna_rh_bci_truth =
174         { "First in Chain", "Not First in Chain" };
175
176 /* End Chain Indicator */
177 static const true_false_string sna_rh_eci_truth =
178         { "Last in Chain", "Not Last in Chain" };
179
180 /* Lengith-Checked Compression Indicator */
181 static const true_false_string sna_rh_lcci_truth =
182         { "Compressed", "Not Compressed" };
183
184 /* Response Type Indicator */
185 static const true_false_string sna_rh_rti_truth =
186         { "Negative", "Positive" };
187
188 /* Exception Response Indicator */
189 static const true_false_string sna_rh_eri_truth =
190         { "Exception", "Definite" };
191
192 /* Queued Response Indicator */
193 static const true_false_string sna_rh_qri_truth =
194         { "Enqueue response in TC queues", "Response bypasses TC queues" };
195
196 /* Code Selection Indicator */
197 static const value_string sna_rh_csi_vals[] = {
198         { 0, "EBCDIC" },
199         { 1, "ASCII" }
200 };
201
202 /* TG Sweep */
203 static const value_string sna_th_tg_sweep_vals[] = {
204         { 0, "This PIU may overtake any PU ahead of it." },
205         { 1, "This PIU does not ovetake any PIU ahead of it." }
206 };
207
208 /* ER_VR_SUPP_IND */
209 static const value_string sna_th_er_vr_supp_ind_vals[] = {
210         { 0, "Each node supports ER and VR protocols" },
211         { 1, "Includes at least one node that does not support ER and VR protocols"  }
212 };
213
214 /* VR_PAC_CNT_IND */
215 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
216         { 0, "Pacing count on the VR has not reached 0" },
217         { 1, "Pacing count on the VR has reached 0" }
218 };
219
220 /* NTWK_PRTY */
221 static const value_string sna_th_ntwk_prty_vals[] = {
222         { 0, "PIU flows at a lower priority" },
223         { 1, "PIU flows at network priority (highest transmission priority)" }
224 };
225
226 /* TGSF */
227 static const value_string sna_th_tgsf_vals[] = {
228         { 0x00, "Not segmented" },
229         { 0x01, "Last segment" },
230         { 0x10, "First segment" },
231         { 0x11, "Middle segment" }
232 };
233
234 /* PIUBF */
235 static const value_string sna_th_piubf_vals[] = {
236         { 0x00, "Single PIU frame" },
237         { 0x01, "Last PIU of a multiple PIU frame" },
238         { 0x10, "First PIU of a multiple PIU frame" },
239         { 0x11, "Middle PIU of a multiple PIU frame" }
240 };
241
242 /* NLPOI */
243 static const value_string sna_th_nlpoi_vals[] = {
244         { 0x0, "NLP starts within this FID4 TH" },
245         { 0x1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
246 };
247
248 /* TPF */
249 static const value_string sna_th_tpf_vals[] = {
250         { 0x00, "Low Priority" },
251         { 0x01, "Medium Priority" },
252         { 0x10, "High Priority" },
253 };
254
255 /* VR_CWI */
256 static const value_string sna_th_vr_cwi_vals[] = {
257         { 0x0, "Increment window size" },
258         { 0x1, "Decrement window size" },
259 };
260
261 /* TG_NONFIFO_IND */
262 static const true_false_string sna_th_tg_nonfifo_ind_truth =
263         { "TG FIFO is not required", "TG FIFO is required" };
264
265 /* VR_SQTI */
266 static const value_string sna_th_vr_sqti_vals[] = {
267         { 0x00, "Non-sequenced, Non-supervisory" },
268         { 0x01, "Non-sequenced, Supervisory" },
269         { 0x10, "Singly-sequenced" },
270 };
271
272 /* VRPRQ */
273 static const true_false_string sna_th_vrprq_truth = {
274         "VR pacing request is sent asking for a VR pacing response",
275         "No VR pacing response is requested",
276 };
277
278 /* VRPRS */
279 static const true_false_string sna_th_vrprs_truth = {
280         "VR pacing response is sent in response to a VRPRQ bit set",
281         "No pacing response sent",
282 };
283
284 /* VR_CWRI */
285 static const value_string sna_th_vr_cwri_vals[] = {
286         { 0, "Increment window size by 1" },
287         { 1, "Decrement window size by 1" },
288 };
289
290 /* VR_RWI */
291 static const true_false_string sna_th_vr_rwi_truth = {
292         "Reset window size to the minimum specified in NC_ACTVR",
293         "Do not reset window size",
294 };
295
296 static int  dissect_fid0_1 (const u_char*, int, frame_data*, proto_tree*);
297 static int  dissect_fid2 (const u_char*, int, frame_data*, proto_tree*);
298 static int  dissect_fid3 (const u_char*, int, frame_data*, proto_tree*);
299 static int  dissect_fid4 (const u_char*, int, frame_data*, proto_tree*);
300 static int  dissect_fid5 (const u_char*, int, frame_data*, proto_tree*);
301 static int  dissect_fidf (const u_char*, int, frame_data*, proto_tree*);
302 static void dissect_rh (const u_char*, int, frame_data*, proto_tree*);
303
304 void
305 dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
306
307         proto_tree      *sna_tree = NULL, *th_tree = NULL, *rh_tree = NULL;
308         proto_item      *sna_ti = NULL, *th_ti = NULL, *rh_ti = NULL;
309         guint8          th_fid;
310         int             sna_header_len = 0, th_header_len = 0;
311
312         if (IS_DATA_IN_FRAME(offset)) {
313                 /* Transmission Header Format Identifier */
314                 th_fid = hi_nibble(pd[offset]);
315         }
316         else {
317                 /* If our first byte isn't here, stop dissecting */
318                 return;
319         }
320
321         /* Summary information */
322         if (check_col(fd, COL_PROTOCOL))
323                 col_add_str(fd, COL_PROTOCOL, "SNA");
324         if (check_col(fd, COL_INFO))
325                 col_add_str(fd, COL_INFO, val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
326
327         if (tree) {
328
329                 /* Don't bother setting length. We'll set it later after we find
330                  * the lengths of TH/RH/RU */
331                 sna_ti = proto_tree_add_item(tree, proto_sna, offset, 0, NULL);
332                 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
333
334                 /* --- TH --- */
335                 /* Don't bother setting length. We'll set it later after we find
336                  * the length of TH */
337                 th_ti = proto_tree_add_item(sna_tree, hf_sna_th,  offset, 0, NULL);
338                 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
339         }
340
341         /* Get size of TH */
342         switch(th_fid) {
343                 case 0x0:
344                 case 0x1:
345                         th_header_len = dissect_fid0_1(pd, offset, fd, th_tree);
346                         break;
347                 case 0x2:
348                         th_header_len = dissect_fid2(pd, offset, fd, th_tree);
349                         break;
350                 case 0x3:
351                         th_header_len = dissect_fid3(pd, offset, fd, th_tree);
352                         break;
353                 case 0x4:
354                         th_header_len = dissect_fid4(pd, offset, fd, th_tree);
355                         break;
356                 case 0x5:
357                         th_header_len = dissect_fid5(pd, offset, fd, th_tree);
358                         break;
359                 case 0xf:
360                         th_header_len = dissect_fidf(pd, offset, fd, th_tree);
361                         break;
362                 default:
363                         dissect_data(pd, offset+1, fd, tree);
364         }
365
366         sna_header_len += th_header_len;
367         offset += th_header_len;
368
369         if (tree) {
370                 proto_item_set_len(th_ti, th_header_len);
371
372                 /* --- RH --- */
373                 if (BYTES_ARE_IN_FRAME(offset, 3)) {
374                         rh_ti = proto_tree_add_item(sna_tree, hf_sna_rh, offset, 3, NULL);
375                         rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
376                         dissect_rh(pd, offset, fd, rh_tree);
377                         sna_header_len += 3;
378                         offset += 3;
379                 }
380                 else {
381                         /* If our first byte isn't here, stop dissecting */
382                         return;
383                 }
384
385                 proto_item_set_len(sna_ti, sna_header_len);
386         }
387         else {
388                 if (BYTES_ARE_IN_FRAME(offset, 3)) {
389                         sna_header_len += 3;
390                         offset += 3;
391                 }
392
393         }
394
395         if (IS_DATA_IN_FRAME(offset+1)) {
396                 dissect_data(pd, offset, fd, tree);
397         }
398 }
399
400 /* FID Types 0 and 1 */
401 static int
402 dissect_fid0_1 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
403
404         proto_tree      *bf_tree;
405         proto_item      *bf_item;
406         guint8          th_0;
407         guint16         daf, oaf, snf, dcf;
408
409         static int bytes_in_header = 10;
410
411         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
412                 return 0;
413         }
414
415         th_0 = pd[offset+0];
416         daf = pntohs(&pd[offset+2]);
417         oaf = pntohs(&pd[offset+4]);
418         snf = pntohs(&pd[offset+6]);
419         dcf = pntohs(&pd[offset+8]);
420
421         SET_ADDRESS(&pi.net_src, AT_SNA, 2, &pd[offset+4]);
422         SET_ADDRESS(&pi.src, AT_SNA, 2, &pd[offset+4]);
423         SET_ADDRESS(&pi.net_dst, AT_SNA, 2, &pd[offset+2]);
424         SET_ADDRESS(&pi.dst, AT_SNA, 2, &pd[offset+2]);
425
426         if (!tree) {
427                 return bytes_in_header;
428         }
429
430         /* Create the bitfield tree */
431         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
432         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
433
434         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
435         proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
436         proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
437
438         proto_tree_add_text(tree, offset+1, 1, "Reserved");
439         proto_tree_add_item(tree, hf_sna_th_daf ,offset+2, 1, daf);
440         proto_tree_add_item(tree, hf_sna_th_oaf ,offset+4, 1, oaf);
441         proto_tree_add_item(tree, hf_sna_th_snf ,offset+6, 2, snf);
442         proto_tree_add_item(tree, hf_sna_th_dcf ,offset+8, 2, dcf);
443
444         return bytes_in_header;
445
446 }
447
448
449 /* FID Type 2 */
450 static int
451 dissect_fid2 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
452
453         proto_tree      *bf_tree;
454         proto_item      *bf_item;
455         guint8          th_0, daf, oaf;
456         guint16         snf;
457
458         static int bytes_in_header = 6;
459
460         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
461                 return 0;
462         }
463
464         th_0 = pd[offset+0];
465         daf = pd[offset+2];
466         oaf = pd[offset+3];
467
468         /* Addresses in FID 2 are FT_UINT8 */
469         SET_ADDRESS(&pi.net_src, AT_SNA, 1, &pd[offset+3]);
470         SET_ADDRESS(&pi.src, AT_SNA, 1, &pd[offset+3]);
471         SET_ADDRESS(&pi.net_dst, AT_SNA, 1, &pd[offset+2]);
472         SET_ADDRESS(&pi.dst, AT_SNA, 1, &pd[offset+2]);
473
474         if (!tree) {
475                 return bytes_in_header;
476         }
477
478         snf = pntohs(&pd[offset+4]);
479
480         /* Create the bitfield tree */
481         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
482         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
483
484         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
485         proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
486         proto_tree_add_item(bf_tree, hf_sna_th_odai ,offset, 1, th_0);
487         proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
488
489         /* Addresses in FID 2 are FT_UINT8 */
490         proto_tree_add_text(tree, offset+1, 1, "Reserved");
491         proto_tree_add_item_format(tree, hf_sna_th_daf ,offset+2, 1, daf,
492                         "Destination Address Field: 0x%02x", daf);
493         proto_tree_add_item_format(tree, hf_sna_th_oaf ,offset+3, 1, oaf,
494                         "Origin Address Field: 0x%02x", oaf);
495         proto_tree_add_item(tree, hf_sna_th_snf ,offset+4, 2, snf);
496
497         return bytes_in_header;
498 }
499
500 /* FID Type 3 */
501 static int
502 dissect_fid3 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
503
504         proto_tree      *bf_tree;
505         proto_item      *bf_item;
506         guint8          th_0;
507         guint8          lsid;
508
509         static int bytes_in_header = 2;
510
511         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
512                 return 0;
513         }
514
515         if (!tree) {
516                 return bytes_in_header;
517         }
518
519         th_0 = pd[offset+0];
520         lsid = pd[offset+1];
521
522         /* Create the bitfield tree */
523         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
524         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
525
526         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
527         proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
528         proto_tree_add_item(bf_tree, hf_sna_th_efi ,offset, 1, th_0);
529
530         proto_tree_add_item(tree, hf_sna_th_lsid ,offset+1, 1, lsid);
531
532         return bytes_in_header;
533 }
534
535 /* FID Type 4 */
536
537 gchar *
538 sna_fid_type_4_addr_to_str(const struct sna_fid_type_4_addr *addrp)
539 {
540   static gchar  str[3][14];
541   static gchar  *cur;
542
543   if (cur == &str[0][0]) {
544     cur = &str[1][0];
545   } else if (cur == &str[1][0]) {
546     cur = &str[2][0];
547   } else {
548     cur = &str[0][0];
549   }
550
551   sprintf(cur, "%08X.%04X", addrp->saf, addrp->ef);
552   return cur;
553 }
554
555 static int
556 dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
557
558         proto_tree      *bf_tree;
559         proto_item      *bf_item;
560         guint8          th_byte, mft;
561         guint16         th_word;
562         guint16         def, oef, snf, dcf;
563         guint32         dsaf, osaf;
564         static struct sna_fid_type_4_addr src, dst;
565
566         static int bytes_in_header = 26;
567
568         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
569                 return 0;
570         }
571
572         dsaf = pntohl(&pd[offset+8]);
573         osaf = pntohl(&pd[offset+12]);
574         def = pntohs(&pd[offset+18]);
575         oef = pntohs(&pd[offset+20]);
576         snf = pntohs(&pd[offset+22]);
577         dcf = pntohs(&pd[offset+24]);
578
579         /* Addresses in FID 4 are discontiguous, sigh */
580         src.saf = osaf;
581         src.ef = oef;
582         dst.saf = dsaf;
583         dst.ef = def;
584         SET_ADDRESS(&pi.net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
585             (guint8 *)&src);
586         SET_ADDRESS(&pi.src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
587             (guint8 *)&src);
588         SET_ADDRESS(&pi.net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
589             (guint8 *)&dst);
590         SET_ADDRESS(&pi.dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
591             (guint8 *)&dst);
592
593         if (!tree) {
594                 return bytes_in_header;
595         }
596
597         th_byte = pd[offset];
598
599         /* Create the bitfield tree */
600         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_byte);
601         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
602
603         /* Byte 0 */
604         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_byte);
605         proto_tree_add_item(bf_tree, hf_sna_th_tg_sweep, offset, 1, th_byte);
606         proto_tree_add_item(bf_tree, hf_sna_th_er_vr_supp_ind, offset, 1, th_byte);
607         proto_tree_add_item(bf_tree, hf_sna_th_vr_pac_cnt_ind, offset, 1, th_byte);
608         proto_tree_add_item(bf_tree, hf_sna_th_ntwk_prty, offset, 1, th_byte);
609
610         offset += 1;
611         th_byte = pd[offset];
612
613         /* Create the bitfield tree */
614         bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 1");
615         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
616
617         /* Byte 1 */
618         proto_tree_add_item(bf_tree, hf_sna_th_tgsf, offset, 1, th_byte);
619         proto_tree_add_item(bf_tree, hf_sna_th_mft, offset, 1, th_byte);
620         proto_tree_add_item(bf_tree, hf_sna_th_piubf, offset, 1, th_byte);
621
622         mft = th_byte & 0x04;
623         offset += 1;
624         th_byte = pd[offset];
625
626         /* Create the bitfield tree */
627         bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 2");
628         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
629
630         /* Byte 2 */
631         if (mft) {
632                 proto_tree_add_item(bf_tree, hf_sna_th_nlpoi, offset, 1, th_byte);
633                 proto_tree_add_item(bf_tree, hf_sna_th_nlp_cp, offset, 1, th_byte);
634         }
635         else {
636                 proto_tree_add_item(bf_tree, hf_sna_th_iern, offset, 1, th_byte);
637         }
638         proto_tree_add_item(bf_tree, hf_sna_th_ern, offset, 1, th_byte);
639
640         offset += 1;
641         th_byte = pd[offset];
642
643         /* Create the bitfield tree */
644         bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 3");
645         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
646
647         /* Byte 3 */
648         proto_tree_add_item(bf_tree, hf_sna_th_vrn, offset, 1, th_byte);
649         proto_tree_add_item(bf_tree, hf_sna_th_tpf, offset, 1, th_byte);
650
651         offset += 1;
652         th_word = pntohs(&pd[offset]);
653
654         /* Create the bitfield tree */
655         bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 4-5");
656         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
657
658         /* Bytes 4-5 */
659         proto_tree_add_item(bf_tree, hf_sna_th_vr_cwi, offset, 2, th_word);
660         proto_tree_add_item(bf_tree, hf_sna_th_tg_nonfifo_ind, offset, 2, th_word);
661         proto_tree_add_item(bf_tree, hf_sna_th_vr_sqti, offset, 2, th_word);
662
663         /* I'm not sure about byte-order on this one... */
664         proto_tree_add_item(bf_tree, hf_sna_th_tg_snf, offset, 2, th_word);
665
666         offset += 2;
667         th_word = pntohs(&pd[offset]);
668
669         /* Create the bitfield tree */
670         bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 6-7");
671         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
672
673         /* Bytes 6-7 */
674         proto_tree_add_item(bf_tree, hf_sna_th_vrprq, offset, 2, th_word);
675         proto_tree_add_item(bf_tree, hf_sna_th_vrprs, offset, 2, th_word);
676         proto_tree_add_item(bf_tree, hf_sna_th_vr_cwri, offset, 2, th_word);
677         proto_tree_add_item(bf_tree, hf_sna_th_vr_rwi, offset, 2, th_word);
678
679         /* I'm not sure about byte-order on this one... */
680         proto_tree_add_item(bf_tree, hf_sna_th_vr_snf_send, offset, 2, th_word);
681
682         offset += 2;
683
684         /* Bytes 8-11 */
685         proto_tree_add_item(tree, hf_sna_th_dsaf, offset, 4, dsaf);
686
687         offset += 4;
688
689         /* Bytes 12-15 */
690         proto_tree_add_item(tree, hf_sna_th_osaf, offset, 4, osaf);
691
692         offset += 4;
693         th_byte = pd[offset];
694
695         /* Create the bitfield tree */
696         bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Byte 16");
697         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
698
699         /* Byte 16 */
700         proto_tree_add_item(tree, hf_sna_th_snai, offset, 1, th_byte);
701
702         /* We luck out here because in their infinite wisdom the SNA
703          * architects placed the MPF and EFI fields in the same bitfield
704          * locations, even though for FID4 they're not in byte 0.
705          * Thank you IBM! */
706         proto_tree_add_item(tree, hf_sna_th_mpf, offset, 1, th_byte);
707         proto_tree_add_item(tree, hf_sna_th_efi, offset, 1, th_byte);
708
709         offset += 2; /* 1 for byte 16, 1 for byte 17 which is reserved */
710
711         /* Bytes 18-25 */
712         proto_tree_add_item(tree, hf_sna_th_def, offset+0, 2, def);
713         proto_tree_add_item(tree, hf_sna_th_oef, offset+2, 2, oef);
714         proto_tree_add_item(tree, hf_sna_th_snf, offset+4, 2, snf);
715         proto_tree_add_item(tree, hf_sna_th_snf, offset+6, 2, dcf);
716
717         return bytes_in_header;
718 }
719
720 /* FID Type 5 */
721 static int
722 dissect_fid5 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
723
724         proto_tree      *bf_tree;
725         proto_item      *bf_item;
726         guint8          th_0;
727         guint16         snf;
728
729         static int bytes_in_header = 12;
730
731         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
732                 return 0;
733         }
734
735         th_0 = pd[offset+0];
736         snf = pntohs(&pd[offset+2]);
737
738         if (!tree) {
739                 return bytes_in_header;
740         }
741
742         /* Create the bitfield tree */
743         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
744         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
745
746         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
747         proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0);
748         proto_tree_add_item(bf_tree, hf_sna_th_efi, offset, 1, th_0);
749
750         proto_tree_add_text(tree, offset+1, 1, "Reserved");
751         proto_tree_add_item(tree, hf_sna_th_snf, offset+2, 2, snf);
752
753         proto_tree_add_item(tree, hf_sna_th_sa, offset+4, 8, &pd[offset+4]);
754
755         return bytes_in_header;
756
757 }
758
759 /* FID Type f */
760 static int
761 dissect_fidf (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
762
763         proto_tree      *bf_tree;
764         proto_item      *bf_item;
765         guint8          th_0, cmd_fmt, cmd_type;
766         guint16         cmd_sn, dcf;
767         
768         static int bytes_in_header = 26;
769
770         if (!BYTES_ARE_IN_FRAME(offset, bytes_in_header)) {
771                 return 0;
772         }
773
774         th_0 = pd[offset+0];
775         cmd_fmt = pd[offset+2];
776         cmd_type = pd[offset+3];
777         cmd_sn = pntohs(&pd[offset+4]);
778
779         /* Yup, bytes 6-23 are reserved! */
780         dcf = pntohs(&pd[offset+24]);
781
782         if (!tree) {
783                 return bytes_in_header;
784         }
785
786         /* Create the bitfield tree */
787         bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0);
788         bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
789
790         proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0);
791         proto_tree_add_text(tree, offset+1, 1, "Reserved");
792
793         proto_tree_add_item(tree, hf_sna_th_cmd_fmt,  offset+2, 1, cmd_fmt);
794         proto_tree_add_item(tree, hf_sna_th_cmd_type, offset+3, 1, cmd_type);
795         proto_tree_add_item(tree, hf_sna_th_cmd_sn,   offset+4, 2, cmd_sn);
796
797         proto_tree_add_text(tree, offset+6, 18, "Reserved");
798
799         proto_tree_add_item(tree, hf_sna_th_dcf, offset+24, 8, dcf);
800
801         return bytes_in_header;
802 }
803
804
805 /* RH */
806 static void
807 dissect_rh (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
808
809         proto_tree      *bf_tree;
810         proto_item      *bf_item;
811         gboolean        is_response;
812         guint8          rh_0, rh_1, rh_2;
813
814         rh_0 = pd[offset+0];
815         rh_1 = pd[offset+1];
816         rh_2 = pd[offset+2];
817
818         is_response = (rh_0 & 0x80);
819
820         /* Create the bitfield tree for byte 0*/
821         bf_item = proto_tree_add_item(tree, hf_sna_rh_0, offset, 1, rh_0);
822         bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
823
824         proto_tree_add_item(bf_tree, hf_sna_rh_rri, offset, 1, rh_0);
825         proto_tree_add_item(bf_tree, hf_sna_rh_ru_category, offset, 1, rh_0);
826         proto_tree_add_item(bf_tree, hf_sna_rh_fi, offset, 1, rh_0);
827         proto_tree_add_item(bf_tree, hf_sna_rh_sdi, offset, 1, rh_0);
828         proto_tree_add_item(bf_tree, hf_sna_rh_bci, offset, 1, rh_0);
829         proto_tree_add_item(bf_tree, hf_sna_rh_eci, offset, 1, rh_0);
830
831         offset += 1;
832
833         /* Create the bitfield tree for byte 1*/
834         bf_item = proto_tree_add_item(tree, hf_sna_rh_1, offset, 1, rh_1);
835         bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
836
837         proto_tree_add_item(bf_tree, hf_sna_rh_dr1,  offset, 1, rh_1);
838
839         if (!is_response) {
840                 proto_tree_add_item(bf_tree, hf_sna_rh_lcci, offset, 1, rh_1);
841         }
842
843         proto_tree_add_item(bf_tree, hf_sna_rh_dr2,  offset, 1, rh_1);
844
845         if (is_response) {
846                 proto_tree_add_item(bf_tree, hf_sna_rh_rti,  offset, 1, rh_1);
847         }
848         else {
849                 proto_tree_add_item(bf_tree, hf_sna_rh_eri,  offset, 1, rh_1);
850                 proto_tree_add_item(bf_tree, hf_sna_rh_rlwi, offset, 1, rh_1);
851         }
852
853         proto_tree_add_item(bf_tree, hf_sna_rh_qri, offset, 1, rh_1);
854         proto_tree_add_item(bf_tree, hf_sna_rh_pi,  offset, 1, rh_1);
855
856         offset += 1;
857
858         /* Create the bitfield tree for byte 2*/
859         bf_item = proto_tree_add_item(tree, hf_sna_rh_2, offset, 1, rh_2);
860
861         if (!is_response) {
862                 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
863
864                 proto_tree_add_item(bf_tree, hf_sna_rh_bbi,  offset, 1, rh_2);
865                 proto_tree_add_item(bf_tree, hf_sna_rh_ebi,  offset, 1, rh_2);
866                 proto_tree_add_item(bf_tree, hf_sna_rh_cdi,  offset, 1, rh_2);
867                 proto_tree_add_item(bf_tree, hf_sna_rh_csi,  offset, 1, rh_2);
868                 proto_tree_add_item(bf_tree, hf_sna_rh_edi,  offset, 1, rh_2);
869                 proto_tree_add_item(bf_tree, hf_sna_rh_pdi,  offset, 1, rh_2);
870                 proto_tree_add_item(bf_tree, hf_sna_rh_cebi, offset, 1, rh_2);
871         }
872
873         /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
874 }
875
876 void
877 proto_register_sna(void)
878 {
879         static hf_register_info hf[] = {
880                 { &hf_sna_th,
881                 { "Transmission Header",        "sna.th", FT_NONE, BASE_NONE, NULL, 0x0,
882                         "" }},
883
884                 { &hf_sna_th_0,
885                 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX, NULL, 0x0,
886                         "Byte 0 of Tranmission Header contains FID, MPF, ODAI,"
887                         " and EFI as bitfields." }},
888
889                 { &hf_sna_th_fid,
890                 { "Format Identifer",           "sna.th.fid", FT_UINT8, BASE_HEX, VALS(sna_th_fid_vals), 0xf0,
891                         "Format Identification" }},
892
893                 { &hf_sna_th_mpf,
894                 { "Mapping Field",              "sna.th.mpf", FT_UINT8, BASE_NONE, VALS(sna_th_mpf_vals), 0x0c,
895                         "The Mapping Field specifies whether the information field"
896                         " associated with the TH is a complete or partial BIU." }},
897
898                 { &hf_sna_th_odai,
899                 { "ODAI Assignment Indicator",  "sna.th.odai", FT_UINT8, BASE_DEC, NULL, 0x02,
900                         "The ODAI indicates which node assigned the OAF'-DAF' values"
901                         " carried in the TH." }},
902
903                 { &hf_sna_th_efi,
904                 { "Expedited Flow Indicator",   "sna.th.efi", FT_UINT8, BASE_DEC, VALS(sna_th_efi_vals), 0x01,
905                         "The EFI designates whether the PIU belongs to the normal"
906                         " or expedited flow." }},
907
908                 { &hf_sna_th_daf,
909                 { "Destination Address Field",  "sna.th.daf", FT_UINT16, BASE_HEX, NULL, 0x0,
910                         "" }},
911
912                 { &hf_sna_th_oaf,
913                 { "Origin Address Field",       "sna.th.oaf", FT_UINT16, BASE_HEX, NULL, 0x0,
914                         "" }},
915
916                 { &hf_sna_th_snf,
917                 { "Sequence Number Field",      "sna.th.snf", FT_UINT16, BASE_NONE, NULL, 0x0,
918                         "The Sequence Number Field contains a numerical identifier for"
919                         " the associated BIU."}},
920
921                 { &hf_sna_th_dcf,
922                 { "Data Count Field",   "sna.th.dcf", FT_UINT16, BASE_DEC, NULL, 0x0,
923                         "A binary count of the number of bytes in the BIU or BIU segment associated "
924                         "with the tranmission header. The count does not include any of the bytes "
925                         "in the transmission header."}},
926
927                 { &hf_sna_th_lsid,
928                 { "Local Session Identification",       "sna.th.lsid", FT_UINT8, BASE_HEX, NULL, 0x0,
929                         "" }},
930
931                 { &hf_sna_th_tg_sweep,
932                 { "Transmission Group Sweep",           "sna.th.tg_sweep", FT_UINT8, BASE_DEC,
933                         VALS(sna_th_tg_sweep_vals), 0x08,
934                         "" }},
935
936                 { &hf_sna_th_er_vr_supp_ind,
937                 { "ER and VR Support Indicator",        "sna.th.er_vr_supp_ind", FT_UINT8, BASE_DEC,
938                         VALS(sna_th_er_vr_supp_ind_vals), 0x04,
939                         "" }},
940
941                 { &hf_sna_th_vr_pac_cnt_ind,
942                 { "Virtual Route Pacing Count Indicator",       "sna.th.vr_pac_cnt_ind",
943                         FT_UINT8, BASE_DEC, VALS(sna_th_vr_pac_cnt_ind_vals), 0x02,
944                         "" }},
945
946                 { &hf_sna_th_ntwk_prty,
947                 { "Network Priority",   "sna.th.ntwk_prty",
948                         FT_UINT8, BASE_DEC, VALS(sna_th_ntwk_prty_vals), 0x01,
949                         "" }},
950
951                 { &hf_sna_th_tgsf,
952                 { "Transmission Group Segmenting Field",        "sna.th.tgsf",
953                         FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
954                         "" }},
955
956                 { &hf_sna_th_mft,
957                 { "MPR FID4 Type",      "sna.th.mft", FT_BOOLEAN, BASE_NONE, NULL, 0x04,
958                         "" }},
959
960                 { &hf_sna_th_piubf,
961                 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
962                         VALS(sna_th_piubf_vals), 0x03,
963                         "Specifies whether this frame contains a single PIU or multiple PIUs." }},
964
965                 { &hf_sna_th_iern,
966                 { "Initial Explicit Route Number",      "sna.th.iern", FT_UINT8, BASE_DEC, NULL, 0xf0,
967                         "" }},
968
969                 { &hf_sna_th_nlpoi,
970                 { "NLP Offset Indicator",       "sna.th.nlpoi", FT_UINT8, BASE_DEC,
971                         VALS(sna_th_nlpoi_vals), 0x80,
972                         "" }},
973
974                 { &hf_sna_th_nlp_cp,
975                 { "NLP Count or Padding",       "sna.th.nlp_cp", FT_UINT8, BASE_DEC, NULL, 0x70,
976                         "" }},
977
978                 { &hf_sna_th_ern,
979                 { "Explicit Route Number",      "sna.th.ern", FT_UINT8, BASE_DEC, NULL, 0x0f,
980                         "The ERN in a TH identifies an explicit route direction of flow." }},
981
982                 { &hf_sna_th_vrn,
983                 { "Virtual Route Number",       "sna.th.vrn", FT_UINT8, BASE_DEC, NULL, 0xf0,
984                         "" }},
985
986                 { &hf_sna_th_tpf,
987                 { "Transmission Priority Field",        "sna.th.tpf", FT_UINT8, BASE_HEX,
988                         VALS(sna_th_tpf_vals), 0x03,
989                         "" }},
990
991                 { &hf_sna_th_vr_cwi,
992                 { "Virtual Route Change Window Indicator",      "sna.th.vr_cwi", FT_UINT16, BASE_DEC,
993                         VALS(sna_th_vr_cwi_vals), 0x8000,
994                         "Used to change the window size of the virtual route by 1." }},
995
996                 { &hf_sna_th_tg_nonfifo_ind,
997                 { "Transmission Group Non-FIFO Indicator",      "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
998                         TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000,
999                         "Indicates whether or not FIFO discipline is to enforced in "
1000                         "transmitting PIUs through the tranmission groups to prevent the PIUs "
1001                         "getting out of sequence during transmission over the TGs." }},
1002
1003                 { &hf_sna_th_vr_sqti,
1004                 { "Virtual Route Sequence and Type Indicator",  "sna.th.vr_sqti", FT_UINT16, BASE_HEX,
1005                         VALS(sna_th_vr_sqti_vals), 0x3000,
1006                         "Specifies the PIU type." }},
1007
1008                 { &hf_sna_th_tg_snf,
1009                 { "Transmission Group Sequence Number Field",   "sna.th.tg_snf", FT_UINT16, BASE_DEC,
1010                         NULL, 0x0fff,
1011                         "" }},
1012
1013                 { &hf_sna_th_vrprq,
1014                 { "Virtual Route Pacing Request",       "sna.th.vrprq", FT_BOOLEAN, 16,
1015                         TFS(&sna_th_vrprq_truth), 0x8000,
1016                         "" }},
1017
1018                 { &hf_sna_th_vrprs,
1019                 { "Virtual Route Pacing Response",      "sna.th.vrprs", FT_BOOLEAN, 16,
1020                         TFS(&sna_th_vrprs_truth), 0x4000,
1021                         "" }},
1022
1023                 { &hf_sna_th_vr_cwri,
1024                 { "Virtual Route Change Window Reply Indicator",        "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
1025                         VALS(sna_th_vr_cwri_vals), 0x2000,
1026                         "Permits changing of the window size by 1 for PIUs received by the "
1027                         "sender of this bit." }},
1028
1029                 { &hf_sna_th_vr_rwi,
1030                 { "Virtual Route Reset Window Indicator",       "sna.th.vr_rwi", FT_BOOLEAN, 16,
1031                         TFS(&sna_th_vr_rwi_truth), 0x1000,
1032                         "Indicates severe congestion in a node on the virtual route." }},
1033
1034                 { &hf_sna_th_vr_snf_send,
1035                 { "Virtual Route Send Sequence Number Field",   "sna.th.vr_snf_send", FT_UINT16, BASE_DEC,
1036                         NULL, 0x0fff,
1037                         "" }},
1038
1039                 { &hf_sna_th_dsaf,
1040                 { "Destination Subarea Address Field",  "sna.th.dsaf", FT_UINT32, BASE_HEX, NULL, 0x0,
1041                         "" }},
1042
1043                 { &hf_sna_th_osaf,
1044                 { "Origin Subarea Address Field",       "sna.th.osaf", FT_UINT32, BASE_HEX, NULL, 0x0,
1045                         "" }},
1046
1047                 { &hf_sna_th_snai,
1048                 { "SNA Indicator",      "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
1049                         "Used to identify whether the PIU originated or is destined for "
1050                         "an SNA or non-SNA device." }},
1051
1052                 { &hf_sna_th_def,
1053                 { "Destination Element Field",  "sna.th.def", FT_UINT16, BASE_HEX, NULL, 0x0,
1054                         "" }},
1055
1056                 { &hf_sna_th_oef,
1057                 { "Origin Element Field",       "sna.th.oef", FT_UINT16, BASE_HEX, NULL, 0x0,
1058                         "" }},
1059
1060                 { &hf_sna_th_sa,
1061                 { "Session Address",    "sna.th.sa", FT_BYTES, BASE_HEX, NULL, 0x0,
1062                         "" }},
1063
1064                 { &hf_sna_th_cmd_fmt,
1065                 { "Command Format",     "sna.th.cmd_fmt", FT_UINT8, BASE_HEX, NULL, 0x0,
1066                         "" }},
1067
1068                 { &hf_sna_th_cmd_type,
1069                 { "Command Type",       "sna.th.cmd_type", FT_UINT8, BASE_HEX, NULL, 0x0,
1070                         "" }},
1071
1072                 { &hf_sna_th_cmd_sn,
1073                 { "Command Sequence Number",    "sna.th.cmd_sn", FT_UINT16, BASE_DEC, NULL, 0x0,
1074                         "" }},
1075
1076
1077                 { &hf_sna_rh,
1078                 { "Request/Response Header",    "sna.rh", FT_NONE, BASE_NONE, NULL, 0x0,
1079                         "" }},
1080
1081                 { &hf_sna_rh_0,
1082                 { "Request/Response Header Byte 0",     "sna.rh.0", FT_UINT8, BASE_HEX, NULL, 0x0,
1083                         "" }},
1084
1085                 { &hf_sna_rh_1,
1086                 { "Request/Response Header Byte 1",     "sna.rh.1", FT_UINT8, BASE_HEX, NULL, 0x0,
1087                         "" }},
1088
1089                 { &hf_sna_rh_2,
1090                 { "Request/Response Header Byte 2",     "sna.rh.2", FT_UINT8, BASE_HEX, NULL, 0x0,
1091                         "" }},
1092
1093                 { &hf_sna_rh_rri,
1094                 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8, BASE_DEC, VALS(sna_rh_rri_vals), 0x80,
1095                         "Denotes whether this is a request or a response." }},
1096
1097                 { &hf_sna_rh_ru_category,
1098                 { "Request/Response Unit Category",     "sna.rh.ru_category", FT_UINT8, BASE_HEX,
1099                         VALS(sna_rh_ru_category_vals), 0x60,
1100                         "" }},
1101
1102                 { &hf_sna_rh_fi,
1103                 { "Format Indicator",           "sna.rh.fi", FT_BOOLEAN, 8, TFS(&sna_rh_fi_truth), 0x08,
1104                         "" }},
1105
1106                 { &hf_sna_rh_sdi,
1107                 { "Sense Data Included",        "sna.rh.sdi", FT_BOOLEAN, 8, TFS(&sna_rh_sdi_truth), 0x04,
1108                         "Indicates that a 4-byte sense data field is included in the associated RU." }},
1109
1110                 { &hf_sna_rh_bci,
1111                 { "Begin Chain Indicator",      "sna.rh.bci", FT_BOOLEAN, 8, TFS(&sna_rh_bci_truth), 0x02,
1112                         "" }},
1113
1114                 { &hf_sna_rh_eci,
1115                 { "End Chain Indicator",        "sna.rh.eci", FT_BOOLEAN, 8, TFS(&sna_rh_eci_truth), 0x01,
1116                         "" }},
1117
1118                 { &hf_sna_rh_dr1,
1119                 { "Definite Response 1 Indicator",      "sna.rh.dr1", FT_BOOLEAN, 8, NULL, 0x80,
1120                         "" }},
1121
1122                 { &hf_sna_rh_lcci,
1123                 { "Length-Checked Compression Indicator",       "sna.rh.lcci", FT_BOOLEAN, 8,
1124                         TFS(&sna_rh_lcci_truth), 0x40,
1125                         "" }},
1126
1127                 { &hf_sna_rh_dr2,
1128                 { "Definite Response 2 Indicator",      "sna.rh.dr2", FT_BOOLEAN, 8, NULL, 0x20,
1129                         "" }},
1130
1131                 { &hf_sna_rh_eri,
1132                 { "Exception Response Indicator",       "sna.rh.eri", FT_BOOLEAN, 8, NULL, 0x10,
1133                         "Used in conjunction with DR1I and DR2I to indicate, in a request, "
1134                         "the form of response requested." }},
1135
1136                 { &hf_sna_rh_rti,
1137                 { "Response Type Indicator",    "sna.rh.rti", FT_BOOLEAN, 8, TFS(&sna_rh_rti_truth), 0x10,
1138                         "" }},
1139
1140                 { &hf_sna_rh_rlwi,
1141                 { "Request Larger Window Indicator",    "sna.rh.rlwi", FT_BOOLEAN, 8, NULL, 0x04,
1142                         "Indicates whether a larger pacing window was requested." }},
1143
1144                 { &hf_sna_rh_qri,
1145                 { "Queued Response Indicator",  "sna.rh.qri", FT_BOOLEAN, 8, TFS(&sna_rh_qri_truth), 0x02,
1146                         "" }},
1147
1148                 { &hf_sna_rh_pi,
1149                 { "Pacing Indicator",   "sna.rh.pi", FT_BOOLEAN, 8, NULL, 0x01,
1150                         "" }},
1151
1152                 { &hf_sna_rh_bbi,
1153                 { "Begin Bracket Indicator",    "sna.rh.bbi", FT_BOOLEAN, 8, NULL, 0x80,
1154                         "" }},
1155
1156                 { &hf_sna_rh_ebi,
1157                 { "End Bracket Indicator",      "sna.rh.ebi", FT_BOOLEAN, 8, NULL, 0x40,
1158                         "" }},
1159
1160                 { &hf_sna_rh_cdi,
1161                 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN, 8, NULL, 0x20,
1162                         "" }},
1163
1164                 { &hf_sna_rh_csi,
1165                 { "Code Selection Indicator",   "sna.rh.csi", FT_BOOLEAN, 8, VALS(sna_rh_csi_vals), 0x08,
1166                         "Specifies the encoding used for the associated FMD RU." }},
1167
1168                 { &hf_sna_rh_edi,
1169                 { "Enciphered Data Indicator",  "sna.rh.edi", FT_BOOLEAN, 8, NULL, 0x04,
1170                         "Indicates that information in the associated RU is enciphered under "
1171                         "session-level cryptography protocols." }},
1172
1173                 { &hf_sna_rh_pdi,
1174                 { "Padded Data Indicator",      "sna.rh.pdi", FT_BOOLEAN, 8, NULL, 0x02,
1175                         "Indicates that the RU was padded at the end, before encipherment, to the next "
1176                         "integral multiple of 8 bytes." }},
1177
1178                 { &hf_sna_rh_cebi,
1179                 { "Conditional End Bracket Indicator",  "sna.rh.cebi", FT_BOOLEAN, 8, NULL, 0x01,
1180                         "Used to indicate the beginning or end of a group of exchanged "
1181                         "requests and responses called a bracket. Only used on LU-LU sessions." }},
1182
1183                 { &hf_sna_ru,
1184                 { "Request/Response Unit",      "sna.ru", FT_NONE, BASE_NONE, NULL, 0x0,
1185                         ""}},
1186         };
1187         static gint *ett[] = {
1188                 &ett_sna,
1189                 &ett_sna_th,
1190                 &ett_sna_th_fid,
1191                 &ett_sna_rh,
1192                 &ett_sna_rh_0,
1193                 &ett_sna_rh_1,
1194                 &ett_sna_rh_2,
1195         };
1196
1197         proto_sna = proto_register_protocol("Systems Network Architecture", "sna");
1198         proto_register_field_array(proto_sna, hf, array_length(hf));
1199         proto_register_subtree_array(ett, array_length(ett));
1200 }