Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-sna.c
Line
Count
Source
1
/* packet-sna.c
2
 * Routines for SNA
3
 * Gilbert Ramirez <gram@alumni.rice.edu>
4
 * Jochen Friedrich <jochen@scram.de>
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
#include "config.h"
14
15
#include <epan/packet.h>
16
#include <epan/address_types.h>
17
#include <epan/prefs.h>
18
#include <epan/reassemble.h>
19
#include <epan/to_str.h>
20
#include <epan/tfs.h>
21
#include <wsutil/array.h>
22
#include "wsutil/pint.h"
23
#include "packet-ppp.h"
24
#include "packet-llc.h"
25
26
/*
27
 * See:
28
 *
29
 * http://web.archive.org/web/20020206033700/http://www.wanresources.com/snacell.html
30
 *
31
 * http://web.archive.org/web/20150522015710/http://www.protocols.com/pbook/sna.htm
32
 *
33
 * Systems Network Architecture Formats, GA27-3136-20:
34
 * https://publibfp.dhe.ibm.com/epubs/pdf/d50a5007.pdf
35
 *
36
 * Systems Network Architecture Management Services Formats, GC31-8302-03:
37
 * https://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/d50x4002/CCONTENTS
38
 */
39
void proto_register_sna(void);
40
void proto_reg_handoff_sna(void);
41
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;
92
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;
170
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;*/
197
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;
203
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;
248
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;
260
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;
304
305
static dissector_handle_t sna_handle;
306
static dissector_handle_t sna_xid_handle;
307
308
static int sna_address_type = -1;
309
310
/* Defragment fragmented SNA BIUs*/
311
static bool sna_defragment = true;
312
static reassembly_table sna_reassembly_table;
313
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 }
328
};
329
330
/* Mapping Field */
331
14
#define MPF_MIDDLE_SEGMENT  0
332
699
#define MPF_LAST_SEGMENT    1
333
111
#define MPF_FIRST_SEGMENT   2
334
597
#define MPF_WHOLE_BIU       3
335
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 }
342
};
343
344
/* Expedited Flow Indicator */
345
static const value_string sna_th_efi_vals[] = {
346
  { 0, "Normal Flow" },
347
  { 1, "Expedited Flow" },
348
  { 0x0,  NULL }
349
};
350
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 }
358
};
359
360
/* Format Indicator */
361
static const true_false_string sna_rh_fi_truth =
362
  { "FM Header", "No FM Header" };
363
364
/* Begin Chain Indicator */
365
static const true_false_string sna_rh_bci_truth =
366
  { "First in Chain", "Not First in Chain" };
367
368
/* End Chain Indicator */
369
static const true_false_string sna_rh_eci_truth =
370
  { "Last in Chain", "Not Last in Chain" };
371
372
/* Lengith-Checked Compression Indicator */
373
static const true_false_string sna_rh_lcci_truth =
374
  { "Compressed", "Not Compressed" };
375
376
/* Response Type Indicator */
377
static const true_false_string sna_rh_rti_truth =
378
  { "Negative", "Positive" };
379
380
/* Queued Response Indicator */
381
static const true_false_string sna_rh_qri_truth =
382
  { "Enqueue response in TC queues", "Response bypasses TC queues" };
383
384
/* Code Selection Indicator */
385
static const value_string sna_rh_csi_vals[] = {
386
  { 0, "EBCDIC" },
387
  { 1, "ASCII" },
388
  { 0x0,  NULL }
389
};
390
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 }
396
};
397
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 }
404
};
405
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 }
411
};
412
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 }
418
};
419
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 }
427
};
428
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 }
436
};
437
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 }
443
};
444
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 }
452
};
453
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 }
459
};
460
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" };
464
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 }
471
};
472
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",
477
};
478
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",
483
};
484
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 }
490
};
491
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",
496
};
497
498
/* Switching Mode */
499
static const value_string sna_nlp_sm_vals[] = {
500
  { 5, "Function routing" },
501
  { 6, "Automatic network routing" },
502
  { 0x0,  NULL }
503
};
504
505
static const true_false_string sna_nlp_tspi_truth =
506
  { "Time sensitive", "Not time sensitive" };
507
508
static const true_false_string sna_nlp_slowdn1_truth =
509
  { "Minor congestion", "No minor congestion" };
510
511
static const true_false_string sna_nlp_slowdn2_truth =
512
  { "Major congestion", "No major congestion" };
513
514
/* Function Type */
515
static const value_string sna_nlp_ft_vals[] = {
516
  { 0x10, "LDLC" },
517
  { 0x0,  NULL }
518
};
519
520
static const value_string sna_nlp_frh_vals[] = {
521
  { 0x03, "XID complete request" },
522
  { 0x04, "XID complete response" },
523
  { 0x0,  NULL }
524
};
525
526
static const true_false_string sna_nlp_setupi_truth =
527
  { "Connection setup segment present", "Connection setup segment not"
528
      " present" };
529
530
static const true_false_string sna_nlp_somi_truth =
531
  { "Start of message", "Not start of message" };
532
533
static const true_false_string sna_nlp_eomi_truth =
534
  { "End of message", "Not end of message" };
535
536
static const true_false_string sna_nlp_sri_truth =
537
  { "Status requested", "No status requested" };
538
539
static const true_false_string sna_nlp_rasapi_truth =
540
  { "Reply as soon as possible", "No need to reply as soon as possible" };
541
542
static const true_false_string sna_nlp_retryi_truth =
543
  { "Undefined", "Sender will retransmit" };
544
545
static const true_false_string sna_nlp_lmi_truth =
546
  { "Last message", "Not last message" };
547
548
static const true_false_string sna_nlp_cqfi_truth =
549
  { "CQFI included", "CQFI not included" };
550
551
static const true_false_string sna_nlp_osi_truth =
552
  { "Optional segments present", "No optional segments present" };
553
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 }
560
};
561
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 }
568
};
569
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 }
576
};
577
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 }
587
};
588
589
static const value_string sna_nlp_opti_0d_version_vals[] = {
590
  { 0x0101, "Version 1.1" },
591
  { 0x0, NULL }
592
};
593
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 }
599
};
600
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 }
607
};
608
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 }
616
};
617
618
static const value_string sna_nlp_opti_22_arb_vals[] = {
619
  { 0x00, "Base Mode ARB" },
620
  { 0x01, "Responsive Mode ARB" },
621
  { 0x0, NULL }
622
};
623
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 }
662
};
663
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 }
766
};
767
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 }
773
};
774
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 }
786
};
787
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
794
};
795
796
enum parse {
797
  LT,
798
  KL
799
};
800
801
/*
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.
805
 */
806
124
#define SNA_FID_TYPE_4_ADDR_LEN 6
807
struct sna_fid_type_4_addr {
808
  uint32_t  saf;
809
  uint16_t  ef;
810
};
811
812
typedef enum next_dissection_enum next_dissection_t;
813
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);
820
821
static int sna_fid_to_str_buf(const address *addr, char *buf, int buf_len _U_)
822
25
{
823
25
  const uint8_t *addrdata;
824
25
  struct sna_fid_type_4_addr sna_fid_type_4_addr;
825
25
  char *bufp = buf;
826
827
25
  switch (addr->len) {
828
829
14
  case 1:
830
14
    addrdata = (const uint8_t *)addr->data;
831
14
    word_to_hex(buf, addrdata[0]);
832
14
    buf[4] = '\0';
833
14
    break;
834
835
6
  case 2:
836
6
    addrdata = (const uint8_t *)addr->data;
837
6
    word_to_hex(buf, pntohu16(&addrdata[0]));
838
6
    buf[4] = '\0';
839
6
    break;
840
841
5
  case SNA_FID_TYPE_4_ADDR_LEN:
842
    /* FID Type 4 */
843
5
    memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
844
845
5
    bufp = dword_to_hex(bufp, sna_fid_type_4_addr.saf);
846
5
    *bufp++ = '.';
847
5
    bufp = word_to_hex(bufp, sna_fid_type_4_addr.ef);
848
5
    *bufp++ = '\0'; /* NULL terminate */
849
5
    break;
850
0
  default:
851
0
    buf[0] = '\0';
852
0
    return 1;
853
25
  }
854
855
25
  return (int)strlen(buf)+1;
856
25
}
857
858
859
static int sna_address_str_len(const address* addr _U_)
860
25
{
861
  /* We could do this based on address length, but 14 bytes isn't THAT much space */
862
25
  return 14;
863
25
}
864
865
866
/* --------------------------------------------------------------------
867
 * Chapter 2 High-Performance Routing (HPR) Headers
868
 * --------------------------------------------------------------------
869
 */
870
871
static void
872
dissect_optional_0d(tvbuff_t *tvb, proto_tree *tree)
873
53
{
874
53
  int   offset, len, pad;
875
53
  static int * const fields[] = {
876
53
    &hf_sna_nlp_opti_0d_target,
877
53
    &hf_sna_nlp_opti_0d_arb,
878
53
    &hf_sna_nlp_opti_0d_reliable,
879
53
    &hf_sna_nlp_opti_0d_dedicated,
880
53
    NULL
881
53
  };
882
883
53
  if (!tree)
884
0
    return;
885
886
53
  proto_tree_add_item(tree, hf_sna_nlp_opti_0d_version, tvb, 2, 2, ENC_BIG_ENDIAN);
887
888
53
  proto_tree_add_bitmask(tree, tvb, 4, hf_sna_nlp_opti_0d_4,
889
53
             ett_sna_nlp_opti_0d_4, fields, ENC_NA);
890
891
53
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 5, 3, ENC_NA);
892
893
53
  offset = 8;
894
895
248
  while (tvb_offset_exists(tvb, offset)) {
896
219
    len = tvb_get_uint8(tvb, offset+0);
897
219
    if (len) {
898
195
      dissect_sna_control(tvb, offset, len, tree, 1, LT);
899
195
      pad = (len+3) & 0xfffc;
900
195
      if (pad > len)
901
148
        proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
902
195
      offset += pad;
903
195
    } else {
904
      /* Avoid endless loop */
905
24
      return;
906
24
    }
907
219
  }
908
53
}
909
910
static void
911
dissect_optional_0e(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
912
9
{
913
9
  int   bits, offset;
914
9
  static int * const fields[] = {
915
9
    &hf_sna_nlp_opti_0e_gap,
916
9
    &hf_sna_nlp_opti_0e_idle,
917
9
    NULL
918
9
  };
919
920
9
  bits = tvb_get_uint8(tvb, 2);
921
9
  offset = 20;
922
923
9
  proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_0e_stat,
924
9
          ett_sna_nlp_opti_0e_stat, fields, ENC_NA);
925
926
9
  proto_tree_add_item(tree, hf_sna_nlp_opti_0e_nabsp,
927
9
    tvb, 3, 1, ENC_BIG_ENDIAN);
928
9
  proto_tree_add_item(tree, hf_sna_nlp_opti_0e_sync,
929
9
    tvb, 4, 2, ENC_BIG_ENDIAN);
930
9
  proto_tree_add_item(tree, hf_sna_nlp_opti_0e_echo,
931
9
    tvb, 6, 2, ENC_BIG_ENDIAN);
932
9
  proto_tree_add_item(tree, hf_sna_nlp_opti_0e_rseq,
933
9
    tvb, 8, 4, ENC_BIG_ENDIAN);
934
9
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 12, 8, ENC_NA);
935
936
9
  if (tvb_offset_exists(tvb, offset))
937
8
    call_data_dissector(tvb_new_subset_remaining(tvb, 4), pinfo, tree);
938
939
9
  if (bits & 0x40) {
940
2
    col_set_str(pinfo->cinfo, COL_INFO, "HPR Idle Message");
941
7
  } else {
942
7
    col_set_str(pinfo->cinfo, COL_INFO, "HPR Status Message");
943
7
  }
944
9
}
945
946
static void
947
dissect_optional_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
948
8
{
949
8
  proto_tree_add_item(tree, hf_sna_nlp_opti_0f_bits, tvb, 2, 2, ENC_BIG_ENDIAN);
950
8
  if (tvb_offset_exists(tvb, 4))
951
8
    call_data_dissector(tvb_new_subset_remaining(tvb, 4), pinfo, tree);
952
8
}
953
954
static void
955
dissect_optional_10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
956
4
{
957
4
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
958
4
  proto_tree_add_item(tree, hf_sna_nlp_opti_10_tcid, tvb, 4, 8, ENC_NA);
959
4
  if (tvb_offset_exists(tvb, 12))
960
4
    call_data_dissector(tvb_new_subset_remaining(tvb, 12), pinfo, tree);
961
4
}
962
963
static void
964
dissect_optional_12(tvbuff_t *tvb, proto_tree *tree)
965
5
{
966
5
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
967
5
  proto_tree_add_item(tree, hf_sna_nlp_opti_12_sense, tvb, 4, -1, ENC_NA);
968
5
}
969
970
static void
971
dissect_optional_14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
972
6
{
973
6
  proto_tree  *sub_tree;
974
6
  int   len, pad, type, offset, num, sublen;
975
6
  static int * const opti_14_si_fields[] = {
976
6
    &hf_sna_nlp_opti_14_si_refifo,
977
6
    &hf_sna_nlp_opti_14_si_mobility,
978
6
    &hf_sna_nlp_opti_14_si_dirsearch,
979
6
    &hf_sna_nlp_opti_14_si_limitres,
980
6
    &hf_sna_nlp_opti_14_si_ncescope,
981
6
    &hf_sna_nlp_opti_14_si_mnpsrscv,
982
6
    NULL
983
6
  };
984
6
  static int * const opti_14_rr_fields[] = {
985
6
    &hf_sna_nlp_opti_14_rr_bfe,
986
6
    NULL
987
6
  };
988
989
6
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 2, 2, ENC_NA);
990
991
6
  offset = 4;
992
993
6
  len = tvb_get_uint8(tvb, offset);
994
6
  type = tvb_get_uint8(tvb, offset+1);
995
996
6
  if ((type != 0x83) || (len <= 16)) {
997
    /* Invalid */
998
5
    call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
999
5
    return;
1000
5
  }
1001
1
  sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1002
1
      ett_sna_nlp_opti_14_si, NULL, "Switching Information Control Vector");
1003
1004
1
  proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_len,
1005
1
      tvb, offset, 1, len);
1006
1
  proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_si_key,
1007
1
      tvb, offset+1, 1, type);
1008
1009
1
  proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_si_2,
1010
1
             ett_sna_nlp_opti_14_si_2, opti_14_si_fields, ENC_NA);
1011
1012
1
  proto_tree_add_item(sub_tree, hf_sna_reserved, tvb, offset+3, 1, ENC_NA);
1013
1
  proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_maxpsize,
1014
1
      tvb, offset+4, 4, ENC_BIG_ENDIAN);
1015
1
  proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_switch,
1016
1
      tvb, offset+8, 4, ENC_BIG_ENDIAN);
1017
1
  proto_tree_add_item(sub_tree, hf_sna_nlp_opti_14_si_alive,
1018
1
      tvb, offset+12, 4, ENC_BIG_ENDIAN);
1019
1020
1
  dissect_sna_control(tvb, offset+16, len-16, sub_tree, 1, LT);
1021
1022
1
  pad = (len+3) & 0xfffc;
1023
1
  if (pad > len)
1024
1
    proto_tree_add_item(sub_tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
1025
1
  offset += pad;
1026
1027
1
  len = tvb_get_uint8(tvb, offset);
1028
1
  type = tvb_get_uint8(tvb, offset+1);
1029
1030
1
  if ((type != 0x85) || ( len < 4))  {
1031
    /* Invalid */
1032
1
    call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1033
1
    return;
1034
1
  }
1035
0
  sub_tree = proto_tree_add_subtree(tree, tvb, offset, len,
1036
0
      ett_sna_nlp_opti_14_rr, NULL, "Return Route TG Descriptor Control Vector");
1037
1038
0
  proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_len,
1039
0
      tvb, offset, 1, len);
1040
0
  proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_key,
1041
0
      tvb, offset+1, 1, type);
1042
1043
0
  proto_tree_add_bitmask(tree, tvb, offset+2, hf_sna_nlp_opti_14_rr_2,
1044
0
             ett_sna_nlp_opti_14_rr_2, opti_14_rr_fields, ENC_NA);
1045
1046
0
  num = tvb_get_uint8(tvb, offset+3);
1047
1048
0
  proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_14_rr_num,
1049
0
      tvb, offset+3, 1, num);
1050
1051
0
  offset += 4;
1052
1053
0
  while (num) {
1054
0
    sublen = tvb_get_uint8(tvb, offset);
1055
0
    if (sublen) {
1056
0
      dissect_sna_control(tvb, offset, sublen, sub_tree, 1, LT);
1057
0
    } else {
1058
      /* Invalid */
1059
0
      call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1060
0
      return;
1061
0
    }
1062
    /* No padding here */
1063
0
    offset += sublen;
1064
0
    num--;
1065
0
  }
1066
0
}
1067
1068
static void
1069
dissect_optional_22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1070
5
{
1071
5
  int   bits, type;
1072
5
  static int * const opti_22_2_fields[] = {
1073
5
    &hf_sna_nlp_opti_22_type,
1074
5
    &hf_sna_nlp_opti_22_raa,
1075
5
    &hf_sna_nlp_opti_22_parity,
1076
5
    &hf_sna_nlp_opti_22_arb,
1077
5
    NULL
1078
5
  };
1079
5
  static int * const opti_22_3_fields[] = {
1080
5
    &hf_sna_nlp_opti_22_ratereq,
1081
5
    &hf_sna_nlp_opti_22_raterep,
1082
5
    NULL
1083
5
  };
1084
1085
5
  bits = tvb_get_uint8(tvb, 2);
1086
5
  type = (bits & 0xc0) >> 6;
1087
1088
5
  proto_tree_add_bitmask(tree, tvb, 2, hf_sna_nlp_opti_22_2,
1089
5
             ett_sna_nlp_opti_22_2, opti_22_2_fields, ENC_NA);
1090
1091
5
  proto_tree_add_bitmask(tree, tvb, 3, hf_sna_nlp_opti_22_3,
1092
5
             ett_sna_nlp_opti_22_3, opti_22_3_fields, ENC_NA);
1093
1094
5
  proto_tree_add_item(tree, hf_sna_nlp_opti_22_field1,
1095
5
      tvb, 4, 4, ENC_BIG_ENDIAN);
1096
5
  proto_tree_add_item(tree, hf_sna_nlp_opti_22_field2,
1097
5
      tvb, 8, 4, ENC_BIG_ENDIAN);
1098
1099
5
  if (type == 0) {
1100
4
    proto_tree_add_item(tree, hf_sna_nlp_opti_22_field3,
1101
4
        tvb, 12, 4, ENC_BIG_ENDIAN);
1102
4
    proto_tree_add_item(tree, hf_sna_nlp_opti_22_field4,
1103
4
        tvb, 16, 4, ENC_BIG_ENDIAN);
1104
1105
4
    if (tvb_offset_exists(tvb, 20))
1106
4
      call_data_dissector(tvb_new_subset_remaining(tvb, 20), pinfo, tree);
1107
4
  } else {
1108
1
    if (tvb_offset_exists(tvb, 12))
1109
1
      call_data_dissector(tvb_new_subset_remaining(tvb, 12), pinfo, tree);
1110
1
  }
1111
5
}
1112
1113
static void
1114
dissect_optional(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1115
119
{
1116
119
  proto_tree  *sub_tree;
1117
119
  int   offset, type, len;
1118
119
  int   ett;
1119
1120
119
  sub_tree = NULL;
1121
1122
119
  offset = 0;
1123
1124
311
  while (tvb_offset_exists(tvb, offset)) {
1125
225
    len = tvb_get_uint8(tvb, offset);
1126
225
    type = tvb_get_uint8(tvb, offset+1);
1127
1128
    /* Prevent loop for invalid crap in packet */
1129
225
    if (len == 0) {
1130
15
      call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
1131
15
      return;
1132
15
    }
1133
1134
210
    ett = ett_sna_nlp_opti_un;
1135
210
    if(type == 0x0d) ett = ett_sna_nlp_opti_0d;
1136
210
    if(type == 0x0e) ett = ett_sna_nlp_opti_0e;
1137
210
    if(type == 0x0f) ett = ett_sna_nlp_opti_0f;
1138
210
    if(type == 0x10) ett = ett_sna_nlp_opti_10;
1139
210
    if(type == 0x12) ett = ett_sna_nlp_opti_12;
1140
210
    if(type == 0x14) ett = ett_sna_nlp_opti_14;
1141
210
    if(type == 0x22) ett = ett_sna_nlp_opti_22;
1142
210
    if (tree) {
1143
209
      sub_tree = proto_tree_add_subtree(tree, tvb,
1144
209
          offset, len << 2, ett, NULL,
1145
209
          val_to_str_const(type, sna_nlp_opti_vals, "Unknown Segment Type"));
1146
209
      proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_len,
1147
209
          tvb, offset, 1, len);
1148
209
      proto_tree_add_uint(sub_tree, hf_sna_nlp_opti_type,
1149
209
          tvb, offset+1, 1, type);
1150
209
    }
1151
210
    switch(type) {
1152
53
      case 0x0d:
1153
53
        dissect_optional_0d(tvb_new_subset_length(tvb, offset,
1154
53
            len << 2), sub_tree);
1155
53
        break;
1156
9
      case 0x0e:
1157
9
        dissect_optional_0e(tvb_new_subset_length(tvb, offset,
1158
9
            len << 2), pinfo, sub_tree);
1159
9
        break;
1160
8
      case 0x0f:
1161
8
        dissect_optional_0f(tvb_new_subset_length(tvb, offset,
1162
8
            len << 2), pinfo, sub_tree);
1163
8
        break;
1164
4
      case 0x10:
1165
4
        dissect_optional_10(tvb_new_subset_length(tvb, offset,
1166
4
            len << 2), pinfo, sub_tree);
1167
4
        break;
1168
5
      case 0x12:
1169
5
        dissect_optional_12(tvb_new_subset_length(tvb, offset,
1170
5
            len << 2), sub_tree);
1171
5
        break;
1172
6
      case 0x14:
1173
6
        dissect_optional_14(tvb_new_subset_length(tvb, offset,
1174
6
            len << 2), pinfo, sub_tree);
1175
6
        break;
1176
5
      case 0x22:
1177
5
        dissect_optional_22(tvb_new_subset_length(tvb, offset,
1178
5
            len << 2), pinfo, sub_tree);
1179
5
        break;
1180
119
      default:
1181
119
        call_data_dissector(tvb_new_subset_length(tvb, offset,
1182
119
            len << 2), pinfo, sub_tree);
1183
210
    }
1184
192
    offset += (len << 2);
1185
192
  }
1186
119
}
1187
1188
static void
1189
dissect_nlp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1190
      proto_tree *parent_tree)
1191
221
{
1192
221
  proto_tree  *nlp_tree;
1193
221
  proto_item  *nlp_item;
1194
221
  uint8_t   nhdr_0, nhdr_1, nhdr_x, thdr_8, thdr_9, fid;
1195
221
  uint32_t    thdr_len, thdr_dlf;
1196
221
  uint16_t    subindx;
1197
221
  static int * const nlp_nhdr_0_fields[] = {
1198
221
    &hf_sna_nlp_sm,
1199
221
    &hf_sna_nlp_tpf,
1200
221
    NULL
1201
221
  };
1202
221
  static int * const nlp_nhdr_1_fields[] = {
1203
221
    &hf_sna_nlp_ft,
1204
221
    &hf_sna_nlp_tspi,
1205
221
    &hf_sna_nlp_slowdn1,
1206
221
    &hf_sna_nlp_slowdn2,
1207
221
    NULL
1208
221
  };
1209
221
  static int * const nlp_nhdr_8_fields[] = {
1210
221
    &hf_sna_nlp_setupi,
1211
221
    &hf_sna_nlp_somi,
1212
221
    &hf_sna_nlp_eomi,
1213
221
    &hf_sna_nlp_sri,
1214
221
    &hf_sna_nlp_rasapi,
1215
221
    &hf_sna_nlp_retryi,
1216
221
    NULL
1217
221
  };
1218
221
  static int * const nlp_nhdr_9_fields[] = {
1219
221
    &hf_sna_nlp_lmi,
1220
221
    &hf_sna_nlp_cqfi,
1221
221
    &hf_sna_nlp_osi,
1222
221
    NULL
1223
221
  };
1224
1225
221
  int indx = 0, counter = 0;
1226
1227
221
  nlp_tree = NULL;
1228
221
  nlp_item = NULL;
1229
1230
221
  nhdr_0 = tvb_get_uint8(tvb, indx);
1231
221
  nhdr_1 = tvb_get_uint8(tvb, indx+1);
1232
1233
221
  col_set_str(pinfo->cinfo, COL_INFO, "HPR NLP Packet");
1234
1235
221
  if (tree) {
1236
    /* Don't bother setting length. We'll set it later after we
1237
     * find the lengths of NHDR */
1238
221
    nlp_item = proto_tree_add_item(tree, hf_sna_nlp_nhdr, tvb,
1239
221
        indx, -1, ENC_NA);
1240
221
    nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_nhdr);
1241
1242
221
    proto_tree_add_bitmask(nlp_tree, tvb, indx, hf_sna_nlp_nhdr_0,
1243
221
             ett_sna_nlp_nhdr_0, nlp_nhdr_0_fields, ENC_NA);
1244
1245
221
    proto_tree_add_bitmask(nlp_tree, tvb, indx+1, hf_sna_nlp_nhdr_1,
1246
221
             ett_sna_nlp_nhdr_1, nlp_nhdr_1_fields, ENC_NA);
1247
221
  }
1248
  /* ANR or FR lists */
1249
1250
221
  indx += 2;
1251
221
  counter = 0;
1252
1253
221
  if ((nhdr_0 & 0xe0) == 0xa0) {
1254
1.96k
    do {
1255
1.96k
      nhdr_x = tvb_get_uint8(tvb, indx + counter);
1256
1.96k
      counter ++;
1257
1.96k
    } while (nhdr_x != 0xff);
1258
77
    proto_tree_add_item(nlp_tree,
1259
77
          hf_sna_nlp_fra, tvb, indx, counter, ENC_NA);
1260
77
    indx += counter;
1261
77
    proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1262
77
    indx++;
1263
1264
77
    if (tree)
1265
67
      proto_item_set_len(nlp_item, indx);
1266
1267
77
    if ((nhdr_1 & 0xf0) == 0x10) {
1268
6
      proto_tree_add_item(tree, hf_sna_nlp_frh,
1269
6
            tvb, indx, 1, ENC_BIG_ENDIAN);
1270
6
      indx ++;
1271
1272
6
      if (tvb_offset_exists(tvb, indx))
1273
4
        call_data_dissector(tvb_new_subset_remaining(tvb, indx),
1274
4
          pinfo, parent_tree);
1275
6
      return;
1276
6
    }
1277
77
  }
1278
215
  if ((nhdr_0 & 0xe0) == 0xc0) {
1279
4.60k
    do {
1280
4.60k
      nhdr_x = tvb_get_uint8(tvb, indx + counter);
1281
4.60k
      counter ++;
1282
4.60k
    } while (nhdr_x != 0xff);
1283
144
    proto_tree_add_item(nlp_tree, hf_sna_nlp_anr,
1284
144
          tvb, indx, counter, ENC_NA);
1285
144
    indx += counter;
1286
1287
144
    proto_tree_add_item(nlp_tree, hf_sna_reserved, tvb, indx, 1, ENC_NA);
1288
144
    indx++;
1289
1290
144
    if (tree)
1291
129
      proto_item_set_len(nlp_item, indx);
1292
144
  }
1293
1294
215
  thdr_8 = tvb_get_uint8(tvb, indx+8);
1295
215
  thdr_9 = tvb_get_uint8(tvb, indx+9);
1296
215
  thdr_len = tvb_get_ntohs(tvb, indx+10);
1297
215
  thdr_dlf = tvb_get_ntohl(tvb, indx+12);
1298
1299
215
  if (tree) {
1300
183
    nlp_item = proto_tree_add_item(tree, hf_sna_nlp_thdr, tvb,
1301
183
        indx, thdr_len << 2, ENC_NA);
1302
183
    nlp_tree = proto_item_add_subtree(nlp_item, ett_sna_nlp_thdr);
1303
1304
183
    proto_tree_add_item(nlp_tree, hf_sna_nlp_tcid, tvb,
1305
183
        indx, 8, ENC_NA);
1306
1307
183
    proto_tree_add_bitmask(nlp_tree, tvb, indx+8, hf_sna_nlp_thdr_8,
1308
183
             ett_sna_nlp_thdr_8, nlp_nhdr_8_fields, ENC_NA);
1309
1310
183
    proto_tree_add_bitmask(nlp_tree, tvb, indx+9, hf_sna_nlp_thdr_9,
1311
183
             ett_sna_nlp_thdr_9, nlp_nhdr_9_fields, ENC_NA);
1312
1313
183
    proto_tree_add_uint(nlp_tree, hf_sna_nlp_offset, tvb, indx+10,
1314
183
        2, thdr_len);
1315
183
    proto_tree_add_uint(nlp_tree, hf_sna_nlp_dlf, tvb, indx+12,
1316
183
        4, thdr_dlf);
1317
183
    proto_tree_add_item(nlp_tree, hf_sna_nlp_bsn, tvb, indx+16,
1318
183
        4, ENC_BIG_ENDIAN);
1319
183
  }
1320
215
  subindx = 20;
1321
1322
215
  if (((thdr_9 & 0x18) == 0x08) && ((thdr_len << 2) > subindx)) {
1323
24
    counter = tvb_get_uint8(tvb, indx + subindx);
1324
24
    if (tvb_get_uint8(tvb, indx+subindx+1) == 5)
1325
8
      dissect_sna_control(tvb, indx + subindx, counter+2, nlp_tree, 1, LT);
1326
16
    else
1327
16
      call_data_dissector(tvb_new_subset_length(tvb, indx + subindx, counter+2),
1328
16
          pinfo, nlp_tree);
1329
1330
24
    subindx += (counter+2);
1331
24
  }
1332
215
  if ((thdr_9 & 0x04) && ((thdr_len << 2) > subindx))
1333
123
    dissect_optional(
1334
123
        tvb_new_subset_length(tvb, indx + subindx,
1335
123
        (thdr_len << 2) - subindx),
1336
123
        pinfo, nlp_tree);
1337
1338
215
  indx += (thdr_len << 2);
1339
215
  if (((thdr_8 & 0x20) == 0) && thdr_dlf) {
1340
88
    col_set_str(pinfo->cinfo, COL_INFO, "HPR Fragment");
1341
88
    if (tvb_offset_exists(tvb, indx)) {
1342
11
      call_data_dissector(tvb_new_subset_remaining(tvb, indx), pinfo,
1343
11
          parent_tree);
1344
11
    }
1345
88
    return;
1346
88
  }
1347
127
  if (tvb_offset_exists(tvb, indx)) {
1348
    /* Transmission Header Format Identifier */
1349
19
    fid = hi_nibble(tvb_get_uint8(tvb, indx));
1350
19
    if (fid == 5) /* Only FID5 allowed for HPR */
1351
2
      dissect_fid(tvb_new_subset_remaining(tvb, indx), pinfo,
1352
2
          tree, parent_tree);
1353
17
    else {
1354
17
      if (tvb_get_ntohs(tvb, indx+2) == 0x12ce) {
1355
        /* Route Setup */
1356
0
        col_set_str(pinfo->cinfo, COL_INFO, "HPR Route Setup");
1357
0
        dissect_gds(tvb_new_subset_remaining(tvb, indx),
1358
0
            pinfo, tree, parent_tree);
1359
0
      } else
1360
17
        call_data_dissector(tvb_new_subset_remaining(tvb, indx),
1361
17
            pinfo, parent_tree);
1362
17
    }
1363
19
  }
1364
127
}
1365
1366
/* --------------------------------------------------------------------
1367
 * Chapter 3 Exchange Identification (XID) Information Fields
1368
 * --------------------------------------------------------------------
1369
 */
1370
1371
static void
1372
dissect_xid1(tvbuff_t *tvb, proto_tree *tree)
1373
3
{
1374
3
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1375
1376
3
}
1377
1378
static void
1379
dissect_xid2(tvbuff_t *tvb, proto_tree *tree)
1380
17
{
1381
17
  unsigned    dlen, offset;
1382
1383
17
  if (!tree)
1384
0
    return;
1385
1386
17
  dlen = tvb_get_uint8(tvb, 0);
1387
1388
17
  offset = dlen;
1389
1390
175
  while (tvb_offset_exists(tvb, offset)) {
1391
158
    dlen = tvb_get_uint8(tvb, offset+1);
1392
158
    dissect_sna_control(tvb, offset, dlen+2, tree, 0, KL);
1393
158
    offset += (dlen + 2);
1394
158
  }
1395
17
}
1396
1397
static void
1398
dissect_xid3(tvbuff_t *tvb, proto_tree *tree)
1399
29
{
1400
29
  unsigned    dlen, offset;
1401
29
  static int * const sna_xid_3_fields[] = {
1402
29
    &hf_sna_xid_3_init_self,
1403
29
    &hf_sna_xid_3_stand_bind,
1404
29
    &hf_sna_xid_3_gener_bind,
1405
29
    &hf_sna_xid_3_recve_bind,
1406
29
    &hf_sna_xid_3_actpu,
1407
29
    &hf_sna_xid_3_nwnode,
1408
29
    &hf_sna_xid_3_cp,
1409
29
    &hf_sna_xid_3_cpcp,
1410
29
    &hf_sna_xid_3_state,
1411
29
    &hf_sna_xid_3_nonact,
1412
29
    &hf_sna_xid_3_cpchange,
1413
29
    NULL
1414
29
  };
1415
29
  static int * const sna_xid_10_fields[] = {
1416
29
    &hf_sna_xid_3_asend_bind,
1417
29
    &hf_sna_xid_3_arecv_bind,
1418
29
    &hf_sna_xid_3_quiesce,
1419
29
    &hf_sna_xid_3_pucap,
1420
29
    &hf_sna_xid_3_pbn,
1421
29
    &hf_sna_xid_3_pacing,
1422
29
    NULL
1423
29
  };
1424
29
  static int * const sna_xid_11_fields[] = {
1425
29
    &hf_sna_xid_3_tgshare,
1426
29
    &hf_sna_xid_3_dedsvc,
1427
29
    NULL
1428
29
  };
1429
29
  static int * const sna_xid_12_fields[] = {
1430
29
    &hf_sna_xid_3_negcsup,
1431
29
    &hf_sna_xid_3_negcomp,
1432
29
    NULL
1433
29
  };
1434
29
  static int * const sna_xid_15_fields[] = {
1435
29
    &hf_sna_xid_3_partg,
1436
29
    &hf_sna_xid_3_dlur,
1437
29
    &hf_sna_xid_3_dlus,
1438
29
    &hf_sna_xid_3_exbn,
1439
29
    &hf_sna_xid_3_genodai,
1440
29
    &hf_sna_xid_3_branch,
1441
29
    &hf_sna_xid_3_brnn,
1442
29
    NULL
1443
29
  };
1444
1445
29
  if (!tree)
1446
0
    return;
1447
1448
29
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 0, 2, ENC_NA);
1449
1450
29
  proto_tree_add_bitmask(tree, tvb, 2, hf_sna_xid_3_8,
1451
29
             ett_sna_xid_3_8, sna_xid_3_fields, ENC_BIG_ENDIAN);
1452
1453
29
  proto_tree_add_bitmask(tree, tvb, 4, hf_sna_xid_3_10,
1454
29
             ett_sna_xid_3_10, sna_xid_10_fields, ENC_BIG_ENDIAN);
1455
1456
29
  proto_tree_add_bitmask(tree, tvb, 5, hf_sna_xid_3_11,
1457
29
             ett_sna_xid_3_11, sna_xid_11_fields, ENC_BIG_ENDIAN);
1458
1459
29
  proto_tree_add_bitmask(tree, tvb, 6, hf_sna_xid_3_12,
1460
29
             ett_sna_xid_3_12, sna_xid_12_fields, ENC_BIG_ENDIAN);
1461
1462
29
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 7, 2, ENC_NA);
1463
1464
29
  proto_tree_add_bitmask(tree, tvb, 9, hf_sna_xid_3_15,
1465
29
             ett_sna_xid_3_15, sna_xid_15_fields, ENC_BIG_ENDIAN);
1466
1467
29
  proto_tree_add_item(tree, hf_sna_xid_3_tg, tvb, 10, 1, ENC_BIG_ENDIAN);
1468
29
  proto_tree_add_item(tree, hf_sna_xid_3_dlc, tvb, 11, 1, ENC_BIG_ENDIAN);
1469
1470
29
  dlen = tvb_get_uint8(tvb, 12);
1471
1472
29
  proto_tree_add_uint(tree, hf_sna_xid_3_dlen, tvb, 12, 1, dlen);
1473
1474
  /* FIXME: DLC Dependent Data Go Here */
1475
1476
29
  offset = 12 + dlen;
1477
1478
295
  while (tvb_offset_exists(tvb, offset)) {
1479
266
    dlen = tvb_get_uint8(tvb, offset+1);
1480
266
    dissect_sna_control(tvb, offset, dlen+2, tree, 0, KL);
1481
266
    offset += (dlen+2);
1482
266
  }
1483
29
}
1484
1485
static void
1486
dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1487
      proto_tree *parent_tree)
1488
97
{
1489
97
  proto_tree  *sub_tree;
1490
97
  proto_item  *sub_ti = NULL;
1491
97
  int   format, type, len;
1492
97
  uint32_t    id;
1493
1494
97
  len = tvb_get_uint8(tvb, 1);
1495
97
  type = tvb_get_uint8(tvb, 0);
1496
97
  id = tvb_get_ntohl(tvb, 2);
1497
97
  format = hi_nibble(type);
1498
1499
  /* Summary information */
1500
97
  col_add_fstr(pinfo->cinfo, COL_INFO,
1501
97
        "SNA XID Format:%d Type:%s", format,
1502
97
        val_to_str_const(lo_nibble(type), sna_xid_type_vals,
1503
97
        "Unknown Type"));
1504
1505
97
  if (tree) {
1506
97
    sub_ti = proto_tree_add_item(tree, hf_sna_xid_0, tvb,
1507
97
        0, 1, ENC_BIG_ENDIAN);
1508
97
    sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_0);
1509
1510
97
    proto_tree_add_uint(sub_tree, hf_sna_xid_format, tvb, 0, 1,
1511
97
        type);
1512
97
    proto_tree_add_uint(sub_tree, hf_sna_xid_type, tvb, 0, 1,
1513
97
        type);
1514
1515
97
    proto_tree_add_uint(tree, hf_sna_xid_len, tvb, 1, 1, len);
1516
1517
97
    sub_ti = proto_tree_add_item(tree, hf_sna_xid_id, tvb,
1518
97
        2, 4, ENC_BIG_ENDIAN);
1519
97
    sub_tree = proto_item_add_subtree(sub_ti, ett_sna_xid_id);
1520
1521
97
    proto_tree_add_uint(sub_tree, hf_sna_xid_idblock, tvb, 2, 4,
1522
97
        id);
1523
97
    proto_tree_add_uint(sub_tree, hf_sna_xid_idnum, tvb, 2, 4,
1524
97
        id);
1525
1526
97
    switch(format) {
1527
2
      case 0:
1528
2
        break;
1529
3
      case 1:
1530
3
        dissect_xid1(tvb_new_subset_length(tvb, 6, len-6),
1531
3
            tree);
1532
3
        break;
1533
17
      case 2:
1534
17
        dissect_xid2(tvb_new_subset_length(tvb, 6, len-6),
1535
17
            tree);
1536
17
        break;
1537
29
      case 3:
1538
29
        dissect_xid3(tvb_new_subset_length(tvb, 6, len-6),
1539
29
            tree);
1540
29
        break;
1541
46
      default:
1542
        /* external standards organizations */
1543
46
        call_data_dissector(tvb_new_subset_length(tvb, 6, len-6),
1544
46
            pinfo, tree);
1545
97
    }
1546
97
  }
1547
1548
93
  if (format == 0)
1549
2
    len = 6;
1550
1551
93
  if (tvb_offset_exists(tvb, len))
1552
51
    call_data_dissector(tvb_new_subset_remaining(tvb, len), pinfo, parent_tree);
1553
93
}
1554
1555
/* --------------------------------------------------------------------
1556
 * Chapter 4 Transmission Headers (THs)
1557
 * --------------------------------------------------------------------
1558
 */
1559
1560
892
#define RH_LEN  3
1561
1562
static unsigned int
1563
mpf_value(uint8_t th_byte)
1564
292
{
1565
292
  return (th_byte & 0x0c) >> 2;
1566
292
}
1567
1568
111
#define FIRST_FRAG_NUMBER 0
1569
134
#define MIDDLE_FRAG_NUMBER  1
1570
151
#define LAST_FRAG_NUMBER  2
1571
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.
1580
 *
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.
1589
 *
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).
1593
 *
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.
1606
 */
1607
static tvbuff_t*
1608
defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf,
1609
           int id)
1610
289
{
1611
289
  fragment_head *fd_head;
1612
289
  int frag_number = -1;
1613
289
  bool more_frags = true;
1614
289
  tvbuff_t *rh_tvb = NULL;
1615
289
  int frag_len;
1616
1617
  /* Determine frag_number and more_frags */
1618
289
  switch(mpf) {
1619
13
    case MPF_WHOLE_BIU:
1620
      /* nothing */
1621
13
      break;
1622
111
    case MPF_FIRST_SEGMENT:
1623
111
      frag_number = FIRST_FRAG_NUMBER;
1624
111
      break;
1625
14
    case MPF_MIDDLE_SEGMENT:
1626
14
      frag_number = MIDDLE_FRAG_NUMBER;
1627
14
      break;
1628
151
    case MPF_LAST_SEGMENT:
1629
151
      frag_number = LAST_FRAG_NUMBER;
1630
151
      more_frags = false;
1631
151
      break;
1632
0
    default:
1633
0
      DISSECTOR_ASSERT_NOT_REACHED();
1634
289
  }
1635
1636
  /* If sna_defragment is on, and this is a fragment.. */
1637
289
  if (frag_number > -1) {
1638
    /* XXX - check length ??? */
1639
276
    frag_len = tvb_reported_length_remaining(tvb, offset);
1640
276
    if (tvb_bytes_exist(tvb, offset, frag_len)) {
1641
274
      fd_head = fragment_add_seq(&sna_reassembly_table,
1642
274
          tvb, offset, pinfo, id, NULL,
1643
274
          frag_number, frag_len, more_frags, 0);
1644
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. */
1650
1651
274
      if (mpf == MPF_LAST_SEGMENT && !fd_head) {
1652
120
        fd_head = fragment_add_seq(&sna_reassembly_table,
1653
120
            tvb, offset, pinfo, id, NULL,
1654
120
            MIDDLE_FRAG_NUMBER, 0, true, 0);
1655
120
      }
1656
1657
274
      if (fd_head != NULL) {
1658
        /* We have the complete reassembled payload. */
1659
88
        rh_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
1660
1661
        /* Add the defragmented data to the data
1662
         * source list. */
1663
88
        add_new_data_source(pinfo, rh_tvb,
1664
88
            "Reassembled SNA BIU");
1665
88
      }
1666
274
    }
1667
276
  }
1668
289
  return rh_tvb;
1669
289
}
1670
1671
182
#define SNA_FID01_ADDR_LEN  2
1672
1673
/* FID Types 0 and 1 */
1674
static int
1675
dissect_fid0_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1676
91
{
1677
91
  proto_tree  *bf_tree;
1678
91
  proto_item  *bf_item;
1679
91
  uint8_t   th_0;
1680
1681
91
  const int bytes_in_header = 10;
1682
1683
91
  if (tree) {
1684
    /* Byte 0 */
1685
91
    th_0 = tvb_get_uint8(tvb, 0);
1686
91
    bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1,
1687
91
        th_0);
1688
91
    bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1689
1690
91
    proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1691
91
    proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1692
91
    proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1693
1694
    /* Byte 1 */
1695
91
    proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1696
1697
    /* Bytes 2-3 */
1698
91
    proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 2, ENC_BIG_ENDIAN);
1699
91
  }
1700
1701
  /* Set DST addr */
1702
91
  set_address_tvb(&pinfo->net_dst, sna_address_type, SNA_FID01_ADDR_LEN, tvb, 2);
1703
91
  copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1704
1705
91
  proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
1706
1707
  /* Set SRC addr */
1708
91
  set_address_tvb(&pinfo->net_src, sna_address_type, SNA_FID01_ADDR_LEN, tvb, 4);
1709
91
  copy_address_shallow(&pinfo->src, &pinfo->net_src);
1710
1711
91
  proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
1712
91
  proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
1713
1714
91
  return bytes_in_header;
1715
91
}
1716
1717
584
#define SNA_FID2_ADDR_LEN 1
1718
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)
1723
292
{
1724
292
  proto_tree  *bf_tree;
1725
292
  proto_item  *bf_item;
1726
292
  uint8_t   th_0;
1727
292
  unsigned int  mpf, id;
1728
1729
292
  const int bytes_in_header = 6;
1730
1731
292
  th_0 = tvb_get_uint8(tvb, 0);
1732
292
  mpf = mpf_value(th_0);
1733
1734
292
  if (tree) {
1735
1736
    /* Byte 0 */
1737
292
    bf_item = proto_tree_add_item(tree, hf_sna_th_0, tvb, 0, 1, ENC_BIG_ENDIAN);
1738
292
    bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1739
1740
292
    proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, 0, 1, ENC_BIG_ENDIAN);
1741
292
    proto_tree_add_item(bf_tree, hf_sna_th_mpf, tvb, 0, 1, ENC_BIG_ENDIAN);
1742
292
    proto_tree_add_item(bf_tree, hf_sna_th_odai,tvb, 0, 1, ENC_BIG_ENDIAN);
1743
292
    proto_tree_add_item(bf_tree, hf_sna_th_efi, tvb, 0, 1, ENC_BIG_ENDIAN);
1744
1745
1746
    /* Byte 1 */
1747
292
    proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1748
1749
    /* Byte 2 */
1750
292
    proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 1, ENC_BIG_ENDIAN);
1751
292
  }
1752
1753
  /* Set DST addr */
1754
292
  set_address_tvb(&pinfo->net_dst, sna_address_type, SNA_FID2_ADDR_LEN, tvb, 2);
1755
292
  copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1756
1757
  /* Byte 3 */
1758
292
  proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_BIG_ENDIAN);
1759
1760
  /* Set SRC addr */
1761
292
  set_address_tvb(&pinfo->net_src, sna_address_type, SNA_FID2_ADDR_LEN, tvb, 3);
1762
292
  copy_address_shallow(&pinfo->src, &pinfo->net_src);
1763
1764
292
  id = tvb_get_ntohs(tvb, 4);
1765
292
  proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN);
1766
1767
292
  if (mpf != MPF_WHOLE_BIU && !sna_defragment) {
1768
0
    if (mpf == MPF_FIRST_SEGMENT) {
1769
0
      *continue_dissecting = rh_only;
1770
0
      } else {
1771
0
      *continue_dissecting = stop_here;
1772
0
      }
1773
1774
0
    }
1775
292
  else if (sna_defragment) {
1776
289
    *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb,
1777
289
        bytes_in_header, mpf, id);
1778
289
  }
1779
1780
292
  return bytes_in_header;
1781
292
}
1782
1783
/* FID Type 3 */
1784
static int
1785
dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
1786
31
{
1787
31
  proto_tree  *bf_tree;
1788
31
  proto_item  *bf_item;
1789
31
  uint8_t   th_0;
1790
1791
31
  const int bytes_in_header = 2;
1792
1793
  /* If we're not filling a proto_tree, return now */
1794
31
  if (!tree)
1795
0
    return bytes_in_header;
1796
1797
31
  th_0 = tvb_get_uint8(tvb, 0);
1798
1799
  /* Create the bitfield tree */
1800
31
  bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1801
31
  bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1802
1803
31
  proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1804
31
  proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1805
31
  proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1806
1807
31
  proto_tree_add_item(tree, hf_sna_th_lsid, tvb, 1, 1, ENC_BIG_ENDIAN);
1808
1809
31
  return bytes_in_header;
1810
31
}
1811
1812
static int
1813
dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1814
57
{
1815
57
  int   offset = 0;
1816
57
  uint8_t   th_byte, mft;
1817
57
  uint16_t    def, oef;
1818
57
  uint32_t    dsaf, osaf;
1819
57
  static int * const byte0_fields[] = {
1820
57
    &hf_sna_th_fid,
1821
57
    &hf_sna_th_tg_sweep,
1822
57
    &hf_sna_th_er_vr_supp_ind,
1823
57
    &hf_sna_th_vr_pac_cnt_ind,
1824
57
    &hf_sna_th_ntwk_prty,
1825
57
    NULL
1826
57
  };
1827
57
  static int * const byte1_fields[] = {
1828
57
    &hf_sna_th_tgsf,
1829
57
    &hf_sna_th_mft,
1830
57
    &hf_sna_th_piubf,
1831
57
    NULL
1832
57
  };
1833
57
  static int * const byte2_mft_fields[] = {
1834
57
    &hf_sna_th_nlpoi,
1835
57
    &hf_sna_th_nlp_cp,
1836
57
    &hf_sna_th_ern,
1837
57
    NULL
1838
57
  };
1839
57
  static int * const byte2_fields[] = {
1840
57
    &hf_sna_th_iern,
1841
57
    &hf_sna_th_ern,
1842
57
    NULL
1843
57
  };
1844
57
  static int * const byte3_fields[] = {
1845
57
    &hf_sna_th_vrn,
1846
57
    &hf_sna_th_tpf,
1847
57
    NULL
1848
57
  };
1849
57
  static int * const byte4_fields[] = {
1850
57
    &hf_sna_th_vr_cwi,
1851
57
    &hf_sna_th_tg_nonfifo_ind,
1852
57
    &hf_sna_th_vr_sqti,
1853
      /* I'm not sure about byte-order on this one... */
1854
57
    &hf_sna_th_tg_snf,
1855
57
    NULL
1856
57
  };
1857
57
  static int * const byte6_fields[] = {
1858
57
    &hf_sna_th_vrprq,
1859
57
    &hf_sna_th_vrprs,
1860
57
    &hf_sna_th_vr_cwri,
1861
57
    &hf_sna_th_vr_rwi,
1862
      /* I'm not sure about byte-order on this one... */
1863
57
    &hf_sna_th_vr_snf_send,
1864
57
    NULL
1865
57
  };
1866
57
  static int * const byte16_fields[] = {
1867
57
    &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
57
    &hf_sna_th_mpf,
1873
57
    &hf_sna_th_efi,
1874
57
    NULL
1875
57
  };
1876
1877
57
  struct sna_fid_type_4_addr *src, *dst;
1878
1879
57
  const int bytes_in_header = 26;
1880
1881
  /* If we're not filling a proto_tree, return now */
1882
57
  if (!tree)
1883
0
    return bytes_in_header;
1884
1885
  /* Byte 0 */
1886
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_0,
1887
57
             ett_sna_th_fid, byte0_fields, ENC_NA);
1888
1889
57
  offset += 1;
1890
57
  th_byte = tvb_get_uint8(tvb, offset);
1891
1892
  /* Byte 1 */
1893
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte1,
1894
57
             ett_sna_th_fid, byte1_fields, ENC_NA);
1895
1896
57
  mft = th_byte & 0x04;
1897
57
  offset += 1;
1898
1899
  /* Byte 2 */
1900
57
  if (mft) {
1901
30
    proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1902
30
             ett_sna_th_fid, byte2_mft_fields, ENC_NA);
1903
30
  } else {
1904
27
    proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte2,
1905
27
             ett_sna_th_fid, byte2_fields, ENC_NA);
1906
27
  }
1907
1908
57
  offset += 1;
1909
1910
  /* Byte 3 */
1911
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte3,
1912
57
             ett_sna_th_fid, byte3_fields, ENC_NA);
1913
57
  offset += 1;
1914
1915
  /* Bytes 4-5 */
1916
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte4,
1917
57
             ett_sna_th_fid, byte4_fields, ENC_BIG_ENDIAN);
1918
57
  offset += 2;
1919
1920
  /* Create the bitfield tree */
1921
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte6,
1922
57
             ett_sna_th_fid, byte6_fields, ENC_BIG_ENDIAN);
1923
57
  offset += 2;
1924
1925
57
  dsaf = tvb_get_ntohl(tvb, 8);
1926
  /* Bytes 8-11 */
1927
57
  proto_tree_add_uint(tree, hf_sna_th_dsaf, tvb, offset, 4, dsaf);
1928
1929
57
  offset += 4;
1930
1931
57
  osaf = tvb_get_ntohl(tvb, 12);
1932
  /* Bytes 12-15 */
1933
57
  proto_tree_add_uint(tree, hf_sna_th_osaf, tvb, offset, 4, osaf);
1934
1935
57
  offset += 4;
1936
1937
  /* Byte 16 */
1938
57
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_th_byte16,
1939
57
             ett_sna_th_fid, byte16_fields, ENC_NA);
1940
1941
  /* 1 for byte 16, 1 for byte 17 which is reserved */
1942
57
  offset += 2;
1943
1944
57
  def = tvb_get_ntohs(tvb, 18);
1945
  /* Bytes 18-25 */
1946
57
  proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
1947
1948
  /* Addresses in FID 4 are discontiguous, sigh */
1949
57
  dst = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1950
57
  dst->saf = dsaf;
1951
57
  dst->ef = def;
1952
57
  set_address(&pinfo->net_dst, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, dst);
1953
57
  copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
1954
1955
57
  oef = tvb_get_ntohs(tvb, 20);
1956
57
  proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
1957
1958
  /* Addresses in FID 4 are discontiguous, sigh */
1959
57
  src = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
1960
57
  src->saf = osaf;
1961
57
  src->ef = oef;
1962
57
  set_address(&pinfo->net_src, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, src);
1963
57
  copy_address_shallow(&pinfo->src, &pinfo->net_src);
1964
1965
57
  proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1966
57
  proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1967
1968
57
  return bytes_in_header;
1969
57
}
1970
1971
/* FID Type 5 */
1972
static int
1973
dissect_fid5(tvbuff_t *tvb, proto_tree *tree)
1974
15
{
1975
15
  proto_tree  *bf_tree;
1976
15
  proto_item  *bf_item;
1977
15
  uint8_t   th_0;
1978
1979
15
  const int bytes_in_header = 12;
1980
1981
  /* If we're not filling a proto_tree, return now */
1982
15
  if (!tree)
1983
0
    return bytes_in_header;
1984
1985
15
  th_0 = tvb_get_uint8(tvb, 0);
1986
1987
  /* Create the bitfield tree */
1988
15
  bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
1989
15
  bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
1990
1991
15
  proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
1992
15
  proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0);
1993
15
  proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0);
1994
1995
15
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
1996
15
  proto_tree_add_item(tree, hf_sna_th_snf, tvb, 2, 2, ENC_BIG_ENDIAN);
1997
1998
15
  proto_tree_add_item(tree, hf_sna_th_sa, tvb, 4, 8, ENC_NA);
1999
2000
15
  return bytes_in_header;
2001
2002
15
}
2003
2004
/* FID Type f */
2005
static int
2006
dissect_fidf(tvbuff_t *tvb, proto_tree *tree)
2007
19
{
2008
19
  proto_tree  *bf_tree;
2009
19
  proto_item  *bf_item;
2010
19
  uint8_t   th_0;
2011
2012
19
  const int bytes_in_header = 26;
2013
2014
  /* If we're not filling a proto_tree, return now */
2015
19
  if (!tree)
2016
0
    return bytes_in_header;
2017
2018
19
  th_0 = tvb_get_uint8(tvb, 0);
2019
2020
  /* Create the bitfield tree */
2021
19
  bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, th_0);
2022
19
  bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid);
2023
2024
19
  proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0);
2025
19
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 1, 1, ENC_NA);
2026
2027
19
  proto_tree_add_item(tree, hf_sna_th_cmd_fmt, tvb,  2, 1, ENC_BIG_ENDIAN);
2028
19
  proto_tree_add_item(tree, hf_sna_th_cmd_type, tvb, 3, 1, ENC_BIG_ENDIAN);
2029
19
  proto_tree_add_item(tree, hf_sna_th_cmd_sn, tvb,   4, 2, ENC_BIG_ENDIAN);
2030
2031
  /* Yup, bytes 6-23 are reserved! */
2032
19
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 6, 18, ENC_NA);
2033
2034
19
  proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 24, 2, ENC_BIG_ENDIAN);
2035
2036
19
  return bytes_in_header;
2037
19
}
2038
2039
static void
2040
dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2041
      proto_tree *parent_tree)
2042
550
{
2043
2044
550
  proto_tree  *th_tree = NULL, *rh_tree = NULL;
2045
550
  proto_item  *th_ti = NULL, *rh_ti = NULL;
2046
550
  uint8_t   th_fid;
2047
550
  int   th_header_len = 0;
2048
550
  int   offset, rh_offset;
2049
550
  tvbuff_t  *rh_tvb = NULL;
2050
550
  next_dissection_t continue_dissecting = everything;
2051
2052
  /* Transmission Header Format Identifier */
2053
550
  th_fid = hi_nibble(tvb_get_uint8(tvb, 0));
2054
2055
  /* Summary information */
2056
550
  col_add_str(pinfo->cinfo, COL_INFO,
2057
550
        val_to_str(pinfo->pool, th_fid, sna_th_fid_vals, "Unknown FID: %01x"));
2058
2059
550
  if (tree) {
2060
    /* --- TH --- */
2061
    /* Don't bother setting length. We'll set it later after we
2062
     * find the length of TH */
2063
550
    th_ti = proto_tree_add_item(tree, hf_sna_th, tvb,  0, -1,
2064
550
        ENC_NA);
2065
550
    th_tree = proto_item_add_subtree(th_ti, ett_sna_th);
2066
550
  }
2067
2068
  /* Get size of TH */
2069
550
  switch(th_fid) {
2070
84
    case 0x0:
2071
91
    case 0x1:
2072
91
      th_header_len = dissect_fid0_1(tvb, pinfo, th_tree);
2073
91
      break;
2074
292
    case 0x2:
2075
292
      th_header_len = dissect_fid2(tvb, pinfo, th_tree,
2076
292
          &rh_tvb, &continue_dissecting);
2077
292
      break;
2078
31
    case 0x3:
2079
31
      th_header_len = dissect_fid3(tvb, th_tree);
2080
31
      break;
2081
57
    case 0x4:
2082
57
      th_header_len = dissect_fid4(tvb, pinfo, th_tree);
2083
57
      break;
2084
15
    case 0x5:
2085
15
      th_header_len = dissect_fid5(tvb, th_tree);
2086
15
      break;
2087
19
    case 0xf:
2088
19
      th_header_len = dissect_fidf(tvb, th_tree);
2089
19
      break;
2090
45
    default:
2091
45
      call_data_dissector(tvb_new_subset_remaining(tvb, 1), pinfo, parent_tree);
2092
45
      return;
2093
550
  }
2094
2095
446
  offset = th_header_len;
2096
2097
  /* Short-circuit ? */
2098
446
  if (continue_dissecting == stop_here) {
2099
0
    proto_tree_add_item(tree, hf_sna_biu_segment_data, tvb, offset, -1, ENC_NA);
2100
0
    return;
2101
0
  }
2102
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
446
  if (!rh_tvb)
2106
358
    rh_tvb = tvb_new_subset_remaining(tvb, offset);
2107
446
  rh_offset = 0;
2108
2109
  /* Process the rest of the SNA packet, starting with RH */
2110
446
  if (tree) {
2111
446
    proto_item_set_len(th_ti, th_header_len);
2112
2113
    /* --- RH --- */
2114
446
    rh_ti = proto_tree_add_item(tree, hf_sna_rh, rh_tvb, rh_offset,
2115
446
        RH_LEN, ENC_NA);
2116
446
    rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh);
2117
446
    dissect_rh(rh_tvb, rh_offset, rh_tree);
2118
446
  }
2119
2120
446
  rh_offset += RH_LEN;
2121
2122
446
  if (tvb_offset_exists(rh_tvb, rh_offset)) {
2123
    /* Short-circuit ? */
2124
409
    if (continue_dissecting == rh_only) {
2125
0
      proto_tree_add_item(tree, hf_sna_biu_segment_data, rh_tvb, rh_offset, -1, ENC_NA);
2126
0
      return;
2127
0
    }
2128
2129
409
    call_data_dissector(tvb_new_subset_remaining(rh_tvb, rh_offset),
2130
409
        pinfo, parent_tree);
2131
409
  }
2132
446
}
2133
2134
/* --------------------------------------------------------------------
2135
 * Chapter 5 Request/Response Headers (RHs)
2136
 * --------------------------------------------------------------------
2137
 */
2138
2139
static void
2140
dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
2141
440
{
2142
440
  bool  is_response;
2143
440
  uint8_t   rh_0;
2144
440
  static int * const sna_rh_fields[] = {
2145
440
    &hf_sna_rh_rri,
2146
440
    &hf_sna_rh_ru_category,
2147
440
    &hf_sna_rh_fi,
2148
440
    &hf_sna_rh_sdi,
2149
440
    &hf_sna_rh_bci,
2150
440
    &hf_sna_rh_eci,
2151
440
    NULL
2152
440
  };
2153
440
  static int * const sna_rh_1_req_fields[] = {
2154
440
    &hf_sna_rh_dr1,
2155
440
    &hf_sna_rh_lcci,
2156
440
    &hf_sna_rh_dr2,
2157
440
    &hf_sna_rh_eri,
2158
440
    &hf_sna_rh_rlwi,
2159
440
    &hf_sna_rh_qri,
2160
440
    &hf_sna_rh_pi,
2161
440
    NULL
2162
440
  };
2163
440
  static int * const sna_rh_1_rsp_fields[] = {
2164
440
    &hf_sna_rh_dr1,
2165
440
    &hf_sna_rh_dr2,
2166
440
    &hf_sna_rh_rti,
2167
440
    &hf_sna_rh_qri,
2168
440
    &hf_sna_rh_pi,
2169
440
    NULL
2170
440
  };
2171
440
  static int * const sna_rh_2_req_fields[] = {
2172
440
    &hf_sna_rh_bbi,
2173
440
    &hf_sna_rh_ebi,
2174
440
    &hf_sna_rh_cdi,
2175
440
    &hf_sna_rh_csi,
2176
440
    &hf_sna_rh_edi,
2177
440
    &hf_sna_rh_pdi,
2178
440
    &hf_sna_rh_cebi,
2179
440
    NULL
2180
440
  };
2181
2182
440
  if (!tree)
2183
0
    return;
2184
2185
  /* Create the bitfield tree for byte 0*/
2186
440
  rh_0 = tvb_get_uint8(tvb, offset);
2187
440
  is_response = (rh_0 & 0x80);
2188
2189
440
  proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_0,
2190
440
             ett_sna_rh_0, sna_rh_fields, ENC_BIG_ENDIAN);
2191
440
  offset += 1;
2192
2193
  /* Create the bitfield tree for byte 1*/
2194
440
  if (is_response) {
2195
191
    proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2196
191
             ett_sna_rh_1, sna_rh_1_rsp_fields, ENC_BIG_ENDIAN);
2197
249
  } else {
2198
249
    proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_1,
2199
249
             ett_sna_rh_1, sna_rh_1_req_fields, ENC_BIG_ENDIAN);
2200
249
  }
2201
440
  offset += 1;
2202
2203
  /* Create the bitfield tree for byte 2*/
2204
440
  if (!is_response) {
2205
245
    proto_tree_add_bitmask(tree, tvb, offset, hf_sna_rh_2,
2206
245
             ett_sna_rh_2, sna_rh_2_req_fields, ENC_BIG_ENDIAN);
2207
245
  } else {
2208
195
    proto_tree_add_item(tree, hf_sna_rh_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2209
195
  }
2210
2211
  /* XXX - check for sdi. If true, the next 4 bytes will be sense data */
2212
440
}
2213
2214
/* --------------------------------------------------------------------
2215
 * Chapter 6 Request/Response Units (RUs)
2216
 * --------------------------------------------------------------------
2217
 */
2218
2219
/* --------------------------------------------------------------------
2220
 * Chapter 9 Common Fields
2221
 * --------------------------------------------------------------------
2222
 */
2223
2224
static void
2225
// NOLINTNEXTLINE(misc-no-recursion)
2226
dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
2227
          enum parse parse)
2228
10
{
2229
10
  uint16_t    offset, len, pad;
2230
10
  static int * const sna_control_05hpr_fields[] = {
2231
10
    &hf_sna_control_05_ptp,
2232
10
    NULL
2233
10
  };
2234
2235
10
  if (!tree)
2236
0
    return;
2237
2238
10
  proto_tree_add_bitmask(tree, tvb, 2, hf_sna_control_05_type,
2239
10
             ett_sna_control_05hpr_type, sna_control_05hpr_fields, ENC_BIG_ENDIAN);
2240
2241
10
  proto_tree_add_item(tree, hf_sna_reserved, tvb, 3, 1, ENC_NA);
2242
2243
10
  offset = 4;
2244
2245
23
  while (tvb_offset_exists(tvb, offset)) {
2246
16
    if (parse == LT) {
2247
16
      len = tvb_get_uint8(tvb, offset+0);
2248
16
    } else {
2249
0
      len = tvb_get_uint8(tvb, offset+1);
2250
0
    }
2251
16
    if (len) {
2252
      // We recurse here, but we'll run out of packet before we run out of stack.
2253
13
      dissect_sna_control(tvb, offset, len, tree, hpr, parse);
2254
13
      pad = (len+3) & 0xfffc;
2255
13
      if (pad > len) {
2256
9
        proto_tree_add_item(tree, hf_sna_padding, tvb, offset+len, pad-len, ENC_NA);
2257
9
      }
2258
13
      offset += pad;
2259
13
    } else {
2260
3
      return;
2261
3
    }
2262
16
  }
2263
10
}
2264
2265
static void
2266
dissect_control_05(tvbuff_t *tvb, proto_tree *tree)
2267
45
{
2268
45
  if(!tree)
2269
0
    return;
2270
2271
45
  proto_tree_add_item(tree, hf_sna_control_05_delay, tvb, 2, 2, ENC_BIG_ENDIAN);
2272
45
}
2273
2274
static void
2275
dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
2276
4
{
2277
4
  int len;
2278
2279
4
  if (!tree)
2280
0
    return;
2281
2282
4
  proto_tree_add_item(tree, hf_sna_control_0e_type, tvb, 2, 1, ENC_BIG_ENDIAN);
2283
2284
4
  len = tvb_reported_length_remaining(tvb, 3);
2285
4
  if (len <= 0)
2286
0
    return;
2287
2288
4
  proto_tree_add_item(tree, hf_sna_control_0e_value, tvb, 3, len, ENC_EBCDIC);
2289
4
}
2290
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)
2295
639
{
2296
639
  tvbuff_t  *tvb;
2297
639
  proto_tree  *sub_tree;
2298
639
  int   len, key;
2299
639
  int   ett;
2300
2301
639
  tvb = tvb_new_subset_length(parent_tvb, offset, control_len);
2302
2303
639
  sub_tree = NULL;
2304
2305
639
  if (parse == LT) {
2306
217
    len = tvb_get_uint8(tvb, 0);
2307
217
    key = tvb_get_uint8(tvb, 1);
2308
422
  } else {
2309
422
    key = tvb_get_uint8(tvb, 0);
2310
422
    len = tvb_get_uint8(tvb, 1);
2311
422
  }
2312
639
  ett = ett_sna_control_un;
2313
2314
639
  if (tree) {
2315
638
    if (key == 5) {
2316
55
       if (hpr) ett = ett_sna_control_05hpr;
2317
45
       else ett = ett_sna_control_05;
2318
55
    }
2319
638
    if (key == 0x0e) ett = ett_sna_control_0e;
2320
2321
638
    if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2322
41
      sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2323
41
          val_to_str_const(key, sna_control_hpr_vals,
2324
41
          "Unknown Control Vector"));
2325
597
    else
2326
597
      sub_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett, NULL,
2327
597
          val_to_str_const(key, sna_control_vals,
2328
597
          "Unknown Control Vector"));
2329
638
    if (parse == LT) {
2330
216
      proto_tree_add_uint(sub_tree, hf_sna_control_len,
2331
216
          tvb, 0, 1, len);
2332
216
      if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2333
41
        proto_tree_add_uint(sub_tree,
2334
41
            hf_sna_control_hprkey, tvb, 1, 1, key);
2335
175
      else
2336
175
        proto_tree_add_uint(sub_tree,
2337
175
            hf_sna_control_key, tvb, 1, 1, key);
2338
422
    } else {
2339
422
      if (((key == 0) || (key == 3) || (key == 5)) && hpr)
2340
0
        proto_tree_add_uint(sub_tree,
2341
0
            hf_sna_control_hprkey, tvb, 0, 1, key);
2342
422
      else
2343
422
        proto_tree_add_uint(sub_tree,
2344
422
            hf_sna_control_key, tvb, 0, 1, key);
2345
422
      proto_tree_add_uint(sub_tree, hf_sna_control_len,
2346
422
          tvb, 1, 1, len);
2347
422
    }
2348
638
  }
2349
639
  switch(key) {
2350
55
    case 0x05:
2351
55
      if (hpr)
2352
        // We recurse here, but we'll run out of packet before we run out of stack.
2353
10
        dissect_control_05hpr(tvb, sub_tree, hpr,
2354
10
            parse);
2355
45
      else
2356
45
        dissect_control_05(tvb, sub_tree);
2357
55
      break;
2358
4
    case 0x0e:
2359
4
      dissect_control_0e(tvb, sub_tree);
2360
4
      break;
2361
639
  }
2362
639
}
2363
2364
/* --------------------------------------------------------------------
2365
 * Chapter 11 Function Management (FM) Headers
2366
 * --------------------------------------------------------------------
2367
 */
2368
2369
/* --------------------------------------------------------------------
2370
 * Chapter 12 Presentation Services (PS) Headers
2371
 * --------------------------------------------------------------------
2372
 */
2373
2374
/* --------------------------------------------------------------------
2375
 * Chapter 13 GDS Variables
2376
 * --------------------------------------------------------------------
2377
 */
2378
2379
static void
2380
dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2381
      proto_tree *parent_tree)
2382
0
{
2383
0
  uint16_t    length;
2384
0
  int   cont;
2385
0
  int   offset = 0;
2386
0
  proto_item  *pi;
2387
0
  proto_tree  *subtree;
2388
0
  bool  first_ll = true;
2389
2390
0
  do {
2391
0
    length = tvb_get_ntohs(tvb, offset) & 0x7fff;
2392
0
    cont   = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
2393
2394
0
    pi = proto_tree_add_item(tree, hf_sna_gds, tvb, offset, -1, ENC_NA);
2395
0
    subtree = proto_item_add_subtree(pi, ett_sna_gds);
2396
0
    proto_tree_add_item(subtree, hf_sna_gds_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2397
0
    proto_tree_add_item(subtree, hf_sna_gds_cont, tvb, offset, 2, ENC_BIG_ENDIAN);
2398
0
    if (length < 2 ) /* escape sequence */
2399
0
      return;
2400
0
    offset += 2;
2401
0
    length -= 2;
2402
0
    if (first_ll) {
2403
0
      proto_tree_add_item(subtree, hf_sna_gds_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2404
0
      offset += 2;
2405
0
      length -= 2;
2406
0
      first_ll = false;
2407
0
    }
2408
0
    if (length > 0) {
2409
0
      proto_tree_add_item(subtree, hf_sna_gds_info, tvb, offset, length, ENC_NA);
2410
0
      offset += length;
2411
0
    }
2412
0
  } while(cont);
2413
0
  proto_item_set_len(pi, offset);
2414
0
  if (tvb_offset_exists(tvb, offset))
2415
0
    call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
2416
0
}
2417
2418
/* --------------------------------------------------------------------
2419
 * General stuff
2420
 * --------------------------------------------------------------------
2421
 */
2422
2423
static int
2424
dissect_sna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2425
849
{
2426
849
  uint8_t   fid;
2427
849
  proto_tree  *sna_tree = NULL;
2428
849
  proto_item  *sna_ti = NULL;
2429
2430
849
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2431
849
  col_clear(pinfo->cinfo, COL_INFO);
2432
2433
  /* SNA data should be printed in EBCDIC, not ASCII */
2434
849
  pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2435
2436
849
  if (tree) {
2437
2438
    /* Don't bother setting length. We'll set it later after we find
2439
     * the lengths of TH/RH/RU */
2440
849
    sna_ti = proto_tree_add_item(tree, proto_sna, tvb, 0, -1,
2441
849
        ENC_NA);
2442
849
    sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2443
849
  }
2444
2445
  /* Transmission Header Format Identifier */
2446
849
  fid = hi_nibble(tvb_get_uint8(tvb, 0));
2447
849
  switch(fid) {
2448
33
    case 0xa: /* HPR Network Layer Packet */
2449
77
    case 0xb:
2450
160
    case 0xc:
2451
221
    case 0xd:
2452
221
      dissect_nlp(tvb, pinfo, sna_tree, tree);
2453
221
      break;
2454
548
    default:
2455
548
      dissect_fid(tvb, pinfo, sna_tree, tree);
2456
849
  }
2457
638
  return tvb_captured_length(tvb);
2458
849
}
2459
2460
static int
2461
dissect_sna_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2462
97
{
2463
97
  proto_tree  *sna_tree = NULL;
2464
97
  proto_item  *sna_ti = NULL;
2465
2466
97
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNA");
2467
97
  col_clear(pinfo->cinfo, COL_INFO);
2468
2469
  /* SNA data should be printed in EBCDIC, not ASCII */
2470
97
  pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
2471
2472
97
  if (tree) {
2473
2474
    /* Don't bother setting length. We'll set it later after we find
2475
     * the lengths of XID */
2476
97
    sna_ti = proto_tree_add_item(tree, proto_sna_xid, tvb, 0, -1,
2477
97
        ENC_NA);
2478
97
    sna_tree = proto_item_add_subtree(sna_ti, ett_sna);
2479
97
  }
2480
97
  dissect_xid(tvb, pinfo, sna_tree, tree);
2481
97
  return tvb_captured_length(tvb);
2482
97
}
2483
2484
2485
void
2486
proto_register_sna(void)
2487
16
{
2488
16
  static hf_register_info hf[] = {
2489
16
    { &hf_sna_th,
2490
16
      { "Transmission Header", "sna.th", FT_NONE, BASE_NONE,
2491
16
        NULL, 0x0, NULL, HFILL }},
2492
2493
16
    { &hf_sna_th_0,
2494
16
      { "Transmission Header Byte 0", "sna.th.0", FT_UINT8, BASE_HEX,
2495
16
        NULL, 0x0,
2496
16
        "TH Byte 0", HFILL }},
2497
2498
16
    { &hf_sna_th_fid,
2499
16
      { "Format Identifier", "sna.th.fid", FT_UINT8, BASE_HEX,
2500
16
        VALS(sna_th_fid_vals), 0xf0, NULL, HFILL }},
2501
2502
16
    { &hf_sna_th_mpf,
2503
16
      { "Mapping Field", "sna.th.mpf", FT_UINT8,
2504
16
        BASE_DEC, VALS(sna_th_mpf_vals), 0x0c, NULL, HFILL }},
2505
2506
16
    { &hf_sna_th_odai,
2507
16
      { "ODAI Assignment Indicator", "sna.th.odai", FT_UINT8,
2508
16
        BASE_DEC, NULL, 0x02, NULL, HFILL }},
2509
2510
16
    { &hf_sna_th_efi,
2511
16
      { "Expedited Flow Indicator", "sna.th.efi", FT_UINT8,
2512
16
        BASE_DEC, VALS(sna_th_efi_vals), 0x01, NULL, HFILL }},
2513
2514
16
    { &hf_sna_th_daf,
2515
16
      { "Destination Address Field", "sna.th.daf", FT_UINT16,
2516
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2517
2518
16
    { &hf_sna_th_oaf,
2519
16
      { "Origin Address Field", "sna.th.oaf", FT_UINT16, BASE_HEX,
2520
16
        NULL, 0x0, NULL, HFILL }},
2521
2522
16
    { &hf_sna_th_snf,
2523
16
      { "Sequence Number Field", "sna.th.snf", FT_UINT16, BASE_DEC,
2524
16
        NULL, 0x0, NULL, HFILL }},
2525
2526
16
    { &hf_sna_th_dcf,
2527
16
      { "Data Count Field", "sna.th.dcf", FT_UINT16, BASE_DEC,
2528
16
        NULL, 0x0, NULL, HFILL }},
2529
2530
16
    { &hf_sna_th_lsid,
2531
16
      { "Local Session Identification", "sna.th.lsid", FT_UINT8,
2532
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2533
2534
16
    { &hf_sna_th_tg_sweep,
2535
16
      { "Transmission Group Sweep", "sna.th.tg_sweep", FT_UINT8,
2536
16
        BASE_DEC, VALS(sna_th_tg_sweep_vals), 0x08, NULL, HFILL }},
2537
2538
16
    { &hf_sna_th_er_vr_supp_ind,
2539
16
      { "ER and VR Support Indicator", "sna.th.er_vr_supp_ind",
2540
16
        FT_UINT8, BASE_DEC, VALS(sna_th_er_vr_supp_ind_vals),
2541
16
        0x04, NULL, HFILL }},
2542
2543
16
    { &hf_sna_th_vr_pac_cnt_ind,
2544
16
      { "Virtual Route Pacing Count Indicator",
2545
16
        "sna.th.vr_pac_cnt_ind", FT_UINT8, BASE_DEC,
2546
16
        VALS(sna_th_vr_pac_cnt_ind_vals), 0x02, NULL, HFILL }},
2547
2548
16
    { &hf_sna_th_ntwk_prty,
2549
16
      { "Network Priority", "sna.th.ntwk_prty", FT_UINT8, BASE_DEC,
2550
16
        VALS(sna_th_ntwk_prty_vals), 0x01, NULL, HFILL }},
2551
2552
16
    { &hf_sna_th_tgsf,
2553
16
      { "Transmission Group Segmenting Field", "sna.th.tgsf",
2554
16
        FT_UINT8, BASE_HEX, VALS(sna_th_tgsf_vals), 0xc0,
2555
16
        NULL, HFILL }},
2556
2557
16
    { &hf_sna_th_mft,
2558
16
      { "MPR FID4 Type", "sna.th.mft", FT_BOOLEAN, 8,
2559
16
        NULL, 0x04, NULL, HFILL }},
2560
2561
16
    { &hf_sna_th_piubf,
2562
16
      { "PIU Blocking Field", "sna.th.piubf", FT_UINT8, BASE_HEX,
2563
16
        VALS(sna_th_piubf_vals), 0x03, NULL, HFILL }},
2564
2565
16
    { &hf_sna_th_iern,
2566
16
      { "Initial Explicit Route Number", "sna.th.iern", FT_UINT8,
2567
16
        BASE_DEC, NULL, 0xf0, NULL, HFILL }},
2568
2569
16
    { &hf_sna_th_nlpoi,
2570
16
      { "NLP Offset Indicator", "sna.th.nlpoi", FT_UINT8, BASE_DEC,
2571
16
        VALS(sna_th_nlpoi_vals), 0x80, NULL, HFILL }},
2572
2573
16
    { &hf_sna_th_nlp_cp,
2574
16
      { "NLP Count or Padding", "sna.th.nlp_cp", FT_UINT8, BASE_DEC,
2575
16
        NULL, 0x70, NULL, HFILL }},
2576
2577
16
    { &hf_sna_th_ern,
2578
16
      { "Explicit Route Number", "sna.th.ern", FT_UINT8, BASE_DEC,
2579
16
        NULL, 0x0f, NULL, HFILL }},
2580
2581
16
    { &hf_sna_th_vrn,
2582
16
      { "Virtual Route Number", "sna.th.vrn", FT_UINT8, BASE_DEC,
2583
16
        NULL, 0xf0, NULL, HFILL }},
2584
2585
16
    { &hf_sna_th_tpf,
2586
16
      { "Transmission Priority Field", "sna.th.tpf", FT_UINT8,
2587
16
        BASE_HEX, VALS(sna_th_tpf_vals), 0x03, NULL, HFILL }},
2588
2589
16
    { &hf_sna_th_vr_cwi,
2590
16
      { "Virtual Route Change Window Indicator", "sna.th.vr_cwi",
2591
16
        FT_UINT16, BASE_DEC, VALS(sna_th_vr_cwi_vals), 0x8000,
2592
16
        NULL, HFILL }},
2593
2594
16
    { &hf_sna_th_tg_nonfifo_ind,
2595
16
      { "Transmission Group Non-FIFO Indicator",
2596
16
        "sna.th.tg_nonfifo_ind", FT_BOOLEAN, 16,
2597
16
        TFS(&sna_th_tg_nonfifo_ind_truth), 0x4000, NULL, HFILL }},
2598
2599
16
    { &hf_sna_th_vr_sqti,
2600
16
      { "Virtual Route Sequence and Type Indicator", "sna.th.vr_sqti",
2601
16
        FT_UINT16, BASE_HEX, VALS(sna_th_vr_sqti_vals), 0x3000,
2602
16
        NULL, HFILL }},
2603
2604
16
    { &hf_sna_th_tg_snf,
2605
16
      { "Transmission Group Sequence Number Field", "sna.th.tg_snf",
2606
16
        FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
2607
2608
16
    { &hf_sna_th_vrprq,
2609
16
      { "Virtual Route Pacing Request", "sna.th.vrprq", FT_BOOLEAN,
2610
16
        16, TFS(&sna_th_vrprq_truth), 0x8000, NULL, HFILL }},
2611
2612
16
    { &hf_sna_th_vrprs,
2613
16
      { "Virtual Route Pacing Response", "sna.th.vrprs", FT_BOOLEAN,
2614
16
        16, TFS(&sna_th_vrprs_truth), 0x4000, NULL, HFILL }},
2615
2616
16
    { &hf_sna_th_vr_cwri,
2617
16
      { "Virtual Route Change Window Reply Indicator",
2618
16
        "sna.th.vr_cwri", FT_UINT16, BASE_DEC,
2619
16
        VALS(sna_th_vr_cwri_vals), 0x2000, NULL, HFILL }},
2620
2621
16
    { &hf_sna_th_vr_rwi,
2622
16
      { "Virtual Route Reset Window Indicator", "sna.th.vr_rwi",
2623
16
        FT_BOOLEAN, 16, TFS(&sna_th_vr_rwi_truth), 0x1000,
2624
16
        NULL, HFILL }},
2625
2626
16
    { &hf_sna_th_vr_snf_send,
2627
16
      { "Virtual Route Send Sequence Number Field",
2628
16
        "sna.th.vr_snf_send", FT_UINT16, BASE_DEC, NULL, 0x0fff,
2629
16
        NULL, HFILL }},
2630
2631
16
    { &hf_sna_th_dsaf,
2632
16
      { "Destination Subarea Address Field", "sna.th.dsaf",
2633
16
        FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2634
2635
16
    { &hf_sna_th_osaf,
2636
16
      { "Origin Subarea Address Field", "sna.th.osaf", FT_UINT32,
2637
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2638
2639
16
    { &hf_sna_th_snai,
2640
16
      { "SNA Indicator", "sna.th.snai", FT_BOOLEAN, 8, NULL, 0x10,
2641
16
        "Used to identify whether the PIU originated or is destined for an SNA or non-SNA device.", HFILL }},
2642
2643
16
    { &hf_sna_th_def,
2644
16
      { "Destination Element Field", "sna.th.def", FT_UINT16,
2645
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2646
2647
16
    { &hf_sna_th_oef,
2648
16
      { "Origin Element Field", "sna.th.oef", FT_UINT16, BASE_HEX,
2649
16
        NULL, 0x0, NULL, HFILL }},
2650
2651
16
    { &hf_sna_th_sa,
2652
16
      { "Session Address", "sna.th.sa", FT_BYTES, BASE_NONE,
2653
16
        NULL, 0x0, NULL, HFILL }},
2654
2655
16
    { &hf_sna_th_cmd_fmt,
2656
16
      { "Command Format", "sna.th.cmd_fmt", FT_UINT8, BASE_HEX,
2657
16
        NULL, 0x0, NULL, HFILL }},
2658
2659
16
    { &hf_sna_th_cmd_type,
2660
16
      { "Command Type", "sna.th.cmd_type", FT_UINT8, BASE_HEX,
2661
16
        NULL, 0x0, NULL, HFILL }},
2662
2663
16
    { &hf_sna_th_cmd_sn,
2664
16
      { "Command Sequence Number", "sna.th.cmd_sn", FT_UINT16,
2665
16
        BASE_DEC, NULL, 0x0, NULL, HFILL }},
2666
2667
16
    { &hf_sna_th_byte1,
2668
16
      { "Transmission Header Bytes 1", "sna.th.byte1", FT_UINT8,
2669
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2670
2671
16
    { &hf_sna_th_byte2,
2672
16
      { "Transmission Header Bytes 2", "sna.th.byte2", FT_UINT8,
2673
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2674
2675
16
    { &hf_sna_th_byte3,
2676
16
      { "Transmission Header Bytes 3", "sna.th.byte3", FT_UINT8,
2677
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2678
2679
16
    { &hf_sna_th_byte4,
2680
16
      { "Transmission Header Bytes 4-5", "sna.th.byte4", FT_UINT16,
2681
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2682
2683
16
    { &hf_sna_th_byte6,
2684
16
      { "Transmission Header Bytes 6-7", "sna.th.byte6", FT_UINT16,
2685
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2686
2687
16
    { &hf_sna_th_byte16,
2688
16
      { "Transmission Header Bytes 16", "sna.th.byte16", FT_UINT8,
2689
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2690
2691
16
    { &hf_sna_nlp_nhdr,
2692
16
      { "Network Layer Packet Header", "sna.nlp.nhdr", FT_NONE,
2693
16
        BASE_NONE, NULL, 0x0, "NHDR", HFILL }},
2694
2695
16
    { &hf_sna_nlp_nhdr_0,
2696
16
      { "Network Layer Packet Header Byte 0", "sna.nlp.nhdr.0",
2697
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2698
2699
16
    { &hf_sna_nlp_nhdr_1,
2700
16
      { "Network Layer Packet Header Byte 1", "sna.nlp.nhdr.1",
2701
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2702
2703
16
    { &hf_sna_nlp_sm,
2704
16
      { "Switching Mode Field", "sna.nlp.nhdr.sm", FT_UINT8,
2705
16
        BASE_HEX, VALS(sna_nlp_sm_vals), 0xe0, NULL, HFILL }},
2706
2707
16
    { &hf_sna_nlp_tpf,
2708
16
      { "Transmission Priority Field", "sna.nlp.nhdr.tpf", FT_UINT8,
2709
16
        BASE_HEX, VALS(sna_th_tpf_vals), 0x06, NULL, HFILL }},
2710
2711
16
    { &hf_sna_nlp_ft,
2712
16
      { "Function Type", "sna.nlp.nhdr.ft", FT_UINT8, BASE_HEX,
2713
16
        VALS(sna_nlp_ft_vals), 0xF0, NULL, HFILL }},
2714
2715
16
    { &hf_sna_nlp_tspi,
2716
16
      { "Time Sensitive Packet Indicator", "sna.nlp.nhdr.tspi",
2717
16
        FT_BOOLEAN, 8, TFS(&sna_nlp_tspi_truth), 0x08, NULL, HFILL }},
2718
2719
16
    { &hf_sna_nlp_slowdn1,
2720
16
      { "Slowdown 1", "sna.nlp.nhdr.slowdn1", FT_BOOLEAN, 8,
2721
16
        TFS(&sna_nlp_slowdn1_truth), 0x04, NULL, HFILL }},
2722
2723
16
    { &hf_sna_nlp_slowdn2,
2724
16
      { "Slowdown 2", "sna.nlp.nhdr.slowdn2", FT_BOOLEAN, 8,
2725
16
        TFS(&sna_nlp_slowdn2_truth), 0x02, NULL, HFILL }},
2726
2727
16
    { &hf_sna_nlp_fra,
2728
16
      { "Function Routing Address Entry", "sna.nlp.nhdr.fra",
2729
16
        FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2730
2731
16
    { &hf_sna_nlp_anr,
2732
16
      { "Automatic Network Routing Entry", "sna.nlp.nhdr.anr",
2733
16
        FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
2734
2735
16
    { &hf_sna_nlp_frh,
2736
16
      { "Transmission Priority Field", "sna.nlp.frh", FT_UINT8,
2737
16
        BASE_HEX, VALS(sna_nlp_frh_vals), 0, NULL, HFILL }},
2738
2739
16
    { &hf_sna_nlp_thdr,
2740
16
      { "RTP Transport Header", "sna.nlp.thdr", FT_NONE, BASE_NONE,
2741
16
        NULL, 0x0, "THDR", HFILL }},
2742
2743
16
    { &hf_sna_nlp_tcid,
2744
16
      { "Transport Connection Identifier", "sna.nlp.thdr.tcid",
2745
16
        FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2746
2747
16
    { &hf_sna_nlp_thdr_8,
2748
16
      { "RTP Transport Packet Header Byte 8", "sna.nlp.thdr.8",
2749
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2750
2751
16
    { &hf_sna_nlp_setupi,
2752
16
      { "Setup Indicator", "sna.nlp.thdr.setupi", FT_BOOLEAN, 8,
2753
16
        TFS(&sna_nlp_setupi_truth), 0x40, NULL, HFILL }},
2754
2755
16
    { &hf_sna_nlp_somi,
2756
16
      { "Start Of Message Indicator", "sna.nlp.thdr.somi",
2757
16
        FT_BOOLEAN, 8, TFS(&sna_nlp_somi_truth), 0x20, NULL, HFILL }},
2758
2759
16
    { &hf_sna_nlp_eomi,
2760
16
      { "End Of Message Indicator", "sna.nlp.thdr.eomi", FT_BOOLEAN,
2761
16
        8, TFS(&sna_nlp_eomi_truth), 0x10, NULL, HFILL }},
2762
2763
16
    { &hf_sna_nlp_sri,
2764
16
      { "Session Request Indicator", "sna.nlp.thdr.sri", FT_BOOLEAN,
2765
16
        8, TFS(&sna_nlp_sri_truth), 0x08, NULL, HFILL }},
2766
2767
16
    { &hf_sna_nlp_rasapi,
2768
16
      { "Reply ASAP Indicator", "sna.nlp.thdr.rasapi", FT_BOOLEAN,
2769
16
        8, TFS(&sna_nlp_rasapi_truth), 0x04, NULL, HFILL }},
2770
2771
16
    { &hf_sna_nlp_retryi,
2772
16
      { "Retry Indicator", "sna.nlp.thdr.retryi", FT_BOOLEAN,
2773
16
        8, TFS(&sna_nlp_retryi_truth), 0x02, NULL, HFILL }},
2774
2775
16
    { &hf_sna_nlp_thdr_9,
2776
16
      { "RTP Transport Packet Header Byte 9", "sna.nlp.thdr.9",
2777
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2778
2779
16
    { &hf_sna_nlp_lmi,
2780
16
      { "Last Message Indicator", "sna.nlp.thdr.lmi", FT_BOOLEAN,
2781
16
        8, TFS(&sna_nlp_lmi_truth), 0x80, NULL, HFILL }},
2782
2783
16
    { &hf_sna_nlp_cqfi,
2784
16
      { "Connection Qualifier Field Indicator", "sna.nlp.thdr.cqfi",
2785
16
        FT_BOOLEAN, 8, TFS(&sna_nlp_cqfi_truth), 0x08, NULL, HFILL }},
2786
2787
16
    { &hf_sna_nlp_osi,
2788
16
      { "Optional Segments Present Indicator", "sna.nlp.thdr.osi",
2789
16
        FT_BOOLEAN, 8, TFS(&sna_nlp_osi_truth), 0x04, NULL, HFILL }},
2790
2791
16
    { &hf_sna_nlp_offset,
2792
16
      { "Data Offset/4", "sna.nlp.thdr.offset", FT_UINT16, BASE_HEX,
2793
16
        NULL, 0x0, "Data Offset in Words", HFILL }},
2794
2795
16
    { &hf_sna_nlp_dlf,
2796
16
      { "Data Length Field", "sna.nlp.thdr.dlf", FT_UINT32, BASE_HEX,
2797
16
        NULL, 0x0, NULL, HFILL }},
2798
2799
16
    { &hf_sna_nlp_bsn,
2800
16
      { "Byte Sequence Number", "sna.nlp.thdr.bsn", FT_UINT32,
2801
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
2802
2803
16
    { &hf_sna_nlp_opti_len,
2804
16
      { "Optional Segment Length/4", "sna.nlp.thdr.optional.len",
2805
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2806
2807
16
    { &hf_sna_nlp_opti_type,
2808
16
      { "Optional Segment Type", "sna.nlp.thdr.optional.type",
2809
16
        FT_UINT8, BASE_HEX, VALS(sna_nlp_opti_vals), 0x0, NULL,
2810
16
        HFILL }},
2811
2812
16
    { &hf_sna_nlp_opti_0d_version,
2813
16
      { "Version", "sna.nlp.thdr.optional.0d.version",
2814
16
        FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0d_version_vals),
2815
16
        0, NULL, HFILL }},
2816
2817
16
    { &hf_sna_nlp_opti_0d_4,
2818
16
      { "Connection Setup Byte 4", "sna.nlp.thdr.optional.0e.4",
2819
16
        FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2820
2821
16
    { &hf_sna_nlp_opti_0d_target,
2822
16
      { "Target Resource ID Present",
2823
16
        "sna.nlp.thdr.optional.0d.target",
2824
16
        FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2825
2826
16
    { &hf_sna_nlp_opti_0d_arb,
2827
16
      { "ARB Flow Control", "sna.nlp.thdr.optional.0d.arb",
2828
16
        FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2829
2830
16
    { &hf_sna_nlp_opti_0d_reliable,
2831
16
      { "Reliable Connection", "sna.nlp.thdr.optional.0d.reliable",
2832
16
        FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2833
2834
16
    { &hf_sna_nlp_opti_0d_dedicated,
2835
16
      { "Dedicated RTP Connection",
2836
16
        "sna.nlp.thdr.optional.0d.dedicated",
2837
16
        FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2838
2839
16
    { &hf_sna_nlp_opti_0e_stat,
2840
16
      { "Status", "sna.nlp.thdr.optional.0e.stat",
2841
16
        FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
2842
2843
16
    { &hf_sna_nlp_opti_0e_gap,
2844
16
      { "Gap Detected", "sna.nlp.thdr.optional.0e.gap",
2845
16
        FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2846
2847
16
    { &hf_sna_nlp_opti_0e_idle,
2848
16
      { "RTP Idle Packet", "sna.nlp.thdr.optional.0e.idle",
2849
16
        FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2850
2851
16
    { &hf_sna_nlp_opti_0e_nabsp,
2852
16
      { "Number Of ABSP", "sna.nlp.thdr.optional.0e.nabsp",
2853
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2854
2855
16
    { &hf_sna_nlp_opti_0e_sync,
2856
16
      { "Status Report Number", "sna.nlp.thdr.optional.0e.sync",
2857
16
        FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2858
2859
16
    { &hf_sna_nlp_opti_0e_echo,
2860
16
      { "Status Acknowledge Number", "sna.nlp.thdr.optional.0e.echo",
2861
16
        FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2862
2863
16
    { &hf_sna_nlp_opti_0e_rseq,
2864
16
      { "Received Sequence Number", "sna.nlp.thdr.optional.0e.rseq",
2865
16
        FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2866
2867
#if 0
2868
    { &hf_sna_nlp_opti_0e_abspbeg,
2869
      { "ABSP Begin", "sna.nlp.thdr.optional.0e.abspbeg",
2870
        FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2871
#endif
2872
2873
#if 0
2874
    { &hf_sna_nlp_opti_0e_abspend,
2875
      { "ABSP End", "sna.nlp.thdr.optional.0e.abspend",
2876
        FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2877
#endif
2878
2879
16
    { &hf_sna_nlp_opti_0f_bits,
2880
16
      { "Client Bits", "sna.nlp.thdr.optional.0f.bits",
2881
16
        FT_UINT16, BASE_HEX, VALS(sna_nlp_opti_0f_bits_vals),
2882
16
        0x0, NULL, HFILL }},
2883
2884
16
    { &hf_sna_nlp_opti_10_tcid,
2885
16
      { "Transport Connection Identifier",
2886
16
        "sna.nlp.thdr.optional.10.tcid",
2887
16
        FT_BYTES, BASE_NONE, NULL, 0x0, "TCID", HFILL }},
2888
2889
16
    { &hf_sna_nlp_opti_12_sense,
2890
16
      { "Sense Data", "sna.nlp.thdr.optional.12.sense",
2891
16
        FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2892
2893
16
    { &hf_sna_nlp_opti_14_si_len,
2894
16
      { "Length", "sna.nlp.thdr.optional.14.si.len",
2895
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2896
2897
16
    { &hf_sna_nlp_opti_14_si_key,
2898
16
      { "Key", "sna.nlp.thdr.optional.14.si.key",
2899
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2900
2901
16
    { &hf_sna_nlp_opti_14_si_2,
2902
16
      { "Switching Information Byte 2",
2903
16
        "sna.nlp.thdr.optional.14.si.2",
2904
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2905
2906
16
    { &hf_sna_nlp_opti_14_si_refifo,
2907
16
      { "Resequencing (REFIFO) Indicator",
2908
16
        "sna.nlp.thdr.optional.14.si.refifo",
2909
16
        FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2910
2911
16
    { &hf_sna_nlp_opti_14_si_mobility,
2912
16
      { "Mobility Indicator",
2913
16
        "sna.nlp.thdr.optional.14.si.mobility",
2914
16
        FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
2915
2916
16
    { &hf_sna_nlp_opti_14_si_dirsearch,
2917
16
      { "Directory Search Required on Path Switch Indicator",
2918
16
        "sna.nlp.thdr.optional.14.si.dirsearch",
2919
16
        FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
2920
2921
16
    { &hf_sna_nlp_opti_14_si_limitres,
2922
16
      { "Limited Resource Link Indicator",
2923
16
        "sna.nlp.thdr.optional.14.si.limitres",
2924
16
        FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
2925
2926
16
    { &hf_sna_nlp_opti_14_si_ncescope,
2927
16
      { "NCE Scope Indicator",
2928
16
        "sna.nlp.thdr.optional.14.si.ncescope",
2929
16
        FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
2930
2931
16
    { &hf_sna_nlp_opti_14_si_mnpsrscv,
2932
16
      { "MNPS RSCV Retention Indicator",
2933
16
        "sna.nlp.thdr.optional.14.si.mnpsrscv",
2934
16
        FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2935
2936
16
    { &hf_sna_nlp_opti_14_si_maxpsize,
2937
16
      { "Maximum Packet Size On Return Path",
2938
16
        "sna.nlp.thdr.optional.14.si.maxpsize",
2939
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2940
2941
16
    { &hf_sna_nlp_opti_14_si_switch,
2942
16
      { "Path Switch Time", "sna.nlp.thdr.optional.14.si.switch",
2943
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2944
2945
16
    { &hf_sna_nlp_opti_14_si_alive,
2946
16
      { "RTP Alive Timer", "sna.nlp.thdr.optional.14.si.alive",
2947
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2948
2949
16
    { &hf_sna_nlp_opti_14_rr_len,
2950
16
      { "Length", "sna.nlp.thdr.optional.14.rr.len",
2951
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2952
2953
16
    { &hf_sna_nlp_opti_14_rr_key,
2954
16
      { "Key", "sna.nlp.thdr.optional.14.rr.key",
2955
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2956
2957
16
    { &hf_sna_nlp_opti_14_rr_2,
2958
16
      { "Return Route TG Descriptor Byte 2",
2959
16
        "sna.nlp.thdr.optional.14.rr.2",
2960
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2961
2962
16
    { &hf_sna_nlp_opti_14_rr_bfe,
2963
16
      { "BF Entry Indicator",
2964
16
        "sna.nlp.thdr.optional.14.rr.bfe",
2965
16
        FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
2966
2967
16
    { &hf_sna_nlp_opti_14_rr_num,
2968
16
      { "Number Of TG Control Vectors",
2969
16
        "sna.nlp.thdr.optional.14.rr.num",
2970
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2971
2972
16
    { &hf_sna_nlp_opti_22_2,
2973
16
      { "Adaptive Rate Based Segment Byte 2",
2974
16
        "sna.nlp.thdr.optional.22.2",
2975
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2976
2977
16
    { &hf_sna_nlp_opti_22_type,
2978
16
      { "Message Type",
2979
16
        "sna.nlp.thdr.optional.22.type",
2980
16
        FT_UINT8, BASE_HEX,
2981
16
        VALS(sna_nlp_opti_22_type_vals), 0xc0, NULL, HFILL }},
2982
2983
16
    { &hf_sna_nlp_opti_22_raa,
2984
16
      { "Rate Adjustment Action",
2985
16
        "sna.nlp.thdr.optional.22.raa",
2986
16
        FT_UINT8, BASE_HEX,
2987
16
        VALS(sna_nlp_opti_22_raa_vals), 0x38, NULL, HFILL }},
2988
2989
16
    { &hf_sna_nlp_opti_22_parity,
2990
16
      { "Parity Indicator",
2991
16
        "sna.nlp.thdr.optional.22.parity",
2992
16
        FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
2993
2994
16
    { &hf_sna_nlp_opti_22_arb,
2995
16
      { "ARB Mode",
2996
16
        "sna.nlp.thdr.optional.22.arb",
2997
16
        FT_UINT8, BASE_HEX,
2998
16
        VALS(sna_nlp_opti_22_arb_vals), 0x03, NULL, HFILL }},
2999
3000
16
    { &hf_sna_nlp_opti_22_3,
3001
16
      { "Adaptive Rate Based Segment Byte 3",
3002
16
        "sna.nlp.thdr.optional.22.3",
3003
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3004
3005
16
    { &hf_sna_nlp_opti_22_ratereq,
3006
16
      { "Rate Request Correlator",
3007
16
        "sna.nlp.thdr.optional.22.ratereq",
3008
16
        FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3009
3010
16
    { &hf_sna_nlp_opti_22_raterep,
3011
16
      { "Rate Reply Correlator",
3012
16
        "sna.nlp.thdr.optional.22.raterep",
3013
16
        FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
3014
3015
16
    { &hf_sna_nlp_opti_22_field1,
3016
16
      { "Field 1", "sna.nlp.thdr.optional.22.field1",
3017
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3018
3019
16
    { &hf_sna_nlp_opti_22_field2,
3020
16
      { "Field 2", "sna.nlp.thdr.optional.22.field2",
3021
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3022
3023
16
    { &hf_sna_nlp_opti_22_field3,
3024
16
      { "Field 3", "sna.nlp.thdr.optional.22.field3",
3025
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3026
3027
16
    { &hf_sna_nlp_opti_22_field4,
3028
16
      { "Field 4", "sna.nlp.thdr.optional.22.field4",
3029
16
        FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3030
3031
16
    { &hf_sna_rh,
3032
16
      { "Request/Response Header", "sna.rh", FT_NONE, BASE_NONE,
3033
16
        NULL, 0x0, NULL, HFILL }},
3034
3035
16
    { &hf_sna_rh_0,
3036
16
      { "Request/Response Header Byte 0", "sna.rh.0", FT_UINT8,
3037
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
3038
3039
16
    { &hf_sna_rh_1,
3040
16
      { "Request/Response Header Byte 1", "sna.rh.1", FT_UINT8,
3041
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
3042
3043
16
    { &hf_sna_rh_2,
3044
16
      { "Request/Response Header Byte 2", "sna.rh.2", FT_UINT8,
3045
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
3046
3047
16
    { &hf_sna_rh_rri,
3048
16
      { "Request/Response Indicator", "sna.rh.rri", FT_BOOLEAN,
3049
16
        8, TFS(&tfs_response_request), 0x80, NULL, HFILL }},
3050
3051
16
    { &hf_sna_rh_ru_category,
3052
16
      { "Request/Response Unit Category", "sna.rh.ru_category",
3053
16
        FT_UINT8, BASE_HEX, VALS(sna_rh_ru_category_vals), 0x60,
3054
16
        NULL, HFILL }},
3055
3056
16
    { &hf_sna_rh_fi,
3057
16
      { "Format Indicator", "sna.rh.fi", FT_BOOLEAN, 8,
3058
16
        TFS(&sna_rh_fi_truth), 0x08, NULL, HFILL }},
3059
3060
16
    { &hf_sna_rh_sdi,
3061
16
      { "Sense Data Included", "sna.rh.sdi", FT_BOOLEAN, 8,
3062
16
        TFS(&tfs_included_not_included), 0x04, NULL, HFILL }},
3063
3064
16
    { &hf_sna_rh_bci,
3065
16
      { "Begin Chain Indicator", "sna.rh.bci", FT_BOOLEAN, 8,
3066
16
        TFS(&sna_rh_bci_truth), 0x02, NULL, HFILL }},
3067
3068
16
    { &hf_sna_rh_eci,
3069
16
      { "End Chain Indicator", "sna.rh.eci", FT_BOOLEAN, 8,
3070
16
        TFS(&sna_rh_eci_truth), 0x01, NULL, HFILL }},
3071
3072
16
    { &hf_sna_rh_dr1,
3073
16
      { "Definite Response 1 Indicator", "sna.rh.dr1", FT_BOOLEAN,
3074
16
        8, NULL, 0x80, NULL, HFILL }},
3075
3076
16
    { &hf_sna_rh_lcci,
3077
16
      { "Length-Checked Compression Indicator", "sna.rh.lcci",
3078
16
        FT_BOOLEAN, 8, TFS(&sna_rh_lcci_truth), 0x40, NULL, HFILL }},
3079
3080
16
    { &hf_sna_rh_dr2,
3081
16
      { "Definite Response 2 Indicator", "sna.rh.dr2", FT_BOOLEAN,
3082
16
        8, NULL, 0x20, NULL, HFILL }},
3083
3084
16
    { &hf_sna_rh_eri,
3085
16
      { "Exception Response Indicator", "sna.rh.eri", FT_BOOLEAN,
3086
16
        8, NULL, 0x10, NULL, HFILL }},
3087
3088
16
    { &hf_sna_rh_rti,
3089
16
      { "Response Type Indicator", "sna.rh.rti", FT_BOOLEAN,
3090
16
        8, TFS(&sna_rh_rti_truth), 0x10, NULL, HFILL }},
3091
3092
16
    { &hf_sna_rh_rlwi,
3093
16
      { "Request Larger Window Indicator", "sna.rh.rlwi", FT_BOOLEAN,
3094
16
        8, NULL, 0x04, NULL, HFILL }},
3095
3096
16
    { &hf_sna_rh_qri,
3097
16
      { "Queued Response Indicator", "sna.rh.qri", FT_BOOLEAN,
3098
16
        8, TFS(&sna_rh_qri_truth), 0x02, NULL, HFILL }},
3099
3100
16
    { &hf_sna_rh_pi,
3101
16
      { "Pacing Indicator", "sna.rh.pi", FT_BOOLEAN,
3102
16
        8, NULL, 0x01, NULL, HFILL }},
3103
3104
16
    { &hf_sna_rh_bbi,
3105
16
      { "Begin Bracket Indicator", "sna.rh.bbi", FT_BOOLEAN,
3106
16
        8, NULL, 0x80, NULL, HFILL }},
3107
3108
16
    { &hf_sna_rh_ebi,
3109
16
      { "End Bracket Indicator", "sna.rh.ebi", FT_BOOLEAN,
3110
16
        8, NULL, 0x40, NULL, HFILL }},
3111
3112
16
    { &hf_sna_rh_cdi,
3113
16
      { "Change Direction Indicator", "sna.rh.cdi", FT_BOOLEAN,
3114
16
        8, NULL, 0x20, NULL, HFILL }},
3115
3116
16
    { &hf_sna_rh_csi,
3117
16
      { "Code Selection Indicator", "sna.rh.csi", FT_UINT8, BASE_DEC,
3118
16
        VALS(sna_rh_csi_vals), 0x08, NULL, HFILL }},
3119
3120
16
    { &hf_sna_rh_edi,
3121
16
      { "Enciphered Data Indicator", "sna.rh.edi", FT_BOOLEAN, 8,
3122
16
        NULL, 0x04, NULL, HFILL }},
3123
3124
16
    { &hf_sna_rh_pdi,
3125
16
      { "Padded Data Indicator", "sna.rh.pdi", FT_BOOLEAN, 8, NULL,
3126
16
        0x02, NULL, HFILL }},
3127
3128
16
    { &hf_sna_rh_cebi,
3129
16
      { "Conditional End Bracket Indicator", "sna.rh.cebi",
3130
16
        FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3131
3132
/*    { &hf_sna_ru,
3133
    { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE,
3134
    NULL, 0x0, NULL, HFILL }},*/
3135
3136
16
    { &hf_sna_gds,
3137
16
      { "GDS Variable", "sna.gds", FT_NONE, BASE_NONE, NULL, 0x0,
3138
16
        NULL, HFILL }},
3139
3140
16
    { &hf_sna_gds_len,
3141
16
      { "GDS Variable Length", "sna.gds.len", FT_UINT16, BASE_DEC,
3142
16
        NULL, 0x7fff, NULL, HFILL }},
3143
3144
16
    { &hf_sna_gds_cont,
3145
16
      { "Continuation Flag", "sna.gds.cont", FT_BOOLEAN, 16, NULL,
3146
16
        0x8000, NULL, HFILL }},
3147
3148
16
    { &hf_sna_gds_type,
3149
16
      { "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
3150
16
        VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
3151
3152
16
    { &hf_sna_gds_info,
3153
16
      { "Information", "sna.gds.info", FT_BYTES, BASE_NONE,
3154
16
        NULL, 0x0, NULL, HFILL }},
3155
3156
#if 0
3157
    { &hf_sna_xid,
3158
      { "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,
3159
        "XID Frame", HFILL }},
3160
#endif
3161
3162
16
    { &hf_sna_xid_0,
3163
16
      { "XID Byte 0", "sna.xid.0", FT_UINT8, BASE_HEX, NULL, 0x0,
3164
16
        NULL, HFILL }},
3165
3166
16
    { &hf_sna_xid_format,
3167
16
      { "XID Format", "sna.xid.format", FT_UINT8, BASE_DEC, NULL,
3168
16
        0xf0, NULL, HFILL }},
3169
3170
16
    { &hf_sna_xid_type,
3171
16
      { "XID Type", "sna.xid.type", FT_UINT8, BASE_DEC,
3172
16
        VALS(sna_xid_type_vals), 0x0f, NULL, HFILL }},
3173
3174
16
    { &hf_sna_xid_len,
3175
16
      { "XID Length", "sna.xid.len", FT_UINT8, BASE_DEC, NULL, 0x0,
3176
16
        NULL, HFILL }},
3177
3178
16
    { &hf_sna_xid_id,
3179
16
      { "Node Identification", "sna.xid.id", FT_UINT32, BASE_HEX,
3180
16
        NULL, 0x0, NULL, HFILL }},
3181
3182
16
    { &hf_sna_xid_idblock,
3183
16
      { "ID Block", "sna.xid.idblock", FT_UINT32, BASE_HEX, NULL,
3184
16
        0xfff00000, NULL, HFILL }},
3185
3186
16
    { &hf_sna_xid_idnum,
3187
16
      { "ID Number", "sna.xid.idnum", FT_UINT32, BASE_HEX, NULL,
3188
16
        0x0fffff, NULL, HFILL }},
3189
3190
16
    { &hf_sna_xid_3_8,
3191
16
      { "Characteristics of XID sender", "sna.xid.type3.8", FT_UINT16,
3192
16
        BASE_HEX, NULL, 0x0, NULL, HFILL }},
3193
3194
16
    { &hf_sna_xid_3_init_self,
3195
16
      { "INIT-SELF support", "sna.xid.type3.initself",
3196
16
        FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3197
3198
16
    { &hf_sna_xid_3_stand_bind,
3199
16
      { "Stand-Alone BIND Support", "sna.xid.type3.stand_bind",
3200
16
        FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3201
3202
16
    { &hf_sna_xid_3_gener_bind,
3203
16
      { "Whole BIND PIU generated indicator",
3204
16
        "sna.xid.type3.gener_bind", FT_BOOLEAN, 16, NULL, 0x2000,
3205
16
        NULL, HFILL }},
3206
3207
16
    { &hf_sna_xid_3_recve_bind,
3208
16
      { "Whole BIND PIU required indicator",
3209
16
        "sna.xid.type3.recve_bind", FT_BOOLEAN, 16, NULL, 0x1000,
3210
16
        NULL, HFILL }},
3211
3212
16
    { &hf_sna_xid_3_actpu,
3213
16
      { "ACTPU suppression indicator", "sna.xid.type3.actpu",
3214
16
        FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
3215
3216
16
    { &hf_sna_xid_3_nwnode,
3217
16
      { "Sender is network node", "sna.xid.type3.nwnode",
3218
16
        FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
3219
3220
16
    { &hf_sna_xid_3_cp,
3221
16
      { "Control Point Services", "sna.xid.type3.cp",
3222
16
        FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }},
3223
3224
16
    { &hf_sna_xid_3_cpcp,
3225
16
      { "CP-CP session support", "sna.xid.type3.cpcp",
3226
16
        FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }},
3227
3228
16
    { &hf_sna_xid_3_state,
3229
16
      { "XID exchange state indicator", "sna.xid.type3.state",
3230
16
        FT_UINT16, BASE_HEX, VALS(sna_xid_3_state_vals),
3231
16
        0x000c, NULL, HFILL }},
3232
3233
16
    { &hf_sna_xid_3_nonact,
3234
16
      { "Nonactivation Exchange", "sna.xid.type3.nonact",
3235
16
        FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
3236
3237
16
    { &hf_sna_xid_3_cpchange,
3238
16
      { "CP name change support", "sna.xid.type3.cpchange",
3239
16
        FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3240
3241
16
    { &hf_sna_xid_3_10,
3242
16
      { "XID Type 3 Byte 10", "sna.xid.type3.10", FT_UINT8, BASE_HEX,
3243
16
        NULL, 0x0, NULL, HFILL }},
3244
3245
16
    { &hf_sna_xid_3_asend_bind,
3246
16
      { "Adaptive BIND pacing support as sender",
3247
16
        "sna.xid.type3.asend_bind", FT_BOOLEAN, 8, NULL, 0x80,
3248
16
        NULL, HFILL }},
3249
3250
16
    { &hf_sna_xid_3_arecv_bind,
3251
16
      { "Adaptive BIND pacing support as receiver",
3252
16
        "sna.xid.type3.asend_recv", FT_BOOLEAN, 8, NULL, 0x40,
3253
16
        NULL, HFILL }},
3254
3255
16
    { &hf_sna_xid_3_quiesce,
3256
16
      { "Quiesce TG Request",
3257
16
        "sna.xid.type3.quiesce", FT_BOOLEAN, 8, NULL, 0x20,
3258
16
        NULL, HFILL }},
3259
3260
16
    { &hf_sna_xid_3_pucap,
3261
16
      { "PU Capabilities",
3262
16
        "sna.xid.type3.pucap", FT_BOOLEAN, 8, NULL, 0x10,
3263
16
        NULL, HFILL }},
3264
3265
16
    { &hf_sna_xid_3_pbn,
3266
16
      { "Peripheral Border Node",
3267
16
        "sna.xid.type3.pbn", FT_BOOLEAN, 8, NULL, 0x08,
3268
16
        NULL, HFILL }},
3269
3270
16
    { &hf_sna_xid_3_pacing,
3271
16
      { "Qualifier for adaptive BIND pacing support",
3272
16
        "sna.xid.type3.pacing", FT_UINT8, BASE_HEX, NULL, 0x03,
3273
16
        NULL, HFILL }},
3274
3275
16
    { &hf_sna_xid_3_11,
3276
16
      { "XID Type 3 Byte 11", "sna.xid.type3.11", FT_UINT8, BASE_HEX,
3277
16
        NULL, 0x0, NULL, HFILL }},
3278
3279
16
    { &hf_sna_xid_3_tgshare,
3280
16
      { "TG Sharing Prohibited Indicator",
3281
16
        "sna.xid.type3.tgshare", FT_BOOLEAN, 8, NULL, 0x40,
3282
16
        NULL, HFILL }},
3283
3284
16
    { &hf_sna_xid_3_dedsvc,
3285
16
      { "Dedicated SVC Indicator",
3286
16
        "sna.xid.type3.dedsvc", FT_BOOLEAN, 8, NULL, 0x20,
3287
16
        NULL, HFILL }},
3288
3289
16
    { &hf_sna_xid_3_12,
3290
16
      { "XID Type 3 Byte 12", "sna.xid.type3.12", FT_UINT8, BASE_HEX,
3291
16
        NULL, 0x0, NULL, HFILL }},
3292
3293
16
    { &hf_sna_xid_3_negcsup,
3294
16
      { "Negotiation Complete Supported",
3295
16
        "sna.xid.type3.negcsup", FT_BOOLEAN, 8, NULL, 0x80,
3296
16
        NULL, HFILL }},
3297
3298
16
    { &hf_sna_xid_3_negcomp,
3299
16
      { "Negotiation Complete",
3300
16
        "sna.xid.type3.negcomp", FT_BOOLEAN, 8, NULL, 0x40,
3301
16
        NULL, HFILL }},
3302
3303
16
    { &hf_sna_xid_3_15,
3304
16
      { "XID Type 3 Byte 15", "sna.xid.type3.15", FT_UINT8, BASE_HEX,
3305
16
        NULL, 0x0, NULL, HFILL }},
3306
3307
16
    { &hf_sna_xid_3_partg,
3308
16
      { "Parallel TG Support",
3309
16
        "sna.xid.type3.partg", FT_BOOLEAN, 8, NULL, 0x80,
3310
16
        NULL, HFILL }},
3311
3312
16
    { &hf_sna_xid_3_dlur,
3313
16
      { "Dependent LU Requester Indicator",
3314
16
        "sna.xid.type3.dlur", FT_BOOLEAN, 8, NULL, 0x40,
3315
16
        NULL, HFILL }},
3316
3317
16
    { &hf_sna_xid_3_dlus,
3318
16
      { "DLUS Served LU Registration Indicator",
3319
16
        "sna.xid.type3.dlus", FT_BOOLEAN, 8, NULL, 0x20,
3320
16
        NULL, HFILL }},
3321
3322
16
    { &hf_sna_xid_3_exbn,
3323
16
      { "Extended HPR Border Node",
3324
16
        "sna.xid.type3.exbn", FT_BOOLEAN, 8, NULL, 0x10,
3325
16
        NULL, HFILL }},
3326
3327
16
    { &hf_sna_xid_3_genodai,
3328
16
      { "Generalized ODAI Usage Option",
3329
16
        "sna.xid.type3.genodai", FT_BOOLEAN, 8, NULL, 0x08,
3330
16
        NULL, HFILL }},
3331
3332
16
    { &hf_sna_xid_3_branch,
3333
16
      { "Branch Indicator", "sna.xid.type3.branch",
3334
16
        FT_UINT8, BASE_HEX, VALS(sna_xid_3_branch_vals),
3335
16
        0x06, NULL, HFILL }},
3336
3337
16
    { &hf_sna_xid_3_brnn,
3338
16
      { "Option Set 1123 Indicator",
3339
16
        "sna.xid.type3.brnn", FT_BOOLEAN, 8, NULL, 0x01,
3340
16
        NULL, HFILL }},
3341
3342
16
    { &hf_sna_xid_3_tg,
3343
16
      { "XID TG", "sna.xid.type3.tg", FT_UINT8, BASE_HEX, NULL, 0x0,
3344
16
        NULL, HFILL }},
3345
3346
16
    { &hf_sna_xid_3_dlc,
3347
16
      { "XID DLC", "sna.xid.type3.dlc", FT_UINT8, BASE_HEX, NULL, 0x0,
3348
16
        NULL, HFILL }},
3349
3350
16
    { &hf_sna_xid_3_dlen,
3351
16
      { "DLC Dependent Section Length", "sna.xid.type3.dlen",
3352
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3353
3354
16
    { &hf_sna_control_len,
3355
16
      { "Control Vector Length", "sna.control.len",
3356
16
        FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3357
3358
16
    { &hf_sna_control_key,
3359
16
      { "Control Vector Key", "sna.control.key",
3360
16
        FT_UINT8, BASE_HEX, VALS(sna_control_vals), 0x0, NULL,
3361
16
        HFILL }},
3362
3363
16
    { &hf_sna_control_hprkey,
3364
16
      { "Control Vector HPR Key", "sna.control.hprkey",
3365
16
        FT_UINT8, BASE_HEX, VALS(sna_control_hpr_vals), 0x0, NULL,
3366
16
        HFILL }},
3367
3368
16
    { &hf_sna_control_05_delay,
3369
16
      { "Channel Delay", "sna.control.05.delay",
3370
16
        FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3371
3372
16
    { &hf_sna_control_05_type,
3373
16
      { "Network Address Type", "sna.control.05.type",
3374
16
        FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3375
3376
16
    { &hf_sna_control_05_ptp,
3377
16
      { "Point-to-point", "sna.control.05.ptp",
3378
16
        FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
3379
3380
16
    { &hf_sna_control_0e_type,
3381
16
      { "Type", "sna.control.0e.type",
3382
16
        FT_UINT8, BASE_HEX, VALS(sna_control_0e_type_vals),
3383
16
        0, NULL, HFILL }},
3384
3385
16
    { &hf_sna_control_0e_value,
3386
16
      { "Value", "sna.control.0e.value",
3387
16
        FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
3388
3389
16
    { &hf_sna_padding,
3390
16
      { "Padding", "sna.padding",
3391
16
        FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3392
3393
16
    { &hf_sna_reserved,
3394
16
      { "Reserved", "sna.reserved",
3395
16
        FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3396
3397
16
    { &hf_sna_biu_segment_data,
3398
16
      { "BIU segment data", "sna.biu_segment_data",
3399
16
        FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
3400
3401
16
  };
3402
16
  static int *ett[] = {
3403
16
    &ett_sna,
3404
16
    &ett_sna_th,
3405
16
    &ett_sna_th_fid,
3406
16
    &ett_sna_nlp_nhdr,
3407
16
    &ett_sna_nlp_nhdr_0,
3408
16
    &ett_sna_nlp_nhdr_1,
3409
16
    &ett_sna_nlp_thdr,
3410
16
    &ett_sna_nlp_thdr_8,
3411
16
    &ett_sna_nlp_thdr_9,
3412
16
    &ett_sna_nlp_opti_un,
3413
16
    &ett_sna_nlp_opti_0d,
3414
16
    &ett_sna_nlp_opti_0d_4,
3415
16
    &ett_sna_nlp_opti_0e,
3416
16
    &ett_sna_nlp_opti_0e_stat,
3417
16
    &ett_sna_nlp_opti_0e_absp,
3418
16
    &ett_sna_nlp_opti_0f,
3419
16
    &ett_sna_nlp_opti_10,
3420
16
    &ett_sna_nlp_opti_12,
3421
16
    &ett_sna_nlp_opti_14,
3422
16
    &ett_sna_nlp_opti_14_si,
3423
16
    &ett_sna_nlp_opti_14_si_2,
3424
16
    &ett_sna_nlp_opti_14_rr,
3425
16
    &ett_sna_nlp_opti_14_rr_2,
3426
16
    &ett_sna_nlp_opti_22,
3427
16
    &ett_sna_nlp_opti_22_2,
3428
16
    &ett_sna_nlp_opti_22_3,
3429
16
    &ett_sna_rh,
3430
16
    &ett_sna_rh_0,
3431
16
    &ett_sna_rh_1,
3432
16
    &ett_sna_rh_2,
3433
16
    &ett_sna_gds,
3434
16
    &ett_sna_xid_0,
3435
16
    &ett_sna_xid_id,
3436
16
    &ett_sna_xid_3_8,
3437
16
    &ett_sna_xid_3_10,
3438
16
    &ett_sna_xid_3_11,
3439
16
    &ett_sna_xid_3_12,
3440
16
    &ett_sna_xid_3_15,
3441
16
    &ett_sna_control_un,
3442
16
    &ett_sna_control_05,
3443
16
    &ett_sna_control_05hpr,
3444
16
    &ett_sna_control_05hpr_type,
3445
16
    &ett_sna_control_0e,
3446
16
  };
3447
16
  module_t *sna_module;
3448
3449
16
  proto_sna = proto_register_protocol("Systems Network Architecture", "SNA", "sna");
3450
16
  proto_register_field_array(proto_sna, hf, array_length(hf));
3451
16
  proto_register_subtree_array(ett, array_length(ett));
3452
16
  sna_handle = register_dissector("sna", dissect_sna, proto_sna);
3453
3454
16
  proto_sna_xid = proto_register_protocol("Systems Network Architecture XID", "SNA XID", "sna_xid");
3455
16
  sna_xid_handle = register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
3456
3457
16
  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);
3458
3459
  /* Register configuration options */
3460
16
  sna_module = prefs_register_protocol(proto_sna, NULL);
3461
16
  prefs_register_bool_preference(sna_module, "defragment",
3462
16
    "Reassemble fragmented BIUs",
3463
16
    "Whether fragmented BIUs should be reassembled",
3464
16
    &sna_defragment);
3465
3466
16
  reassembly_table_register(&sna_reassembly_table,
3467
16
      &addresses_reassembly_table_functions);
3468
16
}
3469
3470
void
3471
proto_reg_handoff_sna(void)
3472
16
{
3473
16
  dissector_add_uint("llc.dsap", SAP_SNA_PATHCTRL, sna_handle);
3474
16
  dissector_add_uint("llc.dsap", SAP_SNA1, sna_handle);
3475
16
  dissector_add_uint("llc.dsap", SAP_SNA2, sna_handle);
3476
16
  dissector_add_uint("llc.dsap", SAP_SNA3, sna_handle);
3477
16
  dissector_add_uint("llc.dsap", SAP_SNA4, sna_handle);
3478
16
  dissector_add_uint("llc.xid_dsap", SAP_SNA_PATHCTRL, sna_xid_handle);
3479
16
  dissector_add_uint("llc.xid_dsap", SAP_SNA1, sna_xid_handle);
3480
16
  dissector_add_uint("llc.xid_dsap", SAP_SNA2, sna_xid_handle);
3481
16
  dissector_add_uint("llc.xid_dsap", SAP_SNA3, sna_xid_handle);
3482
  /* RFC 2043 */
3483
16
  dissector_add_uint("ppp.protocol", PPP_SNA, sna_handle);
3484
16
}
3485
3486
/*
3487
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
3488
 *
3489
 * Local variables:
3490
 * c-basic-offset: 8
3491
 * tab-width: 8
3492
 * indent-tabs-mode: t
3493
 * End:
3494
 *
3495
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
3496
 * :indentSize=8:tabSize=8:noTabs=false:
3497
 */