Coverage Report

Created: 2026-11-12 07:01

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