Coverage Report

Created: 2025-08-04 07:15

/src/wireshark/epan/dissectors/packet-fcdns.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-fcdns.c
2
 * Routines for FC distributed Name Server (dNS)
3
 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
#include "config.h"
12
13
#include <epan/packet.h>
14
#include <epan/expert.h>
15
#include <epan/tfs.h>
16
#include "packet-fc.h"
17
#include "packet-fcct.h"
18
#include "packet-fcswils.h"
19
20
void proto_register_fcdns(void);
21
void proto_reg_handoff_fcdns(void);
22
23
/*
24
 * See FC-GS-2.
25
 */
26
27
static dissector_handle_t dns_handle;
28
29
/* protocol and registered fields */
30
31
/* Opcode definitions */
32
0
#define FCDNS_GA_NXT   0x0100
33
#define FCDNS_GID_A    0x0101
34
0
#define FCDNS_GPN_ID   0x0112
35
0
#define FCDNS_GNN_ID   0x0113
36
0
#define FCDNS_GCS_ID   0x0114
37
0
#define FCDNS_GFT_ID   0x0117
38
0
#define FCDNS_GSPN_ID  0x0118
39
0
#define FCDNS_GPT_ID   0x011A
40
#define FCDNS_GIPP_ID  0x011B
41
0
#define FCDNS_GFPN_ID  0x011C
42
#define FCDNS_GHA_ID   0x011D
43
0
#define FCDNS_GFD_ID   0x011E
44
0
#define FCDNS_GFF_ID   0x011F
45
0
#define FCDNS_GID_PN   0x0121
46
0
#define FCDNS_GIPP_PN  0x012B
47
0
#define FCDNS_GID_NN   0x0131
48
0
#define FCDNS_GPN_NN   0x0132
49
0
#define FCDNS_GIP_NN   0x0135
50
#define FCDNS_GIPA_NN  0x0136
51
0
#define FCDNS_GSNN_NN  0x0139
52
#define FCDNS_GNN_IP   0x0153
53
#define FCDNS_GIPA_IP  0x0156
54
0
#define FCDNS_GID_FT   0x0171
55
0
#define FCDNS_GPN_FT   0x0172
56
0
#define FCDNS_GNN_FT   0x0173
57
0
#define FCDNS_GID_PT   0x01A1
58
0
#define FCDNS_GID_IPP  0x01B1
59
#define FCDNS_GPN_IPP  0x01B2
60
0
#define FCDNS_GID_FF   0x01F1
61
0
#define FCDNS_RPN_ID   0x0212
62
0
#define FCDNS_RNN_ID   0x0213
63
0
#define FCDNS_RCS_ID   0x0214
64
0
#define FCDNS_RFT_ID   0x0217
65
0
#define FCDNS_RSPN_ID  0x0218
66
0
#define FCDNS_RPT_ID   0x021A
67
0
#define FCDNS_RIPP_ID  0x021B
68
#define FCDNS_RHA_ID   0x021D
69
0
#define FCDNS_RFD_ID   0x021E
70
0
#define FCDNS_RFF_ID   0x021F
71
0
#define FCDNS_RIP_NN   0x0235
72
0
#define FCDNS_RSNN_NN  0x0239
73
0
#define FCDNS_DA_ID    0x0300
74
/* dNS messages defined by FC-SW2 */
75
#define FCDNS_RA       0x0
76
0
#define FCDNS_GE_ID    0x0410
77
0
#define FCDNS_GE_PN    0x0420
78
0
#define FCDNS_GE_NN    0x0430
79
0
#define FCDNS_GE_IP    0x0450
80
0
#define FCDNS_GE_FT    0x0470
81
0
#define FCDNS_GE_PT    0x04A0
82
0
#define FCDNS_GE_ZM    0x04B0
83
0
#define FCDNS_GE_ZN    0x04C0
84
0
#define FCDNS_GE_IPP   0x04D0
85
0
#define FCDNS_GE_FF    0x04E0
86
87
static const value_string fc_dns_opcode_val[] = {
88
    {FCDNS_GA_NXT, "GA_NXT"  },
89
    {FCDNS_GID_A,  "GID_A"   },
90
    {FCDNS_GPN_ID, "GPN_ID"  },
91
    {FCDNS_GNN_ID, "GNN_ID"  },
92
    {FCDNS_GCS_ID, "GCS_ID"  },
93
    {FCDNS_GFT_ID, "GFT_ID"  },
94
    {FCDNS_GSPN_ID, "GSPN_ID" },
95
    {FCDNS_GPT_ID, "GPT_ID"  },
96
    {FCDNS_GIPP_ID, "GIPP_ID" },
97
    {FCDNS_GFPN_ID, "GFPN_ID" },
98
    {FCDNS_GHA_ID, "GHA_ID"  },
99
    {FCDNS_GFD_ID, "GFD_ID"  },
100
    {FCDNS_GFF_ID, "GFF_ID"  },
101
    {FCDNS_GID_PN, "GID_PN"  },
102
    {FCDNS_GIPP_PN, "GIPP_PN" },
103
    {FCDNS_GID_NN, "GID_NN"  },
104
    {FCDNS_GPN_NN, "GPN_NN"  },
105
    {FCDNS_GIP_NN, "GIP_NN"  },
106
    {FCDNS_GIPA_NN, "GIPA_NN" },
107
    {FCDNS_GSNN_NN, "GSNN_NN" },
108
    {FCDNS_GNN_IP, "GNN_IP"  },
109
    {FCDNS_GIPA_IP, "GIPA_IP" },
110
    {FCDNS_GID_FT, "GID_FT"  },
111
    {FCDNS_GPN_FT, "GPN_FT"  },
112
    {FCDNS_GNN_FT, "GNN_FT"  },
113
    {FCDNS_GID_PT, "GID_PT"  },
114
    {FCDNS_GID_IPP, "GID_IPP" },
115
    {FCDNS_GPN_IPP, "GPN_IPP" },
116
    {FCDNS_GID_FF, "GID_FF"  },
117
    {FCDNS_RPN_ID, "RPN_ID"  },
118
    {FCDNS_RNN_ID, "RNN_ID"  },
119
    {FCDNS_RCS_ID, "RCS_ID"  },
120
    {FCDNS_RFT_ID, "RFT_ID"  },
121
    {FCDNS_RSPN_ID, "RSPN_ID" },
122
    {FCDNS_RPT_ID, "RPT_ID"  },
123
    {FCDNS_RIPP_ID, "RIPP_ID" },
124
    {FCDNS_RHA_ID, "RHA_ID"  },
125
    {FCDNS_RFD_ID, "RFD_ID"  },
126
    {FCDNS_RFF_ID, "RFF_ID"  },
127
    {FCDNS_RIP_NN, "RIP_NN"  },
128
    {FCDNS_RSNN_NN, "RSNN_NN"},
129
    {FCDNS_DA_ID, "DA_ID"},
130
    {FCDNS_GE_ID, "GE_ID"},
131
    {FCDNS_GE_PN, "GE_PN"},
132
    {FCDNS_GE_NN, "GE_NN"},
133
    {FCDNS_GE_IP, "GE_IP"},
134
    {FCDNS_GE_FT, "GE_FT"},
135
    {FCDNS_GE_PT, "GE_PT"},
136
    {FCDNS_GE_ZM, "GE_ZM"},
137
    {FCDNS_GE_ZN, "GE_ZN"},
138
    {FCDNS_GE_IPP, "GE_IPP"},
139
    {FCDNS_GE_FF, "GE_FF"},
140
    {FCCT_MSG_ACC, "MSG_ACC"},
141
    {FCCT_MSG_RJT, "MSG_RJT"},
142
    {0, NULL},
143
};
144
145
/* Port type definitions */
146
#define FCDNS_PTYPE_UNDEF    0x00
147
#define FCDNS_PTYPE_NPORT    0x01
148
#define FCDNS_PTYPE_NLPORT   0x02
149
#define FCDNS_PTYPE_FNLPORT  0x03
150
#define FCDNS_PTYPE_NXPORT   0x7F
151
#define FCDNS_PTYPE_FPORT    0x81
152
#define FCDNS_PTYPE_FLPORT   0x82
153
#define FCDNS_PTYPE_EPORT    0x84
154
#define FCDNS_PTYPE_BPORT    0x85
155
156
static const value_string fc_dns_port_type_val [] = {
157
    {FCDNS_PTYPE_UNDEF   , "Undefined Port Type"},
158
    {FCDNS_PTYPE_NPORT   , "N_Port"},
159
    {FCDNS_PTYPE_NLPORT  , "NL_Port"},
160
    {FCDNS_PTYPE_FNLPORT , "F/NL_Port"},
161
    {FCDNS_PTYPE_NXPORT  , "Nx_Port"},
162
    {FCDNS_PTYPE_FPORT   , "F_Port"},
163
    {FCDNS_PTYPE_FLPORT  , "FL_Port"},
164
    {FCDNS_PTYPE_EPORT   , "E_Port"},
165
    {FCDNS_PTYPE_BPORT   , "B_Port"},
166
    {0, NULL},
167
};
168
169
/* Reject Detailed Reason code definitions for dNS */
170
#define FCDNS_RJT_NOREASON          0x00
171
#define FCDNS_RJT_PIDNOTREG         0x01
172
#define FCDNS_RJT_PNAMENOTREG       0x02
173
#define FCDNS_RJT_NNAMENOTREG       0x03
174
#define FCDNS_RJT_CLASSNOTREG       0x04
175
#define FCDNS_RJT_IPNNOTREG         0x05
176
#define FCDNS_RJT_IPANOTREG         0x06
177
#define FCDNS_RJT_FC4NOTREG         0x07
178
#define FCDNS_RJT_SPNAMENOTREG      0x08
179
#define FCDNS_RJT_SNNAMENOTREG      0x09
180
#define FCDNS_RJT_PTYPENOTREG       0x0A
181
#define FCDNS_RJT_IPPNOTREG         0x0B
182
#define FCDNS_RJT_FPNAMENOTREG      0x0C
183
#define FCDNS_RJT_HRDADDNOTREG      0x0D
184
#define FCDNS_RJT_FC4DESNOTREG      0x0E
185
#define FCDNS_RJT_FC4FEANOTREG      0x0F
186
#define FCDNS_RJT_ACCRJT            0x10
187
#define FCDNS_RJT_PTYPEFMT          0x11
188
#define FCDNS_RJT_DBEMPTY           0x12
189
#define FCDNS_RJT_NOOBJSCOPE        0x13
190
#define FCDNS_RJT_AUTHRZN_EXCEPTION 0xF0
191
#define FCDNS_RJT_AUTH_EXCEPTION    0xF1
192
#define FCDNS_RJT_DB_FULL           0xF2
193
#define FCDNS_RJT_DB_EMPTY          0xF3
194
195
static const value_string fc_dns_rjt_det_code_val [] = {
196
    {FCDNS_RJT_NOREASON    , "No Additional Info"},
197
    {FCDNS_RJT_PIDNOTREG   , "PortID Not Regd."},
198
    {FCDNS_RJT_PNAMENOTREG , "PortName Not Regd."},
199
    {FCDNS_RJT_NNAMENOTREG , "NodeName Not Regd."},
200
    {FCDNS_RJT_CLASSNOTREG , "Class Not Regd."},
201
    {FCDNS_RJT_IPNNOTREG   , "IP Addr (Node) Not Regd."},
202
    {FCDNS_RJT_IPANOTREG   , "IPA Not Regd."},
203
    {FCDNS_RJT_FC4NOTREG   , "FC4 TYPEs Not Regd."},
204
    {FCDNS_RJT_SPNAMENOTREG, "Symbolic PortName Not Regd."},
205
    {FCDNS_RJT_SNNAMENOTREG, "Symbolic NodeName Not Regd."},
206
    {FCDNS_RJT_PTYPENOTREG , "PortType Not Regd."},
207
    {FCDNS_RJT_IPPNOTREG   , "IP Addr (Port) Not Regd."},
208
    {FCDNS_RJT_FPNAMENOTREG, "Fabric Port Name Not Regd."},
209
    {FCDNS_RJT_HRDADDNOTREG, "Hard Addr Not Regd."},
210
    {FCDNS_RJT_FC4DESNOTREG, "FC4 Descriptors Not Regd."},
211
    {FCDNS_RJT_FC4FEANOTREG, "FC4 Features Not Regd."},
212
    {FCDNS_RJT_ACCRJT      , "Access Denied"},
213
    {FCDNS_RJT_PTYPEFMT    , "Unacceptable PortId"},
214
    {FCDNS_RJT_DBEMPTY     , "Database Empty"},
215
    {FCDNS_RJT_NOOBJSCOPE  , "No Objects Regd. in Scope"},
216
    {FCDNS_RJT_AUTHRZN_EXCEPTION, "Authorization Exception"},
217
    {FCDNS_RJT_AUTH_EXCEPTION, "Authentication Exception"},
218
    {FCDNS_RJT_DB_FULL, "Database Full"},
219
    {FCDNS_RJT_DB_EMPTY, "Database Empty"},
220
    {0, NULL},
221
};
222
223
/* Actual servers serving the directory service type identified by subtype */
224
#define FCDNS_GSSUBTYPE_DNS  0x02
225
#define FCDNS_GSSUBTYPE_IP   0x03
226
227
static int proto_fcdns;
228
229
static int hf_fcdns_cos_1;
230
static int hf_fcdns_cos_2;
231
static int hf_fcdns_cos_3;
232
static int hf_fcdns_cos_4;
233
static int hf_fcdns_cos_6;
234
static int hf_fcdns_cos_f;
235
static int hf_fcdns_fc4features;
236
static int hf_fcdns_fc4features_i;
237
static int hf_fcdns_fc4features_t;
238
static int hf_fcdns_fc4type;
239
static int hf_fcdns_fc4type_fcp;
240
static int hf_fcdns_fc4type_gs3;
241
static int hf_fcdns_fc4type_ip;
242
static int hf_fcdns_fc4type_llcsnap;
243
static int hf_fcdns_fc4type_snmp;
244
static int hf_fcdns_fc4type_swils;
245
static int hf_fcdns_fc4type_vi;
246
static int hf_fcdns_id_length;
247
static int hf_fcdns_maxres_size;
248
static int hf_fcdns_num_entries;
249
static int hf_fcdns_num_fc4desc;
250
static int hf_fcdns_opcode;
251
static int hf_fcdns_portip;
252
static int hf_fcdns_reason;
253
static int hf_fcdns_reply_cos;
254
static int hf_fcdns_req_areascope;
255
static int hf_fcdns_req_cos;
256
static int hf_fcdns_req_domainscope;
257
static int hf_fcdns_req_fc4type;
258
static int hf_fcdns_req_fc4types;
259
static int hf_fcdns_req_fdesc;
260
static int hf_fcdns_req_fdesclen;
261
static int hf_fcdns_req_ip;
262
static int hf_fcdns_req_nname;
263
static int hf_fcdns_req_pname;
264
static int hf_fcdns_req_portid;
265
static int hf_fcdns_req_ptype;
266
static int hf_fcdns_req_sname;
267
static int hf_fcdns_req_snamelen;
268
static int hf_fcdns_req_spname;
269
static int hf_fcdns_req_spnamelen;
270
static int hf_fcdns_rjtdetail;
271
static int hf_fcdns_rply_fc4desc;
272
static int hf_fcdns_rply_fc4desclen;
273
static int hf_fcdns_rply_fc4type;
274
static int hf_fcdns_rply_fpname;
275
static int hf_fcdns_rply_gft;
276
static int hf_fcdns_rply_hrdaddr;
277
static int hf_fcdns_rply_ipa;
278
static int hf_fcdns_rply_ipnode;
279
static int hf_fcdns_rply_ipport;
280
static int hf_fcdns_rply_nname;
281
static int hf_fcdns_rply_ownerid;
282
static int hf_fcdns_rply_pname;
283
static int hf_fcdns_rply_portid;
284
static int hf_fcdns_rply_ptype;
285
static int hf_fcdns_rply_sname;
286
static int hf_fcdns_rply_snamelen;
287
static int hf_fcdns_rply_spname;
288
static int hf_fcdns_rply_spnamelen;
289
static int hf_fcdns_sw2_objfmt;
290
static int hf_fcdns_vendor;
291
static int hf_fcdns_zone_flags;
292
static int hf_fcdns_zone_mbrid;
293
static int hf_fcdns_zone_mbrid_fc;
294
static int hf_fcdns_zone_mbrid_uint;
295
static int hf_fcdns_zone_mbrid_wwn;
296
static int hf_fcdns_zone_mbrtype;
297
static int hf_fcdns_zonelen;
298
static int hf_fcdns_zonenm;
299
300
/* Initialize the subtree pointers */
301
static int ett_fcdns;
302
static int ett_cos_flags;
303
static int ett_fc4flags;
304
static int ett_fc4features;
305
306
static expert_field ei_fcdns_no_record_of_exchange;
307
static expert_field ei_fcdns_zone_mbrid;
308
309
typedef struct _fcdns_conv_key {
310
    uint32_t conv_idx;
311
} fcdns_conv_key_t;
312
313
typedef struct _fcdns_conv_data {
314
    uint32_t opcode;
315
} fcdns_conv_data_t;
316
317
static wmem_map_t *fcdns_req_hash;
318
319
/*
320
 * Hash Functions
321
 */
322
static int
323
fcdns_equal(const void *v, const void *w)
324
0
{
325
0
  const fcdns_conv_key_t *v1 = (const fcdns_conv_key_t *)v;
326
0
  const fcdns_conv_key_t *v2 = (const fcdns_conv_key_t *)w;
327
328
0
  return (v1->conv_idx == v2->conv_idx);
329
0
}
330
331
static unsigned
332
fcdns_hash (const void *v)
333
0
{
334
0
    const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
335
0
    unsigned val;
336
337
0
    val = key->conv_idx;
338
339
0
    return val;
340
0
}
341
342
static void
343
dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
344
0
{
345
0
    static int * const flags[] = {
346
0
        &hf_fcdns_cos_f,
347
0
        &hf_fcdns_cos_1,
348
0
        &hf_fcdns_cos_2,
349
0
        &hf_fcdns_cos_3,
350
0
        &hf_fcdns_cos_4,
351
0
        &hf_fcdns_cos_6,
352
0
        NULL
353
0
    };
354
355
0
    proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfindex,
356
0
                                ett_cos_flags, flags, ENC_BIG_ENDIAN, BMT_NO_FALSE|BMT_NO_TFS);
357
0
}
358
359
360
361
/* The feature routines just decode FCP's FC-4 features field
362
 * based on the flahs in offset and the type in offset+1
363
 */
364
static void
365
dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
366
0
{
367
0
    uint8_t type;
368
0
    static int * const flags[] = {
369
0
        &hf_fcdns_fc4features_i,
370
0
        &hf_fcdns_fc4features_t,
371
0
        NULL
372
0
    };
373
374
0
    type = tvb_get_uint8(tvb, offset+1);
375
376
0
    if(type==FC_TYPE_SCSI){
377
0
        proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_fcdns_fc4features,
378
0
                                ett_fc4features, flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS);
379
0
    } else {
380
0
        proto_tree_add_item(parent_tree, hf_fcdns_fc4features, tvb, offset, 1, ENC_NA);
381
0
    }
382
383
0
    proto_tree_add_item (parent_tree, hf_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
384
0
}
385
386
/* The feature routines just decode FCP's FC-4 features field
387
 */
388
static void
389
dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
390
0
{
391
0
    static int * const flags[] = {
392
0
        &hf_fcdns_fc4features_i,
393
0
        &hf_fcdns_fc4features_t,
394
0
        NULL
395
0
    };
396
397
0
    proto_tree_add_bitmask(parent_tree, tvb, offset, hf_fcdns_fc4features,
398
0
                           ett_fc4features, flags, ENC_NA);
399
0
}
400
401
402
403
/* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
404
static void
405
dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
406
0
{
407
0
    proto_item *item;
408
0
    proto_tree *tree;
409
0
    uint32_t flags;
410
411
0
    item=proto_tree_add_item(parent_tree, hfindex, tvb, offset,
412
0
                                32, ENC_NA);
413
0
    tree=proto_item_add_subtree(item, ett_fc4flags);
414
415
0
    flags = tvb_get_ntohl (tvb, offset);
416
417
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_fcp, tvb, offset, 4, flags);
418
0
    if (flags&0x0100){
419
0
        proto_item_append_text(item, "  FCP");
420
0
    }
421
0
    flags&=(~( 0x0100 ));
422
423
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_ip, tvb, offset, 4, flags);
424
0
    if (flags&0x0020){
425
0
        proto_item_append_text(item, "  IP");
426
0
    }
427
0
    flags&=(~( 0x0020 ));
428
429
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
430
0
    if (flags&0x0010){
431
0
        proto_item_append_text(item, "  LLC/SNAP");
432
0
    }
433
    /*flags&=(~( 0x0010 ));*/
434
435
436
0
    flags = tvb_get_ntohl (tvb, offset+4);
437
438
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
439
0
    if (flags&0x0010){
440
0
        proto_item_append_text(item, "  SW_ILS");
441
0
    }
442
0
    flags&=(~( 0x0010 ));
443
444
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
445
0
    if (flags&0x0004){
446
0
        proto_item_append_text(item, "  SNMP");
447
0
    }
448
0
    flags&=(~( 0x0004 ));
449
450
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
451
0
    if (flags&0x0001){
452
0
        proto_item_append_text(item, "  GS3");
453
0
    }
454
    /*flags&=(~( 0x0001 ));*/
455
456
457
0
    flags = tvb_get_ntohl (tvb, offset+8);
458
459
0
    proto_tree_add_boolean(tree, hf_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
460
0
    if (flags&0x0001){
461
0
        proto_item_append_text(item, "  VI");
462
0
    }
463
    /*flags&=(~( 0x0001 ));*/
464
0
}
465
466
/* Code to actually dissect the packets */
467
468
/* A bunch of get routines have a similar req packet format. The first few
469
 * routines deal with this decoding. All assume that tree is valid */
470
static void
471
dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
472
0
{
473
0
    proto_tree_add_item (tree, hf_fcdns_req_portid, tvb, offset, 3, ENC_NA);
474
0
}
475
476
static void
477
dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
478
0
{
479
0
    int offset = 16;            /* past the fc_ct header */
480
0
    uint8_t len;
481
482
0
    if (req_tree) {
483
0
        if (isreq) {
484
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
485
0
        }
486
0
        else {
487
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb, offset,
488
0
                                 1, ENC_BIG_ENDIAN);
489
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
490
0
                                   offset+1, 3, ENC_NA);
491
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb,
492
0
                                   offset+4, 8, ENC_NA);
493
0
            len = tvb_get_uint8 (tvb, offset+12);
494
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb,
495
0
                                 offset+12, 1, ENC_BIG_ENDIAN);
496
0
            if (!tvb_offset_exists (tvb, 29+len))
497
0
                return;
498
499
0
            if (len) {
500
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
501
0
                                     offset+13, len, ENC_ASCII);
502
0
            }
503
504
0
            if (tvb_offset_exists (tvb, 292)) {
505
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
506
0
                                       offset+268, 8, ENC_NA);
507
0
            }
508
0
            if (tvb_offset_exists (tvb, 548)) {
509
0
                len = tvb_get_uint8 (tvb, offset+276);
510
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
511
0
                                     offset+276, 1, ENC_BIG_ENDIAN);
512
0
                if (len) {
513
0
                    proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
514
0
                                         offset+277, len, ENC_ASCII);
515
0
                }
516
0
            }
517
0
            if (tvb_offset_exists (tvb, 556)) {
518
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_ipa, tvb,
519
0
                                     offset+532, 8, ENC_NA);
520
0
            }
521
0
            if (tvb_offset_exists (tvb, 572)) {
522
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb,
523
0
                                     offset+540, 16, ENC_NA);
524
0
            }
525
0
            if (tvb_offset_exists (tvb, 576)) {
526
0
                dissect_cos_flags(req_tree, tvb, offset+556, hf_fcdns_reply_cos);
527
0
            }
528
0
            if (tvb_offset_exists (tvb, 608)) {
529
0
                dissect_fc4type(req_tree, tvb, offset+560, hf_fcdns_rply_gft);
530
0
            }
531
0
            if (tvb_offset_exists (tvb, 624)) {
532
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb,
533
0
                                     offset+592, 16, ENC_NA);
534
0
            }
535
0
            if (tvb_offset_exists (tvb, 632)) {
536
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
537
0
                                       offset+608, 8, ENC_NA);
538
0
            }
539
0
            if (tvb_offset_exists (tvb, 635)) {
540
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_hrdaddr, tvb,
541
0
                                       offset+617, 3, ENC_NA);
542
0
            }
543
0
        }
544
0
    }
545
0
}
546
547
static void
548
dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
549
0
{
550
0
    int offset = 16;            /* past the fc_ct header */
551
552
0
    if (req_tree) {
553
0
        if (isreq) {
554
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
555
0
        }
556
0
        else {
557
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb, offset,
558
0
                                   8, ENC_NA);
559
0
        }
560
0
    }
561
0
}
562
563
static void
564
dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
565
0
{
566
0
    int offset = 16;            /* past the fc_ct header */
567
568
0
    if (req_tree) {
569
0
        if (isreq) {
570
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
571
0
        }
572
0
        else {
573
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
574
0
                                   offset, 8, ENC_NA);
575
0
        }
576
0
    }
577
0
}
578
579
static void
580
dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
581
0
{
582
0
    int offset = 16;            /* past the fc_ct header */
583
584
0
    if (req_tree) {
585
0
        if (isreq) {
586
0
            dissect_fcdns_req_portid (tvb, req_tree, offset);
587
0
        }
588
0
        else {
589
0
            dissect_cos_flags(req_tree, tvb, offset, hf_fcdns_reply_cos);
590
0
        }
591
0
    }
592
0
}
593
594
static void
595
dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
596
0
{
597
0
    int offset = 16;            /* past the fc_ct header */
598
599
0
    if (req_tree) {
600
0
        if (isreq) {
601
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
602
0
        }
603
0
        else {
604
0
            dissect_fc4type(req_tree, tvb, offset, hf_fcdns_rply_gft);
605
0
        }
606
0
    }
607
0
}
608
609
static void
610
dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
611
0
{
612
0
    int offset = 16;            /* past the fc_ct header */
613
0
    uint8_t len;
614
615
0
    if (req_tree) {
616
0
        if (isreq) {
617
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
618
0
        }
619
0
        else {
620
0
            len = tvb_get_uint8 (tvb, offset);
621
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen,
622
0
                                 tvb, offset, 1, ENC_BIG_ENDIAN);
623
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
624
0
                                 offset+1, len, ENC_ASCII);
625
0
        }
626
0
    }
627
0
}
628
629
static void
630
dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
631
0
{
632
0
    int offset = 16;            /* past the fc_ct header */
633
634
0
    if (req_tree) {
635
0
        if (isreq) {
636
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
637
0
        }
638
0
        else {
639
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb,
640
0
                                 offset, 1, ENC_BIG_ENDIAN);
641
0
        }
642
0
    }
643
0
}
644
645
static void
646
dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
647
0
{
648
0
    int offset = 16;            /* past the fc_ct header */
649
650
0
    if (req_tree) {
651
0
        if (isreq) {
652
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
653
0
        }
654
0
        else {
655
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
656
0
                                   offset, 8, ENC_NA);
657
0
        }
658
0
    }
659
660
0
}
661
662
static void
663
dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
664
0
{
665
0
    int offset = 16;            /* past the fc_ct header */
666
0
    int tot_len, desclen;
667
668
0
    if (req_tree) {
669
0
        if (isreq) {
670
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
671
0
            dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_fc4type);
672
0
        }
673
0
        else {
674
0
            tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
675
0
            while (tot_len > 0) {
676
                /* The count of the descriptors is not returned and so we have
677
                 * to track the display by the length field */
678
0
                desclen = tvb_get_uint8 (tvb, offset);
679
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_fc4desc, tvb,
680
0
                                     offset, desclen, ENC_NA);
681
0
                tot_len -= 255; /* descriptors are aligned to 255 bytes */
682
0
                offset += 256;
683
0
            }
684
0
        }
685
0
    }
686
0
}
687
688
static void
689
dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
690
0
{
691
0
    int offset = 16;            /* past the fc_ct header */
692
693
0
    if (req_tree) {
694
0
        if (isreq) {
695
0
            dissect_fcdns_req_portid (tvb, req_tree, offset+1);
696
0
        }
697
0
        else {
698
0
            dissect_fc4features(req_tree, tvb, offset);
699
0
        }
700
0
    }
701
0
}
702
703
static void
704
dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
705
0
{
706
0
    int offset = 16;            /* past the fc_ct header */
707
708
0
    if (req_tree) {
709
0
        if (isreq) {
710
0
            proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
711
0
                                   offset, 8, ENC_NA);
712
0
        }
713
0
        else {
714
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
715
0
                                   offset+1, 3, ENC_NA);
716
0
        }
717
0
    }
718
0
}
719
720
static void
721
dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
722
0
{
723
0
    int offset = 16;            /* past the fc_ct header */
724
725
0
    if (req_tree) {
726
0
        if (isreq) {
727
0
            proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
728
0
                                   offset, 8, ENC_NA);
729
0
        }
730
0
        else {
731
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset,
732
0
                                 16, ENC_NA);
733
0
        }
734
0
    }
735
0
}
736
737
static void
738
dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
739
0
{
740
0
    int offset = 16;            /* past the fc_ct header */
741
0
    uint8_t islast;
742
743
0
    if (req_tree) {
744
0
        if (isreq) {
745
0
            proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
746
0
                                   offset, 8, ENC_NA);
747
0
        }
748
0
        else {
749
0
            do {
750
0
                islast = tvb_get_uint8 (tvb, offset);
751
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
752
0
                                       tvb, offset+1, 3, ENC_NA);
753
0
                offset += 4;
754
0
            } while (!(islast & 0x80));
755
0
        }
756
0
    }
757
0
}
758
759
static void
760
dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
761
0
{
762
0
    int offset = 16;            /* past the fc_ct header */
763
764
0
    if (req_tree) {
765
0
        if (isreq) {
766
0
            proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
767
0
                                   offset, 8, ENC_NA);
768
0
        }
769
0
        else {
770
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset,
771
0
                                 16, ENC_NA);
772
0
        }
773
0
    }
774
0
}
775
776
static void
777
dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
778
0
{
779
0
    int offset = 16;            /* past the fc_ct header */
780
0
    uint8_t islast;
781
782
0
    if (req_tree) {
783
0
        if (isreq) {
784
0
            proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
785
0
                                   offset, 8, ENC_NA);
786
0
        }
787
0
        else {
788
0
            do {
789
0
                islast = tvb_get_uint8 (tvb, offset);
790
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
791
0
                                       tvb, offset+1, 3, ENC_NA);
792
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
793
0
                                       tvb, offset+8, 8, ENC_NA);
794
0
                offset += 16;
795
0
            } while (!(islast & 0x80));
796
0
        }
797
0
    }
798
0
}
799
800
static void
801
dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
802
0
{
803
0
    int offset = 16;            /* past the fc_ct header */
804
0
    uint8_t len;
805
806
0
    if (req_tree) {
807
0
        if (isreq) {
808
0
            proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
809
0
                                   offset, 8, ENC_NA);
810
0
        }
811
0
        else {
812
0
            len = tvb_get_uint8 (tvb, offset);
813
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
814
0
                                 offset, 1, ENC_BIG_ENDIAN);
815
0
            proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
816
0
                                 offset+1, len, ENC_ASCII);
817
0
        }
818
0
    }
819
0
}
820
821
static void
822
dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
823
0
{
824
0
    int offset = 16;            /* past the fc_ct header */
825
0
    uint8_t islast;
826
827
0
    if (req_tree) {
828
0
        if (isreq) {
829
0
            proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
830
0
                                 tvb, offset+1, 1, ENC_BIG_ENDIAN);
831
0
            proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
832
0
                                 tvb, offset+2, 1, ENC_BIG_ENDIAN);
833
0
            proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
834
0
                                 tvb, offset+3, 1, ENC_BIG_ENDIAN);
835
0
        }
836
0
        else {
837
0
            do {
838
0
                islast = tvb_get_uint8 (tvb, offset);
839
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
840
0
                                       tvb, offset+1, 3, ENC_NA);
841
0
                offset += 4;
842
0
            } while (!(islast & 0x80));
843
0
        }
844
0
    }
845
0
}
846
847
static void
848
dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
849
0
{
850
0
    int offset = 16;            /* past the fc_ct header */
851
0
    uint8_t islast;
852
853
0
    if (req_tree) {
854
0
        if (isreq) {
855
0
            proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
856
0
                                 tvb, offset+1, 1, ENC_BIG_ENDIAN);
857
0
            proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
858
0
                                 tvb, offset+2, 1, ENC_BIG_ENDIAN);
859
0
            proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
860
0
                                 tvb, offset+3, 1, ENC_BIG_ENDIAN);
861
0
        }
862
0
        else {
863
0
            do {
864
0
                islast = tvb_get_uint8 (tvb, offset);
865
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
866
0
                                       tvb, offset+1, 3, ENC_NA);
867
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
868
0
                                       tvb, offset+4, 8, ENC_NA);
869
0
                offset += 16;
870
0
            } while (!(islast & 0x80));
871
0
        }
872
0
    }
873
0
}
874
875
static void
876
dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
877
0
{
878
0
    int offset = 16;            /* past the fc_ct header */
879
0
    uint8_t islast;
880
881
0
    if (req_tree) {
882
0
        if (isreq) {
883
0
            proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
884
0
                                 tvb, offset+1, 1, ENC_BIG_ENDIAN);
885
0
            proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
886
0
                                 tvb, offset+2, 1, ENC_BIG_ENDIAN);
887
0
            proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
888
0
                                 tvb, offset+3, 1, ENC_BIG_ENDIAN);
889
0
        }
890
0
        else {
891
0
            do {
892
0
                islast = tvb_get_uint8 (tvb, offset);
893
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
894
0
                                       tvb, offset+1, 3, ENC_NA);
895
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_nname,
896
0
                                       tvb, offset+4, 8, ENC_NA);
897
0
                offset += 16;
898
0
            } while (!(islast & 0x80));
899
0
        }
900
0
    }
901
0
}
902
903
static void
904
dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
905
0
{
906
0
    int offset = 16;            /* past the fc_ct header */
907
0
    uint8_t islast = 0;
908
909
0
    if (req_tree) {
910
0
        if (isreq) {
911
0
            proto_tree_add_item (req_tree, hf_fcdns_req_ptype,
912
0
                                 tvb, offset, 1, ENC_BIG_ENDIAN);
913
0
            proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
914
0
                                 tvb, offset+1, 1, ENC_BIG_ENDIAN);
915
0
            proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
916
0
                                 tvb, offset+2, 1, ENC_BIG_ENDIAN);
917
0
        }
918
0
        else {
919
0
            do {
920
0
                islast = tvb_get_uint8 (tvb, offset);
921
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
922
0
                                       tvb, offset+1, 3, ENC_NA);
923
0
                offset += 4;
924
0
            } while (!(islast & 0x80));
925
0
        }
926
0
    }
927
0
}
928
929
static void
930
dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
931
0
{
932
0
    int offset = 16;            /* past the fc_ct header */
933
0
    uint8_t islast;
934
935
0
    if (req_tree) {
936
0
        if (isreq) {
937
0
            proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset,
938
0
                                 16, ENC_NA);
939
0
        }
940
0
        else {
941
0
            do {
942
0
                islast = tvb_get_uint8 (tvb, offset);
943
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
944
0
                                       tvb, offset+1, 3, ENC_NA);
945
0
                offset += 4;
946
0
            } while (!(islast & 0x80));
947
0
        }
948
0
    }
949
0
}
950
951
static void
952
dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
953
0
{
954
0
    int offset = 16;            /* past the fc_ct header */
955
0
    uint8_t islast;
956
957
0
    if (req_tree) {
958
0
        if (isreq) {
959
0
            proto_tree_add_item (req_tree, hf_fcdns_req_domainscope, tvb,
960
0
                                 offset+1, 1, ENC_BIG_ENDIAN);
961
0
            proto_tree_add_item (req_tree, hf_fcdns_req_areascope, tvb,
962
0
                                 offset+2, 1, ENC_BIG_ENDIAN);
963
0
            dissect_fc4features_and_type(req_tree, tvb, offset+6);
964
0
        }
965
0
        else {
966
0
            do {
967
0
                islast = tvb_get_uint8 (tvb, offset);
968
0
                proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
969
0
                                       tvb, offset+1, 3, ENC_NA);
970
0
                offset += 4;
971
0
            } while (!(islast & 0x80));
972
0
        }
973
0
    }
974
0
}
975
976
static void
977
dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
978
0
{
979
0
    int offset = 16;            /* past the fc_ct header */
980
981
0
    if (req_tree) {
982
0
        if (isreq) {
983
0
            proto_tree_add_item (req_tree, hf_fcdns_req_portid,
984
0
                                   tvb, offset+1, 3, ENC_NA);
985
0
            proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
986
0
                                   offset+4, 8, ENC_NA);
987
0
        }
988
0
    }
989
0
}
990
991
static void
992
dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
993
0
{
994
0
    int offset = 16;            /* past the fc_ct header */
995
996
0
    if (req_tree) {
997
0
        if (isreq) {
998
0
            proto_tree_add_item (req_tree, hf_fcdns_req_portid,
999
0
                                   tvb, offset+1, 3, ENC_NA);
1000
0
            proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
1001
0
                                   offset+4, 8, ENC_NA);
1002
0
        }
1003
0
    }
1004
0
}
1005
1006
static void
1007
dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1008
0
{
1009
0
    int offset = 16;            /* past the fc_ct header */
1010
1011
0
    if (req_tree && isreq) {
1012
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1013
0
                               offset+1, 3, ENC_NA);
1014
0
        dissect_cos_flags(req_tree, tvb, offset+4, hf_fcdns_req_cos);
1015
0
    }
1016
0
}
1017
1018
static void
1019
dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1020
0
{
1021
0
    int offset = 16;            /* past the fc_ct header */
1022
1023
0
    if (isreq) {
1024
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1025
0
                               offset+1, 3, ENC_NA);
1026
0
        proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb,
1027
0
                             offset+4, 1, ENC_BIG_ENDIAN);
1028
0
    }
1029
0
}
1030
1031
static void
1032
dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1033
0
{
1034
0
    int offset = 16;            /* past the fc_ct header */
1035
1036
0
    if (isreq) {
1037
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1038
0
                               offset+1, 3, ENC_NA);
1039
0
        dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1040
0
    }
1041
0
}
1042
1043
static void
1044
dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1045
0
{
1046
0
    int offset = 16;            /* past the fc_ct header */
1047
0
    uint8_t len;
1048
1049
0
    if (req_tree && isreq) {
1050
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1051
0
                               offset+1, 3, ENC_NA);
1052
0
        proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb,
1053
0
                             offset+4, 1, ENC_BIG_ENDIAN);
1054
0
        len = tvb_get_uint8 (tvb, offset+4);
1055
1056
0
        proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5,
1057
0
                             len, ENC_ASCII);
1058
0
    }
1059
0
}
1060
1061
static void
1062
dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1063
0
{
1064
0
    int offset = 16;            /* past the fc_ct header */
1065
1066
0
    if (isreq) {
1067
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1068
0
                               offset+1, 3, ENC_NA);
1069
0
        proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb,
1070
0
                             offset+4, 16, ENC_NA);
1071
0
    }
1072
0
}
1073
1074
static void
1075
dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1076
0
{
1077
0
    int offset = 16;            /* past the fc_ct header */
1078
0
    int len;
1079
1080
0
    if (isreq) {
1081
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1082
0
                               offset+1, 3, ENC_NA);
1083
0
        dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1084
1085
0
        offset += 36;
1086
0
        len = tvb_reported_length_remaining (tvb, offset);
1087
1088
0
        while (len > 0) {
1089
0
            proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset,
1090
0
                                 1, ENC_BIG_ENDIAN);
1091
0
            proto_tree_add_item (req_tree, hf_fcdns_req_fdesc, tvb, offset+1,
1092
0
                                 len, ENC_ASCII);
1093
0
            offset += 256;
1094
0
            len -= 256;
1095
0
        }
1096
0
    }
1097
0
}
1098
1099
static void
1100
dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1101
0
{
1102
0
    int offset = 16;            /* past the fc_ct header */
1103
1104
0
    if (isreq) {
1105
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1106
0
        dissect_fc4features_and_type(req_tree, tvb, offset+6);
1107
0
    }
1108
0
}
1109
1110
static void
1111
dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1112
0
{
1113
0
    int offset = 16;            /* past the fc_ct header */
1114
1115
0
    if (isreq) {
1116
0
        proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1117
0
        proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
1118
0
    }
1119
0
}
1120
1121
static void
1122
dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1123
0
{
1124
0
    int offset = 16;            /* past the fc_ct header */
1125
0
    uint8_t len;
1126
1127
0
    if (isreq) {
1128
0
        proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1129
0
        len = tvb_get_uint8 (tvb, offset+8);
1130
1131
0
        proto_tree_add_item (req_tree, hf_fcdns_req_snamelen, tvb, offset+8,
1132
0
                             1, ENC_BIG_ENDIAN);
1133
0
        proto_tree_add_item (req_tree, hf_fcdns_req_sname, tvb, offset+9,
1134
0
                             len, ENC_ASCII);
1135
0
    }
1136
0
}
1137
1138
static void
1139
dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1140
0
{
1141
0
    int offset = 16;            /* past the fc_ct header */
1142
1143
0
    if (isreq) {
1144
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1145
0
    }
1146
0
}
1147
1148
static uint8_t *
1149
zonenm_to_str (wmem_allocator_t *scope, tvbuff_t *tvb, int offset)
1150
0
{
1151
0
    int len = tvb_get_uint8 (tvb, offset);
1152
0
    return tvb_get_string_enc(scope, tvb, offset+4, len, ENC_ASCII);
1153
0
}
1154
1155
static void
1156
dissect_fcdns_zone_mbr (tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree, int offset)
1157
0
{
1158
0
    uint8_t mbrtype;
1159
0
    int idlen;
1160
0
    proto_item* ti;
1161
1162
0
    mbrtype = tvb_get_uint8 (tvb, offset);
1163
0
    ti = proto_tree_add_uint (zmbr_tree, hf_fcdns_zone_mbrtype, tvb,
1164
0
                         offset, 1, mbrtype);
1165
0
    proto_tree_add_item(zmbr_tree, hf_fcdns_zone_flags, tvb, offset+2, 1, ENC_NA);
1166
0
    idlen = tvb_get_uint8 (tvb, offset+3);
1167
0
    proto_tree_add_item(zmbr_tree, hf_fcdns_id_length, tvb, offset+3, 1, ENC_NA);
1168
0
    switch (mbrtype) {
1169
0
    case FC_SWILS_ZONEMBR_WWN:
1170
0
        proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_wwn, tvb,
1171
0
                               offset+4, 8, ENC_NA);
1172
0
        break;
1173
0
    case FC_SWILS_ZONEMBR_DP:
1174
0
        proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_uint, tvb,
1175
0
                               offset+4, 4, ENC_BIG_ENDIAN);
1176
0
        break;
1177
0
    case FC_SWILS_ZONEMBR_FCID:
1178
0
        proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_fc, tvb,
1179
0
                               offset+4, 3, ENC_NA);
1180
0
        break;
1181
0
    case FC_SWILS_ZONEMBR_ALIAS:
1182
0
        proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1183
0
                               offset+4, idlen, zonenm_to_str (pinfo->pool, tvb, offset+4));
1184
0
        break;
1185
0
    default:
1186
0
        expert_add_info(pinfo, ti, &ei_fcdns_zone_mbrid);
1187
1188
0
    }
1189
0
}
1190
1191
static void
1192
dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1193
0
{
1194
0
    int numrec, i, len;
1195
0
    uint8_t objfmt;
1196
1197
0
    if (tree) {
1198
0
        numrec = tvb_get_ntohl (tvb, offset);
1199
0
        proto_tree_add_uint(tree, hf_fcdns_num_entries, tvb, offset, 4, numrec);
1200
0
        offset += 4;
1201
1202
0
        for (i = 0; i < numrec; i++) {
1203
0
            objfmt = tvb_get_uint8 (tvb, offset);
1204
1205
0
            proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
1206
0
            proto_tree_add_item (tree, hf_fcdns_rply_ownerid, tvb, offset+1, 3, ENC_NA);
1207
0
            proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
1208
0
                                 1, ENC_BIG_ENDIAN);
1209
0
            proto_tree_add_item (tree, hf_fcdns_rply_portid, tvb, offset+5, 3, ENC_NA);
1210
0
            proto_tree_add_item (tree, hf_fcdns_rply_pname, tvb, offset+8, 8, ENC_NA);
1211
0
            offset += 16;
1212
0
            if (!(objfmt & 0x1)) {
1213
0
                len = tvb_get_uint8 (tvb, offset);
1214
0
                proto_tree_add_item (tree, hf_fcdns_rply_spnamelen, tvb,
1215
0
                                     offset, 1, ENC_BIG_ENDIAN);
1216
0
                proto_tree_add_item (tree, hf_fcdns_rply_spname, tvb,
1217
0
                                     offset+1, len, ENC_ASCII);
1218
0
                offset += 256;
1219
0
            }
1220
0
            proto_tree_add_item (tree, hf_fcdns_rply_nname, tvb, offset, 8, ENC_NA);
1221
0
            offset += 8;
1222
0
            if (!(objfmt & 0x1)) {
1223
0
                len = tvb_get_uint8 (tvb, offset);
1224
0
                proto_tree_add_item (tree, hf_fcdns_rply_snamelen, tvb,
1225
0
                                     offset, 1, ENC_BIG_ENDIAN);
1226
0
                proto_tree_add_item (tree, hf_fcdns_rply_sname, tvb,
1227
0
                                     offset+1, len, ENC_ASCII);
1228
0
                offset += 256;
1229
0
            }
1230
0
            proto_tree_add_item (tree, hf_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
1231
0
            proto_tree_add_item (tree, hf_fcdns_rply_ipnode, tvb, offset+8, 16,
1232
0
                                 ENC_NA);
1233
0
            dissect_cos_flags(tree, tvb, offset+24, hf_fcdns_reply_cos);
1234
0
            dissect_fc4type(tree, tvb, offset+28, hf_fcdns_rply_gft);
1235
0
            proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60,
1236
0
                                 16, ENC_NA);
1237
0
            proto_tree_add_item (tree, hf_fcdns_rply_fpname, tvb, offset+76,
1238
0
                                   8, ENC_NA);
1239
0
            proto_tree_add_item (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85,
1240
0
                                   3, ENC_NA);
1241
0
            offset += 88;
1242
0
            if (objfmt & 0x2) {
1243
0
                dissect_fc4features(tree, tvb, offset);
1244
0
                if (tvb_get_uint8 (tvb, offset+129)) {
1245
0
                    proto_tree_add_item (tree, hf_fcdns_rply_fc4type, tvb,
1246
0
                                         offset+128, 1, ENC_BIG_ENDIAN);
1247
0
                    proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1248
0
                                         offset+129, 1, ENC_BIG_ENDIAN);
1249
0
                    len = tvb_get_uint8 (tvb, offset+132);
1250
0
                    proto_tree_add_item (tree, hf_fcdns_rply_fc4desclen, tvb,
1251
0
                                         offset+132, 1, ENC_BIG_ENDIAN);
1252
0
                    proto_tree_add_item (tree, hf_fcdns_rply_fc4desc, tvb,
1253
0
                                         offset+133, len, ENC_NA);
1254
0
                }
1255
0
                else {
1256
0
                    proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1257
0
                                         offset+129, 1, ENC_BIG_ENDIAN);
1258
0
                }
1259
0
                offset += 388;  /* FC4 desc is 260 bytes, maybe padded */
1260
0
            }
1261
0
        }
1262
0
    }
1263
0
}
1264
1265
static void
1266
dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1267
0
{
1268
0
    int offset = 16;            /* past the fc_ct header */
1269
1270
0
    if (isreq) {
1271
0
        proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1272
0
    }
1273
0
    else {
1274
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1275
0
    }
1276
0
}
1277
1278
static void
1279
dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1280
0
{
1281
0
    int offset = 16;            /* past the fc_ct header */
1282
0
    if (isreq) {
1283
0
        proto_tree_add_item(req_tree, hf_fcdns_req_pname, tvb, offset, 8, ENC_NA);
1284
0
    }
1285
0
    else {
1286
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1287
0
    }
1288
0
}
1289
1290
static void
1291
dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1292
0
{
1293
0
    int offset = 16;            /* past the fc_ct header */
1294
1295
0
    if (isreq) {
1296
0
        proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1297
0
    }
1298
0
    else {
1299
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1300
0
    }
1301
0
}
1302
1303
static void
1304
dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1305
0
{
1306
0
    int offset = 16;            /* past the fc_ct header */
1307
1308
0
    if (isreq) {
1309
0
        if (req_tree) {
1310
0
            proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1311
0
        }
1312
0
    }
1313
0
    else {
1314
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1315
0
    }
1316
0
}
1317
1318
static void
1319
dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1320
0
{
1321
0
    int offset = 16;            /* past the fc_ct header */
1322
1323
0
    if (isreq) {
1324
0
        if (req_tree) {
1325
0
            dissect_fc4type(req_tree, tvb, offset, hf_fcdns_fc4type);
1326
0
        }
1327
0
    }
1328
0
    else {
1329
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1330
0
    }
1331
0
}
1332
1333
static void
1334
dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1335
0
{
1336
0
    int offset = 16;            /* past the fc_ct header */
1337
1338
0
    if (isreq) {
1339
0
        if (req_tree) {
1340
0
            proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+3,
1341
0
                                 1, ENC_BIG_ENDIAN);
1342
0
        }
1343
0
    }
1344
0
    else {
1345
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1346
0
    }
1347
0
}
1348
1349
static void
1350
dissect_fcdns_gezm (tvbuff_t *tvb, packet_info* pinfo, proto_tree *req_tree, bool isreq)
1351
0
{
1352
0
    int offset = 16;            /* past the fc_ct header */
1353
1354
0
    if (isreq) {
1355
0
        dissect_fcdns_zone_mbr (tvb, pinfo, req_tree, offset);
1356
0
    }
1357
0
    else {
1358
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1359
0
    }
1360
0
}
1361
1362
static void
1363
dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1364
0
{
1365
0
    int offset = 16;            /* past the fc_ct header */
1366
0
    int str_len;
1367
1368
0
    if (isreq) {
1369
0
        if (req_tree) {
1370
0
            str_len = tvb_get_uint8 (tvb, offset);
1371
0
            proto_tree_add_uint(req_tree, hf_fcdns_zonelen, tvb, offset, 1, str_len);
1372
0
            proto_tree_add_item (req_tree, hf_fcdns_zonenm, tvb, offset+3,
1373
0
                                 str_len, ENC_ASCII);
1374
0
        }
1375
0
    }
1376
0
    else {
1377
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1378
0
    }
1379
0
}
1380
1381
static void
1382
dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1383
0
{
1384
0
    int offset = 16;            /* past the fc_ct header */
1385
1386
0
    if (isreq) {
1387
0
        if (req_tree) {
1388
0
            proto_tree_add_item (req_tree, hf_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1389
0
        }
1390
0
    }
1391
0
    else {
1392
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1393
0
    }
1394
0
}
1395
1396
static void
1397
dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1398
0
{
1399
0
    int offset = 16;            /* past the fc_ct header */
1400
1401
0
    if (isreq) {
1402
0
        if (req_tree) {
1403
0
            dissect_fc4features(req_tree, tvb, offset);
1404
0
        }
1405
0
    }
1406
0
    else {
1407
0
        dissect_fcdns_swils_entries (tvb, req_tree, offset);
1408
0
    }
1409
0
}
1410
1411
static void
1412
dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1413
0
{
1414
0
    int offset = 0;
1415
1416
0
    if (req_tree) {
1417
0
        proto_tree_add_item (req_tree, hf_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1418
0
        proto_tree_add_item (req_tree, hf_fcdns_rjtdetail, tvb, offset+14, 1,
1419
0
                             ENC_BIG_ENDIAN);
1420
0
        proto_tree_add_item (req_tree, hf_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1421
0
    }
1422
0
}
1423
1424
static int
1425
dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1426
0
{
1427
    /* Set up structures needed to add the protocol subtree and manage it */
1428
0
    proto_item *ti = NULL;
1429
0
    proto_tree *fcdns_tree = NULL;
1430
0
    int offset = 0;
1431
0
    int opcode,
1432
0
        failed_opcode = 0;
1433
0
    int isreq = 1;
1434
0
    fc_ct_preamble cthdr;
1435
0
    conversation_t *conversation;
1436
0
    fcdns_conv_data_t *cdata;
1437
0
    fcdns_conv_key_t ckey, *req_key;
1438
0
    fc_hdr *fchdr;
1439
1440
    /* Reject the packet if data is NULL */
1441
0
    if (data == NULL)
1442
0
        return 0;
1443
0
    fchdr = (fc_hdr *)data;
1444
1445
0
    tvb_memcpy (tvb, (uint8_t *)&cthdr, offset, FCCT_PRMBL_SIZE);
1446
0
    cthdr.revision = tvb_get_uint8 (tvb, offset);
1447
0
    cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1448
0
    cthdr.opcode = g_ntohs (cthdr.opcode);
1449
0
    opcode = cthdr.opcode;
1450
0
    cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
1451
1452
    /* Determine the type of server the request/response is for */
1453
0
    if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1454
0
        col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1455
0
    else
1456
0
        col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1457
1458
0
    if (tree) {
1459
0
        if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1460
0
            ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1461
0
                                                 -1,
1462
0
                                                 "dNS");
1463
0
            fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1464
0
        }
1465
0
        else {
1466
0
            ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1467
0
                                                 -1,
1468
0
                                                 "Unzoned NS");
1469
0
            fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1470
0
        }
1471
0
    }
1472
1473
0
    if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1474
0
        conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
1475
0
                                          conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1476
0
                                          fchdr->rxid, NO_PORT_B);
1477
0
        if (!conversation) {
1478
0
            conversation = conversation_new (pinfo->num, &pinfo->src, &pinfo->dst,
1479
0
                                             conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1480
0
                                             fchdr->rxid, NO_PORT2);
1481
0
        }
1482
1483
0
        ckey.conv_idx = conversation->conv_index;
1484
1485
0
        cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash,
1486
0
                                                            &ckey);
1487
0
        if (cdata) {
1488
            /* Since we never free the memory used by an exchange, this maybe a
1489
             * case of another request using the same exchange as a previous
1490
             * req.
1491
             */
1492
0
            cdata->opcode = opcode;
1493
0
        }
1494
0
        else {
1495
0
            req_key = wmem_new(wmem_file_scope(), fcdns_conv_key_t);
1496
0
            req_key->conv_idx = conversation->conv_index;
1497
1498
0
            cdata = wmem_new(wmem_file_scope(), fcdns_conv_data_t);
1499
0
            cdata->opcode = opcode;
1500
1501
0
            wmem_map_insert (fcdns_req_hash, req_key, cdata);
1502
0
        }
1503
0
        col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1504
0
                                                          "0x%x"));
1505
0
    }
1506
0
    else {
1507
        /* Opcode is ACC or RJT */
1508
0
        conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
1509
0
                                          conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1510
0
                                          fchdr->rxid, NO_PORT_B);
1511
0
        isreq = 0;
1512
0
        if (!conversation) {
1513
0
            if (opcode == FCCT_MSG_ACC) {
1514
0
                col_add_str (pinfo->cinfo, COL_INFO,
1515
0
                                 val_to_str (opcode, fc_dns_opcode_val,
1516
0
                                             "0x%x"));
1517
                /* No record of what this accept is for. Can't decode */
1518
0
                proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1519
0
                return 0;
1520
0
            }
1521
0
        }
1522
0
        else {
1523
0
            ckey.conv_idx = conversation->conv_index;
1524
1525
0
            cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash, &ckey);
1526
1527
0
            if (cdata != NULL) {
1528
0
                if (opcode == FCCT_MSG_ACC) {
1529
0
                    opcode = cdata->opcode;
1530
0
                }
1531
0
                else
1532
0
                    failed_opcode = cdata->opcode;
1533
0
            }
1534
1535
0
            if (opcode != FCCT_MSG_RJT) {
1536
0
                col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1537
0
                                val_to_str (opcode, fc_dns_opcode_val,
1538
0
                                            "0x%x"));
1539
0
            }
1540
0
            else {
1541
0
                col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1542
0
                                val_to_str (failed_opcode,
1543
0
                                            fc_dns_opcode_val,
1544
0
                                            "0x%x"));
1545
0
            }
1546
1547
0
            if (tree) {
1548
0
                if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1549
                    /* No record of what this accept is for. Can't decode */
1550
0
                    proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1551
0
                    return 0;
1552
0
                }
1553
0
            }
1554
0
        }
1555
0
    }
1556
1557
0
     if (tree) {
1558
0
        proto_tree_add_item (fcdns_tree, hf_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1559
0
        proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10,
1560
0
                             2, ENC_BIG_ENDIAN);
1561
0
    }
1562
1563
0
    switch (opcode) {
1564
0
    case FCCT_MSG_RJT:
1565
0
        dissect_fcdns_rjt (tvb, fcdns_tree);
1566
0
        break;
1567
0
    case FCDNS_GA_NXT:
1568
0
        dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1569
0
        break;
1570
0
    case FCDNS_GPN_ID:
1571
0
        dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1572
0
        break;
1573
0
    case FCDNS_GNN_ID:
1574
0
        dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1575
0
        break;
1576
0
    case FCDNS_GCS_ID:
1577
0
        dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1578
0
        break;
1579
0
    case FCDNS_GFT_ID:
1580
0
        dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1581
0
        break;
1582
0
    case FCDNS_GSPN_ID:
1583
0
        dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1584
0
        break;
1585
0
    case FCDNS_GPT_ID:
1586
0
        dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1587
0
        break;
1588
0
    case FCDNS_GFPN_ID:
1589
0
        dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1590
0
        break;
1591
0
    case FCDNS_GFD_ID:
1592
0
        dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1593
0
        break;
1594
0
    case FCDNS_GFF_ID:
1595
0
        dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1596
0
        break;
1597
0
    case FCDNS_GID_PN:
1598
0
        dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1599
0
        break;
1600
0
    case FCDNS_GIPP_PN:
1601
0
        dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1602
0
        break;
1603
0
    case FCDNS_GID_NN:
1604
0
        dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1605
0
        break;
1606
0
    case FCDNS_GPN_NN:
1607
0
        dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1608
0
        break;
1609
0
    case FCDNS_GIP_NN:
1610
0
        dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1611
0
        break;
1612
0
    case FCDNS_GSNN_NN:
1613
0
        dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1614
0
        break;
1615
0
    case FCDNS_GID_FT:
1616
0
        dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1617
0
        break;
1618
0
    case FCDNS_GPN_FT:
1619
0
        dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1620
0
        break;
1621
0
    case FCDNS_GNN_FT:
1622
0
        dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1623
0
        break;
1624
0
    case FCDNS_GID_PT:
1625
0
        dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1626
0
        break;
1627
0
    case FCDNS_GID_IPP:
1628
0
        dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1629
0
        break;
1630
0
    case FCDNS_GID_FF:
1631
0
        dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1632
0
        break;
1633
0
    case FCDNS_RPN_ID:
1634
0
        dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1635
0
        break;
1636
0
    case FCDNS_RNN_ID:
1637
0
        dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1638
0
        break;
1639
0
    case FCDNS_RCS_ID:
1640
0
        dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1641
0
        break;
1642
0
    case FCDNS_RPT_ID:
1643
0
        dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1644
0
        break;
1645
0
    case FCDNS_RFT_ID:
1646
0
        dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1647
0
        break;
1648
0
    case FCDNS_RSPN_ID:
1649
0
        dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1650
0
        break;
1651
0
    case FCDNS_RIPP_ID:
1652
0
        dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1653
0
        break;
1654
0
    case FCDNS_RFD_ID:
1655
0
        dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1656
0
        break;
1657
0
    case FCDNS_RFF_ID:
1658
0
        dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1659
0
        break;
1660
0
    case FCDNS_RIP_NN:
1661
0
        dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1662
0
        break;
1663
0
    case FCDNS_RSNN_NN:
1664
0
        dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1665
0
        break;
1666
0
    case FCDNS_DA_ID:
1667
0
        dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1668
0
        break;
1669
0
    case FCDNS_GE_ID:
1670
0
        dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1671
0
        break;
1672
0
    case FCDNS_GE_PN:
1673
0
        dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1674
0
        break;
1675
0
    case FCDNS_GE_NN:
1676
0
        dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1677
0
        break;
1678
0
    case FCDNS_GE_IP:
1679
0
        dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1680
0
        break;
1681
0
    case FCDNS_GE_FT:
1682
0
        dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1683
0
        break;
1684
0
    case FCDNS_GE_PT:
1685
0
        dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1686
0
        break;
1687
0
    case FCDNS_GE_ZM:
1688
0
        dissect_fcdns_gezm (tvb, pinfo, fcdns_tree, isreq);
1689
0
        break;
1690
0
    case FCDNS_GE_ZN:
1691
0
        dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1692
0
        break;
1693
0
    case FCDNS_GE_IPP:
1694
0
        dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1695
0
        break;
1696
0
    case FCDNS_GE_FF:
1697
0
        dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1698
0
        break;
1699
0
    default:
1700
0
        break;
1701
0
    }
1702
1703
0
    return tvb_captured_length(tvb);
1704
0
}
1705
1706
/* Register the protocol with Wireshark */
1707
1708
void
1709
proto_register_fcdns (void)
1710
14
{
1711
14
    static hf_register_info hf[] = {
1712
14
        { &hf_fcdns_opcode,
1713
14
            { "Opcode", "fcdns.opcode",
1714
14
              FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val), 0x0,
1715
14
              NULL, HFILL }
1716
14
        },
1717
14
        { &hf_fcdns_reason,
1718
14
            { "Reason Code", "fcdns.rply.reason",
1719
14
              FT_UINT8, BASE_HEX, VALS (fc_ct_rjt_code_vals), 0x0,
1720
14
              NULL, HFILL }
1721
14
        },
1722
14
        { &hf_fcdns_vendor,
1723
14
            { "Vendor Unique Reject Code", "fcdns.rply.vendor",
1724
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
1725
14
              NULL, HFILL }
1726
14
        },
1727
14
        { &hf_fcdns_req_portid,
1728
14
            { "Port Identifier", "fcdns.req.portid",
1729
14
              FT_BYTES, SEP_DOT, NULL, 0x0,
1730
14
              NULL, HFILL }
1731
14
        },
1732
14
        { &hf_fcdns_rply_pname,
1733
14
            { "Port Name", "fcdns.rply.pname",
1734
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1735
14
              NULL, HFILL }
1736
14
        },
1737
14
        { &hf_fcdns_rply_nname,
1738
14
            { "Node Name", "fcdns.rply.nname",
1739
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1740
14
              NULL, HFILL }
1741
14
        },
1742
14
        { &hf_fcdns_rply_gft,
1743
14
            { "FC-4 Types Supported", "fcdns.rply.gft",
1744
14
              FT_NONE, BASE_NONE, NULL, 0x0,
1745
14
              NULL, HFILL }
1746
14
        },
1747
14
        { &hf_fcdns_rply_snamelen,
1748
14
            { "Symbolic Node Name Length", "fcdns.rply.snamelen",
1749
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1750
14
              NULL, HFILL }
1751
14
        },
1752
14
        { &hf_fcdns_rply_sname,
1753
14
            { "Symbolic Node Name", "fcdns.rply.sname",
1754
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1755
14
              NULL, HFILL }
1756
14
        },
1757
14
        { &hf_fcdns_rply_ptype,
1758
14
            { "Port Type", "fcdns.rply.porttype",
1759
14
              FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
1760
14
              NULL, HFILL }
1761
14
        },
1762
14
        { &hf_fcdns_rply_fpname,
1763
14
            { "Fabric Port Name", "fcdns.rply.fpname",
1764
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1765
14
              NULL, HFILL }
1766
14
        },
1767
14
        { &hf_fcdns_fc4type,
1768
14
            { "FC-4 Types", "fcdns.req.fc4types",
1769
14
              FT_NONE, BASE_NONE, NULL, 0x0,
1770
14
              NULL, HFILL }
1771
14
        },
1772
14
        { &hf_fcdns_rply_fc4type,
1773
14
            { "FC-4 Descriptor Type", "fcdns.rply.fc4type",
1774
14
              FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
1775
14
              NULL, HFILL }
1776
14
        },
1777
14
        { &hf_fcdns_rply_fc4desc,
1778
14
            { "FC-4 Descriptor", "fcdns.rply.fc4desc",
1779
14
              FT_BYTES, BASE_NONE, NULL, 0x0,
1780
14
              NULL, HFILL }
1781
14
        },
1782
14
        { &hf_fcdns_req_pname,
1783
14
            { "Port Name", "fcdns.req.portname",
1784
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1785
14
              NULL, HFILL }
1786
14
        },
1787
14
        { &hf_fcdns_rply_portid,
1788
14
            { "Port Identifier", "fcdns.rply.portid",
1789
14
              FT_BYTES, SEP_DOT, NULL, 0x0,
1790
14
              NULL, HFILL }
1791
14
        },
1792
14
        { &hf_fcdns_req_nname,
1793
14
            { "Node Name", "fcdns.req.nname",
1794
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1795
14
              NULL, HFILL }
1796
14
        },
1797
14
        { &hf_fcdns_req_domainscope,
1798
14
            { "Domain ID Scope", "fcdns.req.domainid",
1799
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
1800
14
              NULL, HFILL }
1801
14
        },
1802
14
        { &hf_fcdns_req_areascope,
1803
14
            { "Area ID Scope", "fcdns.req.areaid",
1804
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
1805
14
              NULL, HFILL }
1806
14
        },
1807
14
        { &hf_fcdns_req_ptype,
1808
14
            { "Port Type", "fcdns.req.porttype",
1809
14
              FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
1810
14
              NULL, HFILL }
1811
14
        },
1812
14
        { &hf_fcdns_req_cos,
1813
14
            { "Requested Class of Service", "fcdns.req.class",
1814
14
              FT_UINT32, BASE_HEX, NULL, 0x0,
1815
14
              NULL, HFILL }
1816
14
        },
1817
14
        { &hf_fcdns_req_fc4types,
1818
14
            { "FC-4 Types Supported", "fcdns.req.fc4types",
1819
14
              FT_NONE, BASE_NONE, NULL, 0x0,
1820
14
              NULL, HFILL }
1821
14
        },
1822
14
        { &hf_fcdns_req_snamelen,
1823
14
            { "Symbolic Name Length", "fcdns.req.snamelen",
1824
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1825
14
              NULL, HFILL }
1826
14
        },
1827
14
        { &hf_fcdns_req_sname,
1828
14
            { "Symbolic Port Name", "fcdns.req.sname",
1829
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1830
14
              NULL, HFILL }
1831
14
        },
1832
14
        { &hf_fcdns_rply_spnamelen,
1833
14
            { "Symbolic Port Name Length", "fcdns.rply.spnamelen",
1834
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1835
14
              NULL, HFILL }
1836
14
        },
1837
14
        { &hf_fcdns_rply_spname,
1838
14
            { "Symbolic Port Name", "fcdns.rply.spname",
1839
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1840
14
              NULL, HFILL }
1841
14
        },
1842
14
        { &hf_fcdns_req_spnamelen,
1843
14
            { "Symbolic Port Name Length", "fcdns.req.spnamelen",
1844
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1845
14
              NULL, HFILL }
1846
14
        },
1847
14
        { &hf_fcdns_req_spname,
1848
14
            { "Symbolic Port Name", "fcdns.req.spname",
1849
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1850
14
              NULL, HFILL }
1851
14
        },
1852
14
        { &hf_fcdns_rply_ipa,
1853
14
            { "Initial Process Associator", "fcdns.rply.ipa",
1854
14
              FT_BYTES, BASE_NONE, NULL, 0x0,
1855
14
              NULL, HFILL }
1856
14
        },
1857
14
        { &hf_fcdns_rply_ipnode,
1858
14
            { "Node IP Address", "fcdns.rply.ipnode",
1859
14
              FT_IPv6, BASE_NONE, NULL, 0x0,
1860
14
              NULL, HFILL }
1861
14
        },
1862
14
        { &hf_fcdns_rply_ipport,
1863
14
            { "Port IP Address", "fcdns.rply.ipport",
1864
14
              FT_IPv6, BASE_NONE, NULL, 0x0,
1865
14
              NULL, HFILL }
1866
14
        },
1867
14
        { &hf_fcdns_rply_fc4desclen,
1868
14
            { "FC-4 Descriptor Length", "fcdns.rply.fc4desclen",
1869
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1870
14
              NULL, HFILL }
1871
14
        },
1872
14
        { &hf_fcdns_rply_hrdaddr,
1873
14
            { "Hard Address", "fcdns.rply.hrdaddr",
1874
14
              FT_BYTES, SEP_DOT, NULL, 0x0,
1875
14
              NULL, HFILL }
1876
14
        },
1877
14
        { &hf_fcdns_req_fdesclen,
1878
14
            { "FC-4 Descriptor Length", "fcdns.req.fc4desclen",
1879
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1880
14
              NULL, HFILL }
1881
14
        },
1882
14
        { &hf_fcdns_req_fdesc,
1883
14
            { "FC-4 Descriptor", "fcdns.req.fc4desc",
1884
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1885
14
              NULL, HFILL }
1886
14
        },
1887
14
        { &hf_fcdns_req_ip,
1888
14
            { "IP Address", "fcdns.req.ip",
1889
14
              FT_IPv6, BASE_NONE, NULL, 0x0,
1890
14
              NULL, HFILL }
1891
14
        },
1892
14
        { &hf_fcdns_rjtdetail,
1893
14
            { "Reason Code Explanation", "fcdns.rply.reasondet",
1894
14
              FT_UINT8, BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0,
1895
14
              NULL, HFILL }
1896
14
        },
1897
14
        { &hf_fcdns_zone_mbrtype,
1898
14
            { "Zone Member Type", "fcdns.zone.mbrtype",
1899
14
              FT_UINT8, BASE_HEX, VALS (fc_swils_zonembr_type_val), 0x0,
1900
14
              NULL, HFILL }
1901
14
        },
1902
14
        { &hf_fcdns_zone_mbrid,
1903
14
            { "Member Identifier", "fcdns.zone.mbrid",
1904
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1905
14
              NULL, HFILL }
1906
14
        },
1907
14
        { &hf_fcdns_zone_mbrid_wwn,
1908
14
            { "Member Identifier", "fcdns.zone.mbrid.wwn",
1909
14
              FT_FCWWN, BASE_NONE, NULL, 0x0,
1910
14
              NULL, HFILL }
1911
14
        },
1912
14
        { &hf_fcdns_zone_mbrid_uint,
1913
14
            { "Member Identifier", "fcdns.zone.mbrid.uint",
1914
14
              FT_UINT32, BASE_HEX, NULL, 0x0,
1915
14
              NULL, HFILL }
1916
14
        },
1917
14
        { &hf_fcdns_zone_mbrid_fc,
1918
14
            { "Member Identifier", "fcdns.zone.mbrid.fc",
1919
14
              FT_BYTES, SEP_DOT, NULL, 0x0,
1920
14
              NULL, HFILL }
1921
14
        },
1922
14
        { &hf_fcdns_id_length,
1923
14
            { "Identifier Length", "fcdns.id_length",
1924
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1925
14
              NULL, HFILL }
1926
14
        },
1927
14
        { &hf_fcdns_zone_flags,
1928
14
            { "Flags", "fcdns.zone_flags",
1929
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
1930
14
              NULL, HFILL }
1931
14
        },
1932
14
        { &hf_fcdns_zonelen,
1933
14
            { "Name Length", "fcdns.zone_len",
1934
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1935
14
              NULL, HFILL }
1936
14
        },
1937
14
        { &hf_fcdns_zonenm,
1938
14
            { "Zone Name", "fcdns.zonename",
1939
14
              FT_STRING, BASE_NONE, NULL, 0x0,
1940
14
              NULL, HFILL }
1941
14
        },
1942
14
        { &hf_fcdns_portip,
1943
14
            { "Port IP Address", "fcdns.portip",
1944
14
              FT_IPv4, BASE_NONE, NULL, 0x0,
1945
14
              NULL, HFILL }
1946
14
        },
1947
14
        { &hf_fcdns_num_entries,
1948
14
            { "Number of Entries", "fcdns.num_entries",
1949
14
              FT_UINT32, BASE_HEX, NULL, 0x0,
1950
14
              NULL, HFILL }
1951
14
        },
1952
14
        { &hf_fcdns_sw2_objfmt,
1953
14
            { "Name Entry Object Format", "fcdns.entry.objfmt",
1954
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
1955
14
              NULL, HFILL }
1956
14
        },
1957
14
        { &hf_fcdns_num_fc4desc,
1958
14
            { "Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
1959
14
              FT_UINT8, BASE_DEC, NULL, 0x0,
1960
14
              NULL, HFILL }
1961
14
        },
1962
14
        { &hf_fcdns_rply_ownerid,
1963
14
            { "Owner Id", "fcdns.rply.ownerid",
1964
14
              FT_BYTES, SEP_DOT, NULL, 0x0,
1965
14
              NULL, HFILL }
1966
14
        },
1967
14
        { &hf_fcdns_maxres_size,
1968
14
            { "Maximum/Residual Size", "fcdns.maxres_size",
1969
14
              FT_UINT16, BASE_DEC, NULL, 0x0,
1970
14
              NULL, HFILL }
1971
14
        },
1972
14
        { &hf_fcdns_reply_cos,
1973
14
            { "Class of Service Supported", "fcdns.reply.cos",
1974
14
              FT_UINT32, BASE_HEX, NULL, 0x0,
1975
14
              NULL, HFILL }
1976
14
        },
1977
14
        { &hf_fcdns_cos_f,
1978
14
            { "F", "fcdns.cos.f",
1979
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
1980
14
              NULL, HFILL }
1981
14
        },
1982
14
        { &hf_fcdns_cos_1,
1983
14
            { "1", "fcdns.cos.1",
1984
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002,
1985
14
              NULL, HFILL }
1986
14
        },
1987
14
        { &hf_fcdns_cos_2,
1988
14
            { "2", "fcdns.cos.2",
1989
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
1990
14
              NULL, HFILL }
1991
14
        },
1992
14
        { &hf_fcdns_cos_3,
1993
14
            { "3", "fcdns.cos.3",
1994
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008,
1995
14
              NULL, HFILL }
1996
14
        },
1997
14
        { &hf_fcdns_cos_4,
1998
14
            { "4", "fcdns.cos.4",
1999
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2000
14
              NULL, HFILL }
2001
14
        },
2002
14
        { &hf_fcdns_cos_6,
2003
14
            { "6", "fcdns.cos.6",
2004
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040,
2005
14
              NULL, HFILL }
2006
14
        },
2007
14
        { &hf_fcdns_fc4type_llcsnap,
2008
14
            { "LLC/SNAP", "fcdns.fc4types.llc_snap",
2009
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2010
14
              NULL, HFILL }
2011
14
        },
2012
14
        { &hf_fcdns_fc4type_ip,
2013
14
            { "IP", "fcdns.fc4types.ip",
2014
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020,
2015
14
              NULL, HFILL }
2016
14
        },
2017
14
        { &hf_fcdns_fc4type_fcp,
2018
14
            { "FCP", "fcdns.fc4types.fcp",
2019
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000100,
2020
14
              NULL, HFILL }
2021
14
        },
2022
14
        { &hf_fcdns_fc4type_swils,
2023
14
            { "SW_ILS", "fcdns.fc4types.swils",
2024
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2025
14
              NULL, HFILL }
2026
14
        },
2027
14
        { &hf_fcdns_fc4type_snmp,
2028
14
            { "SNMP", "fcdns.fc4types.snmp",
2029
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
2030
14
              NULL, HFILL }
2031
14
        },
2032
14
        { &hf_fcdns_fc4type_gs3,
2033
14
            { "GS3", "fcdns.fc4types.gs3",
2034
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
2035
14
              NULL, HFILL }
2036
14
        },
2037
14
        { &hf_fcdns_fc4type_vi,
2038
14
            { "VI", "fcdns.fc4types.vi",
2039
14
              FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
2040
14
              NULL, HFILL }
2041
14
        },
2042
14
        { &hf_fcdns_fc4features,
2043
14
            { "FC-4 Feature Bits", "fcdns.fc4features",
2044
14
              FT_UINT8, BASE_HEX, NULL, 0x0,
2045
14
              NULL, HFILL }
2046
14
        },
2047
14
        { &hf_fcdns_fc4features_i,
2048
14
            { "I", "fcdns.fc4features.i",
2049
14
              FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
2050
14
              NULL, HFILL }
2051
14
        },
2052
14
        { &hf_fcdns_fc4features_t,
2053
14
            { "T", "fcdns.fc4features.t",
2054
14
              FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
2055
14
              NULL, HFILL }
2056
14
        },
2057
14
        { &hf_fcdns_req_fc4type,
2058
14
            { "FC-4 Type", "fcdns.req.fc4type",
2059
14
              FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
2060
14
              NULL, HFILL }
2061
14
        },
2062
14
    };
