3 * Gilbert Ramirez <gram@alumni.rice.edu>
4 * Jochen Friedrich <jochen@scram.de>
6 * $Id: packet-sna.c,v 1.46 2003/03/05 07:17:50 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
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.
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.
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.
32 #include <epan/packet.h>
35 #include <epan/sna-utils.h>
37 #include "reassemble.h"
41 * http://www.wanresources.com/snacell.html
42 * ftp://ftp.software.ibm.com/networking/pub/standards/aiw/formats/
46 static int proto_sna = -1;
47 static int proto_sna_xid = -1;
48 static int hf_sna_th = -1;
49 static int hf_sna_th_0 = -1;
50 static int hf_sna_th_fid = -1;
51 static int hf_sna_th_mpf = -1;
52 static int hf_sna_th_odai = -1;
53 static int hf_sna_th_efi = -1;
54 static int hf_sna_th_daf = -1;
55 static int hf_sna_th_oaf = -1;
56 static int hf_sna_th_snf = -1;
57 static int hf_sna_th_dcf = -1;
58 static int hf_sna_th_lsid = -1;
59 static int hf_sna_th_tg_sweep = -1;
60 static int hf_sna_th_er_vr_supp_ind = -1;
61 static int hf_sna_th_vr_pac_cnt_ind = -1;
62 static int hf_sna_th_ntwk_prty = -1;
63 static int hf_sna_th_tgsf = -1;
64 static int hf_sna_th_mft = -1;
65 static int hf_sna_th_piubf = -1;
66 static int hf_sna_th_iern = -1;
67 static int hf_sna_th_nlpoi = -1;
68 static int hf_sna_th_nlp_cp = -1;
69 static int hf_sna_th_ern = -1;
70 static int hf_sna_th_vrn = -1;
71 static int hf_sna_th_tpf = -1;
72 static int hf_sna_th_vr_cwi = -1;
73 static int hf_sna_th_tg_nonfifo_ind = -1;
74 static int hf_sna_th_vr_sqti = -1;
75 static int hf_sna_th_tg_snf = -1;
76 static int hf_sna_th_vrprq = -1;
77 static int hf_sna_th_vrprs = -1;
78 static int hf_sna_th_vr_cwri = -1;
79 static int hf_sna_th_vr_rwi = -1;
80 static int hf_sna_th_vr_snf_send = -1;
81 static int hf_sna_th_dsaf = -1;
82 static int hf_sna_th_osaf = -1;
83 static int hf_sna_th_snai = -1;
84 static int hf_sna_th_def = -1;
85 static int hf_sna_th_oef = -1;
86 static int hf_sna_th_sa = -1;
87 static int hf_sna_th_cmd_fmt = -1;
88 static int hf_sna_th_cmd_type = -1;
89 static int hf_sna_th_cmd_sn = -1;
91 static int hf_sna_nlp_nhdr = -1;
92 static int hf_sna_nlp_nhdr_0 = -1;
93 static int hf_sna_nlp_sm = -1;
94 static int hf_sna_nlp_tpf = -1;
95 static int hf_sna_nlp_nhdr_1 = -1;
96 static int hf_sna_nlp_ft = -1;
97 static int hf_sna_nlp_tspi = -1;
98 static int hf_sna_nlp_slowdn1 = -1;
99 static int hf_sna_nlp_slowdn2 = -1;
100 static int hf_sna_nlp_fra = -1;
101 static int hf_sna_nlp_anr = -1;
102 static int hf_sna_nlp_frh = -1;
103 static int hf_sna_nlp_thdr = -1;
104 static int hf_sna_nlp_tcid = -1;
105 static int hf_sna_nlp_thdr_8 = -1;
106 static int hf_sna_nlp_setupi = -1;
107 static int hf_sna_nlp_somi = -1;
108 static int hf_sna_nlp_eomi = -1;
109 static int hf_sna_nlp_sri = -1;
110 static int hf_sna_nlp_rasapi = -1;
111 static int hf_sna_nlp_retryi = -1;
112 static int hf_sna_nlp_thdr_9 = -1;
113 static int hf_sna_nlp_lmi = -1;
114 static int hf_sna_nlp_cqfi = -1;
115 static int hf_sna_nlp_osi = -1;
116 static int hf_sna_nlp_offset = -1;
117 static int hf_sna_nlp_dlf = -1;
118 static int hf_sna_nlp_bsn = -1;
119 static int hf_sna_nlp_opti_len = -1;
120 static int hf_sna_nlp_opti_type = -1;
121 static int hf_sna_nlp_opti_0d_version = -1;
122 static int hf_sna_nlp_opti_0d_4 = -1;
123 static int hf_sna_nlp_opti_0d_target = -1;
124 static int hf_sna_nlp_opti_0d_arb = -1;
125 static int hf_sna_nlp_opti_0d_reliable = -1;
126 static int hf_sna_nlp_opti_0d_dedicated = -1;
127 static int hf_sna_nlp_opti_0e_stat = -1;
128 static int hf_sna_nlp_opti_0e_gap = -1;
129 static int hf_sna_nlp_opti_0e_idle = -1;
130 static int hf_sna_nlp_opti_0e_nabsp = -1;
131 static int hf_sna_nlp_opti_0e_sync = -1;
132 static int hf_sna_nlp_opti_0e_echo = -1;
133 static int hf_sna_nlp_opti_0e_rseq = -1;
134 static int hf_sna_nlp_opti_0e_abspbeg = -1;
135 static int hf_sna_nlp_opti_0e_abspend = -1;
136 static int hf_sna_nlp_opti_0f_bits = -1;
137 static int hf_sna_nlp_opti_10_tcid = -1;
138 static int hf_sna_nlp_opti_12_sense = -1;
139 static int hf_sna_nlp_opti_14_si_len = -1;
140 static int hf_sna_nlp_opti_14_si_key = -1;
141 static int hf_sna_nlp_opti_14_si_2 = -1;
142 static int hf_sna_nlp_opti_14_si_refifo = -1;
143 static int hf_sna_nlp_opti_14_si_mobility = -1;
144 static int hf_sna_nlp_opti_14_si_dirsearch = -1;
145 static int hf_sna_nlp_opti_14_si_limitres = -1;
146 static int hf_sna_nlp_opti_14_si_ncescope = -1;
147 static int hf_sna_nlp_opti_14_si_mnpsrscv = -1;
148 static int hf_sna_nlp_opti_14_si_maxpsize = -1;
149 static int hf_sna_nlp_opti_14_si_switch = -1;
150 static int hf_sna_nlp_opti_14_si_alive = -1;
151 static int hf_sna_nlp_opti_14_rr_len = -1;
152 static int hf_sna_nlp_opti_14_rr_key = -1;
153 static int hf_sna_nlp_opti_14_rr_2 = -1;
154 static int hf_sna_nlp_opti_14_rr_bfe = -1;
155 static int hf_sna_nlp_opti_14_rr_num = -1;
156 static int hf_sna_nlp_opti_22_2 = -1;
157 static int hf_sna_nlp_opti_22_type = -1;
158 static int hf_sna_nlp_opti_22_raa = -1;
159 static int hf_sna_nlp_opti_22_parity = -1;
160 static int hf_sna_nlp_opti_22_arb = -1;
161 static int hf_sna_nlp_opti_22_3 = -1;
162 static int hf_sna_nlp_opti_22_ratereq = -1;
163 static int hf_sna_nlp_opti_22_raterep = -1;
164 static int hf_sna_nlp_opti_22_field1 = -1;
165 static int hf_sna_nlp_opti_22_field2 = -1;
166 static int hf_sna_nlp_opti_22_field3 = -1;
167 static int hf_sna_nlp_opti_22_field4 = -1;
169 static int hf_sna_rh = -1;
170 static int hf_sna_rh_0 = -1;
171 static int hf_sna_rh_1 = -1;
172 static int hf_sna_rh_2 = -1;
173 static int hf_sna_rh_rri = -1;
174 static int hf_sna_rh_ru_category = -1;
175 static int hf_sna_rh_fi = -1;
176 static int hf_sna_rh_sdi = -1;
177 static int hf_sna_rh_bci = -1;
178 static int hf_sna_rh_eci = -1;
179 static int hf_sna_rh_dr1 = -1;
180 static int hf_sna_rh_lcci = -1;
181 static int hf_sna_rh_dr2 = -1;
182 static int hf_sna_rh_eri = -1;
183 static int hf_sna_rh_rti = -1;
184 static int hf_sna_rh_rlwi = -1;
185 static int hf_sna_rh_qri = -1;
186 static int hf_sna_rh_pi = -1;
187 static int hf_sna_rh_bbi = -1;
188 static int hf_sna_rh_ebi = -1;
189 static int hf_sna_rh_cdi = -1;
190 static int hf_sna_rh_csi = -1;
191 static int hf_sna_rh_edi = -1;
192 static int hf_sna_rh_pdi = -1;
193 static int hf_sna_rh_cebi = -1;
194 /*static int hf_sna_ru = -1;*/
196 static int hf_sna_gds = -1;
197 static int hf_sna_gds_len = -1;
198 static int hf_sna_gds_type = -1;
199 static int hf_sna_gds_cont = -1;
201 static int hf_sna_xid = -1;
202 static int hf_sna_xid_0 = -1;
203 static int hf_sna_xid_id = -1;
204 static int hf_sna_xid_format = -1;
205 static int hf_sna_xid_type = -1;
206 static int hf_sna_xid_len = -1;
207 static int hf_sna_xid_idblock = -1;
208 static int hf_sna_xid_idnum = -1;
209 static int hf_sna_xid_3_8 = -1;
210 static int hf_sna_xid_3_init_self = -1;
211 static int hf_sna_xid_3_stand_bind = -1;
212 static int hf_sna_xid_3_gener_bind = -1;
213 static int hf_sna_xid_3_recve_bind = -1;
214 static int hf_sna_xid_3_actpu = -1;
215 static int hf_sna_xid_3_nwnode = -1;
216 static int hf_sna_xid_3_cp = -1;
217 static int hf_sna_xid_3_cpcp = -1;
218 static int hf_sna_xid_3_state = -1;
219 static int hf_sna_xid_3_nonact = -1;
220 static int hf_sna_xid_3_cpchange = -1;
221 static int hf_sna_xid_3_10 = -1;
222 static int hf_sna_xid_3_asend_bind = -1;
223 static int hf_sna_xid_3_arecv_bind = -1;
224 static int hf_sna_xid_3_quiesce = -1;
225 static int hf_sna_xid_3_pucap = -1;
226 static int hf_sna_xid_3_pbn = -1;
227 static int hf_sna_xid_3_pacing = -1;
228 static int hf_sna_xid_3_11 = -1;
229 static int hf_sna_xid_3_tgshare = -1;
230 static int hf_sna_xid_3_dedsvc = -1;
231 static int hf_sna_xid_3_12 = -1;
232 static int hf_sna_xid_3_negcsup = -1;
233 static int hf_sna_xid_3_negcomp = -1;
234 static int hf_sna_xid_3_15 = -1;
235 static int hf_sna_xid_3_partg = -1;
236 static int hf_sna_xid_3_dlur = -1;
237 static int hf_sna_xid_3_dlus = -1;
238 static int hf_sna_xid_3_exbn = -1;
239 static int hf_sna_xid_3_genodai = -1;
240 static int hf_sna_xid_3_branch = -1;
241 static int hf_sna_xid_3_brnn = -1;
242 static int hf_sna_xid_3_tg = -1;
243 static int hf_sna_xid_3_dlc = -1;
244 static int hf_sna_xid_3_dlen = -1;
246 static int hf_sna_control_len = -1;
247 static int hf_sna_control_key = -1;
248 static int hf_sna_control_hprkey = -1;
249 static int hf_sna_control_05_delay = -1;
250 static int hf_sna_control_05_type = -1;
251 static int hf_sna_control_05_ptp = -1;
252 static int hf_sna_control_0e_type = -1;
253 static int hf_sna_control_0e_value = -1;
255 static gint ett_sna = -1;
256 static gint ett_sna_th = -1;
257 static gint ett_sna_th_fid = -1;
258 static gint ett_sna_nlp_nhdr = -1;
259 static gint ett_sna_nlp_nhdr_0 = -1;
260 static gint ett_sna_nlp_nhdr_1 = -1;
261 static gint ett_sna_nlp_thdr = -1;
262 static gint ett_sna_nlp_thdr_8 = -1;
263 static gint ett_sna_nlp_thdr_9 = -1;
264 static gint ett_sna_nlp_opti_un = -1;
265 static gint ett_sna_nlp_opti_0d = -1;
266 static gint ett_sna_nlp_opti_0d_4 = -1;
267 static gint ett_sna_nlp_opti_0e = -1;
268 static gint ett_sna_nlp_opti_0e_stat = -1;
269 static gint ett_sna_nlp_opti_0e_absp = -1;
270 static gint ett_sna_nlp_opti_0f = -1;
271 static gint ett_sna_nlp_opti_10 = -1;
272 static gint ett_sna_nlp_opti_12 = -1;
273 static gint ett_sna_nlp_opti_14 = -1;
274 static gint ett_sna_nlp_opti_14_si = -1;
275 static gint ett_sna_nlp_opti_14_si_2 = -1;
276 static gint ett_sna_nlp_opti_14_rr = -1;
277 static gint ett_sna_nlp_opti_14_rr_2 = -1;
278 static gint ett_sna_nlp_opti_22 = -1;
279 static gint ett_sna_nlp_opti_22_2 = -1;
280 static gint ett_sna_nlp_opti_22_3 = -1;
281 static gint ett_sna_rh = -1;
282 static gint ett_sna_rh_0 = -1;
283 static gint ett_sna_rh_1 = -1;
284 static gint ett_sna_rh_2 = -1;
285 static gint ett_sna_gds = -1;
286 static gint ett_sna_xid_0 = -1;
287 static gint ett_sna_xid_id = -1;
288 static gint ett_sna_xid_3_8 = -1;
289 static gint ett_sna_xid_3_10 = -1;
290 static gint ett_sna_xid_3_11 = -1;
291 static gint ett_sna_xid_3_12 = -1;
292 static gint ett_sna_xid_3_15 = -1;
293 static gint ett_sna_control_un = -1;
294 static gint ett_sna_control_05 = -1;
295 static gint ett_sna_control_05hpr = -1;
296 static gint ett_sna_control_05hpr_type = -1;
297 static gint ett_sna_control_0e = -1;
299 static dissector_handle_t data_handle;
301 /* Defragment fragmented SNA BIUs*/
302 static gboolean sna_defragment = FALSE;
303 static GHashTable *sna_fragment_table = NULL;
304 static GHashTable *sna_reassembled_table = NULL;
306 /* Format Identifier */
307 static const value_string sna_th_fid_vals[] = {
308 { 0x0, "SNA device <--> Non-SNA Device" },
309 { 0x1, "Subarea Nodes, without ER or VR" },
310 { 0x2, "Subarea Node <--> PU2" },
311 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
312 { 0x4, "Subarea Nodes, supporting ER and VR" },
313 { 0x5, "HPR RTP endpoint nodes" },
314 { 0xa, "HPR NLP Frame Routing" },
315 { 0xb, "HPR NLP Frame Routing" },
316 { 0xc, "HPR NLP Automatic Network Routing" },
317 { 0xd, "HPR NLP Automatic Network Routing" },
318 { 0xf, "Adjaced Subarea Nodes, supporting ER and VR" },
323 #define MPF_MIDDLE_SEGMENT 0
324 #define MPF_LAST_SEGMENT 1
325 #define MPF_FIRST_SEGMENT 2
326 #define MPF_WHOLE_BIU 3
328 static const value_string sna_th_mpf_vals[] = {
329 { MPF_MIDDLE_SEGMENT, "Middle segment of a BIU" },
330 { MPF_LAST_SEGMENT, "Last segment of a BIU" },
331 { MPF_FIRST_SEGMENT, "First segment of a BIU" },
332 { MPF_WHOLE_BIU, "Whole BIU" },
336 /* Expedited Flow Indicator */
337 static const value_string sna_th_efi_vals[] = {
338 { 0, "Normal Flow" },
339 { 1, "Expedited Flow" },
343 /* Request/Response Indicator */
344 static const value_string sna_rh_rri_vals[] = {
350 /* Request/Response Unit Category */
351 static const value_string sna_rh_ru_category_vals[] = {
352 { 0, "Function Management Data (FMD)" },
353 { 1, "Network Control (NC)" },
354 { 2, "Data Flow Control (DFC)" },
355 { 3, "Session Control (SC)" },
359 /* Format Indicator */
360 static const true_false_string sna_rh_fi_truth =
361 { "FM Header", "No FM Header" };
363 /* Sense Data Included */
364 static const true_false_string sna_rh_sdi_truth =
365 { "Included", "Not Included" };
367 /* Begin Chain Indicator */
368 static const true_false_string sna_rh_bci_truth =
369 { "First in Chain", "Not First in Chain" };
371 /* End Chain Indicator */
372 static const true_false_string sna_rh_eci_truth =
373 { "Last in Chain", "Not Last in Chain" };
375 /* Lengith-Checked Compression Indicator */
376 static const true_false_string sna_rh_lcci_truth =
377 { "Compressed", "Not Compressed" };
379 /* Response Type Indicator */
380 static const true_false_string sna_rh_rti_truth =
381 { "Negative", "Positive" };
383 /* Exception Response Indicator */
384 static const true_false_string sna_rh_eri_truth =
385 { "Exception", "Definite" };
387 /* Queued Response Indicator */
388 static const true_false_string sna_rh_qri_truth =
389 { "Enqueue response in TC queues", "Response bypasses TC queues" };
391 /* Code Selection Indicator */
392 static const value_string sna_rh_csi_vals[] = {
399 static const value_string sna_th_tg_sweep_vals[] = {
400 { 0, "This PIU may overtake any PU ahead of it." },
401 { 1, "This PIU does not ovetake any PIU ahead of it." },
406 static const value_string sna_th_er_vr_supp_ind_vals[] = {
407 { 0, "Each node supports ER and VR protocols" },
408 { 1, "Includes at least one node that does not support ER and VR"
414 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
415 { 0, "Pacing count on the VR has not reached 0" },
416 { 1, "Pacing count on the VR has reached 0" },
421 static const value_string sna_th_ntwk_prty_vals[] = {
422 { 0, "PIU flows at a lower priority" },
423 { 1, "PIU flows at network priority (highest transmission priority)" },
428 static const value_string sna_th_tgsf_vals[] = {
429 { 0, "Not segmented" },
430 { 1, "Last segment" },
431 { 2, "First segment" },
432 { 3, "Middle segment" },
437 static const value_string sna_th_piubf_vals[] = {
438 { 0, "Single PIU frame" },
439 { 1, "Last PIU of a multiple PIU frame" },
440 { 2, "First PIU of a multiple PIU frame" },
441 { 3, "Middle PIU of a multiple PIU frame" },
446 static const value_string sna_th_nlpoi_vals[] = {
447 { 0, "NLP starts within this FID4 TH" },
448 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
453 static const value_string sna_th_tpf_vals[] = {
454 { 0, "Low Priority" },
455 { 1, "Medium Priority" },
456 { 2, "High Priority" },
457 { 3, "Network Priority" },
462 static const value_string sna_th_vr_cwi_vals[] = {
463 { 0, "Increment window size" },
464 { 1, "Decrement window size" },
469 static const true_false_string sna_th_tg_nonfifo_ind_truth =
470 { "TG FIFO is not required", "TG FIFO is required" };
473 static const value_string sna_th_vr_sqti_vals[] = {
474 { 0, "Non-sequenced, Non-supervisory" },
475 { 1, "Non-sequenced, Supervisory" },
476 { 2, "Singly-sequenced" },
481 static const true_false_string sna_th_vrprq_truth = {
482 "VR pacing request is sent asking for a VR pacing response",
483 "No VR pacing response is requested",
487 static const true_false_string sna_th_vrprs_truth = {
488 "VR pacing response is sent in response to a VRPRQ bit set",
489 "No pacing response sent",
493 static const value_string sna_th_vr_cwri_vals[] = {
494 { 0, "Increment window size by 1" },
495 { 1, "Decrement window size by 1" },
500 static const true_false_string sna_th_vr_rwi_truth = {
501 "Reset window size to the minimum specified in NC_ACTVR",
502 "Do not reset window size",
506 static const value_string sna_nlp_sm_vals[] = {
507 { 5, "Function routing" },
508 { 6, "Automatic network routing" },
512 static const true_false_string sna_nlp_tspi_truth =
513 { "Time sensitive", "Not time sensitive" };
515 static const true_false_string sna_nlp_slowdn1_truth =
516 { "Minor congestion", "No minor congestion" };
518 static const true_false_string sna_nlp_slowdn2_truth =
519 { "Major congestion", "No major congestion" };
522 static const value_string sna_nlp_ft_vals[] = {
527 static const value_string sna_nlp_frh_vals[] = {
528 { 0x03, "XID complete request" },
529 { 0x04, "XID complete response" },
533 static const true_false_string sna_nlp_setupi_truth =
534 { "Connection setup segment present", "Connection setup segment not"
537 static const true_false_string sna_nlp_somi_truth =
538 { "Start of message", "Not start of message" };
540 static const true_false_string sna_nlp_eomi_truth =
541 { "End of message", "Not end of message" };
543 static const true_false_string sna_nlp_sri_truth =
544 { "Status requested", "No status requested" };
546 static const true_false_string sna_nlp_rasapi_truth =
547 { "Reply as soon as possible", "No need to reply as soon as possible" };
549 static const true_false_string sna_nlp_retryi_truth =
550 { "Undefined", "Sender will retransmit" };
552 static const true_false_string sna_nlp_lmi_truth =
553 { "Last message", "Not last message" };
555 static const true_false_string sna_nlp_cqfi_truth =
556 { "CQFI included", "CQFI not included" };
558 static const true_false_string sna_nlp_osi_truth =
559 { "Optional segments present", "No optional segments present" };
561 static const value_string sna_xid_3_state_vals[] = {
562 { 0x00, "Exchange state indicators not supported" },
563 { 0x01, "Negotiation-proceeding exchange" },
564 { 0x02, "Prenegotiation exchange" },
565 { 0x03, "Nonactivation exchange" },
569 static const value_string sna_xid_3_branch_vals[] = {
570 { 0x00, "Sender does not support branch extender" },
571 { 0x01, "TG is branch uplink" },
572 { 0x02, "TG is branch downlink" },
573 { 0x03, "TG is neither uplink nor downlink" },
577 static const value_string sna_xid_type_vals[] = {
579 { 0x02, "T2.0 or T2.1 node" },
580 { 0x03, "Reserved" },
581 { 0x04, "T4 or T5 node" },
585 static const value_string sna_nlp_opti_vals[] = {
586 { 0x0d, "Connection Setup Segment" },
587 { 0x0e, "Status Segment" },
588 { 0x0f, "Client Out Of Band Bits Segment" },
589 { 0x10, "Connection Identifier Exchange Segment" },
590 { 0x12, "Connection Fault Segment" },
591 { 0x14, "Switching Information Segment" },
592 { 0x22, "Adaptive Rate-Based Segment" },
596 static const value_string sna_nlp_opti_0d_version_vals[] = {
597 { 0x0101, "Version 1.1" },
601 static const value_string sna_nlp_opti_0f_bits_vals[] = {
602 { 0x0001, "Request Deactivation" },
603 { 0x8000, "Reply - OK" },
604 { 0x8004, "Reply - Reject" },
608 static const value_string sna_nlp_opti_22_type_vals[] = {
610 { 0x01, "Rate Reply" },
611 { 0x02, "Rate Request" },
612 { 0x03, "Rate Request/Rate Reply" },
616 static const value_string sna_nlp_opti_22_raa_vals[] = {
618 { 0x01, "Restraint" },
619 { 0x02, "Slowdown1" },
620 { 0x03, "Slowdown2" },
621 { 0x04, "Critical" },
625 static const value_string sna_nlp_opti_22_arb_vals[] = {
626 { 0x00, "Base Mode ARB" },
627 { 0x01, "Responsive Mode ARB" },
631 /* GDS Variable Type */
632 static const value_string sna_gds_var_vals[] = {
633 { 0x1210, "Change Number Of Sessions" },
634 { 0x1211, "Exchange Log Name" },
635 { 0x1212, "Control Point Management Services Unit" },
636 { 0x1213, "Compare States" },
637 { 0x1214, "LU Names Position" },
638 { 0x1215, "LU Name" },
639 { 0x1217, "Do Know" },
640 { 0x1218, "Partner Restart" },
641 { 0x1219, "Don't Know" },
642 { 0x1220, "Sign-Off" },
643 { 0x1221, "Sign-On" },
644 { 0x1222, "SNMP-over-SNA" },
645 { 0x1223, "Node Address Service" },
646 { 0x12C1, "CP Capabilities" },
647 { 0x12C2, "Topology Database Update" },
648 { 0x12C3, "Register Resource" },
649 { 0x12C4, "Locate" },
650 { 0x12C5, "Cross-Domain Initiate" },
651 { 0x12C9, "Delete Resource" },
652 { 0x12CA, "Find Resource" },
653 { 0x12CB, "Found Resource" },
654 { 0x12CC, "Notify" },
655 { 0x12CD, "Initiate-Other Cross-Domain" },
656 { 0x12CE, "Route Setup" },
657 { 0x12E1, "Error Log" },
658 { 0x12F1, "Null Data" },
659 { 0x12F2, "User Control Date" },
660 { 0x12F3, "Map Name" },
661 { 0x12F4, "Error Data" },
662 { 0x12F6, "Authentication Token Data" },
663 { 0x12F8, "Service Flow Authentication Token Data" },
664 { 0x12FF, "Application Data" },
665 { 0x1310, "MDS Message Unit" },
666 { 0x1311, "MDS Routing Information" },
667 { 0x1500, "FID2 Encapsulation" },
671 /* Control Vector Type */
672 static const value_string sna_control_vals[] = {
673 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
674 { 0x01, "Date-Time Control Vector" },
675 { 0x02, "Subarea Routing Control Vector" },
676 { 0x03, "SDLC Secondary Station Control Vector" },
677 { 0x04, "LU Control Vector" },
678 { 0x05, "Channel Control Vector" },
679 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
680 { 0x07, "PU FMD-RU-Usage Control Vector" },
681 { 0x08, "Intensive Mode Control Vector" },
682 { 0x09, "Activation Request / Response Sequence Identifier Control"
684 { 0x0a, "User Request Correlator Control Vector" },
685 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
686 { 0x0c, "LU-LU Session Capabilities Control Vector" },
687 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
689 { 0x0e, "Network Name Control Vector" },
690 { 0x0f, "Link Capabilities and Status Control Vector" },
691 { 0x10, "Product Set ID Control Vector" },
692 { 0x11, "Load Module Correlation Control Vector" },
693 { 0x12, "Network Identifier Control Vector" },
694 { 0x13, "Gateway Support Capabilities Control Vector" },
695 { 0x14, "Session Initiation Control Vector" },
696 { 0x15, "Network-Qualified Address Pair Control Vector" },
697 { 0x16, "Names Substitution Control Vector" },
698 { 0x17, "SSCP Identifier Control Vector" },
699 { 0x18, "SSCP Name Control Vector" },
700 { 0x19, "Resource Identifier Control Vector" },
701 { 0x1a, "NAU Address Control Vector" },
702 { 0x1b, "VRID List Control Vector" },
703 { 0x1c, "Network-Qualified Name Pair Control Vector" },
704 { 0x1e, "VR-ER Mapping Data Control Vector" },
705 { 0x1f, "ER Configuration Control Vector" },
706 { 0x23, "Local-Form Session Identifier Control Vector" },
707 { 0x24, "IPL Load Module Request Control Vector" },
708 { 0x25, "Security ID Control Control Vector" },
709 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
710 { 0x27, "XRF Session Activation Control Vector" },
711 { 0x28, "Related Session Identifier Control Vector" },
712 { 0x29, "Session State Data Control Vector" },
713 { 0x2a, "Session Information Control Vector" },
714 { 0x2b, "Route Selection Control Vector" },
715 { 0x2c, "COS/TPF Control Vector" },
716 { 0x2d, "Mode Control Vector" },
717 { 0x2f, "LU Definition Control Vector" },
718 { 0x30, "Assign LU Characteristics Control Vector" },
719 { 0x31, "BIND Image Control Vector" },
720 { 0x32, "Short-Hold Mode Control Vector" },
721 { 0x33, "ENCP Search Control Control Vector" },
722 { 0x34, "LU Definition Override Control Vector" },
723 { 0x35, "Extended Sense Data Control Vector" },
724 { 0x36, "Directory Error Control Vector" },
725 { 0x37, "Directory Entry Correlator Control Vector" },
726 { 0x38, "Short-Hold Mode Emulation Control Vector" },
727 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
729 { 0x3a, "Route Status Data Control Vector" },
730 { 0x3b, "VR Congestion Data Control Vector" },
731 { 0x3c, "Associated Resource Entry Control Vector" },
732 { 0x3d, "Directory Entry Control Vector" },
733 { 0x3e, "Directory Entry Characteristic Control Vector" },
734 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
735 { 0x40, "Real Associated Resource Control Vector" },
736 { 0x41, "Station Parameters Control Vector" },
737 { 0x42, "Dynamic Path Update Data Control Vector" },
738 { 0x43, "Extended SDLC Station Control Vector" },
739 { 0x44, "Node Descriptor Control Vector" },
740 { 0x45, "Node Characteristics Control Vector" },
741 { 0x46, "TG Descriptor Control Vector" },
742 { 0x47, "TG Characteristics Control Vector" },
743 { 0x48, "Topology Resource Descriptor Control Vector" },
744 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
746 { 0x4a, "Real Owning Control Point Control Vector" },
747 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
748 { 0x51, "DLUR/S Capabilities Control Vector" },
749 { 0x52, "Primary Send Pacing Window Size Control Vector" },
750 { 0x56, "Call Security Verification Control Vector" },
751 { 0x57, "DLC Connection Data Control Vector" },
752 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
753 { 0x5a, "Session Services Extension Support Control Vector" },
754 { 0x5b, "Interchange Node Support Control Vector" },
755 { 0x5c, "APPN Message Transport Control Vector" },
756 { 0x5d, "Subarea Message Transport Control Vector" },
757 { 0x5e, "Related Request Control Vector" },
758 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
759 { 0x60, "Fully Qualified PCID Control Vector" },
760 { 0x61, "HPR Capabilities Control Vector" },
761 { 0x62, "Session Address Control Vector" },
762 { 0x63, "Cryptographic Key Distribution Control Vector" },
763 { 0x64, "TCP/IP Information Control Vector" },
764 { 0x65, "Device Characteristics Control Vector" },
765 { 0x66, "Length-Checked Compression Control Vector" },
766 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
767 { 0x68, "XRF/Session Cryptography Control Vector" },
768 { 0x69, "Switched Parameters Control Vector" },
769 { 0x6a, "ER Congestion Data Control Vector" },
770 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
771 { 0xfe, "Control Vector Keys Not Recognized" },
775 static const value_string sna_control_hpr_vals[] = {
776 { 0x00, "Node Identifier Control Vector" },
777 { 0x03, "Network ID Control Vector" },
778 { 0x05, "Network Address Control Vector" },
782 static const value_string sna_control_0e_type_vals[] = {
786 { 0xF5, "SSCP Name" },
787 { 0xF6, "NNCP Name" },
788 { 0xF7, "Link Station Name" },
789 { 0xF8, "CP Name of CP(PLU)" },
790 { 0xF9, "CP Name of CP(SLU)" },
791 { 0xFA, "Generic Name" },
795 /* Values to direct the top-most dissector what to dissect
797 enum next_dissection_enum {
808 typedef enum next_dissection_enum next_dissection_t;
810 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
811 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
812 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
813 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
814 static void dissect_rh (tvbuff_t*, int, proto_tree*);
815 static void dissect_control(tvbuff_t*, proto_tree*, int, enum parse);
817 /* --------------------------------------------------------------------
818 * Chapter 2 High-Performance Routing (HPR) Headers
819 * --------------------------------------------------------------------
823 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
825 int bits, offset, len, pad;
826 proto_tree *sub_tree;
827 proto_item *sub_ti = NULL;
832 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, FALSE);
833 bits = tvb_get_guint8(tvb, 4);
835 sub_ti = proto_tree_add_uint(tree, hf_sna_nlp_opti_0d_4,
837 sub_tree = proto_item_add_subtree(sub_ti,
838 ett_sna_nlp_opti_0d_4);
840 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_target,
842 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_arb,
844 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_reliable,
846 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_dedicated,
849 proto_tree_add_text(tree, tvb, 5, 3, "Reserved");
853 while (tvb_offset_exists(tvb, offset)) {
854 len = tvb_get_guint8(tvb, offset+0);
856 dissect_control(tvb_new_subset(tvb, offset, len, -1),
858 pad = (len+3) & 0xfffc;
860 proto_tree_add_text(tree, tvb, offset+len,
864 /* Avoid endless loop */
871 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
874 proto_tree *sub_tree;
875 proto_item *sub_ti = NULL;
877 bits = tvb_get_guint8(tvb, 2);
881 sub_ti = proto_tree_add_item(tree, hf_sna_nlp_opti_0e_stat,
883 sub_tree = proto_item_add_subtree(sub_ti,
884 ett_sna_nlp_opti_0e_stat);
886 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_gap,
888 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_idle,
890 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
892 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
894 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
896 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
898 proto_tree_add_text(tree, tvb, 12, 8, "Reserved");
900 if (tvb_offset_exists(tvb, offset))
901 call_dissector(data_handle,
902 tvb_new_subset(tvb, 4, -1, -1), pinfo, tree);
905 if (check_col(pinfo->cinfo, COL_INFO))
906 col_add_str(pinfo->cinfo, COL_INFO,
909 if (check_col(pinfo->cinfo, COL_INFO))
910 col_add_str(pinfo->cinfo, COL_INFO,
911 "HPR Status Message");
916 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
921 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, FALSE);
922 if (tvb_offset_exists(tvb, 4))
923 call_dissector(data_handle,
924 tvb_new_subset(tvb, 4, -1, -1), pinfo, tree);
928 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
933 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
934 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, FALSE);
935 if (tvb_offset_exists(tvb, 12))
936 call_dissector(data_handle,
937 tvb_new_subset(tvb, 12, -1, -1), pinfo, tree);
941 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
946 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
947 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, FALSE);
951 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
953 proto_tree *sub_tree, *bf_tree;
954 proto_item *sub_item, *bf_item;
955 int len, pad, type, bits, offset, num, sublen;
960 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
964 len = tvb_get_guint8(tvb, offset);
965 type = tvb_get_guint8(tvb, offset+1);
967 if ((type != 0x83) || (len <= 16)) {
969 call_dissector(data_handle,
970 tvb_new_subset(tvb, offset, -1, -1), pinfo, tree);
973 sub_item = proto_tree_add_text(tree, tvb, offset, len,
974 "Switching Information Control Vector");
975 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_si);
977 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
978 tvb, offset, 1, len);
979 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
980 tvb, offset+1, 1, type);
982 bits = tvb_get_guint8(tvb, offset+2);
983 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_2,
984 tvb, offset+2, 1, bits);
985 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_si_2);
987 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_refifo,
988 tvb, offset+2, 1, bits);
989 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mobility,
990 tvb, offset+2, 1, bits);
991 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_dirsearch,
992 tvb, offset+2, 1, bits);
993 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_limitres,
994 tvb, offset+2, 1, bits);
995 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_ncescope,
996 tvb, offset+2, 1, bits);
997 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mnpsrscv,
998 tvb, offset+2, 1, bits);
1000 proto_tree_add_text(sub_tree, tvb, offset+3, 1, "Reserved");
1001 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
1002 tvb, offset+4, 4, FALSE);
1003 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
1004 tvb, offset+8, 4, FALSE);
1005 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
1006 tvb, offset+12, 4, FALSE);
1008 dissect_control(tvb_new_subset(tvb, offset+16,
1009 len-16, -1), sub_tree, 1, LT);
1011 pad = (len+3) & 0xfffc;
1013 proto_tree_add_text(sub_tree, tvb, offset+len, pad-len,
1017 len = tvb_get_guint8(tvb, offset);
1018 type = tvb_get_guint8(tvb, offset+1);
1020 if ((type != 0x85) || ( len < 4)) {
1022 call_dissector(data_handle,
1023 tvb_new_subset(tvb, offset, -1, -1), pinfo, tree);
1026 sub_item = proto_tree_add_text(tree, tvb, offset, len,
1027 "Return Route TG Descriptor Control Vector");
1028 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_rr);
1030 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1031 tvb, offset, 1, len);
1032 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1033 tvb, offset+1, 1, type);
1035 bits = tvb_get_guint8(tvb, offset+2);
1036 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_2,
1037 tvb, offset+2, 1, bits);
1038 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_rr_2);
1040 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_rr_bfe,
1041 tvb, offset+2, 1, bits);
1043 num = tvb_get_guint8(tvb, offset+3);
1045 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1046 tvb, offset+3, 1, num);
1051 sublen = tvb_get_guint8(tvb, offset);
1053 dissect_control(tvb_new_subset(tvb, offset,
1054 sublen, -1), sub_tree, 1, LT);
1057 call_dissector(data_handle,
1058 tvb_new_subset(tvb, offset, -1, -1), pinfo, tree);
1061 /* No padding here */
1068 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1070 proto_tree *bf_tree;
1071 proto_item *bf_item;
1077 bits = tvb_get_guint8(tvb, 2);
1078 type = (bits & 0xc0) >> 6;
1080 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_2,
1082 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_2);
1084 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_type,
1086 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raa,
1088 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_22_parity,
1090 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_arb,
1093 bits = tvb_get_guint8(tvb, 3);
1095 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_3,
1097 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_3);
1099 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_ratereq,
1101 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raterep,
1104 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1106 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1110 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1112 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1115 if (tvb_offset_exists(tvb, 20))
1116 call_dissector(data_handle,
1117 tvb_new_subset(tvb, 20, -1, -1), pinfo, tree);
1119 if (tvb_offset_exists(tvb, 12))
1120 call_dissector(data_handle,
1121 tvb_new_subset(tvb, 12, -1, -1), pinfo, tree);
1126 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1128 proto_tree *sub_tree;
1129 proto_item *sub_item;
1130 int offset, type, len;
1137 while (tvb_offset_exists(tvb, offset)) {
1138 len = tvb_get_guint8(tvb, offset);
1139 type = tvb_get_guint8(tvb, offset+1);
1141 /* Prevent loop for invalid crap in packet */
1144 call_dissector(data_handle,
1145 tvb_new_subset(tvb, offset,
1146 -1, -1), pinfo, tree);
1150 ett = ett_sna_nlp_opti_un;
1151 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1152 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1153 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1154 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1155 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1156 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1157 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1159 sub_item = proto_tree_add_text(tree, tvb,
1161 val_to_str(type, sna_nlp_opti_vals,
1162 "Unknown Segment Type"));
1163 sub_tree = proto_item_add_subtree(sub_item, ett);
1164 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1165 tvb, offset, 1, len);
1166 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1167 tvb, offset+1, 1, type);
1171 dissect_optional_0d(tvb_new_subset(tvb, offset,
1172 len << 2, -1), sub_tree);
1175 dissect_optional_0e(tvb_new_subset(tvb, offset,
1176 len << 2, -1), pinfo, sub_tree);
1179 dissect_optional_0f(tvb_new_subset(tvb, offset,
1180 len << 2, -1), pinfo, sub_tree);
1183 dissect_optional_10(tvb_new_subset(tvb, offset,
1184 len << 2, -1), pinfo, sub_tree);
1187 dissect_optional_12(tvb_new_subset(tvb, offset,
1188 len << 2, -1), sub_tree);
1191 dissect_optional_14(tvb_new_subset(tvb, offset,
1192 len << 2, -1), pinfo, sub_tree);
1195 dissect_optional_22(tvb_new_subset(tvb, offset,
1196 len << 2, -1), pinfo, sub_tree);
1199 call_dissector(data_handle,
1200 tvb_new_subset(tvb, offset,
1201 len << 2, -1), pinfo, sub_tree);
1203 offset += (len << 2);
1208 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1209 proto_tree *parent_tree)
1211 proto_tree *nlp_tree, *bf_tree;
1212 proto_item *nlp_item, *bf_item, *h_item;
1213 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1214 guint32 thdr_len, thdr_dlf;
1217 int index = 0, counter = 0;
1222 nhdr_0 = tvb_get_guint8(tvb, index);
1223 nhdr_1 = tvb_get_guint8(tvb, index+1);
1225 if (check_col(pinfo->cinfo, COL_INFO))
1226 col_add_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1229 /* Don't bother setting length. We'll set it later after we
1230 * find the lengths of NHDR */
1231 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1233 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1235 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_0, tvb,
1237 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_0);
1239 proto_tree_add_uint(bf_tree, hf_sna_nlp_sm, tvb, index, 1,
1241 proto_tree_add_uint(bf_tree, hf_sna_nlp_tpf, tvb, index, 1,
1244 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_1, tvb,
1245 index+1, 1, nhdr_1);
1246 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_1);
1248 proto_tree_add_uint(bf_tree, hf_sna_nlp_ft, tvb,
1249 index+1, 1, nhdr_1);
1250 proto_tree_add_boolean(bf_tree, hf_sna_nlp_tspi, tvb,
1251 index+1, 1, nhdr_1);
1252 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn1, tvb,
1253 index+1, 1, nhdr_1);
1254 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn2, tvb,
1255 index+1, 1, nhdr_1);
1257 /* ANR or FR lists */
1262 if ((nhdr_0 & 0xe0) == 0xa0) {
1264 nhdr_x = tvb_get_guint8(tvb, index + counter);
1266 } while (nhdr_x != 0xff);
1268 h_item = proto_tree_add_item(nlp_tree,
1269 hf_sna_nlp_fra, tvb, index, counter, FALSE);
1272 proto_tree_add_text(nlp_tree, tvb, index, 1,
1277 proto_item_set_len(nlp_item, index);
1279 if ((nhdr_1 & 0xf0) == 0x10) {
1280 nhdr_x = tvb_get_guint8(tvb, index);
1282 proto_tree_add_uint(tree, hf_sna_nlp_frh,
1283 tvb, index, 1, nhdr_x);
1286 if (tvb_offset_exists(tvb, index))
1287 call_dissector(data_handle,
1288 tvb_new_subset(tvb, index, -1, -1),
1289 pinfo, parent_tree);
1293 if ((nhdr_0 & 0xe0) == 0xc0) {
1295 nhdr_x = tvb_get_guint8(tvb, index + counter);
1297 } while (nhdr_x != 0xff);
1299 h_item = proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1300 tvb, index, counter, FALSE);
1304 proto_tree_add_text(nlp_tree, tvb, index, 1,
1309 proto_item_set_len(nlp_item, index);
1312 thdr_8 = tvb_get_guint8(tvb, index+8);
1313 thdr_9 = tvb_get_guint8(tvb, index+9);
1314 thdr_len = tvb_get_ntohs(tvb, index+10);
1315 thdr_dlf = tvb_get_ntohl(tvb, index+12);
1318 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1319 index, thdr_len << 2, FALSE);
1320 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1322 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1324 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_8, tvb,
1325 index+8, 1, thdr_8);
1326 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_8);
1328 proto_tree_add_boolean(bf_tree, hf_sna_nlp_setupi, tvb,
1329 index+8, 1, thdr_8);
1330 proto_tree_add_boolean(bf_tree, hf_sna_nlp_somi, tvb, index+8,
1332 proto_tree_add_boolean(bf_tree, hf_sna_nlp_eomi, tvb, index+8,
1334 proto_tree_add_boolean(bf_tree, hf_sna_nlp_sri, tvb, index+8,
1336 proto_tree_add_boolean(bf_tree, hf_sna_nlp_rasapi, tvb,
1337 index+8, 1, thdr_8);
1338 proto_tree_add_boolean(bf_tree, hf_sna_nlp_retryi, tvb,
1339 index+8, 1, thdr_8);
1341 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_9, tvb,
1342 index+9, 1, thdr_9);
1343 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_9);
1345 proto_tree_add_boolean(bf_tree, hf_sna_nlp_lmi, tvb, index+9,
1347 proto_tree_add_boolean(bf_tree, hf_sna_nlp_cqfi, tvb, index+9,
1349 proto_tree_add_boolean(bf_tree, hf_sna_nlp_osi, tvb, index+9,
1352 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, index+10,
1354 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, index+12,
1356 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, index+16,
1361 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindex)) {
1362 counter = tvb_get_guint8(tvb, index + subindex);
1363 if (tvb_get_guint8(tvb, index+subindex+1) == 5)
1365 tvb_new_subset(tvb, index + subindex,
1366 counter+2, -1), nlp_tree, 1, LT);
1368 call_dissector(data_handle,
1369 tvb_new_subset(tvb, index + subindex, counter+2,
1370 -1), pinfo, nlp_tree);
1372 subindex += (counter+2);
1374 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindex))
1376 tvb_new_subset(tvb, index + subindex,
1377 (thdr_len << 2) - subindex, -1),
1380 index += (thdr_len << 2);
1381 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1382 if (check_col(pinfo->cinfo, COL_INFO))
1383 col_add_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1384 if (tvb_offset_exists(tvb, index)) {
1385 call_dissector(data_handle,
1386 tvb_new_subset(tvb, index, -1, -1), pinfo,
1391 if (tvb_offset_exists(tvb, index)) {
1392 /* Transmission Header Format Identifier */
1393 fid = hi_nibble(tvb_get_guint8(tvb, index));
1394 if (fid == 5) /* Only FID5 allowed for HPR */
1395 dissect_fid(tvb_new_subset(tvb, index, -1, -1), pinfo,
1398 if (tvb_get_ntohs(tvb, index+2) == 0x12ce) {
1400 if (check_col(pinfo->cinfo, COL_INFO))
1401 col_add_str(pinfo->cinfo, COL_INFO,
1403 dissect_gds(tvb_new_subset(tvb, index, -1, -1),
1404 pinfo, tree, parent_tree);
1406 call_dissector(data_handle,
1407 tvb_new_subset(tvb, index, -1, -1),
1408 pinfo, parent_tree);
1413 /* --------------------------------------------------------------------
1414 * Chapter 3 Exchange Identification (XID) Information Fields
1415 * --------------------------------------------------------------------
1419 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1424 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1429 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1436 dlen = tvb_get_guint8(tvb, 0);
1440 while (tvb_offset_exists(tvb, offset)) {
1441 dlen = tvb_get_guint8(tvb, offset+1);
1442 dissect_control(tvb_new_subset(tvb, offset, dlen+2, -1),
1444 offset += (dlen + 2);
1449 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1451 proto_tree *sub_tree;
1452 proto_item *sub_ti = NULL;
1453 guint val, dlen, offset;
1458 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1460 val = tvb_get_ntohs(tvb, 2);
1462 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_8, tvb,
1464 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_8);
1466 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_init_self, tvb, 2, 2,
1468 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_stand_bind, tvb, 2, 2,
1470 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_gener_bind, tvb, 2, 2,
1472 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_recve_bind, tvb, 2, 2,
1474 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_actpu, tvb, 2, 2, val);
1475 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nwnode, tvb, 2, 2, val);
1476 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cp, tvb, 2, 2, val);
1477 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpcp, tvb, 2, 2, val);
1478 proto_tree_add_uint(sub_tree, hf_sna_xid_3_state, tvb, 2, 2, val);
1479 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nonact, tvb, 2, 2, val);
1480 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpchange, tvb, 2, 2,
1483 val = tvb_get_guint8(tvb, 4);
1485 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_10, tvb,
1487 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_10);
1489 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_asend_bind, tvb, 4, 1,
1491 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_arecv_bind, tvb, 4, 1,
1493 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_quiesce, tvb, 4, 1, val);
1494 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pucap, tvb, 4, 1, val);
1495 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pbn, tvb, 4, 1, val);
1496 proto_tree_add_uint(sub_tree, hf_sna_xid_3_pacing, tvb, 4, 1, val);
1498 val = tvb_get_guint8(tvb, 5);
1500 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_11, tvb,
1502 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_11);
1504 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_tgshare, tvb, 5, 1, val);
1505 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dedsvc, tvb, 5, 1, val);
1507 val = tvb_get_guint8(tvb, 6);
1509 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_12, tvb,
1511 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_12);
1513 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcsup, tvb, 6, 1, val);
1514 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcomp, tvb, 6, 1, val);
1516 proto_tree_add_text(tree, tvb, 7, 2, "Reserved");
1518 val = tvb_get_guint8(tvb, 9);
1520 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_15, tvb,
1522 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_15);
1524 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_partg, tvb, 9, 1, val);
1525 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlur, tvb, 9, 1, val);
1526 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlus, tvb, 9, 1, val);
1527 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_exbn, tvb, 9, 1, val);
1528 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_genodai, tvb, 9, 1, val);
1529 proto_tree_add_uint(sub_tree, hf_sna_xid_3_branch, tvb, 9, 1, val);
1530 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_brnn, tvb, 9, 1, val);
1532 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, FALSE);
1533 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, FALSE);
1535 dlen = tvb_get_guint8(tvb, 12);
1537 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1539 /* FIXME: DLC Dependent Data Go Here */
1543 while (tvb_offset_exists(tvb, offset)) {
1544 dlen = tvb_get_guint8(tvb, offset+1);
1545 dissect_control(tvb_new_subset(tvb, offset, dlen+2, -1),
1552 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1553 proto_tree *parent_tree)
1555 proto_tree *sub_tree;
1556 proto_item *sub_ti = NULL;
1557 int format, type, len;
1560 len = tvb_get_guint8(tvb, 1);
1561 type = tvb_get_guint8(tvb, 0);
1562 id = tvb_get_ntohl(tvb, 2);
1563 format = hi_nibble(type);
1565 /* Summary information */
1566 if (check_col(pinfo->cinfo, COL_INFO))
1567 col_add_fstr(pinfo->cinfo, COL_INFO,
1568 "SNA XID Format:%d Type:%s", format,
1569 val_to_str(lo_nibble(type), sna_xid_type_vals,
1573 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1575 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1577 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1579 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1582 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1584 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1586 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1588 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1590 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1597 dissect_xid1(tvb_new_subset(tvb, 6, len-6, -1),
1601 dissect_xid2(tvb_new_subset(tvb, 6, len-6, -1),
1605 dissect_xid3(tvb_new_subset(tvb, 6, len-6, -1),
1609 /* external standards organizations */
1610 call_dissector(data_handle,
1611 tvb_new_subset(tvb, 6, len-6, -1),
1619 if (tvb_offset_exists(tvb, len))
1620 call_dissector(data_handle,
1621 tvb_new_subset(tvb, len, -1, -1), pinfo, parent_tree);
1624 /* --------------------------------------------------------------------
1625 * Chapter 4 Transmission Headers (THs)
1626 * --------------------------------------------------------------------
1632 mpf_value(guint8 th_byte)
1634 return (th_byte & 0x0c) >> 2;
1637 #define FIRST_FRAG_NUMBER 0
1638 #define MIDDLE_FRAG_NUMBER 1
1639 #define LAST_FRAG_NUMBER 2
1641 /* FID2 is defragged by sequence. The weird thing is that we have neither
1642 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1643 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1644 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1645 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1646 * and 2. However, if the BIU is split into 2 frames, then we only have
1647 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1650 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1651 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1652 * see the FTP URL in the comment near the top of this file). I *think*
1653 * this means that the fragmented frames cannot arrive out of order.
1654 * Well, I *want* it to mean this, because w/o this limitation, if you
1655 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1656 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1657 * arrive in order, then we're saved.
1659 * The problem then boils down to figuring out if "LAST" means frag-number 1
1660 * (in the case of a BIU split into 2 frames) or frag-number 2
1661 * (in the case of a BIU split into 3 frames).
1663 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1664 * way to handle the mapping of "LAST" to either frag-number 1 or
1665 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1666 * This consumes resources. A trickier way, but a way which works, is to
1667 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1668 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1669 * and the reassembly code tells us that the the BIU is still not reassmebled,
1670 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1671 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1672 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1673 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1674 * to complete the reassembly.
1677 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1680 fragment_data *fd_head;
1681 int frag_number = -1;
1682 int more_frags = TRUE;
1683 tvbuff_t *rh_tvb = NULL;
1686 /* Determine frag_number and more_frags */
1691 case MPF_FIRST_SEGMENT:
1692 frag_number = FIRST_FRAG_NUMBER;
1694 case MPF_MIDDLE_SEGMENT:
1695 frag_number = MIDDLE_FRAG_NUMBER;
1697 case MPF_LAST_SEGMENT:
1698 frag_number = LAST_FRAG_NUMBER;
1702 g_assert_not_reached();
1705 /* If sna_defragment is on, and this is a fragment.. */
1706 if (frag_number > -1) {
1707 /* XXX - check length ??? */
1708 frag_len = tvb_reported_length_remaining(tvb, offset);
1709 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1710 fd_head = fragment_add_seq(tvb, offset, pinfo, id,
1711 sna_fragment_table, frag_number, frag_len,
1714 /* We added the LAST segment and reassembly didn't
1715 * complete. Insert a zero-length MIDDLE segment to
1716 * turn a 2-frame BIU-fragmentation into a 3-frame
1717 * BIU-fragmentation (empty middle frag).
1718 * See above long comment about this trickery. */
1720 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1721 fd_head = fragment_add_seq(tvb, offset, pinfo,
1722 id, sna_fragment_table,
1723 MIDDLE_FRAG_NUMBER, 0, TRUE);
1726 if (fd_head != NULL) {
1727 /* We have the complete reassembled payload. */
1728 rh_tvb = tvb_new_real_data(fd_head->data,
1729 fd_head->len, fd_head->len);
1731 /* Add the tvbuff to the chain of tvbuffs
1732 * so that it will get cleaned up too. */
1733 tvb_set_child_real_data_tvbuff(tvb, rh_tvb);
1735 /* Add the defragmented data to the data
1737 add_new_data_source(pinfo, rh_tvb,
1738 "Reassembled SNA BIU");
1745 #define SNA_FID01_ADDR_LEN 2
1747 /* FID Types 0 and 1 */
1749 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1751 proto_tree *bf_tree;
1752 proto_item *bf_item;
1756 const int bytes_in_header = 10;
1760 th_0 = tvb_get_guint8(tvb, 0);
1761 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1763 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1765 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1766 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1767 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1770 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1773 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, FALSE);
1777 ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
1778 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1779 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1782 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, FALSE);
1785 ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
1786 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1787 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1789 /* If we're not filling a proto_tree, return now */
1791 return bytes_in_header;
1793 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, FALSE);
1794 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, FALSE);
1796 return bytes_in_header;
1799 #define SNA_FID2_ADDR_LEN 1
1803 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1804 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1806 proto_tree *bf_tree;
1807 proto_item *bf_item;
1808 guint8 th_0=0, daf=0, oaf=0;
1810 unsigned int mpf, id;
1812 const int bytes_in_header = 6;
1814 th_0 = tvb_get_guint8(tvb, 0);
1815 mpf = mpf_value(th_0);
1818 daf = tvb_get_guint8(tvb, 2);
1819 oaf = tvb_get_guint8(tvb, 3);
1822 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1824 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1826 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1827 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1828 proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0);
1829 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1833 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1836 proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf,
1837 "Destination Address Field: 0x%02x", daf);
1841 ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
1842 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1843 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1847 proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf,
1848 "Origin Address Field: 0x%02x", oaf);
1852 ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
1853 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1854 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1856 id = tvb_get_ntohs(tvb, 4);
1858 proto_tree_add_uint(tree, hf_sna_th_snf, tvb, 4, 2, id);
1860 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1861 if (mpf == MPF_FIRST_SEGMENT) {
1862 *continue_dissecting = rh_only;
1864 *continue_dissecting = stop_here;
1868 else if (sna_defragment) {
1869 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1870 bytes_in_header, mpf, id);
1873 return bytes_in_header;
1878 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1880 proto_tree *bf_tree;
1881 proto_item *bf_item;
1884 const int bytes_in_header = 2;
1886 /* If we're not filling a proto_tree, return now */
1888 return bytes_in_header;
1890 th_0 = tvb_get_guint8(tvb, 0);
1892 /* Create the bitfield tree */
1893 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1894 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1896 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1897 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1898 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1900 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, FALSE);
1902 return bytes_in_header;
1906 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1908 proto_tree *bf_tree;
1909 proto_item *bf_item;
1911 guint8 th_byte, mft;
1915 static struct sna_fid_type_4_addr src, dst;
1917 const int bytes_in_header = 26;
1919 /* If we're not filling a proto_tree, return now */
1921 return bytes_in_header;
1923 th_byte = tvb_get_guint8(tvb, offset);
1925 /* Create the bitfield tree */
1926 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset,
1928 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1931 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb,
1932 offset, 1, th_byte);
1933 proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb,
1934 offset, 1, th_byte);
1935 proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb,
1936 offset, 1, th_byte);
1937 proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb,
1938 offset, 1, th_byte);
1939 proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb,
1940 offset, 1, th_byte);
1943 th_byte = tvb_get_guint8(tvb, offset);
1945 /* Create the bitfield tree */
1946 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1947 "Transmision Header Byte 1");
1948 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1951 proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1,
1953 proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1,
1955 proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1,
1958 mft = th_byte & 0x04;
1960 th_byte = tvb_get_guint8(tvb, offset);
1962 /* Create the bitfield tree */
1963 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1964 "Transmision Header Byte 2");
1965 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1969 proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb,
1970 offset, 1, th_byte);
1971 proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb,
1972 offset, 1, th_byte);
1974 proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb,
1975 offset, 1, th_byte);
1977 proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1,
1981 th_byte = tvb_get_guint8(tvb, offset);
1983 /* Create the bitfield tree */
1984 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1985 "Transmision Header Byte 3");
1986 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1989 proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1,
1991 proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, offset, 1,
1995 th_word = tvb_get_ntohs(tvb, offset);
1997 /* Create the bitfield tree */
1998 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1999 "Transmision Header Bytes 4-5");
2000 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2003 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb,
2004 offset, 2, th_word);
2005 proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb,
2006 offset, 2, th_word);
2007 proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb,
2008 offset, 2, th_word);
2010 /* I'm not sure about byte-order on this one... */
2011 proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb,
2012 offset, 2, th_word);
2015 th_word = tvb_get_ntohs(tvb, offset);
2017 /* Create the bitfield tree */
2018 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
2019 "Transmision Header Bytes 6-7");
2020 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2023 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset,
2025 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset,
2027 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset,
2029 proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset,
2032 /* I'm not sure about byte-order on this one... */
2033 proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb,
2034 offset, 2, th_word);
2038 dsaf = tvb_get_ntohl(tvb, 8);
2040 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
2044 osaf = tvb_get_ntohl(tvb, 12);
2046 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
2049 th_byte = tvb_get_guint8(tvb, offset);
2051 /* Create the bitfield tree */
2052 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
2053 "Transmision Header Byte 16");
2054 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2057 proto_tree_add_boolean(tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
2059 /* We luck out here because in their infinite wisdom the SNA
2060 * architects placed the MPF and EFI fields in the same bitfield
2061 * locations, even though for FID4 they're not in byte 0.
2063 proto_tree_add_uint(tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
2064 proto_tree_add_uint(tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
2067 /* 1 for byte 16, 1 for byte 17 which is reserved */
2069 def = tvb_get_ntohs(tvb, 18);
2071 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
2073 /* Addresses in FID 4 are discontiguous, sigh */
2076 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2078 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2081 oef = tvb_get_ntohs(tvb, 20);
2082 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
2084 /* Addresses in FID 4 are discontiguous, sigh */
2087 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2089 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2092 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, FALSE);
2093 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, FALSE);
2095 return bytes_in_header;
2100 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
2102 proto_tree *bf_tree;
2103 proto_item *bf_item;
2106 const int bytes_in_header = 12;
2108 /* If we're not filling a proto_tree, return now */
2110 return bytes_in_header;
2112 th_0 = tvb_get_guint8(tvb, 0);
2114 /* Create the bitfield tree */
2115 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2116 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2118 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2119 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
2120 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
2122 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2123 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, FALSE);
2125 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, FALSE);
2127 return bytes_in_header;
2133 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2135 proto_tree *bf_tree;
2136 proto_item *bf_item;
2139 const int bytes_in_header = 26;
2141 /* If we're not filling a proto_tree, return now */
2143 return bytes_in_header;
2145 th_0 = tvb_get_guint8(tvb, 0);
2147 /* Create the bitfield tree */
2148 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2149 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2151 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2152 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2154 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, FALSE);
2155 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, FALSE);
2156 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, FALSE);
2158 /* Yup, bytes 6-23 are reserved! */
2159 proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
2161 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, FALSE);
2163 return bytes_in_header;
2167 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2168 proto_tree *parent_tree)
2171 proto_tree *th_tree = NULL, *rh_tree = NULL;
2172 proto_item *th_ti = NULL, *rh_ti = NULL;
2174 int th_header_len = 0;
2175 int offset, rh_offset;
2176 tvbuff_t *rh_tvb = NULL;
2177 next_dissection_t continue_dissecting = everything;
2179 /* Transmission Header Format Identifier */
2180 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
2182 /* Summary information */
2183 if (check_col(pinfo->cinfo, COL_INFO))
2184 col_add_str(pinfo->cinfo, COL_INFO,
2185 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2189 /* Don't bother setting length. We'll set it later after we
2190 * find the length of TH */
2191 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2193 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2196 /* Get size of TH */
2200 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2203 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2204 &rh_tvb, &continue_dissecting);
2207 th_header_len = dissect_fid3(tvb, th_tree);
2210 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2213 th_header_len = dissect_fid5(tvb, th_tree);
2216 th_header_len = dissect_fidf(tvb, th_tree);
2219 call_dissector(data_handle,
2220 tvb_new_subset(tvb, 1, -1, -1), pinfo, parent_tree);
2224 offset = th_header_len;
2226 /* Short-circuit ? */
2227 if (continue_dissecting == stop_here) {
2229 proto_tree_add_text(tree, tvb, offset, -1,
2230 "BIU segment data");
2235 /* If the FID dissector function didn't create an rh_tvb, then we just
2236 * use the rest of our tvbuff as the rh_tvb. */
2238 rh_tvb = tvb_new_subset(tvb, offset, -1, -1);
2241 /* Process the rest of the SNA packet, starting with RH */
2243 proto_item_set_len(th_ti, th_header_len);
2246 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2248 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2249 dissect_rh(rh_tvb, rh_offset, rh_tree);
2252 rh_offset += RH_LEN;
2254 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2255 /* Short-circuit ? */
2256 if (continue_dissecting == rh_only) {
2258 proto_tree_add_text(tree, rh_tvb, rh_offset, -1,
2259 "BIU segment data");
2263 call_dissector(data_handle,
2264 tvb_new_subset(rh_tvb, rh_offset, -1, -1),
2265 pinfo, parent_tree);
2269 /* --------------------------------------------------------------------
2270 * Chapter 5 Request/Response Headers (RHs)
2271 * --------------------------------------------------------------------
2275 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2277 proto_tree *bf_tree;
2278 proto_item *bf_item;
2279 gboolean is_response;
2280 guint8 rh_0, rh_1, rh_2;
2285 /* Create the bitfield tree for byte 0*/
2286 rh_0 = tvb_get_guint8(tvb, offset);
2287 is_response = (rh_0 & 0x80);
2289 bf_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, rh_0);
2290 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
2292 proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
2293 proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1,
2295 proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
2296 proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
2297 proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
2298 proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
2301 rh_1 = tvb_get_guint8(tvb, offset);
2303 /* Create the bitfield tree for byte 1*/
2304 bf_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, rh_1);
2305 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
2307 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb, offset, 1, rh_1);
2310 proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1,
2313 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb, offset, 1, rh_1);
2316 proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb, offset, 1,
2319 proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb, offset, 1,
2321 proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1,
2325 proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
2326 proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb, offset, 1, rh_1);
2329 rh_2 = tvb_get_guint8(tvb, offset);
2331 /* Create the bitfield tree for byte 2*/
2332 bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
2335 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
2337 proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb, offset, 1,
2339 proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb, offset, 1,
2341 proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb, offset, 1,
2343 proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb, offset, 1,
2345 proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb, offset, 1,
2347 proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb, offset, 1,
2349 proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1,
2353 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
2356 /* --------------------------------------------------------------------
2357 * Chapter 6 Request/Response Units (RUs)
2358 * --------------------------------------------------------------------
2361 /* --------------------------------------------------------------------
2362 * Chapter 9 Common Fields
2363 * --------------------------------------------------------------------
2367 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2370 proto_tree *bf_tree;
2371 proto_item *bf_item;
2373 guint16 offset, len, pad;
2378 type = tvb_get_guint8(tvb, 2);
2380 bf_item = proto_tree_add_uint(tree, hf_sna_control_05_type, tvb,
2382 bf_tree = proto_item_add_subtree(bf_item, ett_sna_control_05hpr_type);
2384 proto_tree_add_boolean(bf_tree, hf_sna_control_05_ptp, tvb, 2, 1, type);
2385 proto_tree_add_text(tree, tvb, 3, 1, "Reserved");
2389 while (tvb_offset_exists(tvb, offset)) {
2391 len = tvb_get_guint8(tvb, offset+0);
2393 len = tvb_get_guint8(tvb, offset+1);
2396 dissect_control(tvb_new_subset(tvb, offset, len, -1),
2398 pad = (len+3) & 0xfffc;
2400 proto_tree_add_text(tree, tvb, offset+len,
2401 pad-len, "Padding");
2410 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2415 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, FALSE);
2419 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2427 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, FALSE);
2429 len = tvb_length(tvb) - 3;
2433 buf = g_malloc(len+1);
2434 tvb_memcpy (tvb, buf, 3, len);
2435 EBCDIC_to_ASCII(buf, len);
2437 proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, buf);
2442 dissect_control(tvbuff_t *tvb, proto_tree *tree, int hpr, enum parse parse)
2444 proto_tree *sub_tree;
2445 proto_item *sub_item;
2452 len = tvb_get_guint8(tvb, 0);
2453 key = tvb_get_guint8(tvb, 1);
2455 key = tvb_get_guint8(tvb, 0);
2456 len = tvb_get_guint8(tvb, 1);
2458 ett = ett_sna_control_un;
2462 if (hpr) ett = ett_sna_control_05hpr;
2463 else ett = ett_sna_control_05;
2465 if (key == 0x0e) ett = ett_sna_control_0e;
2467 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2468 sub_item = proto_tree_add_text(tree, tvb, 0, -1,
2469 val_to_str(key, sna_control_hpr_vals,
2470 "Unknown Control Vector"));
2472 sub_item = proto_tree_add_text(tree, tvb, 0, -1,
2473 val_to_str(key, sna_control_vals,
2474 "Unknown Control Vector"));
2475 sub_tree = proto_item_add_subtree(sub_item, ett);
2477 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2479 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2480 proto_tree_add_uint(sub_tree,
2481 hf_sna_control_hprkey, tvb, 1, 1, key);
2483 proto_tree_add_uint(sub_tree,
2484 hf_sna_control_key, tvb, 1, 1, key);
2486 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2487 proto_tree_add_uint(sub_tree,
2488 hf_sna_control_hprkey, tvb, 0, 1, key);
2490 proto_tree_add_uint(sub_tree,
2491 hf_sna_control_key, tvb, 0, 1, key);
2492 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2499 dissect_control_05hpr(tvb, sub_tree, hpr,
2502 dissect_control_05(tvb, sub_tree);
2505 dissect_control_0e(tvb, sub_tree);
2510 /* --------------------------------------------------------------------
2511 * Chapter 11 Function Management (FM) Headers
2512 * --------------------------------------------------------------------
2515 /* --------------------------------------------------------------------
2516 * Chapter 12 Presentation Services (PS) Headers
2517 * --------------------------------------------------------------------
2520 /* --------------------------------------------------------------------
2521 * Chapter 13 GDS Variables
2522 * --------------------------------------------------------------------
2526 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2527 proto_tree *parent_tree)
2533 proto_tree *gds_tree;
2534 proto_item *gds_item;
2538 type = tvb_get_ntohs(tvb, offset+2);
2541 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2542 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2543 type = tvb_get_ntohs(tvb, offset+2);
2545 if (length < 2 ) /* escape sequence ? */
2548 gds_item = proto_tree_add_item(tree, hf_sna_gds, tvb,
2549 offset, length, FALSE);
2550 gds_tree = proto_item_add_subtree(gds_item,
2553 proto_tree_add_uint(gds_tree, hf_sna_gds_len, tvb,
2555 proto_tree_add_boolean(gds_tree, hf_sna_gds_cont, tvb,
2557 proto_tree_add_uint(gds_tree, hf_sna_gds_type, tvb,
2562 if (tvb_offset_exists(tvb, offset))
2563 call_dissector(data_handle,
2564 tvb_new_subset(tvb, offset, -1, -1), pinfo, parent_tree);
2567 /* --------------------------------------------------------------------
2569 * --------------------------------------------------------------------
2573 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2576 proto_tree *sna_tree = NULL;
2577 proto_item *sna_ti = NULL;
2579 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2580 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2581 if (check_col(pinfo->cinfo, COL_INFO))
2582 col_clear(pinfo->cinfo, COL_INFO);
2584 /* SNA data should be printed in EBCDIC, not ASCII */
2585 pinfo->fd->flags.encoding = CHAR_EBCDIC;
2589 /* Don't bother setting length. We'll set it later after we find
2590 * the lengths of TH/RH/RU */
2591 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2593 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2596 /* Transmission Header Format Identifier */
2597 fid = hi_nibble(tvb_get_guint8(tvb, 0));
2599 case 0xa: /* HPR Network Layer Packet */
2603 dissect_nlp(tvb, pinfo, sna_tree, tree);
2606 dissect_fid(tvb, pinfo, sna_tree, tree);
2611 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2613 proto_tree *sna_tree = NULL;
2614 proto_item *sna_ti = NULL;
2616 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2617 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2618 if (check_col(pinfo->cinfo, COL_INFO))
2619 col_clear(pinfo->cinfo, COL_INFO);
2621 /* SNA data should be printed in EBCDIC, not ASCII */
2622 pinfo->fd->flags.encoding = CHAR_EBCDIC;
2626 /* Don't bother setting length. We'll set it later after we find
2627 * the lengths of XID */
2628 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2630 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2632 dissect_xid(tvb, pinfo, sna_tree, tree);
2638 fragment_table_init(&sna_fragment_table);
2639 reassembled_table_init(&sna_reassembled_table);
2644 proto_register_sna(void)
2646 static hf_register_info hf[] = {
2648 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2649 NULL, 0x0, "", HFILL }},
2652 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2654 "TH Byte 0", HFILL }},
2657 { "Format Identifer", "sna.th.fid", FT_UINT8, BASE_HEX,
2658 VALS(sna_th_fid_vals), 0xf0, "", HFILL }},
2661 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2662 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, "", HFILL }},
2665 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2666 BASE_DEC, NULL, 0x02, "", HFILL }},
2669 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2670 BASE_DEC, VALS(sna_th_efi_vals), 0x01, "", HFILL }},
2673 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2674 BASE_HEX, NULL, 0x0, "", HFILL }},
2677 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2678 NULL, 0x0, "", HFILL }},
2681 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2682 NULL, 0x0, "", HFILL }},
2685 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2686 NULL, 0x0, "", HFILL }},
2689 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2690 BASE_HEX, NULL, 0x0, "", HFILL }},
2692 { &hf_sna_th_tg_sweep,
2693 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2694 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, "", HFILL }},
2696 { &hf_sna_th_er_vr_supp_ind,
2697 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2698 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2701 { &hf_sna_th_vr_pac_cnt_ind,
2702 { "Virtual Route Pacing Count Indicator",
2703 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2704 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, "", HFILL }},
2706 { &hf_sna_th_ntwk_prty,
2707 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2708 VALS(sna_th_ntwk_prty_vals), 0x01, "", HFILL }},
2711 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2712 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2716 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, BASE_NONE,
2717 NULL, 0x04, "", HFILL }},
2720 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2721 VALS(sna_th_piubf_vals), 0x03, "", HFILL }},
2724 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2725 BASE_DEC, NULL, 0xf0, "", HFILL }},
2728 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2729 VALS(sna_th_nlpoi_vals), 0x80, "", HFILL }},
2731 { &hf_sna_th_nlp_cp,
2732 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2733 NULL, 0x70, "", HFILL }},
2736 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2737 NULL, 0x0f, "", HFILL }},
2740 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2741 NULL, 0xf0, "", HFILL }},
2744 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2745 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, "", HFILL }},
2747 { &hf_sna_th_vr_cwi,
2748 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2749 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2750 "Change Window Indicator", HFILL }},
2752 { &hf_sna_th_tg_nonfifo_ind,
2753 { "Transmission Group Non-FIFO Indicator",
2754 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2755 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, "", HFILL }},
2757 { &hf_sna_th_vr_sqti,
2758 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2759 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2760 "Route Sequence and Type", HFILL }},
2762 { &hf_sna_th_tg_snf,
2763 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2764 FT_UINT16, BASE_DEC, NULL, 0x0fff, "", HFILL }},
2767 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2768 16, TFS(&sna_th_vrprq_truth), 0x8000, "", HFILL }},
2771 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2772 16, TFS(&sna_th_vrprs_truth), 0x4000, "", HFILL }},
2774 { &hf_sna_th_vr_cwri,
2775 { "Virtual Route Change Window Reply Indicator",
2776 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2777 VALS(sna_th_vr_cwri_vals), 0x2000, "", HFILL }},
2779 { &hf_sna_th_vr_rwi,
2780 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2781 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2784 { &hf_sna_th_vr_snf_send,
2785 { "Virtual Route Send Sequence Number Field",
2786 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2787 "Send Sequence Number Field", HFILL }},
2790 { "Destination Subarea Address Field", "sna.th.dsaf",
2791 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
2794 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2795 BASE_HEX, NULL, 0x0, "", HFILL }},
2798 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2799 "Used to identify whether the PIU originated or is destined"
2800 " for an SNA or non-SNA device.", HFILL }},
2803 { "Destination Element Field", "sna.th.def", FT_UINT16,
2804 BASE_HEX, NULL, 0x0, "", HFILL }},
2807 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2808 NULL, 0x0, "", HFILL }},
2811 { "Session Address", "sna.th.sa", FT_BYTES, BASE_HEX,
2812 NULL, 0x0, "", HFILL }},
2814 { &hf_sna_th_cmd_fmt,
2815 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2816 NULL, 0x0, "", HFILL }},
2818 { &hf_sna_th_cmd_type,
2819 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2820 NULL, 0x0, "", HFILL }},
2822 { &hf_sna_th_cmd_sn,
2823 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2824 BASE_DEC, NULL, 0x0, "", HFILL }},
2827 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2828 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2830 { &hf_sna_nlp_nhdr_0,
2831 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2832 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
2834 { &hf_sna_nlp_nhdr_1,
2835 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2836 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
2839 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2840 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, "", HFILL }},
2843 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2844 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, "", HFILL }},
2847 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2848 VALS(sna_nlp_ft_vals), 0xF0, "", HFILL }},
2851 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2852 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, "", HFILL }},
2854 { &hf_sna_nlp_slowdn1,
2855 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2856 TFS(&sna_nlp_slowdn1_truth), 0x04, "", HFILL }},
2858 { &hf_sna_nlp_slowdn2,
2859 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2860 TFS(&sna_nlp_slowdn2_truth), 0x02, "", HFILL }},
2863 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2864 FT_BYTES, BASE_NONE, NULL, 0, "", HFILL }},
2867 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2868 FT_BYTES, BASE_HEX, NULL, 0, "", HFILL }},
2871 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2872 BASE_HEX, VALS(sna_nlp_frh_vals), 0, "", HFILL }},
2875 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2876 NULL, 0x0, "THDR", HFILL }},
2879 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2880 FT_BYTES, BASE_HEX, NULL, 0x0, "TCID", HFILL }},
2882 { &hf_sna_nlp_thdr_8,
2883 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2884 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
2886 { &hf_sna_nlp_setupi,
2887 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2888 TFS(&sna_nlp_setupi_truth), 0x40, "", HFILL }},
2891 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2892 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, "", HFILL }},
2895 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2896 8, TFS(&sna_nlp_eomi_truth), 0x10, "", HFILL }},
2899 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2900 8, TFS(&sna_nlp_sri_truth), 0x08, "", HFILL }},
2902 { &hf_sna_nlp_rasapi,
2903 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2904 8, TFS(&sna_nlp_rasapi_truth), 0x04, "", HFILL }},
2906 { &hf_sna_nlp_retryi,
2907 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2908 8, TFS(&sna_nlp_retryi_truth), 0x02, "", HFILL }},
2910 { &hf_sna_nlp_thdr_9,
2911 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2912 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
2915 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2916 8, TFS(&sna_nlp_lmi_truth), 0x80, "", HFILL }},
2919 { "Connection Qualifyer Field Indicator", "sna.nlp.thdr.cqfi",
2920 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, "", HFILL }},
2923 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2924 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, "", HFILL }},
2926 { &hf_sna_nlp_offset,
2927 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2928 NULL, 0x0, "Data Offset in Words", HFILL }},
2931 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2932 NULL, 0x0, "", HFILL }},
2935 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2936 BASE_HEX, NULL, 0x0, "", HFILL }},
2938 { &hf_sna_nlp_opti_len,
2939 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2940 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
2942 { &hf_sna_nlp_opti_type,
2943 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2944 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, "",
2947 { &hf_sna_nlp_opti_0d_version,
2948 { "Version", "sna.nlp.thdr.optional.0d.version",
2949 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2952 { &hf_sna_nlp_opti_0d_4,
2953 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2954 FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }},
2956 { &hf_sna_nlp_opti_0d_target,
2957 { "Target Resource ID Present",
2958 "sna.nlp.thdr.optional.0d.target",
2959 FT_BOOLEAN, 8, NULL, 0x80, "", HFILL }},
2961 { &hf_sna_nlp_opti_0d_arb,
2962 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2963 FT_BOOLEAN, 8, NULL, 0x10, "", HFILL }},
2965 { &hf_sna_nlp_opti_0d_reliable,
2966 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2967 FT_BOOLEAN, 8, NULL, 0x08, "", HFILL }},
2969 { &hf_sna_nlp_opti_0d_dedicated,
2970 { "Dedicated RTP Connection",
2971 "sna.nlp.thdr.optional.0d.dedicated",
2972 FT_BOOLEAN, 8, NULL, 0x04, "", HFILL }},
2974 { &hf_sna_nlp_opti_0e_stat,
2975 { "Status", "sna.nlp.thdr.optional.0e.stat",
2976 FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }},
2978 { &hf_sna_nlp_opti_0e_gap,
2979 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2980 FT_BOOLEAN, 8, NULL, 0x80, "", HFILL }},
2982 { &hf_sna_nlp_opti_0e_idle,
2983 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2984 FT_BOOLEAN, 8, NULL, 0x40, "", HFILL }},
2986 { &hf_sna_nlp_opti_0e_nabsp,
2987 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2988 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
2990 { &hf_sna_nlp_opti_0e_sync,
2991 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2992 FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
2994 { &hf_sna_nlp_opti_0e_echo,
2995 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2996 FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
2998 { &hf_sna_nlp_opti_0e_rseq,
2999 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
3000 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
3002 { &hf_sna_nlp_opti_0e_abspbeg,
3003 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
3004 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
3006 { &hf_sna_nlp_opti_0e_abspend,
3007 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
3008 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
3010 { &hf_sna_nlp_opti_0f_bits,
3011 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
3012 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
3015 { &hf_sna_nlp_opti_10_tcid,
3016 { "Transport Connection Identifier",
3017 "sna.nlp.thdr.optional.10.tcid",
3018 FT_BYTES, BASE_HEX, NULL, 0x0, "TCID", HFILL }},
3020 { &hf_sna_nlp_opti_12_sense,
3021 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
3022 FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
3024 { &hf_sna_nlp_opti_14_si_len,
3025 { "Length", "sna.nlp.thdr.optional.14.si.len",
3026 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
3028 { &hf_sna_nlp_opti_14_si_key,
3029 { "Key", "sna.nlp.thdr.optional.14.si.key",
3030 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3032 { &hf_sna_nlp_opti_14_si_2,
3033 { "Switching Information Byte 2",
3034 "sna.nlp.thdr.optional.14.si.2",
3035 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3037 { &hf_sna_nlp_opti_14_si_refifo,
3038 { "Resequencing (REFIFO) Indicator",
3039 "sna.nlp.thdr.optional.14.si.refifo",
3040 FT_BOOLEAN, 8, NULL, 0x80, "", HFILL }},
3042 { &hf_sna_nlp_opti_14_si_mobility,
3043 { "Mobility Indicator",
3044 "sna.nlp.thdr.optional.14.si.mobility",
3045 FT_BOOLEAN, 8, NULL, 0x40, "", HFILL }},
3047 { &hf_sna_nlp_opti_14_si_dirsearch,
3048 { "Directory Search Required on Path Switch Indicator",
3049 "sna.nlp.thdr.optional.14.si.dirsearch",
3050 FT_BOOLEAN, 8, NULL, 0x20, "", HFILL }},
3052 { &hf_sna_nlp_opti_14_si_limitres,
3053 { "Limited Resource Link Indicator",
3054 "sna.nlp.thdr.optional.14.si.limitres",
3055 FT_BOOLEAN, 8, NULL, 0x10, "", HFILL }},
3057 { &hf_sna_nlp_opti_14_si_ncescope,
3058 { "NCE Scope Indicator",
3059 "sna.nlp.thdr.optional.14.si.ncescope",
3060 FT_BOOLEAN, 8, NULL, 0x08, "", HFILL }},
3062 { &hf_sna_nlp_opti_14_si_mnpsrscv,
3063 { "MNPS RSCV Retention Indicator",
3064 "sna.nlp.thdr.optional.14.si.mnpsrscv",
3065 FT_BOOLEAN, 8, NULL, 0x04, "", HFILL }},
3067 { &hf_sna_nlp_opti_14_si_maxpsize,
3068 { "Maximum Packet Size On Return Path",
3069 "sna.nlp.thdr.optional.14.si.maxpsize",
3070 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3072 { &hf_sna_nlp_opti_14_si_switch,
3073 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
3074 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3076 { &hf_sna_nlp_opti_14_si_alive,
3077 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
3078 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3080 { &hf_sna_nlp_opti_14_rr_len,
3081 { "Length", "sna.nlp.thdr.optional.14.rr.len",
3082 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
3084 { &hf_sna_nlp_opti_14_rr_key,
3085 { "Key", "sna.nlp.thdr.optional.14.rr.key",
3086 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3088 { &hf_sna_nlp_opti_14_rr_2,
3089 { "Return Route TG Descriptor Byte 2",
3090 "sna.nlp.thdr.optional.14.rr.2",
3091 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3093 { &hf_sna_nlp_opti_14_rr_bfe,
3094 { "BF Entry Indicator",
3095 "sna.nlp.thdr.optional.14.rr.bfe",
3096 FT_BOOLEAN, 8, NULL, 0x80, "", HFILL }},
3098 { &hf_sna_nlp_opti_14_rr_num,
3099 { "Number Of TG Control Vectors",
3100 "sna.nlp.thdr.optional.14.rr.num",
3101 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
3103 { &hf_sna_nlp_opti_22_2,
3104 { "Adaptive Rate Based Segment Byte 2",
3105 "sna.nlp.thdr.optional.22.2",
3106 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3108 { &hf_sna_nlp_opti_22_type,
3110 "sna.nlp.thdr.optional.22.type",
3112 VALS(sna_nlp_opti_22_type_vals), 0xc0, "", HFILL }},
3114 { &hf_sna_nlp_opti_22_raa,
3115 { "Rate Adjustment Action",
3116 "sna.nlp.thdr.optional.22.raa",
3118 VALS(sna_nlp_opti_22_raa_vals), 0x38, "", HFILL }},
3120 { &hf_sna_nlp_opti_22_parity,
3121 { "Parity Indicator",
3122 "sna.nlp.thdr.optional.22.parity",
3123 FT_BOOLEAN, 8, NULL, 0x04, "", HFILL }},
3125 { &hf_sna_nlp_opti_22_arb,
3127 "sna.nlp.thdr.optional.22.arb",
3129 VALS(sna_nlp_opti_22_arb_vals), 0x03, "", HFILL }},
3131 { &hf_sna_nlp_opti_22_3,
3132 { "Adaptive Rate Based Segment Byte 3",
3133 "sna.nlp.thdr.optional.22.3",
3134 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3136 { &hf_sna_nlp_opti_22_ratereq,
3137 { "Rate Request Correlator",
3138 "sna.nlp.thdr.optional.22.ratereq",
3139 FT_UINT8, BASE_DEC, NULL, 0xf0, "", HFILL }},
3141 { &hf_sna_nlp_opti_22_raterep,
3142 { "Rate Reply Correlator",
3143 "sna.nlp.thdr.optional.22.raterep",
3144 FT_UINT8, BASE_DEC, NULL, 0x0f, "", HFILL }},
3146 { &hf_sna_nlp_opti_22_field1,
3147 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3148 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3150 { &hf_sna_nlp_opti_22_field2,
3151 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3152 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3154 { &hf_sna_nlp_opti_22_field3,
3155 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3156 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3158 { &hf_sna_nlp_opti_22_field4,
3159 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3160 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
3163 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3164 NULL, 0x0, "", HFILL }},
3167 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3168 BASE_HEX, NULL, 0x0, "", HFILL }},
3171 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3172 BASE_HEX, NULL, 0x0, "", HFILL }},
3175 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3176 BASE_HEX, NULL, 0x0, "", HFILL }},
3179 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8,
3180 BASE_DEC, VALS(sna_rh_rri_vals), 0x80, "", HFILL }},
3182 { &hf_sna_rh_ru_category,
3183 { "Request/Response Unit Category", "sna.rh.ru_category",
3184 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3188 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3189 TFS(&sna_rh_fi_truth), 0x08, "", HFILL }},
3192 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3193 TFS(&sna_rh_sdi_truth), 0x04, "", HFILL }},
3196 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3197 TFS(&sna_rh_bci_truth), 0x02, "", HFILL }},
3200 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3201 TFS(&sna_rh_eci_truth), 0x01, "", HFILL }},
3204 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3205 8, NULL, 0x80, "", HFILL }},
3208 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3209 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, "", HFILL }},
3212 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3213 8, NULL, 0x20, "", HFILL }},
3216 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3217 8, NULL, 0x10, "", HFILL }},
3220 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3221 8, TFS(&sna_rh_rti_truth), 0x10, "", HFILL }},
3224 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3225 8, NULL, 0x04, "", HFILL }},
3228 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3229 8, TFS(&sna_rh_qri_truth), 0x02, "", HFILL }},
3232 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3233 8, NULL, 0x01, "", HFILL }},
3236 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3237 8, NULL, 0x80, "", HFILL }},
3240 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3241 8, NULL, 0x40, "", HFILL }},
3244 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3245 8, NULL, 0x20, "", HFILL }},
3248 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3249 VALS(sna_rh_csi_vals), 0x08, "", HFILL }},
3252 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3253 NULL, 0x04, "", HFILL }},
3256 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3260 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3261 FT_BOOLEAN, 8, NULL, 0x01, "", HFILL }},
3264 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3265 NULL, 0x0, "", HFILL }},*/
3268 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3272 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3273 NULL, 0x7fff, "", HFILL }},
3276 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3277 0x8000, "", HFILL }},
3280 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3281 VALS(sna_gds_var_vals), 0x0, "", HFILL }},
3284 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3285 "XID Frame", HFILL }},
3288 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3291 { &hf_sna_xid_format,
3292 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3296 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3297 VALS(sna_xid_type_vals), 0x0f, "", HFILL }},
3300 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3304 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3305 NULL, 0x0, "", HFILL }},
3307 { &hf_sna_xid_idblock,
3308 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3309 0xfff00000, "", HFILL }},
3311 { &hf_sna_xid_idnum,
3312 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3313 0x0fffff, "", HFILL }},
3316 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3317 BASE_HEX, NULL, 0x0, "", HFILL }},
3319 { &hf_sna_xid_3_init_self,
3320 { "INIT-SELF support", "sna.xid.type3.initself",
3321 FT_BOOLEAN, 16, NULL, 0x8000, "", HFILL }},
3323 { &hf_sna_xid_3_stand_bind,
3324 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3325 FT_BOOLEAN, 16, NULL, 0x4000, "", HFILL }},
3327 { &hf_sna_xid_3_gener_bind,
3328 { "Whole BIND PIU generated indicator",
3329 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3330 "Whole BIND PIU generated", HFILL }},
3332 { &hf_sna_xid_3_recve_bind,
3333 { "Whole BIND PIU required indicator",
3334 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3335 "Whole BIND PIU required", HFILL }},
3337 { &hf_sna_xid_3_actpu,
3338 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3339 FT_BOOLEAN, 16, NULL, 0x0080, "", HFILL }},
3341 { &hf_sna_xid_3_nwnode,
3342 { "Sender is network node", "sna.xid.type3.nwnode",
3343 FT_BOOLEAN, 16, NULL, 0x0040, "", HFILL }},
3346 { "Control Point Services", "sna.xid.type3.cp",
3347 FT_BOOLEAN, 16, NULL, 0x0020, "", HFILL }},
3349 { &hf_sna_xid_3_cpcp,
3350 { "CP-CP session support", "sna.xid.type3.cpcp",
3351 FT_BOOLEAN, 16, NULL, 0x0010, "", HFILL }},
3353 { &hf_sna_xid_3_state,
3354 { "XID exchange state indicator", "sna.xid.type3.state",
3355 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3356 0x000c, "", HFILL }},
3358 { &hf_sna_xid_3_nonact,
3359 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3360 FT_BOOLEAN, 16, NULL, 0x0002, "", HFILL }},
3362 { &hf_sna_xid_3_cpchange,
3363 { "CP name change support", "sna.xid.type3.cpchange",
3364 FT_BOOLEAN, 16, NULL, 0x0001, "", HFILL }},
3367 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3368 NULL, 0x0, "", HFILL }},
3370 { &hf_sna_xid_3_asend_bind,
3371 { "Adaptive BIND pacing support as sender",
3372 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3373 "Pacing support as sender", HFILL }},
3375 { &hf_sna_xid_3_arecv_bind,
3376 { "Adaptive BIND pacing support as receiver",
3377 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3378 "Pacing support as receive", HFILL }},
3380 { &hf_sna_xid_3_quiesce,
3381 { "Quiesce TG Request",
3382 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3385 { &hf_sna_xid_3_pucap,
3386 { "PU Capabilities",
3387 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3390 { &hf_sna_xid_3_pbn,
3391 { "Peripheral Border Node",
3392 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3395 { &hf_sna_xid_3_pacing,
3396 { "Qualifier for adaptive BIND pacing support",
3397 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3401 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3402 NULL, 0x0, "", HFILL }},
3404 { &hf_sna_xid_3_tgshare,
3405 { "TG Sharing Prohibited Indicator",
3406 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3409 { &hf_sna_xid_3_dedsvc,
3410 { "Dedicated SVC Idicator",
3411 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3415 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3416 NULL, 0x0, "", HFILL }},
3418 { &hf_sna_xid_3_negcsup,
3419 { "Negotiation Complete Supported",
3420 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3423 { &hf_sna_xid_3_negcomp,
3424 { "Negotiation Complete",
3425 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3429 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3430 NULL, 0x0, "", HFILL }},
3432 { &hf_sna_xid_3_partg,
3433 { "Parallel TG Support",
3434 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3437 { &hf_sna_xid_3_dlur,
3438 { "Dependent LU Requester Indicator",
3439 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3442 { &hf_sna_xid_3_dlus,
3443 { "DLUS Served LU Registration Indicator",
3444 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3447 { &hf_sna_xid_3_exbn,
3448 { "Extended HPR Border Node",
3449 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3452 { &hf_sna_xid_3_genodai,
3453 { "Generalized ODAI Usage Option",
3454 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3457 { &hf_sna_xid_3_branch,
3458 { "Branch Indicator", "sna.xid.type3.branch",
3459 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3462 { &hf_sna_xid_3_brnn,
3463 { "Option Set 1123 Indicator",
3464 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3468 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3471 { &hf_sna_xid_3_dlc,
3472 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3475 { &hf_sna_xid_3_dlen,
3476 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3477 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
3479 { &hf_sna_control_len,
3480 { "Control Vector Length", "sna.control.len",
3481 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
3483 { &hf_sna_control_key,
3484 { "Control Vector Key", "sna.control.key",
3485 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, "",
3488 { &hf_sna_control_hprkey,
3489 { "Control Vector HPR Key", "sna.control.hprkey",
3490 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, "",
3493 { &hf_sna_control_05_delay,
3494 { "Channel Delay", "sna.control.05.delay",
3495 FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
3497 { &hf_sna_control_05_type,
3498 { "Network Address Type", "sna.control.05.type",
3499 FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
3501 { &hf_sna_control_05_ptp,
3502 { "Point-to-point", "sna.control.05.ptp",
3503 FT_BOOLEAN, 8, NULL, 0x80, "", HFILL }},
3505 { &hf_sna_control_0e_type,
3506 { "Type", "sna.control.0e.type",
3507 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3510 { &hf_sna_control_0e_value,
3511 { "Value", "sna.control.0e.value",
3512 FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
3514 static gint *ett[] = {
3519 &ett_sna_nlp_nhdr_0,
3520 &ett_sna_nlp_nhdr_1,
3522 &ett_sna_nlp_thdr_8,
3523 &ett_sna_nlp_thdr_9,
3524 &ett_sna_nlp_opti_un,
3525 &ett_sna_nlp_opti_0d,
3526 &ett_sna_nlp_opti_0d_4,
3527 &ett_sna_nlp_opti_0e,
3528 &ett_sna_nlp_opti_0e_stat,
3529 &ett_sna_nlp_opti_0e_absp,
3530 &ett_sna_nlp_opti_0f,
3531 &ett_sna_nlp_opti_10,
3532 &ett_sna_nlp_opti_12,
3533 &ett_sna_nlp_opti_14,
3534 &ett_sna_nlp_opti_14_si,
3535 &ett_sna_nlp_opti_14_si_2,
3536 &ett_sna_nlp_opti_14_rr,
3537 &ett_sna_nlp_opti_14_rr_2,
3538 &ett_sna_nlp_opti_22,
3539 &ett_sna_nlp_opti_22_2,
3540 &ett_sna_nlp_opti_22_3,
3553 &ett_sna_control_un,
3554 &ett_sna_control_05,
3555 &ett_sna_control_05hpr,
3556 &ett_sna_control_05hpr_type,
3557 &ett_sna_control_0e,
3559 module_t *sna_module;
3561 proto_sna = proto_register_protocol("Systems Network Architecture",
3563 proto_register_field_array(proto_sna, hf, array_length(hf));
3564 proto_register_subtree_array(ett, array_length(ett));
3565 register_dissector("sna", dissect_sna, proto_sna);
3567 proto_sna_xid = proto_register_protocol(
3568 "Systems Network Architecture XID", "SNA XID", "sna_xid");
3569 register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3571 /* Register configuration options */
3572 sna_module = prefs_register_protocol(proto_sna, NULL);
3573 prefs_register_bool_preference(sna_module, "defragment",
3574 "Reassemble fragmented BIUs",
3575 "Whether fragmented BIUs should be reassembled",
3580 proto_reg_handoff_sna(void)
3582 dissector_handle_t sna_handle;
3583 dissector_handle_t sna_xid_handle;
3585 sna_handle = find_dissector("sna");
3586 sna_xid_handle = find_dissector("sna_xid");
3587 dissector_add("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3588 dissector_add("llc.dsap", SAP_SNA1, sna_handle);
3589 dissector_add("llc.dsap", SAP_SNA2, sna_handle);
3590 dissector_add("llc.dsap", SAP_SNA3, sna_handle);
3591 dissector_add("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3592 dissector_add("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3593 dissector_add("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3594 dissector_add("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3596 dissector_add("ppp.protocol", PPP_SNA, sna_handle);
3597 data_handle = find_dissector("data");
3599 register_init_routine(sna_init);