3 * Gilbert Ramirez <gram@alumni.rice.edu>
4 * Jochen Friedrich <jochen@scram.de>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include <epan/llcsaps.h>
34 #include <epan/ppptypes.h>
35 #include <epan/sna-utils.h>
36 #include <epan/charsets.h>
37 #include <epan/prefs.h>
38 #include <epan/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 = TRUE;
303 static GHashTable *sna_fragment_table = NULL;
305 /* Format Identifier */
306 static const value_string sna_th_fid_vals[] = {
307 { 0x0, "SNA device <--> Non-SNA Device" },
308 { 0x1, "Subarea Nodes, without ER or VR" },
309 { 0x2, "Subarea Node <--> PU2" },
310 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
311 { 0x4, "Subarea Nodes, supporting ER and VR" },
312 { 0x5, "HPR RTP endpoint nodes" },
313 { 0xa, "HPR NLP Frame Routing" },
314 { 0xb, "HPR NLP Frame Routing" },
315 { 0xc, "HPR NLP Automatic Network Routing" },
316 { 0xd, "HPR NLP Automatic Network Routing" },
317 { 0xf, "Adjacent Subarea Nodes, supporting ER and VR" },
322 #define MPF_MIDDLE_SEGMENT 0
323 #define MPF_LAST_SEGMENT 1
324 #define MPF_FIRST_SEGMENT 2
325 #define MPF_WHOLE_BIU 3
327 static const value_string sna_th_mpf_vals[] = {
328 { MPF_MIDDLE_SEGMENT, "Middle segment of a BIU" },
329 { MPF_LAST_SEGMENT, "Last segment of a BIU" },
330 { MPF_FIRST_SEGMENT, "First segment of a BIU" },
331 { MPF_WHOLE_BIU, "Whole BIU" },
335 /* Expedited Flow Indicator */
336 static const value_string sna_th_efi_vals[] = {
337 { 0, "Normal Flow" },
338 { 1, "Expedited Flow" },
342 /* Request/Response Indicator */
343 static const value_string sna_rh_rri_vals[] = {
349 /* Request/Response Unit Category */
350 static const value_string sna_rh_ru_category_vals[] = {
351 { 0, "Function Management Data (FMD)" },
352 { 1, "Network Control (NC)" },
353 { 2, "Data Flow Control (DFC)" },
354 { 3, "Session Control (SC)" },
358 /* Format Indicator */
359 static const true_false_string sna_rh_fi_truth =
360 { "FM Header", "No FM Header" };
362 /* Sense Data Included */
363 static const true_false_string sna_rh_sdi_truth =
364 { "Included", "Not Included" };
366 /* Begin Chain Indicator */
367 static const true_false_string sna_rh_bci_truth =
368 { "First in Chain", "Not First in Chain" };
370 /* End Chain Indicator */
371 static const true_false_string sna_rh_eci_truth =
372 { "Last in Chain", "Not Last in Chain" };
374 /* Lengith-Checked Compression Indicator */
375 static const true_false_string sna_rh_lcci_truth =
376 { "Compressed", "Not Compressed" };
378 /* Response Type Indicator */
379 static const true_false_string sna_rh_rti_truth =
380 { "Negative", "Positive" };
382 /* Queued Response Indicator */
383 static const true_false_string sna_rh_qri_truth =
384 { "Enqueue response in TC queues", "Response bypasses TC queues" };
386 /* Code Selection Indicator */
387 static const value_string sna_rh_csi_vals[] = {
394 static const value_string sna_th_tg_sweep_vals[] = {
395 { 0, "This PIU may overtake any PU ahead of it." },
396 { 1, "This PIU does not overtake any PIU ahead of it." },
401 static const value_string sna_th_er_vr_supp_ind_vals[] = {
402 { 0, "Each node supports ER and VR protocols" },
403 { 1, "Includes at least one node that does not support ER and VR"
409 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
410 { 0, "Pacing count on the VR has not reached 0" },
411 { 1, "Pacing count on the VR has reached 0" },
416 static const value_string sna_th_ntwk_prty_vals[] = {
417 { 0, "PIU flows at a lower priority" },
418 { 1, "PIU flows at network priority (highest transmission priority)" },
423 static const value_string sna_th_tgsf_vals[] = {
424 { 0, "Not segmented" },
425 { 1, "Last segment" },
426 { 2, "First segment" },
427 { 3, "Middle segment" },
432 static const value_string sna_th_piubf_vals[] = {
433 { 0, "Single PIU frame" },
434 { 1, "Last PIU of a multiple PIU frame" },
435 { 2, "First PIU of a multiple PIU frame" },
436 { 3, "Middle PIU of a multiple PIU frame" },
441 static const value_string sna_th_nlpoi_vals[] = {
442 { 0, "NLP starts within this FID4 TH" },
443 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
448 static const value_string sna_th_tpf_vals[] = {
449 { 0, "Low Priority" },
450 { 1, "Medium Priority" },
451 { 2, "High Priority" },
452 { 3, "Network Priority" },
457 static const value_string sna_th_vr_cwi_vals[] = {
458 { 0, "Increment window size" },
459 { 1, "Decrement window size" },
464 static const true_false_string sna_th_tg_nonfifo_ind_truth =
465 { "TG FIFO is not required", "TG FIFO is required" };
468 static const value_string sna_th_vr_sqti_vals[] = {
469 { 0, "Non-sequenced, Non-supervisory" },
470 { 1, "Non-sequenced, Supervisory" },
471 { 2, "Singly-sequenced" },
476 static const true_false_string sna_th_vrprq_truth = {
477 "VR pacing request is sent asking for a VR pacing response",
478 "No VR pacing response is requested",
482 static const true_false_string sna_th_vrprs_truth = {
483 "VR pacing response is sent in response to a VRPRQ bit set",
484 "No pacing response sent",
488 static const value_string sna_th_vr_cwri_vals[] = {
489 { 0, "Increment window size by 1" },
490 { 1, "Decrement window size by 1" },
495 static const true_false_string sna_th_vr_rwi_truth = {
496 "Reset window size to the minimum specified in NC_ACTVR",
497 "Do not reset window size",
501 static const value_string sna_nlp_sm_vals[] = {
502 { 5, "Function routing" },
503 { 6, "Automatic network routing" },
507 static const true_false_string sna_nlp_tspi_truth =
508 { "Time sensitive", "Not time sensitive" };
510 static const true_false_string sna_nlp_slowdn1_truth =
511 { "Minor congestion", "No minor congestion" };
513 static const true_false_string sna_nlp_slowdn2_truth =
514 { "Major congestion", "No major congestion" };
517 static const value_string sna_nlp_ft_vals[] = {
522 static const value_string sna_nlp_frh_vals[] = {
523 { 0x03, "XID complete request" },
524 { 0x04, "XID complete response" },
528 static const true_false_string sna_nlp_setupi_truth =
529 { "Connection setup segment present", "Connection setup segment not"
532 static const true_false_string sna_nlp_somi_truth =
533 { "Start of message", "Not start of message" };
535 static const true_false_string sna_nlp_eomi_truth =
536 { "End of message", "Not end of message" };
538 static const true_false_string sna_nlp_sri_truth =
539 { "Status requested", "No status requested" };
541 static const true_false_string sna_nlp_rasapi_truth =
542 { "Reply as soon as possible", "No need to reply as soon as possible" };
544 static const true_false_string sna_nlp_retryi_truth =
545 { "Undefined", "Sender will retransmit" };
547 static const true_false_string sna_nlp_lmi_truth =
548 { "Last message", "Not last message" };
550 static const true_false_string sna_nlp_cqfi_truth =
551 { "CQFI included", "CQFI not included" };
553 static const true_false_string sna_nlp_osi_truth =
554 { "Optional segments present", "No optional segments present" };
556 static const value_string sna_xid_3_state_vals[] = {
557 { 0x00, "Exchange state indicators not supported" },
558 { 0x01, "Negotiation-proceeding exchange" },
559 { 0x02, "Prenegotiation exchange" },
560 { 0x03, "Nonactivation exchange" },
564 static const value_string sna_xid_3_branch_vals[] = {
565 { 0x00, "Sender does not support branch extender" },
566 { 0x01, "TG is branch uplink" },
567 { 0x02, "TG is branch downlink" },
568 { 0x03, "TG is neither uplink nor downlink" },
572 static const value_string sna_xid_type_vals[] = {
574 { 0x02, "T2.0 or T2.1 node" },
575 { 0x03, "Reserved" },
576 { 0x04, "T4 or T5 node" },
580 static const value_string sna_nlp_opti_vals[] = {
581 { 0x0d, "Connection Setup Segment" },
582 { 0x0e, "Status Segment" },
583 { 0x0f, "Client Out Of Band Bits Segment" },
584 { 0x10, "Connection Identifier Exchange Segment" },
585 { 0x12, "Connection Fault Segment" },
586 { 0x14, "Switching Information Segment" },
587 { 0x22, "Adaptive Rate-Based Segment" },
591 static const value_string sna_nlp_opti_0d_version_vals[] = {
592 { 0x0101, "Version 1.1" },
596 static const value_string sna_nlp_opti_0f_bits_vals[] = {
597 { 0x0001, "Request Deactivation" },
598 { 0x8000, "Reply - OK" },
599 { 0x8004, "Reply - Reject" },
603 static const value_string sna_nlp_opti_22_type_vals[] = {
605 { 0x01, "Rate Reply" },
606 { 0x02, "Rate Request" },
607 { 0x03, "Rate Request/Rate Reply" },
611 static const value_string sna_nlp_opti_22_raa_vals[] = {
613 { 0x01, "Restraint" },
614 { 0x02, "Slowdown1" },
615 { 0x03, "Slowdown2" },
616 { 0x04, "Critical" },
620 static const value_string sna_nlp_opti_22_arb_vals[] = {
621 { 0x00, "Base Mode ARB" },
622 { 0x01, "Responsive Mode ARB" },
626 /* GDS Variable Type */
627 static const value_string sna_gds_var_vals[] = {
628 { 0x1210, "Change Number Of Sessions" },
629 { 0x1211, "Exchange Log Name" },
630 { 0x1212, "Control Point Management Services Unit" },
631 { 0x1213, "Compare States" },
632 { 0x1214, "LU Names Position" },
633 { 0x1215, "LU Name" },
634 { 0x1217, "Do Know" },
635 { 0x1218, "Partner Restart" },
636 { 0x1219, "Don't Know" },
637 { 0x1220, "Sign-Off" },
638 { 0x1221, "Sign-On" },
639 { 0x1222, "SNMP-over-SNA" },
640 { 0x1223, "Node Address Service" },
641 { 0x12C1, "CP Capabilities" },
642 { 0x12C2, "Topology Database Update" },
643 { 0x12C3, "Register Resource" },
644 { 0x12C4, "Locate" },
645 { 0x12C5, "Cross-Domain Initiate" },
646 { 0x12C9, "Delete Resource" },
647 { 0x12CA, "Find Resource" },
648 { 0x12CB, "Found Resource" },
649 { 0x12CC, "Notify" },
650 { 0x12CD, "Initiate-Other Cross-Domain" },
651 { 0x12CE, "Route Setup" },
652 { 0x12E1, "Error Log" },
653 { 0x12F1, "Null Data" },
654 { 0x12F2, "User Control Date" },
655 { 0x12F3, "Map Name" },
656 { 0x12F4, "Error Data" },
657 { 0x12F6, "Authentication Token Data" },
658 { 0x12F8, "Service Flow Authentication Token Data" },
659 { 0x12FF, "Application Data" },
660 { 0x1310, "MDS Message Unit" },
661 { 0x1311, "MDS Routing Information" },
662 { 0x1500, "FID2 Encapsulation" },
666 /* Control Vector Type */
667 static const value_string sna_control_vals[] = {
668 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
669 { 0x01, "Date-Time Control Vector" },
670 { 0x02, "Subarea Routing Control Vector" },
671 { 0x03, "SDLC Secondary Station Control Vector" },
672 { 0x04, "LU Control Vector" },
673 { 0x05, "Channel Control Vector" },
674 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
675 { 0x07, "PU FMD-RU-Usage Control Vector" },
676 { 0x08, "Intensive Mode Control Vector" },
677 { 0x09, "Activation Request / Response Sequence Identifier Control"
679 { 0x0a, "User Request Correlator Control Vector" },
680 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
681 { 0x0c, "LU-LU Session Capabilities Control Vector" },
682 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
684 { 0x0e, "Network Name Control Vector" },
685 { 0x0f, "Link Capabilities and Status Control Vector" },
686 { 0x10, "Product Set ID Control Vector" },
687 { 0x11, "Load Module Correlation Control Vector" },
688 { 0x12, "Network Identifier Control Vector" },
689 { 0x13, "Gateway Support Capabilities Control Vector" },
690 { 0x14, "Session Initiation Control Vector" },
691 { 0x15, "Network-Qualified Address Pair Control Vector" },
692 { 0x16, "Names Substitution Control Vector" },
693 { 0x17, "SSCP Identifier Control Vector" },
694 { 0x18, "SSCP Name Control Vector" },
695 { 0x19, "Resource Identifier Control Vector" },
696 { 0x1a, "NAU Address Control Vector" },
697 { 0x1b, "VRID List Control Vector" },
698 { 0x1c, "Network-Qualified Name Pair Control Vector" },
699 { 0x1e, "VR-ER Mapping Data Control Vector" },
700 { 0x1f, "ER Configuration Control Vector" },
701 { 0x23, "Local-Form Session Identifier Control Vector" },
702 { 0x24, "IPL Load Module Request Control Vector" },
703 { 0x25, "Security ID Control Control Vector" },
704 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
705 { 0x27, "XRF Session Activation Control Vector" },
706 { 0x28, "Related Session Identifier Control Vector" },
707 { 0x29, "Session State Data Control Vector" },
708 { 0x2a, "Session Information Control Vector" },
709 { 0x2b, "Route Selection Control Vector" },
710 { 0x2c, "COS/TPF Control Vector" },
711 { 0x2d, "Mode Control Vector" },
712 { 0x2f, "LU Definition Control Vector" },
713 { 0x30, "Assign LU Characteristics Control Vector" },
714 { 0x31, "BIND Image Control Vector" },
715 { 0x32, "Short-Hold Mode Control Vector" },
716 { 0x33, "ENCP Search Control Control Vector" },
717 { 0x34, "LU Definition Override Control Vector" },
718 { 0x35, "Extended Sense Data Control Vector" },
719 { 0x36, "Directory Error Control Vector" },
720 { 0x37, "Directory Entry Correlator Control Vector" },
721 { 0x38, "Short-Hold Mode Emulation Control Vector" },
722 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
724 { 0x3a, "Route Status Data Control Vector" },
725 { 0x3b, "VR Congestion Data Control Vector" },
726 { 0x3c, "Associated Resource Entry Control Vector" },
727 { 0x3d, "Directory Entry Control Vector" },
728 { 0x3e, "Directory Entry Characteristic Control Vector" },
729 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
730 { 0x40, "Real Associated Resource Control Vector" },
731 { 0x41, "Station Parameters Control Vector" },
732 { 0x42, "Dynamic Path Update Data Control Vector" },
733 { 0x43, "Extended SDLC Station Control Vector" },
734 { 0x44, "Node Descriptor Control Vector" },
735 { 0x45, "Node Characteristics Control Vector" },
736 { 0x46, "TG Descriptor Control Vector" },
737 { 0x47, "TG Characteristics Control Vector" },
738 { 0x48, "Topology Resource Descriptor Control Vector" },
739 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
741 { 0x4a, "Real Owning Control Point Control Vector" },
742 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
743 { 0x51, "DLUR/S Capabilities Control Vector" },
744 { 0x52, "Primary Send Pacing Window Size Control Vector" },
745 { 0x56, "Call Security Verification Control Vector" },
746 { 0x57, "DLC Connection Data Control Vector" },
747 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
748 { 0x5a, "Session Services Extension Support Control Vector" },
749 { 0x5b, "Interchange Node Support Control Vector" },
750 { 0x5c, "APPN Message Transport Control Vector" },
751 { 0x5d, "Subarea Message Transport Control Vector" },
752 { 0x5e, "Related Request Control Vector" },
753 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
754 { 0x60, "Fully Qualified PCID Control Vector" },
755 { 0x61, "HPR Capabilities Control Vector" },
756 { 0x62, "Session Address Control Vector" },
757 { 0x63, "Cryptographic Key Distribution Control Vector" },
758 { 0x64, "TCP/IP Information Control Vector" },
759 { 0x65, "Device Characteristics Control Vector" },
760 { 0x66, "Length-Checked Compression Control Vector" },
761 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
762 { 0x68, "XRF/Session Cryptography Control Vector" },
763 { 0x69, "Switched Parameters Control Vector" },
764 { 0x6a, "ER Congestion Data Control Vector" },
765 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
766 { 0xfe, "Control Vector Keys Not Recognized" },
770 static const value_string sna_control_hpr_vals[] = {
771 { 0x00, "Node Identifier Control Vector" },
772 { 0x03, "Network ID Control Vector" },
773 { 0x05, "Network Address Control Vector" },
777 static const value_string sna_control_0e_type_vals[] = {
781 { 0xF5, "SSCP Name" },
782 { 0xF6, "NNCP Name" },
783 { 0xF7, "Link Station Name" },
784 { 0xF8, "CP Name of CP(PLU)" },
785 { 0xF9, "CP Name of CP(SLU)" },
786 { 0xFA, "Generic Name" },
790 /* Values to direct the top-most dissector what to dissect
792 enum next_dissection_enum {
803 typedef enum next_dissection_enum next_dissection_t;
805 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
806 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
807 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
808 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
809 static void dissect_rh (tvbuff_t*, int, proto_tree*);
810 static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
812 /* --------------------------------------------------------------------
813 * Chapter 2 High-Performance Routing (HPR) Headers
814 * --------------------------------------------------------------------
818 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
820 int bits, offset, len, pad;
821 proto_tree *sub_tree;
822 proto_item *sub_ti = NULL;
827 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
828 bits = tvb_get_guint8(tvb, 4);
830 sub_ti = proto_tree_add_uint(tree, hf_sna_nlp_opti_0d_4,
832 sub_tree = proto_item_add_subtree(sub_ti,
833 ett_sna_nlp_opti_0d_4);
835 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_target,
837 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_arb,
839 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_reliable,
841 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_dedicated,
844 proto_tree_add_text(tree, tvb, 5, 3, "Reserved");
848 while (tvb_offset_exists(tvb, offset)) {
849 len = tvb_get_guint8(tvb, offset+0);
851 dissect_control(tvb, offset, len, tree, 1, LT);
852 pad = (len+3) & 0xfffc;
854 proto_tree_add_text(tree, tvb, offset+len,
858 /* Avoid endless loop */
865 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
868 proto_tree *sub_tree;
869 proto_item *sub_ti = NULL;
871 bits = tvb_get_guint8(tvb, 2);
875 sub_ti = proto_tree_add_item(tree, hf_sna_nlp_opti_0e_stat,
876 tvb, 2, 1, ENC_BIG_ENDIAN);
877 sub_tree = proto_item_add_subtree(sub_ti,
878 ett_sna_nlp_opti_0e_stat);
880 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_gap,
882 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_idle,
884 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
885 tvb, 3, 1, ENC_BIG_ENDIAN);
886 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
887 tvb, 4, 2, ENC_BIG_ENDIAN);
888 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
889 tvb, 6, 2, ENC_BIG_ENDIAN);
890 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
891 tvb, 8, 4, ENC_BIG_ENDIAN);
892 proto_tree_add_text(tree, tvb, 12, 8, "Reserved");
894 if (tvb_offset_exists(tvb, offset))
895 call_dissector(data_handle,
896 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
899 col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
901 col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
906 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
911 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
912 if (tvb_offset_exists(tvb, 4))
913 call_dissector(data_handle,
914 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
918 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
923 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
924 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
925 if (tvb_offset_exists(tvb, 12))
926 call_dissector(data_handle,
927 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
931 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
936 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
937 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
941 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
943 proto_tree *sub_tree, *bf_tree;
944 proto_item *sub_item, *bf_item;
945 int len, pad, type, bits, offset, num, sublen;
950 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
954 len = tvb_get_guint8(tvb, offset);
955 type = tvb_get_guint8(tvb, offset+1);
957 if ((type != 0x83) || (len <= 16)) {
959 call_dissector(data_handle,
960 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
963 sub_item = proto_tree_add_text(tree, tvb, offset, len,
964 "Switching Information Control Vector");
965 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_si);
967 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
968 tvb, offset, 1, len);
969 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
970 tvb, offset+1, 1, type);
972 bits = tvb_get_guint8(tvb, offset+2);
973 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_2,
974 tvb, offset+2, 1, bits);
975 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_si_2);
977 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_refifo,
978 tvb, offset+2, 1, bits);
979 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mobility,
980 tvb, offset+2, 1, bits);
981 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_dirsearch,
982 tvb, offset+2, 1, bits);
983 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_limitres,
984 tvb, offset+2, 1, bits);
985 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_ncescope,
986 tvb, offset+2, 1, bits);
987 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mnpsrscv,
988 tvb, offset+2, 1, bits);
990 proto_tree_add_text(sub_tree, tvb, offset+3, 1, "Reserved");
991 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
992 tvb, offset+4, 4, ENC_BIG_ENDIAN);
993 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
994 tvb, offset+8, 4, ENC_BIG_ENDIAN);
995 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
996 tvb, offset+12, 4, ENC_BIG_ENDIAN);
998 dissect_control(tvb, offset+16, len-16, sub_tree, 1, LT);
1000 pad = (len+3) & 0xfffc;
1002 proto_tree_add_text(sub_tree, tvb, offset+len, pad-len,
1006 len = tvb_get_guint8(tvb, offset);
1007 type = tvb_get_guint8(tvb, offset+1);
1009 if ((type != 0x85) || ( len < 4)) {
1011 call_dissector(data_handle,
1012 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1015 sub_item = proto_tree_add_text(tree, tvb, offset, len,
1016 "Return Route TG Descriptor Control Vector");
1017 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_rr);
1019 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1020 tvb, offset, 1, len);
1021 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1022 tvb, offset+1, 1, type);
1024 bits = tvb_get_guint8(tvb, offset+2);
1025 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_2,
1026 tvb, offset+2, 1, bits);
1027 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_rr_2);
1029 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_rr_bfe,
1030 tvb, offset+2, 1, bits);
1032 num = tvb_get_guint8(tvb, offset+3);
1034 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1035 tvb, offset+3, 1, num);
1040 sublen = tvb_get_guint8(tvb, offset);
1042 dissect_control(tvb, offset, sublen, sub_tree, 1, LT);
1045 call_dissector(data_handle,
1046 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1049 /* No padding here */
1056 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1058 proto_tree *bf_tree;
1059 proto_item *bf_item;
1065 bits = tvb_get_guint8(tvb, 2);
1066 type = (bits & 0xc0) >> 6;
1068 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_2,
1070 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_2);
1072 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_type,
1074 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raa,
1076 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_22_parity,
1078 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_arb,
1081 bits = tvb_get_guint8(tvb, 3);
1083 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_3,
1085 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_3);
1087 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_ratereq,
1089 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raterep,
1092 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1093 tvb, 4, 4, ENC_BIG_ENDIAN);
1094 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1095 tvb, 8, 4, ENC_BIG_ENDIAN);
1098 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1099 tvb, 12, 4, ENC_BIG_ENDIAN);
1100 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1101 tvb, 16, 4, ENC_BIG_ENDIAN);
1103 if (tvb_offset_exists(tvb, 20))
1104 call_dissector(data_handle,
1105 tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1107 if (tvb_offset_exists(tvb, 12))
1108 call_dissector(data_handle,
1109 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1114 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1116 proto_tree *sub_tree;
1117 proto_item *sub_item;
1118 int offset, type, len;
1125 while (tvb_offset_exists(tvb, offset)) {
1126 len = tvb_get_guint8(tvb, offset);
1127 type = tvb_get_guint8(tvb, offset+1);
1129 /* Prevent loop for invalid crap in packet */
1132 call_dissector(data_handle,
1133 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1137 ett = ett_sna_nlp_opti_un;
1138 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1139 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1140 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1141 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1142 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1143 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1144 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1146 sub_item = proto_tree_add_text(tree, tvb,
1147 offset, len << 2, "%s",
1148 val_to_str(type, sna_nlp_opti_vals,
1149 "Unknown Segment Type"));
1150 sub_tree = proto_item_add_subtree(sub_item, ett);
1151 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1152 tvb, offset, 1, len);
1153 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1154 tvb, offset+1, 1, type);
1158 dissect_optional_0d(tvb_new_subset(tvb, offset,
1159 len << 2, -1), sub_tree);
1162 dissect_optional_0e(tvb_new_subset(tvb, offset,
1163 len << 2, -1), pinfo, sub_tree);
1166 dissect_optional_0f(tvb_new_subset(tvb, offset,
1167 len << 2, -1), pinfo, sub_tree);
1170 dissect_optional_10(tvb_new_subset(tvb, offset,
1171 len << 2, -1), pinfo, sub_tree);
1174 dissect_optional_12(tvb_new_subset(tvb, offset,
1175 len << 2, -1), sub_tree);
1178 dissect_optional_14(tvb_new_subset(tvb, offset,
1179 len << 2, -1), pinfo, sub_tree);
1182 dissect_optional_22(tvb_new_subset(tvb, offset,
1183 len << 2, -1), pinfo, sub_tree);
1186 call_dissector(data_handle,
1187 tvb_new_subset(tvb, offset,
1188 len << 2, -1), pinfo, sub_tree);
1190 offset += (len << 2);
1195 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1196 proto_tree *parent_tree)
1198 proto_tree *nlp_tree, *bf_tree;
1199 proto_item *nlp_item, *bf_item;
1200 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1201 guint32 thdr_len, thdr_dlf;
1204 int index = 0, counter = 0;
1209 nhdr_0 = tvb_get_guint8(tvb, index);
1210 nhdr_1 = tvb_get_guint8(tvb, index+1);
1212 col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1215 /* Don't bother setting length. We'll set it later after we
1216 * find the lengths of NHDR */
1217 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1219 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1221 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_0, tvb,
1223 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_0);
1225 proto_tree_add_uint(bf_tree, hf_sna_nlp_sm, tvb, index, 1,
1227 proto_tree_add_uint(bf_tree, hf_sna_nlp_tpf, tvb, index, 1,
1230 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_1, tvb,
1231 index+1, 1, nhdr_1);
1232 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_1);
1234 proto_tree_add_uint(bf_tree, hf_sna_nlp_ft, tvb,
1235 index+1, 1, nhdr_1);
1236 proto_tree_add_boolean(bf_tree, hf_sna_nlp_tspi, tvb,
1237 index+1, 1, nhdr_1);
1238 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn1, tvb,
1239 index+1, 1, nhdr_1);
1240 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn2, tvb,
1241 index+1, 1, nhdr_1);
1243 /* ANR or FR lists */
1248 if ((nhdr_0 & 0xe0) == 0xa0) {
1250 nhdr_x = tvb_get_guint8(tvb, index + counter);
1252 } while (nhdr_x != 0xff);
1254 proto_tree_add_item(nlp_tree,
1255 hf_sna_nlp_fra, tvb, index, counter, ENC_NA);
1258 proto_tree_add_text(nlp_tree, tvb, index, 1,
1263 proto_item_set_len(nlp_item, index);
1265 if ((nhdr_1 & 0xf0) == 0x10) {
1266 nhdr_x = tvb_get_guint8(tvb, index);
1268 proto_tree_add_uint(tree, hf_sna_nlp_frh,
1269 tvb, index, 1, nhdr_x);
1272 if (tvb_offset_exists(tvb, index))
1273 call_dissector(data_handle,
1274 tvb_new_subset_remaining(tvb, index),
1275 pinfo, parent_tree);
1279 if ((nhdr_0 & 0xe0) == 0xc0) {
1281 nhdr_x = tvb_get_guint8(tvb, index + counter);
1283 } while (nhdr_x != 0xff);
1285 proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1286 tvb, index, counter, ENC_NA);
1290 proto_tree_add_text(nlp_tree, tvb, index, 1,
1295 proto_item_set_len(nlp_item, index);
1298 thdr_8 = tvb_get_guint8(tvb, index+8);
1299 thdr_9 = tvb_get_guint8(tvb, index+9);
1300 thdr_len = tvb_get_ntohs(tvb, index+10);
1301 thdr_dlf = tvb_get_ntohl(tvb, index+12);
1304 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1305 index, thdr_len << 2, ENC_NA);
1306 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1308 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1310 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_8, tvb,
1311 index+8, 1, thdr_8);
1312 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_8);
1314 proto_tree_add_boolean(bf_tree, hf_sna_nlp_setupi, tvb,
1315 index+8, 1, thdr_8);
1316 proto_tree_add_boolean(bf_tree, hf_sna_nlp_somi, tvb, index+8,
1318 proto_tree_add_boolean(bf_tree, hf_sna_nlp_eomi, tvb, index+8,
1320 proto_tree_add_boolean(bf_tree, hf_sna_nlp_sri, tvb, index+8,
1322 proto_tree_add_boolean(bf_tree, hf_sna_nlp_rasapi, tvb,
1323 index+8, 1, thdr_8);
1324 proto_tree_add_boolean(bf_tree, hf_sna_nlp_retryi, tvb,
1325 index+8, 1, thdr_8);
1327 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_9, tvb,
1328 index+9, 1, thdr_9);
1329 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_9);
1331 proto_tree_add_boolean(bf_tree, hf_sna_nlp_lmi, tvb, index+9,
1333 proto_tree_add_boolean(bf_tree, hf_sna_nlp_cqfi, tvb, index+9,
1335 proto_tree_add_boolean(bf_tree, hf_sna_nlp_osi, tvb, index+9,
1338 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, index+10,
1340 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, index+12,
1342 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, index+16,
1347 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindex)) {
1348 counter = tvb_get_guint8(tvb, index + subindex);
1349 if (tvb_get_guint8(tvb, index+subindex+1) == 5)
1350 dissect_control(tvb, index + subindex, counter+2, nlp_tree, 1, LT);
1352 call_dissector(data_handle,
1353 tvb_new_subset(tvb, index + subindex, counter+2,
1354 -1), pinfo, nlp_tree);
1356 subindex += (counter+2);
1358 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindex))
1360 tvb_new_subset(tvb, index + subindex,
1361 (thdr_len << 2) - subindex, -1),
1364 index += (thdr_len << 2);
1365 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1366 col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1367 if (tvb_offset_exists(tvb, index)) {
1368 call_dissector(data_handle,
1369 tvb_new_subset_remaining(tvb, index), pinfo,
1374 if (tvb_offset_exists(tvb, index)) {
1375 /* Transmission Header Format Identifier */
1376 fid = hi_nibble(tvb_get_guint8(tvb, index));
1377 if (fid == 5) /* Only FID5 allowed for HPR */
1378 dissect_fid(tvb_new_subset_remaining(tvb, index), pinfo,
1381 if (tvb_get_ntohs(tvb, index+2) == 0x12ce) {
1383 col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1384 dissect_gds(tvb_new_subset_remaining(tvb, index),
1385 pinfo, tree, parent_tree);
1387 call_dissector(data_handle,
1388 tvb_new_subset_remaining(tvb, index),
1389 pinfo, parent_tree);
1394 /* --------------------------------------------------------------------
1395 * Chapter 3 Exchange Identification (XID) Information Fields
1396 * --------------------------------------------------------------------
1400 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1405 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1410 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1417 dlen = tvb_get_guint8(tvb, 0);
1421 while (tvb_offset_exists(tvb, offset)) {
1422 dlen = tvb_get_guint8(tvb, offset+1);
1423 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1424 offset += (dlen + 2);
1429 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1431 proto_tree *sub_tree;
1432 proto_item *sub_ti = NULL;
1433 guint val, dlen, offset;
1438 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1440 val = tvb_get_ntohs(tvb, 2);
1442 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_8, tvb,
1444 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_8);
1446 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_init_self, tvb, 2, 2,
1448 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_stand_bind, tvb, 2, 2,
1450 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_gener_bind, tvb, 2, 2,
1452 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_recve_bind, tvb, 2, 2,
1454 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_actpu, tvb, 2, 2, val);
1455 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nwnode, tvb, 2, 2, val);
1456 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cp, tvb, 2, 2, val);
1457 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpcp, tvb, 2, 2, val);
1458 proto_tree_add_uint(sub_tree, hf_sna_xid_3_state, tvb, 2, 2, val);
1459 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nonact, tvb, 2, 2, val);
1460 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpchange, tvb, 2, 2,
1463 val = tvb_get_guint8(tvb, 4);
1465 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_10, tvb,
1467 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_10);
1469 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_asend_bind, tvb, 4, 1,
1471 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_arecv_bind, tvb, 4, 1,
1473 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_quiesce, tvb, 4, 1, val);
1474 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pucap, tvb, 4, 1, val);
1475 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pbn, tvb, 4, 1, val);
1476 proto_tree_add_uint(sub_tree, hf_sna_xid_3_pacing, tvb, 4, 1, val);
1478 val = tvb_get_guint8(tvb, 5);
1480 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_11, tvb,
1482 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_11);
1484 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_tgshare, tvb, 5, 1, val);
1485 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dedsvc, tvb, 5, 1, val);
1487 val = tvb_get_guint8(tvb, 6);
1489 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_12, tvb,
1490 6, 1, ENC_BIG_ENDIAN);
1491 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_12);
1493 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcsup, tvb, 6, 1, val);
1494 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcomp, tvb, 6, 1, val);
1496 proto_tree_add_text(tree, tvb, 7, 2, "Reserved");
1498 val = tvb_get_guint8(tvb, 9);
1500 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_15, tvb,
1501 9, 1, ENC_BIG_ENDIAN);
1502 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_15);
1504 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_partg, tvb, 9, 1, val);
1505 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlur, tvb, 9, 1, val);
1506 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlus, tvb, 9, 1, val);
1507 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_exbn, tvb, 9, 1, val);
1508 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_genodai, tvb, 9, 1, val);
1509 proto_tree_add_uint(sub_tree, hf_sna_xid_3_branch, tvb, 9, 1, val);
1510 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_brnn, tvb, 9, 1, val);
1512 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1513 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1515 dlen = tvb_get_guint8(tvb, 12);
1517 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1519 /* FIXME: DLC Dependent Data Go Here */
1523 while (tvb_offset_exists(tvb, offset)) {
1524 dlen = tvb_get_guint8(tvb, offset+1);
1525 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1531 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1532 proto_tree *parent_tree)
1534 proto_tree *sub_tree;
1535 proto_item *sub_ti = NULL;
1536 int format, type, len;
1539 len = tvb_get_guint8(tvb, 1);
1540 type = tvb_get_guint8(tvb, 0);
1541 id = tvb_get_ntohl(tvb, 2);
1542 format = hi_nibble(type);
1544 /* Summary information */
1545 if (check_col(pinfo->cinfo, COL_INFO))
1546 col_add_fstr(pinfo->cinfo, COL_INFO,
1547 "SNA XID Format:%d Type:%s", format,
1548 val_to_str(lo_nibble(type), sna_xid_type_vals,
1552 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1553 0, 1, ENC_BIG_ENDIAN);
1554 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1556 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1558 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1561 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1563 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1564 2, 4, ENC_BIG_ENDIAN);
1565 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1567 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1569 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1576 dissect_xid1(tvb_new_subset(tvb, 6, len-6, -1),
1580 dissect_xid2(tvb_new_subset(tvb, 6, len-6, -1),
1584 dissect_xid3(tvb_new_subset(tvb, 6, len-6, -1),
1588 /* external standards organizations */
1589 call_dissector(data_handle,
1590 tvb_new_subset(tvb, 6, len-6, -1),
1598 if (tvb_offset_exists(tvb, len))
1599 call_dissector(data_handle,
1600 tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1603 /* --------------------------------------------------------------------
1604 * Chapter 4 Transmission Headers (THs)
1605 * --------------------------------------------------------------------
1611 mpf_value(guint8 th_byte)
1613 return (th_byte & 0x0c) >> 2;
1616 #define FIRST_FRAG_NUMBER 0
1617 #define MIDDLE_FRAG_NUMBER 1
1618 #define LAST_FRAG_NUMBER 2
1620 /* FID2 is defragged by sequence. The weird thing is that we have neither
1621 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1622 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1623 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1624 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1625 * and 2. However, if the BIU is split into 2 frames, then we only have
1626 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1629 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1630 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1631 * see the FTP URL in the comment near the top of this file). I *think*
1632 * this means that the fragmented frames cannot arrive out of order.
1633 * Well, I *want* it to mean this, because w/o this limitation, if you
1634 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1635 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1636 * arrive in order, then we're saved.
1638 * The problem then boils down to figuring out if "LAST" means frag-number 1
1639 * (in the case of a BIU split into 2 frames) or frag-number 2
1640 * (in the case of a BIU split into 3 frames).
1642 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1643 * way to handle the mapping of "LAST" to either frag-number 1 or
1644 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1645 * This consumes resources. A trickier way, but a way which works, is to
1646 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1647 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1648 * and the reassembly code tells us that the the BIU is still not reassmebled,
1649 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1650 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1651 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1652 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1653 * to complete the reassembly.
1656 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1659 fragment_data *fd_head;
1660 int frag_number = -1;
1661 int more_frags = TRUE;
1662 tvbuff_t *rh_tvb = NULL;
1665 /* Determine frag_number and more_frags */
1670 case MPF_FIRST_SEGMENT:
1671 frag_number = FIRST_FRAG_NUMBER;
1673 case MPF_MIDDLE_SEGMENT:
1674 frag_number = MIDDLE_FRAG_NUMBER;
1676 case MPF_LAST_SEGMENT:
1677 frag_number = LAST_FRAG_NUMBER;
1681 DISSECTOR_ASSERT_NOT_REACHED();
1684 /* If sna_defragment is on, and this is a fragment.. */
1685 if (frag_number > -1) {
1686 /* XXX - check length ??? */
1687 frag_len = tvb_reported_length_remaining(tvb, offset);
1688 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1689 fd_head = fragment_add_seq(tvb, offset, pinfo, id,
1690 sna_fragment_table, frag_number, frag_len,
1693 /* We added the LAST segment and reassembly didn't
1694 * complete. Insert a zero-length MIDDLE segment to
1695 * turn a 2-frame BIU-fragmentation into a 3-frame
1696 * BIU-fragmentation (empty middle frag).
1697 * See above long comment about this trickery. */
1699 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1700 fd_head = fragment_add_seq(tvb, offset, pinfo,
1701 id, sna_fragment_table,
1702 MIDDLE_FRAG_NUMBER, 0, TRUE);
1705 if (fd_head != NULL) {
1706 /* We have the complete reassembled payload. */
1707 rh_tvb = tvb_new_child_real_data(tvb, fd_head->data,
1708 fd_head->len, fd_head->len);
1710 /* Add the defragmented data to the data
1712 add_new_data_source(pinfo, rh_tvb,
1713 "Reassembled SNA BIU");
1720 #define SNA_FID01_ADDR_LEN 2
1722 /* FID Types 0 and 1 */
1724 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1726 proto_tree *bf_tree;
1727 proto_item *bf_item;
1731 const int bytes_in_header = 10;
1735 th_0 = tvb_get_guint8(tvb, 0);
1736 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1738 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1740 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1741 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1742 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1745 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1748 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1752 ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
1753 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1754 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1757 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1760 ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
1761 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1762 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1764 /* If we're not filling a proto_tree, return now */
1766 return bytes_in_header;
1768 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1769 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1771 return bytes_in_header;
1774 #define SNA_FID2_ADDR_LEN 1
1778 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1779 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1781 proto_tree *bf_tree;
1782 proto_item *bf_item;
1783 guint8 th_0=0, daf=0, oaf=0;
1785 unsigned int mpf, id;
1787 const int bytes_in_header = 6;
1789 th_0 = tvb_get_guint8(tvb, 0);
1790 mpf = mpf_value(th_0);
1793 daf = tvb_get_guint8(tvb, 2);
1794 oaf = tvb_get_guint8(tvb, 3);
1797 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1799 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1801 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1802 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1803 proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0);
1804 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1808 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1811 proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf,
1812 "Destination Address Field: 0x%02x", daf);
1816 ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
1817 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1818 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1822 proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf,
1823 "Origin Address Field: 0x%02x", oaf);
1827 ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
1828 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1829 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1831 id = tvb_get_ntohs(tvb, 4);
1833 proto_tree_add_uint(tree, hf_sna_th_snf, tvb, 4, 2, id);
1835 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1836 if (mpf == MPF_FIRST_SEGMENT) {
1837 *continue_dissecting = rh_only;
1839 *continue_dissecting = stop_here;
1843 else if (sna_defragment) {
1844 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1845 bytes_in_header, mpf, id);
1848 return bytes_in_header;
1853 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1855 proto_tree *bf_tree;
1856 proto_item *bf_item;
1859 const int bytes_in_header = 2;
1861 /* If we're not filling a proto_tree, return now */
1863 return bytes_in_header;
1865 th_0 = tvb_get_guint8(tvb, 0);
1867 /* Create the bitfield tree */
1868 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1869 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1871 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1872 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1873 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1875 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1877 return bytes_in_header;
1881 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1883 proto_tree *bf_tree;
1884 proto_item *bf_item;
1886 guint8 th_byte, mft;
1890 static struct sna_fid_type_4_addr src, dst;
1892 const int bytes_in_header = 26;
1894 /* If we're not filling a proto_tree, return now */
1896 return bytes_in_header;
1898 th_byte = tvb_get_guint8(tvb, offset);
1900 /* Create the bitfield tree */
1901 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset,
1903 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1906 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb,
1907 offset, 1, th_byte);
1908 proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb,
1909 offset, 1, th_byte);
1910 proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb,
1911 offset, 1, th_byte);
1912 proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb,
1913 offset, 1, th_byte);
1914 proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb,
1915 offset, 1, th_byte);
1918 th_byte = tvb_get_guint8(tvb, offset);
1920 /* Create the bitfield tree */
1921 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1922 "Transmission Header Byte 1");
1923 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1926 proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1,
1928 proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1,
1930 proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1,
1933 mft = th_byte & 0x04;
1935 th_byte = tvb_get_guint8(tvb, offset);
1937 /* Create the bitfield tree */
1938 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1939 "Transmission Header Byte 2");
1940 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1944 proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb,
1945 offset, 1, th_byte);
1946 proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb,
1947 offset, 1, th_byte);
1949 proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb,
1950 offset, 1, th_byte);
1952 proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1,
1956 th_byte = tvb_get_guint8(tvb, offset);
1958 /* Create the bitfield tree */
1959 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1960 "Transmission Header Byte 3");
1961 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1964 proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1,
1966 proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, offset, 1,
1970 th_word = tvb_get_ntohs(tvb, offset);
1972 /* Create the bitfield tree */
1973 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1974 "Transmission Header Bytes 4-5");
1975 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1978 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb,
1979 offset, 2, th_word);
1980 proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb,
1981 offset, 2, th_word);
1982 proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb,
1983 offset, 2, th_word);
1985 /* I'm not sure about byte-order on this one... */
1986 proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb,
1987 offset, 2, th_word);
1990 th_word = tvb_get_ntohs(tvb, offset);
1992 /* Create the bitfield tree */
1993 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1994 "Transmission Header Bytes 6-7");
1995 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1998 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset,
2000 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset,
2002 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset,
2004 proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset,
2007 /* I'm not sure about byte-order on this one... */
2008 proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb,
2009 offset, 2, th_word);
2013 dsaf = tvb_get_ntohl(tvb, 8);
2015 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
2019 osaf = tvb_get_ntohl(tvb, 12);
2021 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
2024 th_byte = tvb_get_guint8(tvb, offset);
2026 /* Create the bitfield tree */
2027 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
2028 "Transmission Header Byte 16");
2029 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2032 proto_tree_add_boolean(bf_tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
2034 /* We luck out here because in their infinite wisdom the SNA
2035 * architects placed the MPF and EFI fields in the same bitfield
2036 * locations, even though for FID4 they're not in byte 0.
2038 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
2039 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
2042 /* 1 for byte 16, 1 for byte 17 which is reserved */
2044 def = tvb_get_ntohs(tvb, 18);
2046 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
2048 /* Addresses in FID 4 are discontiguous, sigh */
2051 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2053 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2056 oef = tvb_get_ntohs(tvb, 20);
2057 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
2059 /* Addresses in FID 4 are discontiguous, sigh */
2062 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2064 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2067 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
2068 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
2070 return bytes_in_header;
2075 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
2077 proto_tree *bf_tree;
2078 proto_item *bf_item;
2081 const int bytes_in_header = 12;
2083 /* If we're not filling a proto_tree, return now */
2085 return bytes_in_header;
2087 th_0 = tvb_get_guint8(tvb, 0);
2089 /* Create the bitfield tree */
2090 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2091 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2093 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2094 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
2095 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
2097 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2098 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
2100 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
2102 return bytes_in_header;
2108 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2110 proto_tree *bf_tree;
2111 proto_item *bf_item;
2114 const int bytes_in_header = 26;
2116 /* If we're not filling a proto_tree, return now */
2118 return bytes_in_header;
2120 th_0 = tvb_get_guint8(tvb, 0);
2122 /* Create the bitfield tree */
2123 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2124 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2126 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2127 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2129 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, ENC_BIG_ENDIAN);
2130 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2131 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, ENC_BIG_ENDIAN);
2133 /* Yup, bytes 6-23 are reserved! */
2134 proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
2136 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2138 return bytes_in_header;
2142 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2143 proto_tree *parent_tree)
2146 proto_tree *th_tree = NULL, *rh_tree = NULL;
2147 proto_item *th_ti = NULL, *rh_ti = NULL;
2149 int th_header_len = 0;
2150 int offset, rh_offset;
2151 tvbuff_t *rh_tvb = NULL;
2152 next_dissection_t continue_dissecting = everything;
2154 /* Transmission Header Format Identifier */
2155 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
2157 /* Summary information */
2158 if (check_col(pinfo->cinfo, COL_INFO))
2159 col_add_str(pinfo->cinfo, COL_INFO,
2160 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2164 /* Don't bother setting length. We'll set it later after we
2165 * find the length of TH */
2166 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2168 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2171 /* Get size of TH */
2175 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2178 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2179 &rh_tvb, &continue_dissecting);
2182 th_header_len = dissect_fid3(tvb, th_tree);
2185 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2188 th_header_len = dissect_fid5(tvb, th_tree);
2191 th_header_len = dissect_fidf(tvb, th_tree);
2194 call_dissector(data_handle,
2195 tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2199 offset = th_header_len;
2201 /* Short-circuit ? */
2202 if (continue_dissecting == stop_here) {
2204 proto_tree_add_text(tree, tvb, offset, -1,
2205 "BIU segment data");
2210 /* If the FID dissector function didn't create an rh_tvb, then we just
2211 * use the rest of our tvbuff as the rh_tvb. */
2213 rh_tvb = tvb_new_subset_remaining(tvb, offset);
2216 /* Process the rest of the SNA packet, starting with RH */
2218 proto_item_set_len(th_ti, th_header_len);
2221 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2223 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2224 dissect_rh(rh_tvb, rh_offset, rh_tree);
2227 rh_offset += RH_LEN;
2229 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2230 /* Short-circuit ? */
2231 if (continue_dissecting == rh_only) {
2233 proto_tree_add_text(tree, rh_tvb, rh_offset, -1,
2234 "BIU segment data");
2238 call_dissector(data_handle,
2239 tvb_new_subset_remaining(rh_tvb, rh_offset),
2240 pinfo, parent_tree);
2244 /* --------------------------------------------------------------------
2245 * Chapter 5 Request/Response Headers (RHs)
2246 * --------------------------------------------------------------------
2250 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2252 proto_tree *bf_tree;
2253 proto_item *bf_item;
2254 gboolean is_response;
2255 guint8 rh_0, rh_1, rh_2;
2260 /* Create the bitfield tree for byte 0*/
2261 rh_0 = tvb_get_guint8(tvb, offset);
2262 is_response = (rh_0 & 0x80);
2264 bf_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, rh_0);
2265 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
2267 proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
2268 proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1,
2270 proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
2271 proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
2272 proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
2273 proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
2276 rh_1 = tvb_get_guint8(tvb, offset);
2278 /* Create the bitfield tree for byte 1*/
2279 bf_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, rh_1);
2280 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
2282 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb, offset, 1, rh_1);
2285 proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1,
2288 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb, offset, 1, rh_1);
2291 proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb, offset, 1,
2294 proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb, offset, 1,
2296 proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1,
2300 proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
2301 proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb, offset, 1, rh_1);
2304 rh_2 = tvb_get_guint8(tvb, offset);
2306 /* Create the bitfield tree for byte 2*/
2307 bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
2310 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
2312 proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb, offset, 1,
2314 proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb, offset, 1,
2316 proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb, offset, 1,
2318 proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb, offset, 1,
2320 proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb, offset, 1,
2322 proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb, offset, 1,
2324 proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1,
2328 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
2331 /* --------------------------------------------------------------------
2332 * Chapter 6 Request/Response Units (RUs)
2333 * --------------------------------------------------------------------
2336 /* --------------------------------------------------------------------
2337 * Chapter 9 Common Fields
2338 * --------------------------------------------------------------------
2342 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2345 proto_tree *bf_tree;
2346 proto_item *bf_item;
2348 guint16 offset, len, pad;
2353 type = tvb_get_guint8(tvb, 2);
2355 bf_item = proto_tree_add_uint(tree, hf_sna_control_05_type, tvb,
2357 bf_tree = proto_item_add_subtree(bf_item, ett_sna_control_05hpr_type);
2359 proto_tree_add_boolean(bf_tree, hf_sna_control_05_ptp, tvb, 2, 1, type);
2360 proto_tree_add_text(tree, tvb, 3, 1, "Reserved");
2364 while (tvb_offset_exists(tvb, offset)) {
2366 len = tvb_get_guint8(tvb, offset+0);
2368 len = tvb_get_guint8(tvb, offset+1);
2371 dissect_control(tvb, offset, len, tree, hpr, parse);
2372 pad = (len+3) & 0xfffc;
2374 /* XXX - fix this, ensure tvb is large enough for pad */
2375 tvb_ensure_bytes_exist(tvb, offset+len, pad-len);
2376 proto_tree_add_text(tree, tvb, offset+len,
2377 pad-len, "Padding");
2387 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2392 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2396 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2404 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2406 len = tvb_reported_length_remaining(tvb, 3);
2410 buf = tvb_get_ephemeral_string(tvb, 3, len);
2411 EBCDIC_to_ASCII(buf, len);
2412 proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char *)buf);
2416 dissect_control(tvbuff_t *parent_tvb, int offset, int control_len,
2417 proto_tree *tree, int hpr, enum parse parse)
2420 gint length, reported_length;
2421 proto_tree *sub_tree;
2422 proto_item *sub_item;
2426 length = tvb_length_remaining(parent_tvb, offset);
2427 reported_length = tvb_reported_length_remaining(parent_tvb, offset);
2428 if (control_len < length)
2429 length = control_len;
2430 if (control_len < reported_length)
2431 reported_length = control_len;
2432 tvb = tvb_new_subset(parent_tvb, offset, length, reported_length);
2437 len = tvb_get_guint8(tvb, 0);
2438 key = tvb_get_guint8(tvb, 1);
2440 key = tvb_get_guint8(tvb, 0);
2441 len = tvb_get_guint8(tvb, 1);
2443 ett = ett_sna_control_un;
2447 if (hpr) ett = ett_sna_control_05hpr;
2448 else ett = ett_sna_control_05;
2450 if (key == 0x0e) ett = ett_sna_control_0e;
2452 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2453 sub_item = proto_tree_add_text(tree, tvb, 0, -1, "%s",
2454 val_to_str(key, sna_control_hpr_vals,
2455 "Unknown Control Vector"));
2457 sub_item = proto_tree_add_text(tree, tvb, 0, -1, "%s",
2458 val_to_str(key, sna_control_vals,
2459 "Unknown Control Vector"));
2460 sub_tree = proto_item_add_subtree(sub_item, ett);
2462 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2464 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2465 proto_tree_add_uint(sub_tree,
2466 hf_sna_control_hprkey, tvb, 1, 1, key);
2468 proto_tree_add_uint(sub_tree,
2469 hf_sna_control_key, tvb, 1, 1, key);
2471 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2472 proto_tree_add_uint(sub_tree,
2473 hf_sna_control_hprkey, tvb, 0, 1, key);
2475 proto_tree_add_uint(sub_tree,
2476 hf_sna_control_key, tvb, 0, 1, key);
2477 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2484 dissect_control_05hpr(tvb, sub_tree, hpr,
2487 dissect_control_05(tvb, sub_tree);
2490 dissect_control_0e(tvb, sub_tree);
2495 /* --------------------------------------------------------------------
2496 * Chapter 11 Function Management (FM) Headers
2497 * --------------------------------------------------------------------
2500 /* --------------------------------------------------------------------
2501 * Chapter 12 Presentation Services (PS) Headers
2502 * --------------------------------------------------------------------
2505 /* --------------------------------------------------------------------
2506 * Chapter 13 GDS Variables
2507 * --------------------------------------------------------------------
2511 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2512 proto_tree *parent_tree)
2518 proto_tree *gds_tree;
2519 proto_item *gds_item;
2523 type = tvb_get_ntohs(tvb, offset+2);
2526 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2527 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2528 type = tvb_get_ntohs(tvb, offset+2);
2530 if (length < 2 ) /* escape sequence ? */
2533 gds_item = proto_tree_add_item(tree, hf_sna_gds, tvb,
2534 offset, length, ENC_NA);
2535 gds_tree = proto_item_add_subtree(gds_item,
2538 proto_tree_add_uint(gds_tree, hf_sna_gds_len, tvb,
2540 proto_tree_add_boolean(gds_tree, hf_sna_gds_cont, tvb,
2542 proto_tree_add_uint(gds_tree, hf_sna_gds_type, tvb,
2547 if (tvb_offset_exists(tvb, offset))
2548 call_dissector(data_handle,
2549 tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2552 /* --------------------------------------------------------------------
2554 * --------------------------------------------------------------------
2558 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2561 proto_tree *sna_tree = NULL;
2562 proto_item *sna_ti = NULL;
2564 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2565 col_clear(pinfo->cinfo, COL_INFO);
2567 /* SNA data should be printed in EBCDIC, not ASCII */
2568 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2572 /* Don't bother setting length. We'll set it later after we find
2573 * the lengths of TH/RH/RU */
2574 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2576 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2579 /* Transmission Header Format Identifier */
2580 fid = hi_nibble(tvb_get_guint8(tvb, 0));
2582 case 0xa: /* HPR Network Layer Packet */
2586 dissect_nlp(tvb, pinfo, sna_tree, tree);
2589 dissect_fid(tvb, pinfo, sna_tree, tree);
2594 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2596 proto_tree *sna_tree = NULL;
2597 proto_item *sna_ti = NULL;
2599 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2600 col_clear(pinfo->cinfo, COL_INFO);
2602 /* SNA data should be printed in EBCDIC, not ASCII */
2603 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2607 /* Don't bother setting length. We'll set it later after we find
2608 * the lengths of XID */
2609 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2611 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2613 dissect_xid(tvb, pinfo, sna_tree, tree);
2619 fragment_table_init(&sna_fragment_table);
2624 proto_register_sna(void)
2626 static hf_register_info hf[] = {
2628 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2629 NULL, 0x0, NULL, HFILL }},
2632 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2634 "TH Byte 0", HFILL }},
2637 { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2638 VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2641 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2642 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2645 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2646 BASE_DEC, NULL, 0x02, NULL, HFILL }},
2649 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2650 BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2653 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2654 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2657 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2658 NULL, 0x0, NULL, HFILL }},
2661 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2662 NULL, 0x0, NULL, HFILL }},
2665 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2666 NULL, 0x0, NULL, HFILL }},
2669 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2670 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2672 { &hf_sna_th_tg_sweep,
2673 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2674 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2676 { &hf_sna_th_er_vr_supp_ind,
2677 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2678 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2679 0x04, NULL, HFILL }},
2681 { &hf_sna_th_vr_pac_cnt_ind,
2682 { "Virtual Route Pacing Count Indicator",
2683 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2684 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2686 { &hf_sna_th_ntwk_prty,
2687 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2688 VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2691 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2692 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2696 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2697 NULL, 0x04, NULL, HFILL }},
2700 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2701 VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2704 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2705 BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2708 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2709 VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2711 { &hf_sna_th_nlp_cp,
2712 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2713 NULL, 0x70, NULL, HFILL }},
2716 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2717 NULL, 0x0f, NULL, HFILL }},
2720 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2721 NULL, 0xf0, NULL, HFILL }},
2724 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2725 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2727 { &hf_sna_th_vr_cwi,
2728 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2729 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2730 "Change Window Indicator", HFILL }},
2732 { &hf_sna_th_tg_nonfifo_ind,
2733 { "Transmission Group Non-FIFO Indicator",
2734 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2735 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2737 { &hf_sna_th_vr_sqti,
2738 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2739 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2740 "Route Sequence and Type", HFILL }},
2742 { &hf_sna_th_tg_snf,
2743 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2744 FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2747 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2748 16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2751 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2752 16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2754 { &hf_sna_th_vr_cwri,
2755 { "Virtual Route Change Window Reply Indicator",
2756 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2757 VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2759 { &hf_sna_th_vr_rwi,
2760 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2761 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2764 { &hf_sna_th_vr_snf_send,
2765 { "Virtual Route Send Sequence Number Field",
2766 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2767 "Send Sequence Number Field", HFILL }},
2770 { "Destination Subarea Address Field", "sna.th.dsaf",
2771 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2774 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2775 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2778 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2779 "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2782 { "Destination Element Field", "sna.th.def", FT_UINT16,
2783 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2786 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2787 NULL, 0x0, NULL, HFILL }},
2790 { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2791 NULL, 0x0, NULL, HFILL }},
2793 { &hf_sna_th_cmd_fmt,
2794 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2795 NULL, 0x0, NULL, HFILL }},
2797 { &hf_sna_th_cmd_type,
2798 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2799 NULL, 0x0, NULL, HFILL }},
2801 { &hf_sna_th_cmd_sn,
2802 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2803 BASE_DEC, NULL, 0x0, NULL, HFILL }},
2806 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2807 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2809 { &hf_sna_nlp_nhdr_0,
2810 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2811 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2813 { &hf_sna_nlp_nhdr_1,
2814 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2815 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2818 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2819 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2822 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2823 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2826 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2827 VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2830 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2831 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2833 { &hf_sna_nlp_slowdn1,
2834 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2835 TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2837 { &hf_sna_nlp_slowdn2,
2838 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2839 TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2842 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2843 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2846 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2847 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2850 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2851 BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2854 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2855 NULL, 0x0, "THDR", HFILL }},
2858 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2859 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2861 { &hf_sna_nlp_thdr_8,
2862 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2863 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2865 { &hf_sna_nlp_setupi,
2866 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2867 TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2870 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2871 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2874 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2875 8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2878 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2879 8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2881 { &hf_sna_nlp_rasapi,
2882 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2883 8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2885 { &hf_sna_nlp_retryi,
2886 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2887 8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2889 { &hf_sna_nlp_thdr_9,
2890 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2891 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2894 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2895 8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2898 { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2899 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2902 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2903 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2905 { &hf_sna_nlp_offset,
2906 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2907 NULL, 0x0, "Data Offset in Words", HFILL }},
2910 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2911 NULL, 0x0, NULL, HFILL }},
2914 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2915 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2917 { &hf_sna_nlp_opti_len,
2918 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2919 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2921 { &hf_sna_nlp_opti_type,
2922 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2923 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2926 { &hf_sna_nlp_opti_0d_version,
2927 { "Version", "sna.nlp.thdr.optional.0d.version",
2928 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2931 { &hf_sna_nlp_opti_0d_4,
2932 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2933 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2935 { &hf_sna_nlp_opti_0d_target,
2936 { "Target Resource ID Present",
2937 "sna.nlp.thdr.optional.0d.target",
2938 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2940 { &hf_sna_nlp_opti_0d_arb,
2941 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2942 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2944 { &hf_sna_nlp_opti_0d_reliable,
2945 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2946 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2948 { &hf_sna_nlp_opti_0d_dedicated,
2949 { "Dedicated RTP Connection",
2950 "sna.nlp.thdr.optional.0d.dedicated",
2951 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2953 { &hf_sna_nlp_opti_0e_stat,
2954 { "Status", "sna.nlp.thdr.optional.0e.stat",
2955 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2957 { &hf_sna_nlp_opti_0e_gap,
2958 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2959 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2961 { &hf_sna_nlp_opti_0e_idle,
2962 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2963 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2965 { &hf_sna_nlp_opti_0e_nabsp,
2966 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2967 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2969 { &hf_sna_nlp_opti_0e_sync,
2970 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2971 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2973 { &hf_sna_nlp_opti_0e_echo,
2974 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2975 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2977 { &hf_sna_nlp_opti_0e_rseq,
2978 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2979 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2981 { &hf_sna_nlp_opti_0e_abspbeg,
2982 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2983 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2985 { &hf_sna_nlp_opti_0e_abspend,
2986 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2987 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2989 { &hf_sna_nlp_opti_0f_bits,
2990 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2991 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2992 0x0, NULL, HFILL }},
2994 { &hf_sna_nlp_opti_10_tcid,
2995 { "Transport Connection Identifier",
2996 "sna.nlp.thdr.optional.10.tcid",
2997 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2999 { &hf_sna_nlp_opti_12_sense,
3000 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
3001 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3003 { &hf_sna_nlp_opti_14_si_len,
3004 { "Length", "sna.nlp.thdr.optional.14.si.len",
3005 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3007 { &hf_sna_nlp_opti_14_si_key,
3008 { "Key", "sna.nlp.thdr.optional.14.si.key",
3009 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3011 { &hf_sna_nlp_opti_14_si_2,
3012 { "Switching Information Byte 2",
3013 "sna.nlp.thdr.optional.14.si.2",
3014 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3016 { &hf_sna_nlp_opti_14_si_refifo,
3017 { "Resequencing (REFIFO) Indicator",
3018 "sna.nlp.thdr.optional.14.si.refifo",
3019 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3021 { &hf_sna_nlp_opti_14_si_mobility,
3022 { "Mobility Indicator",
3023 "sna.nlp.thdr.optional.14.si.mobility",
3024 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
3026 { &hf_sna_nlp_opti_14_si_dirsearch,
3027 { "Directory Search Required on Path Switch Indicator",
3028 "sna.nlp.thdr.optional.14.si.dirsearch",
3029 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
3031 { &hf_sna_nlp_opti_14_si_limitres,
3032 { "Limited Resource Link Indicator",
3033 "sna.nlp.thdr.optional.14.si.limitres",
3034 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
3036 { &hf_sna_nlp_opti_14_si_ncescope,
3037 { "NCE Scope Indicator",
3038 "sna.nlp.thdr.optional.14.si.ncescope",
3039 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
3041 { &hf_sna_nlp_opti_14_si_mnpsrscv,
3042 { "MNPS RSCV Retention Indicator",
3043 "sna.nlp.thdr.optional.14.si.mnpsrscv",
3044 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3046 { &hf_sna_nlp_opti_14_si_maxpsize,
3047 { "Maximum Packet Size On Return Path",
3048 "sna.nlp.thdr.optional.14.si.maxpsize",
3049 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3051 { &hf_sna_nlp_opti_14_si_switch,
3052 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
3053 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3055 { &hf_sna_nlp_opti_14_si_alive,
3056 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
3057 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3059 { &hf_sna_nlp_opti_14_rr_len,
3060 { "Length", "sna.nlp.thdr.optional.14.rr.len",
3061 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3063 { &hf_sna_nlp_opti_14_rr_key,
3064 { "Key", "sna.nlp.thdr.optional.14.rr.key",
3065 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3067 { &hf_sna_nlp_opti_14_rr_2,
3068 { "Return Route TG Descriptor Byte 2",
3069 "sna.nlp.thdr.optional.14.rr.2",
3070 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3072 { &hf_sna_nlp_opti_14_rr_bfe,
3073 { "BF Entry Indicator",
3074 "sna.nlp.thdr.optional.14.rr.bfe",
3075 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3077 { &hf_sna_nlp_opti_14_rr_num,
3078 { "Number Of TG Control Vectors",
3079 "sna.nlp.thdr.optional.14.rr.num",
3080 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3082 { &hf_sna_nlp_opti_22_2,
3083 { "Adaptive Rate Based Segment Byte 2",
3084 "sna.nlp.thdr.optional.22.2",
3085 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3087 { &hf_sna_nlp_opti_22_type,
3089 "sna.nlp.thdr.optional.22.type",
3091 VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
3093 { &hf_sna_nlp_opti_22_raa,
3094 { "Rate Adjustment Action",
3095 "sna.nlp.thdr.optional.22.raa",
3097 VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
3099 { &hf_sna_nlp_opti_22_parity,
3100 { "Parity Indicator",
3101 "sna.nlp.thdr.optional.22.parity",
3102 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3104 { &hf_sna_nlp_opti_22_arb,
3106 "sna.nlp.thdr.optional.22.arb",
3108 VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
3110 { &hf_sna_nlp_opti_22_3,
3111 { "Adaptive Rate Based Segment Byte 3",
3112 "sna.nlp.thdr.optional.22.3",
3113 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3115 { &hf_sna_nlp_opti_22_ratereq,
3116 { "Rate Request Correlator",
3117 "sna.nlp.thdr.optional.22.ratereq",
3118 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3120 { &hf_sna_nlp_opti_22_raterep,
3121 { "Rate Reply Correlator",
3122 "sna.nlp.thdr.optional.22.raterep",
3123 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3125 { &hf_sna_nlp_opti_22_field1,
3126 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3127 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3129 { &hf_sna_nlp_opti_22_field2,
3130 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3131 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3133 { &hf_sna_nlp_opti_22_field3,
3134 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3135 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3137 { &hf_sna_nlp_opti_22_field4,
3138 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3139 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3142 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3143 NULL, 0x0, NULL, HFILL }},
3146 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3147 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3150 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3151 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3154 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3155 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3158 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8,
3159 BASE_DEC, VALS(sna_rh_rri_vals), 0x80, NULL, HFILL }},
3161 { &hf_sna_rh_ru_category,
3162 { "Request/Response Unit Category", "sna.rh.ru_category",
3163 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3167 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3168 TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3171 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3172 TFS(&sna_rh_sdi_truth), 0x04, NULL, HFILL }},
3175 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3176 TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3179 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3180 TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3183 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3184 8, NULL, 0x80, NULL, HFILL }},
3187 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3188 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3191 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3192 8, NULL, 0x20, NULL, HFILL }},
3195 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3196 8, NULL, 0x10, NULL, HFILL }},
3199 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3200 8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3203 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3204 8, NULL, 0x04, NULL, HFILL }},
3207 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3208 8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3211 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3212 8, NULL, 0x01, NULL, HFILL }},
3215 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3216 8, NULL, 0x80, NULL, HFILL }},
3219 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3220 8, NULL, 0x40, NULL, HFILL }},
3223 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3224 8, NULL, 0x20, NULL, HFILL }},
3227 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3228 VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3231 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3232 NULL, 0x04, NULL, HFILL }},
3235 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3236 0x02, NULL, HFILL }},
3239 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3240 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3243 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3244 NULL, 0x0, NULL, HFILL }},*/
3247 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3251 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3252 NULL, 0x7fff, NULL, HFILL }},
3255 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3256 0x8000, NULL, HFILL }},
3259 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3260 VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3263 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3264 "XID Frame", HFILL }},
3267 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3270 { &hf_sna_xid_format,
3271 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3272 0xf0, NULL, HFILL }},
3275 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3276 VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3279 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3283 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3284 NULL, 0x0, NULL, HFILL }},
3286 { &hf_sna_xid_idblock,
3287 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3288 0xfff00000, NULL, HFILL }},
3290 { &hf_sna_xid_idnum,
3291 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3292 0x0fffff, NULL, HFILL }},
3295 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3296 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3298 { &hf_sna_xid_3_init_self,
3299 { "INIT-SELF support", "sna.xid.type3.initself",
3300 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3302 { &hf_sna_xid_3_stand_bind,
3303 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3304 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3306 { &hf_sna_xid_3_gener_bind,
3307 { "Whole BIND PIU generated indicator",
3308 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3309 "Whole BIND PIU generated", HFILL }},
3311 { &hf_sna_xid_3_recve_bind,
3312 { "Whole BIND PIU required indicator",
3313 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3314 "Whole BIND PIU required", HFILL }},
3316 { &hf_sna_xid_3_actpu,
3317 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3318 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3320 { &hf_sna_xid_3_nwnode,
3321 { "Sender is network node", "sna.xid.type3.nwnode",
3322 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3325 { "Control Point Services", "sna.xid.type3.cp",
3326 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3328 { &hf_sna_xid_3_cpcp,
3329 { "CP-CP session support", "sna.xid.type3.cpcp",
3330 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3332 { &hf_sna_xid_3_state,
3333 { "XID exchange state indicator", "sna.xid.type3.state",
3334 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3335 0x000c, NULL, HFILL }},
3337 { &hf_sna_xid_3_nonact,
3338 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3339 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3341 { &hf_sna_xid_3_cpchange,
3342 { "CP name change support", "sna.xid.type3.cpchange",
3343 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3346 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3347 NULL, 0x0, NULL, HFILL }},
3349 { &hf_sna_xid_3_asend_bind,
3350 { "Adaptive BIND pacing support as sender",
3351 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3352 "Pacing support as sender", HFILL }},
3354 { &hf_sna_xid_3_arecv_bind,
3355 { "Adaptive BIND pacing support as receiver",
3356 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3357 "Pacing support as receive", HFILL }},
3359 { &hf_sna_xid_3_quiesce,
3360 { "Quiesce TG Request",
3361 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3364 { &hf_sna_xid_3_pucap,
3365 { "PU Capabilities",
3366 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3369 { &hf_sna_xid_3_pbn,
3370 { "Peripheral Border Node",
3371 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3374 { &hf_sna_xid_3_pacing,
3375 { "Qualifier for adaptive BIND pacing support",
3376 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3380 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3381 NULL, 0x0, NULL, HFILL }},
3383 { &hf_sna_xid_3_tgshare,
3384 { "TG Sharing Prohibited Indicator",
3385 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3388 { &hf_sna_xid_3_dedsvc,
3389 { "Dedicated SVC Indicator",
3390 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3394 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3395 NULL, 0x0, NULL, HFILL }},
3397 { &hf_sna_xid_3_negcsup,
3398 { "Negotiation Complete Supported",
3399 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3402 { &hf_sna_xid_3_negcomp,
3403 { "Negotiation Complete",
3404 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3408 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3409 NULL, 0x0, NULL, HFILL }},
3411 { &hf_sna_xid_3_partg,
3412 { "Parallel TG Support",
3413 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3416 { &hf_sna_xid_3_dlur,
3417 { "Dependent LU Requester Indicator",
3418 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3421 { &hf_sna_xid_3_dlus,
3422 { "DLUS Served LU Registration Indicator",
3423 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3426 { &hf_sna_xid_3_exbn,
3427 { "Extended HPR Border Node",
3428 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3431 { &hf_sna_xid_3_genodai,
3432 { "Generalized ODAI Usage Option",
3433 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3436 { &hf_sna_xid_3_branch,
3437 { "Branch Indicator", "sna.xid.type3.branch",
3438 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3439 0x06, NULL, HFILL }},
3441 { &hf_sna_xid_3_brnn,
3442 { "Option Set 1123 Indicator",
3443 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3447 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3450 { &hf_sna_xid_3_dlc,
3451 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3454 { &hf_sna_xid_3_dlen,
3455 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3456 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3458 { &hf_sna_control_len,
3459 { "Control Vector Length", "sna.control.len",
3460 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3462 { &hf_sna_control_key,
3463 { "Control Vector Key", "sna.control.key",
3464 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3467 { &hf_sna_control_hprkey,
3468 { "Control Vector HPR Key", "sna.control.hprkey",
3469 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3472 { &hf_sna_control_05_delay,
3473 { "Channel Delay", "sna.control.05.delay",
3474 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3476 { &hf_sna_control_05_type,
3477 { "Network Address Type", "sna.control.05.type",
3478 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3480 { &hf_sna_control_05_ptp,
3481 { "Point-to-point", "sna.control.05.ptp",
3482 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3484 { &hf_sna_control_0e_type,
3485 { "Type", "sna.control.0e.type",
3486 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3489 { &hf_sna_control_0e_value,
3490 { "Value", "sna.control.0e.value",
3491 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3493 static gint *ett[] = {
3498 &ett_sna_nlp_nhdr_0,
3499 &ett_sna_nlp_nhdr_1,
3501 &ett_sna_nlp_thdr_8,
3502 &ett_sna_nlp_thdr_9,
3503 &ett_sna_nlp_opti_un,
3504 &ett_sna_nlp_opti_0d,
3505 &ett_sna_nlp_opti_0d_4,
3506 &ett_sna_nlp_opti_0e,
3507 &ett_sna_nlp_opti_0e_stat,
3508 &ett_sna_nlp_opti_0e_absp,
3509 &ett_sna_nlp_opti_0f,
3510 &ett_sna_nlp_opti_10,
3511 &ett_sna_nlp_opti_12,
3512 &ett_sna_nlp_opti_14,
3513 &ett_sna_nlp_opti_14_si,
3514 &ett_sna_nlp_opti_14_si_2,
3515 &ett_sna_nlp_opti_14_rr,
3516 &ett_sna_nlp_opti_14_rr_2,
3517 &ett_sna_nlp_opti_22,
3518 &ett_sna_nlp_opti_22_2,
3519 &ett_sna_nlp_opti_22_3,
3532 &ett_sna_control_un,
3533 &ett_sna_control_05,
3534 &ett_sna_control_05hpr,
3535 &ett_sna_control_05hpr_type,
3536 &ett_sna_control_0e,
3538 module_t *sna_module;
3540 proto_sna = proto_register_protocol("Systems Network Architecture",
3542 proto_register_field_array(proto_sna, hf, array_length(hf));
3543 proto_register_subtree_array(ett, array_length(ett));
3544 register_dissector("sna", dissect_sna, proto_sna);
3546 proto_sna_xid = proto_register_protocol(
3547 "Systems Network Architecture XID", "SNA XID", "sna_xid");
3548 register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3550 /* Register configuration options */
3551 sna_module = prefs_register_protocol(proto_sna, NULL);
3552 prefs_register_bool_preference(sna_module, "defragment",
3553 "Reassemble fragmented BIUs",
3554 "Whether fragmented BIUs should be reassembled",
3557 register_init_routine(sna_init);
3561 proto_reg_handoff_sna(void)
3563 dissector_handle_t sna_handle;
3564 dissector_handle_t sna_xid_handle;
3566 sna_handle = find_dissector("sna");
3567 sna_xid_handle = find_dissector("sna_xid");
3568 dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3569 dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3570 dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3571 dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3572 dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3573 dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3574 dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3575 dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3577 dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3578 data_handle = find_dissector("data");