3 * Gilbert Ramirez <gram@alumni.rice.edu>
4 * Jochen Friedrich <jochen@scram.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include <epan/packet.h>
28 #include <epan/llcsaps.h>
29 #include <epan/ppptypes.h>
30 #include <epan/address_types.h>
31 #include <epan/prefs.h>
32 #include <epan/reassemble.h>
33 #include <epan/to_str-int.h>
34 #include "wsutil/pint.h"
37 * http://www.wanresources.com/snacell.html
38 * ftp://ftp.software.ibm.com/networking/pub/standards/aiw/formats/
41 void proto_register_sna(void);
42 void proto_reg_handoff_sna(void);
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;
88 static int hf_sna_th_byte1 = -1;
89 static int hf_sna_th_byte2 = -1;
90 static int hf_sna_th_byte3 = -1;
91 static int hf_sna_th_byte4 = -1;
92 static int hf_sna_th_byte6 = -1;
93 static int hf_sna_th_byte16 = -1;
95 static int hf_sna_nlp_nhdr = -1;
96 static int hf_sna_nlp_nhdr_0 = -1;
97 static int hf_sna_nlp_sm = -1;
98 static int hf_sna_nlp_tpf = -1;
99 static int hf_sna_nlp_nhdr_1 = -1;
100 static int hf_sna_nlp_ft = -1;
101 static int hf_sna_nlp_tspi = -1;
102 static int hf_sna_nlp_slowdn1 = -1;
103 static int hf_sna_nlp_slowdn2 = -1;
104 static int hf_sna_nlp_fra = -1;
105 static int hf_sna_nlp_anr = -1;
106 static int hf_sna_nlp_frh = -1;
107 static int hf_sna_nlp_thdr = -1;
108 static int hf_sna_nlp_tcid = -1;
109 static int hf_sna_nlp_thdr_8 = -1;
110 static int hf_sna_nlp_setupi = -1;
111 static int hf_sna_nlp_somi = -1;
112 static int hf_sna_nlp_eomi = -1;
113 static int hf_sna_nlp_sri = -1;
114 static int hf_sna_nlp_rasapi = -1;
115 static int hf_sna_nlp_retryi = -1;
116 static int hf_sna_nlp_thdr_9 = -1;
117 static int hf_sna_nlp_lmi = -1;
118 static int hf_sna_nlp_cqfi = -1;
119 static int hf_sna_nlp_osi = -1;
120 static int hf_sna_nlp_offset = -1;
121 static int hf_sna_nlp_dlf = -1;
122 static int hf_sna_nlp_bsn = -1;
123 static int hf_sna_nlp_opti_len = -1;
124 static int hf_sna_nlp_opti_type = -1;
125 static int hf_sna_nlp_opti_0d_version = -1;
126 static int hf_sna_nlp_opti_0d_4 = -1;
127 static int hf_sna_nlp_opti_0d_target = -1;
128 static int hf_sna_nlp_opti_0d_arb = -1;
129 static int hf_sna_nlp_opti_0d_reliable = -1;
130 static int hf_sna_nlp_opti_0d_dedicated = -1;
131 static int hf_sna_nlp_opti_0e_stat = -1;
132 static int hf_sna_nlp_opti_0e_gap = -1;
133 static int hf_sna_nlp_opti_0e_idle = -1;
134 static int hf_sna_nlp_opti_0e_nabsp = -1;
135 static int hf_sna_nlp_opti_0e_sync = -1;
136 static int hf_sna_nlp_opti_0e_echo = -1;
137 static int hf_sna_nlp_opti_0e_rseq = -1;
138 /* static int hf_sna_nlp_opti_0e_abspbeg = -1; */
139 /* static int hf_sna_nlp_opti_0e_abspend = -1; */
140 static int hf_sna_nlp_opti_0f_bits = -1;
141 static int hf_sna_nlp_opti_10_tcid = -1;
142 static int hf_sna_nlp_opti_12_sense = -1;
143 static int hf_sna_nlp_opti_14_si_len = -1;
144 static int hf_sna_nlp_opti_14_si_key = -1;
145 static int hf_sna_nlp_opti_14_si_2 = -1;
146 static int hf_sna_nlp_opti_14_si_refifo = -1;
147 static int hf_sna_nlp_opti_14_si_mobility = -1;
148 static int hf_sna_nlp_opti_14_si_dirsearch = -1;
149 static int hf_sna_nlp_opti_14_si_limitres = -1;
150 static int hf_sna_nlp_opti_14_si_ncescope = -1;
151 static int hf_sna_nlp_opti_14_si_mnpsrscv = -1;
152 static int hf_sna_nlp_opti_14_si_maxpsize = -1;
153 static int hf_sna_nlp_opti_14_si_switch = -1;
154 static int hf_sna_nlp_opti_14_si_alive = -1;
155 static int hf_sna_nlp_opti_14_rr_len = -1;
156 static int hf_sna_nlp_opti_14_rr_key = -1;
157 static int hf_sna_nlp_opti_14_rr_2 = -1;
158 static int hf_sna_nlp_opti_14_rr_bfe = -1;
159 static int hf_sna_nlp_opti_14_rr_num = -1;
160 static int hf_sna_nlp_opti_22_2 = -1;
161 static int hf_sna_nlp_opti_22_type = -1;
162 static int hf_sna_nlp_opti_22_raa = -1;
163 static int hf_sna_nlp_opti_22_parity = -1;
164 static int hf_sna_nlp_opti_22_arb = -1;
165 static int hf_sna_nlp_opti_22_3 = -1;
166 static int hf_sna_nlp_opti_22_ratereq = -1;
167 static int hf_sna_nlp_opti_22_raterep = -1;
168 static int hf_sna_nlp_opti_22_field1 = -1;
169 static int hf_sna_nlp_opti_22_field2 = -1;
170 static int hf_sna_nlp_opti_22_field3 = -1;
171 static int hf_sna_nlp_opti_22_field4 = -1;
173 static int hf_sna_rh = -1;
174 static int hf_sna_rh_0 = -1;
175 static int hf_sna_rh_1 = -1;
176 static int hf_sna_rh_2 = -1;
177 static int hf_sna_rh_rri = -1;
178 static int hf_sna_rh_ru_category = -1;
179 static int hf_sna_rh_fi = -1;
180 static int hf_sna_rh_sdi = -1;
181 static int hf_sna_rh_bci = -1;
182 static int hf_sna_rh_eci = -1;
183 static int hf_sna_rh_dr1 = -1;
184 static int hf_sna_rh_lcci = -1;
185 static int hf_sna_rh_dr2 = -1;
186 static int hf_sna_rh_eri = -1;
187 static int hf_sna_rh_rti = -1;
188 static int hf_sna_rh_rlwi = -1;
189 static int hf_sna_rh_qri = -1;
190 static int hf_sna_rh_pi = -1;
191 static int hf_sna_rh_bbi = -1;
192 static int hf_sna_rh_ebi = -1;
193 static int hf_sna_rh_cdi = -1;
194 static int hf_sna_rh_csi = -1;
195 static int hf_sna_rh_edi = -1;
196 static int hf_sna_rh_pdi = -1;
197 static int hf_sna_rh_cebi = -1;
198 /*static int hf_sna_ru = -1;*/
200 static int hf_sna_gds = -1;
201 static int hf_sna_gds_len = -1;
202 static int hf_sna_gds_type = -1;
203 static int hf_sna_gds_cont = -1;
205 /* static int hf_sna_xid = -1; */
206 static int hf_sna_xid_0 = -1;
207 static int hf_sna_xid_id = -1;
208 static int hf_sna_xid_format = -1;
209 static int hf_sna_xid_type = -1;
210 static int hf_sna_xid_len = -1;
211 static int hf_sna_xid_idblock = -1;
212 static int hf_sna_xid_idnum = -1;
213 static int hf_sna_xid_3_8 = -1;
214 static int hf_sna_xid_3_init_self = -1;
215 static int hf_sna_xid_3_stand_bind = -1;
216 static int hf_sna_xid_3_gener_bind = -1;
217 static int hf_sna_xid_3_recve_bind = -1;
218 static int hf_sna_xid_3_actpu = -1;
219 static int hf_sna_xid_3_nwnode = -1;
220 static int hf_sna_xid_3_cp = -1;
221 static int hf_sna_xid_3_cpcp = -1;
222 static int hf_sna_xid_3_state = -1;
223 static int hf_sna_xid_3_nonact = -1;
224 static int hf_sna_xid_3_cpchange = -1;
225 static int hf_sna_xid_3_10 = -1;
226 static int hf_sna_xid_3_asend_bind = -1;
227 static int hf_sna_xid_3_arecv_bind = -1;
228 static int hf_sna_xid_3_quiesce = -1;
229 static int hf_sna_xid_3_pucap = -1;
230 static int hf_sna_xid_3_pbn = -1;
231 static int hf_sna_xid_3_pacing = -1;
232 static int hf_sna_xid_3_11 = -1;
233 static int hf_sna_xid_3_tgshare = -1;
234 static int hf_sna_xid_3_dedsvc = -1;
235 static int hf_sna_xid_3_12 = -1;
236 static int hf_sna_xid_3_negcsup = -1;
237 static int hf_sna_xid_3_negcomp = -1;
238 static int hf_sna_xid_3_15 = -1;
239 static int hf_sna_xid_3_partg = -1;
240 static int hf_sna_xid_3_dlur = -1;
241 static int hf_sna_xid_3_dlus = -1;
242 static int hf_sna_xid_3_exbn = -1;
243 static int hf_sna_xid_3_genodai = -1;
244 static int hf_sna_xid_3_branch = -1;
245 static int hf_sna_xid_3_brnn = -1;
246 static int hf_sna_xid_3_tg = -1;
247 static int hf_sna_xid_3_dlc = -1;
248 static int hf_sna_xid_3_dlen = -1;
250 static int hf_sna_control_len = -1;
251 static int hf_sna_control_key = -1;
252 static int hf_sna_control_hprkey = -1;
253 static int hf_sna_control_05_delay = -1;
254 static int hf_sna_control_05_type = -1;
255 static int hf_sna_control_05_ptp = -1;
256 static int hf_sna_control_0e_type = -1;
257 static int hf_sna_control_0e_value = -1;
258 static int hf_sna_padding = -1;
259 static int hf_sna_reserved = -1;
260 static int hf_sna_biu_segment_data = -1;
262 static gint ett_sna = -1;
263 static gint ett_sna_th = -1;
264 static gint ett_sna_th_fid = -1;
265 static gint ett_sna_nlp_nhdr = -1;
266 static gint ett_sna_nlp_nhdr_0 = -1;
267 static gint ett_sna_nlp_nhdr_1 = -1;
268 static gint ett_sna_nlp_thdr = -1;
269 static gint ett_sna_nlp_thdr_8 = -1;
270 static gint ett_sna_nlp_thdr_9 = -1;
271 static gint ett_sna_nlp_opti_un = -1;
272 static gint ett_sna_nlp_opti_0d = -1;
273 static gint ett_sna_nlp_opti_0d_4 = -1;
274 static gint ett_sna_nlp_opti_0e = -1;
275 static gint ett_sna_nlp_opti_0e_stat = -1;
276 static gint ett_sna_nlp_opti_0e_absp = -1;
277 static gint ett_sna_nlp_opti_0f = -1;
278 static gint ett_sna_nlp_opti_10 = -1;
279 static gint ett_sna_nlp_opti_12 = -1;
280 static gint ett_sna_nlp_opti_14 = -1;
281 static gint ett_sna_nlp_opti_14_si = -1;
282 static gint ett_sna_nlp_opti_14_si_2 = -1;
283 static gint ett_sna_nlp_opti_14_rr = -1;
284 static gint ett_sna_nlp_opti_14_rr_2 = -1;
285 static gint ett_sna_nlp_opti_22 = -1;
286 static gint ett_sna_nlp_opti_22_2 = -1;
287 static gint ett_sna_nlp_opti_22_3 = -1;
288 static gint ett_sna_rh = -1;
289 static gint ett_sna_rh_0 = -1;
290 static gint ett_sna_rh_1 = -1;
291 static gint ett_sna_rh_2 = -1;
292 static gint ett_sna_gds = -1;
293 static gint ett_sna_xid_0 = -1;
294 static gint ett_sna_xid_id = -1;
295 static gint ett_sna_xid_3_8 = -1;
296 static gint ett_sna_xid_3_10 = -1;
297 static gint ett_sna_xid_3_11 = -1;
298 static gint ett_sna_xid_3_12 = -1;
299 static gint ett_sna_xid_3_15 = -1;
300 static gint ett_sna_control_un = -1;
301 static gint ett_sna_control_05 = -1;
302 static gint ett_sna_control_05hpr = -1;
303 static gint ett_sna_control_05hpr_type = -1;
304 static gint ett_sna_control_0e = -1;
306 static dissector_handle_t data_handle;
308 static int sna_address_type = -1;
310 /* Defragment fragmented SNA BIUs*/
311 static gboolean sna_defragment = TRUE;
312 static reassembly_table sna_reassembly_table;
314 /* Format Identifier */
315 static const value_string sna_th_fid_vals[] = {
316 { 0x0, "SNA device <--> Non-SNA Device" },
317 { 0x1, "Subarea Nodes, without ER or VR" },
318 { 0x2, "Subarea Node <--> PU2" },
319 { 0x3, "Subarea Node or SNA host <--> Subarea Node" },
320 { 0x4, "Subarea Nodes, supporting ER and VR" },
321 { 0x5, "HPR RTP endpoint nodes" },
322 { 0xa, "HPR NLP Frame Routing" },
323 { 0xb, "HPR NLP Frame Routing" },
324 { 0xc, "HPR NLP Automatic Network Routing" },
325 { 0xd, "HPR NLP Automatic Network Routing" },
326 { 0xf, "Adjacent Subarea Nodes, supporting ER and VR" },
331 #define MPF_MIDDLE_SEGMENT 0
332 #define MPF_LAST_SEGMENT 1
333 #define MPF_FIRST_SEGMENT 2
334 #define MPF_WHOLE_BIU 3
336 static const value_string sna_th_mpf_vals[] = {
337 { MPF_MIDDLE_SEGMENT, "Middle segment of a BIU" },
338 { MPF_LAST_SEGMENT, "Last segment of a BIU" },
339 { MPF_FIRST_SEGMENT, "First segment of a BIU" },
340 { MPF_WHOLE_BIU, "Whole BIU" },
344 /* Expedited Flow Indicator */
345 static const value_string sna_th_efi_vals[] = {
346 { 0, "Normal Flow" },
347 { 1, "Expedited Flow" },
351 /* Request/Response Indicator */
352 static const value_string sna_rh_rri_vals[] = {
358 /* Request/Response Unit Category */
359 static const value_string sna_rh_ru_category_vals[] = {
360 { 0, "Function Management Data (FMD)" },
361 { 1, "Network Control (NC)" },
362 { 2, "Data Flow Control (DFC)" },
363 { 3, "Session Control (SC)" },
367 /* Format Indicator */
368 static const true_false_string sna_rh_fi_truth =
369 { "FM Header", "No FM Header" };
371 /* Sense Data Included */
372 static const true_false_string sna_rh_sdi_truth =
373 { "Included", "Not Included" };
375 /* Begin Chain Indicator */
376 static const true_false_string sna_rh_bci_truth =
377 { "First in Chain", "Not First in Chain" };
379 /* End Chain Indicator */
380 static const true_false_string sna_rh_eci_truth =
381 { "Last in Chain", "Not Last in Chain" };
383 /* Lengith-Checked Compression Indicator */
384 static const true_false_string sna_rh_lcci_truth =
385 { "Compressed", "Not Compressed" };
387 /* Response Type Indicator */
388 static const true_false_string sna_rh_rti_truth =
389 { "Negative", "Positive" };
391 /* Queued Response Indicator */
392 static const true_false_string sna_rh_qri_truth =
393 { "Enqueue response in TC queues", "Response bypasses TC queues" };
395 /* Code Selection Indicator */
396 static const value_string sna_rh_csi_vals[] = {
403 static const value_string sna_th_tg_sweep_vals[] = {
404 { 0, "This PIU may overtake any PU ahead of it." },
405 { 1, "This PIU does not overtake any PIU ahead of it." },
410 static const value_string sna_th_er_vr_supp_ind_vals[] = {
411 { 0, "Each node supports ER and VR protocols" },
412 { 1, "Includes at least one node that does not support ER and VR"
418 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
419 { 0, "Pacing count on the VR has not reached 0" },
420 { 1, "Pacing count on the VR has reached 0" },
425 static const value_string sna_th_ntwk_prty_vals[] = {
426 { 0, "PIU flows at a lower priority" },
427 { 1, "PIU flows at network priority (highest transmission priority)" },
432 static const value_string sna_th_tgsf_vals[] = {
433 { 0, "Not segmented" },
434 { 1, "Last segment" },
435 { 2, "First segment" },
436 { 3, "Middle segment" },
441 static const value_string sna_th_piubf_vals[] = {
442 { 0, "Single PIU frame" },
443 { 1, "Last PIU of a multiple PIU frame" },
444 { 2, "First PIU of a multiple PIU frame" },
445 { 3, "Middle PIU of a multiple PIU frame" },
450 static const value_string sna_th_nlpoi_vals[] = {
451 { 0, "NLP starts within this FID4 TH" },
452 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
457 static const value_string sna_th_tpf_vals[] = {
458 { 0, "Low Priority" },
459 { 1, "Medium Priority" },
460 { 2, "High Priority" },
461 { 3, "Network Priority" },
466 static const value_string sna_th_vr_cwi_vals[] = {
467 { 0, "Increment window size" },
468 { 1, "Decrement window size" },
473 static const true_false_string sna_th_tg_nonfifo_ind_truth =
474 { "TG FIFO is not required", "TG FIFO is required" };
477 static const value_string sna_th_vr_sqti_vals[] = {
478 { 0, "Non-sequenced, Non-supervisory" },
479 { 1, "Non-sequenced, Supervisory" },
480 { 2, "Singly-sequenced" },
485 static const true_false_string sna_th_vrprq_truth = {
486 "VR pacing request is sent asking for a VR pacing response",
487 "No VR pacing response is requested",
491 static const true_false_string sna_th_vrprs_truth = {
492 "VR pacing response is sent in response to a VRPRQ bit set",
493 "No pacing response sent",
497 static const value_string sna_th_vr_cwri_vals[] = {
498 { 0, "Increment window size by 1" },
499 { 1, "Decrement window size by 1" },
504 static const true_false_string sna_th_vr_rwi_truth = {
505 "Reset window size to the minimum specified in NC_ACTVR",
506 "Do not reset window size",
510 static const value_string sna_nlp_sm_vals[] = {
511 { 5, "Function routing" },
512 { 6, "Automatic network routing" },
516 static const true_false_string sna_nlp_tspi_truth =
517 { "Time sensitive", "Not time sensitive" };
519 static const true_false_string sna_nlp_slowdn1_truth =
520 { "Minor congestion", "No minor congestion" };
522 static const true_false_string sna_nlp_slowdn2_truth =
523 { "Major congestion", "No major congestion" };
526 static const value_string sna_nlp_ft_vals[] = {
531 static const value_string sna_nlp_frh_vals[] = {
532 { 0x03, "XID complete request" },
533 { 0x04, "XID complete response" },
537 static const true_false_string sna_nlp_setupi_truth =
538 { "Connection setup segment present", "Connection setup segment not"
541 static const true_false_string sna_nlp_somi_truth =
542 { "Start of message", "Not start of message" };
544 static const true_false_string sna_nlp_eomi_truth =
545 { "End of message", "Not end of message" };
547 static const true_false_string sna_nlp_sri_truth =
548 { "Status requested", "No status requested" };
550 static const true_false_string sna_nlp_rasapi_truth =
551 { "Reply as soon as possible", "No need to reply as soon as possible" };
553 static const true_false_string sna_nlp_retryi_truth =
554 { "Undefined", "Sender will retransmit" };
556 static const true_false_string sna_nlp_lmi_truth =
557 { "Last message", "Not last message" };
559 static const true_false_string sna_nlp_cqfi_truth =
560 { "CQFI included", "CQFI not included" };
562 static const true_false_string sna_nlp_osi_truth =
563 { "Optional segments present", "No optional segments present" };
565 static const value_string sna_xid_3_state_vals[] = {
566 { 0x00, "Exchange state indicators not supported" },
567 { 0x01, "Negotiation-proceeding exchange" },
568 { 0x02, "Prenegotiation exchange" },
569 { 0x03, "Nonactivation exchange" },
573 static const value_string sna_xid_3_branch_vals[] = {
574 { 0x00, "Sender does not support branch extender" },
575 { 0x01, "TG is branch uplink" },
576 { 0x02, "TG is branch downlink" },
577 { 0x03, "TG is neither uplink nor downlink" },
581 static const value_string sna_xid_type_vals[] = {
583 { 0x02, "T2.0 or T2.1 node" },
584 { 0x03, "Reserved" },
585 { 0x04, "T4 or T5 node" },
589 static const value_string sna_nlp_opti_vals[] = {
590 { 0x0d, "Connection Setup Segment" },
591 { 0x0e, "Status Segment" },
592 { 0x0f, "Client Out Of Band Bits Segment" },
593 { 0x10, "Connection Identifier Exchange Segment" },
594 { 0x12, "Connection Fault Segment" },
595 { 0x14, "Switching Information Segment" },
596 { 0x22, "Adaptive Rate-Based Segment" },
600 static const value_string sna_nlp_opti_0d_version_vals[] = {
601 { 0x0101, "Version 1.1" },
605 static const value_string sna_nlp_opti_0f_bits_vals[] = {
606 { 0x0001, "Request Deactivation" },
607 { 0x8000, "Reply - OK" },
608 { 0x8004, "Reply - Reject" },
612 static const value_string sna_nlp_opti_22_type_vals[] = {
614 { 0x01, "Rate Reply" },
615 { 0x02, "Rate Request" },
616 { 0x03, "Rate Request/Rate Reply" },
620 static const value_string sna_nlp_opti_22_raa_vals[] = {
622 { 0x01, "Restraint" },
623 { 0x02, "Slowdown1" },
624 { 0x03, "Slowdown2" },
625 { 0x04, "Critical" },
629 static const value_string sna_nlp_opti_22_arb_vals[] = {
630 { 0x00, "Base Mode ARB" },
631 { 0x01, "Responsive Mode ARB" },
635 /* GDS Variable Type */
636 static const value_string sna_gds_var_vals[] = {
637 { 0x1210, "Change Number Of Sessions" },
638 { 0x1211, "Exchange Log Name" },
639 { 0x1212, "Control Point Management Services Unit" },
640 { 0x1213, "Compare States" },
641 { 0x1214, "LU Names Position" },
642 { 0x1215, "LU Name" },
643 { 0x1217, "Do Know" },
644 { 0x1218, "Partner Restart" },
645 { 0x1219, "Don't Know" },
646 { 0x1220, "Sign-Off" },
647 { 0x1221, "Sign-On" },
648 { 0x1222, "SNMP-over-SNA" },
649 { 0x1223, "Node Address Service" },
650 { 0x12C1, "CP Capabilities" },
651 { 0x12C2, "Topology Database Update" },
652 { 0x12C3, "Register Resource" },
653 { 0x12C4, "Locate" },
654 { 0x12C5, "Cross-Domain Initiate" },
655 { 0x12C9, "Delete Resource" },
656 { 0x12CA, "Find Resource" },
657 { 0x12CB, "Found Resource" },
658 { 0x12CC, "Notify" },
659 { 0x12CD, "Initiate-Other Cross-Domain" },
660 { 0x12CE, "Route Setup" },
661 { 0x12E1, "Error Log" },
662 { 0x12F1, "Null Data" },
663 { 0x12F2, "User Control Date" },
664 { 0x12F3, "Map Name" },
665 { 0x12F4, "Error Data" },
666 { 0x12F6, "Authentication Token Data" },
667 { 0x12F8, "Service Flow Authentication Token Data" },
668 { 0x12FF, "Application Data" },
669 { 0x1310, "MDS Message Unit" },
670 { 0x1311, "MDS Routing Information" },
671 { 0x1500, "FID2 Encapsulation" },
675 /* Control Vector Type */
676 static const value_string sna_control_vals[] = {
677 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
678 { 0x01, "Date-Time Control Vector" },
679 { 0x02, "Subarea Routing Control Vector" },
680 { 0x03, "SDLC Secondary Station Control Vector" },
681 { 0x04, "LU Control Vector" },
682 { 0x05, "Channel Control Vector" },
683 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
684 { 0x07, "PU FMD-RU-Usage Control Vector" },
685 { 0x08, "Intensive Mode Control Vector" },
686 { 0x09, "Activation Request / Response Sequence Identifier Control"
688 { 0x0a, "User Request Correlator Control Vector" },
689 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
690 { 0x0c, "LU-LU Session Capabilities Control Vector" },
691 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
693 { 0x0e, "Network Name Control Vector" },
694 { 0x0f, "Link Capabilities and Status Control Vector" },
695 { 0x10, "Product Set ID Control Vector" },
696 { 0x11, "Load Module Correlation Control Vector" },
697 { 0x12, "Network Identifier Control Vector" },
698 { 0x13, "Gateway Support Capabilities Control Vector" },
699 { 0x14, "Session Initiation Control Vector" },
700 { 0x15, "Network-Qualified Address Pair Control Vector" },
701 { 0x16, "Names Substitution Control Vector" },
702 { 0x17, "SSCP Identifier Control Vector" },
703 { 0x18, "SSCP Name Control Vector" },
704 { 0x19, "Resource Identifier Control Vector" },
705 { 0x1a, "NAU Address Control Vector" },
706 { 0x1b, "VRID List Control Vector" },
707 { 0x1c, "Network-Qualified Name Pair Control Vector" },
708 { 0x1e, "VR-ER Mapping Data Control Vector" },
709 { 0x1f, "ER Configuration Control Vector" },
710 { 0x23, "Local-Form Session Identifier Control Vector" },
711 { 0x24, "IPL Load Module Request Control Vector" },
712 { 0x25, "Security ID Control Control Vector" },
713 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
714 { 0x27, "XRF Session Activation Control Vector" },
715 { 0x28, "Related Session Identifier Control Vector" },
716 { 0x29, "Session State Data Control Vector" },
717 { 0x2a, "Session Information Control Vector" },
718 { 0x2b, "Route Selection Control Vector" },
719 { 0x2c, "COS/TPF Control Vector" },
720 { 0x2d, "Mode Control Vector" },
721 { 0x2f, "LU Definition Control Vector" },
722 { 0x30, "Assign LU Characteristics Control Vector" },
723 { 0x31, "BIND Image Control Vector" },
724 { 0x32, "Short-Hold Mode Control Vector" },
725 { 0x33, "ENCP Search Control Control Vector" },
726 { 0x34, "LU Definition Override Control Vector" },
727 { 0x35, "Extended Sense Data Control Vector" },
728 { 0x36, "Directory Error Control Vector" },
729 { 0x37, "Directory Entry Correlator Control Vector" },
730 { 0x38, "Short-Hold Mode Emulation Control Vector" },
731 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
733 { 0x3a, "Route Status Data Control Vector" },
734 { 0x3b, "VR Congestion Data Control Vector" },
735 { 0x3c, "Associated Resource Entry Control Vector" },
736 { 0x3d, "Directory Entry Control Vector" },
737 { 0x3e, "Directory Entry Characteristic Control Vector" },
738 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
739 { 0x40, "Real Associated Resource Control Vector" },
740 { 0x41, "Station Parameters Control Vector" },
741 { 0x42, "Dynamic Path Update Data Control Vector" },
742 { 0x43, "Extended SDLC Station Control Vector" },
743 { 0x44, "Node Descriptor Control Vector" },
744 { 0x45, "Node Characteristics Control Vector" },
745 { 0x46, "TG Descriptor Control Vector" },
746 { 0x47, "TG Characteristics Control Vector" },
747 { 0x48, "Topology Resource Descriptor Control Vector" },
748 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
750 { 0x4a, "Real Owning Control Point Control Vector" },
751 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
752 { 0x51, "DLUR/S Capabilities Control Vector" },
753 { 0x52, "Primary Send Pacing Window Size Control Vector" },
754 { 0x56, "Call Security Verification Control Vector" },
755 { 0x57, "DLC Connection Data Control Vector" },
756 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
757 { 0x5a, "Session Services Extension Support Control Vector" },
758 { 0x5b, "Interchange Node Support Control Vector" },
759 { 0x5c, "APPN Message Transport Control Vector" },
760 { 0x5d, "Subarea Message Transport Control Vector" },
761 { 0x5e, "Related Request Control Vector" },
762 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
763 { 0x60, "Fully Qualified PCID Control Vector" },
764 { 0x61, "HPR Capabilities Control Vector" },
765 { 0x62, "Session Address Control Vector" },
766 { 0x63, "Cryptographic Key Distribution Control Vector" },
767 { 0x64, "TCP/IP Information Control Vector" },
768 { 0x65, "Device Characteristics Control Vector" },
769 { 0x66, "Length-Checked Compression Control Vector" },
770 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
771 { 0x68, "XRF/Session Cryptography Control Vector" },
772 { 0x69, "Switched Parameters Control Vector" },
773 { 0x6a, "ER Congestion Data Control Vector" },
774 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
775 { 0xfe, "Control Vector Keys Not Recognized" },
779 static const value_string sna_control_hpr_vals[] = {
780 { 0x00, "Node Identifier Control Vector" },
781 { 0x03, "Network ID Control Vector" },
782 { 0x05, "Network Address Control Vector" },
786 static const value_string sna_control_0e_type_vals[] = {
790 { 0xF5, "SSCP Name" },
791 { 0xF6, "NNCP Name" },
792 { 0xF7, "Link Station Name" },
793 { 0xF8, "CP Name of CP(PLU)" },
794 { 0xF9, "CP Name of CP(SLU)" },
795 { 0xFA, "Generic Name" },
799 /* Values to direct the top-most dissector what to dissect
801 enum next_dissection_enum {
813 * Structure used to represent an FID Type 4 address; gives the layout of the
814 * data pointed to by an AT_SNA "address" structure if the size is
815 * SNA_FID_TYPE_4_ADDR_LEN.
817 #define SNA_FID_TYPE_4_ADDR_LEN 6
818 struct sna_fid_type_4_addr {
823 typedef enum next_dissection_enum next_dissection_t;
825 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
826 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
827 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
828 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
829 static void dissect_rh (tvbuff_t*, int, proto_tree*);
830 static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
832 static int sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len _U_)
834 const guint8 *addrdata;
835 struct sna_fid_type_4_addr sna_fid_type_4_addr;
841 addrdata = (const guint8 *)addr->data;
842 word_to_hex(buf, addrdata[0]);
847 addrdata = (const guint8 *)addr->data;
848 word_to_hex(buf, pntoh16(&addrdata[0]));
852 case SNA_FID_TYPE_4_ADDR_LEN:
854 memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
856 bufp = dword_to_hex(bufp, sna_fid_type_4_addr.saf);
858 bufp = word_to_hex(bufp, sna_fid_type_4_addr.ef);
859 *bufp++ = '\0'; /* NULL terminate */
866 return (int)strlen(buf)+1;
870 static int sna_address_str_len(const address* addr _U_)
872 /* We could do this based on address length, but 14 bytes isn't THAT much space */
877 /* --------------------------------------------------------------------
878 * Chapter 2 High-Performance Routing (HPR) Headers
879 * --------------------------------------------------------------------
883 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
885 int offset, len, pad;
886 static const int * fields[] = {
887 &hf_sna_nlp_opti_0d_target,
888 &hf_sna_nlp_opti_0d_arb,
889 &hf_sna_nlp_opti_0d_reliable,
890 &hf_sna_nlp_opti_0d_dedicated,
897 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
899 proto_tree_add_bitmask(tree, tvb, 4, hf_sna_nlp_opti_0d_4,
900 ett_sna_nlp_opti_0d_4, fields, ENC_NA);
902 proto_tree_add_item(tree, hf_sna_reserved, tvb, 5, 3, ENC_NA);
906 while (tvb_offset_exists(tvb, offset)) {
907 len = tvb_get_guint8(tvb, offset+0);
909 dissect_control(tvb, offset, len, tree, 1, LT);
910 pad = (len+3) & 0xfffc;
912 proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
915 /* Avoid endless loop */
922 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
925 static const int * fields[] = {
926 &hf_sna_nlp_opti_0e_gap,
927 &hf_sna_nlp_opti_0e_idle,
931 bits = tvb_get_guint8(tvb, 2);
934 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_0e_stat,
935 ett_sna_nlp_opti_0e_stat, fields, ENC_NA);
937 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
938 tvb, 3, 1, ENC_BIG_ENDIAN);
939 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
940 tvb, 4, 2, ENC_BIG_ENDIAN);
941 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
942 tvb, 6, 2, ENC_BIG_ENDIAN);
943 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
944 tvb, 8, 4, ENC_BIG_ENDIAN);
945 proto_tree_add_item(tree, hf_sna_reserved, tvb, 12, 8, ENC_NA);
947 if (tvb_offset_exists(tvb, offset))
948 call_dissector(data_handle,
949 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
952 col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
954 col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
959 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
961 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
962 if (tvb_offset_exists(tvb, 4))
963 call_dissector(data_handle,
964 tvb_new_subset_remaining(tvb, 4), pinfo, tree);
968 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
970 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
971 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
972 if (tvb_offset_exists(tvb, 12))
973 call_dissector(data_handle,
974 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
978 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
980 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
981 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
985 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
987 proto_tree *sub_tree;
988 int len, pad, type, offset, num, sublen;
989 static const int * opti_14_si_fields[] = {
990 &hf_sna_nlp_opti_14_si_refifo,
991 &hf_sna_nlp_opti_14_si_mobility,
992 &hf_sna_nlp_opti_14_si_dirsearch,
993 &hf_sna_nlp_opti_14_si_limitres,
994 &hf_sna_nlp_opti_14_si_ncescope,
995 &hf_sna_nlp_opti_14_si_mnpsrscv,
998 static const int * opti_14_rr_fields[] = {
999 &hf_sna_nlp_opti_14_rr_bfe,
1003 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
1007 len = tvb_get_guint8(tvb, offset);
1008 type = tvb_get_guint8(tvb, offset+1);
1010 if ((type != 0x83) || (len <= 16)) {
1012 call_dissector(data_handle,
1013 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1016 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1017 ett_sna_nlp_opti_14_si, NULL, "Switching Information Control Vector");
1019 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
1020 tvb, offset, 1, len);
1021 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
1022 tvb, offset+1, 1, type);
1024 proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_si_2,
1025 ett_sna_nlp_opti_14_si_2, opti_14_si_fields, ENC_NA);
1027 proto_tree_add_item(sub_tree, hf_sna_reserved, tvb, offset+3, 1, ENC_NA);
1028 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
1029 tvb, offset+4, 4, ENC_BIG_ENDIAN);
1030 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
1031 tvb, offset+8, 4, ENC_BIG_ENDIAN);
1032 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
1033 tvb, offset+12, 4, ENC_BIG_ENDIAN);
1035 dissect_control(tvb, offset+16, len-16, sub_tree, 1, LT);
1037 pad = (len+3) & 0xfffc;
1039 proto_tree_add_item(sub_tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
1042 len = tvb_get_guint8(tvb, offset);
1043 type = tvb_get_guint8(tvb, offset+1);
1045 if ((type != 0x85) || ( len < 4)) {
1047 call_dissector(data_handle,
1048 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1051 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1052 ett_sna_nlp_opti_14_rr, NULL, "Return Route TG Descriptor Control Vector");
1054 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1055 tvb, offset, 1, len);
1056 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1057 tvb, offset+1, 1, type);
1059 proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_rr_2,
1060 ett_sna_nlp_opti_14_rr_2, opti_14_rr_fields, ENC_NA);
1062 num = tvb_get_guint8(tvb, offset+3);
1064 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1065 tvb, offset+3, 1, num);
1070 sublen = tvb_get_guint8(tvb, offset);
1072 dissect_control(tvb, offset, sublen, sub_tree, 1, LT);
1075 call_dissector(data_handle,
1076 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1079 /* No padding here */
1086 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1089 static const int * opti_22_2_fields[] = {
1090 &hf_sna_nlp_opti_22_type,
1091 &hf_sna_nlp_opti_22_raa,
1092 &hf_sna_nlp_opti_22_parity,
1093 &hf_sna_nlp_opti_22_arb,
1096 static const int * opti_22_3_fields[] = {
1097 &hf_sna_nlp_opti_22_ratereq,
1098 &hf_sna_nlp_opti_22_raterep,
1102 bits = tvb_get_guint8(tvb, 2);
1103 type = (bits & 0xc0) >> 6;
1105 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_22_2,
1106 ett_sna_nlp_opti_22_2, opti_22_2_fields, ENC_NA);
1108 proto_tree_add_bitmask(tree, tvb, 3, hf_sna_nlp_opti_22_3,
1109 ett_sna_nlp_opti_22_3, opti_22_3_fields, ENC_NA);
1111 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1112 tvb, 4, 4, ENC_BIG_ENDIAN);
1113 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1114 tvb, 8, 4, ENC_BIG_ENDIAN);
1117 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1118 tvb, 12, 4, ENC_BIG_ENDIAN);
1119 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1120 tvb, 16, 4, ENC_BIG_ENDIAN);
1122 if (tvb_offset_exists(tvb, 20))
1123 call_dissector(data_handle,
1124 tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1126 if (tvb_offset_exists(tvb, 12))
1127 call_dissector(data_handle,
1128 tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1133 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1135 proto_tree *sub_tree;
1136 int offset, type, len;
1143 while (tvb_offset_exists(tvb, offset)) {
1144 len = tvb_get_guint8(tvb, offset);
1145 type = tvb_get_guint8(tvb, offset+1);
1147 /* Prevent loop for invalid crap in packet */
1150 call_dissector(data_handle,
1151 tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1155 ett = ett_sna_nlp_opti_un;
1156 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1157 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1158 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1159 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1160 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1161 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1162 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1164 sub_tree = proto_tree_add_subtree(tree, tvb,
1165 offset, len << 2, ett, NULL,
1166 val_to_str(type, sna_nlp_opti_vals,
1167 "Unknown Segment Type"));
1168 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1169 tvb, offset, 1, len);
1170 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1171 tvb, offset+1, 1, type);
1175 dissect_optional_0d(tvb_new_subset(tvb, offset,
1176 len << 2, -1), sub_tree);
1179 dissect_optional_0e(tvb_new_subset(tvb, offset,
1180 len << 2, -1), pinfo, sub_tree);
1183 dissect_optional_0f(tvb_new_subset(tvb, offset,
1184 len << 2, -1), pinfo, sub_tree);
1187 dissect_optional_10(tvb_new_subset(tvb, offset,
1188 len << 2, -1), pinfo, sub_tree);
1191 dissect_optional_12(tvb_new_subset(tvb, offset,
1192 len << 2, -1), sub_tree);
1195 dissect_optional_14(tvb_new_subset(tvb, offset,
1196 len << 2, -1), pinfo, sub_tree);
1199 dissect_optional_22(tvb_new_subset(tvb, offset,
1200 len << 2, -1), pinfo, sub_tree);
1203 call_dissector(data_handle,
1204 tvb_new_subset(tvb, offset,
1205 len << 2, -1), pinfo, sub_tree);
1207 offset += (len << 2);
1212 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1213 proto_tree *parent_tree)
1215 proto_tree *nlp_tree;
1216 proto_item *nlp_item;
1217 guint8 nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1218 guint32 thdr_len, thdr_dlf;
1220 static const int * nlp_nhdr_0_fields[] = {
1225 static const int * nlp_nhdr_1_fields[] = {
1228 &hf_sna_nlp_slowdn1,
1229 &hf_sna_nlp_slowdn2,
1232 static const int * nlp_nhdr_8_fields[] = {
1241 static const int * nlp_nhdr_9_fields[] = {
1248 int indx = 0, counter = 0;
1253 nhdr_0 = tvb_get_guint8(tvb, indx);
1254 nhdr_1 = tvb_get_guint8(tvb, indx+1);
1256 col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1259 /* Don't bother setting length. We'll set it later after we
1260 * find the lengths of NHDR */
1261 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1263 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1265 proto_tree_add_bitmask(nlp_tree, tvb, indx, hf_sna_nlp_nhdr_0,
1266 ett_sna_nlp_nhdr_0, nlp_nhdr_0_fields, ENC_NA);
1268 proto_tree_add_bitmask(nlp_tree, tvb, indx+1, hf_sna_nlp_nhdr_1,
1269 ett_sna_nlp_nhdr_1, nlp_nhdr_1_fields, ENC_NA);
1271 /* ANR or FR lists */
1276 if ((nhdr_0 & 0xe0) == 0xa0) {
1278 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1280 } while (nhdr_x != 0xff);
1281 proto_tree_add_item(nlp_tree,
1282 hf_sna_nlp_fra, tvb, indx, counter, ENC_NA);
1284 proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1288 proto_item_set_len(nlp_item, indx);
1290 if ((nhdr_1 & 0xf0) == 0x10) {
1291 proto_tree_add_item(tree, hf_sna_nlp_frh,
1292 tvb, indx, 1, ENC_BIG_ENDIAN);
1295 if (tvb_offset_exists(tvb, indx))
1296 call_dissector(data_handle,
1297 tvb_new_subset_remaining(tvb, indx),
1298 pinfo, parent_tree);
1302 if ((nhdr_0 & 0xe0) == 0xc0) {
1304 nhdr_x = tvb_get_guint8(tvb, indx + counter);
1306 } while (nhdr_x != 0xff);
1307 proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1308 tvb, indx, counter, ENC_NA);
1311 proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1315 proto_item_set_len(nlp_item, indx);
1318 thdr_8 = tvb_get_guint8(tvb, indx+8);
1319 thdr_9 = tvb_get_guint8(tvb, indx+9);
1320 thdr_len = tvb_get_ntohs(tvb, indx+10);
1321 thdr_dlf = tvb_get_ntohl(tvb, indx+12);
1324 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1325 indx, thdr_len << 2, ENC_NA);
1326 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1328 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1331 proto_tree_add_bitmask(nlp_tree, tvb, indx+8, hf_sna_nlp_thdr_8,
1332 ett_sna_nlp_thdr_8, nlp_nhdr_8_fields, ENC_NA);
1334 proto_tree_add_bitmask(nlp_tree, tvb, indx+9, hf_sna_nlp_thdr_9,
1335 ett_sna_nlp_thdr_9, nlp_nhdr_9_fields, ENC_NA);
1337 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, indx+10,
1339 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, indx+12,
1341 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, indx+16,
1346 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindx)) {
1347 counter = tvb_get_guint8(tvb, indx + subindx);
1348 if (tvb_get_guint8(tvb, indx+subindx+1) == 5)
1349 dissect_control(tvb, indx + subindx, counter+2, nlp_tree, 1, LT);
1351 call_dissector(data_handle,
1352 tvb_new_subset(tvb, indx + subindx, counter+2,
1353 -1), pinfo, nlp_tree);
1355 subindx += (counter+2);
1357 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindx))
1359 tvb_new_subset(tvb, indx + subindx,
1360 (thdr_len << 2) - subindx, -1),
1363 indx += (thdr_len << 2);
1364 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1365 col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1366 if (tvb_offset_exists(tvb, indx)) {
1367 call_dissector(data_handle,
1368 tvb_new_subset_remaining(tvb, indx), pinfo,
1373 if (tvb_offset_exists(tvb, indx)) {
1374 /* Transmission Header Format Identifier */
1375 fid = hi_nibble(tvb_get_guint8(tvb, indx));
1376 if (fid == 5) /* Only FID5 allowed for HPR */
1377 dissect_fid(tvb_new_subset_remaining(tvb, indx), pinfo,
1380 if (tvb_get_ntohs(tvb, indx+2) == 0x12ce) {
1382 col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1383 dissect_gds(tvb_new_subset_remaining(tvb, indx),
1384 pinfo, tree, parent_tree);
1386 call_dissector(data_handle,
1387 tvb_new_subset_remaining(tvb, indx),
1388 pinfo, parent_tree);
1393 /* --------------------------------------------------------------------
1394 * Chapter 3 Exchange Identification (XID) Information Fields
1395 * --------------------------------------------------------------------
1399 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1401 proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1406 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1413 dlen = tvb_get_guint8(tvb, 0);
1417 while (tvb_offset_exists(tvb, offset)) {
1418 dlen = tvb_get_guint8(tvb, offset+1);
1419 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1420 offset += (dlen + 2);
1425 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1428 static const int * sna_xid_3_fields[] = {
1429 &hf_sna_xid_3_init_self,
1430 &hf_sna_xid_3_stand_bind,
1431 &hf_sna_xid_3_gener_bind,
1432 &hf_sna_xid_3_recve_bind,
1433 &hf_sna_xid_3_actpu,
1434 &hf_sna_xid_3_nwnode,
1437 &hf_sna_xid_3_state,
1438 &hf_sna_xid_3_nonact,
1439 &hf_sna_xid_3_cpchange,
1442 static const int * sna_xid_10_fields[] = {
1443 &hf_sna_xid_3_asend_bind,
1444 &hf_sna_xid_3_arecv_bind,
1445 &hf_sna_xid_3_quiesce,
1446 &hf_sna_xid_3_pucap,
1448 &hf_sna_xid_3_pacing,
1451 static const int * sna_xid_11_fields[] = {
1452 &hf_sna_xid_3_tgshare,
1453 &hf_sna_xid_3_dedsvc,
1456 static const int * sna_xid_12_fields[] = {
1457 &hf_sna_xid_3_negcsup,
1458 &hf_sna_xid_3_negcomp,
1461 static const int * sna_xid_15_fields[] = {
1462 &hf_sna_xid_3_partg,
1466 &hf_sna_xid_3_genodai,
1467 &hf_sna_xid_3_branch,
1475 proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1477 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_xid_3_8,
1478 ett_sna_xid_3_8, sna_xid_3_fields, ENC_BIG_ENDIAN);
1480 proto_tree_add_bitmask(tree, tvb, 4, hf_sna_xid_3_10,
1481 ett_sna_xid_3_10, sna_xid_10_fields, ENC_BIG_ENDIAN);
1483 proto_tree_add_bitmask(tree, tvb, 5, hf_sna_xid_3_11,
1484 ett_sna_xid_3_11, sna_xid_11_fields, ENC_BIG_ENDIAN);
1486 proto_tree_add_bitmask(tree, tvb, 6, hf_sna_xid_3_12,
1487 ett_sna_xid_3_12, sna_xid_12_fields, ENC_BIG_ENDIAN);
1489 proto_tree_add_item(tree, hf_sna_reserved, tvb, 7, 2, ENC_NA);
1491 proto_tree_add_bitmask(tree, tvb, 9, hf_sna_xid_3_15,
1492 ett_sna_xid_3_15, sna_xid_15_fields, ENC_BIG_ENDIAN);
1494 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1495 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1497 dlen = tvb_get_guint8(tvb, 12);
1499 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1501 /* FIXME: DLC Dependent Data Go Here */
1505 while (tvb_offset_exists(tvb, offset)) {
1506 dlen = tvb_get_guint8(tvb, offset+1);
1507 dissect_control(tvb, offset, dlen+2, tree, 0, KL);
1513 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1514 proto_tree *parent_tree)
1516 proto_tree *sub_tree;
1517 proto_item *sub_ti = NULL;
1518 int format, type, len;
1521 len = tvb_get_guint8(tvb, 1);
1522 type = tvb_get_guint8(tvb, 0);
1523 id = tvb_get_ntohl(tvb, 2);
1524 format = hi_nibble(type);
1526 /* Summary information */
1527 col_add_fstr(pinfo->cinfo, COL_INFO,
1528 "SNA XID Format:%d Type:%s", format,
1529 val_to_str_const(lo_nibble(type), sna_xid_type_vals,
1533 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1534 0, 1, ENC_BIG_ENDIAN);
1535 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1537 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1539 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1542 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1544 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1545 2, 4, ENC_BIG_ENDIAN);
1546 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1548 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1550 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1557 dissect_xid1(tvb_new_subset(tvb, 6, len-6, -1),
1561 dissect_xid2(tvb_new_subset(tvb, 6, len-6, -1),
1565 dissect_xid3(tvb_new_subset(tvb, 6, len-6, -1),
1569 /* external standards organizations */
1570 call_dissector(data_handle,
1571 tvb_new_subset(tvb, 6, len-6, -1),
1579 if (tvb_offset_exists(tvb, len))
1580 call_dissector(data_handle,
1581 tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1584 /* --------------------------------------------------------------------
1585 * Chapter 4 Transmission Headers (THs)
1586 * --------------------------------------------------------------------
1592 mpf_value(guint8 th_byte)
1594 return (th_byte & 0x0c) >> 2;
1597 #define FIRST_FRAG_NUMBER 0
1598 #define MIDDLE_FRAG_NUMBER 1
1599 #define LAST_FRAG_NUMBER 2
1601 /* FID2 is defragged by sequence. The weird thing is that we have neither
1602 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1603 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1604 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1605 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1606 * and 2. However, if the BIU is split into 2 frames, then we only have
1607 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1610 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1611 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1612 * see the FTP URL in the comment near the top of this file). I *think*
1613 * this means that the fragmented frames cannot arrive out of order.
1614 * Well, I *want* it to mean this, because w/o this limitation, if you
1615 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1616 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1617 * arrive in order, then we're saved.
1619 * The problem then boils down to figuring out if "LAST" means frag-number 1
1620 * (in the case of a BIU split into 2 frames) or frag-number 2
1621 * (in the case of a BIU split into 3 frames).
1623 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1624 * way to handle the mapping of "LAST" to either frag-number 1 or
1625 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1626 * This consumes resources. A trickier way, but a way which works, is to
1627 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1628 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1629 * and the reassembly code tells us that the the BIU is still not reassmebled,
1630 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1631 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1632 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1633 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1634 * to complete the reassembly.
1637 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1640 fragment_head *fd_head;
1641 int frag_number = -1;
1642 int more_frags = TRUE;
1643 tvbuff_t *rh_tvb = NULL;
1646 /* Determine frag_number and more_frags */
1651 case MPF_FIRST_SEGMENT:
1652 frag_number = FIRST_FRAG_NUMBER;
1654 case MPF_MIDDLE_SEGMENT:
1655 frag_number = MIDDLE_FRAG_NUMBER;
1657 case MPF_LAST_SEGMENT:
1658 frag_number = LAST_FRAG_NUMBER;
1662 DISSECTOR_ASSERT_NOT_REACHED();
1665 /* If sna_defragment is on, and this is a fragment.. */
1666 if (frag_number > -1) {
1667 /* XXX - check length ??? */
1668 frag_len = tvb_reported_length_remaining(tvb, offset);
1669 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1670 fd_head = fragment_add_seq(&sna_reassembly_table,
1671 tvb, offset, pinfo, id, NULL,
1672 frag_number, frag_len, more_frags, 0);
1674 /* We added the LAST segment and reassembly didn't
1675 * complete. Insert a zero-length MIDDLE segment to
1676 * turn a 2-frame BIU-fragmentation into a 3-frame
1677 * BIU-fragmentation (empty middle frag).
1678 * See above long comment about this trickery. */
1680 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1681 fd_head = fragment_add_seq(&sna_reassembly_table,
1682 tvb, offset, pinfo, id, NULL,
1683 MIDDLE_FRAG_NUMBER, 0, TRUE, 0);
1686 if (fd_head != NULL) {
1687 /* We have the complete reassembled payload. */
1688 rh_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
1690 /* Add the defragmented data to the data
1692 add_new_data_source(pinfo, rh_tvb,
1693 "Reassembled SNA BIU");
1700 #define SNA_FID01_ADDR_LEN 2
1702 /* FID Types 0 and 1 */
1704 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1706 proto_tree *bf_tree;
1707 proto_item *bf_item;
1710 const int bytes_in_header = 10;
1714 th_0 = tvb_get_guint8(tvb, 0);
1715 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1717 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1719 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1720 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1721 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1724 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1727 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1731 TVB_SET_ADDRESS(&pinfo->net_dst, sna_address_type, tvb, 2, SNA_FID01_ADDR_LEN);
1732 COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
1734 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1737 TVB_SET_ADDRESS(&pinfo->net_src, sna_address_type, tvb, 4, SNA_FID01_ADDR_LEN);
1738 COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
1740 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1741 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1743 return bytes_in_header;
1746 #define SNA_FID2_ADDR_LEN 1
1750 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1751 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1753 proto_tree *bf_tree;
1754 proto_item *bf_item;
1756 unsigned int mpf, id;
1758 const int bytes_in_header = 6;
1760 th_0 = tvb_get_guint8(tvb, 0);
1761 mpf = mpf_value(th_0);
1766 bf_item = proto_tree_add_item(tree, hf_sna_th_0, tvb, 0, 1, ENC_BIG_ENDIAN);
1767 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1769 proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, 0, 1, ENC_BIG_ENDIAN);
1770 proto_tree_add_item(bf_tree, hf_sna_th_mpf, tvb, 0, 1, ENC_BIG_ENDIAN);
1771 proto_tree_add_item(bf_tree, hf_sna_th_odai,tvb, 0, 1, ENC_BIG_ENDIAN);
1772 proto_tree_add_item(bf_tree, hf_sna_th_efi, tvb, 0, 1, ENC_BIG_ENDIAN);
1776 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1779 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 1, ENC_BIG_ENDIAN);
1783 TVB_SET_ADDRESS(&pinfo->net_dst, sna_address_type, tvb, 2, SNA_FID2_ADDR_LEN);
1784 COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
1787 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_BIG_ENDIAN);
1790 TVB_SET_ADDRESS(&pinfo->net_src, sna_address_type, tvb, 3, SNA_FID2_ADDR_LEN);
1791 COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
1793 id = tvb_get_ntohs(tvb, 4);
1794 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN);
1796 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1797 if (mpf == MPF_FIRST_SEGMENT) {
1798 *continue_dissecting = rh_only;
1800 *continue_dissecting = stop_here;
1804 else if (sna_defragment) {
1805 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1806 bytes_in_header, mpf, id);
1809 return bytes_in_header;
1814 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1816 proto_tree *bf_tree;
1817 proto_item *bf_item;
1820 const int bytes_in_header = 2;
1822 /* If we're not filling a proto_tree, return now */
1824 return bytes_in_header;
1826 th_0 = tvb_get_guint8(tvb, 0);
1828 /* Create the bitfield tree */
1829 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1830 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1832 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1833 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1834 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1836 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1838 return bytes_in_header;
1842 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1845 guint8 th_byte, mft;
1848 static const int * byte0_fields[] = {
1850 &hf_sna_th_tg_sweep,
1851 &hf_sna_th_er_vr_supp_ind,
1852 &hf_sna_th_vr_pac_cnt_ind,
1853 &hf_sna_th_ntwk_prty,
1856 static const int * byte1_fields[] = {
1862 static const int * byte2_mft_fields[] = {
1868 static const int * byte2_fields[] = {
1873 static const int * byte3_fields[] = {
1878 static const int * byte4_fields[] = {
1880 &hf_sna_th_tg_nonfifo_ind,
1882 /* I'm not sure about byte-order on this one... */
1886 static const int * byte6_fields[] = {
1891 /* I'm not sure about byte-order on this one... */
1892 &hf_sna_th_vr_snf_send,
1895 static const int * byte16_fields[] = {
1897 /* We luck out here because in their infinite wisdom the SNA
1898 * architects placed the MPF and EFI fields in the same bitfield
1899 * locations, even though for FID4 they're not in byte 0.
1906 struct sna_fid_type_4_addr *src, *dst;
1908 const int bytes_in_header = 26;
1910 /* If we're not filling a proto_tree, return now */
1912 return bytes_in_header;
1915 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_0,
1916 ett_sna_th_fid, byte0_fields, ENC_NA);
1919 th_byte = tvb_get_guint8(tvb, offset);
1922 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte1,
1923 ett_sna_th_fid, byte1_fields, ENC_NA);
1925 mft = th_byte & 0x04;
1930 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1931 ett_sna_th_fid, byte2_mft_fields, ENC_NA);
1933 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1934 ett_sna_th_fid, byte2_fields, ENC_NA);
1940 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte3,
1941 ett_sna_th_fid, byte3_fields, ENC_NA);
1945 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte4,
1946 ett_sna_th_fid, byte4_fields, ENC_BIG_ENDIAN);
1949 /* Create the bitfield tree */
1950 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte6,
1951 ett_sna_th_fid, byte6_fields, ENC_BIG_ENDIAN);
1954 dsaf = tvb_get_ntohl(tvb, 8);
1956 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
1960 osaf = tvb_get_ntohl(tvb, 12);
1962 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
1967 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte16,
1968 ett_sna_th_fid, byte16_fields, ENC_NA);
1970 /* 1 for byte 16, 1 for byte 17 which is reserved */
1973 def = tvb_get_ntohs(tvb, 18);
1975 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
1977 /* Addresses in FID 4 are discontiguous, sigh */
1978 dst = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1981 SET_ADDRESS(&pinfo->net_dst, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, dst);
1982 COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
1984 oef = tvb_get_ntohs(tvb, 20);
1985 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
1987 /* Addresses in FID 4 are discontiguous, sigh */
1988 src = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1991 SET_ADDRESS(&pinfo->net_src, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, src);
1992 COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
1994 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1995 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1997 return bytes_in_header;
2002 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
2004 proto_tree *bf_tree;
2005 proto_item *bf_item;
2008 const int bytes_in_header = 12;
2010 /* If we're not filling a proto_tree, return now */
2012 return bytes_in_header;
2014 th_0 = tvb_get_guint8(tvb, 0);
2016 /* Create the bitfield tree */
2017 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2018 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2020 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2021 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
2022 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
2024 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
2025 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
2027 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
2029 return bytes_in_header;
2035 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2037 proto_tree *bf_tree;
2038 proto_item *bf_item;
2041 const int bytes_in_header = 26;
2043 /* If we're not filling a proto_tree, return now */
2045 return bytes_in_header;
2047 th_0 = tvb_get_guint8(tvb, 0);
2049 /* Create the bitfield tree */
2050 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2051 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2053 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2054 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
2056 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, ENC_BIG_ENDIAN);
2057 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2058 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, ENC_BIG_ENDIAN);
2060 /* Yup, bytes 6-23 are reserved! */
2061 proto_tree_add_item(tree, hf_sna_reserved, tvb, 6, 18, ENC_NA);
2063 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2065 return bytes_in_header;
2069 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2070 proto_tree *parent_tree)
2073 proto_tree *th_tree = NULL, *rh_tree = NULL;
2074 proto_item *th_ti = NULL, *rh_ti = NULL;
2076 int th_header_len = 0;
2077 int offset, rh_offset;
2078 tvbuff_t *rh_tvb = NULL;
2079 next_dissection_t continue_dissecting = everything;
2081 /* Transmission Header Format Identifier */
2082 th_fid = hi_nibble(tvb_get_guint8(tvb, 0));
2084 /* Summary information */
2085 col_add_str(pinfo->cinfo, COL_INFO,
2086 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2090 /* Don't bother setting length. We'll set it later after we
2091 * find the length of TH */
2092 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2094 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2097 /* Get size of TH */
2101 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2104 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2105 &rh_tvb, &continue_dissecting);
2108 th_header_len = dissect_fid3(tvb, th_tree);
2111 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2114 th_header_len = dissect_fid5(tvb, th_tree);
2117 th_header_len = dissect_fidf(tvb, th_tree);
2120 call_dissector(data_handle,
2121 tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2125 offset = th_header_len;
2127 /* Short-circuit ? */
2128 if (continue_dissecting == stop_here) {
2129 proto_tree_add_item(tree, hf_sna_biu_segment_data, tvb, offset, -1, ENC_NA);
2133 /* If the FID dissector function didn't create an rh_tvb, then we just
2134 * use the rest of our tvbuff as the rh_tvb. */
2136 rh_tvb = tvb_new_subset_remaining(tvb, offset);
2139 /* Process the rest of the SNA packet, starting with RH */
2141 proto_item_set_len(th_ti, th_header_len);
2144 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2146 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2147 dissect_rh(rh_tvb, rh_offset, rh_tree);
2150 rh_offset += RH_LEN;
2152 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2153 /* Short-circuit ? */
2154 if (continue_dissecting == rh_only) {
2155 proto_tree_add_item(tree, hf_sna_biu_segment_data, rh_tvb, rh_offset, -1, ENC_NA);
2159 call_dissector(data_handle,
2160 tvb_new_subset_remaining(rh_tvb, rh_offset),
2161 pinfo, parent_tree);
2165 /* --------------------------------------------------------------------
2166 * Chapter 5 Request/Response Headers (RHs)
2167 * --------------------------------------------------------------------
2171 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2173 gboolean is_response;
2175 static const int * sna_rh_fields[] = {
2177 &hf_sna_rh_ru_category,
2184 static const int * sna_rh_1_req_fields[] = {
2194 static const int * sna_rh_1_rsp_fields[] = {
2202 static const int * sna_rh_2_req_fields[] = {
2216 /* Create the bitfield tree for byte 0*/
2217 rh_0 = tvb_get_guint8(tvb, offset);
2218 is_response = (rh_0 & 0x80);
2220 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_0,
2221 ett_sna_rh_0, sna_rh_fields, ENC_BIG_ENDIAN);
2224 /* Create the bitfield tree for byte 1*/
2226 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2227 ett_sna_rh_1, sna_rh_1_rsp_fields, ENC_BIG_ENDIAN);
2229 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2230 ett_sna_rh_1, sna_rh_1_req_fields, ENC_BIG_ENDIAN);
2234 /* Create the bitfield tree for byte 2*/
2236 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_2,
2237 ett_sna_rh_2, sna_rh_2_req_fields, ENC_BIG_ENDIAN);
2239 proto_tree_add_item(tree, hf_sna_rh_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2242 /* XXX - check for sdi. If TRUE, the next 4 bytes will be sense data */
2245 /* --------------------------------------------------------------------
2246 * Chapter 6 Request/Response Units (RUs)
2247 * --------------------------------------------------------------------
2250 /* --------------------------------------------------------------------
2251 * Chapter 9 Common Fields
2252 * --------------------------------------------------------------------
2256 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2259 guint16 offset, len, pad;
2260 static const int * sna_control_05hpr_fields[] = {
2261 &hf_sna_control_05_ptp,
2268 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_control_05_type,
2269 ett_sna_control_05hpr_type, sna_control_05hpr_fields, ENC_BIG_ENDIAN);
2271 proto_tree_add_item(tree, hf_sna_reserved, tvb, 3, 1, ENC_NA);
2275 while (tvb_offset_exists(tvb, offset)) {
2277 len = tvb_get_guint8(tvb, offset+0);
2279 len = tvb_get_guint8(tvb, offset+1);
2282 dissect_control(tvb, offset, len, tree, hpr, parse);
2283 pad = (len+3) & 0xfffc;
2285 proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
2295 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2300 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2304 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2311 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2313 len = tvb_reported_length_remaining(tvb, 3);
2317 proto_tree_add_item(tree, hf_sna_control_0e_value, tvb, 3, len, ENC_EBCDIC|ENC_NA);
2321 dissect_control(tvbuff_t *parent_tvb, int offset, int control_len,
2322 proto_tree *tree, int hpr, enum parse parse)
2325 gint length, reported_length;
2326 proto_tree *sub_tree;
2330 length = tvb_captured_length_remaining(parent_tvb, offset);
2331 reported_length = tvb_reported_length_remaining(parent_tvb, offset);
2332 if (control_len < length)
2333 length = control_len;
2334 if (control_len < reported_length)
2335 reported_length = control_len;
2336 tvb = tvb_new_subset(parent_tvb, offset, length, reported_length);
2341 len = tvb_get_guint8(tvb, 0);
2342 key = tvb_get_guint8(tvb, 1);
2344 key = tvb_get_guint8(tvb, 0);
2345 len = tvb_get_guint8(tvb, 1);
2347 ett = ett_sna_control_un;
2351 if (hpr) ett = ett_sna_control_05hpr;
2352 else ett = ett_sna_control_05;
2354 if (key == 0x0e) ett = ett_sna_control_0e;
2356 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2357 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2358 val_to_str_const(key, sna_control_hpr_vals,
2359 "Unknown Control Vector"));
2361 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2362 val_to_str_const(key, sna_control_vals,
2363 "Unknown Control Vector"));
2365 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2367 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2368 proto_tree_add_uint(sub_tree,
2369 hf_sna_control_hprkey, tvb, 1, 1, key);
2371 proto_tree_add_uint(sub_tree,
2372 hf_sna_control_key, tvb, 1, 1, key);
2374 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2375 proto_tree_add_uint(sub_tree,
2376 hf_sna_control_hprkey, tvb, 0, 1, key);
2378 proto_tree_add_uint(sub_tree,
2379 hf_sna_control_key, tvb, 0, 1, key);
2380 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2387 dissect_control_05hpr(tvb, sub_tree, hpr,
2390 dissect_control_05(tvb, sub_tree);
2393 dissect_control_0e(tvb, sub_tree);
2398 /* --------------------------------------------------------------------
2399 * Chapter 11 Function Management (FM) Headers
2400 * --------------------------------------------------------------------
2403 /* --------------------------------------------------------------------
2404 * Chapter 12 Presentation Services (PS) Headers
2405 * --------------------------------------------------------------------
2408 /* --------------------------------------------------------------------
2409 * Chapter 13 GDS Variables
2410 * --------------------------------------------------------------------
2414 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2415 proto_tree *parent_tree)
2420 static const int * flags[] = {
2428 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2429 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2431 if (length < 2 ) /* escape sequence ? */
2434 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_gds, ett_sna_gds, flags, ENC_BIG_ENDIAN);
2438 if (tvb_offset_exists(tvb, offset))
2439 call_dissector(data_handle,
2440 tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2443 /* --------------------------------------------------------------------
2445 * --------------------------------------------------------------------
2449 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2452 proto_tree *sna_tree = NULL;
2453 proto_item *sna_ti = NULL;
2455 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2456 col_clear(pinfo->cinfo, COL_INFO);
2458 /* SNA data should be printed in EBCDIC, not ASCII */
2459 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2463 /* Don't bother setting length. We'll set it later after we find
2464 * the lengths of TH/RH/RU */
2465 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2467 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2470 /* Transmission Header Format Identifier */
2471 fid = hi_nibble(tvb_get_guint8(tvb, 0));
2473 case 0xa: /* HPR Network Layer Packet */
2477 dissect_nlp(tvb, pinfo, sna_tree, tree);
2480 dissect_fid(tvb, pinfo, sna_tree, tree);
2485 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2487 proto_tree *sna_tree = NULL;
2488 proto_item *sna_ti = NULL;
2490 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2491 col_clear(pinfo->cinfo, COL_INFO);
2493 /* SNA data should be printed in EBCDIC, not ASCII */
2494 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2498 /* Don't bother setting length. We'll set it later after we find
2499 * the lengths of XID */
2500 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2502 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2504 dissect_xid(tvb, pinfo, sna_tree, tree);
2510 reassembly_table_init(&sna_reassembly_table,
2511 &addresses_reassembly_table_functions);
2516 proto_register_sna(void)
2518 static hf_register_info hf[] = {
2520 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2521 NULL, 0x0, NULL, HFILL }},
2524 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2526 "TH Byte 0", HFILL }},
2529 { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2530 VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2533 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2534 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2537 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2538 BASE_DEC, NULL, 0x02, NULL, HFILL }},
2541 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2542 BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2545 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2546 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2549 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2550 NULL, 0x0, NULL, HFILL }},
2553 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2554 NULL, 0x0, NULL, HFILL }},
2557 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2558 NULL, 0x0, NULL, HFILL }},
2561 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2562 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2564 { &hf_sna_th_tg_sweep,
2565 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2566 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2568 { &hf_sna_th_er_vr_supp_ind,
2569 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2570 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2571 0x04, NULL, HFILL }},
2573 { &hf_sna_th_vr_pac_cnt_ind,
2574 { "Virtual Route Pacing Count Indicator",
2575 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2576 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2578 { &hf_sna_th_ntwk_prty,
2579 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2580 VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2583 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2584 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2588 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2589 NULL, 0x04, NULL, HFILL }},
2592 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2593 VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2596 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2597 BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2600 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2601 VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2603 { &hf_sna_th_nlp_cp,
2604 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2605 NULL, 0x70, NULL, HFILL }},
2608 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2609 NULL, 0x0f, NULL, HFILL }},
2612 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2613 NULL, 0xf0, NULL, HFILL }},
2616 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2617 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2619 { &hf_sna_th_vr_cwi,
2620 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2621 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2622 "Change Window Indicator", HFILL }},
2624 { &hf_sna_th_tg_nonfifo_ind,
2625 { "Transmission Group Non-FIFO Indicator",
2626 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2627 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2629 { &hf_sna_th_vr_sqti,
2630 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2631 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2632 "Route Sequence and Type", HFILL }},
2634 { &hf_sna_th_tg_snf,
2635 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2636 FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2639 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2640 16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2643 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2644 16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2646 { &hf_sna_th_vr_cwri,
2647 { "Virtual Route Change Window Reply Indicator",
2648 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2649 VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2651 { &hf_sna_th_vr_rwi,
2652 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2653 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2656 { &hf_sna_th_vr_snf_send,
2657 { "Virtual Route Send Sequence Number Field",
2658 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2659 "Send Sequence Number Field", HFILL }},
2662 { "Destination Subarea Address Field", "sna.th.dsaf",
2663 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2666 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2667 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2670 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2671 "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2674 { "Destination Element Field", "sna.th.def", FT_UINT16,
2675 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2678 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2679 NULL, 0x0, NULL, HFILL }},
2682 { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2683 NULL, 0x0, NULL, HFILL }},
2685 { &hf_sna_th_cmd_fmt,
2686 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2687 NULL, 0x0, NULL, HFILL }},
2689 { &hf_sna_th_cmd_type,
2690 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2691 NULL, 0x0, NULL, HFILL }},
2693 { &hf_sna_th_cmd_sn,
2694 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2695 BASE_DEC, NULL, 0x0, NULL, HFILL }},
2698 { "Transmission Header Bytes 1", "sna.th.byte1", FT_UINT8,
2699 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2702 { "Transmission Header Bytes 2", "sna.th.byte2", FT_UINT8,
2703 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2706 { "Transmission Header Bytes 3", "sna.th.byte3", FT_UINT8,
2707 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2710 { "Transmission Header Bytes 4-5", "sna.th.byte4", FT_UINT16,
2711 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2714 { "Transmission Header Bytes 6-7", "sna.th.byte6", FT_UINT16,
2715 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2717 { &hf_sna_th_byte16,
2718 { "Transmission Header Bytes 16", "sna.th.byte16", FT_UINT8,
2719 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2722 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2723 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2725 { &hf_sna_nlp_nhdr_0,
2726 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2727 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2729 { &hf_sna_nlp_nhdr_1,
2730 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2731 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2734 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2735 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2738 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2739 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2742 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2743 VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2746 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2747 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2749 { &hf_sna_nlp_slowdn1,
2750 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2751 TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2753 { &hf_sna_nlp_slowdn2,
2754 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2755 TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2758 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2759 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2762 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2763 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2766 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2767 BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2770 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2771 NULL, 0x0, "THDR", HFILL }},
2774 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2775 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2777 { &hf_sna_nlp_thdr_8,
2778 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2779 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2781 { &hf_sna_nlp_setupi,
2782 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2783 TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2786 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2787 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2790 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2791 8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2794 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2795 8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2797 { &hf_sna_nlp_rasapi,
2798 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2799 8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2801 { &hf_sna_nlp_retryi,
2802 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2803 8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2805 { &hf_sna_nlp_thdr_9,
2806 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2807 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2810 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2811 8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2814 { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2815 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2818 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2819 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2821 { &hf_sna_nlp_offset,
2822 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2823 NULL, 0x0, "Data Offset in Words", HFILL }},
2826 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2827 NULL, 0x0, NULL, HFILL }},
2830 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2831 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2833 { &hf_sna_nlp_opti_len,
2834 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2835 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2837 { &hf_sna_nlp_opti_type,
2838 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2839 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2842 { &hf_sna_nlp_opti_0d_version,
2843 { "Version", "sna.nlp.thdr.optional.0d.version",
2844 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2847 { &hf_sna_nlp_opti_0d_4,
2848 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2849 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2851 { &hf_sna_nlp_opti_0d_target,
2852 { "Target Resource ID Present",
2853 "sna.nlp.thdr.optional.0d.target",
2854 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2856 { &hf_sna_nlp_opti_0d_arb,
2857 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2858 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2860 { &hf_sna_nlp_opti_0d_reliable,
2861 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2862 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2864 { &hf_sna_nlp_opti_0d_dedicated,
2865 { "Dedicated RTP Connection",
2866 "sna.nlp.thdr.optional.0d.dedicated",
2867 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2869 { &hf_sna_nlp_opti_0e_stat,
2870 { "Status", "sna.nlp.thdr.optional.0e.stat",
2871 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2873 { &hf_sna_nlp_opti_0e_gap,
2874 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2875 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2877 { &hf_sna_nlp_opti_0e_idle,
2878 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2879 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2881 { &hf_sna_nlp_opti_0e_nabsp,
2882 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2883 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2885 { &hf_sna_nlp_opti_0e_sync,
2886 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2887 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2889 { &hf_sna_nlp_opti_0e_echo,
2890 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2891 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2893 { &hf_sna_nlp_opti_0e_rseq,
2894 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2895 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2898 { &hf_sna_nlp_opti_0e_abspbeg,
2899 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2900 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2904 { &hf_sna_nlp_opti_0e_abspend,
2905 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2906 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2909 { &hf_sna_nlp_opti_0f_bits,
2910 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2911 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2912 0x0, NULL, HFILL }},
2914 { &hf_sna_nlp_opti_10_tcid,
2915 { "Transport Connection Identifier",
2916 "sna.nlp.thdr.optional.10.tcid",
2917 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2919 { &hf_sna_nlp_opti_12_sense,
2920 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
2921 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2923 { &hf_sna_nlp_opti_14_si_len,
2924 { "Length", "sna.nlp.thdr.optional.14.si.len",
2925 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2927 { &hf_sna_nlp_opti_14_si_key,
2928 { "Key", "sna.nlp.thdr.optional.14.si.key",
2929 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2931 { &hf_sna_nlp_opti_14_si_2,
2932 { "Switching Information Byte 2",
2933 "sna.nlp.thdr.optional.14.si.2",
2934 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2936 { &hf_sna_nlp_opti_14_si_refifo,
2937 { "Resequencing (REFIFO) Indicator",
2938 "sna.nlp.thdr.optional.14.si.refifo",
2939 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2941 { &hf_sna_nlp_opti_14_si_mobility,
2942 { "Mobility Indicator",
2943 "sna.nlp.thdr.optional.14.si.mobility",
2944 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2946 { &hf_sna_nlp_opti_14_si_dirsearch,
2947 { "Directory Search Required on Path Switch Indicator",
2948 "sna.nlp.thdr.optional.14.si.dirsearch",
2949 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
2951 { &hf_sna_nlp_opti_14_si_limitres,
2952 { "Limited Resource Link Indicator",
2953 "sna.nlp.thdr.optional.14.si.limitres",
2954 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2956 { &hf_sna_nlp_opti_14_si_ncescope,
2957 { "NCE Scope Indicator",
2958 "sna.nlp.thdr.optional.14.si.ncescope",
2959 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2961 { &hf_sna_nlp_opti_14_si_mnpsrscv,
2962 { "MNPS RSCV Retention Indicator",
2963 "sna.nlp.thdr.optional.14.si.mnpsrscv",
2964 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2966 { &hf_sna_nlp_opti_14_si_maxpsize,
2967 { "Maximum Packet Size On Return Path",
2968 "sna.nlp.thdr.optional.14.si.maxpsize",
2969 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2971 { &hf_sna_nlp_opti_14_si_switch,
2972 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
2973 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2975 { &hf_sna_nlp_opti_14_si_alive,
2976 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
2977 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2979 { &hf_sna_nlp_opti_14_rr_len,
2980 { "Length", "sna.nlp.thdr.optional.14.rr.len",
2981 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2983 { &hf_sna_nlp_opti_14_rr_key,
2984 { "Key", "sna.nlp.thdr.optional.14.rr.key",
2985 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2987 { &hf_sna_nlp_opti_14_rr_2,
2988 { "Return Route TG Descriptor Byte 2",
2989 "sna.nlp.thdr.optional.14.rr.2",
2990 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2992 { &hf_sna_nlp_opti_14_rr_bfe,
2993 { "BF Entry Indicator",
2994 "sna.nlp.thdr.optional.14.rr.bfe",
2995 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2997 { &hf_sna_nlp_opti_14_rr_num,
2998 { "Number Of TG Control Vectors",
2999 "sna.nlp.thdr.optional.14.rr.num",
3000 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3002 { &hf_sna_nlp_opti_22_2,
3003 { "Adaptive Rate Based Segment Byte 2",
3004 "sna.nlp.thdr.optional.22.2",
3005 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3007 { &hf_sna_nlp_opti_22_type,
3009 "sna.nlp.thdr.optional.22.type",
3011 VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
3013 { &hf_sna_nlp_opti_22_raa,
3014 { "Rate Adjustment Action",
3015 "sna.nlp.thdr.optional.22.raa",
3017 VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
3019 { &hf_sna_nlp_opti_22_parity,
3020 { "Parity Indicator",
3021 "sna.nlp.thdr.optional.22.parity",
3022 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3024 { &hf_sna_nlp_opti_22_arb,
3026 "sna.nlp.thdr.optional.22.arb",
3028 VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
3030 { &hf_sna_nlp_opti_22_3,
3031 { "Adaptive Rate Based Segment Byte 3",
3032 "sna.nlp.thdr.optional.22.3",
3033 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3035 { &hf_sna_nlp_opti_22_ratereq,
3036 { "Rate Request Correlator",
3037 "sna.nlp.thdr.optional.22.ratereq",
3038 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3040 { &hf_sna_nlp_opti_22_raterep,
3041 { "Rate Reply Correlator",
3042 "sna.nlp.thdr.optional.22.raterep",
3043 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3045 { &hf_sna_nlp_opti_22_field1,
3046 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3047 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3049 { &hf_sna_nlp_opti_22_field2,
3050 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3051 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3053 { &hf_sna_nlp_opti_22_field3,
3054 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3055 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3057 { &hf_sna_nlp_opti_22_field4,
3058 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3059 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3062 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3063 NULL, 0x0, NULL, HFILL }},
3066 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3067 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3070 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3071 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3074 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3075 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3078 { "Request/Response Indicator", "sna.rh.rri", FT_UINT8,
3079 BASE_DEC, VALS(sna_rh_rri_vals), 0x80, NULL, HFILL }},
3081 { &hf_sna_rh_ru_category,
3082 { "Request/Response Unit Category", "sna.rh.ru_category",
3083 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3087 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3088 TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3091 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3092 TFS(&sna_rh_sdi_truth), 0x04, NULL, HFILL }},
3095 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3096 TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3099 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3100 TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3103 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3104 8, NULL, 0x80, NULL, HFILL }},
3107 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3108 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3111 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3112 8, NULL, 0x20, NULL, HFILL }},
3115 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3116 8, NULL, 0x10, NULL, HFILL }},
3119 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3120 8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3123 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3124 8, NULL, 0x04, NULL, HFILL }},
3127 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3128 8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3131 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3132 8, NULL, 0x01, NULL, HFILL }},
3135 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3136 8, NULL, 0x80, NULL, HFILL }},
3139 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3140 8, NULL, 0x40, NULL, HFILL }},
3143 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3144 8, NULL, 0x20, NULL, HFILL }},
3147 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3148 VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3151 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3152 NULL, 0x04, NULL, HFILL }},
3155 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3156 0x02, NULL, HFILL }},
3159 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3160 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3163 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3164 NULL, 0x0, NULL, HFILL }},*/
3167 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3171 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3172 NULL, 0x7fff, NULL, HFILL }},
3175 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3176 0x8000, NULL, HFILL }},
3179 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3180 VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3184 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3185 "XID Frame", HFILL }},
3189 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3192 { &hf_sna_xid_format,
3193 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3194 0xf0, NULL, HFILL }},
3197 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3198 VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3201 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3205 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3206 NULL, 0x0, NULL, HFILL }},
3208 { &hf_sna_xid_idblock,
3209 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3210 0xfff00000, NULL, HFILL }},
3212 { &hf_sna_xid_idnum,
3213 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3214 0x0fffff, NULL, HFILL }},
3217 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3218 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3220 { &hf_sna_xid_3_init_self,
3221 { "INIT-SELF support", "sna.xid.type3.initself",
3222 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3224 { &hf_sna_xid_3_stand_bind,
3225 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3226 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3228 { &hf_sna_xid_3_gener_bind,
3229 { "Whole BIND PIU generated indicator",
3230 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3231 "Whole BIND PIU generated", HFILL }},
3233 { &hf_sna_xid_3_recve_bind,
3234 { "Whole BIND PIU required indicator",
3235 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3236 "Whole BIND PIU required", HFILL }},
3238 { &hf_sna_xid_3_actpu,
3239 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3240 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3242 { &hf_sna_xid_3_nwnode,
3243 { "Sender is network node", "sna.xid.type3.nwnode",
3244 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3247 { "Control Point Services", "sna.xid.type3.cp",
3248 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3250 { &hf_sna_xid_3_cpcp,
3251 { "CP-CP session support", "sna.xid.type3.cpcp",
3252 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3254 { &hf_sna_xid_3_state,
3255 { "XID exchange state indicator", "sna.xid.type3.state",
3256 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3257 0x000c, NULL, HFILL }},
3259 { &hf_sna_xid_3_nonact,
3260 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3261 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3263 { &hf_sna_xid_3_cpchange,
3264 { "CP name change support", "sna.xid.type3.cpchange",
3265 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3268 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3269 NULL, 0x0, NULL, HFILL }},
3271 { &hf_sna_xid_3_asend_bind,
3272 { "Adaptive BIND pacing support as sender",
3273 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3274 "Pacing support as sender", HFILL }},
3276 { &hf_sna_xid_3_arecv_bind,
3277 { "Adaptive BIND pacing support as receiver",
3278 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3279 "Pacing support as receive", HFILL }},
3281 { &hf_sna_xid_3_quiesce,
3282 { "Quiesce TG Request",
3283 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3286 { &hf_sna_xid_3_pucap,
3287 { "PU Capabilities",
3288 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3291 { &hf_sna_xid_3_pbn,
3292 { "Peripheral Border Node",
3293 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3296 { &hf_sna_xid_3_pacing,
3297 { "Qualifier for adaptive BIND pacing support",
3298 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3302 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3303 NULL, 0x0, NULL, HFILL }},
3305 { &hf_sna_xid_3_tgshare,
3306 { "TG Sharing Prohibited Indicator",
3307 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3310 { &hf_sna_xid_3_dedsvc,
3311 { "Dedicated SVC Indicator",
3312 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3316 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3317 NULL, 0x0, NULL, HFILL }},
3319 { &hf_sna_xid_3_negcsup,
3320 { "Negotiation Complete Supported",
3321 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3324 { &hf_sna_xid_3_negcomp,
3325 { "Negotiation Complete",
3326 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3330 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3331 NULL, 0x0, NULL, HFILL }},
3333 { &hf_sna_xid_3_partg,
3334 { "Parallel TG Support",
3335 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3338 { &hf_sna_xid_3_dlur,
3339 { "Dependent LU Requester Indicator",
3340 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3343 { &hf_sna_xid_3_dlus,
3344 { "DLUS Served LU Registration Indicator",
3345 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3348 { &hf_sna_xid_3_exbn,
3349 { "Extended HPR Border Node",
3350 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3353 { &hf_sna_xid_3_genodai,
3354 { "Generalized ODAI Usage Option",
3355 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3358 { &hf_sna_xid_3_branch,
3359 { "Branch Indicator", "sna.xid.type3.branch",
3360 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3361 0x06, NULL, HFILL }},
3363 { &hf_sna_xid_3_brnn,
3364 { "Option Set 1123 Indicator",
3365 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3369 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3372 { &hf_sna_xid_3_dlc,
3373 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3376 { &hf_sna_xid_3_dlen,
3377 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3378 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3380 { &hf_sna_control_len,
3381 { "Control Vector Length", "sna.control.len",
3382 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3384 { &hf_sna_control_key,
3385 { "Control Vector Key", "sna.control.key",
3386 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3389 { &hf_sna_control_hprkey,
3390 { "Control Vector HPR Key", "sna.control.hprkey",
3391 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3394 { &hf_sna_control_05_delay,
3395 { "Channel Delay", "sna.control.05.delay",
3396 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3398 { &hf_sna_control_05_type,
3399 { "Network Address Type", "sna.control.05.type",
3400 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3402 { &hf_sna_control_05_ptp,
3403 { "Point-to-point", "sna.control.05.ptp",
3404 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3406 { &hf_sna_control_0e_type,
3407 { "Type", "sna.control.0e.type",
3408 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3411 { &hf_sna_control_0e_value,
3412 { "Value", "sna.control.0e.value",
3413 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3416 { "Padding", "sna.padding",
3417 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3420 { "Reserved", "sna.reserved",
3421 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3423 { &hf_sna_biu_segment_data,
3424 { "BIU segment data", "sna.biu_segment_data",
3425 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3428 static gint *ett[] = {
3433 &ett_sna_nlp_nhdr_0,
3434 &ett_sna_nlp_nhdr_1,
3436 &ett_sna_nlp_thdr_8,
3437 &ett_sna_nlp_thdr_9,
3438 &ett_sna_nlp_opti_un,
3439 &ett_sna_nlp_opti_0d,
3440 &ett_sna_nlp_opti_0d_4,
3441 &ett_sna_nlp_opti_0e,
3442 &ett_sna_nlp_opti_0e_stat,
3443 &ett_sna_nlp_opti_0e_absp,
3444 &ett_sna_nlp_opti_0f,
3445 &ett_sna_nlp_opti_10,
3446 &ett_sna_nlp_opti_12,
3447 &ett_sna_nlp_opti_14,
3448 &ett_sna_nlp_opti_14_si,
3449 &ett_sna_nlp_opti_14_si_2,
3450 &ett_sna_nlp_opti_14_rr,
3451 &ett_sna_nlp_opti_14_rr_2,
3452 &ett_sna_nlp_opti_22,
3453 &ett_sna_nlp_opti_22_2,
3454 &ett_sna_nlp_opti_22_3,
3467 &ett_sna_control_un,
3468 &ett_sna_control_05,
3469 &ett_sna_control_05hpr,
3470 &ett_sna_control_05hpr_type,
3471 &ett_sna_control_0e,
3473 module_t *sna_module;
3475 proto_sna = proto_register_protocol("Systems Network Architecture",
3477 proto_register_field_array(proto_sna, hf, array_length(hf));
3478 proto_register_subtree_array(ett, array_length(ett));
3479 register_dissector("sna", dissect_sna, proto_sna);
3481 proto_sna_xid = proto_register_protocol(
3482 "Systems Network Architecture XID", "SNA XID", "sna_xid");
3483 register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3485 sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL, NULL, NULL);
3487 /* Register configuration options */
3488 sna_module = prefs_register_protocol(proto_sna, NULL);
3489 prefs_register_bool_preference(sna_module, "defragment",
3490 "Reassemble fragmented BIUs",
3491 "Whether fragmented BIUs should be reassembled",
3494 register_init_routine(sna_init);
3498 proto_reg_handoff_sna(void)
3500 dissector_handle_t sna_handle;
3501 dissector_handle_t sna_xid_handle;
3503 sna_handle = find_dissector("sna");
3504 sna_xid_handle = find_dissector("sna_xid");
3505 dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3506 dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3507 dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3508 dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3509 dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3510 dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3511 dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3512 dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3514 dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3515 data_handle = find_dissector("data");
3520 * Editor modelines - http://www.wireshark.org/tools/modelines.html
3525 * indent-tabs-mode: t
3528 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
3529 * :indentSize=8:tabSize=8:noTabs=false: