Coverage Report

Created: 2025-12-27 06:52

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