2063
2064
14
    static int *ett[] = {
2065
14
        &ett_fcdns,
2066
14
        &ett_cos_flags,
2067
14
        &ett_fc4flags,
2068
14
        &ett_fc4features,
2069
14
    };
2070
2071
14
    static ei_register_info ei[] = {
2072
14
        { &ei_fcdns_no_record_of_exchange, { "fcdns.no_record_of_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode MSG_ACC/RJT", EXPFILL }},
2073
14
        { &ei_fcdns_zone_mbrid, { "fcdns.zone.mbrid.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown member type format", EXPFILL }},
2074
14
    };
2075
2076
14
    expert_module_t* expert_fcdns;
2077
2078
14
    proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns");
2079
14
    proto_register_field_array(proto_fcdns, hf, array_length(hf));
2080
14
    proto_register_subtree_array(ett, array_length(ett));
2081
14
    expert_fcdns = expert_register_protocol(proto_fcdns);
2082
14
    expert_register_field_array(expert_fcdns, ei, array_length(ei));
2083
2084
14
    fcdns_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcdns_hash, fcdns_equal);
2085
2086
14
    dns_handle = register_dissector("fcdns", dissect_fcdns, proto_fcdns);
2087
14
}
2088
2089
void
2090
proto_reg_handoff_fcdns (void)
2091
14
{
2092
14
    dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
2093
14
    dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_handle);
2094
14
}
2095
2096
/*
2097
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
2098
 *
2099
 * Local variables:
2100
 * c-basic-offset: 4
2101
 * tab-width: 8
2102
 * indent-tabs-mode: nil
2103
 * End:
2104
 *
2105
 * vi: set shiftwidth=4 tabstop=8 expandtab:
2106
 * :indentSize=4:tabSize=8:noTabs=true:
2107
 */