Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-fcdns.c
blob1fc08f9ab5019d5f60539fa2a2e424090d6e48b2
1 /* packet-fcdns.c
2 * Routines for FC distributed Name Server (dNS)
3 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 #include "config.h"
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"
20 void proto_register_fcdns(void);
21 void proto_reg_handoff_fcdns(void);
24 * See FC-GS-2.
27 static dissector_handle_t dns_handle;
29 /* protocol and registered fields */
31 /* Opcode definitions */
32 #define FCDNS_GA_NXT 0x0100
33 #define FCDNS_GID_A 0x0101
34 #define FCDNS_GPN_ID 0x0112
35 #define FCDNS_GNN_ID 0x0113
36 #define FCDNS_GCS_ID 0x0114
37 #define FCDNS_GFT_ID 0x0117
38 #define FCDNS_GSPN_ID 0x0118
39 #define FCDNS_GPT_ID 0x011A
40 #define FCDNS_GIPP_ID 0x011B
41 #define FCDNS_GFPN_ID 0x011C
42 #define FCDNS_GHA_ID 0x011D
43 #define FCDNS_GFD_ID 0x011E
44 #define FCDNS_GFF_ID 0x011F
45 #define FCDNS_GID_PN 0x0121
46 #define FCDNS_GIPP_PN 0x012B
47 #define FCDNS_GID_NN 0x0131
48 #define FCDNS_GPN_NN 0x0132
49 #define FCDNS_GIP_NN 0x0135
50 #define FCDNS_GIPA_NN 0x0136
51 #define FCDNS_GSNN_NN 0x0139
52 #define FCDNS_GNN_IP 0x0153
53 #define FCDNS_GIPA_IP 0x0156
54 #define FCDNS_GID_FT 0x0171
55 #define FCDNS_GPN_FT 0x0172
56 #define FCDNS_GNN_FT 0x0173
57 #define FCDNS_GID_PT 0x01A1
58 #define FCDNS_GID_IPP 0x01B1
59 #define FCDNS_GPN_IPP 0x01B2
60 #define FCDNS_GID_FF 0x01F1
61 #define FCDNS_RPN_ID 0x0212
62 #define FCDNS_RNN_ID 0x0213
63 #define FCDNS_RCS_ID 0x0214
64 #define FCDNS_RFT_ID 0x0217
65 #define FCDNS_RSPN_ID 0x0218
66 #define FCDNS_RPT_ID 0x021A
67 #define FCDNS_RIPP_ID 0x021B
68 #define FCDNS_RHA_ID 0x021D
69 #define FCDNS_RFD_ID 0x021E
70 #define FCDNS_RFF_ID 0x021F
71 #define FCDNS_RIP_NN 0x0235
72 #define FCDNS_RSNN_NN 0x0239
73 #define FCDNS_DA_ID 0x0300
74 /* dNS messages defined by FC-SW2 */
75 #define FCDNS_RA 0x0
76 #define FCDNS_GE_ID 0x0410
77 #define FCDNS_GE_PN 0x0420
78 #define FCDNS_GE_NN 0x0430
79 #define FCDNS_GE_IP 0x0450
80 #define FCDNS_GE_FT 0x0470
81 #define FCDNS_GE_PT 0x04A0
82 #define FCDNS_GE_ZM 0x04B0
83 #define FCDNS_GE_ZN 0x04C0
84 #define FCDNS_GE_IPP 0x04D0
85 #define FCDNS_GE_FF 0x04E0
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},
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
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},
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
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},
223 /* Actual servers serving the directory service type identified by subtype */
224 #define FCDNS_GSSUBTYPE_DNS 0x02
225 #define FCDNS_GSSUBTYPE_IP 0x03
227 static int proto_fcdns;
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;
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;
306 static expert_field ei_fcdns_no_record_of_exchange;
307 static expert_field ei_fcdns_zone_mbrid;
309 typedef struct _fcdns_conv_key {
310 uint32_t conv_idx;
311 } fcdns_conv_key_t;
313 typedef struct _fcdns_conv_data {
314 uint32_t opcode;
315 } fcdns_conv_data_t;
317 static wmem_map_t *fcdns_req_hash;
320 * Hash Functions
322 static int
323 fcdns_equal(const void *v, const void *w)
325 const fcdns_conv_key_t *v1 = (const fcdns_conv_key_t *)v;
326 const fcdns_conv_key_t *v2 = (const fcdns_conv_key_t *)w;
328 return (v1->conv_idx == v2->conv_idx);
331 static unsigned
332 fcdns_hash (const void *v)
334 const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
335 unsigned val;
337 val = key->conv_idx;
339 return val;
342 static void
343 dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
345 static int * const flags[] = {
346 &hf_fcdns_cos_f,
347 &hf_fcdns_cos_1,
348 &hf_fcdns_cos_2,
349 &hf_fcdns_cos_3,
350 &hf_fcdns_cos_4,
351 &hf_fcdns_cos_6,
352 NULL
355 proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfindex,
356 ett_cos_flags, flags, ENC_BIG_ENDIAN, BMT_NO_FALSE|BMT_NO_TFS);
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
364 static void
365 dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
367 uint8_t type;
368 static int * const flags[] = {
369 &hf_fcdns_fc4features_i,
370 &hf_fcdns_fc4features_t,
371 NULL
374 type = tvb_get_uint8(tvb, offset+1);
376 if(type==FC_TYPE_SCSI){
377 proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_fcdns_fc4features,
378 ett_fc4features, flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS);
379 } else {
380 proto_tree_add_item(parent_tree, hf_fcdns_fc4features, tvb, offset, 1, ENC_NA);
383 proto_tree_add_item (parent_tree, hf_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
386 /* The feature routines just decode FCP's FC-4 features field
388 static void
389 dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
391 static int * const flags[] = {
392 &hf_fcdns_fc4features_i,
393 &hf_fcdns_fc4features_t,
394 NULL
397 proto_tree_add_bitmask(parent_tree, tvb, offset, hf_fcdns_fc4features,
398 ett_fc4features, flags, ENC_NA);
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)
407 proto_item *item;
408 proto_tree *tree;
409 uint32_t flags;
411 item=proto_tree_add_item(parent_tree, hfindex, tvb, offset,
412 32, ENC_NA);
413 tree=proto_item_add_subtree(item, ett_fc4flags);
415 flags = tvb_get_ntohl (tvb, offset);
417 proto_tree_add_boolean(tree, hf_fcdns_fc4type_fcp, tvb, offset, 4, flags);
418 if (flags&0x0100){
419 proto_item_append_text(item, " FCP");
421 flags&=(~( 0x0100 ));
423 proto_tree_add_boolean(tree, hf_fcdns_fc4type_ip, tvb, offset, 4, flags);
424 if (flags&0x0020){
425 proto_item_append_text(item, " IP");
427 flags&=(~( 0x0020 ));
429 proto_tree_add_boolean(tree, hf_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
430 if (flags&0x0010){
431 proto_item_append_text(item, " LLC/SNAP");
433 /*flags&=(~( 0x0010 ));*/
436 flags = tvb_get_ntohl (tvb, offset+4);
438 proto_tree_add_boolean(tree, hf_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
439 if (flags&0x0010){
440 proto_item_append_text(item, " SW_ILS");
442 flags&=(~( 0x0010 ));
444 proto_tree_add_boolean(tree, hf_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
445 if (flags&0x0004){
446 proto_item_append_text(item, " SNMP");
448 flags&=(~( 0x0004 ));
450 proto_tree_add_boolean(tree, hf_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
451 if (flags&0x0001){
452 proto_item_append_text(item, " GS3");
454 /*flags&=(~( 0x0001 ));*/
457 flags = tvb_get_ntohl (tvb, offset+8);
459 proto_tree_add_boolean(tree, hf_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
460 if (flags&0x0001){
461 proto_item_append_text(item, " VI");
463 /*flags&=(~( 0x0001 ));*/
466 /* Code to actually dissect the packets */
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)
473 proto_tree_add_item (tree, hf_fcdns_req_portid, tvb, offset, 3, ENC_NA);
476 static void
477 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
479 int offset = 16; /* past the fc_ct header */
480 uint8_t len;
482 if (req_tree) {
483 if (isreq) {
484 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
486 else {
487 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb, offset,
488 1, ENC_BIG_ENDIAN);
489 proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
490 offset+1, 3, ENC_NA);
491 proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb,
492 offset+4, 8, ENC_NA);
493 len = tvb_get_uint8 (tvb, offset+12);
494 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb,
495 offset+12, 1, ENC_BIG_ENDIAN);
496 if (!tvb_offset_exists (tvb, 29+len))
497 return;
499 if (len) {
500 proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
501 offset+13, len, ENC_ASCII);
504 if (tvb_offset_exists (tvb, 292)) {
505 proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
506 offset+268, 8, ENC_NA);
508 if (tvb_offset_exists (tvb, 548)) {
509 len = tvb_get_uint8 (tvb, offset+276);
510 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
511 offset+276, 1, ENC_BIG_ENDIAN);
512 if (len) {
513 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
514 offset+277, len, ENC_ASCII);
517 if (tvb_offset_exists (tvb, 556)) {
518 proto_tree_add_item (req_tree, hf_fcdns_rply_ipa, tvb,
519 offset+532, 8, ENC_NA);
521 if (tvb_offset_exists (tvb, 572)) {
522 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb,
523 offset+540, 16, ENC_NA);
525 if (tvb_offset_exists (tvb, 576)) {
526 dissect_cos_flags(req_tree, tvb, offset+556, hf_fcdns_reply_cos);
528 if (tvb_offset_exists (tvb, 608)) {
529 dissect_fc4type(req_tree, tvb, offset+560, hf_fcdns_rply_gft);
531 if (tvb_offset_exists (tvb, 624)) {
532 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb,
533 offset+592, 16, ENC_NA);
535 if (tvb_offset_exists (tvb, 632)) {
536 proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
537 offset+608, 8, ENC_NA);
539 if (tvb_offset_exists (tvb, 635)) {
540 proto_tree_add_item (req_tree, hf_fcdns_rply_hrdaddr, tvb,
541 offset+617, 3, ENC_NA);
547 static void
548 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
550 int offset = 16; /* past the fc_ct header */
552 if (req_tree) {
553 if (isreq) {
554 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
556 else {
557 proto_tree_add_item (req_tree, hf_fcdns_rply_pname, tvb, offset,
558 8, ENC_NA);
563 static void
564 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
566 int offset = 16; /* past the fc_ct header */
568 if (req_tree) {
569 if (isreq) {
570 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
572 else {
573 proto_tree_add_item (req_tree, hf_fcdns_rply_nname, tvb,
574 offset, 8, ENC_NA);
579 static void
580 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
582 int offset = 16; /* past the fc_ct header */
584 if (req_tree) {
585 if (isreq) {
586 dissect_fcdns_req_portid (tvb, req_tree, offset);
588 else {
589 dissect_cos_flags(req_tree, tvb, offset, hf_fcdns_reply_cos);
594 static void
595 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
597 int offset = 16; /* past the fc_ct header */
599 if (req_tree) {
600 if (isreq) {
601 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
603 else {
604 dissect_fc4type(req_tree, tvb, offset, hf_fcdns_rply_gft);
609 static void
610 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
612 int offset = 16; /* past the fc_ct header */
613 uint8_t len;
615 if (req_tree) {
616 if (isreq) {
617 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
619 else {
620 len = tvb_get_uint8 (tvb, offset);
621 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen,
622 tvb, offset, 1, ENC_BIG_ENDIAN);
623 proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
624 offset+1, len, ENC_ASCII);
629 static void
630 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
632 int offset = 16; /* past the fc_ct header */
634 if (req_tree) {
635 if (isreq) {
636 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
638 else {
639 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb,
640 offset, 1, ENC_BIG_ENDIAN);
645 static void
646 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
648 int offset = 16; /* past the fc_ct header */
650 if (req_tree) {
651 if (isreq) {
652 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
654 else {
655 proto_tree_add_item (req_tree, hf_fcdns_rply_fpname, tvb,
656 offset, 8, ENC_NA);
662 static void
663 dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
665 int offset = 16; /* past the fc_ct header */
666 int tot_len, desclen;
668 if (req_tree) {
669 if (isreq) {
670 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
671 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_fc4type);
673 else {
674 tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
675 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 desclen = tvb_get_uint8 (tvb, offset);
679 proto_tree_add_item (req_tree, hf_fcdns_rply_fc4desc, tvb,
680 offset, desclen, ENC_NA);
681 tot_len -= 255; /* descriptors are aligned to 255 bytes */
682 offset += 256;
688 static void
689 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
691 int offset = 16; /* past the fc_ct header */
693 if (req_tree) {
694 if (isreq) {
695 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
697 else {
698 dissect_fc4features(req_tree, tvb, offset);
703 static void
704 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
706 int offset = 16; /* past the fc_ct header */
708 if (req_tree) {
709 if (isreq) {
710 proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
711 offset, 8, ENC_NA);
713 else {
714 proto_tree_add_item (req_tree, hf_fcdns_rply_portid, tvb,
715 offset+1, 3, ENC_NA);
720 static void
721 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
723 int offset = 16; /* past the fc_ct header */
725 if (req_tree) {
726 if (isreq) {
727 proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
728 offset, 8, ENC_NA);
730 else {
731 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset,
732 16, ENC_NA);
737 static void
738 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
740 int offset = 16; /* past the fc_ct header */
741 uint8_t islast;
743 if (req_tree) {
744 if (isreq) {
745 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
746 offset, 8, ENC_NA);
748 else {
749 do {
750 islast = tvb_get_uint8 (tvb, offset);
751 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
752 tvb, offset+1, 3, ENC_NA);
753 offset += 4;
754 } while (!(islast & 0x80));
759 static void
760 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
762 int offset = 16; /* past the fc_ct header */
764 if (req_tree) {
765 if (isreq) {
766 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
767 offset, 8, ENC_NA);
769 else {
770 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset,
771 16, ENC_NA);
776 static void
777 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
779 int offset = 16; /* past the fc_ct header */
780 uint8_t islast;
782 if (req_tree) {
783 if (isreq) {
784 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
785 offset, 8, ENC_NA);
787 else {
788 do {
789 islast = tvb_get_uint8 (tvb, offset);
790 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
791 tvb, offset+1, 3, ENC_NA);
792 proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
793 tvb, offset+8, 8, ENC_NA);
794 offset += 16;
795 } while (!(islast & 0x80));
800 static void
801 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
803 int offset = 16; /* past the fc_ct header */
804 uint8_t len;
806 if (req_tree) {
807 if (isreq) {
808 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
809 offset, 8, ENC_NA);
811 else {
812 len = tvb_get_uint8 (tvb, offset);
813 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
814 offset, 1, ENC_BIG_ENDIAN);
815 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
816 offset+1, len, ENC_ASCII);
821 static void
822 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
824 int offset = 16; /* past the fc_ct header */
825 uint8_t islast;
827 if (req_tree) {
828 if (isreq) {
829 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
830 tvb, offset+1, 1, ENC_BIG_ENDIAN);
831 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
832 tvb, offset+2, 1, ENC_BIG_ENDIAN);
833 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
834 tvb, offset+3, 1, ENC_BIG_ENDIAN);
836 else {
837 do {
838 islast = tvb_get_uint8 (tvb, offset);
839 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
840 tvb, offset+1, 3, ENC_NA);
841 offset += 4;
842 } while (!(islast & 0x80));
847 static void
848 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
850 int offset = 16; /* past the fc_ct header */
851 uint8_t islast;
853 if (req_tree) {
854 if (isreq) {
855 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
856 tvb, offset+1, 1, ENC_BIG_ENDIAN);
857 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
858 tvb, offset+2, 1, ENC_BIG_ENDIAN);
859 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
860 tvb, offset+3, 1, ENC_BIG_ENDIAN);
862 else {
863 do {
864 islast = tvb_get_uint8 (tvb, offset);
865 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
866 tvb, offset+1, 3, ENC_NA);
867 proto_tree_add_item (req_tree, hf_fcdns_rply_pname,
868 tvb, offset+4, 8, ENC_NA);
869 offset += 16;
870 } while (!(islast & 0x80));
875 static void
876 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
878 int offset = 16; /* past the fc_ct header */
879 uint8_t islast;
881 if (req_tree) {
882 if (isreq) {
883 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
884 tvb, offset+1, 1, ENC_BIG_ENDIAN);
885 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
886 tvb, offset+2, 1, ENC_BIG_ENDIAN);
887 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
888 tvb, offset+3, 1, ENC_BIG_ENDIAN);
890 else {
891 do {
892 islast = tvb_get_uint8 (tvb, offset);
893 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
894 tvb, offset+1, 3, ENC_NA);
895 proto_tree_add_item (req_tree, hf_fcdns_rply_nname,
896 tvb, offset+4, 8, ENC_NA);
897 offset += 16;
898 } while (!(islast & 0x80));
903 static void
904 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
906 int offset = 16; /* past the fc_ct header */
907 uint8_t islast = 0;
909 if (req_tree) {
910 if (isreq) {
911 proto_tree_add_item (req_tree, hf_fcdns_req_ptype,
912 tvb, offset, 1, ENC_BIG_ENDIAN);
913 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
914 tvb, offset+1, 1, ENC_BIG_ENDIAN);
915 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
916 tvb, offset+2, 1, ENC_BIG_ENDIAN);
918 else {
919 do {
920 islast = tvb_get_uint8 (tvb, offset);
921 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
922 tvb, offset+1, 3, ENC_NA);
923 offset += 4;
924 } while (!(islast & 0x80));
929 static void
930 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
932 int offset = 16; /* past the fc_ct header */
933 uint8_t islast;
935 if (req_tree) {
936 if (isreq) {
937 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset,
938 16, ENC_NA);
940 else {
941 do {
942 islast = tvb_get_uint8 (tvb, offset);
943 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
944 tvb, offset+1, 3, ENC_NA);
945 offset += 4;
946 } while (!(islast & 0x80));
951 static void
952 dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
954 int offset = 16; /* past the fc_ct header */
955 uint8_t islast;
957 if (req_tree) {
958 if (isreq) {
959 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope, tvb,
960 offset+1, 1, ENC_BIG_ENDIAN);
961 proto_tree_add_item (req_tree, hf_fcdns_req_areascope, tvb,
962 offset+2, 1, ENC_BIG_ENDIAN);
963 dissect_fc4features_and_type(req_tree, tvb, offset+6);
965 else {
966 do {
967 islast = tvb_get_uint8 (tvb, offset);
968 proto_tree_add_item (req_tree, hf_fcdns_rply_portid,
969 tvb, offset+1, 3, ENC_NA);
970 offset += 4;
971 } while (!(islast & 0x80));
976 static void
977 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
979 int offset = 16; /* past the fc_ct header */
981 if (req_tree) {
982 if (isreq) {
983 proto_tree_add_item (req_tree, hf_fcdns_req_portid,
984 tvb, offset+1, 3, ENC_NA);
985 proto_tree_add_item (req_tree, hf_fcdns_req_pname, tvb,
986 offset+4, 8, ENC_NA);
991 static void
992 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
994 int offset = 16; /* past the fc_ct header */
996 if (req_tree) {
997 if (isreq) {
998 proto_tree_add_item (req_tree, hf_fcdns_req_portid,
999 tvb, offset+1, 3, ENC_NA);
1000 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb,
1001 offset+4, 8, ENC_NA);
1006 static void
1007 dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1009 int offset = 16; /* past the fc_ct header */
1011 if (req_tree && isreq) {
1012 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1013 offset+1, 3, ENC_NA);
1014 dissect_cos_flags(req_tree, tvb, offset+4, hf_fcdns_req_cos);
1018 static void
1019 dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1021 int offset = 16; /* past the fc_ct header */
1023 if (isreq) {
1024 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1025 offset+1, 3, ENC_NA);
1026 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb,
1027 offset+4, 1, ENC_BIG_ENDIAN);
1031 static void
1032 dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1034 int offset = 16; /* past the fc_ct header */
1036 if (isreq) {
1037 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1038 offset+1, 3, ENC_NA);
1039 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1043 static void
1044 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1046 int offset = 16; /* past the fc_ct header */
1047 uint8_t len;
1049 if (req_tree && isreq) {
1050 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1051 offset+1, 3, ENC_NA);
1052 proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb,
1053 offset+4, 1, ENC_BIG_ENDIAN);
1054 len = tvb_get_uint8 (tvb, offset+4);
1056 proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5,
1057 len, ENC_ASCII);
1061 static void
1062 dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1064 int offset = 16; /* past the fc_ct header */
1066 if (isreq) {
1067 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1068 offset+1, 3, ENC_NA);
1069 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb,
1070 offset+4, 16, ENC_NA);
1074 static void
1075 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1077 int offset = 16; /* past the fc_ct header */
1078 int len;
1080 if (isreq) {
1081 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb,
1082 offset+1, 3, ENC_NA);
1083 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1085 offset += 36;
1086 len = tvb_reported_length_remaining (tvb, offset);
1088 while (len > 0) {
1089 proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset,
1090 1, ENC_BIG_ENDIAN);
1091 proto_tree_add_item (req_tree, hf_fcdns_req_fdesc, tvb, offset+1,
1092 len, ENC_ASCII);
1093 offset += 256;
1094 len -= 256;
1099 static void
1100 dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1102 int offset = 16; /* past the fc_ct header */
1104 if (isreq) {
1105 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1106 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1110 static void
1111 dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1113 int offset = 16; /* past the fc_ct header */
1115 if (isreq) {
1116 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1117 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
1121 static void
1122 dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1124 int offset = 16; /* past the fc_ct header */
1125 uint8_t len;
1127 if (isreq) {
1128 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1129 len = tvb_get_uint8 (tvb, offset+8);
1131 proto_tree_add_item (req_tree, hf_fcdns_req_snamelen, tvb, offset+8,
1132 1, ENC_BIG_ENDIAN);
1133 proto_tree_add_item (req_tree, hf_fcdns_req_sname, tvb, offset+9,
1134 len, ENC_ASCII);
1138 static void
1139 dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1141 int offset = 16; /* past the fc_ct header */
1143 if (isreq) {
1144 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1148 static uint8_t *
1149 zonenm_to_str (wmem_allocator_t *scope, tvbuff_t *tvb, int offset)
1151 int len = tvb_get_uint8 (tvb, offset);
1152 return tvb_get_string_enc(scope, tvb, offset+4, len, ENC_ASCII);
1155 static void
1156 dissect_fcdns_zone_mbr (tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree, int offset)
1158 uint8_t mbrtype;
1159 int idlen;
1160 proto_item* ti;
1162 mbrtype = tvb_get_uint8 (tvb, offset);
1163 ti = proto_tree_add_uint (zmbr_tree, hf_fcdns_zone_mbrtype, tvb,
1164 offset, 1, mbrtype);
1165 proto_tree_add_item(zmbr_tree, hf_fcdns_zone_flags, tvb, offset+2, 1, ENC_NA);
1166 idlen = tvb_get_uint8 (tvb, offset+3);
1167 proto_tree_add_item(zmbr_tree, hf_fcdns_id_length, tvb, offset+3, 1, ENC_NA);
1168 switch (mbrtype) {
1169 case FC_SWILS_ZONEMBR_WWN:
1170 proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_wwn, tvb,
1171 offset+4, 8, ENC_NA);
1172 break;
1173 case FC_SWILS_ZONEMBR_DP:
1174 proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_uint, tvb,
1175 offset+4, 4, ENC_BIG_ENDIAN);
1176 break;
1177 case FC_SWILS_ZONEMBR_FCID:
1178 proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrid_fc, tvb,
1179 offset+4, 3, ENC_NA);
1180 break;
1181 case FC_SWILS_ZONEMBR_ALIAS:
1182 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1183 offset+4, idlen, zonenm_to_str (pinfo->pool, tvb, offset+4));
1184 break;
1185 default:
1186 expert_add_info(pinfo, ti, &ei_fcdns_zone_mbrid);
1191 static void
1192 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1194 int numrec, i, len;
1195 uint8_t objfmt;
1197 if (tree) {
1198 numrec = tvb_get_ntohl (tvb, offset);
1199 proto_tree_add_uint(tree, hf_fcdns_num_entries, tvb, offset, 4, numrec);
1200 offset += 4;
1202 for (i = 0; i < numrec; i++) {
1203 objfmt = tvb_get_uint8 (tvb, offset);
1205 proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
1206 proto_tree_add_item (tree, hf_fcdns_rply_ownerid, tvb, offset+1, 3, ENC_NA);
1207 proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
1208 1, ENC_BIG_ENDIAN);
1209 proto_tree_add_item (tree, hf_fcdns_rply_portid, tvb, offset+5, 3, ENC_NA);
1210 proto_tree_add_item (tree, hf_fcdns_rply_pname, tvb, offset+8, 8, ENC_NA);
1211 offset += 16;
1212 if (!(objfmt & 0x1)) {
1213 len = tvb_get_uint8 (tvb, offset);
1214 proto_tree_add_item (tree, hf_fcdns_rply_spnamelen, tvb,
1215 offset, 1, ENC_BIG_ENDIAN);
1216 proto_tree_add_item (tree, hf_fcdns_rply_spname, tvb,
1217 offset+1, len, ENC_ASCII);
1218 offset += 256;
1220 proto_tree_add_item (tree, hf_fcdns_rply_nname, tvb, offset, 8, ENC_NA);
1221 offset += 8;
1222 if (!(objfmt & 0x1)) {
1223 len = tvb_get_uint8 (tvb, offset);
1224 proto_tree_add_item (tree, hf_fcdns_rply_snamelen, tvb,
1225 offset, 1, ENC_BIG_ENDIAN);
1226 proto_tree_add_item (tree, hf_fcdns_rply_sname, tvb,
1227 offset+1, len, ENC_ASCII);
1228 offset += 256;
1230 proto_tree_add_item (tree, hf_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
1231 proto_tree_add_item (tree, hf_fcdns_rply_ipnode, tvb, offset+8, 16,
1232 ENC_NA);
1233 dissect_cos_flags(tree, tvb, offset+24, hf_fcdns_reply_cos);
1234 dissect_fc4type(tree, tvb, offset+28, hf_fcdns_rply_gft);
1235 proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60,
1236 16, ENC_NA);
1237 proto_tree_add_item (tree, hf_fcdns_rply_fpname, tvb, offset+76,
1238 8, ENC_NA);
1239 proto_tree_add_item (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85,
1240 3, ENC_NA);
1241 offset += 88;
1242 if (objfmt & 0x2) {
1243 dissect_fc4features(tree, tvb, offset);
1244 if (tvb_get_uint8 (tvb, offset+129)) {
1245 proto_tree_add_item (tree, hf_fcdns_rply_fc4type, tvb,
1246 offset+128, 1, ENC_BIG_ENDIAN);
1247 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1248 offset+129, 1, ENC_BIG_ENDIAN);
1249 len = tvb_get_uint8 (tvb, offset+132);
1250 proto_tree_add_item (tree, hf_fcdns_rply_fc4desclen, tvb,
1251 offset+132, 1, ENC_BIG_ENDIAN);
1252 proto_tree_add_item (tree, hf_fcdns_rply_fc4desc, tvb,
1253 offset+133, len, ENC_NA);
1255 else {
1256 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1257 offset+129, 1, ENC_BIG_ENDIAN);
1259 offset += 388; /* FC4 desc is 260 bytes, maybe padded */
1265 static void
1266 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1268 int offset = 16; /* past the fc_ct header */
1270 if (isreq) {
1271 proto_tree_add_item (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, ENC_NA);
1273 else {
1274 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1278 static void
1279 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1281 int offset = 16; /* past the fc_ct header */
1282 if (isreq) {
1283 proto_tree_add_item(req_tree, hf_fcdns_req_pname, tvb, offset, 8, ENC_NA);
1285 else {
1286 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1290 static void
1291 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1293 int offset = 16; /* past the fc_ct header */
1295 if (isreq) {
1296 proto_tree_add_item (req_tree, hf_fcdns_req_nname, tvb, offset, 8, ENC_NA);
1298 else {
1299 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1303 static void
1304 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1306 int offset = 16; /* past the fc_ct header */
1308 if (isreq) {
1309 if (req_tree) {
1310 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1313 else {
1314 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1318 static void
1319 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1321 int offset = 16; /* past the fc_ct header */
1323 if (isreq) {
1324 if (req_tree) {
1325 dissect_fc4type(req_tree, tvb, offset, hf_fcdns_fc4type);
1328 else {
1329 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1333 static void
1334 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1336 int offset = 16; /* past the fc_ct header */
1338 if (isreq) {
1339 if (req_tree) {
1340 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+3,
1341 1, ENC_BIG_ENDIAN);
1344 else {
1345 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1349 static void
1350 dissect_fcdns_gezm (tvbuff_t *tvb, packet_info* pinfo, proto_tree *req_tree, bool isreq)
1352 int offset = 16; /* past the fc_ct header */
1354 if (isreq) {
1355 dissect_fcdns_zone_mbr (tvb, pinfo, req_tree, offset);
1357 else {
1358 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1362 static void
1363 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1365 int offset = 16; /* past the fc_ct header */
1366 int str_len;
1368 if (isreq) {
1369 if (req_tree) {
1370 str_len = tvb_get_uint8 (tvb, offset);
1371 proto_tree_add_uint(req_tree, hf_fcdns_zonelen, tvb, offset, 1, str_len);
1372 proto_tree_add_item (req_tree, hf_fcdns_zonenm, tvb, offset+3,
1373 str_len, ENC_ASCII);
1376 else {
1377 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1381 static void
1382 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1384 int offset = 16; /* past the fc_ct header */
1386 if (isreq) {
1387 if (req_tree) {
1388 proto_tree_add_item (req_tree, hf_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1391 else {
1392 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1396 static void
1397 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, bool isreq)
1399 int offset = 16; /* past the fc_ct header */
1401 if (isreq) {
1402 if (req_tree) {
1403 dissect_fc4features(req_tree, tvb, offset);
1406 else {
1407 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1411 static void
1412 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1414 int offset = 0;
1416 if (req_tree) {
1417 proto_tree_add_item (req_tree, hf_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1418 proto_tree_add_item (req_tree, hf_fcdns_rjtdetail, tvb, offset+14, 1,
1419 ENC_BIG_ENDIAN);
1420 proto_tree_add_item (req_tree, hf_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1424 static int
1425 dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1427 /* Set up structures needed to add the protocol subtree and manage it */
1428 proto_item *ti = NULL;
1429 proto_tree *fcdns_tree = NULL;
1430 int offset = 0;
1431 int opcode,
1432 failed_opcode = 0;
1433 int isreq = 1;
1434 fc_ct_preamble cthdr;
1435 conversation_t *conversation;
1436 fcdns_conv_data_t *cdata;
1437 fcdns_conv_key_t ckey, *req_key;
1438 fc_hdr *fchdr;
1440 /* Reject the packet if data is NULL */
1441 if (data == NULL)
1442 return 0;
1443 fchdr = (fc_hdr *)data;
1445 tvb_memcpy (tvb, (uint8_t *)&cthdr, offset, FCCT_PRMBL_SIZE);
1446 cthdr.revision = tvb_get_uint8 (tvb, offset);
1447 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1448 cthdr.opcode = g_ntohs (cthdr.opcode);
1449 opcode = cthdr.opcode;
1450 cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
1452 /* Determine the type of server the request/response is for */
1453 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1454 col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1455 else
1456 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1458 if (tree) {
1459 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1460 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1462 "dNS");
1463 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1465 else {
1466 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1468 "Unzoned NS");
1469 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1473 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1474 conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
1475 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1476 fchdr->rxid, NO_PORT_B);
1477 if (!conversation) {
1478 conversation = conversation_new (pinfo->num, &pinfo->src, &pinfo->dst,
1479 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1480 fchdr->rxid, NO_PORT2);
1483 ckey.conv_idx = conversation->conv_index;
1485 cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash,
1486 &ckey);
1487 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.
1492 cdata->opcode = opcode;
1494 else {
1495 req_key = wmem_new(wmem_file_scope(), fcdns_conv_key_t);
1496 req_key->conv_idx = conversation->conv_index;
1498 cdata = wmem_new(wmem_file_scope(), fcdns_conv_data_t);
1499 cdata->opcode = opcode;
1501 wmem_map_insert (fcdns_req_hash, req_key, cdata);
1503 col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1504 "0x%x"));
1506 else {
1507 /* Opcode is ACC or RJT */
1508 conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
1509 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1510 fchdr->rxid, NO_PORT_B);
1511 isreq = 0;
1512 if (!conversation) {
1513 if (opcode == FCCT_MSG_ACC) {
1514 col_add_str (pinfo->cinfo, COL_INFO,
1515 val_to_str (opcode, fc_dns_opcode_val,
1516 "0x%x"));
1517 /* No record of what this accept is for. Can't decode */
1518 proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1519 return 0;
1522 else {
1523 ckey.conv_idx = conversation->conv_index;
1525 cdata = (fcdns_conv_data_t *)wmem_map_lookup (fcdns_req_hash, &ckey);
1527 if (cdata != NULL) {
1528 if (opcode == FCCT_MSG_ACC) {
1529 opcode = cdata->opcode;
1531 else
1532 failed_opcode = cdata->opcode;
1535 if (opcode != FCCT_MSG_RJT) {
1536 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1537 val_to_str (opcode, fc_dns_opcode_val,
1538 "0x%x"));
1540 else {
1541 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1542 val_to_str (failed_opcode,
1543 fc_dns_opcode_val,
1544 "0x%x"));
1547 if (tree) {
1548 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1549 /* No record of what this accept is for. Can't decode */
1550 proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1551 return 0;
1557 if (tree) {
1558 proto_tree_add_item (fcdns_tree, hf_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1559 proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10,
1560 2, ENC_BIG_ENDIAN);
1563 switch (opcode) {
1564 case FCCT_MSG_RJT:
1565 dissect_fcdns_rjt (tvb, fcdns_tree);
1566 break;
1567 case FCDNS_GA_NXT:
1568 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1569 break;
1570 case FCDNS_GPN_ID:
1571 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1572 break;
1573 case FCDNS_GNN_ID:
1574 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1575 break;
1576 case FCDNS_GCS_ID:
1577 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1578 break;
1579 case FCDNS_GFT_ID:
1580 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1581 break;
1582 case FCDNS_GSPN_ID:
1583 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1584 break;
1585 case FCDNS_GPT_ID:
1586 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1587 break;
1588 case FCDNS_GFPN_ID:
1589 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1590 break;
1591 case FCDNS_GFD_ID:
1592 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1593 break;
1594 case FCDNS_GFF_ID:
1595 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1596 break;
1597 case FCDNS_GID_PN:
1598 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1599 break;
1600 case FCDNS_GIPP_PN:
1601 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1602 break;
1603 case FCDNS_GID_NN:
1604 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1605 break;
1606 case FCDNS_GPN_NN:
1607 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1608 break;
1609 case FCDNS_GIP_NN:
1610 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1611 break;
1612 case FCDNS_GSNN_NN:
1613 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1614 break;
1615 case FCDNS_GID_FT:
1616 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1617 break;
1618 case FCDNS_GPN_FT:
1619 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1620 break;
1621 case FCDNS_GNN_FT:
1622 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1623 break;
1624 case FCDNS_GID_PT:
1625 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1626 break;
1627 case FCDNS_GID_IPP:
1628 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1629 break;
1630 case FCDNS_GID_FF:
1631 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1632 break;
1633 case FCDNS_RPN_ID:
1634 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1635 break;
1636 case FCDNS_RNN_ID:
1637 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1638 break;
1639 case FCDNS_RCS_ID:
1640 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1641 break;
1642 case FCDNS_RPT_ID:
1643 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1644 break;
1645 case FCDNS_RFT_ID:
1646 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1647 break;
1648 case FCDNS_RSPN_ID:
1649 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1650 break;
1651 case FCDNS_RIPP_ID:
1652 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1653 break;
1654 case FCDNS_RFD_ID:
1655 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1656 break;
1657 case FCDNS_RFF_ID:
1658 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1659 break;
1660 case FCDNS_RIP_NN:
1661 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1662 break;
1663 case FCDNS_RSNN_NN:
1664 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1665 break;
1666 case FCDNS_DA_ID:
1667 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1668 break;
1669 case FCDNS_GE_ID:
1670 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1671 break;
1672 case FCDNS_GE_PN:
1673 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1674 break;
1675 case FCDNS_GE_NN:
1676 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1677 break;
1678 case FCDNS_GE_IP:
1679 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1680 break;
1681 case FCDNS_GE_FT:
1682 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1683 break;
1684 case FCDNS_GE_PT:
1685 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1686 break;
1687 case FCDNS_GE_ZM:
1688 dissect_fcdns_gezm (tvb, pinfo, fcdns_tree, isreq);
1689 break;
1690 case FCDNS_GE_ZN:
1691 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1692 break;
1693 case FCDNS_GE_IPP:
1694 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1695 break;
1696 case FCDNS_GE_FF:
1697 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1698 break;
1699 default:
1700 break;
1703 return tvb_captured_length(tvb);
1706 /* Register the protocol with Wireshark */
1708 void
1709 proto_register_fcdns (void)
1711 static hf_register_info hf[] = {
1712 { &hf_fcdns_opcode,
1713 { "Opcode", "fcdns.opcode",
1714 FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val), 0x0,
1715 NULL, HFILL }
1717 { &hf_fcdns_reason,
1718 { "Reason Code", "fcdns.rply.reason",
1719 FT_UINT8, BASE_HEX, VALS (fc_ct_rjt_code_vals), 0x0,
1720 NULL, HFILL }
1722 { &hf_fcdns_vendor,
1723 { "Vendor Unique Reject Code", "fcdns.rply.vendor",
1724 FT_UINT8, BASE_HEX, NULL, 0x0,
1725 NULL, HFILL }
1727 { &hf_fcdns_req_portid,
1728 { "Port Identifier", "fcdns.req.portid",
1729 FT_BYTES, SEP_DOT, NULL, 0x0,
1730 NULL, HFILL }
1732 { &hf_fcdns_rply_pname,
1733 { "Port Name", "fcdns.rply.pname",
1734 FT_FCWWN, BASE_NONE, NULL, 0x0,
1735 NULL, HFILL }
1737 { &hf_fcdns_rply_nname,
1738 { "Node Name", "fcdns.rply.nname",
1739 FT_FCWWN, BASE_NONE, NULL, 0x0,
1740 NULL, HFILL }
1742 { &hf_fcdns_rply_gft,
1743 { "FC-4 Types Supported", "fcdns.rply.gft",
1744 FT_NONE, BASE_NONE, NULL, 0x0,
1745 NULL, HFILL }
1747 { &hf_fcdns_rply_snamelen,
1748 { "Symbolic Node Name Length", "fcdns.rply.snamelen",
1749 FT_UINT8, BASE_DEC, NULL, 0x0,
1750 NULL, HFILL }
1752 { &hf_fcdns_rply_sname,
1753 { "Symbolic Node Name", "fcdns.rply.sname",
1754 FT_STRING, BASE_NONE, NULL, 0x0,
1755 NULL, HFILL }
1757 { &hf_fcdns_rply_ptype,
1758 { "Port Type", "fcdns.rply.porttype",
1759 FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
1760 NULL, HFILL }
1762 { &hf_fcdns_rply_fpname,
1763 { "Fabric Port Name", "fcdns.rply.fpname",
1764 FT_FCWWN, BASE_NONE, NULL, 0x0,
1765 NULL, HFILL }
1767 { &hf_fcdns_fc4type,
1768 { "FC-4 Types", "fcdns.req.fc4types",
1769 FT_NONE, BASE_NONE, NULL, 0x0,
1770 NULL, HFILL }
1772 { &hf_fcdns_rply_fc4type,
1773 { "FC-4 Descriptor Type", "fcdns.rply.fc4type",
1774 FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
1775 NULL, HFILL }
1777 { &hf_fcdns_rply_fc4desc,
1778 { "FC-4 Descriptor", "fcdns.rply.fc4desc",
1779 FT_BYTES, BASE_NONE, NULL, 0x0,
1780 NULL, HFILL }
1782 { &hf_fcdns_req_pname,
1783 { "Port Name", "fcdns.req.portname",
1784 FT_FCWWN, BASE_NONE, NULL, 0x0,
1785 NULL, HFILL }
1787 { &hf_fcdns_rply_portid,
1788 { "Port Identifier", "fcdns.rply.portid",
1789 FT_BYTES, SEP_DOT, NULL, 0x0,
1790 NULL, HFILL }
1792 { &hf_fcdns_req_nname,
1793 { "Node Name", "fcdns.req.nname",
1794 FT_FCWWN, BASE_NONE, NULL, 0x0,
1795 NULL, HFILL }
1797 { &hf_fcdns_req_domainscope,
1798 { "Domain ID Scope", "fcdns.req.domainid",
1799 FT_UINT8, BASE_HEX, NULL, 0x0,
1800 NULL, HFILL }
1802 { &hf_fcdns_req_areascope,
1803 { "Area ID Scope", "fcdns.req.areaid",
1804 FT_UINT8, BASE_HEX, NULL, 0x0,
1805 NULL, HFILL }
1807 { &hf_fcdns_req_ptype,
1808 { "Port Type", "fcdns.req.porttype",
1809 FT_UINT8, BASE_HEX, VALS (fc_dns_port_type_val), 0x0,
1810 NULL, HFILL }
1812 { &hf_fcdns_req_cos,
1813 { "Requested Class of Service", "fcdns.req.class",
1814 FT_UINT32, BASE_HEX, NULL, 0x0,
1815 NULL, HFILL }
1817 { &hf_fcdns_req_fc4types,
1818 { "FC-4 Types Supported", "fcdns.req.fc4types",
1819 FT_NONE, BASE_NONE, NULL, 0x0,
1820 NULL, HFILL }
1822 { &hf_fcdns_req_snamelen,
1823 { "Symbolic Name Length", "fcdns.req.snamelen",
1824 FT_UINT8, BASE_DEC, NULL, 0x0,
1825 NULL, HFILL }
1827 { &hf_fcdns_req_sname,
1828 { "Symbolic Port Name", "fcdns.req.sname",
1829 FT_STRING, BASE_NONE, NULL, 0x0,
1830 NULL, HFILL }
1832 { &hf_fcdns_rply_spnamelen,
1833 { "Symbolic Port Name Length", "fcdns.rply.spnamelen",
1834 FT_UINT8, BASE_DEC, NULL, 0x0,
1835 NULL, HFILL }
1837 { &hf_fcdns_rply_spname,
1838 { "Symbolic Port Name", "fcdns.rply.spname",
1839 FT_STRING, BASE_NONE, NULL, 0x0,
1840 NULL, HFILL }
1842 { &hf_fcdns_req_spnamelen,
1843 { "Symbolic Port Name Length", "fcdns.req.spnamelen",
1844 FT_UINT8, BASE_DEC, NULL, 0x0,
1845 NULL, HFILL }
1847 { &hf_fcdns_req_spname,
1848 { "Symbolic Port Name", "fcdns.req.spname",
1849 FT_STRING, BASE_NONE, NULL, 0x0,
1850 NULL, HFILL }
1852 { &hf_fcdns_rply_ipa,
1853 { "Initial Process Associator", "fcdns.rply.ipa",
1854 FT_BYTES, BASE_NONE, NULL, 0x0,
1855 NULL, HFILL }
1857 { &hf_fcdns_rply_ipnode,
1858 { "Node IP Address", "fcdns.rply.ipnode",
1859 FT_IPv6, BASE_NONE, NULL, 0x0,
1860 NULL, HFILL }
1862 { &hf_fcdns_rply_ipport,
1863 { "Port IP Address", "fcdns.rply.ipport",
1864 FT_IPv6, BASE_NONE, NULL, 0x0,
1865 NULL, HFILL }
1867 { &hf_fcdns_rply_fc4desclen,
1868 { "FC-4 Descriptor Length", "fcdns.rply.fc4desclen",
1869 FT_UINT8, BASE_DEC, NULL, 0x0,
1870 NULL, HFILL }
1872 { &hf_fcdns_rply_hrdaddr,
1873 { "Hard Address", "fcdns.rply.hrdaddr",
1874 FT_BYTES, SEP_DOT, NULL, 0x0,
1875 NULL, HFILL }
1877 { &hf_fcdns_req_fdesclen,
1878 { "FC-4 Descriptor Length", "fcdns.req.fc4desclen",
1879 FT_UINT8, BASE_DEC, NULL, 0x0,
1880 NULL, HFILL }
1882 { &hf_fcdns_req_fdesc,
1883 { "FC-4 Descriptor", "fcdns.req.fc4desc",
1884 FT_STRING, BASE_NONE, NULL, 0x0,
1885 NULL, HFILL }
1887 { &hf_fcdns_req_ip,
1888 { "IP Address", "fcdns.req.ip",
1889 FT_IPv6, BASE_NONE, NULL, 0x0,
1890 NULL, HFILL }
1892 { &hf_fcdns_rjtdetail,
1893 { "Reason Code Explanation", "fcdns.rply.reasondet",
1894 FT_UINT8, BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0,
1895 NULL, HFILL }
1897 { &hf_fcdns_zone_mbrtype,
1898 { "Zone Member Type", "fcdns.zone.mbrtype",
1899 FT_UINT8, BASE_HEX, VALS (fc_swils_zonembr_type_val), 0x0,
1900 NULL, HFILL }
1902 { &hf_fcdns_zone_mbrid,
1903 { "Member Identifier", "fcdns.zone.mbrid",
1904 FT_STRING, BASE_NONE, NULL, 0x0,
1905 NULL, HFILL }
1907 { &hf_fcdns_zone_mbrid_wwn,
1908 { "Member Identifier", "fcdns.zone.mbrid.wwn",
1909 FT_FCWWN, BASE_NONE, NULL, 0x0,
1910 NULL, HFILL }
1912 { &hf_fcdns_zone_mbrid_uint,
1913 { "Member Identifier", "fcdns.zone.mbrid.uint",
1914 FT_UINT32, BASE_HEX, NULL, 0x0,
1915 NULL, HFILL }
1917 { &hf_fcdns_zone_mbrid_fc,
1918 { "Member Identifier", "fcdns.zone.mbrid.fc",
1919 FT_BYTES, SEP_DOT, NULL, 0x0,
1920 NULL, HFILL }
1922 { &hf_fcdns_id_length,
1923 { "Identifier Length", "fcdns.id_length",
1924 FT_UINT8, BASE_DEC, NULL, 0x0,
1925 NULL, HFILL }
1927 { &hf_fcdns_zone_flags,
1928 { "Flags", "fcdns.zone_flags",
1929 FT_UINT8, BASE_HEX, NULL, 0x0,
1930 NULL, HFILL }
1932 { &hf_fcdns_zonelen,
1933 { "Name Length", "fcdns.zone_len",
1934 FT_UINT8, BASE_DEC, NULL, 0x0,
1935 NULL, HFILL }
1937 { &hf_fcdns_zonenm,
1938 { "Zone Name", "fcdns.zonename",
1939 FT_STRING, BASE_NONE, NULL, 0x0,
1940 NULL, HFILL }
1942 { &hf_fcdns_portip,
1943 { "Port IP Address", "fcdns.portip",
1944 FT_IPv4, BASE_NONE, NULL, 0x0,
1945 NULL, HFILL }
1947 { &hf_fcdns_num_entries,
1948 { "Number of Entries", "fcdns.num_entries",
1949 FT_UINT32, BASE_HEX, NULL, 0x0,
1950 NULL, HFILL }
1952 { &hf_fcdns_sw2_objfmt,
1953 { "Name Entry Object Format", "fcdns.entry.objfmt",
1954 FT_UINT8, BASE_HEX, NULL, 0x0,
1955 NULL, HFILL }
1957 { &hf_fcdns_num_fc4desc,
1958 { "Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
1959 FT_UINT8, BASE_DEC, NULL, 0x0,
1960 NULL, HFILL }
1962 { &hf_fcdns_rply_ownerid,
1963 { "Owner Id", "fcdns.rply.ownerid",
1964 FT_BYTES, SEP_DOT, NULL, 0x0,
1965 NULL, HFILL }
1967 { &hf_fcdns_maxres_size,
1968 { "Maximum/Residual Size", "fcdns.maxres_size",
1969 FT_UINT16, BASE_DEC, NULL, 0x0,
1970 NULL, HFILL }
1972 { &hf_fcdns_reply_cos,
1973 { "Class of Service Supported", "fcdns.reply.cos",
1974 FT_UINT32, BASE_HEX, NULL, 0x0,
1975 NULL, HFILL }
1977 { &hf_fcdns_cos_f,
1978 { "F", "fcdns.cos.f",
1979 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
1980 NULL, HFILL }
1982 { &hf_fcdns_cos_1,
1983 { "1", "fcdns.cos.1",
1984 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002,
1985 NULL, HFILL }
1987 { &hf_fcdns_cos_2,
1988 { "2", "fcdns.cos.2",
1989 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
1990 NULL, HFILL }
1992 { &hf_fcdns_cos_3,
1993 { "3", "fcdns.cos.3",
1994 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008,
1995 NULL, HFILL }
1997 { &hf_fcdns_cos_4,
1998 { "4", "fcdns.cos.4",
1999 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2000 NULL, HFILL }
2002 { &hf_fcdns_cos_6,
2003 { "6", "fcdns.cos.6",
2004 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040,
2005 NULL, HFILL }
2007 { &hf_fcdns_fc4type_llcsnap,
2008 { "LLC/SNAP", "fcdns.fc4types.llc_snap",
2009 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2010 NULL, HFILL }
2012 { &hf_fcdns_fc4type_ip,
2013 { "IP", "fcdns.fc4types.ip",
2014 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020,
2015 NULL, HFILL }
2017 { &hf_fcdns_fc4type_fcp,
2018 { "FCP", "fcdns.fc4types.fcp",
2019 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000100,
2020 NULL, HFILL }
2022 { &hf_fcdns_fc4type_swils,
2023 { "SW_ILS", "fcdns.fc4types.swils",
2024 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
2025 NULL, HFILL }
2027 { &hf_fcdns_fc4type_snmp,
2028 { "SNMP", "fcdns.fc4types.snmp",
2029 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
2030 NULL, HFILL }
2032 { &hf_fcdns_fc4type_gs3,
2033 { "GS3", "fcdns.fc4types.gs3",
2034 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
2035 NULL, HFILL }
2037 { &hf_fcdns_fc4type_vi,
2038 { "VI", "fcdns.fc4types.vi",
2039 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
2040 NULL, HFILL }
2042 { &hf_fcdns_fc4features,
2043 { "FC-4 Feature Bits", "fcdns.fc4features",
2044 FT_UINT8, BASE_HEX, NULL, 0x0,
2045 NULL, HFILL }
2047 { &hf_fcdns_fc4features_i,
2048 { "I", "fcdns.fc4features.i",
2049 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
2050 NULL, HFILL }
2052 { &hf_fcdns_fc4features_t,
2053 { "T", "fcdns.fc4features.t",
2054 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
2055 NULL, HFILL }
2057 { &hf_fcdns_req_fc4type,
2058 { "FC-4 Type", "fcdns.req.fc4type",
2059 FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
2060 NULL, HFILL }
2064 static int *ett[] = {
2065 &ett_fcdns,
2066 &ett_cos_flags,
2067 &ett_fc4flags,
2068 &ett_fc4features,
2071 static ei_register_info ei[] = {
2072 { &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 { &ei_fcdns_zone_mbrid, { "fcdns.zone.mbrid.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown member type format", EXPFILL }},
2076 expert_module_t* expert_fcdns;
2078 proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns");
2079 proto_register_field_array(proto_fcdns, hf, array_length(hf));
2080 proto_register_subtree_array(ett, array_length(ett));
2081 expert_fcdns = expert_register_protocol(proto_fcdns);
2082 expert_register_field_array(expert_fcdns, ei, array_length(ei));
2084 fcdns_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcdns_hash, fcdns_equal);
2086 dns_handle = register_dissector("fcdns", dissect_fcdns, proto_fcdns);
2089 void
2090 proto_reg_handoff_fcdns (void)
2092 dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
2093 dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_handle);
2097 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2099 * Local variables:
2100 * c-basic-offset: 4
2101 * tab-width: 8
2102 * indent-tabs-mode: nil
2103 * End:
2105 * vi: set shiftwidth=4 tabstop=8 expandtab:
2106 * :indentSize=4:tabSize=8:noTabs=true: