Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-sna.c
blobea428d5d7cec1d3da01d8822a53a8cc318d1c6a1
1 /* packet-sna.c
2 * Routines for SNA
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 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
16 #include <epan/llcsaps.h>
17 #include <epan/ppptypes.h>
18 #include <epan/address_types.h>
19 #include <epan/prefs.h>
20 #include <epan/reassemble.h>
21 #include <epan/to_str.h>
22 #include <epan/tfs.h>
23 #include <wsutil/array.h>
24 #include "wsutil/pint.h"
27 * See:
29 * http://web.archive.org/web/20020206033700/http://www.wanresources.com/snacell.html
31 * http://web.archive.org/web/20150522015710/http://www.protocols.com/pbook/sna.htm
33 * Systems Network Architecture Formats, GA27-3136-20:
34 * https://publibfp.dhe.ibm.com/epubs/pdf/d50a5007.pdf
36 * Systems Network Architecture Management Services Formats, GC31-8302-03:
37 * https://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/d50x4002/CCONTENTS
39 void proto_register_sna(void);
40 void proto_reg_handoff_sna(void);
42 static int proto_sna;
43 static int proto_sna_xid;
44 static int hf_sna_th;
45 static int hf_sna_th_0;
46 static int hf_sna_th_fid;
47 static int hf_sna_th_mpf;
48 static int hf_sna_th_odai;
49 static int hf_sna_th_efi;
50 static int hf_sna_th_daf;
51 static int hf_sna_th_oaf;
52 static int hf_sna_th_snf;
53 static int hf_sna_th_dcf;
54 static int hf_sna_th_lsid;
55 static int hf_sna_th_tg_sweep;
56 static int hf_sna_th_er_vr_supp_ind;
57 static int hf_sna_th_vr_pac_cnt_ind;
58 static int hf_sna_th_ntwk_prty;
59 static int hf_sna_th_tgsf;
60 static int hf_sna_th_mft;
61 static int hf_sna_th_piubf;
62 static int hf_sna_th_iern;
63 static int hf_sna_th_nlpoi;
64 static int hf_sna_th_nlp_cp;
65 static int hf_sna_th_ern;
66 static int hf_sna_th_vrn;
67 static int hf_sna_th_tpf;
68 static int hf_sna_th_vr_cwi;
69 static int hf_sna_th_tg_nonfifo_ind;
70 static int hf_sna_th_vr_sqti;
71 static int hf_sna_th_tg_snf;
72 static int hf_sna_th_vrprq;
73 static int hf_sna_th_vrprs;
74 static int hf_sna_th_vr_cwri;
75 static int hf_sna_th_vr_rwi;
76 static int hf_sna_th_vr_snf_send;
77 static int hf_sna_th_dsaf;
78 static int hf_sna_th_osaf;
79 static int hf_sna_th_snai;
80 static int hf_sna_th_def;
81 static int hf_sna_th_oef;
82 static int hf_sna_th_sa;
83 static int hf_sna_th_cmd_fmt;
84 static int hf_sna_th_cmd_type;
85 static int hf_sna_th_cmd_sn;
86 static int hf_sna_th_byte1;
87 static int hf_sna_th_byte2;
88 static int hf_sna_th_byte3;
89 static int hf_sna_th_byte4;
90 static int hf_sna_th_byte6;
91 static int hf_sna_th_byte16;
93 static int hf_sna_nlp_nhdr;
94 static int hf_sna_nlp_nhdr_0;
95 static int hf_sna_nlp_sm;
96 static int hf_sna_nlp_tpf;
97 static int hf_sna_nlp_nhdr_1;
98 static int hf_sna_nlp_ft;
99 static int hf_sna_nlp_tspi;
100 static int hf_sna_nlp_slowdn1;
101 static int hf_sna_nlp_slowdn2;
102 static int hf_sna_nlp_fra;
103 static int hf_sna_nlp_anr;
104 static int hf_sna_nlp_frh;
105 static int hf_sna_nlp_thdr;
106 static int hf_sna_nlp_tcid;
107 static int hf_sna_nlp_thdr_8;
108 static int hf_sna_nlp_setupi;
109 static int hf_sna_nlp_somi;
110 static int hf_sna_nlp_eomi;
111 static int hf_sna_nlp_sri;
112 static int hf_sna_nlp_rasapi;
113 static int hf_sna_nlp_retryi;
114 static int hf_sna_nlp_thdr_9;
115 static int hf_sna_nlp_lmi;
116 static int hf_sna_nlp_cqfi;
117 static int hf_sna_nlp_osi;
118 static int hf_sna_nlp_offset;
119 static int hf_sna_nlp_dlf;
120 static int hf_sna_nlp_bsn;
121 static int hf_sna_nlp_opti_len;
122 static int hf_sna_nlp_opti_type;
123 static int hf_sna_nlp_opti_0d_version;
124 static int hf_sna_nlp_opti_0d_4;
125 static int hf_sna_nlp_opti_0d_target;
126 static int hf_sna_nlp_opti_0d_arb;
127 static int hf_sna_nlp_opti_0d_reliable;
128 static int hf_sna_nlp_opti_0d_dedicated;
129 static int hf_sna_nlp_opti_0e_stat;
130 static int hf_sna_nlp_opti_0e_gap;
131 static int hf_sna_nlp_opti_0e_idle;
132 static int hf_sna_nlp_opti_0e_nabsp;
133 static int hf_sna_nlp_opti_0e_sync;
134 static int hf_sna_nlp_opti_0e_echo;
135 static int hf_sna_nlp_opti_0e_rseq;
136 /* static int hf_sna_nlp_opti_0e_abspbeg; */
137 /* static int hf_sna_nlp_opti_0e_abspend; */
138 static int hf_sna_nlp_opti_0f_bits;
139 static int hf_sna_nlp_opti_10_tcid;
140 static int hf_sna_nlp_opti_12_sense;
141 static int hf_sna_nlp_opti_14_si_len;
142 static int hf_sna_nlp_opti_14_si_key;
143 static int hf_sna_nlp_opti_14_si_2;
144 static int hf_sna_nlp_opti_14_si_refifo;
145 static int hf_sna_nlp_opti_14_si_mobility;
146 static int hf_sna_nlp_opti_14_si_dirsearch;
147 static int hf_sna_nlp_opti_14_si_limitres;
148 static int hf_sna_nlp_opti_14_si_ncescope;
149 static int hf_sna_nlp_opti_14_si_mnpsrscv;
150 static int hf_sna_nlp_opti_14_si_maxpsize;
151 static int hf_sna_nlp_opti_14_si_switch;
152 static int hf_sna_nlp_opti_14_si_alive;
153 static int hf_sna_nlp_opti_14_rr_len;
154 static int hf_sna_nlp_opti_14_rr_key;
155 static int hf_sna_nlp_opti_14_rr_2;
156 static int hf_sna_nlp_opti_14_rr_bfe;
157 static int hf_sna_nlp_opti_14_rr_num;
158 static int hf_sna_nlp_opti_22_2;
159 static int hf_sna_nlp_opti_22_type;
160 static int hf_sna_nlp_opti_22_raa;
161 static int hf_sna_nlp_opti_22_parity;
162 static int hf_sna_nlp_opti_22_arb;
163 static int hf_sna_nlp_opti_22_3;
164 static int hf_sna_nlp_opti_22_ratereq;
165 static int hf_sna_nlp_opti_22_raterep;
166 static int hf_sna_nlp_opti_22_field1;
167 static int hf_sna_nlp_opti_22_field2;
168 static int hf_sna_nlp_opti_22_field3;
169 static int hf_sna_nlp_opti_22_field4;
171 static int hf_sna_rh;
172 static int hf_sna_rh_0;
173 static int hf_sna_rh_1;
174 static int hf_sna_rh_2;
175 static int hf_sna_rh_rri;
176 static int hf_sna_rh_ru_category;
177 static int hf_sna_rh_fi;
178 static int hf_sna_rh_sdi;
179 static int hf_sna_rh_bci;
180 static int hf_sna_rh_eci;
181 static int hf_sna_rh_dr1;
182 static int hf_sna_rh_lcci;
183 static int hf_sna_rh_dr2;
184 static int hf_sna_rh_eri;
185 static int hf_sna_rh_rti;
186 static int hf_sna_rh_rlwi;
187 static int hf_sna_rh_qri;
188 static int hf_sna_rh_pi;
189 static int hf_sna_rh_bbi;
190 static int hf_sna_rh_ebi;
191 static int hf_sna_rh_cdi;
192 static int hf_sna_rh_csi;
193 static int hf_sna_rh_edi;
194 static int hf_sna_rh_pdi;
195 static int hf_sna_rh_cebi;
196 /*static int hf_sna_ru;*/
198 static int hf_sna_gds;
199 static int hf_sna_gds_len;
200 static int hf_sna_gds_type;
201 static int hf_sna_gds_cont;
202 static int hf_sna_gds_info;
204 /* static int hf_sna_xid; */
205 static int hf_sna_xid_0;
206 static int hf_sna_xid_id;
207 static int hf_sna_xid_format;
208 static int hf_sna_xid_type;
209 static int hf_sna_xid_len;
210 static int hf_sna_xid_idblock;
211 static int hf_sna_xid_idnum;
212 static int hf_sna_xid_3_8;
213 static int hf_sna_xid_3_init_self;
214 static int hf_sna_xid_3_stand_bind;
215 static int hf_sna_xid_3_gener_bind;
216 static int hf_sna_xid_3_recve_bind;
217 static int hf_sna_xid_3_actpu;
218 static int hf_sna_xid_3_nwnode;
219 static int hf_sna_xid_3_cp;
220 static int hf_sna_xid_3_cpcp;
221 static int hf_sna_xid_3_state;
222 static int hf_sna_xid_3_nonact;
223 static int hf_sna_xid_3_cpchange;
224 static int hf_sna_xid_3_10;
225 static int hf_sna_xid_3_asend_bind;
226 static int hf_sna_xid_3_arecv_bind;
227 static int hf_sna_xid_3_quiesce;
228 static int hf_sna_xid_3_pucap;
229 static int hf_sna_xid_3_pbn;
230 static int hf_sna_xid_3_pacing;
231 static int hf_sna_xid_3_11;
232 static int hf_sna_xid_3_tgshare;
233 static int hf_sna_xid_3_dedsvc;
234 static int hf_sna_xid_3_12;
235 static int hf_sna_xid_3_negcsup;
236 static int hf_sna_xid_3_negcomp;
237 static int hf_sna_xid_3_15;
238 static int hf_sna_xid_3_partg;
239 static int hf_sna_xid_3_dlur;
240 static int hf_sna_xid_3_dlus;
241 static int hf_sna_xid_3_exbn;
242 static int hf_sna_xid_3_genodai;
243 static int hf_sna_xid_3_branch;
244 static int hf_sna_xid_3_brnn;
245 static int hf_sna_xid_3_tg;
246 static int hf_sna_xid_3_dlc;
247 static int hf_sna_xid_3_dlen;
249 static int hf_sna_control_len;
250 static int hf_sna_control_key;
251 static int hf_sna_control_hprkey;
252 static int hf_sna_control_05_delay;
253 static int hf_sna_control_05_type;
254 static int hf_sna_control_05_ptp;
255 static int hf_sna_control_0e_type;
256 static int hf_sna_control_0e_value;
257 static int hf_sna_padding;
258 static int hf_sna_reserved;
259 static int hf_sna_biu_segment_data;
261 static int ett_sna;
262 static int ett_sna_th;
263 static int ett_sna_th_fid;
264 static int ett_sna_nlp_nhdr;
265 static int ett_sna_nlp_nhdr_0;
266 static int ett_sna_nlp_nhdr_1;
267 static int ett_sna_nlp_thdr;
268 static int ett_sna_nlp_thdr_8;
269 static int ett_sna_nlp_thdr_9;
270 static int ett_sna_nlp_opti_un;
271 static int ett_sna_nlp_opti_0d;
272 static int ett_sna_nlp_opti_0d_4;
273 static int ett_sna_nlp_opti_0e;
274 static int ett_sna_nlp_opti_0e_stat;
275 static int ett_sna_nlp_opti_0e_absp;
276 static int ett_sna_nlp_opti_0f;
277 static int ett_sna_nlp_opti_10;
278 static int ett_sna_nlp_opti_12;
279 static int ett_sna_nlp_opti_14;
280 static int ett_sna_nlp_opti_14_si;
281 static int ett_sna_nlp_opti_14_si_2;
282 static int ett_sna_nlp_opti_14_rr;
283 static int ett_sna_nlp_opti_14_rr_2;
284 static int ett_sna_nlp_opti_22;
285 static int ett_sna_nlp_opti_22_2;
286 static int ett_sna_nlp_opti_22_3;
287 static int ett_sna_rh;
288 static int ett_sna_rh_0;
289 static int ett_sna_rh_1;
290 static int ett_sna_rh_2;
291 static int ett_sna_gds;
292 static int ett_sna_xid_0;
293 static int ett_sna_xid_id;
294 static int ett_sna_xid_3_8;
295 static int ett_sna_xid_3_10;
296 static int ett_sna_xid_3_11;
297 static int ett_sna_xid_3_12;
298 static int ett_sna_xid_3_15;
299 static int ett_sna_control_un;
300 static int ett_sna_control_05;
301 static int ett_sna_control_05hpr;
302 static int ett_sna_control_05hpr_type;
303 static int ett_sna_control_0e;
305 static dissector_handle_t sna_handle;
306 static dissector_handle_t sna_xid_handle;
308 static int sna_address_type = -1;
310 /* Defragment fragmented SNA BIUs*/
311 static bool 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" },
327 { 0x0, NULL }
330 /* Mapping Field */
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" },
341 { 0, NULL }
344 /* Expedited Flow Indicator */
345 static const value_string sna_th_efi_vals[] = {
346 { 0, "Normal Flow" },
347 { 1, "Expedited Flow" },
348 { 0x0, NULL }
351 /* Request/Response Unit Category */
352 static const value_string sna_rh_ru_category_vals[] = {
353 { 0, "Function Management Data (FMD)" },
354 { 1, "Network Control (NC)" },
355 { 2, "Data Flow Control (DFC)" },
356 { 3, "Session Control (SC)" },
357 { 0x0, NULL }
360 /* Format Indicator */
361 static const true_false_string sna_rh_fi_truth =
362 { "FM Header", "No FM Header" };
364 /* Begin Chain Indicator */
365 static const true_false_string sna_rh_bci_truth =
366 { "First in Chain", "Not First in Chain" };
368 /* End Chain Indicator */
369 static const true_false_string sna_rh_eci_truth =
370 { "Last in Chain", "Not Last in Chain" };
372 /* Lengith-Checked Compression Indicator */
373 static const true_false_string sna_rh_lcci_truth =
374 { "Compressed", "Not Compressed" };
376 /* Response Type Indicator */
377 static const true_false_string sna_rh_rti_truth =
378 { "Negative", "Positive" };
380 /* Queued Response Indicator */
381 static const true_false_string sna_rh_qri_truth =
382 { "Enqueue response in TC queues", "Response bypasses TC queues" };
384 /* Code Selection Indicator */
385 static const value_string sna_rh_csi_vals[] = {
386 { 0, "EBCDIC" },
387 { 1, "ASCII" },
388 { 0x0, NULL }
391 /* TG Sweep */
392 static const value_string sna_th_tg_sweep_vals[] = {
393 { 0, "This PIU may overtake any PU ahead of it." },
394 { 1, "This PIU does not overtake any PIU ahead of it." },
395 { 0x0, NULL }
398 /* ER_VR_SUPP_IND */
399 static const value_string sna_th_er_vr_supp_ind_vals[] = {
400 { 0, "Each node supports ER and VR protocols" },
401 { 1, "Includes at least one node that does not support ER and VR"
402 " protocols" },
403 { 0x0, NULL }
406 /* VR_PAC_CNT_IND */
407 static const value_string sna_th_vr_pac_cnt_ind_vals[] = {
408 { 0, "Pacing count on the VR has not reached 0" },
409 { 1, "Pacing count on the VR has reached 0" },
410 { 0x0, NULL }
413 /* NTWK_PRTY */
414 static const value_string sna_th_ntwk_prty_vals[] = {
415 { 0, "PIU flows at a lower priority" },
416 { 1, "PIU flows at network priority (highest transmission priority)" },
417 { 0x0, NULL }
420 /* TGSF */
421 static const value_string sna_th_tgsf_vals[] = {
422 { 0, "Not segmented" },
423 { 1, "Last segment" },
424 { 2, "First segment" },
425 { 3, "Middle segment" },
426 { 0x0, NULL }
429 /* PIUBF */
430 static const value_string sna_th_piubf_vals[] = {
431 { 0, "Single PIU frame" },
432 { 1, "Last PIU of a multiple PIU frame" },
433 { 2, "First PIU of a multiple PIU frame" },
434 { 3, "Middle PIU of a multiple PIU frame" },
435 { 0x0, NULL }
438 /* NLPOI */
439 static const value_string sna_th_nlpoi_vals[] = {
440 { 0, "NLP starts within this FID4 TH" },
441 { 1, "NLP byte 0 starts after RH byte 0 following NLP C/P pad" },
442 { 0x0, NULL }
445 /* TPF */
446 static const value_string sna_th_tpf_vals[] = {
447 { 0, "Low Priority" },
448 { 1, "Medium Priority" },
449 { 2, "High Priority" },
450 { 3, "Network Priority" },
451 { 0x0, NULL }
454 /* VR_CWI */
455 static const value_string sna_th_vr_cwi_vals[] = {
456 { 0, "Increment window size" },
457 { 1, "Decrement window size" },
458 { 0x0, NULL }
461 /* TG_NONFIFO_IND */
462 static const true_false_string sna_th_tg_nonfifo_ind_truth =
463 { "TG FIFO is not required", "TG FIFO is required" };
465 /* VR_SQTI */
466 static const value_string sna_th_vr_sqti_vals[] = {
467 { 0, "Non-sequenced, Non-supervisory" },
468 { 1, "Non-sequenced, Supervisory" },
469 { 2, "Singly-sequenced" },
470 { 0x0, NULL }
473 /* VRPRQ */
474 static const true_false_string sna_th_vrprq_truth = {
475 "VR pacing request is sent asking for a VR pacing response",
476 "No VR pacing response is requested",
479 /* VRPRS */
480 static const true_false_string sna_th_vrprs_truth = {
481 "VR pacing response is sent in response to a VRPRQ bit set",
482 "No pacing response sent",
485 /* VR_CWRI */
486 static const value_string sna_th_vr_cwri_vals[] = {
487 { 0, "Increment window size by 1" },
488 { 1, "Decrement window size by 1" },
489 { 0x0, NULL }
492 /* VR_RWI */
493 static const true_false_string sna_th_vr_rwi_truth = {
494 "Reset window size to the minimum specified in NC_ACTVR",
495 "Do not reset window size",
498 /* Switching Mode */
499 static const value_string sna_nlp_sm_vals[] = {
500 { 5, "Function routing" },
501 { 6, "Automatic network routing" },
502 { 0x0, NULL }
505 static const true_false_string sna_nlp_tspi_truth =
506 { "Time sensitive", "Not time sensitive" };
508 static const true_false_string sna_nlp_slowdn1_truth =
509 { "Minor congestion", "No minor congestion" };
511 static const true_false_string sna_nlp_slowdn2_truth =
512 { "Major congestion", "No major congestion" };
514 /* Function Type */
515 static const value_string sna_nlp_ft_vals[] = {
516 { 0x10, "LDLC" },
517 { 0x0, NULL }
520 static const value_string sna_nlp_frh_vals[] = {
521 { 0x03, "XID complete request" },
522 { 0x04, "XID complete response" },
523 { 0x0, NULL }
526 static const true_false_string sna_nlp_setupi_truth =
527 { "Connection setup segment present", "Connection setup segment not"
528 " present" };
530 static const true_false_string sna_nlp_somi_truth =
531 { "Start of message", "Not start of message" };
533 static const true_false_string sna_nlp_eomi_truth =
534 { "End of message", "Not end of message" };
536 static const true_false_string sna_nlp_sri_truth =
537 { "Status requested", "No status requested" };
539 static const true_false_string sna_nlp_rasapi_truth =
540 { "Reply as soon as possible", "No need to reply as soon as possible" };
542 static const true_false_string sna_nlp_retryi_truth =
543 { "Undefined", "Sender will retransmit" };
545 static const true_false_string sna_nlp_lmi_truth =
546 { "Last message", "Not last message" };
548 static const true_false_string sna_nlp_cqfi_truth =
549 { "CQFI included", "CQFI not included" };
551 static const true_false_string sna_nlp_osi_truth =
552 { "Optional segments present", "No optional segments present" };
554 static const value_string sna_xid_3_state_vals[] = {
555 { 0x00, "Exchange state indicators not supported" },
556 { 0x01, "Negotiation-proceeding exchange" },
557 { 0x02, "Prenegotiation exchange" },
558 { 0x03, "Nonactivation exchange" },
559 { 0x0, NULL }
562 static const value_string sna_xid_3_branch_vals[] = {
563 { 0x00, "Sender does not support branch extender" },
564 { 0x01, "TG is branch uplink" },
565 { 0x02, "TG is branch downlink" },
566 { 0x03, "TG is neither uplink nor downlink" },
567 { 0x0, NULL }
570 static const value_string sna_xid_type_vals[] = {
571 { 0x01, "T1 node" },
572 { 0x02, "T2.0 or T2.1 node" },
573 { 0x03, "Reserved" },
574 { 0x04, "T4 or T5 node" },
575 { 0x0, NULL }
578 static const value_string sna_nlp_opti_vals[] = {
579 { 0x0d, "Connection Setup Segment" },
580 { 0x0e, "Status Segment" },
581 { 0x0f, "Client Out Of Band Bits Segment" },
582 { 0x10, "Connection Identifier Exchange Segment" },
583 { 0x12, "Connection Fault Segment" },
584 { 0x14, "Switching Information Segment" },
585 { 0x22, "Adaptive Rate-Based Segment" },
586 { 0x0, NULL }
589 static const value_string sna_nlp_opti_0d_version_vals[] = {
590 { 0x0101, "Version 1.1" },
591 { 0x0, NULL }
594 static const value_string sna_nlp_opti_0f_bits_vals[] = {
595 { 0x0001, "Request Deactivation" },
596 { 0x8000, "Reply - OK" },
597 { 0x8004, "Reply - Reject" },
598 { 0x0, NULL }
601 static const value_string sna_nlp_opti_22_type_vals[] = {
602 { 0x00, "Setup" },
603 { 0x01, "Rate Reply" },
604 { 0x02, "Rate Request" },
605 { 0x03, "Rate Request/Rate Reply" },
606 { 0x0, NULL }
609 static const value_string sna_nlp_opti_22_raa_vals[] = {
610 { 0x00, "Normal" },
611 { 0x01, "Restraint" },
612 { 0x02, "Slowdown1" },
613 { 0x03, "Slowdown2" },
614 { 0x04, "Critical" },
615 { 0x0, NULL }
618 static const value_string sna_nlp_opti_22_arb_vals[] = {
619 { 0x00, "Base Mode ARB" },
620 { 0x01, "Responsive Mode ARB" },
621 { 0x0, NULL }
624 /* GDS Variable Type */
625 static const value_string sna_gds_var_vals[] = {
626 { 0x1210, "Change Number Of Sessions" },
627 { 0x1211, "Exchange Log Name" },
628 { 0x1212, "Control Point Management Services Unit" },
629 { 0x1213, "Compare States" },
630 { 0x1214, "LU Names Position" },
631 { 0x1215, "LU Name" },
632 { 0x1217, "Do Know" },
633 { 0x1218, "Partner Restart" },
634 { 0x1219, "Don't Know" },
635 { 0x1220, "Sign-Off" },
636 { 0x1221, "Sign-On" },
637 { 0x1222, "SNMP-over-SNA" },
638 { 0x1223, "Node Address Service" },
639 { 0x12C1, "CP Capabilities" },
640 { 0x12C2, "Topology Database Update" },
641 { 0x12C3, "Register Resource" },
642 { 0x12C4, "Locate" },
643 { 0x12C5, "Cross-Domain Initiate" },
644 { 0x12C9, "Delete Resource" },
645 { 0x12CA, "Find Resource" },
646 { 0x12CB, "Found Resource" },
647 { 0x12CC, "Notify" },
648 { 0x12CD, "Initiate-Other Cross-Domain" },
649 { 0x12CE, "Route Setup" },
650 { 0x12E1, "Error Log" },
651 { 0x12F1, "Null Data" },
652 { 0x12F2, "User Control Date" },
653 { 0x12F3, "Map Name" },
654 { 0x12F4, "Error Data" },
655 { 0x12F6, "Authentication Token Data" },
656 { 0x12F8, "Service Flow Authentication Token Data" },
657 { 0x12FF, "Application Data" },
658 { 0x1310, "MDS Message Unit" },
659 { 0x1311, "MDS Routing Information" },
660 { 0x1500, "FID2 Encapsulation" },
661 { 0x0, NULL }
664 /* Control Vector Type */
665 static const value_string sna_control_vals[] = {
666 { 0x00, "SSCP-LU Session Capabilities Control Vector" },
667 { 0x01, "Date-Time Control Vector" },
668 { 0x02, "Subarea Routing Control Vector" },
669 { 0x03, "SDLC Secondary Station Control Vector" },
670 { 0x04, "LU Control Vector" },
671 { 0x05, "Channel Control Vector" },
672 { 0x06, "Cross-Domain Resource Manager (CDRM) Control Vector" },
673 { 0x07, "PU FMD-RU-Usage Control Vector" },
674 { 0x08, "Intensive Mode Control Vector" },
675 { 0x09, "Activation Request / Response Sequence Identifier Control"
676 " Vector" },
677 { 0x0a, "User Request Correlator Control Vector" },
678 { 0x0b, "SSCP-PU Session Capabilities Control Vector" },
679 { 0x0c, "LU-LU Session Capabilities Control Vector" },
680 { 0x0d, "Mode / Class-of-Service / Virtual-Route-Identifier List"
681 " Control Vector" },
682 { 0x0e, "Network Name Control Vector" },
683 { 0x0f, "Link Capabilities and Status Control Vector" },
684 { 0x10, "Product Set ID Control Vector" },
685 { 0x11, "Load Module Correlation Control Vector" },
686 { 0x12, "Network Identifier Control Vector" },
687 { 0x13, "Gateway Support Capabilities Control Vector" },
688 { 0x14, "Session Initiation Control Vector" },
689 { 0x15, "Network-Qualified Address Pair Control Vector" },
690 { 0x16, "Names Substitution Control Vector" },
691 { 0x17, "SSCP Identifier Control Vector" },
692 { 0x18, "SSCP Name Control Vector" },
693 { 0x19, "Resource Identifier Control Vector" },
694 { 0x1a, "NAU Address Control Vector" },
695 { 0x1b, "VRID List Control Vector" },
696 { 0x1c, "Network-Qualified Name Pair Control Vector" },
697 { 0x1e, "VR-ER Mapping Data Control Vector" },
698 { 0x1f, "ER Configuration Control Vector" },
699 { 0x23, "Local-Form Session Identifier Control Vector" },
700 { 0x24, "IPL Load Module Request Control Vector" },
701 { 0x25, "Security ID Control Control Vector" },
702 { 0x26, "Network Connection Endpoint Identifier Control Vector" },
703 { 0x27, "XRF Session Activation Control Vector" },
704 { 0x28, "Related Session Identifier Control Vector" },
705 { 0x29, "Session State Data Control Vector" },
706 { 0x2a, "Session Information Control Vector" },
707 { 0x2b, "Route Selection Control Vector" },
708 { 0x2c, "COS/TPF Control Vector" },
709 { 0x2d, "Mode Control Vector" },
710 { 0x2f, "LU Definition Control Vector" },
711 { 0x30, "Assign LU Characteristics Control Vector" },
712 { 0x31, "BIND Image Control Vector" },
713 { 0x32, "Short-Hold Mode Control Vector" },
714 { 0x33, "ENCP Search Control Control Vector" },
715 { 0x34, "LU Definition Override Control Vector" },
716 { 0x35, "Extended Sense Data Control Vector" },
717 { 0x36, "Directory Error Control Vector" },
718 { 0x37, "Directory Entry Correlator Control Vector" },
719 { 0x38, "Short-Hold Mode Emulation Control Vector" },
720 { 0x39, "Network Connection Endpoint (NCE) Instance Identifier"
721 " Control Vector" },
722 { 0x3a, "Route Status Data Control Vector" },
723 { 0x3b, "VR Congestion Data Control Vector" },
724 { 0x3c, "Associated Resource Entry Control Vector" },
725 { 0x3d, "Directory Entry Control Vector" },
726 { 0x3e, "Directory Entry Characteristic Control Vector" },
727 { 0x3f, "SSCP (SLU) Capabilities Control Vector" },
728 { 0x40, "Real Associated Resource Control Vector" },
729 { 0x41, "Station Parameters Control Vector" },
730 { 0x42, "Dynamic Path Update Data Control Vector" },
731 { 0x43, "Extended SDLC Station Control Vector" },
732 { 0x44, "Node Descriptor Control Vector" },
733 { 0x45, "Node Characteristics Control Vector" },
734 { 0x46, "TG Descriptor Control Vector" },
735 { 0x47, "TG Characteristics Control Vector" },
736 { 0x48, "Topology Resource Descriptor Control Vector" },
737 { 0x49, "Multinode Persistent Sessions (MNPS) LU Names Control"
738 " Vector" },
739 { 0x4a, "Real Owning Control Point Control Vector" },
740 { 0x4b, "RTP Transport Connection Identifier Control Vector" },
741 { 0x51, "DLUR/S Capabilities Control Vector" },
742 { 0x52, "Primary Send Pacing Window Size Control Vector" },
743 { 0x56, "Call Security Verification Control Vector" },
744 { 0x57, "DLC Connection Data Control Vector" },
745 { 0x59, "Installation-Defined CDINIT Data Control Vector" },
746 { 0x5a, "Session Services Extension Support Control Vector" },
747 { 0x5b, "Interchange Node Support Control Vector" },
748 { 0x5c, "APPN Message Transport Control Vector" },
749 { 0x5d, "Subarea Message Transport Control Vector" },
750 { 0x5e, "Related Request Control Vector" },
751 { 0x5f, "Extended Fully Qualified PCID Control Vector" },
752 { 0x60, "Fully Qualified PCID Control Vector" },
753 { 0x61, "HPR Capabilities Control Vector" },
754 { 0x62, "Session Address Control Vector" },
755 { 0x63, "Cryptographic Key Distribution Control Vector" },
756 { 0x64, "TCP/IP Information Control Vector" },
757 { 0x65, "Device Characteristics Control Vector" },
758 { 0x66, "Length-Checked Compression Control Vector" },
759 { 0x67, "Automatic Network Routing (ANR) Path Control Vector" },
760 { 0x68, "XRF/Session Cryptography Control Vector" },
761 { 0x69, "Switched Parameters Control Vector" },
762 { 0x6a, "ER Congestion Data Control Vector" },
763 { 0x71, "Triple DES Cryptography Key Continuation Control Vector" },
764 { 0xfe, "Control Vector Keys Not Recognized" },
765 { 0x0, NULL }
768 static const value_string sna_control_hpr_vals[] = {
769 { 0x00, "Node Identifier Control Vector" },
770 { 0x03, "Network ID Control Vector" },
771 { 0x05, "Network Address Control Vector" },
772 { 0x0, NULL }
775 static const value_string sna_control_0e_type_vals[] = {
776 { 0xF1, "PU Name" },
777 { 0xF3, "LU Name" },
778 { 0xF4, "CP Name" },
779 { 0xF5, "SSCP Name" },
780 { 0xF6, "NNCP Name" },
781 { 0xF7, "Link Station Name" },
782 { 0xF8, "CP Name of CP(PLU)" },
783 { 0xF9, "CP Name of CP(SLU)" },
784 { 0xFA, "Generic Name" },
785 { 0x0, NULL }
788 /* Values to direct the top-most dissector what to dissect
789 * after the TH. */
790 enum next_dissection_enum {
791 stop_here,
792 rh_only,
793 everything
796 enum parse {
802 * Structure used to represent an FID Type 4 address; gives the layout of the
803 * data pointed to by an AT_SNA "address" structure if the size is
804 * SNA_FID_TYPE_4_ADDR_LEN.
806 #define SNA_FID_TYPE_4_ADDR_LEN 6
807 struct sna_fid_type_4_addr {
808 uint32_t saf;
809 uint16_t ef;
812 typedef enum next_dissection_enum next_dissection_t;
814 static void dissect_xid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
815 static void dissect_fid (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
816 static void dissect_nlp (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
817 static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
818 static void dissect_rh (tvbuff_t*, int, proto_tree*);
819 static void dissect_sna_control(tvbuff_t* parent_tvb, int offset, int control_len, proto_tree* tree, int hpr, enum parse parse);
821 static int sna_fid_to_str_buf(const address *addr, char *buf, int buf_len _U_)
823 const uint8_t *addrdata;
824 struct sna_fid_type_4_addr sna_fid_type_4_addr;
825 char *bufp = buf;
827 switch (addr->len) {
829 case 1:
830 addrdata = (const uint8_t *)addr->data;
831 word_to_hex(buf, addrdata[0]);
832 buf[4] = '\0';
833 break;
835 case 2:
836 addrdata = (const uint8_t *)addr->data;
837 word_to_hex(buf, pntoh16(&addrdata[0]));
838 buf[4] = '\0';
839 break;
841 case SNA_FID_TYPE_4_ADDR_LEN:
842 /* FID Type 4 */
843 memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
845 bufp = dword_to_hex(bufp, sna_fid_type_4_addr.saf);
846 *bufp++ = '.';
847 bufp = word_to_hex(bufp, sna_fid_type_4_addr.ef);
848 *bufp++ = '\0'; /* NULL terminate */
849 break;
850 default:
851 buf[0] = '\0';
852 return 1;
855 return (int)strlen(buf)+1;
859 static int sna_address_str_len(const address* addr _U_)
861 /* We could do this based on address length, but 14 bytes isn't THAT much space */
862 return 14;
866 /* --------------------------------------------------------------------
867 * Chapter 2 High-Performance Routing (HPR) Headers
868 * --------------------------------------------------------------------
871 static void
872 dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
874 int offset, len, pad;
875 static int * const fields[] = {
876 &hf_sna_nlp_opti_0d_target,
877 &hf_sna_nlp_opti_0d_arb,
878 &hf_sna_nlp_opti_0d_reliable,
879 &hf_sna_nlp_opti_0d_dedicated,
880 NULL
883 if (!tree)
884 return;
886 proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
888 proto_tree_add_bitmask(tree, tvb, 4, hf_sna_nlp_opti_0d_4,
889 ett_sna_nlp_opti_0d_4, fields, ENC_NA);
891 proto_tree_add_item(tree, hf_sna_reserved, tvb, 5, 3, ENC_NA);
893 offset = 8;
895 while (tvb_offset_exists(tvb, offset)) {
896 len = tvb_get_uint8(tvb, offset+0);
897 if (len) {
898 dissect_sna_control(tvb, offset, len, tree, 1, LT);
899 pad = (len+3) & 0xfffc;
900 if (pad > len)
901 proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
902 offset += pad;
903 } else {
904 /* Avoid endless loop */
905 return;
910 static void
911 dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
913 int bits, offset;
914 static int * const fields[] = {
915 &hf_sna_nlp_opti_0e_gap,
916 &hf_sna_nlp_opti_0e_idle,
917 NULL
920 bits = tvb_get_uint8(tvb, 2);
921 offset = 20;
923 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_0e_stat,
924 ett_sna_nlp_opti_0e_stat, fields, ENC_NA);
926 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
927 tvb, 3, 1, ENC_BIG_ENDIAN);
928 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
929 tvb, 4, 2, ENC_BIG_ENDIAN);
930 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
931 tvb, 6, 2, ENC_BIG_ENDIAN);
932 proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
933 tvb, 8, 4, ENC_BIG_ENDIAN);
934 proto_tree_add_item(tree, hf_sna_reserved, tvb, 12, 8, ENC_NA);
936 if (tvb_offset_exists(tvb, offset))
937 call_data_dissector(tvb_new_subset_remaining(tvb, 4), pinfo, tree);
939 if (bits & 0x40) {
940 col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
941 } else {
942 col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
946 static void
947 dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
949 proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
950 if (tvb_offset_exists(tvb, 4))
951 call_data_dissector(tvb_new_subset_remaining(tvb, 4), pinfo, tree);
954 static void
955 dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
957 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
958 proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
959 if (tvb_offset_exists(tvb, 12))
960 call_data_dissector(tvb_new_subset_remaining(tvb, 12), pinfo, tree);
963 static void
964 dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
966 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
967 proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
970 static void
971 dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
973 proto_tree *sub_tree;
974 int len, pad, type, offset, num, sublen;
975 static int * const opti_14_si_fields[] = {
976 &hf_sna_nlp_opti_14_si_refifo,
977 &hf_sna_nlp_opti_14_si_mobility,
978 &hf_sna_nlp_opti_14_si_dirsearch,
979 &hf_sna_nlp_opti_14_si_limitres,
980 &hf_sna_nlp_opti_14_si_ncescope,
981 &hf_sna_nlp_opti_14_si_mnpsrscv,
982 NULL
984 static int * const opti_14_rr_fields[] = {
985 &hf_sna_nlp_opti_14_rr_bfe,
986 NULL
989 proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
991 offset = 4;
993 len = tvb_get_uint8(tvb, offset);
994 type = tvb_get_uint8(tvb, offset+1);
996 if ((type != 0x83) || (len <= 16)) {
997 /* Invalid */
998 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
999 return;
1001 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1002 ett_sna_nlp_opti_14_si, NULL, "Switching Information Control Vector");
1004 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
1005 tvb, offset, 1, len);
1006 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
1007 tvb, offset+1, 1, type);
1009 proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_si_2,
1010 ett_sna_nlp_opti_14_si_2, opti_14_si_fields, ENC_NA);
1012 proto_tree_add_item(sub_tree, hf_sna_reserved, tvb, offset+3, 1, ENC_NA);
1013 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
1014 tvb, offset+4, 4, ENC_BIG_ENDIAN);
1015 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
1016 tvb, offset+8, 4, ENC_BIG_ENDIAN);
1017 proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
1018 tvb, offset+12, 4, ENC_BIG_ENDIAN);
1020 dissect_sna_control(tvb, offset+16, len-16, sub_tree, 1, LT);
1022 pad = (len+3) & 0xfffc;
1023 if (pad > len)
1024 proto_tree_add_item(sub_tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
1025 offset += pad;
1027 len = tvb_get_uint8(tvb, offset);
1028 type = tvb_get_uint8(tvb, offset+1);
1030 if ((type != 0x85) || ( len < 4)) {
1031 /* Invalid */
1032 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1033 return;
1035 sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1036 ett_sna_nlp_opti_14_rr, NULL, "Return Route TG Descriptor Control Vector");
1038 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1039 tvb, offset, 1, len);
1040 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1041 tvb, offset+1, 1, type);
1043 proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_rr_2,
1044 ett_sna_nlp_opti_14_rr_2, opti_14_rr_fields, ENC_NA);
1046 num = tvb_get_uint8(tvb, offset+3);
1048 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1049 tvb, offset+3, 1, num);
1051 offset += 4;
1053 while (num) {
1054 sublen = tvb_get_uint8(tvb, offset);
1055 if (sublen) {
1056 dissect_sna_control(tvb, offset, sublen, sub_tree, 1, LT);
1057 } else {
1058 /* Invalid */
1059 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1060 return;
1062 /* No padding here */
1063 offset += sublen;
1064 num--;
1068 static void
1069 dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1071 int bits, type;
1072 static int * const opti_22_2_fields[] = {
1073 &hf_sna_nlp_opti_22_type,
1074 &hf_sna_nlp_opti_22_raa,
1075 &hf_sna_nlp_opti_22_parity,
1076 &hf_sna_nlp_opti_22_arb,
1077 NULL
1079 static int * const opti_22_3_fields[] = {
1080 &hf_sna_nlp_opti_22_ratereq,
1081 &hf_sna_nlp_opti_22_raterep,
1082 NULL
1085 bits = tvb_get_uint8(tvb, 2);
1086 type = (bits & 0xc0) >> 6;
1088 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_22_2,
1089 ett_sna_nlp_opti_22_2, opti_22_2_fields, ENC_NA);
1091 proto_tree_add_bitmask(tree, tvb, 3, hf_sna_nlp_opti_22_3,
1092 ett_sna_nlp_opti_22_3, opti_22_3_fields, ENC_NA);
1094 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1095 tvb, 4, 4, ENC_BIG_ENDIAN);
1096 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1097 tvb, 8, 4, ENC_BIG_ENDIAN);
1099 if (type == 0) {
1100 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1101 tvb, 12, 4, ENC_BIG_ENDIAN);
1102 proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1103 tvb, 16, 4, ENC_BIG_ENDIAN);
1105 if (tvb_offset_exists(tvb, 20))
1106 call_data_dissector(tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1107 } else {
1108 if (tvb_offset_exists(tvb, 12))
1109 call_data_dissector(tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1113 static void
1114 dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1116 proto_tree *sub_tree;
1117 int offset, type, len;
1118 int ett;
1120 sub_tree = NULL;
1122 offset = 0;
1124 while (tvb_offset_exists(tvb, offset)) {
1125 len = tvb_get_uint8(tvb, offset);
1126 type = tvb_get_uint8(tvb, offset+1);
1128 /* Prevent loop for invalid crap in packet */
1129 if (len == 0) {
1130 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1131 return;
1134 ett = ett_sna_nlp_opti_un;
1135 if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1136 if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1137 if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1138 if(type == 0x10) ett = ett_sna_nlp_opti_10;
1139 if(type == 0x12) ett = ett_sna_nlp_opti_12;
1140 if(type == 0x14) ett = ett_sna_nlp_opti_14;
1141 if(type == 0x22) ett = ett_sna_nlp_opti_22;
1142 if (tree) {
1143 sub_tree = proto_tree_add_subtree(tree, tvb,
1144 offset, len << 2, ett, NULL,
1145 val_to_str_const(type, sna_nlp_opti_vals, "Unknown Segment Type"));
1146 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1147 tvb, offset, 1, len);
1148 proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1149 tvb, offset+1, 1, type);
1151 switch(type) {
1152 case 0x0d:
1153 dissect_optional_0d(tvb_new_subset_length_caplen(tvb, offset,
1154 len << 2, -1), sub_tree);
1155 break;
1156 case 0x0e:
1157 dissect_optional_0e(tvb_new_subset_length_caplen(tvb, offset,
1158 len << 2, -1), pinfo, sub_tree);
1159 break;
1160 case 0x0f:
1161 dissect_optional_0f(tvb_new_subset_length_caplen(tvb, offset,
1162 len << 2, -1), pinfo, sub_tree);
1163 break;
1164 case 0x10:
1165 dissect_optional_10(tvb_new_subset_length_caplen(tvb, offset,
1166 len << 2, -1), pinfo, sub_tree);
1167 break;
1168 case 0x12:
1169 dissect_optional_12(tvb_new_subset_length_caplen(tvb, offset,
1170 len << 2, -1), sub_tree);
1171 break;
1172 case 0x14:
1173 dissect_optional_14(tvb_new_subset_length_caplen(tvb, offset,
1174 len << 2, -1), pinfo, sub_tree);
1175 break;
1176 case 0x22:
1177 dissect_optional_22(tvb_new_subset_length_caplen(tvb, offset,
1178 len << 2, -1), pinfo, sub_tree);
1179 break;
1180 default:
1181 call_data_dissector(tvb_new_subset_length_caplen(tvb, offset,
1182 len << 2, -1), pinfo, sub_tree);
1184 offset += (len << 2);
1188 static void
1189 dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1190 proto_tree *parent_tree)
1192 proto_tree *nlp_tree;
1193 proto_item *nlp_item;
1194 uint8_t nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1195 uint32_t thdr_len, thdr_dlf;
1196 uint16_t subindx;
1197 static int * const nlp_nhdr_0_fields[] = {
1198 &hf_sna_nlp_sm,
1199 &hf_sna_nlp_tpf,
1200 NULL
1202 static int * const nlp_nhdr_1_fields[] = {
1203 &hf_sna_nlp_ft,
1204 &hf_sna_nlp_tspi,
1205 &hf_sna_nlp_slowdn1,
1206 &hf_sna_nlp_slowdn2,
1207 NULL
1209 static int * const nlp_nhdr_8_fields[] = {
1210 &hf_sna_nlp_setupi,
1211 &hf_sna_nlp_somi,
1212 &hf_sna_nlp_eomi,
1213 &hf_sna_nlp_sri,
1214 &hf_sna_nlp_rasapi,
1215 &hf_sna_nlp_retryi,
1216 NULL
1218 static int * const nlp_nhdr_9_fields[] = {
1219 &hf_sna_nlp_lmi,
1220 &hf_sna_nlp_cqfi,
1221 &hf_sna_nlp_osi,
1222 NULL
1225 int indx = 0, counter = 0;
1227 nlp_tree = NULL;
1228 nlp_item = NULL;
1230 nhdr_0 = tvb_get_uint8(tvb, indx);
1231 nhdr_1 = tvb_get_uint8(tvb, indx+1);
1233 col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1235 if (tree) {
1236 /* Don't bother setting length. We'll set it later after we
1237 * find the lengths of NHDR */
1238 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1239 indx, -1, ENC_NA);
1240 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1242 proto_tree_add_bitmask(nlp_tree, tvb, indx, hf_sna_nlp_nhdr_0,
1243 ett_sna_nlp_nhdr_0, nlp_nhdr_0_fields, ENC_NA);
1245 proto_tree_add_bitmask(nlp_tree, tvb, indx+1, hf_sna_nlp_nhdr_1,
1246 ett_sna_nlp_nhdr_1, nlp_nhdr_1_fields, ENC_NA);
1248 /* ANR or FR lists */
1250 indx += 2;
1251 counter = 0;
1253 if ((nhdr_0 & 0xe0) == 0xa0) {
1254 do {
1255 nhdr_x = tvb_get_uint8(tvb, indx + counter);
1256 counter ++;
1257 } while (nhdr_x != 0xff);
1258 proto_tree_add_item(nlp_tree,
1259 hf_sna_nlp_fra, tvb, indx, counter, ENC_NA);
1260 indx += counter;
1261 proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1262 indx++;
1264 if (tree)
1265 proto_item_set_len(nlp_item, indx);
1267 if ((nhdr_1 & 0xf0) == 0x10) {
1268 proto_tree_add_item(tree, hf_sna_nlp_frh,
1269 tvb, indx, 1, ENC_BIG_ENDIAN);
1270 indx ++;
1272 if (tvb_offset_exists(tvb, indx))
1273 call_data_dissector(tvb_new_subset_remaining(tvb, indx),
1274 pinfo, parent_tree);
1275 return;
1278 if ((nhdr_0 & 0xe0) == 0xc0) {
1279 do {
1280 nhdr_x = tvb_get_uint8(tvb, indx + counter);
1281 counter ++;
1282 } while (nhdr_x != 0xff);
1283 proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1284 tvb, indx, counter, ENC_NA);
1285 indx += counter;
1287 proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1288 indx++;
1290 if (tree)
1291 proto_item_set_len(nlp_item, indx);
1294 thdr_8 = tvb_get_uint8(tvb, indx+8);
1295 thdr_9 = tvb_get_uint8(tvb, indx+9);
1296 thdr_len = tvb_get_ntohs(tvb, indx+10);
1297 thdr_dlf = tvb_get_ntohl(tvb, indx+12);
1299 if (tree) {
1300 nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1301 indx, thdr_len << 2, ENC_NA);
1302 nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1304 proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1305 indx, 8, ENC_NA);
1307 proto_tree_add_bitmask(nlp_tree, tvb, indx+8, hf_sna_nlp_thdr_8,
1308 ett_sna_nlp_thdr_8, nlp_nhdr_8_fields, ENC_NA);
1310 proto_tree_add_bitmask(nlp_tree, tvb, indx+9, hf_sna_nlp_thdr_9,
1311 ett_sna_nlp_thdr_9, nlp_nhdr_9_fields, ENC_NA);
1313 proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, indx+10,
1314 2, thdr_len);
1315 proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, indx+12,
1316 4, thdr_dlf);
1317 proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, indx+16,
1318 4, ENC_BIG_ENDIAN);
1320 subindx = 20;
1322 if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindx)) {
1323 counter = tvb_get_uint8(tvb, indx + subindx);
1324 if (tvb_get_uint8(tvb, indx+subindx+1) == 5)
1325 dissect_sna_control(tvb, indx + subindx, counter+2, nlp_tree, 1, LT);
1326 else
1327 call_data_dissector(tvb_new_subset_length_caplen(tvb, indx + subindx, counter+2,
1328 -1), pinfo, nlp_tree);
1330 subindx += (counter+2);
1332 if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindx))
1333 dissect_optional(
1334 tvb_new_subset_length_caplen(tvb, indx + subindx,
1335 (thdr_len << 2) - subindx, -1),
1336 pinfo, nlp_tree);
1338 indx += (thdr_len << 2);
1339 if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1340 col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1341 if (tvb_offset_exists(tvb, indx)) {
1342 call_data_dissector(tvb_new_subset_remaining(tvb, indx), pinfo,
1343 parent_tree);
1345 return;
1347 if (tvb_offset_exists(tvb, indx)) {
1348 /* Transmission Header Format Identifier */
1349 fid = hi_nibble(tvb_get_uint8(tvb, indx));
1350 if (fid == 5) /* Only FID5 allowed for HPR */
1351 dissect_fid(tvb_new_subset_remaining(tvb, indx), pinfo,
1352 tree, parent_tree);
1353 else {
1354 if (tvb_get_ntohs(tvb, indx+2) == 0x12ce) {
1355 /* Route Setup */
1356 col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1357 dissect_gds(tvb_new_subset_remaining(tvb, indx),
1358 pinfo, tree, parent_tree);
1359 } else
1360 call_data_dissector(tvb_new_subset_remaining(tvb, indx),
1361 pinfo, parent_tree);
1366 /* --------------------------------------------------------------------
1367 * Chapter 3 Exchange Identification (XID) Information Fields
1368 * --------------------------------------------------------------------
1371 static void
1372 dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1374 proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1378 static void
1379 dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1381 unsigned dlen, offset;
1383 if (!tree)
1384 return;
1386 dlen = tvb_get_uint8(tvb, 0);
1388 offset = dlen;
1390 while (tvb_offset_exists(tvb, offset)) {
1391 dlen = tvb_get_uint8(tvb, offset+1);
1392 dissect_sna_control(tvb, offset, dlen+2, tree, 0, KL);
1393 offset += (dlen + 2);
1397 static void
1398 dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1400 unsigned dlen, offset;
1401 static int * const sna_xid_3_fields[] = {
1402 &hf_sna_xid_3_init_self,
1403 &hf_sna_xid_3_stand_bind,
1404 &hf_sna_xid_3_gener_bind,
1405 &hf_sna_xid_3_recve_bind,
1406 &hf_sna_xid_3_actpu,
1407 &hf_sna_xid_3_nwnode,
1408 &hf_sna_xid_3_cp,
1409 &hf_sna_xid_3_cpcp,
1410 &hf_sna_xid_3_state,
1411 &hf_sna_xid_3_nonact,
1412 &hf_sna_xid_3_cpchange,
1413 NULL
1415 static int * const sna_xid_10_fields[] = {
1416 &hf_sna_xid_3_asend_bind,
1417 &hf_sna_xid_3_arecv_bind,
1418 &hf_sna_xid_3_quiesce,
1419 &hf_sna_xid_3_pucap,
1420 &hf_sna_xid_3_pbn,
1421 &hf_sna_xid_3_pacing,
1422 NULL
1424 static int * const sna_xid_11_fields[] = {
1425 &hf_sna_xid_3_tgshare,
1426 &hf_sna_xid_3_dedsvc,
1427 NULL
1429 static int * const sna_xid_12_fields[] = {
1430 &hf_sna_xid_3_negcsup,
1431 &hf_sna_xid_3_negcomp,
1432 NULL
1434 static int * const sna_xid_15_fields[] = {
1435 &hf_sna_xid_3_partg,
1436 &hf_sna_xid_3_dlur,
1437 &hf_sna_xid_3_dlus,
1438 &hf_sna_xid_3_exbn,
1439 &hf_sna_xid_3_genodai,
1440 &hf_sna_xid_3_branch,
1441 &hf_sna_xid_3_brnn,
1442 NULL
1445 if (!tree)
1446 return;
1448 proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1450 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_xid_3_8,
1451 ett_sna_xid_3_8, sna_xid_3_fields, ENC_BIG_ENDIAN);
1453 proto_tree_add_bitmask(tree, tvb, 4, hf_sna_xid_3_10,
1454 ett_sna_xid_3_10, sna_xid_10_fields, ENC_BIG_ENDIAN);
1456 proto_tree_add_bitmask(tree, tvb, 5, hf_sna_xid_3_11,
1457 ett_sna_xid_3_11, sna_xid_11_fields, ENC_BIG_ENDIAN);
1459 proto_tree_add_bitmask(tree, tvb, 6, hf_sna_xid_3_12,
1460 ett_sna_xid_3_12, sna_xid_12_fields, ENC_BIG_ENDIAN);
1462 proto_tree_add_item(tree, hf_sna_reserved, tvb, 7, 2, ENC_NA);
1464 proto_tree_add_bitmask(tree, tvb, 9, hf_sna_xid_3_15,
1465 ett_sna_xid_3_15, sna_xid_15_fields, ENC_BIG_ENDIAN);
1467 proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1468 proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1470 dlen = tvb_get_uint8(tvb, 12);
1472 proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1474 /* FIXME: DLC Dependent Data Go Here */
1476 offset = 12 + dlen;
1478 while (tvb_offset_exists(tvb, offset)) {
1479 dlen = tvb_get_uint8(tvb, offset+1);
1480 dissect_sna_control(tvb, offset, dlen+2, tree, 0, KL);
1481 offset += (dlen+2);
1485 static void
1486 dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1487 proto_tree *parent_tree)
1489 proto_tree *sub_tree;
1490 proto_item *sub_ti = NULL;
1491 int format, type, len;
1492 uint32_t id;
1494 len = tvb_get_uint8(tvb, 1);
1495 type = tvb_get_uint8(tvb, 0);
1496 id = tvb_get_ntohl(tvb, 2);
1497 format = hi_nibble(type);
1499 /* Summary information */
1500 col_add_fstr(pinfo->cinfo, COL_INFO,
1501 "SNA XID Format:%d Type:%s", format,
1502 val_to_str_const(lo_nibble(type), sna_xid_type_vals,
1503 "Unknown Type"));
1505 if (tree) {
1506 sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1507 0, 1, ENC_BIG_ENDIAN);
1508 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1510 proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1511 type);
1512 proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1513 type);
1515 proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1517 sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1518 2, 4, ENC_BIG_ENDIAN);
1519 sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1521 proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1522 id);
1523 proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1524 id);
1526 switch(format) {
1527 case 0:
1528 break;
1529 case 1:
1530 dissect_xid1(tvb_new_subset_length_caplen(tvb, 6, len-6, -1),
1531 tree);
1532 break;
1533 case 2:
1534 dissect_xid2(tvb_new_subset_length_caplen(tvb, 6, len-6, -1),
1535 tree);
1536 break;
1537 case 3:
1538 dissect_xid3(tvb_new_subset_length_caplen(tvb, 6, len-6, -1),
1539 tree);
1540 break;
1541 default:
1542 /* external standards organizations */
1543 call_data_dissector(tvb_new_subset_length_caplen(tvb, 6, len-6, -1),
1544 pinfo, tree);
1548 if (format == 0)
1549 len = 6;
1551 if (tvb_offset_exists(tvb, len))
1552 call_data_dissector(tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1555 /* --------------------------------------------------------------------
1556 * Chapter 4 Transmission Headers (THs)
1557 * --------------------------------------------------------------------
1560 #define RH_LEN 3
1562 static unsigned int
1563 mpf_value(uint8_t th_byte)
1565 return (th_byte & 0x0c) >> 2;
1568 #define FIRST_FRAG_NUMBER 0
1569 #define MIDDLE_FRAG_NUMBER 1
1570 #define LAST_FRAG_NUMBER 2
1572 /* FID2 is defragged by sequence. The weird thing is that we have neither
1573 * absolute sequence numbers, nor byte offets. Other FIDs have byte offsets
1574 * (the DCF field), but not FID2. The only thing we have to go with is "FIRST",
1575 * "MIDDLE", or "LAST". If the BIU is split into 3 frames, then everything is
1576 * fine, * "FIRST", "MIDDLE", and "LAST" map nicely onto frag-number 0, 1,
1577 * and 2. However, if the BIU is split into 2 frames, then we only have
1578 * "FIRST" and "LAST", and the mapping *should* be frag-number 0 and 1,
1579 * *NOT* 0 and 2.
1581 * The SNA docs say "FID2 PIUs cannot be blocked because there is no DCF in the
1582 * TH format for deblocking" (note on Figure 4-2 in the IBM SNA documention,
1583 * see the FTP URL in the comment near the top of this file). I *think*
1584 * this means that the fragmented frames cannot arrive out of order.
1585 * Well, I *want* it to mean this, because w/o this limitation, if you
1586 * get a "FIRST" frame and a "LAST" frame, how long should you wait to
1587 * see if a "MIDDLE" frame every arrives????? Thus, if frames *have* to
1588 * arrive in order, then we're saved.
1590 * The problem then boils down to figuring out if "LAST" means frag-number 1
1591 * (in the case of a BIU split into 2 frames) or frag-number 2
1592 * (in the case of a BIU split into 3 frames).
1594 * Assuming fragmented FID2 BIU frames *do* arrive in order, the obvious
1595 * way to handle the mapping of "LAST" to either frag-number 1 or
1596 * frag-number 2 is to keep a hash which tracks the frames seen, etc.
1597 * This consumes resources. A trickier way, but a way which works, is to
1598 * always map the "LAST" BIU segment to frag-number 2. Here's the trickery:
1599 * if we add frag-number 2, which we know to be the "LAST" BIU segment,
1600 * and the reassembly code tells us that the BIU is still not reassmebled,
1601 * then, owing to the, ahem, /fact/, that fragmented BIU segments arrive
1602 * in order :), we know that 1) "FIRST" did come, and 2) there's no "MIDDLE",
1603 * because this BIU was fragmented into 2 frames, not 3. So, we'll be
1604 * tricky and add a zero-length "MIDDLE" BIU frame (i.e, frag-number 1)
1605 * to complete the reassembly.
1607 static tvbuff_t*
1608 defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1609 int id)
1611 fragment_head *fd_head;
1612 int frag_number = -1;
1613 bool more_frags = true;
1614 tvbuff_t *rh_tvb = NULL;
1615 int frag_len;
1617 /* Determine frag_number and more_frags */
1618 switch(mpf) {
1619 case MPF_WHOLE_BIU:
1620 /* nothing */
1621 break;
1622 case MPF_FIRST_SEGMENT:
1623 frag_number = FIRST_FRAG_NUMBER;
1624 break;
1625 case MPF_MIDDLE_SEGMENT:
1626 frag_number = MIDDLE_FRAG_NUMBER;
1627 break;
1628 case MPF_LAST_SEGMENT:
1629 frag_number = LAST_FRAG_NUMBER;
1630 more_frags = false;
1631 break;
1632 default:
1633 DISSECTOR_ASSERT_NOT_REACHED();
1636 /* If sna_defragment is on, and this is a fragment.. */
1637 if (frag_number > -1) {
1638 /* XXX - check length ??? */
1639 frag_len = tvb_reported_length_remaining(tvb, offset);
1640 if (tvb_bytes_exist(tvb, offset, frag_len)) {
1641 fd_head = fragment_add_seq(&sna_reassembly_table,
1642 tvb, offset, pinfo, id, NULL,
1643 frag_number, frag_len, more_frags, 0);
1645 /* We added the LAST segment and reassembly didn't
1646 * complete. Insert a zero-length MIDDLE segment to
1647 * turn a 2-frame BIU-fragmentation into a 3-frame
1648 * BIU-fragmentation (empty middle frag).
1649 * See above long comment about this trickery. */
1651 if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1652 fd_head = fragment_add_seq(&sna_reassembly_table,
1653 tvb, offset, pinfo, id, NULL,
1654 MIDDLE_FRAG_NUMBER, 0, true, 0);
1657 if (fd_head != NULL) {
1658 /* We have the complete reassembled payload. */
1659 rh_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
1661 /* Add the defragmented data to the data
1662 * source list. */
1663 add_new_data_source(pinfo, rh_tvb,
1664 "Reassembled SNA BIU");
1668 return rh_tvb;
1671 #define SNA_FID01_ADDR_LEN 2
1673 /* FID Types 0 and 1 */
1674 static int
1675 dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1677 proto_tree *bf_tree;
1678 proto_item *bf_item;
1679 uint8_t th_0;
1681 const int bytes_in_header = 10;
1683 if (tree) {
1684 /* Byte 0 */
1685 th_0 = tvb_get_uint8(tvb, 0);
1686 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1687 th_0);
1688 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1690 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1691 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1692 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1694 /* Byte 1 */
1695 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1697 /* Bytes 2-3 */
1698 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1701 /* Set DST addr */
1702 set_address_tvb(&pinfo->net_dst, sna_address_type, SNA_FID01_ADDR_LEN, tvb, 2);
1703 copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1705 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1707 /* Set SRC addr */
1708 set_address_tvb(&pinfo->net_src, sna_address_type, SNA_FID01_ADDR_LEN, tvb, 4);
1709 copy_address_shallow(&pinfo->src, &pinfo->net_src);
1711 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1712 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1714 return bytes_in_header;
1717 #define SNA_FID2_ADDR_LEN 1
1719 /* FID Type 2 */
1720 static int
1721 dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1722 tvbuff_t **rh_tvb_ptr, next_dissection_t *continue_dissecting)
1724 proto_tree *bf_tree;
1725 proto_item *bf_item;
1726 uint8_t th_0;
1727 unsigned int mpf, id;
1729 const int bytes_in_header = 6;
1731 th_0 = tvb_get_uint8(tvb, 0);
1732 mpf = mpf_value(th_0);
1734 if (tree) {
1736 /* Byte 0 */
1737 bf_item = proto_tree_add_item(tree, hf_sna_th_0, tvb, 0, 1, ENC_BIG_ENDIAN);
1738 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1740 proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, 0, 1, ENC_BIG_ENDIAN);
1741 proto_tree_add_item(bf_tree, hf_sna_th_mpf, tvb, 0, 1, ENC_BIG_ENDIAN);
1742 proto_tree_add_item(bf_tree, hf_sna_th_odai,tvb, 0, 1, ENC_BIG_ENDIAN);
1743 proto_tree_add_item(bf_tree, hf_sna_th_efi, tvb, 0, 1, ENC_BIG_ENDIAN);
1746 /* Byte 1 */
1747 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1749 /* Byte 2 */
1750 proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 1, ENC_BIG_ENDIAN);
1753 /* Set DST addr */
1754 set_address_tvb(&pinfo->net_dst, sna_address_type, SNA_FID2_ADDR_LEN, tvb, 2);
1755 copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1757 /* Byte 3 */
1758 proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_BIG_ENDIAN);
1760 /* Set SRC addr */
1761 set_address_tvb(&pinfo->net_src, sna_address_type, SNA_FID2_ADDR_LEN, tvb, 3);
1762 copy_address_shallow(&pinfo->src, &pinfo->net_src);
1764 id = tvb_get_ntohs(tvb, 4);
1765 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN);
1767 if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1768 if (mpf == MPF_FIRST_SEGMENT) {
1769 *continue_dissecting = rh_only;
1770 } else {
1771 *continue_dissecting = stop_here;
1775 else if (sna_defragment) {
1776 *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1777 bytes_in_header, mpf, id);
1780 return bytes_in_header;
1783 /* FID Type 3 */
1784 static int
1785 dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1787 proto_tree *bf_tree;
1788 proto_item *bf_item;
1789 uint8_t th_0;
1791 const int bytes_in_header = 2;
1793 /* If we're not filling a proto_tree, return now */
1794 if (!tree)
1795 return bytes_in_header;
1797 th_0 = tvb_get_uint8(tvb, 0);
1799 /* Create the bitfield tree */
1800 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1801 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1803 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1804 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1805 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1807 proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1809 return bytes_in_header;
1812 static int
1813 dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1815 int offset = 0;
1816 uint8_t th_byte, mft;
1817 uint16_t def, oef;
1818 uint32_t dsaf, osaf;
1819 static int * const byte0_fields[] = {
1820 &hf_sna_th_fid,
1821 &hf_sna_th_tg_sweep,
1822 &hf_sna_th_er_vr_supp_ind,
1823 &hf_sna_th_vr_pac_cnt_ind,
1824 &hf_sna_th_ntwk_prty,
1825 NULL
1827 static int * const byte1_fields[] = {
1828 &hf_sna_th_tgsf,
1829 &hf_sna_th_mft,
1830 &hf_sna_th_piubf,
1831 NULL
1833 static int * const byte2_mft_fields[] = {
1834 &hf_sna_th_nlpoi,
1835 &hf_sna_th_nlp_cp,
1836 &hf_sna_th_ern,
1837 NULL
1839 static int * const byte2_fields[] = {
1840 &hf_sna_th_iern,
1841 &hf_sna_th_ern,
1842 NULL
1844 static int * const byte3_fields[] = {
1845 &hf_sna_th_vrn,
1846 &hf_sna_th_tpf,
1847 NULL
1849 static int * const byte4_fields[] = {
1850 &hf_sna_th_vr_cwi,
1851 &hf_sna_th_tg_nonfifo_ind,
1852 &hf_sna_th_vr_sqti,
1853 /* I'm not sure about byte-order on this one... */
1854 &hf_sna_th_tg_snf,
1855 NULL
1857 static int * const byte6_fields[] = {
1858 &hf_sna_th_vrprq,
1859 &hf_sna_th_vrprs,
1860 &hf_sna_th_vr_cwri,
1861 &hf_sna_th_vr_rwi,
1862 /* I'm not sure about byte-order on this one... */
1863 &hf_sna_th_vr_snf_send,
1864 NULL
1866 static int * const byte16_fields[] = {
1867 &hf_sna_th_snai,
1868 /* We luck out here because in their infinite wisdom the SNA
1869 * architects placed the MPF and EFI fields in the same bitfield
1870 * locations, even though for FID4 they're not in byte 0.
1871 * Thank you IBM! */
1872 &hf_sna_th_mpf,
1873 &hf_sna_th_efi,
1874 NULL
1877 struct sna_fid_type_4_addr *src, *dst;
1879 const int bytes_in_header = 26;
1881 /* If we're not filling a proto_tree, return now */
1882 if (!tree)
1883 return bytes_in_header;
1885 /* Byte 0 */
1886 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_0,
1887 ett_sna_th_fid, byte0_fields, ENC_NA);
1889 offset += 1;
1890 th_byte = tvb_get_uint8(tvb, offset);
1892 /* Byte 1 */
1893 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte1,
1894 ett_sna_th_fid, byte1_fields, ENC_NA);
1896 mft = th_byte & 0x04;
1897 offset += 1;
1899 /* Byte 2 */
1900 if (mft) {
1901 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1902 ett_sna_th_fid, byte2_mft_fields, ENC_NA);
1903 } else {
1904 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1905 ett_sna_th_fid, byte2_fields, ENC_NA);
1908 offset += 1;
1910 /* Byte 3 */
1911 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte3,
1912 ett_sna_th_fid, byte3_fields, ENC_NA);
1913 offset += 1;
1915 /* Bytes 4-5 */
1916 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte4,
1917 ett_sna_th_fid, byte4_fields, ENC_BIG_ENDIAN);
1918 offset += 2;
1920 /* Create the bitfield tree */
1921 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte6,
1922 ett_sna_th_fid, byte6_fields, ENC_BIG_ENDIAN);
1923 offset += 2;
1925 dsaf = tvb_get_ntohl(tvb, 8);
1926 /* Bytes 8-11 */
1927 proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
1929 offset += 4;
1931 osaf = tvb_get_ntohl(tvb, 12);
1932 /* Bytes 12-15 */
1933 proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
1935 offset += 4;
1937 /* Byte 16 */
1938 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte16,
1939 ett_sna_th_fid, byte16_fields, ENC_NA);
1941 /* 1 for byte 16, 1 for byte 17 which is reserved */
1942 offset += 2;
1944 def = tvb_get_ntohs(tvb, 18);
1945 /* Bytes 18-25 */
1946 proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
1948 /* Addresses in FID 4 are discontiguous, sigh */
1949 dst = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1950 dst->saf = dsaf;
1951 dst->ef = def;
1952 set_address(&pinfo->net_dst, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, dst);
1953 copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1955 oef = tvb_get_ntohs(tvb, 20);
1956 proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
1958 /* Addresses in FID 4 are discontiguous, sigh */
1959 src = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1960 src->saf = osaf;
1961 src->ef = oef;
1962 set_address(&pinfo->net_src, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, src);
1963 copy_address_shallow(&pinfo->src, &pinfo->net_src);
1965 proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1966 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1968 return bytes_in_header;
1971 /* FID Type 5 */
1972 static int
1973 dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
1975 proto_tree *bf_tree;
1976 proto_item *bf_item;
1977 uint8_t th_0;
1979 const int bytes_in_header = 12;
1981 /* If we're not filling a proto_tree, return now */
1982 if (!tree)
1983 return bytes_in_header;
1985 th_0 = tvb_get_uint8(tvb, 0);
1987 /* Create the bitfield tree */
1988 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1989 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1991 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1992 proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1993 proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1995 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1996 proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
1998 proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
2000 return bytes_in_header;
2004 /* FID Type f */
2005 static int
2006 dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2008 proto_tree *bf_tree;
2009 proto_item *bf_item;
2010 uint8_t th_0;
2012 const int bytes_in_header = 26;
2014 /* If we're not filling a proto_tree, return now */
2015 if (!tree)
2016 return bytes_in_header;
2018 th_0 = tvb_get_uint8(tvb, 0);
2020 /* Create the bitfield tree */
2021 bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2022 bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2024 proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2025 proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
2027 proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb, 2, 1, ENC_BIG_ENDIAN);
2028 proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2029 proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb, 4, 2, ENC_BIG_ENDIAN);
2031 /* Yup, bytes 6-23 are reserved! */
2032 proto_tree_add_item(tree, hf_sna_reserved, tvb, 6, 18, ENC_NA);
2034 proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2036 return bytes_in_header;
2039 static void
2040 dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2041 proto_tree *parent_tree)
2044 proto_tree *th_tree = NULL, *rh_tree = NULL;
2045 proto_item *th_ti = NULL, *rh_ti = NULL;
2046 uint8_t th_fid;
2047 int th_header_len = 0;
2048 int offset, rh_offset;
2049 tvbuff_t *rh_tvb = NULL;
2050 next_dissection_t continue_dissecting = everything;
2052 /* Transmission Header Format Identifier */
2053 th_fid = hi_nibble(tvb_get_uint8(tvb, 0));
2055 /* Summary information */
2056 col_add_str(pinfo->cinfo, COL_INFO,
2057 val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2059 if (tree) {
2060 /* --- TH --- */
2061 /* Don't bother setting length. We'll set it later after we
2062 * find the length of TH */
2063 th_ti = proto_tree_add_item(tree, hf_sna_th, tvb, 0, -1,
2064 ENC_NA);
2065 th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2068 /* Get size of TH */
2069 switch(th_fid) {
2070 case 0x0:
2071 case 0x1:
2072 th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2073 break;
2074 case 0x2:
2075 th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2076 &rh_tvb, &continue_dissecting);
2077 break;
2078 case 0x3:
2079 th_header_len = dissect_fid3(tvb, th_tree);
2080 break;
2081 case 0x4:
2082 th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2083 break;
2084 case 0x5:
2085 th_header_len = dissect_fid5(tvb, th_tree);
2086 break;
2087 case 0xf:
2088 th_header_len = dissect_fidf(tvb, th_tree);
2089 break;
2090 default:
2091 call_data_dissector(tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2092 return;
2095 offset = th_header_len;
2097 /* Short-circuit ? */
2098 if (continue_dissecting == stop_here) {
2099 proto_tree_add_item(tree, hf_sna_biu_segment_data, tvb, offset, -1, ENC_NA);
2100 return;
2103 /* If the FID dissector function didn't create an rh_tvb, then we just
2104 * use the rest of our tvbuff as the rh_tvb. */
2105 if (!rh_tvb)
2106 rh_tvb = tvb_new_subset_remaining(tvb, offset);
2107 rh_offset = 0;
2109 /* Process the rest of the SNA packet, starting with RH */
2110 if (tree) {
2111 proto_item_set_len(th_ti, th_header_len);
2113 /* --- RH --- */
2114 rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2115 RH_LEN, ENC_NA);
2116 rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2117 dissect_rh(rh_tvb, rh_offset, rh_tree);
2120 rh_offset += RH_LEN;
2122 if (tvb_offset_exists(rh_tvb, rh_offset)) {
2123 /* Short-circuit ? */
2124 if (continue_dissecting == rh_only) {
2125 proto_tree_add_item(tree, hf_sna_biu_segment_data, rh_tvb, rh_offset, -1, ENC_NA);
2126 return;
2129 call_data_dissector(tvb_new_subset_remaining(rh_tvb, rh_offset),
2130 pinfo, parent_tree);
2134 /* --------------------------------------------------------------------
2135 * Chapter 5 Request/Response Headers (RHs)
2136 * --------------------------------------------------------------------
2139 static void
2140 dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2142 bool is_response;
2143 uint8_t rh_0;
2144 static int * const sna_rh_fields[] = {
2145 &hf_sna_rh_rri,
2146 &hf_sna_rh_ru_category,
2147 &hf_sna_rh_fi,
2148 &hf_sna_rh_sdi,
2149 &hf_sna_rh_bci,
2150 &hf_sna_rh_eci,
2151 NULL
2153 static int * const sna_rh_1_req_fields[] = {
2154 &hf_sna_rh_dr1,
2155 &hf_sna_rh_lcci,
2156 &hf_sna_rh_dr2,
2157 &hf_sna_rh_eri,
2158 &hf_sna_rh_rlwi,
2159 &hf_sna_rh_qri,
2160 &hf_sna_rh_pi,
2161 NULL
2163 static int * const sna_rh_1_rsp_fields[] = {
2164 &hf_sna_rh_dr1,
2165 &hf_sna_rh_dr2,
2166 &hf_sna_rh_rti,
2167 &hf_sna_rh_qri,
2168 &hf_sna_rh_pi,
2169 NULL
2171 static int * const sna_rh_2_req_fields[] = {
2172 &hf_sna_rh_bbi,
2173 &hf_sna_rh_ebi,
2174 &hf_sna_rh_cdi,
2175 &hf_sna_rh_csi,
2176 &hf_sna_rh_edi,
2177 &hf_sna_rh_pdi,
2178 &hf_sna_rh_cebi,
2179 NULL
2182 if (!tree)
2183 return;
2185 /* Create the bitfield tree for byte 0*/
2186 rh_0 = tvb_get_uint8(tvb, offset);
2187 is_response = (rh_0 & 0x80);
2189 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_0,
2190 ett_sna_rh_0, sna_rh_fields, ENC_BIG_ENDIAN);
2191 offset += 1;
2193 /* Create the bitfield tree for byte 1*/
2194 if (is_response) {
2195 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2196 ett_sna_rh_1, sna_rh_1_rsp_fields, ENC_BIG_ENDIAN);
2197 } else {
2198 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2199 ett_sna_rh_1, sna_rh_1_req_fields, ENC_BIG_ENDIAN);
2201 offset += 1;
2203 /* Create the bitfield tree for byte 2*/
2204 if (!is_response) {
2205 proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_2,
2206 ett_sna_rh_2, sna_rh_2_req_fields, ENC_BIG_ENDIAN);
2207 } else {
2208 proto_tree_add_item(tree, hf_sna_rh_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2211 /* XXX - check for sdi. If true, the next 4 bytes will be sense data */
2214 /* --------------------------------------------------------------------
2215 * Chapter 6 Request/Response Units (RUs)
2216 * --------------------------------------------------------------------
2219 /* --------------------------------------------------------------------
2220 * Chapter 9 Common Fields
2221 * --------------------------------------------------------------------
2224 static void
2225 // NOLINTNEXTLINE(misc-no-recursion)
2226 dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2227 enum parse parse)
2229 uint16_t offset, len, pad;
2230 static int * const sna_control_05hpr_fields[] = {
2231 &hf_sna_control_05_ptp,
2232 NULL
2235 if (!tree)
2236 return;
2238 proto_tree_add_bitmask(tree, tvb, 2, hf_sna_control_05_type,
2239 ett_sna_control_05hpr_type, sna_control_05hpr_fields, ENC_BIG_ENDIAN);
2241 proto_tree_add_item(tree, hf_sna_reserved, tvb, 3, 1, ENC_NA);
2243 offset = 4;
2245 while (tvb_offset_exists(tvb, offset)) {
2246 if (parse == LT) {
2247 len = tvb_get_uint8(tvb, offset+0);
2248 } else {
2249 len = tvb_get_uint8(tvb, offset+1);
2251 if (len) {
2252 // We recurse here, but we'll run out of packet before we run out of stack.
2253 dissect_sna_control(tvb, offset, len, tree, hpr, parse);
2254 pad = (len+3) & 0xfffc;
2255 if (pad > len) {
2256 proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
2258 offset += pad;
2259 } else {
2260 return;
2265 static void
2266 dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2268 if(!tree)
2269 return;
2271 proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2274 static void
2275 dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2277 int len;
2279 if (!tree)
2280 return;
2282 proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2284 len = tvb_reported_length_remaining(tvb, 3);
2285 if (len <= 0)
2286 return;
2288 proto_tree_add_item(tree, hf_sna_control_0e_value, tvb, 3, len, ENC_EBCDIC);
2291 static void
2292 // NOLINTNEXTLINE(misc-no-recursion)
2293 dissect_sna_control(tvbuff_t *parent_tvb, int offset, int control_len,
2294 proto_tree *tree, int hpr, enum parse parse)
2296 tvbuff_t *tvb;
2297 int length, reported_length;
2298 proto_tree *sub_tree;
2299 int len, key;
2300 int ett;
2302 length = tvb_captured_length_remaining(parent_tvb, offset);
2303 reported_length = tvb_reported_length_remaining(parent_tvb, offset);
2304 if (control_len < length)
2305 length = control_len;
2306 if (control_len < reported_length)
2307 reported_length = control_len;
2308 tvb = tvb_new_subset_length_caplen(parent_tvb, offset, length, reported_length);
2310 sub_tree = NULL;
2312 if (parse == LT) {
2313 len = tvb_get_uint8(tvb, 0);
2314 key = tvb_get_uint8(tvb, 1);
2315 } else {
2316 key = tvb_get_uint8(tvb, 0);
2317 len = tvb_get_uint8(tvb, 1);
2319 ett = ett_sna_control_un;
2321 if (tree) {
2322 if (key == 5) {
2323 if (hpr) ett = ett_sna_control_05hpr;
2324 else ett = ett_sna_control_05;
2326 if (key == 0x0e) ett = ett_sna_control_0e;
2328 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2329 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2330 val_to_str_const(key, sna_control_hpr_vals,
2331 "Unknown Control Vector"));
2332 else
2333 sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2334 val_to_str_const(key, sna_control_vals,
2335 "Unknown Control Vector"));
2336 if (parse == LT) {
2337 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2338 tvb, 0, 1, len);
2339 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2340 proto_tree_add_uint(sub_tree,
2341 hf_sna_control_hprkey, tvb, 1, 1, key);
2342 else
2343 proto_tree_add_uint(sub_tree,
2344 hf_sna_control_key, tvb, 1, 1, key);
2345 } else {
2346 if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2347 proto_tree_add_uint(sub_tree,
2348 hf_sna_control_hprkey, tvb, 0, 1, key);
2349 else
2350 proto_tree_add_uint(sub_tree,
2351 hf_sna_control_key, tvb, 0, 1, key);
2352 proto_tree_add_uint(sub_tree, hf_sna_control_len,
2353 tvb, 1, 1, len);
2356 switch(key) {
2357 case 0x05:
2358 if (hpr)
2359 // We recurse here, but we'll run out of packet before we run out of stack.
2360 dissect_control_05hpr(tvb, sub_tree, hpr,
2361 parse);
2362 else
2363 dissect_control_05(tvb, sub_tree);
2364 break;
2365 case 0x0e:
2366 dissect_control_0e(tvb, sub_tree);
2367 break;
2371 /* --------------------------------------------------------------------
2372 * Chapter 11 Function Management (FM) Headers
2373 * --------------------------------------------------------------------
2376 /* --------------------------------------------------------------------
2377 * Chapter 12 Presentation Services (PS) Headers
2378 * --------------------------------------------------------------------
2381 /* --------------------------------------------------------------------
2382 * Chapter 13 GDS Variables
2383 * --------------------------------------------------------------------
2386 static void
2387 dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2388 proto_tree *parent_tree)
2390 uint16_t length;
2391 int cont;
2392 int offset = 0;
2393 proto_item *pi;
2394 proto_tree *subtree;
2395 bool first_ll = true;
2397 do {
2398 length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2399 cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2401 pi = proto_tree_add_item(tree, hf_sna_gds, tvb, offset, -1, ENC_NA);
2402 subtree = proto_item_add_subtree(pi, ett_sna_gds);
2403 proto_tree_add_item(subtree, hf_sna_gds_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2404 proto_tree_add_item(subtree, hf_sna_gds_cont, tvb, offset, 2, ENC_BIG_ENDIAN);
2405 if (length < 2 ) /* escape sequence */
2406 return;
2407 offset += 2;
2408 length -= 2;
2409 if (first_ll) {
2410 proto_tree_add_item(subtree, hf_sna_gds_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2411 offset += 2;
2412 length -= 2;
2413 first_ll = false;
2415 if (length > 0) {
2416 proto_tree_add_item(subtree, hf_sna_gds_info, tvb, offset, length, ENC_NA);
2417 offset += length;
2419 } while(cont);
2420 proto_item_set_len(pi, offset);
2421 if (tvb_offset_exists(tvb, offset))
2422 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2425 /* --------------------------------------------------------------------
2426 * General stuff
2427 * --------------------------------------------------------------------
2430 static int
2431 dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2433 uint8_t fid;
2434 proto_tree *sna_tree = NULL;
2435 proto_item *sna_ti = NULL;
2437 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2438 col_clear(pinfo->cinfo, COL_INFO);
2440 /* SNA data should be printed in EBCDIC, not ASCII */
2441 pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2443 if (tree) {
2445 /* Don't bother setting length. We'll set it later after we find
2446 * the lengths of TH/RH/RU */
2447 sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2448 ENC_NA);
2449 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2452 /* Transmission Header Format Identifier */
2453 fid = hi_nibble(tvb_get_uint8(tvb, 0));
2454 switch(fid) {
2455 case 0xa: /* HPR Network Layer Packet */
2456 case 0xb:
2457 case 0xc:
2458 case 0xd:
2459 dissect_nlp(tvb, pinfo, sna_tree, tree);
2460 break;
2461 default:
2462 dissect_fid(tvb, pinfo, sna_tree, tree);
2464 return tvb_captured_length(tvb);
2467 static int
2468 dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2470 proto_tree *sna_tree = NULL;
2471 proto_item *sna_ti = NULL;
2473 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2474 col_clear(pinfo->cinfo, COL_INFO);
2476 /* SNA data should be printed in EBCDIC, not ASCII */
2477 pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2479 if (tree) {
2481 /* Don't bother setting length. We'll set it later after we find
2482 * the lengths of XID */
2483 sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2484 ENC_NA);
2485 sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2487 dissect_xid(tvb, pinfo, sna_tree, tree);
2488 return tvb_captured_length(tvb);
2492 void
2493 proto_register_sna(void)
2495 static hf_register_info hf[] = {
2496 { &hf_sna_th,
2497 { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2498 NULL, 0x0, NULL, HFILL }},
2500 { &hf_sna_th_0,
2501 { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2502 NULL, 0x0,
2503 "TH Byte 0", HFILL }},
2505 { &hf_sna_th_fid,
2506 { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2507 VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2509 { &hf_sna_th_mpf,
2510 { "Mapping Field", "sna.th.mpf", FT_UINT8,
2511 BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2513 { &hf_sna_th_odai,
2514 { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2515 BASE_DEC, NULL, 0x02, NULL, HFILL }},
2517 { &hf_sna_th_efi,
2518 { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2519 BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2521 { &hf_sna_th_daf,
2522 { "Destination Address Field", "sna.th.daf", FT_UINT16,
2523 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2525 { &hf_sna_th_oaf,
2526 { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2527 NULL, 0x0, NULL, HFILL }},
2529 { &hf_sna_th_snf,
2530 { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2531 NULL, 0x0, NULL, HFILL }},
2533 { &hf_sna_th_dcf,
2534 { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2535 NULL, 0x0, NULL, HFILL }},
2537 { &hf_sna_th_lsid,
2538 { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2539 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2541 { &hf_sna_th_tg_sweep,
2542 { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2543 BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2545 { &hf_sna_th_er_vr_supp_ind,
2546 { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2547 FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2548 0x04, NULL, HFILL }},
2550 { &hf_sna_th_vr_pac_cnt_ind,
2551 { "Virtual Route Pacing Count Indicator",
2552 "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2553 VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2555 { &hf_sna_th_ntwk_prty,
2556 { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2557 VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2559 { &hf_sna_th_tgsf,
2560 { "Transmission Group Segmenting Field", "sna.th.tgsf",
2561 FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2562 NULL, HFILL }},
2564 { &hf_sna_th_mft,
2565 { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2566 NULL, 0x04, NULL, HFILL }},
2568 { &hf_sna_th_piubf,
2569 { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2570 VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2572 { &hf_sna_th_iern,
2573 { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2574 BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2576 { &hf_sna_th_nlpoi,
2577 { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2578 VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2580 { &hf_sna_th_nlp_cp,
2581 { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2582 NULL, 0x70, NULL, HFILL }},
2584 { &hf_sna_th_ern,
2585 { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2586 NULL, 0x0f, NULL, HFILL }},
2588 { &hf_sna_th_vrn,
2589 { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2590 NULL, 0xf0, NULL, HFILL }},
2592 { &hf_sna_th_tpf,
2593 { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2594 BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2596 { &hf_sna_th_vr_cwi,
2597 { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2598 FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2599 NULL, HFILL }},
2601 { &hf_sna_th_tg_nonfifo_ind,
2602 { "Transmission Group Non-FIFO Indicator",
2603 "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2604 TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2606 { &hf_sna_th_vr_sqti,
2607 { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2608 FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2609 NULL, HFILL }},
2611 { &hf_sna_th_tg_snf,
2612 { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2613 FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2615 { &hf_sna_th_vrprq,
2616 { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2617 16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2619 { &hf_sna_th_vrprs,
2620 { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2621 16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2623 { &hf_sna_th_vr_cwri,
2624 { "Virtual Route Change Window Reply Indicator",
2625 "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2626 VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2628 { &hf_sna_th_vr_rwi,
2629 { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2630 FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2631 NULL, HFILL }},
2633 { &hf_sna_th_vr_snf_send,
2634 { "Virtual Route Send Sequence Number Field",
2635 "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2636 NULL, HFILL }},
2638 { &hf_sna_th_dsaf,
2639 { "Destination Subarea Address Field", "sna.th.dsaf",
2640 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2642 { &hf_sna_th_osaf,
2643 { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2644 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2646 { &hf_sna_th_snai,
2647 { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2648 "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2650 { &hf_sna_th_def,
2651 { "Destination Element Field", "sna.th.def", FT_UINT16,
2652 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2654 { &hf_sna_th_oef,
2655 { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2656 NULL, 0x0, NULL, HFILL }},
2658 { &hf_sna_th_sa,
2659 { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2660 NULL, 0x0, NULL, HFILL }},
2662 { &hf_sna_th_cmd_fmt,
2663 { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2664 NULL, 0x0, NULL, HFILL }},
2666 { &hf_sna_th_cmd_type,
2667 { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2668 NULL, 0x0, NULL, HFILL }},
2670 { &hf_sna_th_cmd_sn,
2671 { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2672 BASE_DEC, NULL, 0x0, NULL, HFILL }},
2674 { &hf_sna_th_byte1,
2675 { "Transmission Header Bytes 1", "sna.th.byte1", FT_UINT8,
2676 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2678 { &hf_sna_th_byte2,
2679 { "Transmission Header Bytes 2", "sna.th.byte2", FT_UINT8,
2680 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2682 { &hf_sna_th_byte3,
2683 { "Transmission Header Bytes 3", "sna.th.byte3", FT_UINT8,
2684 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2686 { &hf_sna_th_byte4,
2687 { "Transmission Header Bytes 4-5", "sna.th.byte4", FT_UINT16,
2688 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2690 { &hf_sna_th_byte6,
2691 { "Transmission Header Bytes 6-7", "sna.th.byte6", FT_UINT16,
2692 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2694 { &hf_sna_th_byte16,
2695 { "Transmission Header Bytes 16", "sna.th.byte16", FT_UINT8,
2696 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2698 { &hf_sna_nlp_nhdr,
2699 { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2700 BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2702 { &hf_sna_nlp_nhdr_0,
2703 { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2704 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2706 { &hf_sna_nlp_nhdr_1,
2707 { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2708 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2710 { &hf_sna_nlp_sm,
2711 { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2712 BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2714 { &hf_sna_nlp_tpf,
2715 { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2716 BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2718 { &hf_sna_nlp_ft,
2719 { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2720 VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2722 { &hf_sna_nlp_tspi,
2723 { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2724 FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2726 { &hf_sna_nlp_slowdn1,
2727 { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2728 TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2730 { &hf_sna_nlp_slowdn2,
2731 { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2732 TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2734 { &hf_sna_nlp_fra,
2735 { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2736 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2738 { &hf_sna_nlp_anr,
2739 { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2740 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2742 { &hf_sna_nlp_frh,
2743 { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2744 BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2746 { &hf_sna_nlp_thdr,
2747 { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2748 NULL, 0x0, "THDR", HFILL }},
2750 { &hf_sna_nlp_tcid,
2751 { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2752 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2754 { &hf_sna_nlp_thdr_8,
2755 { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2756 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2758 { &hf_sna_nlp_setupi,
2759 { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2760 TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2762 { &hf_sna_nlp_somi,
2763 { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2764 FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2766 { &hf_sna_nlp_eomi,
2767 { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2768 8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2770 { &hf_sna_nlp_sri,
2771 { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2772 8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2774 { &hf_sna_nlp_rasapi,
2775 { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2776 8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2778 { &hf_sna_nlp_retryi,
2779 { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2780 8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2782 { &hf_sna_nlp_thdr_9,
2783 { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2784 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2786 { &hf_sna_nlp_lmi,
2787 { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2788 8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2790 { &hf_sna_nlp_cqfi,
2791 { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2792 FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2794 { &hf_sna_nlp_osi,
2795 { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2796 FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2798 { &hf_sna_nlp_offset,
2799 { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2800 NULL, 0x0, "Data Offset in Words", HFILL }},
2802 { &hf_sna_nlp_dlf,
2803 { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2804 NULL, 0x0, NULL, HFILL }},
2806 { &hf_sna_nlp_bsn,
2807 { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2808 BASE_HEX, NULL, 0x0, NULL, HFILL }},
2810 { &hf_sna_nlp_opti_len,
2811 { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2812 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2814 { &hf_sna_nlp_opti_type,
2815 { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2816 FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2817 HFILL }},
2819 { &hf_sna_nlp_opti_0d_version,
2820 { "Version", "sna.nlp.thdr.optional.0d.version",
2821 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2822 0, NULL, HFILL }},
2824 { &hf_sna_nlp_opti_0d_4,
2825 { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2826 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2828 { &hf_sna_nlp_opti_0d_target,
2829 { "Target Resource ID Present",
2830 "sna.nlp.thdr.optional.0d.target",
2831 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2833 { &hf_sna_nlp_opti_0d_arb,
2834 { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2835 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2837 { &hf_sna_nlp_opti_0d_reliable,
2838 { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2839 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2841 { &hf_sna_nlp_opti_0d_dedicated,
2842 { "Dedicated RTP Connection",
2843 "sna.nlp.thdr.optional.0d.dedicated",
2844 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2846 { &hf_sna_nlp_opti_0e_stat,
2847 { "Status", "sna.nlp.thdr.optional.0e.stat",
2848 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2850 { &hf_sna_nlp_opti_0e_gap,
2851 { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2852 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2854 { &hf_sna_nlp_opti_0e_idle,
2855 { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2856 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2858 { &hf_sna_nlp_opti_0e_nabsp,
2859 { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2860 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2862 { &hf_sna_nlp_opti_0e_sync,
2863 { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2864 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2866 { &hf_sna_nlp_opti_0e_echo,
2867 { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2868 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2870 { &hf_sna_nlp_opti_0e_rseq,
2871 { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2872 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2874 #if 0
2875 { &hf_sna_nlp_opti_0e_abspbeg,
2876 { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2877 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2878 #endif
2880 #if 0
2881 { &hf_sna_nlp_opti_0e_abspend,
2882 { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2883 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2884 #endif
2886 { &hf_sna_nlp_opti_0f_bits,
2887 { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2888 FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2889 0x0, NULL, HFILL }},
2891 { &hf_sna_nlp_opti_10_tcid,
2892 { "Transport Connection Identifier",
2893 "sna.nlp.thdr.optional.10.tcid",
2894 FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2896 { &hf_sna_nlp_opti_12_sense,
2897 { "Sense Data", "sna.nlp.thdr.optional.12.sense",
2898 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2900 { &hf_sna_nlp_opti_14_si_len,
2901 { "Length", "sna.nlp.thdr.optional.14.si.len",
2902 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2904 { &hf_sna_nlp_opti_14_si_key,
2905 { "Key", "sna.nlp.thdr.optional.14.si.key",
2906 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2908 { &hf_sna_nlp_opti_14_si_2,
2909 { "Switching Information Byte 2",
2910 "sna.nlp.thdr.optional.14.si.2",
2911 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2913 { &hf_sna_nlp_opti_14_si_refifo,
2914 { "Resequencing (REFIFO) Indicator",
2915 "sna.nlp.thdr.optional.14.si.refifo",
2916 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2918 { &hf_sna_nlp_opti_14_si_mobility,
2919 { "Mobility Indicator",
2920 "sna.nlp.thdr.optional.14.si.mobility",
2921 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2923 { &hf_sna_nlp_opti_14_si_dirsearch,
2924 { "Directory Search Required on Path Switch Indicator",
2925 "sna.nlp.thdr.optional.14.si.dirsearch",
2926 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
2928 { &hf_sna_nlp_opti_14_si_limitres,
2929 { "Limited Resource Link Indicator",
2930 "sna.nlp.thdr.optional.14.si.limitres",
2931 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2933 { &hf_sna_nlp_opti_14_si_ncescope,
2934 { "NCE Scope Indicator",
2935 "sna.nlp.thdr.optional.14.si.ncescope",
2936 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2938 { &hf_sna_nlp_opti_14_si_mnpsrscv,
2939 { "MNPS RSCV Retention Indicator",
2940 "sna.nlp.thdr.optional.14.si.mnpsrscv",
2941 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2943 { &hf_sna_nlp_opti_14_si_maxpsize,
2944 { "Maximum Packet Size On Return Path",
2945 "sna.nlp.thdr.optional.14.si.maxpsize",
2946 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2948 { &hf_sna_nlp_opti_14_si_switch,
2949 { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
2950 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2952 { &hf_sna_nlp_opti_14_si_alive,
2953 { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
2954 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2956 { &hf_sna_nlp_opti_14_rr_len,
2957 { "Length", "sna.nlp.thdr.optional.14.rr.len",
2958 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2960 { &hf_sna_nlp_opti_14_rr_key,
2961 { "Key", "sna.nlp.thdr.optional.14.rr.key",
2962 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2964 { &hf_sna_nlp_opti_14_rr_2,
2965 { "Return Route TG Descriptor Byte 2",
2966 "sna.nlp.thdr.optional.14.rr.2",
2967 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2969 { &hf_sna_nlp_opti_14_rr_bfe,
2970 { "BF Entry Indicator",
2971 "sna.nlp.thdr.optional.14.rr.bfe",
2972 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2974 { &hf_sna_nlp_opti_14_rr_num,
2975 { "Number Of TG Control Vectors",
2976 "sna.nlp.thdr.optional.14.rr.num",
2977 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2979 { &hf_sna_nlp_opti_22_2,
2980 { "Adaptive Rate Based Segment Byte 2",
2981 "sna.nlp.thdr.optional.22.2",
2982 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2984 { &hf_sna_nlp_opti_22_type,
2985 { "Message Type",
2986 "sna.nlp.thdr.optional.22.type",
2987 FT_UINT8, BASE_HEX,
2988 VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
2990 { &hf_sna_nlp_opti_22_raa,
2991 { "Rate Adjustment Action",
2992 "sna.nlp.thdr.optional.22.raa",
2993 FT_UINT8, BASE_HEX,
2994 VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
2996 { &hf_sna_nlp_opti_22_parity,
2997 { "Parity Indicator",
2998 "sna.nlp.thdr.optional.22.parity",
2999 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
3001 { &hf_sna_nlp_opti_22_arb,
3002 { "ARB Mode",
3003 "sna.nlp.thdr.optional.22.arb",
3004 FT_UINT8, BASE_HEX,
3005 VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
3007 { &hf_sna_nlp_opti_22_3,
3008 { "Adaptive Rate Based Segment Byte 3",
3009 "sna.nlp.thdr.optional.22.3",
3010 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3012 { &hf_sna_nlp_opti_22_ratereq,
3013 { "Rate Request Correlator",
3014 "sna.nlp.thdr.optional.22.ratereq",
3015 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3017 { &hf_sna_nlp_opti_22_raterep,
3018 { "Rate Reply Correlator",
3019 "sna.nlp.thdr.optional.22.raterep",
3020 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3022 { &hf_sna_nlp_opti_22_field1,
3023 { "Field 1", "sna.nlp.thdr.optional.22.field1",
3024 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3026 { &hf_sna_nlp_opti_22_field2,
3027 { "Field 2", "sna.nlp.thdr.optional.22.field2",
3028 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3030 { &hf_sna_nlp_opti_22_field3,
3031 { "Field 3", "sna.nlp.thdr.optional.22.field3",
3032 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3034 { &hf_sna_nlp_opti_22_field4,
3035 { "Field 4", "sna.nlp.thdr.optional.22.field4",
3036 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3038 { &hf_sna_rh,
3039 { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3040 NULL, 0x0, NULL, HFILL }},
3042 { &hf_sna_rh_0,
3043 { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3044 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3046 { &hf_sna_rh_1,
3047 { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3048 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3050 { &hf_sna_rh_2,
3051 { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3052 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3054 { &hf_sna_rh_rri,
3055 { "Request/Response Indicator", "sna.rh.rri", FT_BOOLEAN,
3056 8, TFS(&tfs_response_request), 0x80, NULL, HFILL }},
3058 { &hf_sna_rh_ru_category,
3059 { "Request/Response Unit Category", "sna.rh.ru_category",
3060 FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3061 NULL, HFILL }},
3063 { &hf_sna_rh_fi,
3064 { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3065 TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3067 { &hf_sna_rh_sdi,
3068 { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3069 TFS(&tfs_included_not_included), 0x04, NULL, HFILL }},
3071 { &hf_sna_rh_bci,
3072 { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3073 TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3075 { &hf_sna_rh_eci,
3076 { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3077 TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3079 { &hf_sna_rh_dr1,
3080 { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3081 8, NULL, 0x80, NULL, HFILL }},
3083 { &hf_sna_rh_lcci,
3084 { "Length-Checked Compression Indicator", "sna.rh.lcci",
3085 FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3087 { &hf_sna_rh_dr2,
3088 { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3089 8, NULL, 0x20, NULL, HFILL }},
3091 { &hf_sna_rh_eri,
3092 { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3093 8, NULL, 0x10, NULL, HFILL }},
3095 { &hf_sna_rh_rti,
3096 { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3097 8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3099 { &hf_sna_rh_rlwi,
3100 { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3101 8, NULL, 0x04, NULL, HFILL }},
3103 { &hf_sna_rh_qri,
3104 { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3105 8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3107 { &hf_sna_rh_pi,
3108 { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3109 8, NULL, 0x01, NULL, HFILL }},
3111 { &hf_sna_rh_bbi,
3112 { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3113 8, NULL, 0x80, NULL, HFILL }},
3115 { &hf_sna_rh_ebi,
3116 { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3117 8, NULL, 0x40, NULL, HFILL }},
3119 { &hf_sna_rh_cdi,
3120 { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3121 8, NULL, 0x20, NULL, HFILL }},
3123 { &hf_sna_rh_csi,
3124 { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3125 VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3127 { &hf_sna_rh_edi,
3128 { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3129 NULL, 0x04, NULL, HFILL }},
3131 { &hf_sna_rh_pdi,
3132 { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3133 0x02, NULL, HFILL }},
3135 { &hf_sna_rh_cebi,
3136 { "Conditional End Bracket Indicator", "sna.rh.cebi",
3137 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3139 /* { &hf_sna_ru,
3140 { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3141 NULL, 0x0, NULL, HFILL }},*/
3143 { &hf_sna_gds,
3144 { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3145 NULL, HFILL }},
3147 { &hf_sna_gds_len,
3148 { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3149 NULL, 0x7fff, NULL, HFILL }},
3151 { &hf_sna_gds_cont,
3152 { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3153 0x8000, NULL, HFILL }},
3155 { &hf_sna_gds_type,
3156 { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3157 VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3159 { &hf_sna_gds_info,
3160 { "Information", "sna.gds.info", FT_BYTES, BASE_NONE,
3161 NULL, 0x0, NULL, HFILL }},
3163 #if 0
3164 { &hf_sna_xid,
3165 { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3166 "XID Frame", HFILL }},
3167 #endif
3169 { &hf_sna_xid_0,
3170 { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3171 NULL, HFILL }},
3173 { &hf_sna_xid_format,
3174 { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3175 0xf0, NULL, HFILL }},
3177 { &hf_sna_xid_type,
3178 { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3179 VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3181 { &hf_sna_xid_len,
3182 { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3183 NULL, HFILL }},
3185 { &hf_sna_xid_id,
3186 { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3187 NULL, 0x0, NULL, HFILL }},
3189 { &hf_sna_xid_idblock,
3190 { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3191 0xfff00000, NULL, HFILL }},
3193 { &hf_sna_xid_idnum,
3194 { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3195 0x0fffff, NULL, HFILL }},
3197 { &hf_sna_xid_3_8,
3198 { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3199 BASE_HEX, NULL, 0x0, NULL, HFILL }},
3201 { &hf_sna_xid_3_init_self,
3202 { "INIT-SELF support", "sna.xid.type3.initself",
3203 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3205 { &hf_sna_xid_3_stand_bind,
3206 { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3207 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3209 { &hf_sna_xid_3_gener_bind,
3210 { "Whole BIND PIU generated indicator",
3211 "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3212 NULL, HFILL }},
3214 { &hf_sna_xid_3_recve_bind,
3215 { "Whole BIND PIU required indicator",
3216 "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3217 NULL, HFILL }},
3219 { &hf_sna_xid_3_actpu,
3220 { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3221 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3223 { &hf_sna_xid_3_nwnode,
3224 { "Sender is network node", "sna.xid.type3.nwnode",
3225 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3227 { &hf_sna_xid_3_cp,
3228 { "Control Point Services", "sna.xid.type3.cp",
3229 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3231 { &hf_sna_xid_3_cpcp,
3232 { "CP-CP session support", "sna.xid.type3.cpcp",
3233 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3235 { &hf_sna_xid_3_state,
3236 { "XID exchange state indicator", "sna.xid.type3.state",
3237 FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3238 0x000c, NULL, HFILL }},
3240 { &hf_sna_xid_3_nonact,
3241 { "Nonactivation Exchange", "sna.xid.type3.nonact",
3242 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3244 { &hf_sna_xid_3_cpchange,
3245 { "CP name change support", "sna.xid.type3.cpchange",
3246 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3248 { &hf_sna_xid_3_10,
3249 { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3250 NULL, 0x0, NULL, HFILL }},
3252 { &hf_sna_xid_3_asend_bind,
3253 { "Adaptive BIND pacing support as sender",
3254 "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3255 NULL, HFILL }},
3257 { &hf_sna_xid_3_arecv_bind,
3258 { "Adaptive BIND pacing support as receiver",
3259 "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3260 NULL, HFILL }},
3262 { &hf_sna_xid_3_quiesce,
3263 { "Quiesce TG Request",
3264 "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3265 NULL, HFILL }},
3267 { &hf_sna_xid_3_pucap,
3268 { "PU Capabilities",
3269 "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3270 NULL, HFILL }},
3272 { &hf_sna_xid_3_pbn,
3273 { "Peripheral Border Node",
3274 "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3275 NULL, HFILL }},
3277 { &hf_sna_xid_3_pacing,
3278 { "Qualifier for adaptive BIND pacing support",
3279 "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3280 NULL, HFILL }},
3282 { &hf_sna_xid_3_11,
3283 { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3284 NULL, 0x0, NULL, HFILL }},
3286 { &hf_sna_xid_3_tgshare,
3287 { "TG Sharing Prohibited Indicator",
3288 "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3289 NULL, HFILL }},
3291 { &hf_sna_xid_3_dedsvc,
3292 { "Dedicated SVC Indicator",
3293 "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3294 NULL, HFILL }},
3296 { &hf_sna_xid_3_12,
3297 { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3298 NULL, 0x0, NULL, HFILL }},
3300 { &hf_sna_xid_3_negcsup,
3301 { "Negotiation Complete Supported",
3302 "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3303 NULL, HFILL }},
3305 { &hf_sna_xid_3_negcomp,
3306 { "Negotiation Complete",
3307 "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3308 NULL, HFILL }},
3310 { &hf_sna_xid_3_15,
3311 { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3312 NULL, 0x0, NULL, HFILL }},
3314 { &hf_sna_xid_3_partg,
3315 { "Parallel TG Support",
3316 "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3317 NULL, HFILL }},
3319 { &hf_sna_xid_3_dlur,
3320 { "Dependent LU Requester Indicator",
3321 "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3322 NULL, HFILL }},
3324 { &hf_sna_xid_3_dlus,
3325 { "DLUS Served LU Registration Indicator",
3326 "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3327 NULL, HFILL }},
3329 { &hf_sna_xid_3_exbn,
3330 { "Extended HPR Border Node",
3331 "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3332 NULL, HFILL }},
3334 { &hf_sna_xid_3_genodai,
3335 { "Generalized ODAI Usage Option",
3336 "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3337 NULL, HFILL }},
3339 { &hf_sna_xid_3_branch,
3340 { "Branch Indicator", "sna.xid.type3.branch",
3341 FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3342 0x06, NULL, HFILL }},
3344 { &hf_sna_xid_3_brnn,
3345 { "Option Set 1123 Indicator",
3346 "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3347 NULL, HFILL }},
3349 { &hf_sna_xid_3_tg,
3350 { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3351 NULL, HFILL }},
3353 { &hf_sna_xid_3_dlc,
3354 { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3355 NULL, HFILL }},
3357 { &hf_sna_xid_3_dlen,
3358 { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3359 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3361 { &hf_sna_control_len,
3362 { "Control Vector Length", "sna.control.len",
3363 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3365 { &hf_sna_control_key,
3366 { "Control Vector Key", "sna.control.key",
3367 FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3368 HFILL }},
3370 { &hf_sna_control_hprkey,
3371 { "Control Vector HPR Key", "sna.control.hprkey",
3372 FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3373 HFILL }},
3375 { &hf_sna_control_05_delay,
3376 { "Channel Delay", "sna.control.05.delay",
3377 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3379 { &hf_sna_control_05_type,
3380 { "Network Address Type", "sna.control.05.type",
3381 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3383 { &hf_sna_control_05_ptp,
3384 { "Point-to-point", "sna.control.05.ptp",
3385 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3387 { &hf_sna_control_0e_type,
3388 { "Type", "sna.control.0e.type",
3389 FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3390 0, NULL, HFILL }},
3392 { &hf_sna_control_0e_value,
3393 { "Value", "sna.control.0e.value",
3394 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3396 { &hf_sna_padding,
3397 { "Padding", "sna.padding",
3398 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3400 { &hf_sna_reserved,
3401 { "Reserved", "sna.reserved",
3402 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3404 { &hf_sna_biu_segment_data,
3405 { "BIU segment data", "sna.biu_segment_data",
3406 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3409 static int *ett[] = {
3410 &ett_sna,
3411 &ett_sna_th,
3412 &ett_sna_th_fid,
3413 &ett_sna_nlp_nhdr,
3414 &ett_sna_nlp_nhdr_0,
3415 &ett_sna_nlp_nhdr_1,
3416 &ett_sna_nlp_thdr,
3417 &ett_sna_nlp_thdr_8,
3418 &ett_sna_nlp_thdr_9,
3419 &ett_sna_nlp_opti_un,
3420 &ett_sna_nlp_opti_0d,
3421 &ett_sna_nlp_opti_0d_4,
3422 &ett_sna_nlp_opti_0e,
3423 &ett_sna_nlp_opti_0e_stat,
3424 &ett_sna_nlp_opti_0e_absp,
3425 &ett_sna_nlp_opti_0f,
3426 &ett_sna_nlp_opti_10,
3427 &ett_sna_nlp_opti_12,
3428 &ett_sna_nlp_opti_14,
3429 &ett_sna_nlp_opti_14_si,
3430 &ett_sna_nlp_opti_14_si_2,
3431 &ett_sna_nlp_opti_14_rr,
3432 &ett_sna_nlp_opti_14_rr_2,
3433 &ett_sna_nlp_opti_22,
3434 &ett_sna_nlp_opti_22_2,
3435 &ett_sna_nlp_opti_22_3,
3436 &ett_sna_rh,
3437 &ett_sna_rh_0,
3438 &ett_sna_rh_1,
3439 &ett_sna_rh_2,
3440 &ett_sna_gds,
3441 &ett_sna_xid_0,
3442 &ett_sna_xid_id,
3443 &ett_sna_xid_3_8,
3444 &ett_sna_xid_3_10,
3445 &ett_sna_xid_3_11,
3446 &ett_sna_xid_3_12,
3447 &ett_sna_xid_3_15,
3448 &ett_sna_control_un,
3449 &ett_sna_control_05,
3450 &ett_sna_control_05hpr,
3451 &ett_sna_control_05hpr_type,
3452 &ett_sna_control_0e,
3454 module_t *sna_module;
3456 proto_sna = proto_register_protocol("Systems Network Architecture", "SNA", "sna");
3457 proto_register_field_array(proto_sna, hf, array_length(hf));
3458 proto_register_subtree_array(ett, array_length(ett));
3459 sna_handle = register_dissector("sna", dissect_sna, proto_sna);
3461 proto_sna_xid = proto_register_protocol("Systems Network Architecture XID", "SNA XID", "sna_xid");
3462 sna_xid_handle = register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3464 sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL, NULL, NULL, NULL);
3466 /* Register configuration options */
3467 sna_module = prefs_register_protocol(proto_sna, NULL);
3468 prefs_register_bool_preference(sna_module, "defragment",
3469 "Reassemble fragmented BIUs",
3470 "Whether fragmented BIUs should be reassembled",
3471 &sna_defragment);
3473 reassembly_table_register(&sna_reassembly_table,
3474 &addresses_reassembly_table_functions);
3477 void
3478 proto_reg_handoff_sna(void)
3480 dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3481 dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3482 dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3483 dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3484 dissector_add_uint("llc.dsap", SAP_SNA4, sna_handle);
3485 dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3486 dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3487 dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3488 dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3489 /* RFC 2043 */
3490 dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3494 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3496 * Local variables:
3497 * c-basic-offset: 8
3498 * tab-width: 8
3499 * indent-tabs-mode: t
3500 * End:
3502 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
3503 * :indentSize=8:tabSize=8:noTabs=false: