3 * Gilbert Ramirez <gram@alumni.rice.edu>
4 * Jochen Friedrich <jochen@scram.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <epan/packet.h>
29 #include <epan/llcsaps.h>
30 #include <epan/ppptypes.h>
31 #include <epan/sna-utils.h>
32 #include <epan/prefs.h>
33 #include <epan/reassemble.h>
36 * http://www.wanresources.com/snacell.html
37 * ftp://ftp.software.ibm.com/networking/pub/standards/aiw/formats/
40 void proto_register_sna(void);
41 void proto_reg_handoff_sna(void);
43 static int proto_sna = -1;
44 static int proto_sna_xid = -1;
45 static int hf_sna_th = -1;
46 static int hf_sna_th_0 = -1;
47 static int hf_sna_th_fid = -1;
48 static int hf_sna_th_mpf = -1;
49 static int hf_sna_th_odai = -1;
50 static int hf_sna_th_efi = -1;
51 static int hf_sna_th_daf = -1;
52 static int hf_sna_th_oaf = -1;
53 static int hf_sna_th_snf = -1;
54 static int hf_sna_th_dcf = -1;
55 static int hf_sna_th_lsid = -1;
56 static int hf_sna_th_tg_sweep = -1;
57 static int hf_sna_th_er_vr_supp_ind = -1;
58 static int hf_sna_th_vr_pac_cnt_ind = -1;
59 static int hf_sna_th_ntwk_prty = -1;
60 static int hf_sna_th_tgsf = -1;
61 static int hf_sna_th_mft = -1;
62 static int hf_sna_th_piubf = -1;
63 static int hf_sna_th_iern = -1;
64 static int hf_sna_th_nlpoi = -1;
65 static int hf_sna_th_nlp_cp = -1;
66 static int hf_sna_th_ern = -1;
67 static int hf_sna_th_vrn = -1;
68 static int hf_sna_th_tpf = -1;
69 static int hf_sna_th_vr_cwi = -1;
70 static int hf_sna_th_tg_nonfifo_ind = -1;
71 static int hf_sna_th_vr_sqti = -1;
72 static int hf_sna_th_tg_snf = -1;
73 static int hf_sna_th_vrprq = -1;
74 static int hf_sna_th_vrprs = -1;
75 static int hf_sna_th_vr_cwri = -1;
76 static int hf_sna_th_vr_rwi = -1;
77 static int hf_sna_th_vr_snf_send = -1;
78 static int hf_sna_th_dsaf = -1;
79 static int hf_sna_th_osaf = -1;
80 static int hf_sna_th_snai = -1;
81 static int hf_sna_th_def = -1;
82 static int hf_sna_th_oef = -1;
83 static int hf_sna_th_sa = -1;
84 static int hf_sna_th_cmd_fmt = -1;
85 static int hf_sna_th_cmd_type = -1;
86 static int hf_sna_th_cmd_sn = -1;
88 static int hf_sna_nlp_nhdr = -1;
89 static int hf_sna_nlp_nhdr_0 = -1;
90 static int hf_sna_nlp_sm = -1;
91 static int hf_sna_nlp_tpf = -1;
92 static int hf_sna_nlp_nhdr_1 = -1;
93 static int hf_sna_nlp_ft = -1;
94 static int hf_sna_nlp_tspi = -1;
95 static int hf_sna_nlp_slowdn1 = -1;
96 static int hf_sna_nlp_slowdn2 = -1;
97 static int hf_sna_nlp_fra = -1;
98 static int hf_sna_nlp_anr = -1;
99 static int hf_sna_nlp_frh = -1;
100 static int hf_sna_nlp_thdr = -1;
101 static int hf_sna_nlp_tcid = -1;
102 static int hf_sna_nlp_thdr_8 = -1;
103 static int hf_sna_nlp_setupi = -1;
104 static int hf_sna_nlp_somi = -1;
105 static int hf_sna_nlp_eomi = -1;
106 static int hf_sna_nlp_sri = -1;
107 static int hf_sna_nlp_rasapi = -1;
108 static int hf_sna_nlp_retryi = -1;
109 static int hf_sna_nlp_thdr_9 = -1;
110 static int hf_sna_nlp_lmi = -1;
111 static int hf_sna_nlp_cqfi = -1;
112 static int hf_sna_nlp_osi = -1;
113 static int hf_sna_nlp_offset = -1;
114 static int hf_sna_nlp_dlf = -1;
115 static int hf_sna_nlp_bsn = -1;
116 static int hf_sna_nlp_opti_len = -1;
117 static int hf_sna_nlp_opti_type = -1;
118 static int hf_sna_nlp_opti_0d_version = -1;
119 static int hf_sna_nlp_opti_0d_4 = -1;
120 static int hf_sna_nlp_opti_0d_target = -1;
121 static int hf_sna_nlp_opti_0d_arb = -1;
122 static int hf_sna_nlp_opti_0d_reliable = -1;
123 static int hf_sna_nlp_opti_0d_dedicated = -1;
124 static int hf_sna_nlp_opti_0e_stat = -1;
125 static int hf_sna_nlp_opti_0e_gap = -1;
126 static int hf_sna_nlp_opti_0e_idle = -1;
127 static int hf_sna_nlp_opti_0e_nabsp = -1;
128 static int hf_sna_nlp_opti_0e_sync = -1;
129 static int hf_sna_nlp_opti_0e_echo = -1;
130 static int hf_sna_nlp_opti_0e_rseq = -1;
131 /* static int hf_sna_nlp_opti_0e_abspbeg = -1; */
132 /* static int hf_sna_nlp_opti_0e_abspend = -1; */
133 static int hf_sna_nlp_opti_0f_bits = -1;
134 static int hf_sna_nlp_opti_10_tcid = -1;
135 static int hf_sna_nlp_opti_12_sense = -1;
136 static int hf_sna_nlp_opti_14_si_len = -1;
137 static int hf_sna_nlp_opti_14_si_key = -1;
138 static int hf_sna_nlp_opti_14_si_2 = -1;
139 static int hf_sna_nlp_opti_14_si_refifo = -1;
140 static int hf_sna_nlp_opti_14_si_mobility = -1;
141 static int hf_sna_nlp_opti_14_si_dirsearch = -1;
142 static int hf_sna_nlp_opti_14_si_limitres = -1;
143 static int hf_sna_nlp_opti_14_si_ncescope = -1;
144 static int hf_sna_nlp_opti_14_si_mnpsrscv = -1;
145 static int hf_sna_nlp_opti_14_si_maxpsize = -1;
146 static int hf_sna_nlp_opti_14_si_switch = -1;
147 static int hf_sna_nlp_opti_14_si_alive = -1;
148 static int hf_sna_nlp_opti_14_rr_len = -1;
149 static int hf_sna_nlp_opti_14_rr_key = -1;
150 static int hf_sna_nlp_opti_14_rr_2 = -1;
151 static int hf_sna_nlp_opti_14_rr_bfe = -1;
152 static int hf_sna_nlp_opti_14_rr_num = -1;
153 static int hf_sna_nlp_opti_22_2 = -1;
154 static int hf_sna_nlp_opti_22_type = -1;
155 static int hf_sna_nlp_opti_22_raa = -1;
156 static int hf_sna_nlp_opti_22_parity = -1;
157 static int hf_sna_nlp_opti_22_arb = -1;
158 static int hf_sna_nlp_opti_22_3 = -1;
159 static int hf_sna_nlp_opti_22_ratereq = -1;
160 static int hf_sna_nlp_opti_22_raterep = -1;
161 static int hf_sna_nlp_opti_22_field1 = -1;
162 static int hf_sna_nlp_opti_22_field2 = -1;
163 static int hf_sna_nlp_opti_22_field3 = -1;
164 static int hf_sna_nlp_opti_22_field4 = -1;
166 static int hf_sna_rh = -1;
167 static int hf_sna_rh_0 = -1;
168 static int hf_sna_rh_1 = -1;
169 static int hf_sna_rh_2 = -1;
170 static int hf_sna_rh_rri = -1;
171 static int hf_sna_rh_ru_category = -1;
172 static int hf_sna_rh_fi = -1;
173 static int hf_sna_rh_sdi = -1;
174 static int hf_sna_rh_bci = -1;
175 static int hf_sna_rh_eci = -1;
176 static int hf_sna_rh_dr1 = -1;
177 static int hf_sna_rh_lcci = -1;
178 static int hf_sna_rh_dr2 = -1;
179 static int hf_sna_rh_eri = -1;
180 static int hf_sna_rh_rti = -1;
181 static int hf_sna_rh_rlwi = -1;
182 static int hf_sna_rh_qri = -1;
183 static int hf_sna_rh_pi = -1;
184 static int hf_sna_rh_bbi = -1;
185 static int hf_sna_rh_ebi = -1;
186 static int hf_sna_rh_cdi = -1;
187 static int hf_sna_rh_csi = -1;
188 static int hf_sna_rh_edi = -1;
189 static int hf_sna_rh_pdi = -1;
190 static int hf_sna_rh_cebi = -1;
191 /*static int hf_sna_ru = -1;*/
193 static int hf_sna_gds = -1;
194 static int hf_sna_gds_len = -1;
195 static int hf_sna_gds_type = -1;
196 static int hf_sna_gds_cont = -1;
198 /* static int hf_sna_xid = -1; */
199 static int hf_sna_xid_0 = -1;
200 static int hf_sna_xid_id = -1;
201 static int hf_sna_xid_format = -1;
202 static int hf_sna_xid_type = -1;
203 static int hf_sna_xid_len = -1;
204 static int hf_sna_xid_idblock = -1;
205 static int hf_sna_xid_idnum = -1;
206 static int hf_sna_xid_3_8 = -1;
207 static int hf_sna_xid_3_init_self = -1;
208 static int hf_sna_xid_3_stand_bind = -1;
209 static int hf_sna_xid_3_gener_bind = -1;
210 static int hf_sna_xid_3_recve_bind = -1;
211 static int hf_sna_xid_3_actpu = -1;
212 static int hf_sna_xid_3_nwnode = -1;
213 static int hf_sna_xid_3_cp = -1;
214 static int hf_sna_xid_3_cpcp = -1;
215 static int hf_sna_xid_3_state = -1;
216 static int hf_sna_xid_3_nonact = -1;
217 static int hf_sna_xid_3_cpchange = -1;
218 static int hf_sna_xid_3_10 = -1;
219 static int hf_sna_xid_3_asend_bind = -1;
220 static int hf_sna_xid_3_arecv_bind = -1;
221 static int hf_sna_xid_3_quiesce = -1;
222 static int hf_sna_xid_3_pucap = -1;
223 static int hf_sna_xid_3_pbn = -1;
224 static int hf_sna_xid_3_pacing = -1;
225 static int hf_sna_xid_3_11 = -1;
226 static int hf_sna_xid_3_tgshare = -1;
227 static int hf_sna_xid_3_dedsvc = -1;
228 static int hf_sna_xid_3_12 = -1;
229 static int hf_sna_xid_3_negcsup = -1;
230 static int hf_sna_xid_3_negcomp = -1;
231 static int hf_sna_xid_3_15 = -1;
232 static int hf_sna_xid_3_partg = -1;
233 static int hf_sna_xid_3_dlur = -1;
234 static int hf_sna_xid_3_dlus = -1;
235 static int hf_sna_xid_3_exbn = -1;
236 static int hf_sna_xid_3_genodai = -1;
237 static int hf_sna_xid_3_branch = -1;
238 static int hf_sna_xid_3_brnn = -1;
239 static int hf_sna_xid_3_tg = -1;
240 static int hf_sna_xid_3_dlc = -1;
241 static int hf_sna_xid_3_dlen = -1;
243 static int hf_sna_control_len = -1;
244 static int hf_sna_control_key = -1;
245 static int hf_sna_control_hprkey = -1;
246 static int hf_sna_control_05_delay = -1;
247 static int hf_sna_control_05_type = -1;
248 static int hf_sna_control_05_ptp = -1;
249 static int hf_sna_control_0e_type = -1;
250 static int hf_sna_control_0e_value = -1;
252 static gint ett_sna = -1;
253 static gint ett_sna_th = -1;
254 static gint ett_sna_th_fid = -1;
255 static gint ett_sna_nlp_nhdr = -1;
256 static gint ett_sna_nlp_nhdr_0 = -1;
257 static gint ett_sna_nlp_nhdr_1 = -1;
258 static gint ett_sna_nlp_thdr = -1;
259 static gint ett_sna_nlp_thdr_8 = -1;
260 static gint ett_sna_nlp_thdr_9 = -1;
261 static gint ett_sna_nlp_opti_un = -1;
262 static gint ett_sna_nlp_opti_0d = -1;
263 static gint ett_sna_nlp_opti_0d_4 = -1;
264 static gint ett_sna_nlp_opti_0e = -1;
265 static gint ett_sna_nlp_opti_0e_stat = -1;
266 static gint ett_sna_nlp_opti_0e_absp = -1;
267 static gint ett_sna_nlp_opti_0f = -1;
268 static gint ett_sna_nlp_opti_10 = -1;
269 static gint ett_sna_nlp_opti_12 = -1;
270 static gint ett_sna_nlp_opti_14 = -1;
271 static gint ett_sna_nlp_opti_14_si = -1;
272 static gint ett_sna_nlp_opti_14_si_2 = -1;
273 static gint ett_sna_nlp_opti_14_rr = -1;
274 static gint ett_sna_nlp_opti_14_rr_2 = -1;
275 static gint ett_sna_nlp_opti_22 = -1;
276 static gint ett_sna_nlp_opti_22_2 = -1;
277 static gint ett_sna_nlp_opti_22_3 = -1;
278 static gint ett_sna_rh = -1;
279 static gint ett_sna_rh_0 = -1;
280 static gint ett_sna_rh_1 = -1;
281 static gint ett_sna_rh_2 = -1;
282 static gint ett_sna_gds = -1;
283 static gint ett_sna_xid_0 = -1;
284 static gint ett_sna_xid_id = -1;
285 static gint ett_sna_xid_3_8 = -1;
286 static gint ett_sna_xid_3_10 = -1;
287 static gint ett_sna_xid_3_11 = -1;
288 static gint ett_sna_xid_3_12 = -1;
289 static gint ett_sna_xid_3_15 = -1;
290 static gint ett_sna_control_un = -1;
291 static gint ett_sna_control_05 = -1;
292 static gint ett_sna_control_05hpr = -1;
293 static gint ett_sna_control_05hpr_type = -1;
294 static gint ett_sna_control_0e = -1;
296 static dissector_handle_t data_handle;
298 /* Defragment fragmented SNA BIUs*/
299 static gboolean sna_defragment = TRUE;
300 static reassembly_table sna_reassembly_table;
302 /* Format Identifier */
303 static const value_string sna_th_fid_vals[] = {
304 { 0x0, "SNA device <--> Non-SNA Device" },
305 { 0x1, "Subarea Nodes, without ER or VR" },
306 { 0x2, "Subarea Node <--> PU2" },
307 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
308 { 0x4, "Subarea Nodes, supporting ER and VR" },
309 { 0x5, "HPR RTP endpoint nodes" },
310 { 0xa, "HPR NLP Frame Routing" },
311 { 0xb, "HPR NLP Frame Routing" },
312 { 0xc, "HPR NLP Automatic Network Routing" },
313 { 0xd, "HPR NLP Automatic Network Routing" },
314 { 0xf, "Adjacent Subarea Nodes, supporting ER and VR" },
319 #define MPF_MIDDLE_SEGMENT 0
320 #define MPF_LAST_SEGMENT 1
321 #define MPF_FIRST_SEGMENT 2
322 #define MPF_WHOLE_BIU 3
324 static const value_string sna_th_mpf_vals[] = {
325 { MPF_MIDDLE_SEGMENT, "Middle segment of a BIU" },
326 { MPF_LAST_SEGMENT, "Last segment of a BIU" },
327 { MPF_FIRST_SEGMENT, "First segment of a BIU" },
328 { MPF_WHOLE_BIU, "Whole BIU" },
332 /* Expedited Flow Indicator */
333 static const value_string sna_th_efi_vals[] = {
334 { 0, "Normal Flow" },
335 { 1, "Expedited Flow" },
339 /* Request/Response Indicator */
340 static const value_string sna_rh_rri_vals[] = {
346 /* Request/Response Unit Category */
347 static const value_string sna_rh_ru_category_vals[] = {
348 { 0, "Function Management Data (FMD)" },
349 { 1, "Network Control (NC)" },
350 { 2, "Data Flow Control (DFC)" },
351 { 3, "Session Control (SC)" },
355 /* Format Indicator */
356 static const true_false_string sna_rh_fi_truth =
357 { "FM Header", "No FM Header" };
359 /* Sense Data Included */
360 static const true_false_string sna_rh_sdi_truth =
361 { "Included", "Not Included" };
363 /* Begin Chain Indicator */
364 static const true_false_string sna_rh_bci_truth =
365 { "First in Chain", "Not First in Chain" };
367 /* End Chain Indicator */
368 static const true_false_string sna_rh_eci_truth =
369 { "Last in Chain", "Not Last in Chain" };
371 /* Lengith-Checked Compression Indicator */
372 static const true_false_string sna_rh_lcci_truth =
373 { "Compressed", "Not Compressed" };
375 /* Response Type Indicator */
376 static const true_false_string sna_rh_rti_truth =
377 { "Negative", "Positive" };
379 /* Queued Response Indicator */
380 static const true_false_string sna_rh_qri_truth =
381 { "Enqueue response in TC queues", "Response bypasses TC queues" };
383 /* Code Selection Indicator */
384 static const value_string sna_rh_csi_vals[] = {
391 static const value_string sna_th_tg_sweep_vals[] = {
392 { 0, "This PIU may overtake any PU ahead of it." },
393 { 1, "This PIU does not overtake any PIU ahead of it." },
398 static const value_string sna_th_er_vr_supp_ind_vals[] = {
399 { 0, "Each node supports ER and VR protocols" },
400 { 1, "Includes at least one node that does not support ER and VR"
406 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
407 { 0, "Pacing count on the VR has not reached 0" },
408 { 1, "Pacing count on the VR has reached 0" },
413 static const value_string sna_th_ntwk_prty_vals[] = {
414 { 0, "PIU flows at a lower priority" },
415 { 1, "PIU flows at network priority (highest transmission priority)" },
420 static const value_string sna_th_tgsf_vals[] = {
421 { 0, "Not segmented" },
422 { 1, "Last segment" },
423 { 2, "First segment" },
424 { 3, "Middle segment" },
429 static const value_string sna_th_piubf_vals[] = {
430 { 0, "Single PIU frame" },
431 { 1, "Last PIU of a multiple PIU frame" },
432 { 2, "First PIU of a multiple PIU frame" },
433 { 3, "Middle PIU of a multiple PIU frame" },
438 static const value_string sna_th_nlpoi_vals[] = {
439 { 0, "NLP starts within this FID4 TH" },
440 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
445 static const value_string sna_th_tpf_vals[] = {
446 { 0, "Low Priority" },
447 { 1, "Medium Priority" },
448 { 2, "High Priority" },
449 { 3, "Network Priority" },
454 static const value_string sna_th_vr_cwi_vals[] = {
455 { 0, "Increment window size" },
456 { 1, "Decrement window size" },
461 static const true_false_string sna_th_tg_nonfifo_ind_truth =
462 { "TG FIFO is not required", "TG FIFO is required" };
465 static const value_string sna_th_vr_sqti_vals[] = {
466 { 0, "Non-sequenced, Non-supervisory" },
467 { 1, "Non-sequenced, Supervisory" },
468 { 2, "Singly-sequenced" },
473 static const true_false_string sna_th_vrprq_truth = {
474 "VR pacing request is sent asking for a VR pacing response",
475 "No VR pacing response is requested",
479 static const true_false_string sna_th_vrprs_truth = {
480 "VR pacing response is sent in response to a VRPRQ bit set",
481 "No pacing response sent",
485 static const value_string sna_th_vr_cwri_vals[] = {
486 { 0, "Increment window size by 1" },
487 { 1, "Decrement window size by 1" },
492 static const true_false_string sna_th_vr_rwi_truth = {
493 "Reset window size to the minimum specified in NC_ACTVR",
494 "Do not reset window size",
498 static const value_string sna_nlp_sm_vals[] = {
499 { 5, "Function routing" },
500 { 6, "Automatic network routing" },
504 static const true_false_string sna_nlp_tspi_truth =
505 { "Time sensitive", "Not time sensitive" };
507 static const true_false_string sna_nlp_slowdn1_truth =
508 { "Minor congestion", "No minor congestion" };
510 static const true_false_string sna_nlp_slowdn2_truth =
511 { "Major congestion", "No major congestion" };
514 static const value_string sna_nlp_ft_vals[] = {
519 static const value_string sna_nlp_frh_vals[] = {
520 { 0x03, "XID complete request" },
521 { 0x04, "XID complete response" },
525 static const true_false_string sna_nlp_setupi_truth =
526 { "Connection setup segment present", "Connection setup segment not"
529 static const true_false_string sna_nlp_somi_truth =
530 { "Start of message", "Not start of message" };
532 static const true_false_string sna_nlp_eomi_truth =
533 { "End of message", "Not end of message" };
535 static const true_false_string sna_nlp_sri_truth =
536 { "Status requested", "No status requested" };
538 static const true_false_string sna_nlp_rasapi_truth =
539 { "Reply as soon as possible", "No need to reply as soon as possible" };
541 static const true_false_string sna_nlp_retryi_truth =
542 { "Undefined", "Sender will retransmit" };
544 static const true_false_string sna_nlp_lmi_truth =
545 { "Last message", "Not last message" };
547 static const true_false_string sna_nlp_cqfi_truth =
548 { "CQFI included", "CQFI not included" };
550 static const true_false_string sna_nlp_osi_truth =
551 { "Optional segments present", "No optional segments present" };
553 static const value_string sna_xid_3_state_vals[] = {
554 { 0x00, "Exchange state indicators not supported" },
555 { 0x01, "Negotiation-proceeding exchange" },
556 { 0x02, "Prenegotiation exchange" },
557 { 0x03, "Nonactivation exchange" },
561 static const value_string sna_xid_3_branch_vals[] = {
562 { 0x00, "Sender does not support branch extender" },
563 { 0x01, "TG is branch uplink" },
564 { 0x02, "TG is branch downlink" },
565 { 0x03, "TG is neither uplink nor downlink" },
569 static const value_string sna_xid_type_vals[] = {
571 { 0x02, "T2.0 or T2.1 node" },
572 { 0x03, "Reserved" },
573 { 0x04, "T4 or T5 node" },
577 static const value_string sna_nlp_opti_vals[] = {
578 { 0x0d, "Connection Setup Segment" },
579 { 0x0e, "Status Segment" },
580 { 0x0f, "Client Out Of Band Bits Segment" },
581 { 0x10, "Connection Identifier Exchange Segment" },
582 { 0x12, "Connection Fault Segment" },
583 { 0x14, "Switching Information Segment" },
584 { 0x22, "Adaptive Rate-Based Segment" },
588 static const value_string sna_nlp_opti_0d_version_vals[] = {
589 { 0x0101, "Version 1.1" },
593 static const value_string sna_nlp_opti_0f_bits_vals[] = {
594 { 0x0001, "Request Deactivation" },
595 { 0x8000, "Reply - OK" },
596 { 0x8004, "Reply - Reject" },
600 static const value_string sna_nlp_opti_22_type_vals[] = {
602 { 0x01, "Rate Reply" },
603 { 0x02, "Rate Request" },
604 { 0x03, "Rate Request/Rate Reply" },
608 static const value_string sna_nlp_opti_22_raa_vals[] = {
610 { 0x01, "Restraint" },
611 { 0x02, "Slowdown1" },
612 { 0x03, "Slowdown2" },
613 { 0x04, "Critical" },
617 static const value_string sna_nlp_opti_22_arb_vals[] = {
618 { 0x00, "Base Mode ARB" },
619 { 0x01, "Responsive Mode ARB" },
623 /* GDS Variable Type */
624 static const value_string sna_gds_var_vals[] = {
625 { 0x1210, "Change Number Of Sessions" },
626 { 0x1211, "Exchange Log Name" },
627 { 0x1212, "Control Point Management Services Unit" },
628 { 0x1213, "Compare States" },
629 { 0x1214, "LU Names Position" },
630 { 0x1215, "LU Name" },
631 { 0x1217, "Do Know" },
632 { 0x1218, "Partner Restart" },
633 { 0x1219, "Don't Know" },
634 { 0x1220, "Sign-Off" },
635 { 0x1221, "Sign-On" },
636 { 0x1222, "SNMP-over-SNA" },
637 { 0x1223, "Node Address Service" },
638 { 0x12C1, "CP Capabilities" },
639 { 0x12C2, "Topology Database Update" },
640 { 0x12C3, "Register Resource" },
641 { 0x12C4, "Locate" },
642 { 0x12C5, "Cross-Domain Initiate" },
643 { 0x12C9, "Delete Resource" },
644 { 0x12CA, "Find Resource" },
645 { 0x12CB, "Found Resource" },
646 { 0x12CC, "Notify" },
647 { 0x12CD, "Initiate-Other Cross-Domain" },
648 { 0x12CE, "Route Setup" },
649 { 0x12E1, "Error Log" },
650 { 0x12F1, "Null Data" },
651 { 0x12F2, "User Control Date" },
652 { 0x12F3, "Map Name" },
653 { 0x12F4, "Error Data" },
654 { 0x12F6, "Authentication Token Data" },
655 { 0x12F8, "Service Flow Authentication Token Data" },
656 { 0x12FF, "Application Data" },
657 { 0x1310, "MDS Message Unit" },
658 { 0x1311, "MDS Routing Information" },
659 { 0x1500, "FID2 Encapsulation" },
663 /* Control Vector Type */
664 static const value_string sna_control_vals[] = {
665 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
666 { 0x01, "Date-Time Control Vector" },
667 { 0x02, "Subarea Routing Control Vector" },
668 { 0x03, "SDLC Secondary Station Control Vector" },
669 { 0x04, "LU Control Vector" },
670 { 0x05, "Channel Control Vector" },
671 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
672 { 0x07, "PU FMD-RU-Usage Control Vector" },
673 { 0x08, "Intensive Mode Control Vector" },
674 { 0x09, "Activation Request / Response Sequence Identifier Control"
676 { 0x0a, "User Request Correlator Control Vector" },
677 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
678 { 0x0c, "LU-LU Session Capabilities Control Vector" },
679 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
681 { 0x0e, "Network Name Control Vector" },
682 { 0x0f, "Link Capabilities and Status Control Vector" },
683 { 0x10, "Product Set ID Control Vector" },
684 { 0x11, "Load Module Correlation Control Vector" },
685 { 0x12, "Network Identifier Control Vector" },
686 { 0x13, "Gateway Support Capabilities Control Vector" },
687 { 0x14, "Session Initiation Control Vector" },
688 { 0x15, "Network-Qualified Address Pair Control Vector" },
689 { 0x16, "Names Substitution Control Vector" },
690 { 0x17, "SSCP Identifier Control Vector" },
691 { 0x18, "SSCP Name Control Vector" },
692 { 0x19, "Resource Identifier Control Vector" },
693 { 0x1a, "NAU Address Control Vector" },
694 { 0x1b, "VRID List Control Vector" },
695 { 0x1c, "Network-Qualified Name Pair Control Vector" },
696 { 0x1e, "VR-ER Mapping Data Control Vector" },
697 { 0x1f, "ER Configuration Control Vector" },
698 { 0x23, "Local-Form Session Identifier Control Vector" },
699 { 0x24, "IPL Load Module Request Control Vector" },
700 { 0x25, "Security ID Control Control Vector" },
701 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
702 { 0x27, "XRF Session Activation Control Vector" },
703 { 0x28, "Related Session Identifier Control Vector" },
704 { 0x29, "Session State Data Control Vector" },
705 { 0x2a, "Session Information Control Vector" },
706 { 0x2b, "Route Selection Control Vector" },
707 { 0x2c, "COS/TPF Control Vector" },
708 { 0x2d, "Mode Control Vector" },
709 { 0x2f, "LU Definition Control Vector" },
710 { 0x30, "Assign LU Characteristics Control Vector" },
711 { 0x31, "BIND Image Control Vector" },
712 { 0x32, "Short-Hold Mode Control Vector" },
713 { 0x33, "ENCP Search Control Control Vector" },
714 { 0x34, "LU Definition Override Control Vector" },
715 { 0x35, "Extended Sense Data Control Vector" },
716 { 0x36, "Directory Error Control Vector" },
717 { 0x37, "Directory Entry Correlator Control Vector" },
718 { 0x38, "Short-Hold Mode Emulation Control Vector" },
719 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
721 { 0x3a, "Route Status Data Control Vector" },
722 { 0x3b, "VR Congestion Data Control Vector" },
723 { 0x3c, "Associated Resource Entry Control Vector" },
724 { 0x3d, "Directory Entry Control Vector" },
725 { 0x3e, "Directory Entry Characteristic Control Vector" },
726 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
727 { 0x40, "Real Associated Resource Control Vector" },
728 { 0x41, "Station Parameters Control Vector" },
729 { 0x42, "Dynamic Path Update Data Control Vector" },
730 { 0x43, "Extended SDLC Station Control Vector" },
731 { 0x44, "Node Descriptor Control Vector" },
732 { 0x45, "Node Characteristics Control Vector" },
733 { 0x46, "TG Descriptor Control Vector" },
734 { 0x47, "TG Characteristics Control Vector" },
735 { 0x48, "Topology Resource Descriptor Control Vector" },
736 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
738 { 0x4a, "Real Owning Control Point Control Vector" },
739 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
740 { 0x51, "DLUR/S Capabilities Control Vector" },
741 { 0x52, "Primary Send Pacing Window Size Control Vector" },
742 { 0x56, "Call Security Verification Control Vector" },
743 { 0x57, "DLC Connection Data Control Vector" },
744 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
745 { 0x5a, "Session Services Extension Support Control Vector" },
746 { 0x5b, "Interchange Node Support Control Vector" },
747 { 0x5c, "APPN Message Transport Control Vector" },
748 { 0x5d, "Subarea Message Transport Control Vector" },
749 { 0x5e, "Related Request Control Vector" },
750 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
751 { 0x60, "Fully Qualified PCID Control Vector" },
752 { 0x61, "HPR Capabilities Control Vector" },
753 { 0x62, "Session Address Control Vector" },
754 { 0x63, "Cryptographic Key Distribution Control Vector" },
755 { 0x64, "TCP/IP Information Control Vector" },
756 { 0x65, "Device Characteristics Control Vector" },
757 { 0x66, "Length-Checked Compression Control Vector" },
758 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
759 { 0x68, "XRF/Session Cryptography Control Vector" },
760 { 0x69, "Switched Parameters Control Vector" },
761 { 0x6a, "ER Congestion Data Control Vector" },
762 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
763 { 0xfe, "Control Vector Keys Not Recognized" },
767 static const value_string sna_control_hpr_vals[] = {
768 { 0x00, "Node Identifier Control Vector" },
769 { 0x03, "Network ID Control Vector" },
770 { 0x05, "Network Address Control Vector" },
774 static const value_string sna_control_0e_type_vals[] = {
778 { 0xF5, "SSCP Name" },
779 { 0xF6, "NNCP Name" },
780 { 0xF7, "Link Station Name" },
781 { 0xF8, "CP Name of CP(PLU)" },
782 { 0xF9, "CP Name of CP(SLU)" },
783 { 0xFA, "Generic Name" },
787 /* Values to direct the top-most dissector what to dissect
789 enum next_dissection_enum {
800 typedef enum next_dissection_enum next_dissection_t;
802 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
803 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
804 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
805 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
806 static void dissect_rh (tvbuff_t*, int, proto_tree*);
807 static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
809 /* --------------------------------------------------------------------
810 * Chapter 2 High-Performance Routing (HPR) Headers
811 * --------------------------------------------------------------------
815 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
817 int bits, offset, len, pad;
818 proto_tree *sub_tree;
819 proto_item *sub_ti = NULL;
824 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
825 bits = tvb_get_guint8(tvb, 4);
827 sub_ti = proto_tree_add_uint(tree, hf_sna_nlp_opti_0d_4,
829 sub_tree = proto_item_add_subtree(sub_ti,
830 ett_sna_nlp_opti_0d_4);
832 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_target,
834 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_arb,
836 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_reliable,
838 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_dedicated,
841 proto_tree_add_text(tree, tvb, 5, 3, "Reserved");
845 while (tvb_offset_exists(tvb, offset)) {
846 len = tvb_get_guint8(tvb, offset+0);
848 dissect_control(tvb, offset, len, tree, 1, LT);
849 pad = (len+3) & 0xfffc;
851 proto_tree_add_text(tree, tvb, offset+len,
855 /* Avoid endless loop */
862 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
865 proto_tree *sub_tree;
866 proto_item *sub_ti = NULL;
868 bits = tvb_get_guint8(tvb, 2);
872 sub_ti = proto_tree_add_item(tree, hf_sna_nlp_opti_0e_stat,
873 tvb, 2, 1, ENC_BIG_ENDIAN);
874 sub_tree = proto_item_add_subtree(sub_ti,
875 ett_sna_nlp_opti_0e_stat);
877 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_gap,
879 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_idle,
881 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
882 tvb, 3, 1, ENC_BIG_ENDIAN);
883 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
884 tvb, 4, 2, ENC_BIG_ENDIAN);
885 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
886 tvb, 6, 2, ENC_BIG_ENDIAN);
887 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
888 tvb, 8, 4, ENC_BIG_ENDIAN);
889 proto_tree_add_text(tree, tvb, 12, 8, "Reserved");
891 if (tvb_offset_exists(tvb, offset))
892 call_dissector(data_handle,
893 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
896 col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
898 col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
903 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
908 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
909 if (tvb_offset_exists(tvb, 4))
910 call_dissector(data_handle,
911 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
915 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
920 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
921 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
922 if (tvb_offset_exists(tvb, 12))
923 call_dissector(data_handle,
924 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
928 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
933 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
934 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
938 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
940 proto_tree *sub_tree, *bf_tree;
942 int len, pad, type, bits, offset, num, sublen;
947 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
951 len = tvb_get_guint8(tvb, offset);
952 type = tvb_get_guint8(tvb, offset+1);
954 if ((type != 0x83) || (len <= 16)) {
956 call_dissector(data_handle,
957 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
960 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
961 ett_sna_nlp_opti_14_si, NULL, "Switching Information Control Vector");
963 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
964 tvb, offset, 1, len);
965 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
966 tvb, offset+1, 1, type);
968 bits = tvb_get_guint8(tvb, offset+2);
969 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_2,
970 tvb, offset+2, 1, bits);
971 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_si_2);
973 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_refifo,
974 tvb, offset+2, 1, bits);
975 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mobility,
976 tvb, offset+2, 1, bits);
977 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_dirsearch,
978 tvb, offset+2, 1, bits);
979 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_limitres,
980 tvb, offset+2, 1, bits);
981 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_ncescope,
982 tvb, offset+2, 1, bits);
983 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mnpsrscv,
984 tvb, offset+2, 1, bits);
986 proto_tree_add_text(sub_tree, tvb, offset+3, 1, "Reserved");
987 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
988 tvb, offset+4, 4, ENC_BIG_ENDIAN);
989 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
990 tvb, offset+8, 4, ENC_BIG_ENDIAN);
991 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
992 tvb, offset+12, 4, ENC_BIG_ENDIAN);
994 dissect_control(tvb, offset+16, len-16, sub_tree, 1, LT);
996 pad = (len+3) & 0xfffc;
998 proto_tree_add_text(sub_tree, tvb, offset+len, pad-len,
1002 len = tvb_get_guint8(tvb, offset);
1003 type = tvb_get_guint8(tvb, offset+1);
1005 if ((type != 0x85) || ( len < 4)) {
1007 call_dissector(data_handle,
1008 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1011 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1012 ett_sna_nlp_opti_14_rr, NULL, "Return Route TG Descriptor Control Vector");
1014 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1015 tvb, offset, 1, len);
1016 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1017 tvb, offset+1, 1, type);
1019 bits = tvb_get_guint8(tvb, offset+2);
1020 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_2,
1021 tvb, offset+2, 1, bits);
1022 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_rr_2);
1024 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_rr_bfe,
1025 tvb, offset+2, 1, bits);
1027 num = tvb_get_guint8(tvb, offset+3);
1029 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1030 tvb, offset+3, 1, num);
1035 sublen = tvb_get_guint8(tvb, offset);
1037 dissect_control(tvb, offset, sublen, sub_tree, 1, LT);
1040 call_dissector(data_handle,
1041 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1044 /* No padding here */
1051 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1053 proto_tree *bf_tree;
1054 proto_item *bf_item;
1060 bits = tvb_get_guint8(tvb, 2);
1061 type = (bits & 0xc0) >> 6;
1063 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_2,
1065 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_2);
1067 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_type,
1069 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raa,
1071 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_22_parity,
1073 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_arb,
1076 bits = tvb_get_guint8(tvb, 3);
1078 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_3,
1080 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_3);
1082 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_ratereq,
1084 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raterep,
1087 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1088 tvb, 4, 4, ENC_BIG_ENDIAN);
1089 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1090 tvb, 8, 4, ENC_BIG_ENDIAN);
1093 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1094 tvb, 12, 4, ENC_BIG_ENDIAN);
1095 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1096 tvb, 16, 4, ENC_BIG_ENDIAN);
1098 if (tvb_offset_exists(tvb, 20))
1099 call_dissector(data_handle,
1100 tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1102 if (tvb_offset_exists(tvb, 12))
1103 call_dissector(data_handle,
1104 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1109 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1111 proto_tree *sub_tree;
1112 int offset, type, len;
1119 while (tvb_offset_exists(tvb, offset)) {
1120 len = tvb_get_guint8(tvb, offset);
1121 type = tvb_get_guint8(tvb, offset+1);
1123 /* Prevent loop for invalid crap in packet */
1126 call_dissector(data_handle,
1127 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1131 ett = ett_sna_nlp_opti_un;
1132 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1133 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1134 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1135 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1136 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1137 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1138 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1140 sub_tree = proto_tree_add_subtree(tree, tvb,
1141 offset, len << 2, ett, NULL,
1142 val_to_str(type, sna_nlp_opti_vals,
1143 "Unknown Segment Type"));
1144 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1145 tvb, offset, 1, len);
1146 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1147 tvb, offset+1, 1, type);
1151 dissect_optional_0d(tvb_new_subset(tvb, offset,
1152 len << 2, -1), sub_tree);
1155 dissect_optional_0e(tvb_new_subset(tvb, offset,
1156 len << 2, -1), pinfo, sub_tree);
1159 dissect_optional_0f(tvb_new_subset(tvb, offset,
1160 len << 2, -1), pinfo, sub_tree);
1163 dissect_optional_10(tvb_new_subset(tvb, offset,
1164 len << 2, -1), pinfo, sub_tree);
1167 dissect_optional_12(tvb_new_subset(tvb, offset,
1168 len << 2, -1), sub_tree);
1171 dissect_optional_14(tvb_new_subset(tvb, offset,
1172 len << 2, -1), pinfo, sub_tree);
1175 dissect_optional_22(tvb_new_subset(tvb, offset,
1176 len << 2, -1), pinfo, sub_tree);
1179 call_dissector(data_handle,
1180 tvb_new_subset(tvb, offset,
1181 len << 2, -1), pinfo, sub_tree);
1183 offset += (len << 2);
1188 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1189 proto_tree *parent_tree)
1191 proto_tree *nlp_tree, *bf_tree;
1192 proto_item *nlp_item, *bf_item;
1193 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1194 guint32 thdr_len, thdr_dlf;
1197 int indx = 0, counter = 0;
1202 nhdr_0 = tvb_get_guint8(tvb, indx);
1203 nhdr_1 = tvb_get_guint8(tvb, indx+1);
1205 col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1208 /* Don't bother setting length. We'll set it later after we
1209 * find the lengths of NHDR */
1210 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1212 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1214 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_0, tvb,
1216 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_0);
1218 proto_tree_add_uint(bf_tree, hf_sna_nlp_sm, tvb, indx, 1,
1220 proto_tree_add_uint(bf_tree, hf_sna_nlp_tpf, tvb, indx, 1,
1223 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_1, tvb,
1225 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_1);
1227 proto_tree_add_uint(bf_tree, hf_sna_nlp_ft, tvb,
1229 proto_tree_add_boolean(bf_tree, hf_sna_nlp_tspi, tvb,
1231 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn1, tvb,
1233 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn2, tvb,
1236 /* ANR or FR lists */
1241 if ((nhdr_0 & 0xe0) == 0xa0) {
1243 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1245 } while (nhdr_x != 0xff);
1247 proto_tree_add_item(nlp_tree,
1248 hf_sna_nlp_fra, tvb, indx, counter, ENC_NA);
1251 proto_tree_add_text(nlp_tree, tvb, indx, 1,
1256 proto_item_set_len(nlp_item, indx);
1258 if ((nhdr_1 & 0xf0) == 0x10) {
1259 nhdr_x = tvb_get_guint8(tvb, indx);
1261 proto_tree_add_uint(tree, hf_sna_nlp_frh,
1262 tvb, indx, 1, nhdr_x);
1265 if (tvb_offset_exists(tvb, indx))
1266 call_dissector(data_handle,
1267 tvb_new_subset_remaining(tvb, indx),
1268 pinfo, parent_tree);
1272 if ((nhdr_0 & 0xe0) == 0xc0) {
1274 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1276 } while (nhdr_x != 0xff);
1278 proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1279 tvb, indx, counter, ENC_NA);
1283 proto_tree_add_text(nlp_tree, tvb, indx, 1,
1288 proto_item_set_len(nlp_item, indx);
1291 thdr_8 = tvb_get_guint8(tvb, indx+8);
1292 thdr_9 = tvb_get_guint8(tvb, indx+9);
1293 thdr_len = tvb_get_ntohs(tvb, indx+10);
1294 thdr_dlf = tvb_get_ntohl(tvb, indx+12);
1297 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1298 indx, thdr_len << 2, ENC_NA);
1299 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1301 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1303 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_8, tvb,
1305 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_8);
1307 proto_tree_add_boolean(bf_tree, hf_sna_nlp_setupi, tvb,
1309 proto_tree_add_boolean(bf_tree, hf_sna_nlp_somi, tvb, indx+8,
1311 proto_tree_add_boolean(bf_tree, hf_sna_nlp_eomi, tvb, indx+8,
1313 proto_tree_add_boolean(bf_tree, hf_sna_nlp_sri, tvb, indx+8,
1315 proto_tree_add_boolean(bf_tree, hf_sna_nlp_rasapi, tvb,
1317 proto_tree_add_boolean(bf_tree, hf_sna_nlp_retryi, tvb,
1320 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_9, tvb,
1322 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_9);
1324 proto_tree_add_boolean(bf_tree, hf_sna_nlp_lmi, tvb, indx+9,
1326 proto_tree_add_boolean(bf_tree, hf_sna_nlp_cqfi, tvb, indx+9,
1328 proto_tree_add_boolean(bf_tree, hf_sna_nlp_osi, tvb, indx+9,
1331 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, indx+10,
1333 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, indx+12,
1335 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, indx+16,
1340 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindx)) {
1341 counter = tvb_get_guint8(tvb, indx + subindx);
1342 if (tvb_get_guint8(tvb, indx+subindx+1) == 5)
1343 dissect_control(tvb, indx + subindx, counter+2, nlp_tree, 1, LT);
1345 call_dissector(data_handle,
1346 tvb_new_subset(tvb, indx + subindx, counter+2,
1347 -1), pinfo, nlp_tree);
1349 subindx += (counter+2);
1351 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindx))
1353 tvb_new_subset(tvb, indx + subindx,
1354 (thdr_len << 2) - subindx, -1),
1357 indx += (thdr_len << 2);
1358 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1359 col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1360 if (tvb_offset_exists(tvb, indx)) {
1361 call_dissector(data_handle,
1362 tvb_new_subset_remaining(tvb, indx), pinfo,
1367 if (tvb_offset_exists(tvb, indx)) {
1368 /* Transmission Header Format Identifier */
1369 fid = hi_nibble(tvb_get_guint8(tvb, indx));
1370 if (fid == 5) /* Only FID5 allowed for HPR */
1371 dissect_fid(tvb_new_subset_remaining(tvb, indx), pinfo,
1374 if (tvb_get_ntohs(tvb, indx+2) == 0x12ce) {
1376 col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1377 dissect_gds(tvb_new_subset_remaining(tvb, indx),
1378 pinfo, tree, parent_tree);
1380 call_dissector(data_handle,
1381 tvb_new_subset_remaining(tvb, indx),
1382 pinfo, parent_tree);
1387 /* --------------------------------------------------------------------
1388 * Chapter 3 Exchange Identification (XID) Information Fields
1389 * --------------------------------------------------------------------
1393 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1398 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1403 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1410 dlen = tvb_get_guint8(tvb, 0);
1414 while (tvb_offset_exists(tvb, offset)) {
1415 dlen = tvb_get_guint8(tvb, offset+1);
1416 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1417 offset += (dlen + 2);
1422 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1424 proto_tree *sub_tree;
1425 proto_item *sub_ti = NULL;
1426 guint val, dlen, offset;
1431 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1433 val = tvb_get_ntohs(tvb, 2);
1435 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_8, tvb,
1437 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_8);
1439 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_init_self, tvb, 2, 2,
1441 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_stand_bind, tvb, 2, 2,
1443 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_gener_bind, tvb, 2, 2,
1445 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_recve_bind, tvb, 2, 2,
1447 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_actpu, tvb, 2, 2, val);
1448 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nwnode, tvb, 2, 2, val);
1449 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cp, tvb, 2, 2, val);
1450 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpcp, tvb, 2, 2, val);
1451 proto_tree_add_uint(sub_tree, hf_sna_xid_3_state, tvb, 2, 2, val);
1452 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nonact, tvb, 2, 2, val);
1453 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpchange, tvb, 2, 2,
1456 val = tvb_get_guint8(tvb, 4);
1458 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_10, tvb,
1460 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_10);
1462 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_asend_bind, tvb, 4, 1,
1464 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_arecv_bind, tvb, 4, 1,
1466 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_quiesce, tvb, 4, 1, val);
1467 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pucap, tvb, 4, 1, val);
1468 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pbn, tvb, 4, 1, val);
1469 proto_tree_add_uint(sub_tree, hf_sna_xid_3_pacing, tvb, 4, 1, val);
1471 val = tvb_get_guint8(tvb, 5);
1473 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_11, tvb,
1475 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_11);
1477 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_tgshare, tvb, 5, 1, val);
1478 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dedsvc, tvb, 5, 1, val);
1480 val = tvb_get_guint8(tvb, 6);
1482 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_12, tvb,
1483 6, 1, ENC_BIG_ENDIAN);
1484 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_12);
1486 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcsup, tvb, 6, 1, val);
1487 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcomp, tvb, 6, 1, val);
1489 proto_tree_add_text(tree, tvb, 7, 2, "Reserved");
1491 val = tvb_get_guint8(tvb, 9);
1493 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_15, tvb,
1494 9, 1, ENC_BIG_ENDIAN);
1495 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_15);
1497 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_partg, tvb, 9, 1, val);
1498 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlur, tvb, 9, 1, val);
1499 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlus, tvb, 9, 1, val);
1500 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_exbn, tvb, 9, 1, val);
1501 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_genodai, tvb, 9, 1, val);
1502 proto_tree_add_uint(sub_tree, hf_sna_xid_3_branch, tvb, 9, 1, val);
1503 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_brnn, tvb, 9, 1, val);
1505 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1506 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1508 dlen = tvb_get_guint8(tvb, 12);
1510 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1512 /* FIXME: DLC Dependent Data Go Here */
1516 while (tvb_offset_exists(tvb, offset)) {
1517 dlen = tvb_get_guint8(tvb, offset+1);
1518 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1524 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1525 proto_tree *parent_tree)
1527 proto_tree *sub_tree;
1528 proto_item *sub_ti = NULL;
1529 int format, type, len;
1532 len = tvb_get_guint8(tvb, 1);
1533 type = tvb_get_guint8(tvb, 0);
1534 id = tvb_get_ntohl(tvb, 2);
1535 format = hi_nibble(type);
1537 /* Summary information */
1538 col_add_fstr(pinfo->cinfo, COL_INFO,
1539 "SNA XID Format:%d Type:%s", format,
1540 val_to_str_const(lo_nibble(type), sna_xid_type_vals,
1544 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1545 0, 1, ENC_BIG_ENDIAN);
1546 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1548 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1550 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1553 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1555 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1556 2, 4, ENC_BIG_ENDIAN);
1557 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1559 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1561 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1568 dissect_xid1(tvb_new_subset(tvb, 6, len-6, -1),
1572 dissect_xid2(tvb_new_subset(tvb, 6, len-6, -1),
1576 dissect_xid3(tvb_new_subset(tvb, 6, len-6, -1),
1580 /* external standards organizations */
1581 call_dissector(data_handle,
1582 tvb_new_subset(tvb, 6, len-6, -1),
1590 if (tvb_offset_exists(tvb, len))
1591 call_dissector(data_handle,
1592 tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1595 /* --------------------------------------------------------------------
1596 * Chapter 4 Transmission Headers (THs)
1597 * --------------------------------------------------------------------
1603 mpf_value(guint8 th_byte)
1605 return (th_byte & 0x0c) >> 2;
1608 #define FIRST_FRAG_NUMBER 0
1609 #define MIDDLE_FRAG_NUMBER 1
1610 #define LAST_FRAG_NUMBER 2
1612 /* FID2 is defragged by sequence. The weird thing is that we have neither
1613 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1614 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1615 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1616 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1617 * and 2. However, if the BIU is split into 2 frames, then we only have
1618 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1621 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1622 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1623 * see the FTP URL in the comment near the top of this file). I *think*
1624 * this means that the fragmented frames cannot arrive out of order.
1625 * Well, I *want* it to mean this, because w/o this limitation, if you
1626 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1627 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1628 * arrive in order, then we're saved.
1630 * The problem then boils down to figuring out if "LAST" means frag-number 1
1631 * (in the case of a BIU split into 2 frames) or frag-number 2
1632 * (in the case of a BIU split into 3 frames).
1634 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1635 * way to handle the mapping of "LAST" to either frag-number 1 or
1636 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1637 * This consumes resources. A trickier way, but a way which works, is to
1638 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1639 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1640 * and the reassembly code tells us that the the BIU is still not reassmebled,
1641 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1642 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1643 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1644 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1645 * to complete the reassembly.
1648 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1651 fragment_head *fd_head;
1652 int frag_number = -1;
1653 int more_frags = TRUE;
1654 tvbuff_t *rh_tvb = NULL;
1657 /* Determine frag_number and more_frags */
1662 case MPF_FIRST_SEGMENT:
1663 frag_number = FIRST_FRAG_NUMBER;
1665 case MPF_MIDDLE_SEGMENT:
1666 frag_number = MIDDLE_FRAG_NUMBER;
1668 case MPF_LAST_SEGMENT:
1669 frag_number = LAST_FRAG_NUMBER;
1673 DISSECTOR_ASSERT_NOT_REACHED();
1676 /* If sna_defragment is on, and this is a fragment.. */
1677 if (frag_number > -1) {
1678 /* XXX - check length ??? */
1679 frag_len = tvb_reported_length_remaining(tvb, offset);
1680 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1681 fd_head = fragment_add_seq(&sna_reassembly_table,
1682 tvb, offset, pinfo, id, NULL,
1683 frag_number, frag_len, more_frags, 0);
1685 /* We added the LAST segment and reassembly didn't
1686 * complete. Insert a zero-length MIDDLE segment to
1687 * turn a 2-frame BIU-fragmentation into a 3-frame
1688 * BIU-fragmentation (empty middle frag).
1689 * See above long comment about this trickery. */
1691 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1692 fd_head = fragment_add_seq(&sna_reassembly_table,
1693 tvb, offset, pinfo, id, NULL,
1694 MIDDLE_FRAG_NUMBER, 0, TRUE, 0);
1697 if (fd_head != NULL) {
1698 /* We have the complete reassembled payload. */
1699 rh_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
1701 /* Add the defragmented data to the data
1703 add_new_data_source(pinfo, rh_tvb,
1704 "Reassembled SNA BIU");
1711 #define SNA_FID01_ADDR_LEN 2
1713 /* FID Types 0 and 1 */
1715 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1717 proto_tree *bf_tree;
1718 proto_item *bf_item;
1722 const int bytes_in_header = 10;
1726 th_0 = tvb_get_guint8(tvb, 0);
1727 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1729 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1731 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1732 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1733 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1736 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1739 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1743 ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
1744 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1745 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1748 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1751 ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
1752 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1753 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1755 /* If we're not filling a proto_tree, return now */
1757 return bytes_in_header;
1759 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1760 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1762 return bytes_in_header;
1765 #define SNA_FID2_ADDR_LEN 1
1769 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1770 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1772 proto_tree *bf_tree;
1773 proto_item *bf_item;
1776 unsigned int mpf, id;
1778 const int bytes_in_header = 6;
1780 th_0 = tvb_get_guint8(tvb, 0);
1781 mpf = mpf_value(th_0);
1786 bf_item = proto_tree_add_item(tree, hf_sna_th_0, tvb, 0, 1, ENC_NA);
1787 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1789 proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, 0, 1, ENC_NA);
1790 proto_tree_add_item(bf_tree, hf_sna_th_mpf, tvb, 0, 1, ENC_NA);
1791 proto_tree_add_item(bf_tree, hf_sna_th_odai,tvb, 0, 1, ENC_NA);
1792 proto_tree_add_item(bf_tree, hf_sna_th_efi, tvb, 0, 1, ENC_NA);
1796 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1799 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 1, ENC_NA);
1803 ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
1804 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1805 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1808 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_NA);
1811 ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
1812 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1813 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1815 id = tvb_get_ntohs(tvb, 4);
1816 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN);
1818 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1819 if (mpf == MPF_FIRST_SEGMENT) {
1820 *continue_dissecting = rh_only;
1822 *continue_dissecting = stop_here;
1826 else if (sna_defragment) {
1827 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1828 bytes_in_header, mpf, id);
1831 return bytes_in_header;
1836 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1838 proto_tree *bf_tree;
1839 proto_item *bf_item;
1842 const int bytes_in_header = 2;
1844 /* If we're not filling a proto_tree, return now */
1846 return bytes_in_header;
1848 th_0 = tvb_get_guint8(tvb, 0);
1850 /* Create the bitfield tree */
1851 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1852 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1854 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1855 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1856 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1858 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1860 return bytes_in_header;
1864 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1866 proto_tree *bf_tree;
1867 proto_item *bf_item;
1869 guint8 th_byte, mft;
1873 static struct sna_fid_type_4_addr src, dst; /* has to be static due to SET_ADDRESS */
1875 const int bytes_in_header = 26;
1877 /* If we're not filling a proto_tree, return now */
1879 return bytes_in_header;
1881 th_byte = tvb_get_guint8(tvb, offset);
1883 /* Create the bitfield tree */
1884 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset,
1886 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1889 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb,
1890 offset, 1, th_byte);
1891 proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb,
1892 offset, 1, th_byte);
1893 proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb,
1894 offset, 1, th_byte);
1895 proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb,
1896 offset, 1, th_byte);
1897 proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb,
1898 offset, 1, th_byte);
1901 th_byte = tvb_get_guint8(tvb, offset);
1903 /* Create the bitfield tree */
1904 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1905 "Transmission Header Byte 1");
1906 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1909 proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1,
1911 proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1,
1913 proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1,
1916 mft = th_byte & 0x04;
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 2");
1923 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1927 proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb,
1928 offset, 1, th_byte);
1929 proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb,
1930 offset, 1, th_byte);
1932 proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb,
1933 offset, 1, th_byte);
1935 proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1,
1939 th_byte = tvb_get_guint8(tvb, offset);
1941 /* Create the bitfield tree */
1942 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1943 "Transmission Header Byte 3");
1944 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1947 proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1,
1949 proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, offset, 1,
1953 th_word = tvb_get_ntohs(tvb, offset);
1955 /* Create the bitfield tree */
1956 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1957 "Transmission Header Bytes 4-5");
1958 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1961 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb,
1962 offset, 2, th_word);
1963 proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb,
1964 offset, 2, th_word);
1965 proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb,
1966 offset, 2, th_word);
1968 /* I'm not sure about byte-order on this one... */
1969 proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb,
1970 offset, 2, th_word);
1973 th_word = tvb_get_ntohs(tvb, offset);
1975 /* Create the bitfield tree */
1976 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1977 "Transmission Header Bytes 6-7");
1978 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1981 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset,
1983 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset,
1985 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset,
1987 proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset,
1990 /* I'm not sure about byte-order on this one... */
1991 proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb,
1992 offset, 2, th_word);
1996 dsaf = tvb_get_ntohl(tvb, 8);
1998 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
2002 osaf = tvb_get_ntohl(tvb, 12);
2004 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
2007 th_byte = tvb_get_guint8(tvb, offset);
2009 /* Create the bitfield tree */
2010 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
2011 "Transmission Header Byte 16");
2012 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2015 proto_tree_add_boolean(bf_tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
2017 /* We luck out here because in their infinite wisdom the SNA
2018 * architects placed the MPF and EFI fields in the same bitfield
2019 * locations, even though for FID4 they're not in byte 0.
2021 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
2022 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
2025 /* 1 for byte 16, 1 for byte 17 which is reserved */
2027 def = tvb_get_ntohs(tvb, 18);
2029 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
2031 /* Addresses in FID 4 are discontiguous, sigh */
2034 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2036 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2039 oef = tvb_get_ntohs(tvb, 20);
2040 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
2042 /* Addresses in FID 4 are discontiguous, sigh */
2045 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2047 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2050 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
2051 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
2053 return bytes_in_header;
2058 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
2060 proto_tree *bf_tree;
2061 proto_item *bf_item;
2064 const int bytes_in_header = 12;
2066 /* If we're not filling a proto_tree, return now */
2068 return bytes_in_header;
2070 th_0 = tvb_get_guint8(tvb, 0);
2072 /* Create the bitfield tree */
2073 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2074 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2076 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2077 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
2078 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
2080 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2081 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
2083 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
2085 return bytes_in_header;
2091 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2093 proto_tree *bf_tree;
2094 proto_item *bf_item;
2097 const int bytes_in_header = 26;
2099 /* If we're not filling a proto_tree, return now */
2101 return bytes_in_header;
2103 th_0 = tvb_get_guint8(tvb, 0);
2105 /* Create the bitfield tree */
2106 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2107 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2109 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2110 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2112 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, ENC_BIG_ENDIAN);
2113 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2114 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, ENC_BIG_ENDIAN);
2116 /* Yup, bytes 6-23 are reserved! */
2117 proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
2119 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2121 return bytes_in_header;
2125 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2126 proto_tree *parent_tree)
2129 proto_tree *th_tree = NULL, *rh_tree = NULL;
2130 proto_item *th_ti = NULL, *rh_ti = NULL;
2132 int th_header_len = 0;
2133 int offset, rh_offset;
2134 tvbuff_t *rh_tvb = NULL;
2135 next_dissection_t continue_dissecting = everything;
2137 /* Transmission Header Format Identifier */
2138 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
2140 /* Summary information */
2141 col_add_str(pinfo->cinfo, COL_INFO,
2142 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2146 /* Don't bother setting length. We'll set it later after we
2147 * find the length of TH */
2148 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2150 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2153 /* Get size of TH */
2157 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2160 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2161 &rh_tvb, &continue_dissecting);
2164 th_header_len = dissect_fid3(tvb, th_tree);
2167 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2170 th_header_len = dissect_fid5(tvb, th_tree);
2173 th_header_len = dissect_fidf(tvb, th_tree);
2176 call_dissector(data_handle,
2177 tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2181 offset = th_header_len;
2183 /* Short-circuit ? */
2184 if (continue_dissecting == stop_here) {
2186 proto_tree_add_text(tree, tvb, offset, -1,
2187 "BIU segment data");
2192 /* If the FID dissector function didn't create an rh_tvb, then we just
2193 * use the rest of our tvbuff as the rh_tvb. */
2195 rh_tvb = tvb_new_subset_remaining(tvb, offset);
2198 /* Process the rest of the SNA packet, starting with RH */
2200 proto_item_set_len(th_ti, th_header_len);
2203 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2205 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2206 dissect_rh(rh_tvb, rh_offset, rh_tree);
2209 rh_offset += RH_LEN;
2211 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2212 /* Short-circuit ? */
2213 if (continue_dissecting == rh_only) {
2215 proto_tree_add_text(tree, rh_tvb, rh_offset, -1,
2216 "BIU segment data");
2220 call_dissector(data_handle,
2221 tvb_new_subset_remaining(rh_tvb, rh_offset),
2222 pinfo, parent_tree);
2226 /* --------------------------------------------------------------------
2227 * Chapter 5 Request/Response Headers (RHs)
2228 * --------------------------------------------------------------------
2232 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2234 proto_tree *bf_tree;
2235 proto_item *bf_item;
2236 gboolean is_response;
2237 guint8 rh_0, rh_1, rh_2;
2242 /* Create the bitfield tree for byte 0*/
2243 rh_0 = tvb_get_guint8(tvb, offset);
2244 is_response = (rh_0 & 0x80);
2246 bf_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, rh_0);
2247 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
2249 proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
2250 proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1,
2252 proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
2253 proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
2254 proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
2255 proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
2258 rh_1 = tvb_get_guint8(tvb, offset);
2260 /* Create the bitfield tree for byte 1*/
2261 bf_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, rh_1);
2262 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
2264 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb, offset, 1, rh_1);
2267 proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1,
2270 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb, offset, 1, rh_1);
2273 proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb, offset, 1,
2276 proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb, offset, 1,
2278 proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1,
2282 proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
2283 proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb, offset, 1, rh_1);
2286 rh_2 = tvb_get_guint8(tvb, offset);
2288 /* Create the bitfield tree for byte 2*/
2289 bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
2292 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
2294 proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb, offset, 1,
2296 proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb, offset, 1,
2298 proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb, offset, 1,
2300 proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb, offset, 1,
2302 proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb, offset, 1,
2304 proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb, offset, 1,
2306 proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1,
2310 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
2313 /* --------------------------------------------------------------------
2314 * Chapter 6 Request/Response Units (RUs)
2315 * --------------------------------------------------------------------
2318 /* --------------------------------------------------------------------
2319 * Chapter 9 Common Fields
2320 * --------------------------------------------------------------------
2324 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2327 proto_tree *bf_tree;
2328 proto_item *bf_item;
2330 guint16 offset, len, pad;
2335 type = tvb_get_guint8(tvb, 2);
2337 bf_item = proto_tree_add_uint(tree, hf_sna_control_05_type, tvb,
2339 bf_tree = proto_item_add_subtree(bf_item, ett_sna_control_05hpr_type);
2341 proto_tree_add_boolean(bf_tree, hf_sna_control_05_ptp, tvb, 2, 1, type);
2342 proto_tree_add_text(tree, tvb, 3, 1, "Reserved");
2346 while (tvb_offset_exists(tvb, offset)) {
2348 len = tvb_get_guint8(tvb, offset+0);
2350 len = tvb_get_guint8(tvb, offset+1);
2353 dissect_control(tvb, offset, len, tree, hpr, parse);
2354 pad = (len+3) & 0xfffc;
2356 /* XXX - fix this, ensure tvb is large enough for pad */
2357 tvb_ensure_bytes_exist(tvb, offset+len, pad-len);
2358 proto_tree_add_text(tree, tvb, offset+len,
2359 pad-len, "Padding");
2369 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2374 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2378 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2385 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2387 len = tvb_reported_length_remaining(tvb, 3);
2391 proto_tree_add_item(tree, hf_sna_control_0e_value, tvb, 3, len, ENC_EBCDIC|ENC_NA);
2395 dissect_control(tvbuff_t *parent_tvb, int offset, int control_len,
2396 proto_tree *tree, int hpr, enum parse parse)
2399 gint length, reported_length;
2400 proto_tree *sub_tree;
2404 length = tvb_length_remaining(parent_tvb, offset);
2405 reported_length = tvb_reported_length_remaining(parent_tvb, offset);
2406 if (control_len < length)
2407 length = control_len;
2408 if (control_len < reported_length)
2409 reported_length = control_len;
2410 tvb = tvb_new_subset(parent_tvb, offset, length, reported_length);
2415 len = tvb_get_guint8(tvb, 0);
2416 key = tvb_get_guint8(tvb, 1);
2418 key = tvb_get_guint8(tvb, 0);
2419 len = tvb_get_guint8(tvb, 1);
2421 ett = ett_sna_control_un;
2425 if (hpr) ett = ett_sna_control_05hpr;
2426 else ett = ett_sna_control_05;
2428 if (key == 0x0e) ett = ett_sna_control_0e;
2430 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2431 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2432 val_to_str_const(key, sna_control_hpr_vals,
2433 "Unknown Control Vector"));
2435 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2436 val_to_str_const(key, sna_control_vals,
2437 "Unknown Control Vector"));
2439 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2441 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2442 proto_tree_add_uint(sub_tree,
2443 hf_sna_control_hprkey, tvb, 1, 1, key);
2445 proto_tree_add_uint(sub_tree,
2446 hf_sna_control_key, tvb, 1, 1, key);
2448 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2449 proto_tree_add_uint(sub_tree,
2450 hf_sna_control_hprkey, tvb, 0, 1, key);
2452 proto_tree_add_uint(sub_tree,
2453 hf_sna_control_key, tvb, 0, 1, key);
2454 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2461 dissect_control_05hpr(tvb, sub_tree, hpr,
2464 dissect_control_05(tvb, sub_tree);
2467 dissect_control_0e(tvb, sub_tree);
2472 /* --------------------------------------------------------------------
2473 * Chapter 11 Function Management (FM) Headers
2474 * --------------------------------------------------------------------
2477 /* --------------------------------------------------------------------
2478 * Chapter 12 Presentation Services (PS) Headers
2479 * --------------------------------------------------------------------
2482 /* --------------------------------------------------------------------
2483 * Chapter 13 GDS Variables
2484 * --------------------------------------------------------------------
2488 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2489 proto_tree *parent_tree)
2495 proto_tree *gds_tree;
2496 proto_item *gds_item;
2499 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2500 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2501 type = tvb_get_ntohs(tvb, offset+2);
2503 if (length < 2 ) /* escape sequence ? */
2506 gds_item = proto_tree_add_item(tree, hf_sna_gds, tvb,
2507 offset, length, ENC_NA);
2508 gds_tree = proto_item_add_subtree(gds_item,
2511 proto_tree_add_uint(gds_tree, hf_sna_gds_len, tvb,
2513 proto_tree_add_boolean(gds_tree, hf_sna_gds_cont, tvb,
2515 proto_tree_add_uint(gds_tree, hf_sna_gds_type, tvb,
2520 if (tvb_offset_exists(tvb, offset))
2521 call_dissector(data_handle,
2522 tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2525 /* --------------------------------------------------------------------
2527 * --------------------------------------------------------------------
2531 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2534 proto_tree *sna_tree = NULL;
2535 proto_item *sna_ti = NULL;
2537 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2538 col_clear(pinfo->cinfo, COL_INFO);
2540 /* SNA data should be printed in EBCDIC, not ASCII */
2541 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2545 /* Don't bother setting length. We'll set it later after we find
2546 * the lengths of TH/RH/RU */
2547 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2549 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2552 /* Transmission Header Format Identifier */
2553 fid = hi_nibble(tvb_get_guint8(tvb, 0));
2555 case 0xa: /* HPR Network Layer Packet */
2559 dissect_nlp(tvb, pinfo, sna_tree, tree);
2562 dissect_fid(tvb, pinfo, sna_tree, tree);
2567 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2569 proto_tree *sna_tree = NULL;
2570 proto_item *sna_ti = NULL;
2572 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2573 col_clear(pinfo->cinfo, COL_INFO);
2575 /* SNA data should be printed in EBCDIC, not ASCII */
2576 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2580 /* Don't bother setting length. We'll set it later after we find
2581 * the lengths of XID */
2582 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2584 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2586 dissect_xid(tvb, pinfo, sna_tree, tree);
2592 reassembly_table_init(&sna_reassembly_table,
2593 &addresses_reassembly_table_functions);
2598 proto_register_sna(void)
2600 static hf_register_info hf[] = {
2602 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2603 NULL, 0x0, NULL, HFILL }},
2606 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2608 "TH Byte 0", HFILL }},
2611 { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2612 VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2615 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2616 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2619 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2620 BASE_DEC, NULL, 0x02, NULL, HFILL }},
2623 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2624 BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2627 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2628 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2631 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2632 NULL, 0x0, NULL, HFILL }},
2635 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2636 NULL, 0x0, NULL, HFILL }},
2639 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2640 NULL, 0x0, NULL, HFILL }},
2643 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2644 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2646 { &hf_sna_th_tg_sweep,
2647 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2648 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2650 { &hf_sna_th_er_vr_supp_ind,
2651 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2652 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2653 0x04, NULL, HFILL }},
2655 { &hf_sna_th_vr_pac_cnt_ind,
2656 { "Virtual Route Pacing Count Indicator",
2657 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2658 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2660 { &hf_sna_th_ntwk_prty,
2661 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2662 VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2665 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2666 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2670 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2671 NULL, 0x04, NULL, HFILL }},
2674 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2675 VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2678 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2679 BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2682 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2683 VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2685 { &hf_sna_th_nlp_cp,
2686 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2687 NULL, 0x70, NULL, HFILL }},
2690 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2691 NULL, 0x0f, NULL, HFILL }},
2694 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2695 NULL, 0xf0, NULL, HFILL }},
2698 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2699 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2701 { &hf_sna_th_vr_cwi,
2702 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2703 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2704 "Change Window Indicator", HFILL }},
2706 { &hf_sna_th_tg_nonfifo_ind,
2707 { "Transmission Group Non-FIFO Indicator",
2708 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2709 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2711 { &hf_sna_th_vr_sqti,
2712 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2713 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2714 "Route Sequence and Type", HFILL }},
2716 { &hf_sna_th_tg_snf,
2717 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2718 FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2721 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2722 16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2725 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2726 16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2728 { &hf_sna_th_vr_cwri,
2729 { "Virtual Route Change Window Reply Indicator",
2730 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2731 VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2733 { &hf_sna_th_vr_rwi,
2734 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2735 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2738 { &hf_sna_th_vr_snf_send,
2739 { "Virtual Route Send Sequence Number Field",
2740 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2741 "Send Sequence Number Field", HFILL }},
2744 { "Destination Subarea Address Field", "sna.th.dsaf",
2745 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2748 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2749 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2752 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2753 "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2756 { "Destination Element Field", "sna.th.def", FT_UINT16,
2757 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2760 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2761 NULL, 0x0, NULL, HFILL }},
2764 { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2765 NULL, 0x0, NULL, HFILL }},
2767 { &hf_sna_th_cmd_fmt,
2768 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2769 NULL, 0x0, NULL, HFILL }},
2771 { &hf_sna_th_cmd_type,
2772 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2773 NULL, 0x0, NULL, HFILL }},
2775 { &hf_sna_th_cmd_sn,
2776 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2777 BASE_DEC, NULL, 0x0, NULL, HFILL }},
2780 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2781 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2783 { &hf_sna_nlp_nhdr_0,
2784 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2785 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2787 { &hf_sna_nlp_nhdr_1,
2788 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2789 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2792 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2793 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2796 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2797 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2800 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2801 VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2804 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2805 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2807 { &hf_sna_nlp_slowdn1,
2808 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2809 TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2811 { &hf_sna_nlp_slowdn2,
2812 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2813 TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2816 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2817 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2820 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2821 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2824 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2825 BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2828 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2829 NULL, 0x0, "THDR", HFILL }},
2832 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2833 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2835 { &hf_sna_nlp_thdr_8,
2836 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2837 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2839 { &hf_sna_nlp_setupi,
2840 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2841 TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2844 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2845 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2848 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2849 8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2852 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2853 8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2855 { &hf_sna_nlp_rasapi,
2856 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2857 8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2859 { &hf_sna_nlp_retryi,
2860 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2861 8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2863 { &hf_sna_nlp_thdr_9,
2864 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2865 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2868 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2869 8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2872 { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2873 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2876 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2877 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2879 { &hf_sna_nlp_offset,
2880 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2881 NULL, 0x0, "Data Offset in Words", HFILL }},
2884 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2885 NULL, 0x0, NULL, HFILL }},
2888 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2889 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2891 { &hf_sna_nlp_opti_len,
2892 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2893 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2895 { &hf_sna_nlp_opti_type,
2896 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2897 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2900 { &hf_sna_nlp_opti_0d_version,
2901 { "Version", "sna.nlp.thdr.optional.0d.version",
2902 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2905 { &hf_sna_nlp_opti_0d_4,
2906 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2907 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2909 { &hf_sna_nlp_opti_0d_target,
2910 { "Target Resource ID Present",
2911 "sna.nlp.thdr.optional.0d.target",
2912 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2914 { &hf_sna_nlp_opti_0d_arb,
2915 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2916 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2918 { &hf_sna_nlp_opti_0d_reliable,
2919 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2920 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2922 { &hf_sna_nlp_opti_0d_dedicated,
2923 { "Dedicated RTP Connection",
2924 "sna.nlp.thdr.optional.0d.dedicated",
2925 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2927 { &hf_sna_nlp_opti_0e_stat,
2928 { "Status", "sna.nlp.thdr.optional.0e.stat",
2929 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2931 { &hf_sna_nlp_opti_0e_gap,
2932 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2933 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2935 { &hf_sna_nlp_opti_0e_idle,
2936 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2937 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2939 { &hf_sna_nlp_opti_0e_nabsp,
2940 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2941 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2943 { &hf_sna_nlp_opti_0e_sync,
2944 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2945 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2947 { &hf_sna_nlp_opti_0e_echo,
2948 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2949 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2951 { &hf_sna_nlp_opti_0e_rseq,
2952 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2953 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2956 { &hf_sna_nlp_opti_0e_abspbeg,
2957 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2958 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2962 { &hf_sna_nlp_opti_0e_abspend,
2963 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2964 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2967 { &hf_sna_nlp_opti_0f_bits,
2968 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2969 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2970 0x0, NULL, HFILL }},
2972 { &hf_sna_nlp_opti_10_tcid,
2973 { "Transport Connection Identifier",
2974 "sna.nlp.thdr.optional.10.tcid",
2975 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2977 { &hf_sna_nlp_opti_12_sense,
2978 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
2979 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2981 { &hf_sna_nlp_opti_14_si_len,
2982 { "Length", "sna.nlp.thdr.optional.14.si.len",
2983 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2985 { &hf_sna_nlp_opti_14_si_key,
2986 { "Key", "sna.nlp.thdr.optional.14.si.key",
2987 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2989 { &hf_sna_nlp_opti_14_si_2,
2990 { "Switching Information Byte 2",
2991 "sna.nlp.thdr.optional.14.si.2",
2992 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2994 { &hf_sna_nlp_opti_14_si_refifo,
2995 { "Resequencing (REFIFO) Indicator",
2996 "sna.nlp.thdr.optional.14.si.refifo",
2997 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2999 { &hf_sna_nlp_opti_14_si_mobility,
3000 { "Mobility Indicator",
3001 "sna.nlp.thdr.optional.14.si.mobility",
3002 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
3004 { &hf_sna_nlp_opti_14_si_dirsearch,
3005 { "Directory Search Required on Path Switch Indicator",
3006 "sna.nlp.thdr.optional.14.si.dirsearch",
3007 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
3009 { &hf_sna_nlp_opti_14_si_limitres,
3010 { "Limited Resource Link Indicator",
3011 "sna.nlp.thdr.optional.14.si.limitres",
3012 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
3014 { &hf_sna_nlp_opti_14_si_ncescope,
3015 { "NCE Scope Indicator",
3016 "sna.nlp.thdr.optional.14.si.ncescope",
3017 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
3019 { &hf_sna_nlp_opti_14_si_mnpsrscv,
3020 { "MNPS RSCV Retention Indicator",
3021 "sna.nlp.thdr.optional.14.si.mnpsrscv",
3022 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3024 { &hf_sna_nlp_opti_14_si_maxpsize,
3025 { "Maximum Packet Size On Return Path",
3026 "sna.nlp.thdr.optional.14.si.maxpsize",
3027 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3029 { &hf_sna_nlp_opti_14_si_switch,
3030 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
3031 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3033 { &hf_sna_nlp_opti_14_si_alive,
3034 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
3035 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3037 { &hf_sna_nlp_opti_14_rr_len,
3038 { "Length", "sna.nlp.thdr.optional.14.rr.len",
3039 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3041 { &hf_sna_nlp_opti_14_rr_key,
3042 { "Key", "sna.nlp.thdr.optional.14.rr.key",
3043 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3045 { &hf_sna_nlp_opti_14_rr_2,
3046 { "Return Route TG Descriptor Byte 2",
3047 "sna.nlp.thdr.optional.14.rr.2",
3048 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3050 { &hf_sna_nlp_opti_14_rr_bfe,
3051 { "BF Entry Indicator",
3052 "sna.nlp.thdr.optional.14.rr.bfe",
3053 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3055 { &hf_sna_nlp_opti_14_rr_num,
3056 { "Number Of TG Control Vectors",
3057 "sna.nlp.thdr.optional.14.rr.num",
3058 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3060 { &hf_sna_nlp_opti_22_2,
3061 { "Adaptive Rate Based Segment Byte 2",
3062 "sna.nlp.thdr.optional.22.2",
3063 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3065 { &hf_sna_nlp_opti_22_type,
3067 "sna.nlp.thdr.optional.22.type",
3069 VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
3071 { &hf_sna_nlp_opti_22_raa,
3072 { "Rate Adjustment Action",
3073 "sna.nlp.thdr.optional.22.raa",
3075 VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
3077 { &hf_sna_nlp_opti_22_parity,
3078 { "Parity Indicator",
3079 "sna.nlp.thdr.optional.22.parity",
3080 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3082 { &hf_sna_nlp_opti_22_arb,
3084 "sna.nlp.thdr.optional.22.arb",
3086 VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
3088 { &hf_sna_nlp_opti_22_3,
3089 { "Adaptive Rate Based Segment Byte 3",
3090 "sna.nlp.thdr.optional.22.3",
3091 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3093 { &hf_sna_nlp_opti_22_ratereq,
3094 { "Rate Request Correlator",
3095 "sna.nlp.thdr.optional.22.ratereq",
3096 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3098 { &hf_sna_nlp_opti_22_raterep,
3099 { "Rate Reply Correlator",
3100 "sna.nlp.thdr.optional.22.raterep",
3101 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3103 { &hf_sna_nlp_opti_22_field1,
3104 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3105 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3107 { &hf_sna_nlp_opti_22_field2,
3108 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3109 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3111 { &hf_sna_nlp_opti_22_field3,
3112 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3113 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3115 { &hf_sna_nlp_opti_22_field4,
3116 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3117 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3120 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3121 NULL, 0x0, NULL, HFILL }},
3124 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3125 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3128 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3129 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3132 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3133 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3136 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8,
3137 BASE_DEC, VALS(sna_rh_rri_vals), 0x80, NULL, HFILL }},
3139 { &hf_sna_rh_ru_category,
3140 { "Request/Response Unit Category", "sna.rh.ru_category",
3141 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3145 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3146 TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3149 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3150 TFS(&sna_rh_sdi_truth), 0x04, NULL, HFILL }},
3153 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3154 TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3157 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3158 TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3161 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3162 8, NULL, 0x80, NULL, HFILL }},
3165 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3166 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3169 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3170 8, NULL, 0x20, NULL, HFILL }},
3173 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3174 8, NULL, 0x10, NULL, HFILL }},
3177 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3178 8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3181 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3182 8, NULL, 0x04, NULL, HFILL }},
3185 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3186 8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3189 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3190 8, NULL, 0x01, NULL, HFILL }},
3193 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3194 8, NULL, 0x80, NULL, HFILL }},
3197 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3198 8, NULL, 0x40, NULL, HFILL }},
3201 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3202 8, NULL, 0x20, NULL, HFILL }},
3205 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3206 VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3209 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3210 NULL, 0x04, NULL, HFILL }},
3213 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3214 0x02, NULL, HFILL }},
3217 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3218 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3221 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3222 NULL, 0x0, NULL, HFILL }},*/
3225 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3229 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3230 NULL, 0x7fff, NULL, HFILL }},
3233 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3234 0x8000, NULL, HFILL }},
3237 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3238 VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3242 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3243 "XID Frame", HFILL }},
3247 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3250 { &hf_sna_xid_format,
3251 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3252 0xf0, NULL, HFILL }},
3255 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3256 VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3259 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3263 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3264 NULL, 0x0, NULL, HFILL }},
3266 { &hf_sna_xid_idblock,
3267 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3268 0xfff00000, NULL, HFILL }},
3270 { &hf_sna_xid_idnum,
3271 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3272 0x0fffff, NULL, HFILL }},
3275 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3276 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3278 { &hf_sna_xid_3_init_self,
3279 { "INIT-SELF support", "sna.xid.type3.initself",
3280 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3282 { &hf_sna_xid_3_stand_bind,
3283 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3284 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3286 { &hf_sna_xid_3_gener_bind,
3287 { "Whole BIND PIU generated indicator",
3288 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3289 "Whole BIND PIU generated", HFILL }},
3291 { &hf_sna_xid_3_recve_bind,
3292 { "Whole BIND PIU required indicator",
3293 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3294 "Whole BIND PIU required", HFILL }},
3296 { &hf_sna_xid_3_actpu,
3297 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3298 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3300 { &hf_sna_xid_3_nwnode,
3301 { "Sender is network node", "sna.xid.type3.nwnode",
3302 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3305 { "Control Point Services", "sna.xid.type3.cp",
3306 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3308 { &hf_sna_xid_3_cpcp,
3309 { "CP-CP session support", "sna.xid.type3.cpcp",
3310 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3312 { &hf_sna_xid_3_state,
3313 { "XID exchange state indicator", "sna.xid.type3.state",
3314 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3315 0x000c, NULL, HFILL }},
3317 { &hf_sna_xid_3_nonact,
3318 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3319 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3321 { &hf_sna_xid_3_cpchange,
3322 { "CP name change support", "sna.xid.type3.cpchange",
3323 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3326 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3327 NULL, 0x0, NULL, HFILL }},
3329 { &hf_sna_xid_3_asend_bind,
3330 { "Adaptive BIND pacing support as sender",
3331 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3332 "Pacing support as sender", HFILL }},
3334 { &hf_sna_xid_3_arecv_bind,
3335 { "Adaptive BIND pacing support as receiver",
3336 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3337 "Pacing support as receive", HFILL }},
3339 { &hf_sna_xid_3_quiesce,
3340 { "Quiesce TG Request",
3341 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3344 { &hf_sna_xid_3_pucap,
3345 { "PU Capabilities",
3346 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3349 { &hf_sna_xid_3_pbn,
3350 { "Peripheral Border Node",
3351 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3354 { &hf_sna_xid_3_pacing,
3355 { "Qualifier for adaptive BIND pacing support",
3356 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3360 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3361 NULL, 0x0, NULL, HFILL }},
3363 { &hf_sna_xid_3_tgshare,
3364 { "TG Sharing Prohibited Indicator",
3365 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3368 { &hf_sna_xid_3_dedsvc,
3369 { "Dedicated SVC Indicator",
3370 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3374 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3375 NULL, 0x0, NULL, HFILL }},
3377 { &hf_sna_xid_3_negcsup,
3378 { "Negotiation Complete Supported",
3379 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3382 { &hf_sna_xid_3_negcomp,
3383 { "Negotiation Complete",
3384 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3388 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3389 NULL, 0x0, NULL, HFILL }},
3391 { &hf_sna_xid_3_partg,
3392 { "Parallel TG Support",
3393 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3396 { &hf_sna_xid_3_dlur,
3397 { "Dependent LU Requester Indicator",
3398 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3401 { &hf_sna_xid_3_dlus,
3402 { "DLUS Served LU Registration Indicator",
3403 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3406 { &hf_sna_xid_3_exbn,
3407 { "Extended HPR Border Node",
3408 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3411 { &hf_sna_xid_3_genodai,
3412 { "Generalized ODAI Usage Option",
3413 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3416 { &hf_sna_xid_3_branch,
3417 { "Branch Indicator", "sna.xid.type3.branch",
3418 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3419 0x06, NULL, HFILL }},
3421 { &hf_sna_xid_3_brnn,
3422 { "Option Set 1123 Indicator",
3423 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3427 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3430 { &hf_sna_xid_3_dlc,
3431 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3434 { &hf_sna_xid_3_dlen,
3435 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3436 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3438 { &hf_sna_control_len,
3439 { "Control Vector Length", "sna.control.len",
3440 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3442 { &hf_sna_control_key,
3443 { "Control Vector Key", "sna.control.key",
3444 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3447 { &hf_sna_control_hprkey,
3448 { "Control Vector HPR Key", "sna.control.hprkey",
3449 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3452 { &hf_sna_control_05_delay,
3453 { "Channel Delay", "sna.control.05.delay",
3454 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3456 { &hf_sna_control_05_type,
3457 { "Network Address Type", "sna.control.05.type",
3458 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3460 { &hf_sna_control_05_ptp,
3461 { "Point-to-point", "sna.control.05.ptp",
3462 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3464 { &hf_sna_control_0e_type,
3465 { "Type", "sna.control.0e.type",
3466 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3469 { &hf_sna_control_0e_value,
3470 { "Value", "sna.control.0e.value",
3471 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3473 static gint *ett[] = {
3478 &ett_sna_nlp_nhdr_0,
3479 &ett_sna_nlp_nhdr_1,
3481 &ett_sna_nlp_thdr_8,
3482 &ett_sna_nlp_thdr_9,
3483 &ett_sna_nlp_opti_un,
3484 &ett_sna_nlp_opti_0d,
3485 &ett_sna_nlp_opti_0d_4,
3486 &ett_sna_nlp_opti_0e,
3487 &ett_sna_nlp_opti_0e_stat,
3488 &ett_sna_nlp_opti_0e_absp,
3489 &ett_sna_nlp_opti_0f,
3490 &ett_sna_nlp_opti_10,
3491 &ett_sna_nlp_opti_12,
3492 &ett_sna_nlp_opti_14,
3493 &ett_sna_nlp_opti_14_si,
3494 &ett_sna_nlp_opti_14_si_2,
3495 &ett_sna_nlp_opti_14_rr,
3496 &ett_sna_nlp_opti_14_rr_2,
3497 &ett_sna_nlp_opti_22,
3498 &ett_sna_nlp_opti_22_2,
3499 &ett_sna_nlp_opti_22_3,
3512 &ett_sna_control_un,
3513 &ett_sna_control_05,
3514 &ett_sna_control_05hpr,
3515 &ett_sna_control_05hpr_type,
3516 &ett_sna_control_0e,
3518 module_t *sna_module;
3520 proto_sna = proto_register_protocol("Systems Network Architecture",
3522 proto_register_field_array(proto_sna, hf, array_length(hf));
3523 proto_register_subtree_array(ett, array_length(ett));
3524 register_dissector("sna", dissect_sna, proto_sna);
3526 proto_sna_xid = proto_register_protocol(
3527 "Systems Network Architecture XID", "SNA XID", "sna_xid");
3528 register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3530 /* Register configuration options */
3531 sna_module = prefs_register_protocol(proto_sna, NULL);
3532 prefs_register_bool_preference(sna_module, "defragment",
3533 "Reassemble fragmented BIUs",
3534 "Whether fragmented BIUs should be reassembled",
3537 register_init_routine(sna_init);
3541 proto_reg_handoff_sna(void)
3543 dissector_handle_t sna_handle;
3544 dissector_handle_t sna_xid_handle;
3546 sna_handle = find_dissector("sna");
3547 sna_xid_handle = find_dissector("sna_xid");
3548 dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3549 dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3550 dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3551 dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3552 dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3553 dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3554 dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3555 dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3557 dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3558 data_handle = find_dissector("data");