3 * Gilbert Ramirez <gram@alumni.rice.edu>
4 * Jochen Friedrich <jochen@scram.de>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/llcsaps.h>
32 #include <epan/ppptypes.h>
33 #include <epan/sna-utils.h>
34 #include <epan/charsets.h>
35 #include <epan/prefs.h>
36 #include <epan/reassemble.h>
39 * http://www.wanresources.com/snacell.html
40 * ftp://ftp.software.ibm.com/networking/pub/standards/aiw/formats/
44 static int proto_sna = -1;
45 static int proto_sna_xid = -1;
46 static int hf_sna_th = -1;
47 static int hf_sna_th_0 = -1;
48 static int hf_sna_th_fid = -1;
49 static int hf_sna_th_mpf = -1;
50 static int hf_sna_th_odai = -1;
51 static int hf_sna_th_efi = -1;
52 static int hf_sna_th_daf = -1;
53 static int hf_sna_th_oaf = -1;
54 static int hf_sna_th_snf = -1;
55 static int hf_sna_th_dcf = -1;
56 static int hf_sna_th_lsid = -1;
57 static int hf_sna_th_tg_sweep = -1;
58 static int hf_sna_th_er_vr_supp_ind = -1;
59 static int hf_sna_th_vr_pac_cnt_ind = -1;
60 static int hf_sna_th_ntwk_prty = -1;
61 static int hf_sna_th_tgsf = -1;
62 static int hf_sna_th_mft = -1;
63 static int hf_sna_th_piubf = -1;
64 static int hf_sna_th_iern = -1;
65 static int hf_sna_th_nlpoi = -1;
66 static int hf_sna_th_nlp_cp = -1;
67 static int hf_sna_th_ern = -1;
68 static int hf_sna_th_vrn = -1;
69 static int hf_sna_th_tpf = -1;
70 static int hf_sna_th_vr_cwi = -1;
71 static int hf_sna_th_tg_nonfifo_ind = -1;
72 static int hf_sna_th_vr_sqti = -1;
73 static int hf_sna_th_tg_snf = -1;
74 static int hf_sna_th_vrprq = -1;
75 static int hf_sna_th_vrprs = -1;
76 static int hf_sna_th_vr_cwri = -1;
77 static int hf_sna_th_vr_rwi = -1;
78 static int hf_sna_th_vr_snf_send = -1;
79 static int hf_sna_th_dsaf = -1;
80 static int hf_sna_th_osaf = -1;
81 static int hf_sna_th_snai = -1;
82 static int hf_sna_th_def = -1;
83 static int hf_sna_th_oef = -1;
84 static int hf_sna_th_sa = -1;
85 static int hf_sna_th_cmd_fmt = -1;
86 static int hf_sna_th_cmd_type = -1;
87 static int hf_sna_th_cmd_sn = -1;
89 static int hf_sna_nlp_nhdr = -1;
90 static int hf_sna_nlp_nhdr_0 = -1;
91 static int hf_sna_nlp_sm = -1;
92 static int hf_sna_nlp_tpf = -1;
93 static int hf_sna_nlp_nhdr_1 = -1;
94 static int hf_sna_nlp_ft = -1;
95 static int hf_sna_nlp_tspi = -1;
96 static int hf_sna_nlp_slowdn1 = -1;
97 static int hf_sna_nlp_slowdn2 = -1;
98 static int hf_sna_nlp_fra = -1;
99 static int hf_sna_nlp_anr = -1;
100 static int hf_sna_nlp_frh = -1;
101 static int hf_sna_nlp_thdr = -1;
102 static int hf_sna_nlp_tcid = -1;
103 static int hf_sna_nlp_thdr_8 = -1;
104 static int hf_sna_nlp_setupi = -1;
105 static int hf_sna_nlp_somi = -1;
106 static int hf_sna_nlp_eomi = -1;
107 static int hf_sna_nlp_sri = -1;
108 static int hf_sna_nlp_rasapi = -1;
109 static int hf_sna_nlp_retryi = -1;
110 static int hf_sna_nlp_thdr_9 = -1;
111 static int hf_sna_nlp_lmi = -1;
112 static int hf_sna_nlp_cqfi = -1;
113 static int hf_sna_nlp_osi = -1;
114 static int hf_sna_nlp_offset = -1;
115 static int hf_sna_nlp_dlf = -1;
116 static int hf_sna_nlp_bsn = -1;
117 static int hf_sna_nlp_opti_len = -1;
118 static int hf_sna_nlp_opti_type = -1;
119 static int hf_sna_nlp_opti_0d_version = -1;
120 static int hf_sna_nlp_opti_0d_4 = -1;
121 static int hf_sna_nlp_opti_0d_target = -1;
122 static int hf_sna_nlp_opti_0d_arb = -1;
123 static int hf_sna_nlp_opti_0d_reliable = -1;
124 static int hf_sna_nlp_opti_0d_dedicated = -1;
125 static int hf_sna_nlp_opti_0e_stat = -1;
126 static int hf_sna_nlp_opti_0e_gap = -1;
127 static int hf_sna_nlp_opti_0e_idle = -1;
128 static int hf_sna_nlp_opti_0e_nabsp = -1;
129 static int hf_sna_nlp_opti_0e_sync = -1;
130 static int hf_sna_nlp_opti_0e_echo = -1;
131 static int hf_sna_nlp_opti_0e_rseq = -1;
132 /* static int hf_sna_nlp_opti_0e_abspbeg = -1; */
133 /* static int hf_sna_nlp_opti_0e_abspend = -1; */
134 static int hf_sna_nlp_opti_0f_bits = -1;
135 static int hf_sna_nlp_opti_10_tcid = -1;
136 static int hf_sna_nlp_opti_12_sense = -1;
137 static int hf_sna_nlp_opti_14_si_len = -1;
138 static int hf_sna_nlp_opti_14_si_key = -1;
139 static int hf_sna_nlp_opti_14_si_2 = -1;
140 static int hf_sna_nlp_opti_14_si_refifo = -1;
141 static int hf_sna_nlp_opti_14_si_mobility = -1;
142 static int hf_sna_nlp_opti_14_si_dirsearch = -1;
143 static int hf_sna_nlp_opti_14_si_limitres = -1;
144 static int hf_sna_nlp_opti_14_si_ncescope = -1;
145 static int hf_sna_nlp_opti_14_si_mnpsrscv = -1;
146 static int hf_sna_nlp_opti_14_si_maxpsize = -1;
147 static int hf_sna_nlp_opti_14_si_switch = -1;
148 static int hf_sna_nlp_opti_14_si_alive = -1;
149 static int hf_sna_nlp_opti_14_rr_len = -1;
150 static int hf_sna_nlp_opti_14_rr_key = -1;
151 static int hf_sna_nlp_opti_14_rr_2 = -1;
152 static int hf_sna_nlp_opti_14_rr_bfe = -1;
153 static int hf_sna_nlp_opti_14_rr_num = -1;
154 static int hf_sna_nlp_opti_22_2 = -1;
155 static int hf_sna_nlp_opti_22_type = -1;
156 static int hf_sna_nlp_opti_22_raa = -1;
157 static int hf_sna_nlp_opti_22_parity = -1;
158 static int hf_sna_nlp_opti_22_arb = -1;
159 static int hf_sna_nlp_opti_22_3 = -1;
160 static int hf_sna_nlp_opti_22_ratereq = -1;
161 static int hf_sna_nlp_opti_22_raterep = -1;
162 static int hf_sna_nlp_opti_22_field1 = -1;
163 static int hf_sna_nlp_opti_22_field2 = -1;
164 static int hf_sna_nlp_opti_22_field3 = -1;
165 static int hf_sna_nlp_opti_22_field4 = -1;
167 static int hf_sna_rh = -1;
168 static int hf_sna_rh_0 = -1;
169 static int hf_sna_rh_1 = -1;
170 static int hf_sna_rh_2 = -1;
171 static int hf_sna_rh_rri = -1;
172 static int hf_sna_rh_ru_category = -1;
173 static int hf_sna_rh_fi = -1;
174 static int hf_sna_rh_sdi = -1;
175 static int hf_sna_rh_bci = -1;
176 static int hf_sna_rh_eci = -1;
177 static int hf_sna_rh_dr1 = -1;
178 static int hf_sna_rh_lcci = -1;
179 static int hf_sna_rh_dr2 = -1;
180 static int hf_sna_rh_eri = -1;
181 static int hf_sna_rh_rti = -1;
182 static int hf_sna_rh_rlwi = -1;
183 static int hf_sna_rh_qri = -1;
184 static int hf_sna_rh_pi = -1;
185 static int hf_sna_rh_bbi = -1;
186 static int hf_sna_rh_ebi = -1;
187 static int hf_sna_rh_cdi = -1;
188 static int hf_sna_rh_csi = -1;
189 static int hf_sna_rh_edi = -1;
190 static int hf_sna_rh_pdi = -1;
191 static int hf_sna_rh_cebi = -1;
192 /*static int hf_sna_ru = -1;*/
194 static int hf_sna_gds = -1;
195 static int hf_sna_gds_len = -1;
196 static int hf_sna_gds_type = -1;
197 static int hf_sna_gds_cont = -1;
199 /* static int hf_sna_xid = -1; */
200 static int hf_sna_xid_0 = -1;
201 static int hf_sna_xid_id = -1;
202 static int hf_sna_xid_format = -1;
203 static int hf_sna_xid_type = -1;
204 static int hf_sna_xid_len = -1;
205 static int hf_sna_xid_idblock = -1;
206 static int hf_sna_xid_idnum = -1;
207 static int hf_sna_xid_3_8 = -1;
208 static int hf_sna_xid_3_init_self = -1;
209 static int hf_sna_xid_3_stand_bind = -1;
210 static int hf_sna_xid_3_gener_bind = -1;
211 static int hf_sna_xid_3_recve_bind = -1;
212 static int hf_sna_xid_3_actpu = -1;
213 static int hf_sna_xid_3_nwnode = -1;
214 static int hf_sna_xid_3_cp = -1;
215 static int hf_sna_xid_3_cpcp = -1;
216 static int hf_sna_xid_3_state = -1;
217 static int hf_sna_xid_3_nonact = -1;
218 static int hf_sna_xid_3_cpchange = -1;
219 static int hf_sna_xid_3_10 = -1;
220 static int hf_sna_xid_3_asend_bind = -1;
221 static int hf_sna_xid_3_arecv_bind = -1;
222 static int hf_sna_xid_3_quiesce = -1;
223 static int hf_sna_xid_3_pucap = -1;
224 static int hf_sna_xid_3_pbn = -1;
225 static int hf_sna_xid_3_pacing = -1;
226 static int hf_sna_xid_3_11 = -1;
227 static int hf_sna_xid_3_tgshare = -1;
228 static int hf_sna_xid_3_dedsvc = -1;
229 static int hf_sna_xid_3_12 = -1;
230 static int hf_sna_xid_3_negcsup = -1;
231 static int hf_sna_xid_3_negcomp = -1;
232 static int hf_sna_xid_3_15 = -1;
233 static int hf_sna_xid_3_partg = -1;
234 static int hf_sna_xid_3_dlur = -1;
235 static int hf_sna_xid_3_dlus = -1;
236 static int hf_sna_xid_3_exbn = -1;
237 static int hf_sna_xid_3_genodai = -1;
238 static int hf_sna_xid_3_branch = -1;
239 static int hf_sna_xid_3_brnn = -1;
240 static int hf_sna_xid_3_tg = -1;
241 static int hf_sna_xid_3_dlc = -1;
242 static int hf_sna_xid_3_dlen = -1;
244 static int hf_sna_control_len = -1;
245 static int hf_sna_control_key = -1;
246 static int hf_sna_control_hprkey = -1;
247 static int hf_sna_control_05_delay = -1;
248 static int hf_sna_control_05_type = -1;
249 static int hf_sna_control_05_ptp = -1;
250 static int hf_sna_control_0e_type = -1;
251 static int hf_sna_control_0e_value = -1;
253 static gint ett_sna = -1;
254 static gint ett_sna_th = -1;
255 static gint ett_sna_th_fid = -1;
256 static gint ett_sna_nlp_nhdr = -1;
257 static gint ett_sna_nlp_nhdr_0 = -1;
258 static gint ett_sna_nlp_nhdr_1 = -1;
259 static gint ett_sna_nlp_thdr = -1;
260 static gint ett_sna_nlp_thdr_8 = -1;
261 static gint ett_sna_nlp_thdr_9 = -1;
262 static gint ett_sna_nlp_opti_un = -1;
263 static gint ett_sna_nlp_opti_0d = -1;
264 static gint ett_sna_nlp_opti_0d_4 = -1;
265 static gint ett_sna_nlp_opti_0e = -1;
266 static gint ett_sna_nlp_opti_0e_stat = -1;
267 static gint ett_sna_nlp_opti_0e_absp = -1;
268 static gint ett_sna_nlp_opti_0f = -1;
269 static gint ett_sna_nlp_opti_10 = -1;
270 static gint ett_sna_nlp_opti_12 = -1;
271 static gint ett_sna_nlp_opti_14 = -1;
272 static gint ett_sna_nlp_opti_14_si = -1;
273 static gint ett_sna_nlp_opti_14_si_2 = -1;
274 static gint ett_sna_nlp_opti_14_rr = -1;
275 static gint ett_sna_nlp_opti_14_rr_2 = -1;
276 static gint ett_sna_nlp_opti_22 = -1;
277 static gint ett_sna_nlp_opti_22_2 = -1;
278 static gint ett_sna_nlp_opti_22_3 = -1;
279 static gint ett_sna_rh = -1;
280 static gint ett_sna_rh_0 = -1;
281 static gint ett_sna_rh_1 = -1;
282 static gint ett_sna_rh_2 = -1;
283 static gint ett_sna_gds = -1;
284 static gint ett_sna_xid_0 = -1;
285 static gint ett_sna_xid_id = -1;
286 static gint ett_sna_xid_3_8 = -1;
287 static gint ett_sna_xid_3_10 = -1;
288 static gint ett_sna_xid_3_11 = -1;
289 static gint ett_sna_xid_3_12 = -1;
290 static gint ett_sna_xid_3_15 = -1;
291 static gint ett_sna_control_un = -1;
292 static gint ett_sna_control_05 = -1;
293 static gint ett_sna_control_05hpr = -1;
294 static gint ett_sna_control_05hpr_type = -1;
295 static gint ett_sna_control_0e = -1;
297 static dissector_handle_t data_handle;
299 /* Defragment fragmented SNA BIUs*/
300 static gboolean sna_defragment = TRUE;
301 static GHashTable *sna_fragment_table = NULL;
303 /* Format Identifier */
304 static const value_string sna_th_fid_vals[] = {
305 { 0x0, "SNA device <--> Non-SNA Device" },
306 { 0x1, "Subarea Nodes, without ER or VR" },
307 { 0x2, "Subarea Node <--> PU2" },
308 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
309 { 0x4, "Subarea Nodes, supporting ER and VR" },
310 { 0x5, "HPR RTP endpoint nodes" },
311 { 0xa, "HPR NLP Frame Routing" },
312 { 0xb, "HPR NLP Frame Routing" },
313 { 0xc, "HPR NLP Automatic Network Routing" },
314 { 0xd, "HPR NLP Automatic Network Routing" },
315 { 0xf, "Adjacent Subarea Nodes, supporting ER and VR" },
320 #define MPF_MIDDLE_SEGMENT 0
321 #define MPF_LAST_SEGMENT 1
322 #define MPF_FIRST_SEGMENT 2
323 #define MPF_WHOLE_BIU 3
325 static const value_string sna_th_mpf_vals[] = {
326 { MPF_MIDDLE_SEGMENT, "Middle segment of a BIU" },
327 { MPF_LAST_SEGMENT, "Last segment of a BIU" },
328 { MPF_FIRST_SEGMENT, "First segment of a BIU" },
329 { MPF_WHOLE_BIU, "Whole BIU" },
333 /* Expedited Flow Indicator */
334 static const value_string sna_th_efi_vals[] = {
335 { 0, "Normal Flow" },
336 { 1, "Expedited Flow" },
340 /* Request/Response Indicator */
341 static const value_string sna_rh_rri_vals[] = {
347 /* Request/Response Unit Category */
348 static const value_string sna_rh_ru_category_vals[] = {
349 { 0, "Function Management Data (FMD)" },
350 { 1, "Network Control (NC)" },
351 { 2, "Data Flow Control (DFC)" },
352 { 3, "Session Control (SC)" },
356 /* Format Indicator */
357 static const true_false_string sna_rh_fi_truth =
358 { "FM Header", "No FM Header" };
360 /* Sense Data Included */
361 static const true_false_string sna_rh_sdi_truth =
362 { "Included", "Not Included" };
364 /* Begin Chain Indicator */
365 static const true_false_string sna_rh_bci_truth =
366 { "First in Chain", "Not First in Chain" };
368 /* End Chain Indicator */
369 static const true_false_string sna_rh_eci_truth =
370 { "Last in Chain", "Not Last in Chain" };
372 /* Lengith-Checked Compression Indicator */
373 static const true_false_string sna_rh_lcci_truth =
374 { "Compressed", "Not Compressed" };
376 /* Response Type Indicator */
377 static const true_false_string sna_rh_rti_truth =
378 { "Negative", "Positive" };
380 /* Queued Response Indicator */
381 static const true_false_string sna_rh_qri_truth =
382 { "Enqueue response in TC queues", "Response bypasses TC queues" };
384 /* Code Selection Indicator */
385 static const value_string sna_rh_csi_vals[] = {
392 static const value_string sna_th_tg_sweep_vals[] = {
393 { 0, "This PIU may overtake any PU ahead of it." },
394 { 1, "This PIU does not overtake any PIU ahead of it." },
399 static const value_string sna_th_er_vr_supp_ind_vals[] = {
400 { 0, "Each node supports ER and VR protocols" },
401 { 1, "Includes at least one node that does not support ER and VR"
407 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
408 { 0, "Pacing count on the VR has not reached 0" },
409 { 1, "Pacing count on the VR has reached 0" },
414 static const value_string sna_th_ntwk_prty_vals[] = {
415 { 0, "PIU flows at a lower priority" },
416 { 1, "PIU flows at network priority (highest transmission priority)" },
421 static const value_string sna_th_tgsf_vals[] = {
422 { 0, "Not segmented" },
423 { 1, "Last segment" },
424 { 2, "First segment" },
425 { 3, "Middle segment" },
430 static const value_string sna_th_piubf_vals[] = {
431 { 0, "Single PIU frame" },
432 { 1, "Last PIU of a multiple PIU frame" },
433 { 2, "First PIU of a multiple PIU frame" },
434 { 3, "Middle PIU of a multiple PIU frame" },
439 static const value_string sna_th_nlpoi_vals[] = {
440 { 0, "NLP starts within this FID4 TH" },
441 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
446 static const value_string sna_th_tpf_vals[] = {
447 { 0, "Low Priority" },
448 { 1, "Medium Priority" },
449 { 2, "High Priority" },
450 { 3, "Network Priority" },
455 static const value_string sna_th_vr_cwi_vals[] = {
456 { 0, "Increment window size" },
457 { 1, "Decrement window size" },
462 static const true_false_string sna_th_tg_nonfifo_ind_truth =
463 { "TG FIFO is not required", "TG FIFO is required" };
466 static const value_string sna_th_vr_sqti_vals[] = {
467 { 0, "Non-sequenced, Non-supervisory" },
468 { 1, "Non-sequenced, Supervisory" },
469 { 2, "Singly-sequenced" },
474 static const true_false_string sna_th_vrprq_truth = {
475 "VR pacing request is sent asking for a VR pacing response",
476 "No VR pacing response is requested",
480 static const true_false_string sna_th_vrprs_truth = {
481 "VR pacing response is sent in response to a VRPRQ bit set",
482 "No pacing response sent",
486 static const value_string sna_th_vr_cwri_vals[] = {
487 { 0, "Increment window size by 1" },
488 { 1, "Decrement window size by 1" },
493 static const true_false_string sna_th_vr_rwi_truth = {
494 "Reset window size to the minimum specified in NC_ACTVR",
495 "Do not reset window size",
499 static const value_string sna_nlp_sm_vals[] = {
500 { 5, "Function routing" },
501 { 6, "Automatic network routing" },
505 static const true_false_string sna_nlp_tspi_truth =
506 { "Time sensitive", "Not time sensitive" };
508 static const true_false_string sna_nlp_slowdn1_truth =
509 { "Minor congestion", "No minor congestion" };
511 static const true_false_string sna_nlp_slowdn2_truth =
512 { "Major congestion", "No major congestion" };
515 static const value_string sna_nlp_ft_vals[] = {
520 static const value_string sna_nlp_frh_vals[] = {
521 { 0x03, "XID complete request" },
522 { 0x04, "XID complete response" },
526 static const true_false_string sna_nlp_setupi_truth =
527 { "Connection setup segment present", "Connection setup segment not"
530 static const true_false_string sna_nlp_somi_truth =
531 { "Start of message", "Not start of message" };
533 static const true_false_string sna_nlp_eomi_truth =
534 { "End of message", "Not end of message" };
536 static const true_false_string sna_nlp_sri_truth =
537 { "Status requested", "No status requested" };
539 static const true_false_string sna_nlp_rasapi_truth =
540 { "Reply as soon as possible", "No need to reply as soon as possible" };
542 static const true_false_string sna_nlp_retryi_truth =
543 { "Undefined", "Sender will retransmit" };
545 static const true_false_string sna_nlp_lmi_truth =
546 { "Last message", "Not last message" };
548 static const true_false_string sna_nlp_cqfi_truth =
549 { "CQFI included", "CQFI not included" };
551 static const true_false_string sna_nlp_osi_truth =
552 { "Optional segments present", "No optional segments present" };
554 static const value_string sna_xid_3_state_vals[] = {
555 { 0x00, "Exchange state indicators not supported" },
556 { 0x01, "Negotiation-proceeding exchange" },
557 { 0x02, "Prenegotiation exchange" },
558 { 0x03, "Nonactivation exchange" },
562 static const value_string sna_xid_3_branch_vals[] = {
563 { 0x00, "Sender does not support branch extender" },
564 { 0x01, "TG is branch uplink" },
565 { 0x02, "TG is branch downlink" },
566 { 0x03, "TG is neither uplink nor downlink" },
570 static const value_string sna_xid_type_vals[] = {
572 { 0x02, "T2.0 or T2.1 node" },
573 { 0x03, "Reserved" },
574 { 0x04, "T4 or T5 node" },
578 static const value_string sna_nlp_opti_vals[] = {
579 { 0x0d, "Connection Setup Segment" },
580 { 0x0e, "Status Segment" },
581 { 0x0f, "Client Out Of Band Bits Segment" },
582 { 0x10, "Connection Identifier Exchange Segment" },
583 { 0x12, "Connection Fault Segment" },
584 { 0x14, "Switching Information Segment" },
585 { 0x22, "Adaptive Rate-Based Segment" },
589 static const value_string sna_nlp_opti_0d_version_vals[] = {
590 { 0x0101, "Version 1.1" },
594 static const value_string sna_nlp_opti_0f_bits_vals[] = {
595 { 0x0001, "Request Deactivation" },
596 { 0x8000, "Reply - OK" },
597 { 0x8004, "Reply - Reject" },
601 static const value_string sna_nlp_opti_22_type_vals[] = {
603 { 0x01, "Rate Reply" },
604 { 0x02, "Rate Request" },
605 { 0x03, "Rate Request/Rate Reply" },
609 static const value_string sna_nlp_opti_22_raa_vals[] = {
611 { 0x01, "Restraint" },
612 { 0x02, "Slowdown1" },
613 { 0x03, "Slowdown2" },
614 { 0x04, "Critical" },
618 static const value_string sna_nlp_opti_22_arb_vals[] = {
619 { 0x00, "Base Mode ARB" },
620 { 0x01, "Responsive Mode ARB" },
624 /* GDS Variable Type */
625 static const value_string sna_gds_var_vals[] = {
626 { 0x1210, "Change Number Of Sessions" },
627 { 0x1211, "Exchange Log Name" },
628 { 0x1212, "Control Point Management Services Unit" },
629 { 0x1213, "Compare States" },
630 { 0x1214, "LU Names Position" },
631 { 0x1215, "LU Name" },
632 { 0x1217, "Do Know" },
633 { 0x1218, "Partner Restart" },
634 { 0x1219, "Don't Know" },
635 { 0x1220, "Sign-Off" },
636 { 0x1221, "Sign-On" },
637 { 0x1222, "SNMP-over-SNA" },
638 { 0x1223, "Node Address Service" },
639 { 0x12C1, "CP Capabilities" },
640 { 0x12C2, "Topology Database Update" },
641 { 0x12C3, "Register Resource" },
642 { 0x12C4, "Locate" },
643 { 0x12C5, "Cross-Domain Initiate" },
644 { 0x12C9, "Delete Resource" },
645 { 0x12CA, "Find Resource" },
646 { 0x12CB, "Found Resource" },
647 { 0x12CC, "Notify" },
648 { 0x12CD, "Initiate-Other Cross-Domain" },
649 { 0x12CE, "Route Setup" },
650 { 0x12E1, "Error Log" },
651 { 0x12F1, "Null Data" },
652 { 0x12F2, "User Control Date" },
653 { 0x12F3, "Map Name" },
654 { 0x12F4, "Error Data" },
655 { 0x12F6, "Authentication Token Data" },
656 { 0x12F8, "Service Flow Authentication Token Data" },
657 { 0x12FF, "Application Data" },
658 { 0x1310, "MDS Message Unit" },
659 { 0x1311, "MDS Routing Information" },
660 { 0x1500, "FID2 Encapsulation" },
664 /* Control Vector Type */
665 static const value_string sna_control_vals[] = {
666 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
667 { 0x01, "Date-Time Control Vector" },
668 { 0x02, "Subarea Routing Control Vector" },
669 { 0x03, "SDLC Secondary Station Control Vector" },
670 { 0x04, "LU Control Vector" },
671 { 0x05, "Channel Control Vector" },
672 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
673 { 0x07, "PU FMD-RU-Usage Control Vector" },
674 { 0x08, "Intensive Mode Control Vector" },
675 { 0x09, "Activation Request / Response Sequence Identifier Control"
677 { 0x0a, "User Request Correlator Control Vector" },
678 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
679 { 0x0c, "LU-LU Session Capabilities Control Vector" },
680 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
682 { 0x0e, "Network Name Control Vector" },
683 { 0x0f, "Link Capabilities and Status Control Vector" },
684 { 0x10, "Product Set ID Control Vector" },
685 { 0x11, "Load Module Correlation Control Vector" },
686 { 0x12, "Network Identifier Control Vector" },
687 { 0x13, "Gateway Support Capabilities Control Vector" },
688 { 0x14, "Session Initiation Control Vector" },
689 { 0x15, "Network-Qualified Address Pair Control Vector" },
690 { 0x16, "Names Substitution Control Vector" },
691 { 0x17, "SSCP Identifier Control Vector" },
692 { 0x18, "SSCP Name Control Vector" },
693 { 0x19, "Resource Identifier Control Vector" },
694 { 0x1a, "NAU Address Control Vector" },
695 { 0x1b, "VRID List Control Vector" },
696 { 0x1c, "Network-Qualified Name Pair Control Vector" },
697 { 0x1e, "VR-ER Mapping Data Control Vector" },
698 { 0x1f, "ER Configuration Control Vector" },
699 { 0x23, "Local-Form Session Identifier Control Vector" },
700 { 0x24, "IPL Load Module Request Control Vector" },
701 { 0x25, "Security ID Control Control Vector" },
702 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
703 { 0x27, "XRF Session Activation Control Vector" },
704 { 0x28, "Related Session Identifier Control Vector" },
705 { 0x29, "Session State Data Control Vector" },
706 { 0x2a, "Session Information Control Vector" },
707 { 0x2b, "Route Selection Control Vector" },
708 { 0x2c, "COS/TPF Control Vector" },
709 { 0x2d, "Mode Control Vector" },
710 { 0x2f, "LU Definition Control Vector" },
711 { 0x30, "Assign LU Characteristics Control Vector" },
712 { 0x31, "BIND Image Control Vector" },
713 { 0x32, "Short-Hold Mode Control Vector" },
714 { 0x33, "ENCP Search Control Control Vector" },
715 { 0x34, "LU Definition Override Control Vector" },
716 { 0x35, "Extended Sense Data Control Vector" },
717 { 0x36, "Directory Error Control Vector" },
718 { 0x37, "Directory Entry Correlator Control Vector" },
719 { 0x38, "Short-Hold Mode Emulation Control Vector" },
720 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
722 { 0x3a, "Route Status Data Control Vector" },
723 { 0x3b, "VR Congestion Data Control Vector" },
724 { 0x3c, "Associated Resource Entry Control Vector" },
725 { 0x3d, "Directory Entry Control Vector" },
726 { 0x3e, "Directory Entry Characteristic Control Vector" },
727 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
728 { 0x40, "Real Associated Resource Control Vector" },
729 { 0x41, "Station Parameters Control Vector" },
730 { 0x42, "Dynamic Path Update Data Control Vector" },
731 { 0x43, "Extended SDLC Station Control Vector" },
732 { 0x44, "Node Descriptor Control Vector" },
733 { 0x45, "Node Characteristics Control Vector" },
734 { 0x46, "TG Descriptor Control Vector" },
735 { 0x47, "TG Characteristics Control Vector" },
736 { 0x48, "Topology Resource Descriptor Control Vector" },
737 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
739 { 0x4a, "Real Owning Control Point Control Vector" },
740 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
741 { 0x51, "DLUR/S Capabilities Control Vector" },
742 { 0x52, "Primary Send Pacing Window Size Control Vector" },
743 { 0x56, "Call Security Verification Control Vector" },
744 { 0x57, "DLC Connection Data Control Vector" },
745 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
746 { 0x5a, "Session Services Extension Support Control Vector" },
747 { 0x5b, "Interchange Node Support Control Vector" },
748 { 0x5c, "APPN Message Transport Control Vector" },
749 { 0x5d, "Subarea Message Transport Control Vector" },
750 { 0x5e, "Related Request Control Vector" },
751 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
752 { 0x60, "Fully Qualified PCID Control Vector" },
753 { 0x61, "HPR Capabilities Control Vector" },
754 { 0x62, "Session Address Control Vector" },
755 { 0x63, "Cryptographic Key Distribution Control Vector" },
756 { 0x64, "TCP/IP Information Control Vector" },
757 { 0x65, "Device Characteristics Control Vector" },
758 { 0x66, "Length-Checked Compression Control Vector" },
759 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
760 { 0x68, "XRF/Session Cryptography Control Vector" },
761 { 0x69, "Switched Parameters Control Vector" },
762 { 0x6a, "ER Congestion Data Control Vector" },
763 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
764 { 0xfe, "Control Vector Keys Not Recognized" },
768 static const value_string sna_control_hpr_vals[] = {
769 { 0x00, "Node Identifier Control Vector" },
770 { 0x03, "Network ID Control Vector" },
771 { 0x05, "Network Address Control Vector" },
775 static const value_string sna_control_0e_type_vals[] = {
779 { 0xF5, "SSCP Name" },
780 { 0xF6, "NNCP Name" },
781 { 0xF7, "Link Station Name" },
782 { 0xF8, "CP Name of CP(PLU)" },
783 { 0xF9, "CP Name of CP(SLU)" },
784 { 0xFA, "Generic Name" },
788 /* Values to direct the top-most dissector what to dissect
790 enum next_dissection_enum {
801 typedef enum next_dissection_enum next_dissection_t;
803 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
804 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
805 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
806 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
807 static void dissect_rh (tvbuff_t*, int, proto_tree*);
808 static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
810 /* --------------------------------------------------------------------
811 * Chapter 2 High-Performance Routing (HPR) Headers
812 * --------------------------------------------------------------------
816 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
818 int bits, offset, len, pad;
819 proto_tree *sub_tree;
820 proto_item *sub_ti = NULL;
825 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
826 bits = tvb_get_guint8(tvb, 4);
828 sub_ti = proto_tree_add_uint(tree, hf_sna_nlp_opti_0d_4,
830 sub_tree = proto_item_add_subtree(sub_ti,
831 ett_sna_nlp_opti_0d_4);
833 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_target,
835 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_arb,
837 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_reliable,
839 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0d_dedicated,
842 proto_tree_add_text(tree, tvb, 5, 3, "Reserved");
846 while (tvb_offset_exists(tvb, offset)) {
847 len = tvb_get_guint8(tvb, offset+0);
849 dissect_control(tvb, offset, len, tree, 1, LT);
850 pad = (len+3) & 0xfffc;
852 proto_tree_add_text(tree, tvb, offset+len,
856 /* Avoid endless loop */
863 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
866 proto_tree *sub_tree;
867 proto_item *sub_ti = NULL;
869 bits = tvb_get_guint8(tvb, 2);
873 sub_ti = proto_tree_add_item(tree, hf_sna_nlp_opti_0e_stat,
874 tvb, 2, 1, ENC_BIG_ENDIAN);
875 sub_tree = proto_item_add_subtree(sub_ti,
876 ett_sna_nlp_opti_0e_stat);
878 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_gap,
880 proto_tree_add_boolean(sub_tree, hf_sna_nlp_opti_0e_idle,
882 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
883 tvb, 3, 1, ENC_BIG_ENDIAN);
884 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
885 tvb, 4, 2, ENC_BIG_ENDIAN);
886 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
887 tvb, 6, 2, ENC_BIG_ENDIAN);
888 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
889 tvb, 8, 4, ENC_BIG_ENDIAN);
890 proto_tree_add_text(tree, tvb, 12, 8, "Reserved");
892 if (tvb_offset_exists(tvb, offset))
893 call_dissector(data_handle,
894 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
897 col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
899 col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
904 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
909 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
910 if (tvb_offset_exists(tvb, 4))
911 call_dissector(data_handle,
912 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
916 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
921 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
922 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
923 if (tvb_offset_exists(tvb, 12))
924 call_dissector(data_handle,
925 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
929 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
934 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
935 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
939 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
941 proto_tree *sub_tree, *bf_tree;
942 proto_item *sub_item, *bf_item;
943 int len, pad, type, bits, offset, num, sublen;
948 proto_tree_add_text(tree, tvb, 2, 2, "Reserved");
952 len = tvb_get_guint8(tvb, offset);
953 type = tvb_get_guint8(tvb, offset+1);
955 if ((type != 0x83) || (len <= 16)) {
957 call_dissector(data_handle,
958 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
961 sub_item = proto_tree_add_text(tree, tvb, offset, len,
962 "Switching Information Control Vector");
963 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_si);
965 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
966 tvb, offset, 1, len);
967 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
968 tvb, offset+1, 1, type);
970 bits = tvb_get_guint8(tvb, offset+2);
971 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_2,
972 tvb, offset+2, 1, bits);
973 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_si_2);
975 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_refifo,
976 tvb, offset+2, 1, bits);
977 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mobility,
978 tvb, offset+2, 1, bits);
979 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_dirsearch,
980 tvb, offset+2, 1, bits);
981 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_limitres,
982 tvb, offset+2, 1, bits);
983 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_ncescope,
984 tvb, offset+2, 1, bits);
985 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_si_mnpsrscv,
986 tvb, offset+2, 1, bits);
988 proto_tree_add_text(sub_tree, tvb, offset+3, 1, "Reserved");
989 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
990 tvb, offset+4, 4, ENC_BIG_ENDIAN);
991 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
992 tvb, offset+8, 4, ENC_BIG_ENDIAN);
993 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
994 tvb, offset+12, 4, ENC_BIG_ENDIAN);
996 dissect_control(tvb, offset+16, len-16, sub_tree, 1, LT);
998 pad = (len+3) & 0xfffc;
1000 proto_tree_add_text(sub_tree, tvb, offset+len, pad-len,
1004 len = tvb_get_guint8(tvb, offset);
1005 type = tvb_get_guint8(tvb, offset+1);
1007 if ((type != 0x85) || ( len < 4)) {
1009 call_dissector(data_handle,
1010 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1013 sub_item = proto_tree_add_text(tree, tvb, offset, len,
1014 "Return Route TG Descriptor Control Vector");
1015 sub_tree = proto_item_add_subtree(sub_item, ett_sna_nlp_opti_14_rr);
1017 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1018 tvb, offset, 1, len);
1019 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1020 tvb, offset+1, 1, type);
1022 bits = tvb_get_guint8(tvb, offset+2);
1023 bf_item = proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_2,
1024 tvb, offset+2, 1, bits);
1025 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_14_rr_2);
1027 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_14_rr_bfe,
1028 tvb, offset+2, 1, bits);
1030 num = tvb_get_guint8(tvb, offset+3);
1032 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1033 tvb, offset+3, 1, num);
1038 sublen = tvb_get_guint8(tvb, offset);
1040 dissect_control(tvb, offset, sublen, sub_tree, 1, LT);
1043 call_dissector(data_handle,
1044 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1047 /* No padding here */
1054 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1056 proto_tree *bf_tree;
1057 proto_item *bf_item;
1063 bits = tvb_get_guint8(tvb, 2);
1064 type = (bits & 0xc0) >> 6;
1066 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_2,
1068 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_2);
1070 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_type,
1072 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raa,
1074 proto_tree_add_boolean(bf_tree, hf_sna_nlp_opti_22_parity,
1076 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_arb,
1079 bits = tvb_get_guint8(tvb, 3);
1081 bf_item = proto_tree_add_uint(tree, hf_sna_nlp_opti_22_3,
1083 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_opti_22_3);
1085 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_ratereq,
1087 proto_tree_add_uint(bf_tree, hf_sna_nlp_opti_22_raterep,
1090 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1091 tvb, 4, 4, ENC_BIG_ENDIAN);
1092 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1093 tvb, 8, 4, ENC_BIG_ENDIAN);
1096 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1097 tvb, 12, 4, ENC_BIG_ENDIAN);
1098 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1099 tvb, 16, 4, ENC_BIG_ENDIAN);
1101 if (tvb_offset_exists(tvb, 20))
1102 call_dissector(data_handle,
1103 tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1105 if (tvb_offset_exists(tvb, 12))
1106 call_dissector(data_handle,
1107 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1112 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1114 proto_tree *sub_tree;
1115 proto_item *sub_item;
1116 int offset, type, len;
1123 while (tvb_offset_exists(tvb, offset)) {
1124 len = tvb_get_guint8(tvb, offset);
1125 type = tvb_get_guint8(tvb, offset+1);
1127 /* Prevent loop for invalid crap in packet */
1130 call_dissector(data_handle,
1131 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1135 ett = ett_sna_nlp_opti_un;
1136 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1137 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1138 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1139 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1140 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1141 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1142 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1144 sub_item = proto_tree_add_text(tree, tvb,
1145 offset, len << 2, "%s",
1146 val_to_str(type, sna_nlp_opti_vals,
1147 "Unknown Segment Type"));
1148 sub_tree = proto_item_add_subtree(sub_item, ett);
1149 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1150 tvb, offset, 1, len);
1151 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1152 tvb, offset+1, 1, type);
1156 dissect_optional_0d(tvb_new_subset(tvb, offset,
1157 len << 2, -1), sub_tree);
1160 dissect_optional_0e(tvb_new_subset(tvb, offset,
1161 len << 2, -1), pinfo, sub_tree);
1164 dissect_optional_0f(tvb_new_subset(tvb, offset,
1165 len << 2, -1), pinfo, sub_tree);
1168 dissect_optional_10(tvb_new_subset(tvb, offset,
1169 len << 2, -1), pinfo, sub_tree);
1172 dissect_optional_12(tvb_new_subset(tvb, offset,
1173 len << 2, -1), sub_tree);
1176 dissect_optional_14(tvb_new_subset(tvb, offset,
1177 len << 2, -1), pinfo, sub_tree);
1180 dissect_optional_22(tvb_new_subset(tvb, offset,
1181 len << 2, -1), pinfo, sub_tree);
1184 call_dissector(data_handle,
1185 tvb_new_subset(tvb, offset,
1186 len << 2, -1), pinfo, sub_tree);
1188 offset += (len << 2);
1193 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1194 proto_tree *parent_tree)
1196 proto_tree *nlp_tree, *bf_tree;
1197 proto_item *nlp_item, *bf_item;
1198 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1199 guint32 thdr_len, thdr_dlf;
1202 int indx = 0, counter = 0;
1207 nhdr_0 = tvb_get_guint8(tvb, indx);
1208 nhdr_1 = tvb_get_guint8(tvb, indx+1);
1210 col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1213 /* Don't bother setting length. We'll set it later after we
1214 * find the lengths of NHDR */
1215 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1217 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1219 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_0, tvb,
1221 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_0);
1223 proto_tree_add_uint(bf_tree, hf_sna_nlp_sm, tvb, indx, 1,
1225 proto_tree_add_uint(bf_tree, hf_sna_nlp_tpf, tvb, indx, 1,
1228 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_nhdr_1, tvb,
1230 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_nhdr_1);
1232 proto_tree_add_uint(bf_tree, hf_sna_nlp_ft, tvb,
1234 proto_tree_add_boolean(bf_tree, hf_sna_nlp_tspi, tvb,
1236 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn1, tvb,
1238 proto_tree_add_boolean(bf_tree, hf_sna_nlp_slowdn2, tvb,
1241 /* ANR or FR lists */
1246 if ((nhdr_0 & 0xe0) == 0xa0) {
1248 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1250 } while (nhdr_x != 0xff);
1252 proto_tree_add_item(nlp_tree,
1253 hf_sna_nlp_fra, tvb, indx, counter, ENC_NA);
1256 proto_tree_add_text(nlp_tree, tvb, indx, 1,
1261 proto_item_set_len(nlp_item, indx);
1263 if ((nhdr_1 & 0xf0) == 0x10) {
1264 nhdr_x = tvb_get_guint8(tvb, indx);
1266 proto_tree_add_uint(tree, hf_sna_nlp_frh,
1267 tvb, indx, 1, nhdr_x);
1270 if (tvb_offset_exists(tvb, indx))
1271 call_dissector(data_handle,
1272 tvb_new_subset_remaining(tvb, indx),
1273 pinfo, parent_tree);
1277 if ((nhdr_0 & 0xe0) == 0xc0) {
1279 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1281 } while (nhdr_x != 0xff);
1283 proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1284 tvb, indx, counter, ENC_NA);
1288 proto_tree_add_text(nlp_tree, tvb, indx, 1,
1293 proto_item_set_len(nlp_item, indx);
1296 thdr_8 = tvb_get_guint8(tvb, indx+8);
1297 thdr_9 = tvb_get_guint8(tvb, indx+9);
1298 thdr_len = tvb_get_ntohs(tvb, indx+10);
1299 thdr_dlf = tvb_get_ntohl(tvb, indx+12);
1302 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1303 indx, thdr_len << 2, ENC_NA);
1304 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1306 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1308 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_8, tvb,
1310 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_8);
1312 proto_tree_add_boolean(bf_tree, hf_sna_nlp_setupi, tvb,
1314 proto_tree_add_boolean(bf_tree, hf_sna_nlp_somi, tvb, indx+8,
1316 proto_tree_add_boolean(bf_tree, hf_sna_nlp_eomi, tvb, indx+8,
1318 proto_tree_add_boolean(bf_tree, hf_sna_nlp_sri, tvb, indx+8,
1320 proto_tree_add_boolean(bf_tree, hf_sna_nlp_rasapi, tvb,
1322 proto_tree_add_boolean(bf_tree, hf_sna_nlp_retryi, tvb,
1325 bf_item = proto_tree_add_uint(nlp_tree, hf_sna_nlp_thdr_9, tvb,
1327 bf_tree = proto_item_add_subtree(bf_item, ett_sna_nlp_thdr_9);
1329 proto_tree_add_boolean(bf_tree, hf_sna_nlp_lmi, tvb, indx+9,
1331 proto_tree_add_boolean(bf_tree, hf_sna_nlp_cqfi, tvb, indx+9,
1333 proto_tree_add_boolean(bf_tree, hf_sna_nlp_osi, tvb, indx+9,
1336 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, indx+10,
1338 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, indx+12,
1340 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, indx+16,
1345 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindx)) {
1346 counter = tvb_get_guint8(tvb, indx + subindx);
1347 if (tvb_get_guint8(tvb, indx+subindx+1) == 5)
1348 dissect_control(tvb, indx + subindx, counter+2, nlp_tree, 1, LT);
1350 call_dissector(data_handle,
1351 tvb_new_subset(tvb, indx + subindx, counter+2,
1352 -1), pinfo, nlp_tree);
1354 subindx += (counter+2);
1356 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindx))
1358 tvb_new_subset(tvb, indx + subindx,
1359 (thdr_len << 2) - subindx, -1),
1362 indx += (thdr_len << 2);
1363 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1364 col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1365 if (tvb_offset_exists(tvb, indx)) {
1366 call_dissector(data_handle,
1367 tvb_new_subset_remaining(tvb, indx), pinfo,
1372 if (tvb_offset_exists(tvb, indx)) {
1373 /* Transmission Header Format Identifier */
1374 fid = hi_nibble(tvb_get_guint8(tvb, indx));
1375 if (fid == 5) /* Only FID5 allowed for HPR */
1376 dissect_fid(tvb_new_subset_remaining(tvb, indx), pinfo,
1379 if (tvb_get_ntohs(tvb, indx+2) == 0x12ce) {
1381 col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1382 dissect_gds(tvb_new_subset_remaining(tvb, indx),
1383 pinfo, tree, parent_tree);
1385 call_dissector(data_handle,
1386 tvb_new_subset_remaining(tvb, indx),
1387 pinfo, parent_tree);
1392 /* --------------------------------------------------------------------
1393 * Chapter 3 Exchange Identification (XID) Information Fields
1394 * --------------------------------------------------------------------
1398 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1403 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1408 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1415 dlen = tvb_get_guint8(tvb, 0);
1419 while (tvb_offset_exists(tvb, offset)) {
1420 dlen = tvb_get_guint8(tvb, offset+1);
1421 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1422 offset += (dlen + 2);
1427 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1429 proto_tree *sub_tree;
1430 proto_item *sub_ti = NULL;
1431 guint val, dlen, offset;
1436 proto_tree_add_text(tree, tvb, 0, 2, "Reserved");
1438 val = tvb_get_ntohs(tvb, 2);
1440 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_8, tvb,
1442 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_8);
1444 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_init_self, tvb, 2, 2,
1446 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_stand_bind, tvb, 2, 2,
1448 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_gener_bind, tvb, 2, 2,
1450 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_recve_bind, tvb, 2, 2,
1452 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_actpu, tvb, 2, 2, val);
1453 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nwnode, tvb, 2, 2, val);
1454 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cp, tvb, 2, 2, val);
1455 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpcp, tvb, 2, 2, val);
1456 proto_tree_add_uint(sub_tree, hf_sna_xid_3_state, tvb, 2, 2, val);
1457 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_nonact, tvb, 2, 2, val);
1458 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_cpchange, tvb, 2, 2,
1461 val = tvb_get_guint8(tvb, 4);
1463 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_10, tvb,
1465 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_10);
1467 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_asend_bind, tvb, 4, 1,
1469 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_arecv_bind, tvb, 4, 1,
1471 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_quiesce, tvb, 4, 1, val);
1472 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pucap, tvb, 4, 1, val);
1473 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_pbn, tvb, 4, 1, val);
1474 proto_tree_add_uint(sub_tree, hf_sna_xid_3_pacing, tvb, 4, 1, val);
1476 val = tvb_get_guint8(tvb, 5);
1478 sub_ti = proto_tree_add_uint(tree, hf_sna_xid_3_11, tvb,
1480 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_11);
1482 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_tgshare, tvb, 5, 1, val);
1483 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dedsvc, tvb, 5, 1, val);
1485 val = tvb_get_guint8(tvb, 6);
1487 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_12, tvb,
1488 6, 1, ENC_BIG_ENDIAN);
1489 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_12);
1491 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcsup, tvb, 6, 1, val);
1492 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_negcomp, tvb, 6, 1, val);
1494 proto_tree_add_text(tree, tvb, 7, 2, "Reserved");
1496 val = tvb_get_guint8(tvb, 9);
1498 sub_ti = proto_tree_add_item(tree, hf_sna_xid_3_15, tvb,
1499 9, 1, ENC_BIG_ENDIAN);
1500 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_3_15);
1502 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_partg, tvb, 9, 1, val);
1503 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlur, tvb, 9, 1, val);
1504 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_dlus, tvb, 9, 1, val);
1505 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_exbn, tvb, 9, 1, val);
1506 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_genodai, tvb, 9, 1, val);
1507 proto_tree_add_uint(sub_tree, hf_sna_xid_3_branch, tvb, 9, 1, val);
1508 proto_tree_add_boolean(sub_tree, hf_sna_xid_3_brnn, tvb, 9, 1, val);
1510 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1511 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1513 dlen = tvb_get_guint8(tvb, 12);
1515 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1517 /* FIXME: DLC Dependent Data Go Here */
1521 while (tvb_offset_exists(tvb, offset)) {
1522 dlen = tvb_get_guint8(tvb, offset+1);
1523 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1529 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1530 proto_tree *parent_tree)
1532 proto_tree *sub_tree;
1533 proto_item *sub_ti = NULL;
1534 int format, type, len;
1537 len = tvb_get_guint8(tvb, 1);
1538 type = tvb_get_guint8(tvb, 0);
1539 id = tvb_get_ntohl(tvb, 2);
1540 format = hi_nibble(type);
1542 /* Summary information */
1543 if (check_col(pinfo->cinfo, COL_INFO))
1544 col_add_fstr(pinfo->cinfo, COL_INFO,
1545 "SNA XID Format:%d Type:%s", format,
1546 val_to_str_const(lo_nibble(type), sna_xid_type_vals,
1550 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1551 0, 1, ENC_BIG_ENDIAN);
1552 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1554 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1556 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1559 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1561 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1562 2, 4, ENC_BIG_ENDIAN);
1563 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1565 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1567 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1574 dissect_xid1(tvb_new_subset(tvb, 6, len-6, -1),
1578 dissect_xid2(tvb_new_subset(tvb, 6, len-6, -1),
1582 dissect_xid3(tvb_new_subset(tvb, 6, len-6, -1),
1586 /* external standards organizations */
1587 call_dissector(data_handle,
1588 tvb_new_subset(tvb, 6, len-6, -1),
1596 if (tvb_offset_exists(tvb, len))
1597 call_dissector(data_handle,
1598 tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1601 /* --------------------------------------------------------------------
1602 * Chapter 4 Transmission Headers (THs)
1603 * --------------------------------------------------------------------
1609 mpf_value(guint8 th_byte)
1611 return (th_byte & 0x0c) >> 2;
1614 #define FIRST_FRAG_NUMBER 0
1615 #define MIDDLE_FRAG_NUMBER 1
1616 #define LAST_FRAG_NUMBER 2
1618 /* FID2 is defragged by sequence. The weird thing is that we have neither
1619 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1620 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1621 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1622 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1623 * and 2. However, if the BIU is split into 2 frames, then we only have
1624 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1627 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1628 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1629 * see the FTP URL in the comment near the top of this file). I *think*
1630 * this means that the fragmented frames cannot arrive out of order.
1631 * Well, I *want* it to mean this, because w/o this limitation, if you
1632 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1633 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1634 * arrive in order, then we're saved.
1636 * The problem then boils down to figuring out if "LAST" means frag-number 1
1637 * (in the case of a BIU split into 2 frames) or frag-number 2
1638 * (in the case of a BIU split into 3 frames).
1640 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1641 * way to handle the mapping of "LAST" to either frag-number 1 or
1642 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1643 * This consumes resources. A trickier way, but a way which works, is to
1644 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1645 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1646 * and the reassembly code tells us that the the BIU is still not reassmebled,
1647 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1648 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1649 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1650 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1651 * to complete the reassembly.
1654 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1657 fragment_data *fd_head;
1658 int frag_number = -1;
1659 int more_frags = TRUE;
1660 tvbuff_t *rh_tvb = NULL;
1663 /* Determine frag_number and more_frags */
1668 case MPF_FIRST_SEGMENT:
1669 frag_number = FIRST_FRAG_NUMBER;
1671 case MPF_MIDDLE_SEGMENT:
1672 frag_number = MIDDLE_FRAG_NUMBER;
1674 case MPF_LAST_SEGMENT:
1675 frag_number = LAST_FRAG_NUMBER;
1679 DISSECTOR_ASSERT_NOT_REACHED();
1682 /* If sna_defragment is on, and this is a fragment.. */
1683 if (frag_number > -1) {
1684 /* XXX - check length ??? */
1685 frag_len = tvb_reported_length_remaining(tvb, offset);
1686 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1687 fd_head = fragment_add_seq(tvb, offset, pinfo, id,
1688 sna_fragment_table, frag_number, frag_len,
1691 /* We added the LAST segment and reassembly didn't
1692 * complete. Insert a zero-length MIDDLE segment to
1693 * turn a 2-frame BIU-fragmentation into a 3-frame
1694 * BIU-fragmentation (empty middle frag).
1695 * See above long comment about this trickery. */
1697 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1698 fd_head = fragment_add_seq(tvb, offset, pinfo,
1699 id, sna_fragment_table,
1700 MIDDLE_FRAG_NUMBER, 0, TRUE);
1703 if (fd_head != NULL) {
1704 /* We have the complete reassembled payload. */
1705 rh_tvb = tvb_new_child_real_data(tvb, fd_head->data,
1706 fd_head->len, fd_head->len);
1708 /* Add the defragmented data to the data
1710 add_new_data_source(pinfo, rh_tvb,
1711 "Reassembled SNA BIU");
1718 #define SNA_FID01_ADDR_LEN 2
1720 /* FID Types 0 and 1 */
1722 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1724 proto_tree *bf_tree;
1725 proto_item *bf_item;
1729 const int bytes_in_header = 10;
1733 th_0 = tvb_get_guint8(tvb, 0);
1734 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1736 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1738 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1739 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1740 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1743 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1746 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1750 ptr = tvb_get_ptr(tvb, 2, SNA_FID01_ADDR_LEN);
1751 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1752 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1755 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1758 ptr = tvb_get_ptr(tvb, 4, SNA_FID01_ADDR_LEN);
1759 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1760 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID01_ADDR_LEN, ptr);
1762 /* If we're not filling a proto_tree, return now */
1764 return bytes_in_header;
1766 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1767 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1769 return bytes_in_header;
1772 #define SNA_FID2_ADDR_LEN 1
1776 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1777 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1779 proto_tree *bf_tree;
1780 proto_item *bf_item;
1781 guint8 th_0=0, daf=0, oaf=0;
1783 unsigned int mpf, id;
1785 const int bytes_in_header = 6;
1787 th_0 = tvb_get_guint8(tvb, 0);
1788 mpf = mpf_value(th_0);
1791 daf = tvb_get_guint8(tvb, 2);
1792 oaf = tvb_get_guint8(tvb, 3);
1795 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1797 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1799 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1800 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1801 proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0);
1802 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1806 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
1809 proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf,
1810 "Destination Address Field: 0x%02x", daf);
1814 ptr = tvb_get_ptr(tvb, 2, SNA_FID2_ADDR_LEN);
1815 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1816 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1820 proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf,
1821 "Origin Address Field: 0x%02x", oaf);
1825 ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN);
1826 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1827 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr);
1829 id = tvb_get_ntohs(tvb, 4);
1831 proto_tree_add_uint(tree, hf_sna_th_snf, tvb, 4, 2, id);
1833 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1834 if (mpf == MPF_FIRST_SEGMENT) {
1835 *continue_dissecting = rh_only;
1837 *continue_dissecting = stop_here;
1841 else if (sna_defragment) {
1842 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1843 bytes_in_header, mpf, id);
1846 return bytes_in_header;
1851 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1853 proto_tree *bf_tree;
1854 proto_item *bf_item;
1857 const int bytes_in_header = 2;
1859 /* If we're not filling a proto_tree, return now */
1861 return bytes_in_header;
1863 th_0 = tvb_get_guint8(tvb, 0);
1865 /* Create the bitfield tree */
1866 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1867 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1869 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1870 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1871 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1873 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1875 return bytes_in_header;
1879 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1881 proto_tree *bf_tree;
1882 proto_item *bf_item;
1884 guint8 th_byte, mft;
1888 static struct sna_fid_type_4_addr src, dst; /* has to be static due to SET_ADDRESS */
1890 const int bytes_in_header = 26;
1892 /* If we're not filling a proto_tree, return now */
1894 return bytes_in_header;
1896 th_byte = tvb_get_guint8(tvb, offset);
1898 /* Create the bitfield tree */
1899 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, offset,
1901 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1904 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb,
1905 offset, 1, th_byte);
1906 proto_tree_add_uint(bf_tree, hf_sna_th_tg_sweep, tvb,
1907 offset, 1, th_byte);
1908 proto_tree_add_uint(bf_tree, hf_sna_th_er_vr_supp_ind, tvb,
1909 offset, 1, th_byte);
1910 proto_tree_add_uint(bf_tree, hf_sna_th_vr_pac_cnt_ind, tvb,
1911 offset, 1, th_byte);
1912 proto_tree_add_uint(bf_tree, hf_sna_th_ntwk_prty, tvb,
1913 offset, 1, th_byte);
1916 th_byte = tvb_get_guint8(tvb, offset);
1918 /* Create the bitfield tree */
1919 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1920 "Transmission Header Byte 1");
1921 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1924 proto_tree_add_uint(bf_tree, hf_sna_th_tgsf, tvb, offset, 1,
1926 proto_tree_add_boolean(bf_tree, hf_sna_th_mft, tvb, offset, 1,
1928 proto_tree_add_uint(bf_tree, hf_sna_th_piubf, tvb, offset, 1,
1931 mft = th_byte & 0x04;
1933 th_byte = tvb_get_guint8(tvb, offset);
1935 /* Create the bitfield tree */
1936 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1937 "Transmission Header Byte 2");
1938 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1942 proto_tree_add_uint(bf_tree, hf_sna_th_nlpoi, tvb,
1943 offset, 1, th_byte);
1944 proto_tree_add_uint(bf_tree, hf_sna_th_nlp_cp, tvb,
1945 offset, 1, th_byte);
1947 proto_tree_add_uint(bf_tree, hf_sna_th_iern, tvb,
1948 offset, 1, th_byte);
1950 proto_tree_add_uint(bf_tree, hf_sna_th_ern, tvb, offset, 1,
1954 th_byte = tvb_get_guint8(tvb, offset);
1956 /* Create the bitfield tree */
1957 bf_item = proto_tree_add_text(tree, tvb, offset, 1,
1958 "Transmission Header Byte 3");
1959 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1962 proto_tree_add_uint(bf_tree, hf_sna_th_vrn, tvb, offset, 1,
1964 proto_tree_add_uint(bf_tree, hf_sna_th_tpf, tvb, offset, 1,
1968 th_word = tvb_get_ntohs(tvb, offset);
1970 /* Create the bitfield tree */
1971 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1972 "Transmission Header Bytes 4-5");
1973 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1976 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwi, tvb,
1977 offset, 2, th_word);
1978 proto_tree_add_boolean(bf_tree, hf_sna_th_tg_nonfifo_ind, tvb,
1979 offset, 2, th_word);
1980 proto_tree_add_uint(bf_tree, hf_sna_th_vr_sqti, tvb,
1981 offset, 2, th_word);
1983 /* I'm not sure about byte-order on this one... */
1984 proto_tree_add_uint(bf_tree, hf_sna_th_tg_snf, tvb,
1985 offset, 2, th_word);
1988 th_word = tvb_get_ntohs(tvb, offset);
1990 /* Create the bitfield tree */
1991 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
1992 "Transmission Header Bytes 6-7");
1993 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1996 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprq, tvb, offset,
1998 proto_tree_add_boolean(bf_tree, hf_sna_th_vrprs, tvb, offset,
2000 proto_tree_add_uint(bf_tree, hf_sna_th_vr_cwri, tvb, offset,
2002 proto_tree_add_boolean(bf_tree, hf_sna_th_vr_rwi, tvb, offset,
2005 /* I'm not sure about byte-order on this one... */
2006 proto_tree_add_uint(bf_tree, hf_sna_th_vr_snf_send, tvb,
2007 offset, 2, th_word);
2011 dsaf = tvb_get_ntohl(tvb, 8);
2013 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
2017 osaf = tvb_get_ntohl(tvb, 12);
2019 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
2022 th_byte = tvb_get_guint8(tvb, offset);
2024 /* Create the bitfield tree */
2025 bf_item = proto_tree_add_text(tree, tvb, offset, 2,
2026 "Transmission Header Byte 16");
2027 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2030 proto_tree_add_boolean(bf_tree, hf_sna_th_snai, tvb, offset, 1, th_byte);
2032 /* We luck out here because in their infinite wisdom the SNA
2033 * architects placed the MPF and EFI fields in the same bitfield
2034 * locations, even though for FID4 they're not in byte 0.
2036 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, offset, 1, th_byte);
2037 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, offset, 1, th_byte);
2040 /* 1 for byte 16, 1 for byte 17 which is reserved */
2042 def = tvb_get_ntohs(tvb, 18);
2044 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
2046 /* Addresses in FID 4 are discontiguous, sigh */
2049 SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2051 SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2054 oef = tvb_get_ntohs(tvb, 20);
2055 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
2057 /* Addresses in FID 4 are discontiguous, sigh */
2060 SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2062 SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
2065 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
2066 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
2068 return bytes_in_header;
2073 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
2075 proto_tree *bf_tree;
2076 proto_item *bf_item;
2079 const int bytes_in_header = 12;
2081 /* If we're not filling a proto_tree, return now */
2083 return bytes_in_header;
2085 th_0 = tvb_get_guint8(tvb, 0);
2087 /* Create the bitfield tree */
2088 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2089 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2091 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2092 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
2093 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
2095 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2096 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
2098 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
2100 return bytes_in_header;
2106 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2108 proto_tree *bf_tree;
2109 proto_item *bf_item;
2112 const int bytes_in_header = 26;
2114 /* If we're not filling a proto_tree, return now */
2116 return bytes_in_header;
2118 th_0 = tvb_get_guint8(tvb, 0);
2120 /* Create the bitfield tree */
2121 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2122 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2124 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2125 proto_tree_add_text(tree, tvb, 1, 1, "Reserved");
2127 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, ENC_BIG_ENDIAN);
2128 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2129 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, ENC_BIG_ENDIAN);
2131 /* Yup, bytes 6-23 are reserved! */
2132 proto_tree_add_text(tree, tvb, 6, 18, "Reserved");
2134 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2136 return bytes_in_header;
2140 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2141 proto_tree *parent_tree)
2144 proto_tree *th_tree = NULL, *rh_tree = NULL;
2145 proto_item *th_ti = NULL, *rh_ti = NULL;
2147 int th_header_len = 0;
2148 int offset, rh_offset;
2149 tvbuff_t *rh_tvb = NULL;
2150 next_dissection_t continue_dissecting = everything;
2152 /* Transmission Header Format Identifier */
2153 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
2155 /* Summary information */
2156 if (check_col(pinfo->cinfo, COL_INFO))
2157 col_add_str(pinfo->cinfo, COL_INFO,
2158 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2162 /* Don't bother setting length. We'll set it later after we
2163 * find the length of TH */
2164 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2166 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2169 /* Get size of TH */
2173 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2176 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2177 &rh_tvb, &continue_dissecting);
2180 th_header_len = dissect_fid3(tvb, th_tree);
2183 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2186 th_header_len = dissect_fid5(tvb, th_tree);
2189 th_header_len = dissect_fidf(tvb, th_tree);
2192 call_dissector(data_handle,
2193 tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2197 offset = th_header_len;
2199 /* Short-circuit ? */
2200 if (continue_dissecting == stop_here) {
2202 proto_tree_add_text(tree, tvb, offset, -1,
2203 "BIU segment data");
2208 /* If the FID dissector function didn't create an rh_tvb, then we just
2209 * use the rest of our tvbuff as the rh_tvb. */
2211 rh_tvb = tvb_new_subset_remaining(tvb, offset);
2214 /* Process the rest of the SNA packet, starting with RH */
2216 proto_item_set_len(th_ti, th_header_len);
2219 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2221 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2222 dissect_rh(rh_tvb, rh_offset, rh_tree);
2225 rh_offset += RH_LEN;
2227 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2228 /* Short-circuit ? */
2229 if (continue_dissecting == rh_only) {
2231 proto_tree_add_text(tree, rh_tvb, rh_offset, -1,
2232 "BIU segment data");
2236 call_dissector(data_handle,
2237 tvb_new_subset_remaining(rh_tvb, rh_offset),
2238 pinfo, parent_tree);
2242 /* --------------------------------------------------------------------
2243 * Chapter 5 Request/Response Headers (RHs)
2244 * --------------------------------------------------------------------
2248 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2250 proto_tree *bf_tree;
2251 proto_item *bf_item;
2252 gboolean is_response;
2253 guint8 rh_0, rh_1, rh_2;
2258 /* Create the bitfield tree for byte 0*/
2259 rh_0 = tvb_get_guint8(tvb, offset);
2260 is_response = (rh_0 & 0x80);
2262 bf_item = proto_tree_add_uint(tree, hf_sna_rh_0, tvb, offset, 1, rh_0);
2263 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0);
2265 proto_tree_add_uint(bf_tree, hf_sna_rh_rri, tvb, offset, 1, rh_0);
2266 proto_tree_add_uint(bf_tree, hf_sna_rh_ru_category, tvb, offset, 1,
2268 proto_tree_add_boolean(bf_tree, hf_sna_rh_fi, tvb, offset, 1, rh_0);
2269 proto_tree_add_boolean(bf_tree, hf_sna_rh_sdi, tvb, offset, 1, rh_0);
2270 proto_tree_add_boolean(bf_tree, hf_sna_rh_bci, tvb, offset, 1, rh_0);
2271 proto_tree_add_boolean(bf_tree, hf_sna_rh_eci, tvb, offset, 1, rh_0);
2274 rh_1 = tvb_get_guint8(tvb, offset);
2276 /* Create the bitfield tree for byte 1*/
2277 bf_item = proto_tree_add_uint(tree, hf_sna_rh_1, tvb, offset, 1, rh_1);
2278 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1);
2280 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr1, tvb, offset, 1, rh_1);
2283 proto_tree_add_boolean(bf_tree, hf_sna_rh_lcci, tvb, offset, 1,
2286 proto_tree_add_boolean(bf_tree, hf_sna_rh_dr2, tvb, offset, 1, rh_1);
2289 proto_tree_add_boolean(bf_tree, hf_sna_rh_rti, tvb, offset, 1,
2292 proto_tree_add_boolean(bf_tree, hf_sna_rh_eri, tvb, offset, 1,
2294 proto_tree_add_boolean(bf_tree, hf_sna_rh_rlwi, tvb, offset, 1,
2298 proto_tree_add_boolean(bf_tree, hf_sna_rh_qri, tvb, offset, 1, rh_1);
2299 proto_tree_add_boolean(bf_tree, hf_sna_rh_pi, tvb, offset, 1, rh_1);
2302 rh_2 = tvb_get_guint8(tvb, offset);
2304 /* Create the bitfield tree for byte 2*/
2305 bf_item = proto_tree_add_uint(tree, hf_sna_rh_2, tvb, offset, 1, rh_2);
2308 bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2);
2310 proto_tree_add_boolean(bf_tree, hf_sna_rh_bbi, tvb, offset, 1,
2312 proto_tree_add_boolean(bf_tree, hf_sna_rh_ebi, tvb, offset, 1,
2314 proto_tree_add_boolean(bf_tree, hf_sna_rh_cdi, tvb, offset, 1,
2316 proto_tree_add_uint(bf_tree, hf_sna_rh_csi, tvb, offset, 1,
2318 proto_tree_add_boolean(bf_tree, hf_sna_rh_edi, tvb, offset, 1,
2320 proto_tree_add_boolean(bf_tree, hf_sna_rh_pdi, tvb, offset, 1,
2322 proto_tree_add_boolean(bf_tree, hf_sna_rh_cebi, tvb, offset, 1,
2326 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
2329 /* --------------------------------------------------------------------
2330 * Chapter 6 Request/Response Units (RUs)
2331 * --------------------------------------------------------------------
2334 /* --------------------------------------------------------------------
2335 * Chapter 9 Common Fields
2336 * --------------------------------------------------------------------
2340 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2343 proto_tree *bf_tree;
2344 proto_item *bf_item;
2346 guint16 offset, len, pad;
2351 type = tvb_get_guint8(tvb, 2);
2353 bf_item = proto_tree_add_uint(tree, hf_sna_control_05_type, tvb,
2355 bf_tree = proto_item_add_subtree(bf_item, ett_sna_control_05hpr_type);
2357 proto_tree_add_boolean(bf_tree, hf_sna_control_05_ptp, tvb, 2, 1, type);
2358 proto_tree_add_text(tree, tvb, 3, 1, "Reserved");
2362 while (tvb_offset_exists(tvb, offset)) {
2364 len = tvb_get_guint8(tvb, offset+0);
2366 len = tvb_get_guint8(tvb, offset+1);
2369 dissect_control(tvb, offset, len, tree, hpr, parse);
2370 pad = (len+3) & 0xfffc;
2372 /* XXX - fix this, ensure tvb is large enough for pad */
2373 tvb_ensure_bytes_exist(tvb, offset+len, pad-len);
2374 proto_tree_add_text(tree, tvb, offset+len,
2375 pad-len, "Padding");
2385 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2390 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2394 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2402 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2404 len = tvb_reported_length_remaining(tvb, 3);
2408 buf = tvb_get_ephemeral_string(tvb, 3, len);
2409 EBCDIC_to_ASCII(buf, len);
2410 proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char *)buf);
2414 dissect_control(tvbuff_t *parent_tvb, int offset, int control_len,
2415 proto_tree *tree, int hpr, enum parse parse)
2418 gint length, reported_length;
2419 proto_tree *sub_tree;
2420 proto_item *sub_item;
2424 length = tvb_length_remaining(parent_tvb, offset);
2425 reported_length = tvb_reported_length_remaining(parent_tvb, offset);
2426 if (control_len < length)
2427 length = control_len;
2428 if (control_len < reported_length)
2429 reported_length = control_len;
2430 tvb = tvb_new_subset(parent_tvb, offset, length, reported_length);
2435 len = tvb_get_guint8(tvb, 0);
2436 key = tvb_get_guint8(tvb, 1);
2438 key = tvb_get_guint8(tvb, 0);
2439 len = tvb_get_guint8(tvb, 1);
2441 ett = ett_sna_control_un;
2445 if (hpr) ett = ett_sna_control_05hpr;
2446 else ett = ett_sna_control_05;
2448 if (key == 0x0e) ett = ett_sna_control_0e;
2450 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2451 sub_item = proto_tree_add_text(tree, tvb, 0, -1, "%s",
2452 val_to_str_const(key, sna_control_hpr_vals,
2453 "Unknown Control Vector"));
2455 sub_item = proto_tree_add_text(tree, tvb, 0, -1, "%s",
2456 val_to_str_const(key, sna_control_vals,
2457 "Unknown Control Vector"));
2458 sub_tree = proto_item_add_subtree(sub_item, ett);
2460 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2462 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2463 proto_tree_add_uint(sub_tree,
2464 hf_sna_control_hprkey, tvb, 1, 1, key);
2466 proto_tree_add_uint(sub_tree,
2467 hf_sna_control_key, tvb, 1, 1, key);
2469 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2470 proto_tree_add_uint(sub_tree,
2471 hf_sna_control_hprkey, tvb, 0, 1, key);
2473 proto_tree_add_uint(sub_tree,
2474 hf_sna_control_key, tvb, 0, 1, key);
2475 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2482 dissect_control_05hpr(tvb, sub_tree, hpr,
2485 dissect_control_05(tvb, sub_tree);
2488 dissect_control_0e(tvb, sub_tree);
2493 /* --------------------------------------------------------------------
2494 * Chapter 11 Function Management (FM) Headers
2495 * --------------------------------------------------------------------
2498 /* --------------------------------------------------------------------
2499 * Chapter 12 Presentation Services (PS) Headers
2500 * --------------------------------------------------------------------
2503 /* --------------------------------------------------------------------
2504 * Chapter 13 GDS Variables
2505 * --------------------------------------------------------------------
2509 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2510 proto_tree *parent_tree)
2516 proto_tree *gds_tree;
2517 proto_item *gds_item;
2520 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2521 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2522 type = tvb_get_ntohs(tvb, offset+2);
2524 if (length < 2 ) /* escape sequence ? */
2527 gds_item = proto_tree_add_item(tree, hf_sna_gds, tvb,
2528 offset, length, ENC_NA);
2529 gds_tree = proto_item_add_subtree(gds_item,
2532 proto_tree_add_uint(gds_tree, hf_sna_gds_len, tvb,
2534 proto_tree_add_boolean(gds_tree, hf_sna_gds_cont, tvb,
2536 proto_tree_add_uint(gds_tree, hf_sna_gds_type, tvb,
2541 if (tvb_offset_exists(tvb, offset))
2542 call_dissector(data_handle,
2543 tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2546 /* --------------------------------------------------------------------
2548 * --------------------------------------------------------------------
2552 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2555 proto_tree *sna_tree = NULL;
2556 proto_item *sna_ti = NULL;
2558 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2559 col_clear(pinfo->cinfo, COL_INFO);
2561 /* SNA data should be printed in EBCDIC, not ASCII */
2562 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2566 /* Don't bother setting length. We'll set it later after we find
2567 * the lengths of TH/RH/RU */
2568 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2570 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2573 /* Transmission Header Format Identifier */
2574 fid = hi_nibble(tvb_get_guint8(tvb, 0));
2576 case 0xa: /* HPR Network Layer Packet */
2580 dissect_nlp(tvb, pinfo, sna_tree, tree);
2583 dissect_fid(tvb, pinfo, sna_tree, tree);
2588 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2590 proto_tree *sna_tree = NULL;
2591 proto_item *sna_ti = NULL;
2593 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2594 col_clear(pinfo->cinfo, COL_INFO);
2596 /* SNA data should be printed in EBCDIC, not ASCII */
2597 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2601 /* Don't bother setting length. We'll set it later after we find
2602 * the lengths of XID */
2603 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2605 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2607 dissect_xid(tvb, pinfo, sna_tree, tree);
2613 fragment_table_init(&sna_fragment_table);
2618 proto_register_sna(void)
2620 static hf_register_info hf[] = {
2622 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2623 NULL, 0x0, NULL, HFILL }},
2626 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2628 "TH Byte 0", HFILL }},
2631 { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2632 VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2635 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2636 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2639 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2640 BASE_DEC, NULL, 0x02, NULL, HFILL }},
2643 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2644 BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2647 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2648 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2651 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2652 NULL, 0x0, NULL, HFILL }},
2655 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2656 NULL, 0x0, NULL, HFILL }},
2659 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2660 NULL, 0x0, NULL, HFILL }},
2663 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2664 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2666 { &hf_sna_th_tg_sweep,
2667 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2668 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2670 { &hf_sna_th_er_vr_supp_ind,
2671 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2672 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2673 0x04, NULL, HFILL }},
2675 { &hf_sna_th_vr_pac_cnt_ind,
2676 { "Virtual Route Pacing Count Indicator",
2677 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2678 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2680 { &hf_sna_th_ntwk_prty,
2681 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2682 VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2685 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2686 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2690 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2691 NULL, 0x04, NULL, HFILL }},
2694 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2695 VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2698 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2699 BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2702 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2703 VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2705 { &hf_sna_th_nlp_cp,
2706 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2707 NULL, 0x70, NULL, HFILL }},
2710 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2711 NULL, 0x0f, NULL, HFILL }},
2714 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2715 NULL, 0xf0, NULL, HFILL }},
2718 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2719 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2721 { &hf_sna_th_vr_cwi,
2722 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2723 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2724 "Change Window Indicator", HFILL }},
2726 { &hf_sna_th_tg_nonfifo_ind,
2727 { "Transmission Group Non-FIFO Indicator",
2728 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2729 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2731 { &hf_sna_th_vr_sqti,
2732 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2733 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2734 "Route Sequence and Type", HFILL }},
2736 { &hf_sna_th_tg_snf,
2737 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2738 FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2741 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2742 16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2745 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2746 16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2748 { &hf_sna_th_vr_cwri,
2749 { "Virtual Route Change Window Reply Indicator",
2750 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2751 VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2753 { &hf_sna_th_vr_rwi,
2754 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2755 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2758 { &hf_sna_th_vr_snf_send,
2759 { "Virtual Route Send Sequence Number Field",
2760 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2761 "Send Sequence Number Field", HFILL }},
2764 { "Destination Subarea Address Field", "sna.th.dsaf",
2765 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2768 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2769 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2772 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2773 "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2776 { "Destination Element Field", "sna.th.def", FT_UINT16,
2777 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2780 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2781 NULL, 0x0, NULL, HFILL }},
2784 { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2785 NULL, 0x0, NULL, HFILL }},
2787 { &hf_sna_th_cmd_fmt,
2788 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2789 NULL, 0x0, NULL, HFILL }},
2791 { &hf_sna_th_cmd_type,
2792 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2793 NULL, 0x0, NULL, HFILL }},
2795 { &hf_sna_th_cmd_sn,
2796 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2797 BASE_DEC, NULL, 0x0, NULL, HFILL }},
2800 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2801 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2803 { &hf_sna_nlp_nhdr_0,
2804 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2805 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2807 { &hf_sna_nlp_nhdr_1,
2808 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2809 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2812 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2813 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2816 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2817 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2820 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2821 VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2824 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2825 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2827 { &hf_sna_nlp_slowdn1,
2828 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2829 TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2831 { &hf_sna_nlp_slowdn2,
2832 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2833 TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2836 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2837 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2840 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2841 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2844 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2845 BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2848 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2849 NULL, 0x0, "THDR", HFILL }},
2852 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2853 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2855 { &hf_sna_nlp_thdr_8,
2856 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2857 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2859 { &hf_sna_nlp_setupi,
2860 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2861 TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2864 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2865 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2868 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2869 8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2872 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2873 8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2875 { &hf_sna_nlp_rasapi,
2876 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2877 8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2879 { &hf_sna_nlp_retryi,
2880 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2881 8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2883 { &hf_sna_nlp_thdr_9,
2884 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2885 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2888 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2889 8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2892 { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2893 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2896 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2897 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2899 { &hf_sna_nlp_offset,
2900 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2901 NULL, 0x0, "Data Offset in Words", HFILL }},
2904 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2905 NULL, 0x0, NULL, HFILL }},
2908 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2909 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2911 { &hf_sna_nlp_opti_len,
2912 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2913 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2915 { &hf_sna_nlp_opti_type,
2916 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2917 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2920 { &hf_sna_nlp_opti_0d_version,
2921 { "Version", "sna.nlp.thdr.optional.0d.version",
2922 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2925 { &hf_sna_nlp_opti_0d_4,
2926 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2927 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2929 { &hf_sna_nlp_opti_0d_target,
2930 { "Target Resource ID Present",
2931 "sna.nlp.thdr.optional.0d.target",
2932 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2934 { &hf_sna_nlp_opti_0d_arb,
2935 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2936 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2938 { &hf_sna_nlp_opti_0d_reliable,
2939 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2940 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2942 { &hf_sna_nlp_opti_0d_dedicated,
2943 { "Dedicated RTP Connection",
2944 "sna.nlp.thdr.optional.0d.dedicated",
2945 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2947 { &hf_sna_nlp_opti_0e_stat,
2948 { "Status", "sna.nlp.thdr.optional.0e.stat",
2949 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2951 { &hf_sna_nlp_opti_0e_gap,
2952 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2953 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2955 { &hf_sna_nlp_opti_0e_idle,
2956 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2957 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2959 { &hf_sna_nlp_opti_0e_nabsp,
2960 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2961 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2963 { &hf_sna_nlp_opti_0e_sync,
2964 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2965 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2967 { &hf_sna_nlp_opti_0e_echo,
2968 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2969 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2971 { &hf_sna_nlp_opti_0e_rseq,
2972 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2973 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2976 { &hf_sna_nlp_opti_0e_abspbeg,
2977 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2978 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2982 { &hf_sna_nlp_opti_0e_abspend,
2983 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2984 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2987 { &hf_sna_nlp_opti_0f_bits,
2988 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2989 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2990 0x0, NULL, HFILL }},
2992 { &hf_sna_nlp_opti_10_tcid,
2993 { "Transport Connection Identifier",
2994 "sna.nlp.thdr.optional.10.tcid",
2995 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2997 { &hf_sna_nlp_opti_12_sense,
2998 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
2999 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3001 { &hf_sna_nlp_opti_14_si_len,
3002 { "Length", "sna.nlp.thdr.optional.14.si.len",
3003 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3005 { &hf_sna_nlp_opti_14_si_key,
3006 { "Key", "sna.nlp.thdr.optional.14.si.key",
3007 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3009 { &hf_sna_nlp_opti_14_si_2,
3010 { "Switching Information Byte 2",
3011 "sna.nlp.thdr.optional.14.si.2",
3012 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3014 { &hf_sna_nlp_opti_14_si_refifo,
3015 { "Resequencing (REFIFO) Indicator",
3016 "sna.nlp.thdr.optional.14.si.refifo",
3017 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3019 { &hf_sna_nlp_opti_14_si_mobility,
3020 { "Mobility Indicator",
3021 "sna.nlp.thdr.optional.14.si.mobility",
3022 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
3024 { &hf_sna_nlp_opti_14_si_dirsearch,
3025 { "Directory Search Required on Path Switch Indicator",
3026 "sna.nlp.thdr.optional.14.si.dirsearch",
3027 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
3029 { &hf_sna_nlp_opti_14_si_limitres,
3030 { "Limited Resource Link Indicator",
3031 "sna.nlp.thdr.optional.14.si.limitres",
3032 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
3034 { &hf_sna_nlp_opti_14_si_ncescope,
3035 { "NCE Scope Indicator",
3036 "sna.nlp.thdr.optional.14.si.ncescope",
3037 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
3039 { &hf_sna_nlp_opti_14_si_mnpsrscv,
3040 { "MNPS RSCV Retention Indicator",
3041 "sna.nlp.thdr.optional.14.si.mnpsrscv",
3042 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3044 { &hf_sna_nlp_opti_14_si_maxpsize,
3045 { "Maximum Packet Size On Return Path",
3046 "sna.nlp.thdr.optional.14.si.maxpsize",
3047 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3049 { &hf_sna_nlp_opti_14_si_switch,
3050 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
3051 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3053 { &hf_sna_nlp_opti_14_si_alive,
3054 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
3055 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3057 { &hf_sna_nlp_opti_14_rr_len,
3058 { "Length", "sna.nlp.thdr.optional.14.rr.len",
3059 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3061 { &hf_sna_nlp_opti_14_rr_key,
3062 { "Key", "sna.nlp.thdr.optional.14.rr.key",
3063 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3065 { &hf_sna_nlp_opti_14_rr_2,
3066 { "Return Route TG Descriptor Byte 2",
3067 "sna.nlp.thdr.optional.14.rr.2",
3068 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3070 { &hf_sna_nlp_opti_14_rr_bfe,
3071 { "BF Entry Indicator",
3072 "sna.nlp.thdr.optional.14.rr.bfe",
3073 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3075 { &hf_sna_nlp_opti_14_rr_num,
3076 { "Number Of TG Control Vectors",
3077 "sna.nlp.thdr.optional.14.rr.num",
3078 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3080 { &hf_sna_nlp_opti_22_2,
3081 { "Adaptive Rate Based Segment Byte 2",
3082 "sna.nlp.thdr.optional.22.2",
3083 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3085 { &hf_sna_nlp_opti_22_type,
3087 "sna.nlp.thdr.optional.22.type",
3089 VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
3091 { &hf_sna_nlp_opti_22_raa,
3092 { "Rate Adjustment Action",
3093 "sna.nlp.thdr.optional.22.raa",
3095 VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
3097 { &hf_sna_nlp_opti_22_parity,
3098 { "Parity Indicator",
3099 "sna.nlp.thdr.optional.22.parity",
3100 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3102 { &hf_sna_nlp_opti_22_arb,
3104 "sna.nlp.thdr.optional.22.arb",
3106 VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
3108 { &hf_sna_nlp_opti_22_3,
3109 { "Adaptive Rate Based Segment Byte 3",
3110 "sna.nlp.thdr.optional.22.3",
3111 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3113 { &hf_sna_nlp_opti_22_ratereq,
3114 { "Rate Request Correlator",
3115 "sna.nlp.thdr.optional.22.ratereq",
3116 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3118 { &hf_sna_nlp_opti_22_raterep,
3119 { "Rate Reply Correlator",
3120 "sna.nlp.thdr.optional.22.raterep",
3121 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3123 { &hf_sna_nlp_opti_22_field1,
3124 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3125 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3127 { &hf_sna_nlp_opti_22_field2,
3128 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3129 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3131 { &hf_sna_nlp_opti_22_field3,
3132 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3133 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3135 { &hf_sna_nlp_opti_22_field4,
3136 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3137 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3140 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3141 NULL, 0x0, NULL, HFILL }},
3144 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3145 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3148 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3149 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3152 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3153 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3156 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8,
3157 BASE_DEC, VALS(sna_rh_rri_vals), 0x80, NULL, HFILL }},
3159 { &hf_sna_rh_ru_category,
3160 { "Request/Response Unit Category", "sna.rh.ru_category",
3161 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3165 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3166 TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3169 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3170 TFS(&sna_rh_sdi_truth), 0x04, NULL, HFILL }},
3173 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3174 TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3177 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3178 TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3181 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3182 8, NULL, 0x80, NULL, HFILL }},
3185 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3186 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3189 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3190 8, NULL, 0x20, NULL, HFILL }},
3193 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3194 8, NULL, 0x10, NULL, HFILL }},
3197 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3198 8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3201 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3202 8, NULL, 0x04, NULL, HFILL }},
3205 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3206 8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3209 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3210 8, NULL, 0x01, NULL, HFILL }},
3213 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3214 8, NULL, 0x80, NULL, HFILL }},
3217 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3218 8, NULL, 0x40, NULL, HFILL }},
3221 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3222 8, NULL, 0x20, NULL, HFILL }},
3225 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3226 VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3229 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3230 NULL, 0x04, NULL, HFILL }},
3233 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3234 0x02, NULL, HFILL }},
3237 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3238 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3241 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3242 NULL, 0x0, NULL, HFILL }},*/
3245 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3249 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3250 NULL, 0x7fff, NULL, HFILL }},
3253 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3254 0x8000, NULL, HFILL }},
3257 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3258 VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3262 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3263 "XID Frame", HFILL }},
3267 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3270 { &hf_sna_xid_format,
3271 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3272 0xf0, NULL, HFILL }},
3275 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3276 VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3279 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3283 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3284 NULL, 0x0, NULL, HFILL }},
3286 { &hf_sna_xid_idblock,
3287 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3288 0xfff00000, NULL, HFILL }},
3290 { &hf_sna_xid_idnum,
3291 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3292 0x0fffff, NULL, HFILL }},
3295 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3296 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3298 { &hf_sna_xid_3_init_self,
3299 { "INIT-SELF support", "sna.xid.type3.initself",
3300 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3302 { &hf_sna_xid_3_stand_bind,
3303 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3304 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3306 { &hf_sna_xid_3_gener_bind,
3307 { "Whole BIND PIU generated indicator",
3308 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3309 "Whole BIND PIU generated", HFILL }},
3311 { &hf_sna_xid_3_recve_bind,
3312 { "Whole BIND PIU required indicator",
3313 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3314 "Whole BIND PIU required", HFILL }},
3316 { &hf_sna_xid_3_actpu,
3317 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3318 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3320 { &hf_sna_xid_3_nwnode,
3321 { "Sender is network node", "sna.xid.type3.nwnode",
3322 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3325 { "Control Point Services", "sna.xid.type3.cp",
3326 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3328 { &hf_sna_xid_3_cpcp,
3329 { "CP-CP session support", "sna.xid.type3.cpcp",
3330 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3332 { &hf_sna_xid_3_state,
3333 { "XID exchange state indicator", "sna.xid.type3.state",
3334 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3335 0x000c, NULL, HFILL }},
3337 { &hf_sna_xid_3_nonact,
3338 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3339 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3341 { &hf_sna_xid_3_cpchange,
3342 { "CP name change support", "sna.xid.type3.cpchange",
3343 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3346 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3347 NULL, 0x0, NULL, HFILL }},
3349 { &hf_sna_xid_3_asend_bind,
3350 { "Adaptive BIND pacing support as sender",
3351 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3352 "Pacing support as sender", HFILL }},
3354 { &hf_sna_xid_3_arecv_bind,
3355 { "Adaptive BIND pacing support as receiver",
3356 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3357 "Pacing support as receive", HFILL }},
3359 { &hf_sna_xid_3_quiesce,
3360 { "Quiesce TG Request",
3361 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3364 { &hf_sna_xid_3_pucap,
3365 { "PU Capabilities",
3366 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3369 { &hf_sna_xid_3_pbn,
3370 { "Peripheral Border Node",
3371 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3374 { &hf_sna_xid_3_pacing,
3375 { "Qualifier for adaptive BIND pacing support",
3376 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3380 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3381 NULL, 0x0, NULL, HFILL }},
3383 { &hf_sna_xid_3_tgshare,
3384 { "TG Sharing Prohibited Indicator",
3385 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3388 { &hf_sna_xid_3_dedsvc,
3389 { "Dedicated SVC Indicator",
3390 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3394 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3395 NULL, 0x0, NULL, HFILL }},
3397 { &hf_sna_xid_3_negcsup,
3398 { "Negotiation Complete Supported",
3399 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3402 { &hf_sna_xid_3_negcomp,
3403 { "Negotiation Complete",
3404 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3408 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3409 NULL, 0x0, NULL, HFILL }},
3411 { &hf_sna_xid_3_partg,
3412 { "Parallel TG Support",
3413 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3416 { &hf_sna_xid_3_dlur,
3417 { "Dependent LU Requester Indicator",
3418 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3421 { &hf_sna_xid_3_dlus,
3422 { "DLUS Served LU Registration Indicator",
3423 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3426 { &hf_sna_xid_3_exbn,
3427 { "Extended HPR Border Node",
3428 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3431 { &hf_sna_xid_3_genodai,
3432 { "Generalized ODAI Usage Option",
3433 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3436 { &hf_sna_xid_3_branch,
3437 { "Branch Indicator", "sna.xid.type3.branch",
3438 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3439 0x06, NULL, HFILL }},
3441 { &hf_sna_xid_3_brnn,
3442 { "Option Set 1123 Indicator",
3443 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3447 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3450 { &hf_sna_xid_3_dlc,
3451 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3454 { &hf_sna_xid_3_dlen,
3455 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3456 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3458 { &hf_sna_control_len,
3459 { "Control Vector Length", "sna.control.len",
3460 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3462 { &hf_sna_control_key,
3463 { "Control Vector Key", "sna.control.key",
3464 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3467 { &hf_sna_control_hprkey,
3468 { "Control Vector HPR Key", "sna.control.hprkey",
3469 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3472 { &hf_sna_control_05_delay,
3473 { "Channel Delay", "sna.control.05.delay",
3474 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3476 { &hf_sna_control_05_type,
3477 { "Network Address Type", "sna.control.05.type",
3478 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3480 { &hf_sna_control_05_ptp,
3481 { "Point-to-point", "sna.control.05.ptp",
3482 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3484 { &hf_sna_control_0e_type,
3485 { "Type", "sna.control.0e.type",
3486 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3489 { &hf_sna_control_0e_value,
3490 { "Value", "sna.control.0e.value",
3491 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3493 static gint *ett[] = {
3498 &ett_sna_nlp_nhdr_0,
3499 &ett_sna_nlp_nhdr_1,
3501 &ett_sna_nlp_thdr_8,
3502 &ett_sna_nlp_thdr_9,
3503 &ett_sna_nlp_opti_un,
3504 &ett_sna_nlp_opti_0d,
3505 &ett_sna_nlp_opti_0d_4,
3506 &ett_sna_nlp_opti_0e,
3507 &ett_sna_nlp_opti_0e_stat,
3508 &ett_sna_nlp_opti_0e_absp,
3509 &ett_sna_nlp_opti_0f,
3510 &ett_sna_nlp_opti_10,
3511 &ett_sna_nlp_opti_12,
3512 &ett_sna_nlp_opti_14,
3513 &ett_sna_nlp_opti_14_si,
3514 &ett_sna_nlp_opti_14_si_2,
3515 &ett_sna_nlp_opti_14_rr,
3516 &ett_sna_nlp_opti_14_rr_2,
3517 &ett_sna_nlp_opti_22,
3518 &ett_sna_nlp_opti_22_2,
3519 &ett_sna_nlp_opti_22_3,
3532 &ett_sna_control_un,
3533 &ett_sna_control_05,
3534 &ett_sna_control_05hpr,
3535 &ett_sna_control_05hpr_type,
3536 &ett_sna_control_0e,
3538 module_t *sna_module;
3540 proto_sna = proto_register_protocol("Systems Network Architecture",
3542 proto_register_field_array(proto_sna, hf, array_length(hf));
3543 proto_register_subtree_array(ett, array_length(ett));
3544 register_dissector("sna", dissect_sna, proto_sna);
3546 proto_sna_xid = proto_register_protocol(
3547 "Systems Network Architecture XID", "SNA XID", "sna_xid");
3548 register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3550 /* Register configuration options */
3551 sna_module = prefs_register_protocol(proto_sna, NULL);
3552 prefs_register_bool_preference(sna_module, "defragment",
3553 "Reassemble fragmented BIUs",
3554 "Whether fragmented BIUs should be reassembled",
3557 register_init_routine(sna_init);
3561 proto_reg_handoff_sna(void)
3563 dissector_handle_t sna_handle;
3564 dissector_handle_t sna_xid_handle;
3566 sna_handle = find_dissector("sna");
3567 sna_xid_handle = find_dissector("sna_xid");
3568 dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3569 dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3570 dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3571 dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3572 dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3573 dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3574 dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3575 dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3577 dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3578 data_handle = find_dissector("data");