3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * $Id: packet-sna.c,v 1.41 2002/08/02 23:36:02 jmayer Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <epan/packet.h>
34 #include <epan/sna-utils.h>
37 * http://www.wanresources.com/snacell.html
38 * ftp://ftp.software.ibm.com/networking/pub/standards/aiw/formats/
42 static int proto_sna = -1;
43 static int hf_sna_th = -1;
44 static int hf_sna_th_0 = -1;
45 static int hf_sna_th_fid = -1;
46 static int hf_sna_th_mpf = -1;
47 static int hf_sna_th_odai = -1;
48 static int hf_sna_th_efi = -1;
49 static int hf_sna_th_daf = -1;
50 static int hf_sna_th_oaf = -1;
51 static int hf_sna_th_snf = -1;
52 static int hf_sna_th_dcf = -1;
53 static int hf_sna_th_lsid = -1;
54 static int hf_sna_th_tg_sweep = -1;
55 static int hf_sna_th_er_vr_supp_ind = -1;
56 static int hf_sna_th_vr_pac_cnt_ind = -1;
57 static int hf_sna_th_ntwk_prty = -1;
58 static int hf_sna_th_tgsf = -1;
59 static int hf_sna_th_mft = -1;
60 static int hf_sna_th_piubf = -1;
61 static int hf_sna_th_iern = -1;
62 static int hf_sna_th_nlpoi = -1;
63 static int hf_sna_th_nlp_cp = -1;
64 static int hf_sna_th_ern = -1;
65 static int hf_sna_th_vrn = -1;
66 static int hf_sna_th_tpf = -1;
67 static int hf_sna_th_vr_cwi = -1;
68 static int hf_sna_th_tg_nonfifo_ind = -1;
69 static int hf_sna_th_vr_sqti = -1;
70 static int hf_sna_th_tg_snf = -1;
71 static int hf_sna_th_vrprq = -1;
72 static int hf_sna_th_vrprs = -1;
73 static int hf_sna_th_vr_cwri = -1;
74 static int hf_sna_th_vr_rwi = -1;
75 static int hf_sna_th_vr_snf_send = -1;
76 static int hf_sna_th_dsaf = -1;
77 static int hf_sna_th_osaf = -1;
78 static int hf_sna_th_snai = -1;
79 static int hf_sna_th_def = -1;
80 static int hf_sna_th_oef = -1;
81 static int hf_sna_th_sa = -1;
82 static int hf_sna_th_cmd_fmt = -1;
83 static int hf_sna_th_cmd_type = -1;
84 static int hf_sna_th_cmd_sn = -1;
86 static int hf_sna_nlp_nhdr = -1;
87 static int hf_sna_nlp_nhdr_0 = -1;
88 static int hf_sna_nlp_sm = -1;
89 static int hf_sna_nlp_tpf = -1;
90 static int hf_sna_nlp_nhdr_1 = -1;
91 static int hf_sna_nlp_ft = -1;
92 static int hf_sna_nlp_tspi = -1;
93 static int hf_sna_nlp_slowdn1 = -1;
94 static int hf_sna_nlp_slowdn2 = -1;
95 static int hf_sna_nlp_fra = -1;
96 static int hf_sna_nlp_anr = -1;
97 static int hf_sna_nlp_frh = -1;
98 static int hf_sna_nlp_thdr = -1;
99 static int hf_sna_nlp_tcid = -1;
100 static int hf_sna_nlp_thdr_8 = -1;
101 static int hf_sna_nlp_setupi = -1;
102 static int hf_sna_nlp_somi = -1;
103 static int hf_sna_nlp_eomi = -1;
104 static int hf_sna_nlp_sri = -1;
105 static int hf_sna_nlp_rasapi = -1;
106 static int hf_sna_nlp_retryi = -1;
107 static int hf_sna_nlp_thdr_9 = -1;
108 static int hf_sna_nlp_lmi = -1;
109 static int hf_sna_nlp_cqfi = -1;
110 static int hf_sna_nlp_osi = -1;
111 static int hf_sna_nlp_offset = -1;
112 static int hf_sna_nlp_dlf = -1;
113 static int hf_sna_nlp_bsn = -1;
115 static int hf_sna_rh = -1;
116 static int hf_sna_rh_0 = -1;
117 static int hf_sna_rh_1 = -1;
118 static int hf_sna_rh_2 = -1;
119 static int hf_sna_rh_rri = -1;
120 static int hf_sna_rh_ru_category = -1;
121 static int hf_sna_rh_fi = -1;
122 static int hf_sna_rh_sdi = -1;
123 static int hf_sna_rh_bci = -1;
124 static int hf_sna_rh_eci = -1;
125 static int hf_sna_rh_dr1 = -1;
126 static int hf_sna_rh_lcci = -1;
127 static int hf_sna_rh_dr2 = -1;
128 static int hf_sna_rh_eri = -1;
129 static int hf_sna_rh_rti = -1;
130 static int hf_sna_rh_rlwi = -1;
131 static int hf_sna_rh_qri = -1;
132 static int hf_sna_rh_pi = -1;
133 static int hf_sna_rh_bbi = -1;
134 static int hf_sna_rh_ebi = -1;
135 static int hf_sna_rh_cdi = -1;
136 static int hf_sna_rh_csi = -1;
137 static int hf_sna_rh_edi = -1;
138 static int hf_sna_rh_pdi = -1;
139 static int hf_sna_rh_cebi = -1;
140 /*static int hf_sna_ru = -1;*/
142 static gint ett_sna = -1;
143 static gint ett_sna_th = -1;
144 static gint ett_sna_th_fid = -1;
145 static gint ett_sna_nlp_nhdr = -1;
146 static gint ett_sna_nlp_nhdr_0 = -1;
147 static gint ett_sna_nlp_nhdr_1 = -1;
148 static gint ett_sna_nlp_thdr = -1;
149 static gint ett_sna_nlp_thdr_8 = -1;
150 static gint ett_sna_nlp_thdr_9 = -1;
151 static gint ett_sna_rh = -1;
152 static gint ett_sna_rh_0 = -1;
153 static gint ett_sna_rh_1 = -1;
154 static gint ett_sna_rh_2 = -1;
156 static dissector_handle_t data_handle;
158 /* Format Identifier */
159 static const value_string sna_th_fid_vals[] = {
160 { 0x0, "SNA device <--> Non-SNA Device" },
161 { 0x1, "Subarea Nodes, without ER or VR" },
162 { 0x2, "Subarea Node <--> PU2" },
163 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
164 { 0x4, "Subarea Nodes, supporting ER and VR" },
165 { 0x5, "HPR RTP endpoint nodes" },
166 { 0xa, "HPR NLP Frame Routing" },
167 { 0xb, "HPR NLP Frame Routing" },
168 { 0xc, "HPR NLP Automatic Network Routing" },
169 { 0xd, "HPR NLP Automatic Network Routing" },
170 { 0xf, "Adjaced Subarea Nodes, supporting ER and VR" },
175 static const value_string sna_th_mpf_vals[] = {
176 { 0, "Middle segment of a BIU" },
177 { 1, "Last segment of a BIU" },
178 { 2, "First segment of a BIU" },
183 /* Expedited Flow Indicator */
184 static const value_string sna_th_efi_vals[] = {
185 { 0, "Normal Flow" },
186 { 1, "Expedited Flow" },
190 /* Request/Response Indicator */
191 static const value_string sna_rh_rri_vals[] = {
197 /* Request/Response Unit Category */
198 static const value_string sna_rh_ru_category_vals[] = {
199 { 0, "Function Management Data (FMD)" },
200 { 1, "Network Control (NC)" },
201 { 2, "Data Flow Control (DFC)" },
202 { 3, "Session Control (SC)" },
206 /* Format Indicator */
207 static const true_false_string sna_rh_fi_truth =
208 { "FM Header", "No FM Header" };
210 /* Sense Data Included */
211 static const true_false_string sna_rh_sdi_truth =
212 { "Included", "Not Included" };
214 /* Begin Chain Indicator */
215 static const true_false_string sna_rh_bci_truth =
216 { "First in Chain", "Not First in Chain" };
218 /* End Chain Indicator */
219 static const true_false_string sna_rh_eci_truth =
220 { "Last in Chain", "Not Last in Chain" };
222 /* Lengith-Checked Compression Indicator */
223 static const true_false_string sna_rh_lcci_truth =
224 { "Compressed", "Not Compressed" };
226 /* Response Type Indicator */
227 static const true_false_string sna_rh_rti_truth =
228 { "Negative", "Positive" };
230 /* Exception Response Indicator */
231 static const true_false_string sna_rh_eri_truth =
232 { "Exception", "Definite" };
234 /* Queued Response Indicator */
235 static const true_false_string sna_rh_qri_truth =
236 { "Enqueue response in TC queues", "Response bypasses TC queues" };
238 /* Code Selection Indicator */
239 static const value_string sna_rh_csi_vals[] = {
246 static const value_string sna_th_tg_sweep_vals[] = {
247 { 0, "This PIU may overtake any PU ahead of it." },
248 { 1, "This PIU does not ovetake any PIU ahead of it." },
253 static const value_string sna_th_er_vr_supp_ind_vals[] = {
254 { 0, "Each node supports ER and VR protocols" },
255 { 1, "Includes at least one node that does not support ER and VR protocols" },
260 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
261 { 0, "Pacing count on the VR has not reached 0" },
262 { 1, "Pacing count on the VR has reached 0" },
267 static const value_string sna_th_ntwk_prty_vals[] = {
268 { 0, "PIU flows at a lower priority" },
269 { 1, "PIU flows at network priority (highest transmission priority)" },
274 static const value_string sna_th_tgsf_vals[] = {
275 { 0, "Not segmented" },
276 { 1, "Last segment" },
277 { 2, "First segment" },
278 { 3, "Middle segment" },
283 static const value_string sna_th_piubf_vals[] = {
284 { 0, "Single PIU frame" },
285 { 1, "Last PIU of a multiple PIU frame" },
286 { 2, "First PIU of a multiple PIU frame" },
287 { 3, "Middle PIU of a multiple PIU frame" },
292 static const value_string sna_th_nlpoi_vals[] = {
293 { 0, "NLP starts within this FID4 TH" },
294 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
299 static const value_string sna_th_tpf_vals[] = {
300 { 0, "Low Priority" },
301 { 1, "Medium Priority" },
302 { 2, "High Priority" },
303 { 3, "Network Priority" },
308 static const value_string sna_th_vr_cwi_vals[] = {
309 { 0, "Increment window size" },
310 { 1, "Decrement window size" },
315 static const true_false_string sna_th_tg_nonfifo_ind_truth =
316 { "TG FIFO is not required", "TG FIFO is required" };
319 static const value_string sna_th_vr_sqti_vals[] = {
320 { 0, "Non-sequenced, Non-supervisory" },
321 { 1, "Non-sequenced, Supervisory" },
322 { 2, "Singly-sequenced" },
327 static const true_false_string sna_th_vrprq_truth = {
328 "VR pacing request is sent asking for a VR pacing response",
329 "No VR pacing response is requested",
333 static const true_false_string sna_th_vrprs_truth = {
334 "VR pacing response is sent in response to a VRPRQ bit set",
335 "No pacing response sent",
339 static const value_string sna_th_vr_cwri_vals[] = {
340 { 0, "Increment window size by 1" },
341 { 1, "Decrement window size by 1" },
346 static const true_false_string sna_th_vr_rwi_truth = {
347 "Reset window size to the minimum specified in NC_ACTVR",
348 "Do not reset window size",
352 static const value_string sna_nlp_sm_vals[] = {
353 { 5, "Function routing" },
354 { 6, "Automatic network routing" },
358 static const true_false_string sna_nlp_tspi_truth =
359 { "Time sensitive", "Not time sensitive" };
361 static const true_false_string sna_nlp_slowdn1_truth =
362 { "Minor congestion", "No minor congestion" };
364 static const true_false_string sna_nlp_slowdn2_truth =
365 { "Major congestion", "No major congestion" };
368 static const value_string sna_nlp_ft_vals[] = {
373 static const value_string sna_nlp_frh_vals[] = {
374 { 0x03, "XID complete request" },
375 { 0x04, "XID complete response" },
379 static const true_false_string sna_nlp_setupi_truth =
380 { "Connection setup segment present", "Connection setup segment not present" };
382 static const true_false_string sna_nlp_somi_truth =
383 { "Start of message", "Not start of message" };
385 static const true_false_string sna_nlp_eomi_truth =
386 { "End of message", "Not end of message" };
388 static const true_false_string sna_nlp_sri_truth =
389 { "Status requested", "No status requested" };
391 static const true_false_string sna_nlp_rasapi_truth =
392 { "Reply as soon as possible", "No need to reply as soon as possible" };
394 static const true_false_string sna_nlp_retryi_truth =
395 { "Undefined", "Sender will retransmit" };
397 static const true_false_string sna_nlp_lmi_truth =
398 { "Last message", "Not last message" };
400 static const true_false_string sna_nlp_cqfi_truth =
401 { "CQFI included", "CQFI not included" };
403 static const true_false_string sna_nlp_osi_truth =
404 { "Optional segments present", "No optional segments present" };
407 static int dissect_fid0_1 (tvbuff_t*, packet_info*, proto_tree*);
408 static int dissect_fid2 (tvbuff_t*, packet_info*, proto_tree*);
409 static int dissect_fid3 (tvbuff_t*, proto_tree*);
410 static int dissect_fid4 (tvbuff_t*, packet_info*, proto_tree*);
411 static int dissect_fid5 (tvbuff_t*, proto_tree*);
412 static int dissect_fidf (tvbuff_t*, proto_tree*);
413 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
414 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
415 static void dissect_rh (tvbuff_t*, int, proto_tree*);
418 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
421 proto_tree *sna_tree = NULL;
422 proto_item *sna_ti = NULL;
424 if (check_col(pinfo->cinfo, COL_PROTOCOL))
425 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
426 if (check_col(pinfo->cinfo, COL_INFO))
427 col_clear(pinfo->cinfo, COL_INFO);
429 /* SNA data should be printed in EBCDIC, not ASCII */
430 pinfo->fd->flags.encoding = CHAR_EBCDIC;
434 /* Don't bother setting length. We'll set it later after we find
435 * the lengths of TH/RH/RU */
436 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1, FALSE);
437 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
440 /* Transmission Header Format Identifier */
441 fid = hi_nibble(tvb_get_guint8(tvb, 0));
443 case 0xa: /* HPR Network Layer Packet */
447 dissect_nlp(tvb, pinfo, sna_tree, tree);
450 dissect_fid(tvb, pinfo, sna_tree, tree);
455 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
456 proto_tree *parent_tree)
459 proto_tree *th_tree = NULL, *rh_tree = NULL;
460 proto_item *th_ti = NULL, *rh_ti = NULL;
462 int sna_header_len = 0, th_header_len = 0;
465 /* Transmission Header Format Identifier */
466 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
468 /* Summary information */
469 if (check_col(pinfo->cinfo, COL_INFO))
470 col_add_str(pinfo->cinfo, COL_INFO,
471 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
476 /* Don't bother setting length. We'll set it later after we find
477 * the length of TH */
478 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1, FALSE);
479 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
486 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
489 th_header_len = dissect_fid2(tvb, pinfo, th_tree);
492 th_header_len = dissect_fid3(tvb, th_tree);
495 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
498 th_header_len = dissect_fid5(tvb, th_tree);
501 th_header_len = dissect_fidf(tvb, th_tree);
504 call_dissector(data_handle,
505 tvb_new_subset(tvb, 1, -1, -1), pinfo, parent_tree);
509 sna_header_len += th_header_len;
510 offset = th_header_len;
513 proto_item_set_len(th_ti, th_header_len);
516 rh_ti = proto_tree_add_item(tree, hf_sna_rh, tvb, offset, 3, FALSE);
517 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
518 dissect_rh(tvb, offset, rh_tree);
528 if (tvb_offset_exists(tvb, offset+1)) {
529 call_dissector(data_handle, tvb_new_subset(tvb, offset, -1, -1),
534 #define SNA_FID01_ADDR_LEN 2
536 /* FID Types 0 and 1 */
538 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
545 const int bytes_in_header = 10;
549 th_0 = tvb_get_guint8(tvb, 0);
550 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
551 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
553 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
554 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
555 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
558 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
561 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, FALSE);
565 ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
566 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
567 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
570 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, FALSE);
574 ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
575 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
576 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
578 /* If we're not filling a proto_tree, return now */
580 return bytes_in_header;
583 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, FALSE);
584 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, FALSE);
586 return bytes_in_header;
589 #define SNA_FID2_ADDR_LEN 1
593 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
597 guint8 th_0=0, daf=0, oaf=0;
600 const int bytes_in_header = 6;
603 th_0 = tvb_get_guint8(tvb, 0);
604 daf = tvb_get_guint8(tvb, 2);
605 oaf = tvb_get_guint8(tvb, 3);
608 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
609 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
611 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
612 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
613 proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0);
614 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
617 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
620 proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf,
621 "Destination Address Field: 0x%02x", daf);
625 ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
626 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
627 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
631 proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf,
632 "Origin Address Field: 0x%02x", oaf);
636 ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
637 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
638 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
641 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, FALSE);
644 return bytes_in_header;
649 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
655 const int bytes_in_header = 2;
657 /* If we're not filling a proto_tree, return now */
659 return bytes_in_header;
662 th_0 = tvb_get_guint8(tvb, 0);
664 /* Create the bitfield tree */
665 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
666 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
668 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
669 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
670 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
672 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, FALSE);
674 return bytes_in_header;
679 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
688 static struct sna_fid_type_4_addr src, dst;
690 const int bytes_in_header = 26;
692 /* If we're not filling a proto_tree, return now */
694 return bytes_in_header;
698 th_byte = tvb_get_guint8(tvb, offset);
700 /* Create the bitfield tree */
701 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset, 1, th_byte);
702 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
705 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, offset, 1, th_byte);
706 proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb, offset, 1, th_byte);
707 proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb, offset, 1, th_byte);
708 proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb, offset, 1, th_byte);
709 proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb, offset, 1, th_byte);
712 th_byte = tvb_get_guint8(tvb, offset);
714 /* Create the bitfield tree */
715 bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 1");
716 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
719 proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1, th_byte);
720 proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1, th_byte);
721 proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1, th_byte);
723 mft = th_byte & 0x04;
725 th_byte = tvb_get_guint8(tvb, offset);
727 /* Create the bitfield tree */
728 bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 2");
729 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
733 proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb, offset, 1, th_byte);
734 proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb, offset, 1, th_byte);
737 proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb, offset, 1, th_byte);
739 proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1, th_byte);
742 th_byte = tvb_get_guint8(tvb, offset);
744 /* Create the bitfield tree */
745 bf_item = proto_tree_add_text(tree, tvb, offset, 1, "Transmision Header Byte 3");
746 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
749 proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1, th_byte);
750 proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, offset, 1, th_byte);
753 th_word = tvb_get_ntohs(tvb, offset);
755 /* Create the bitfield tree */
756 bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Bytes 4-5");
757 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
760 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb, offset, 2, th_word);
761 proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb, offset, 2, th_word);
762 proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb, offset, 2, th_word);
764 /* I'm not sure about byte-order on this one... */
765 proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb, offset, 2, th_word);
768 th_word = tvb_get_ntohs(tvb, offset);
770 /* Create the bitfield tree */
771 bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Bytes 6-7");
772 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
775 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset, 2, th_word);
776 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset, 2, th_word);
777 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset, 2, th_word);
778 proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset, 2, th_word);
780 /* I'm not sure about byte-order on this one... */
781 proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb, offset, 2, th_word);
786 dsaf = tvb_get_ntohl(tvb, 8);
789 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
794 osaf = tvb_get_ntohl(tvb, 12);
797 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
800 th_byte = tvb_get_guint8(tvb, offset);
802 /* Create the bitfield tree */
803 bf_item = proto_tree_add_text(tree, tvb, offset, 2, "Transmision Header Byte 16");
804 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
807 proto_tree_add_boolean(tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
809 /* We luck out here because in their infinite wisdom the SNA
810 * architects placed the MPF and EFI fields in the same bitfield
811 * locations, even though for FID4 they're not in byte 0.
813 proto_tree_add_uint(tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
814 proto_tree_add_uint(tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
816 offset += 2; /* 1 for byte 16, 1 for byte 17 which is reserved */
820 def = tvb_get_ntohs(tvb, 18);
823 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
826 /* Addresses in FID 4 are discontiguous, sigh */
829 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8* )&dst);
830 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&dst);
833 oef = tvb_get_ntohs(tvb, 20);
835 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
838 /* Addresses in FID 4 are discontiguous, sigh */
841 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&src);
842 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, (guint8 *)&src);
845 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, FALSE);
846 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, FALSE);
849 return bytes_in_header;
854 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
860 const int bytes_in_header = 12;
862 /* If we're not filling a proto_tree, return now */
864 return bytes_in_header;
867 th_0 = tvb_get_guint8(tvb, 0);
869 /* Create the bitfield tree */
870 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
871 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
873 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
874 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
875 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
877 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
878 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, FALSE);
880 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, FALSE);
882 return bytes_in_header;
888 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
894 const int bytes_in_header = 26;
896 /* If we're not filling a proto_tree, return now */
898 return bytes_in_header;
901 th_0 = tvb_get_guint8(tvb, 0);
903 /* Create the bitfield tree */
904 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
905 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
907 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
908 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
910 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, FALSE);
911 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, FALSE);
912 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, FALSE);
914 /* Yup, bytes 6-23 are reserved! */
915 proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
917 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, FALSE);
919 return bytes_in_header;
922 /* HPR Network Layer Packet */
924 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
925 proto_tree *parent_tree)
927 proto_tree *nlp_tree, *bf_tree;
928 proto_item *nlp_item, *bf_item, *h_item;
929 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9;
930 guint32 thdr_len, thdr_dlf, thdr_bsn;
932 int index = 0, counter = 0;
937 nhdr_0 = tvb_get_guint8(tvb, index);
938 nhdr_1 = tvb_get_guint8(tvb, index+1);
940 if (check_col(pinfo->cinfo, COL_INFO))
941 col_add_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
944 /* Don't bother setting length. We'll set it later after we find
945 * the lengths of NHDR */
946 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb, index, -1, FALSE);
947 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
949 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_0, tvb, index, 1, nhdr_0);
950 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_0);
952 proto_tree_add_uint(bf_tree, hf_sna_nlp_sm, tvb, index, 1, nhdr_0);
953 proto_tree_add_uint(bf_tree, hf_sna_nlp_tpf, tvb, index, 1, nhdr_0);
955 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_1, tvb, index+1, 1, nhdr_1);
956 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_1);
958 proto_tree_add_uint(bf_tree, hf_sna_nlp_ft, tvb, index+1, 1, nhdr_1);
959 proto_tree_add_boolean(bf_tree, hf_sna_nlp_tspi, tvb, index+1, 1, nhdr_1);
960 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn1, tvb, index+1, 1, nhdr_1);
961 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn2, tvb, index+1, 1, nhdr_1);
963 /* ANR or FR lists */
968 if ((nhdr_0 & 0xe0) == 0xa0) {
970 nhdr_x = tvb_get_guint8(tvb, index + counter);
972 } while (nhdr_x != 0xff);
974 h_item = proto_tree_add_item(nlp_tree, hf_sna_nlp_fra, tvb, index, counter, FALSE);
977 index++; /* 1 Byte Reserved */
980 proto_item_set_len(nlp_item, index);
982 if ((nhdr_1 & 0x80) == 0x10) {
983 nhdr_x = tvb_get_guint8(tvb, index);
985 proto_tree_add_uint(tree, hf_sna_nlp_frh, tvb, index, 1, nhdr_x);
989 if (tvb_offset_exists(tvb, index+1)) {
990 call_dissector(data_handle,
991 tvb_new_subset(tvb, index, -1, -1),
997 if ((nhdr_0 & 0xe0) == 0xc0) {
999 nhdr_x = tvb_get_guint8(tvb, index + counter);
1001 } while (nhdr_x != 0xff);
1003 h_item = proto_tree_add_item(nlp_tree, hf_sna_nlp_anr, tvb, index, counter, FALSE);
1006 index++; /* 1 Byte Reserved */
1009 proto_item_set_len(nlp_item, index);
1014 thdr_8 = tvb_get_guint8(tvb, index+8);
1015 thdr_9 = tvb_get_guint8(tvb, index+9);
1016 thdr_len = tvb_get_ntohs(tvb, index+10);
1017 thdr_dlf = tvb_get_ntohl(tvb, index+12);
1018 thdr_bsn = tvb_get_ntohl(tvb, index+16);
1021 /* Don't bother setting length. We'll set it later after we find
1022 * the lengths of NHDR */
1023 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb, index, -1, FALSE);
1024 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1026 bf_item = proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb, index, 8, FALSE);
1028 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_8, tvb, index+8, 1, thdr_8);
1029 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_8);
1031 proto_tree_add_boolean(bf_tree, hf_sna_nlp_setupi, tvb, index+8, 1, thdr_8);
1032 proto_tree_add_boolean(bf_tree, hf_sna_nlp_somi, tvb, index+8, 1, thdr_8);
1033 proto_tree_add_boolean(bf_tree, hf_sna_nlp_eomi, tvb, index+8, 1, thdr_8);
1034 proto_tree_add_boolean(bf_tree, hf_sna_nlp_sri, tvb, index+8, 1, thdr_8);
1035 proto_tree_add_boolean(bf_tree, hf_sna_nlp_rasapi, tvb, index+8, 1, thdr_8);
1036 proto_tree_add_boolean(bf_tree, hf_sna_nlp_retryi, tvb, index+8, 1, thdr_8);
1038 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_9, tvb, index+9, 1, thdr_9);
1039 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_9);
1041 proto_tree_add_boolean(bf_tree, hf_sna_nlp_lmi, tvb, index+9, 1, thdr_9);
1042 proto_tree_add_boolean(bf_tree, hf_sna_nlp_cqfi, tvb, index+9, 1, thdr_9);
1043 proto_tree_add_boolean(bf_tree, hf_sna_nlp_osi, tvb, index+9, 1, thdr_9);
1045 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, index+10, 2, thdr_len);
1046 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, index+12, 4, thdr_dlf);
1047 proto_tree_add_uint(nlp_tree, hf_sna_nlp_bsn, tvb, index+16, 4, thdr_bsn);
1049 proto_item_set_len(nlp_item, thdr_len);
1051 index += (thdr_len << 2);
1052 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1053 if (check_col(pinfo->cinfo, COL_INFO))
1054 col_add_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1055 if (tvb_offset_exists(tvb, index+1)) {
1056 call_dissector(data_handle,
1057 tvb_new_subset(tvb, index, -1, -1), pinfo,
1062 if (tvb_offset_exists(tvb, index+1)) {
1063 dissect_fid(tvb_new_subset(tvb, index, -1, -1), pinfo, tree,
1070 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
1072 proto_tree *bf_tree;
1073 proto_item *bf_item;
1074 gboolean is_response;
1075 guint8 rh_0, rh_1, rh_2;
1078 /* Create the bitfield tree for byte 0*/
1079 rh_0 = tvb_get_guint8(tvb, offset);
1080 is_response = (rh_0 & 0x80);
1082 bf_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, rh_0);
1083 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
1085 proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
1086 proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1, rh_0);
1087 proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
1088 proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
1089 proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
1090 proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
1093 rh_1 = tvb_get_guint8(tvb, offset);
1095 /* Create the bitfield tree for byte 1*/
1096 bf_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, rh_1);
1097 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
1099 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb, offset, 1, rh_1);
1102 proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1, rh_1);
1105 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb, offset, 1, rh_1);
1108 proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb, offset, 1, rh_1);
1111 proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb, offset, 1, rh_1);
1112 proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1, rh_1);
1115 proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
1116 proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb, offset, 1, rh_1);
1119 rh_2 = tvb_get_guint8(tvb, offset);
1121 /* Create the bitfield tree for byte 2*/
1122 bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
1125 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
1127 proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb, offset, 1, rh_2);
1128 proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb, offset, 1, rh_2);
1129 proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb, offset, 1, rh_2);
1130 proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb, offset, 1, rh_2);
1131 proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb, offset, 1, rh_2);
1132 proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb, offset, 1, rh_2);
1133 proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1, rh_2);
1136 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
1140 proto_register_sna(void)
1142 static hf_register_info hf[] = {
1144 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE, NULL, 0x0,
1148 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX, NULL, 0x0,
1149 "Byte 0 of Tranmission Header contains FID, MPF, ODAI,"
1150 " and EFI as bitfields.", HFILL }},
1153 { "Format Identifer", "sna.th.fid", FT_UINT8, BASE_HEX, VALS(sna_th_fid_vals), 0xf0,
1154 "Format Identification", HFILL }},
1157 { "Mapping Field", "sna.th.mpf", FT_UINT8, BASE_DEC, VALS(sna_th_mpf_vals), 0x0c,
1158 "The Mapping Field specifies whether the information field"
1159 " associated with the TH is a complete or partial BIU.", HFILL }},
1162 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8, BASE_DEC, NULL, 0x02,
1163 "The ODAI indicates which node assigned the OAF'-DAF' values"
1164 " carried in the TH.", HFILL }},
1167 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8, BASE_DEC, VALS(sna_th_efi_vals), 0x01,
1168 "The EFI designates whether the PIU belongs to the normal"
1169 " or expedited flow.", HFILL }},
1172 { "Destination Address Field", "sna.th.daf", FT_UINT16, BASE_HEX, NULL, 0x0,
1176 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX, NULL, 0x0,
1180 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC, NULL, 0x0,
1181 "The Sequence Number Field contains a numerical identifier for"
1182 " the associated BIU.", HFILL }},
1185 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC, NULL, 0x0,
1186 "A binary count of the number of bytes in the BIU or BIU segment associated "
1187 "with the tranmission header. The count does not include any of the bytes "
1188 "in the transmission header.", HFILL }},
1191 { "Local Session Identification", "sna.th.lsid", FT_UINT8, BASE_HEX, NULL, 0x0,
1194 { &hf_sna_th_tg_sweep,
1195 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8, BASE_DEC,
1196 VALS(sna_th_tg_sweep_vals), 0x08,
1199 { &hf_sna_th_er_vr_supp_ind,
1200 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind", FT_UINT8, BASE_DEC,
1201 VALS(sna_th_er_vr_supp_ind_vals), 0x04,
1204 { &hf_sna_th_vr_pac_cnt_ind,
1205 { "Virtual Route Pacing Count Indicator", "sna.th.vr_pac_cnt_ind",
1206 FT_UINT8, BASE_DEC, VALS(sna_th_vr_pac_cnt_ind_vals), 0x02,
1209 { &hf_sna_th_ntwk_prty,
1210 { "Network Priority", "sna.th.ntwk_prty",
1211 FT_UINT8, BASE_DEC, VALS(sna_th_ntwk_prty_vals), 0x01,
1215 { "Transmission Group Segmenting Field", "sna.th.tgsf",
1216 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
1220 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, BASE_NONE, NULL, 0x04,
1224 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
1225 VALS(sna_th_piubf_vals), 0x03,
1226 "Specifies whether this frame contains a single PIU or multiple PIUs.", HFILL }},
1229 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8, BASE_DEC, NULL, 0xf0,
1233 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
1234 VALS(sna_th_nlpoi_vals), 0x80,
1237 { &hf_sna_th_nlp_cp,
1238 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC, NULL, 0x70,
1242 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC, NULL, 0x0f,
1243 "The ERN in a TH identifies an explicit route direction of flow.", HFILL }},
1246 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC, NULL, 0xf0,
1250 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8, BASE_HEX,
1251 VALS(sna_th_tpf_vals), 0x03,
1254 { &hf_sna_th_vr_cwi,
1255 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi", FT_UINT16, BASE_DEC,
1256 VALS(sna_th_vr_cwi_vals), 0x8000,
1257 "Used to change the window size of the virtual route by 1.", HFILL }},
1259 { &hf_sna_th_tg_nonfifo_ind,
1260 { "Transmission Group Non-FIFO Indicator", "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
1261 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000,
1262 "Indicates whether or not FIFO discipline is to enforced in "
1263 "transmitting PIUs through the tranmission groups to prevent the PIUs "
1264 "getting out of sequence during transmission over the TGs.", HFILL }},
1266 { &hf_sna_th_vr_sqti,
1267 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti", FT_UINT16, BASE_HEX,
1268 VALS(sna_th_vr_sqti_vals), 0x3000,
1269 "Specifies the PIU type.", HFILL }},
1271 { &hf_sna_th_tg_snf,
1272 { "Transmission Group Sequence Number Field", "sna.th.tg_snf", FT_UINT16, BASE_DEC,
1277 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN, 16,
1278 TFS(&sna_th_vrprq_truth), 0x8000,
1282 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN, 16,
1283 TFS(&sna_th_vrprs_truth), 0x4000,
1286 { &hf_sna_th_vr_cwri,
1287 { "Virtual Route Change Window Reply Indicator", "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
1288 VALS(sna_th_vr_cwri_vals), 0x2000,
1289 "Permits changing of the window size by 1 for PIUs received by the "
1290 "sender of this bit.", HFILL }},
1292 { &hf_sna_th_vr_rwi,
1293 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi", FT_BOOLEAN, 16,
1294 TFS(&sna_th_vr_rwi_truth), 0x1000,
1295 "Indicates severe congestion in a node on the virtual route.", HFILL }},
1297 { &hf_sna_th_vr_snf_send,
1298 { "Virtual Route Send Sequence Number Field", "sna.th.vr_snf_send", FT_UINT16, BASE_DEC,
1303 { "Destination Subarea Address Field", "sna.th.dsaf", FT_UINT32, BASE_HEX, NULL, 0x0,
1307 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32, BASE_HEX, NULL, 0x0,
1311 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
1312 "Used to identify whether the PIU originated or is destined for "
1313 "an SNA or non-SNA device.", HFILL }},
1316 { "Destination Element Field", "sna.th.def", FT_UINT16, BASE_HEX, NULL, 0x0,
1320 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX, NULL, 0x0,
1324 { "Session Address", "sna.th.sa", FT_BYTES, BASE_HEX, NULL, 0x0,
1327 { &hf_sna_th_cmd_fmt,
1328 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX, NULL, 0x0,
1331 { &hf_sna_th_cmd_type,
1332 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX, NULL, 0x0,
1335 { &hf_sna_th_cmd_sn,
1336 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16, BASE_DEC, NULL, 0x0,
1340 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE, BASE_NONE, NULL, 0x0,
1341 "Network Layer Packet Header (NHDR)", HFILL }},
1343 { &hf_sna_nlp_nhdr_0,
1344 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0", FT_UINT8, BASE_HEX, NULL, 0x0,
1345 "Byte 0 of Network Layer Packet contains SM and TPF", HFILL }},
1347 { &hf_sna_nlp_nhdr_1,
1348 { "Network Layer Packet Header Bype 1", "sna.nlp.nhdr.1", FT_UINT8, BASE_HEX, NULL, 0x0,
1349 "Byte 1 of Network Layer Packet contains FT,"
1350 " Time Sensitive Packet Indicator and Congestion Indicator", HFILL }},
1353 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8, BASE_HEX,
1354 VALS(sna_nlp_sm_vals), 0xe0,
1358 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8, BASE_HEX,
1359 VALS(sna_th_tpf_vals), 0x06,
1363 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
1364 VALS(sna_nlp_ft_vals), 0xF0,
1368 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi", FT_BOOLEAN, 8,
1369 TFS(&sna_nlp_tspi_truth), 0x08,
1372 { &hf_sna_nlp_slowdn1,
1373 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
1374 TFS(&sna_nlp_slowdn1_truth), 0x04,
1377 { &hf_sna_nlp_slowdn2,
1378 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
1379 TFS(&sna_nlp_slowdn2_truth), 0x02,
1383 { "Function Routing Address Entry", "sna.nlp.nhdr.fra", FT_BYTES, BASE_NONE, NULL, 0,
1387 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr", FT_BYTES, BASE_HEX, NULL, 0,
1391 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8, BASE_HEX,
1392 VALS(sna_nlp_frh_vals), 0, "", HFILL }},
1395 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE, NULL, 0x0,
1396 "RTP Transport Header (THDR)", HFILL }},
1399 { "Transport Connection Identifier", "sna.nlp.thdr.tcid", FT_BYTES, BASE_HEX, NULL, 0x0,
1400 "Transport Connection Identifier (TCID)", HFILL }},
1402 { &hf_sna_nlp_thdr_8,
1403 { "RTP Transport Packet Header Bype 8", "sna.nlp.thdr.8", FT_UINT8, BASE_HEX, NULL, 0x0,
1404 "Byte 8 of RTP Transport Packet Header", HFILL }},
1406 { &hf_sna_nlp_setupi,
1407 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
1408 TFS(&sna_nlp_setupi_truth), 0x40,
1412 { "Start Of Message Indicator", "sna.nlp.thdr.somi", FT_BOOLEAN, 8,
1413 TFS(&sna_nlp_somi_truth), 0x20,
1417 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN, 8,
1418 TFS(&sna_nlp_eomi_truth), 0x10,
1422 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN, 8,
1423 TFS(&sna_nlp_sri_truth), 0x08,
1426 { &hf_sna_nlp_rasapi,
1427 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN, 8,
1428 TFS(&sna_nlp_rasapi_truth), 0x04,
1431 { &hf_sna_nlp_retryi,
1432 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN, 8,
1433 TFS(&sna_nlp_retryi_truth), 0x02,
1436 { &hf_sna_nlp_thdr_9,
1437 { "RTP Transport Packet Header Bype 9", "sna.nlp.thdr.9", FT_UINT8, BASE_HEX, NULL, 0x0,
1438 "Byte 9 of RTP Transport Packet Header", HFILL }},
1441 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN, 8,
1442 TFS(&sna_nlp_lmi_truth), 0x80,
1446 { "Connection Qualifyer Field Indicator", "sna.nlp.thdr.cqfi", FT_BOOLEAN, 8,
1447 TFS(&sna_nlp_cqfi_truth), 0x08,
1451 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi", FT_BOOLEAN, 8,
1452 TFS(&sna_nlp_osi_truth), 0x04,
1455 { &hf_sna_nlp_offset,
1456 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX, NULL, 0x0,
1457 "Data Offset in words", HFILL }},
1460 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX, NULL, 0x0,
1461 "Data Length Field", HFILL }},
1464 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32, BASE_HEX, NULL, 0x0,
1465 "Byte Sequence Number", HFILL }},
1469 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE, NULL, 0x0,
1473 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8, BASE_HEX, NULL, 0x0,
1477 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8, BASE_HEX, NULL, 0x0,
1481 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8, BASE_HEX, NULL, 0x0,
1485 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8, BASE_DEC, VALS(sna_rh_rri_vals), 0x80,
1486 "Denotes whether this is a request or a response.", HFILL }},
1488 { &hf_sna_rh_ru_category,
1489 { "Request/Response Unit Category", "sna.rh.ru_category", FT_UINT8, BASE_HEX,
1490 VALS(sna_rh_ru_category_vals), 0x60,
1494 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8, TFS(&sna_rh_fi_truth), 0x08,
1498 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8, TFS(&sna_rh_sdi_truth), 0x04,
1499 "Indicates that a 4-byte sense data field is included in the associated RU.", HFILL }},
1502 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8, TFS(&sna_rh_bci_truth), 0x02,
1506 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8, TFS(&sna_rh_eci_truth), 0x01,
1510 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN, 8, NULL, 0x80,
1514 { "Length-Checked Compression Indicator", "sna.rh.lcci", FT_BOOLEAN, 8,
1515 TFS(&sna_rh_lcci_truth), 0x40,
1519 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN, 8, NULL, 0x20,
1523 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN, 8, NULL, 0x10,
1524 "Used in conjunction with DR1I and DR2I to indicate, in a request, "
1525 "the form of response requested.", HFILL }},
1528 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN, 8, TFS(&sna_rh_rti_truth), 0x10,
1532 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN, 8, NULL, 0x04,
1533 "Indicates whether a larger pacing window was requested.", HFILL }},
1536 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN, 8, TFS(&sna_rh_qri_truth), 0x02,
1540 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN, 8, NULL, 0x01,
1544 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN, 8, NULL, 0x80,
1548 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN, 8, NULL, 0x40,
1552 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN, 8, NULL, 0x20,
1556 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC, VALS(sna_rh_csi_vals), 0x08,
1557 "Specifies the encoding used for the associated FMD RU.", HFILL }},
1560 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8, NULL, 0x04,
1561 "Indicates that information in the associated RU is enciphered under "
1562 "session-level cryptography protocols.", HFILL }},
1565 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL, 0x02,
1566 "Indicates that the RU was padded at the end, before encipherment, to the next "
1567 "integral multiple of 8 bytes.", HFILL }},
1570 { "Conditional End Bracket Indicator", "sna.rh.cebi", FT_BOOLEAN, 8, NULL, 0x01,
1571 "Used to indicate the beginning or end of a group of exchanged "
1572 "requests and responses called a bracket. Only used on LU-LU sessions.", HFILL }},
1575 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE, NULL, 0x0,
1578 static gint *ett[] = {
1583 &ett_sna_nlp_nhdr_0,
1584 &ett_sna_nlp_nhdr_1,
1586 &ett_sna_nlp_thdr_8,
1587 &ett_sna_nlp_thdr_9,
1594 proto_sna = proto_register_protocol("Systems Network Architecture",
1596 proto_register_field_array(proto_sna, hf, array_length(hf));
1597 proto_register_subtree_array(ett, array_length(ett));
1598 register_dissector("sna", dissect_sna, proto_sna);
1602 proto_reg_handoff_sna(void)
1604 dissector_handle_t sna_handle;
1606 sna_handle = find_dissector("sna");
1607 dissector_add("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
1609 dissector_add("ppp.protocol", PPP_SNA, sna_handle);
1610 data_handle = find_dissector("data");