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 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #define NEW_PROTO_TREE_API
30 #include <epan/packet.h>
31 #include <epan/to_str.h>
32 #include <epan/wmem/wmem.h>
33 #include <epan/conversation.h>
34 #include <epan/etypes.h>
35 #include "packet-fc.h"
36 #include "packet-fcct.h"
37 #include "packet-fcdns.h"
38 #include "packet-fcswils.h"
40 void proto_register_fcdns(void);
41 void proto_reg_handoff_fcdns(void);
47 static dissector_handle_t dns_handle;
49 /* protocol and registered fields */
51 static header_field_info *hfi_fcdns = NULL;
53 #define FCDNS_HFI_INIT HFI_INIT(proto_fcdns)
56 static header_field_info hfi_fcdns_gssubtype FCDNS_HFI_INIT =
57 {"GS_Subtype", "fcdns.gssubtype", FT_UINT8, BASE_HEX,
58 VALS(fc_dns_subtype_val), 0x0, NULL, HFILL};
61 static header_field_info hfi_fcdns_opcode FCDNS_HFI_INIT =
62 {"Opcode", "fcdns.opcode", FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val),
65 static header_field_info hfi_fcdns_reason FCDNS_HFI_INIT =
66 {"Reason Code", "fcdns.rply.reason", FT_UINT8, BASE_HEX,
67 VALS (fc_ct_rjt_code_vals), 0x0, NULL, HFILL};
69 static header_field_info hfi_fcdns_vendor FCDNS_HFI_INIT =
70 {"Vendor Unique Reject Code", "fcdns.rply.vendor", FT_UINT8,
71 BASE_HEX, NULL, 0x0, NULL, HFILL};
73 static header_field_info hfi_fcdns_req_portid FCDNS_HFI_INIT =
74 {"Port Identifier", "fcdns.req.portid", FT_STRING, BASE_NONE, NULL, 0x0,
77 static header_field_info hfi_fcdns_rply_pname FCDNS_HFI_INIT =
78 {"Port Name", "fcdns.rply.pname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
81 static header_field_info hfi_fcdns_rply_nname FCDNS_HFI_INIT =
82 {"Node Name", "fcdns.rply.nname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
85 static header_field_info hfi_fcdns_rply_gft FCDNS_HFI_INIT =
86 {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_NONE, BASE_NONE,
87 NULL, 0x0, NULL, HFILL};
89 static header_field_info hfi_fcdns_rply_snamelen FCDNS_HFI_INIT =
90 {"Symbolic Node Name Length", "fcdns.rply.snamelen", FT_UINT8, BASE_DEC,
91 NULL, 0x0, NULL, HFILL};
93 static header_field_info hfi_fcdns_rply_sname FCDNS_HFI_INIT =
94 {"Symbolic Node Name", "fcdns.rply.sname", FT_STRING, BASE_NONE, NULL,
97 static header_field_info hfi_fcdns_rply_ptype FCDNS_HFI_INIT =
98 {"Port Type", "fcdns.rply.porttype", FT_UINT8, BASE_HEX,
99 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL};
101 static header_field_info hfi_fcdns_rply_fpname FCDNS_HFI_INIT =
102 {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING, BASE_NONE, NULL,
105 static header_field_info hfi_fcdns_fc4type FCDNS_HFI_INIT =
106 {"FC-4 Types", "fcdns.req.fc4type", FT_NONE, BASE_NONE,
107 NULL, 0x0, NULL, HFILL};
109 static header_field_info hfi_fcdns_rply_fc4type FCDNS_HFI_INIT =
110 {"FC-4 Descriptor Type", "fcdns.rply.fc4type", FT_UINT8, BASE_HEX,
111 VALS (fc_fc4_val), 0x0, NULL, HFILL};
113 static header_field_info hfi_fcdns_rply_fc4desc FCDNS_HFI_INIT =
114 {"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_BYTES, BASE_NONE, NULL,
117 static header_field_info hfi_fcdns_req_pname FCDNS_HFI_INIT =
118 {"Port Name", "fcdns.req.portname", FT_STRING, BASE_NONE, NULL, 0x0,
121 static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT =
122 {"Port Identifier", "fcdns.rply.portid", FT_STRING, BASE_NONE, NULL,
125 static header_field_info hfi_fcdns_req_nname FCDNS_HFI_INIT =
126 {"Node Name", "fcdns.req.nname", FT_STRING, BASE_NONE, NULL, 0x0,
129 static header_field_info hfi_fcdns_req_domainscope FCDNS_HFI_INIT =
130 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8, BASE_HEX, NULL,
133 static header_field_info hfi_fcdns_req_areascope FCDNS_HFI_INIT =
134 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8, BASE_HEX, NULL,
137 static header_field_info hfi_fcdns_req_ptype FCDNS_HFI_INIT =
138 {"Port Type", "fcdns.req.porttype", FT_UINT8, BASE_HEX,
139 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL};
141 static header_field_info hfi_fcdns_req_cos FCDNS_HFI_INIT =
142 {"Requested Class of Service", "fcdns.req.class", FT_UINT32, BASE_HEX,
143 NULL, 0x0, NULL, HFILL};
145 static header_field_info hfi_fcdns_req_fc4types FCDNS_HFI_INIT =
146 {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE, BASE_NONE,
147 NULL, 0x0, NULL, HFILL};
149 static header_field_info hfi_fcdns_req_snamelen FCDNS_HFI_INIT =
150 {"Symbolic Name Length", "fcdns.req.snamelen", FT_UINT8, BASE_DEC,
151 NULL, 0x0, NULL, HFILL};
153 static header_field_info hfi_fcdns_req_sname FCDNS_HFI_INIT =
154 {"Symbolic Port Name", "fcdns.req.sname", FT_STRING, BASE_NONE, NULL,
157 static header_field_info hfi_fcdns_rply_spnamelen FCDNS_HFI_INIT =
158 {"Symbolic Port Name Length", "fcdns.rply.spnamelen", FT_UINT8,
159 BASE_DEC, NULL, 0x0, NULL, HFILL};
161 static header_field_info hfi_fcdns_rply_spname FCDNS_HFI_INIT =
162 {"Symbolic Port Name", "fcdns.rply.spname", FT_STRING, BASE_NONE, NULL,
165 static header_field_info hfi_fcdns_req_spnamelen FCDNS_HFI_INIT =
166 {"Symbolic Port Name Length", "fcdns.req.spnamelen", FT_UINT8,
167 BASE_DEC, NULL, 0x0, NULL, HFILL};
169 static header_field_info hfi_fcdns_req_spname FCDNS_HFI_INIT =
170 {"Symbolic Port Name", "fcdns.req.spname", FT_STRING, BASE_NONE, NULL,
173 static header_field_info hfi_fcdns_rply_ipa FCDNS_HFI_INIT =
174 {"Initial Process Associator", "fcdns.rply.ipa", FT_BYTES, BASE_NONE,
175 NULL, 0x0, NULL, HFILL};
177 static header_field_info hfi_fcdns_rply_ipnode FCDNS_HFI_INIT =
178 {"Node IP Address", "fcdns.rply.ipnode", FT_IPv6, BASE_NONE, NULL,
181 static header_field_info hfi_fcdns_rply_ipport FCDNS_HFI_INIT =
182 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6, BASE_NONE, NULL,
185 static header_field_info hfi_fcdns_rply_fc4desclen FCDNS_HFI_INIT =
186 {"FC-4 Descriptor Length", "fcdns.rply.fc4desclen", FT_UINT8,
187 BASE_DEC, NULL, 0x0, NULL, HFILL};
189 static header_field_info hfi_fcdns_rply_hrdaddr FCDNS_HFI_INIT =
190 {"Hard Address", "fcdns.rply.hrdaddr", FT_STRING, BASE_NONE, NULL,
193 static header_field_info hfi_fcdns_req_fdesclen FCDNS_HFI_INIT =
194 {"FC-4 Descriptor Length", "fcdns.req.fc4desclen", FT_UINT8, BASE_DEC,
195 NULL, 0x0, NULL, HFILL};
197 static header_field_info hfi_fcdns_req_fdesc FCDNS_HFI_INIT =
198 {"FC-4 Descriptor", "fcdns.req.fc4desc", FT_STRING, BASE_NONE, NULL,
201 static header_field_info hfi_fcdns_req_ip FCDNS_HFI_INIT =
202 {"IP Address", "fcdns.req.ip", FT_IPv6, BASE_NONE, NULL, 0x0,
205 static header_field_info hfi_fcdns_rjtdetail FCDNS_HFI_INIT =
206 {"Reason Code Explanantion", "fcdns.rply.reasondet", FT_UINT8,
207 BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0, NULL, HFILL};
209 static header_field_info hfi_fcdns_zone_mbrtype FCDNS_HFI_INIT =
210 {"Zone Member Type", "fcdns.zone.mbrtype", FT_UINT8, BASE_HEX,
211 VALS (fc_swils_zonembr_type_val), 0x0, NULL, HFILL};
213 static header_field_info hfi_fcdns_zone_mbrid FCDNS_HFI_INIT =
214 {"Member Identifier", "fcdns.zone.mbrid", FT_STRING, BASE_NONE, NULL,
217 static header_field_info hfi_fcdns_zonenm FCDNS_HFI_INIT =
218 {"Zone Name", "fcdns.zonename", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
221 static header_field_info hfi_fcdns_portip FCDNS_HFI_INIT =
222 {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_NONE, NULL, 0x0,
225 static header_field_info hfi_fcdns_sw2_objfmt FCDNS_HFI_INIT =
226 {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8, BASE_HEX,
227 NULL, 0x0, NULL, HFILL};
229 static header_field_info hfi_fcdns_num_fc4desc FCDNS_HFI_INIT =
230 {"Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
231 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL};
233 static header_field_info hfi_fcdns_rply_ownerid FCDNS_HFI_INIT =
234 {"Owner Id", "fcdns.rply.ownerid", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
237 static header_field_info hfi_fcdns_maxres_size FCDNS_HFI_INIT =
238 {"Maximum/Residual Size", "fcdns.maxres_size", FT_UINT16, BASE_DEC,
239 NULL, 0x0, NULL, HFILL};
241 static header_field_info hfi_fcdns_reply_cos FCDNS_HFI_INIT =
242 {"Class of Service Supported", "fcdns.reply.cos", FT_UINT32, BASE_HEX,
243 NULL, 0x0, NULL, HFILL};
245 static header_field_info hfi_fcdns_cos_f FCDNS_HFI_INIT =
246 {"F", "fcdns.cos.f", FT_BOOLEAN, 32,
247 TFS(&tfs_set_notset), 0x01, NULL, HFILL};
249 static header_field_info hfi_fcdns_cos_1 FCDNS_HFI_INIT =
250 {"1", "fcdns.cos.1", FT_BOOLEAN, 32,
251 TFS(&tfs_set_notset), 0x02, NULL, HFILL};
253 static header_field_info hfi_fcdns_cos_2 FCDNS_HFI_INIT =
254 {"2", "fcdns.cos.2", FT_BOOLEAN, 32,
255 TFS(&tfs_set_notset), 0x04, NULL, HFILL};
257 static header_field_info hfi_fcdns_cos_3 FCDNS_HFI_INIT =
258 {"3", "fcdns.cos.3", FT_BOOLEAN, 32,
259 TFS(&tfs_set_notset), 0x08, NULL, HFILL};
261 static header_field_info hfi_fcdns_cos_4 FCDNS_HFI_INIT =
262 {"4", "fcdns.cos.4", FT_BOOLEAN, 32,
263 TFS(&tfs_set_notset), 0x10, NULL, HFILL};
265 static header_field_info hfi_fcdns_cos_6 FCDNS_HFI_INIT =
266 {"6", "fcdns.cos.6", FT_BOOLEAN, 32,
267 TFS(&tfs_set_notset), 0x40, NULL, HFILL};
269 static header_field_info hfi_fcdns_fc4type_llcsnap FCDNS_HFI_INIT =
270 {"LLC/SNAP", "fcdns.fc4types.llc_snap", FT_BOOLEAN, 32,
271 TFS(&tfs_set_notset), 0x0010, NULL, HFILL};
273 static header_field_info hfi_fcdns_fc4type_ip FCDNS_HFI_INIT =
274 {"IP", "fcdns.fc4types.ip", FT_BOOLEAN, 32,
275 TFS(&tfs_set_notset), 0x0020, NULL, HFILL};
277 static header_field_info hfi_fcdns_fc4type_fcp FCDNS_HFI_INIT =
278 {"FCP", "fcdns.fc4types.fcp", FT_BOOLEAN, 32,
279 TFS(&tfs_set_notset), 0x0100, NULL, HFILL};
281 static header_field_info hfi_fcdns_fc4type_swils FCDNS_HFI_INIT =
282 {"SW_ILS", "fcdns.fc4types.swils", FT_BOOLEAN, 32,
283 TFS(&tfs_set_notset), 0x0010, NULL, HFILL};
285 static header_field_info hfi_fcdns_fc4type_snmp FCDNS_HFI_INIT =
286 {"SNMP", "fcdns.fc4types.snmp", FT_BOOLEAN, 32,
287 TFS(&tfs_set_notset), 0x0004, NULL, HFILL};
289 static header_field_info hfi_fcdns_fc4type_gs3 FCDNS_HFI_INIT =
290 {"GS3", "fcdns.fc4types.gs3", FT_BOOLEAN, 32,
291 TFS(&tfs_set_notset), 0x0001, NULL, HFILL};
293 static header_field_info hfi_fcdns_fc4type_vi FCDNS_HFI_INIT =
294 {"VI", "fcdns.fc4types.vi", FT_BOOLEAN, 32,
295 TFS(&tfs_set_notset), 0x0001, NULL, HFILL};
297 static header_field_info hfi_fcdns_fc4features FCDNS_HFI_INIT =
298 {"FC-4 Feature Bits", "fcdns.fc4features", FT_UINT8,
299 BASE_HEX, NULL, 0x0, NULL, HFILL};
301 static header_field_info hfi_fcdns_fc4features_i FCDNS_HFI_INIT =
302 {"I", "fcdns.fc4features.i", FT_BOOLEAN, 8,
303 TFS(&tfs_set_notset), 0x02, NULL, HFILL};
305 static header_field_info hfi_fcdns_fc4features_t FCDNS_HFI_INIT =
306 {"T", "fcdns.fc4features.t", FT_BOOLEAN, 8,
307 TFS(&tfs_set_notset), 0x01, NULL, HFILL};
309 static header_field_info hfi_fcdns_req_fc4type FCDNS_HFI_INIT =
310 {"FC-4 Type", "fcdns.req.fc4type", FT_UINT8, BASE_HEX,
311 VALS (fc_fc4_val), 0x0, NULL, HFILL};
314 /* Initialize the subtree pointers */
315 static gint ett_fcdns = -1;
316 static gint ett_cos_flags = -1;
317 static gint ett_fc4flags = -1;
318 static gint ett_fc4features = -1;
320 typedef struct _fcdns_conv_key {
324 typedef struct _fcdns_conv_data {
328 static GHashTable *fcdns_req_hash = NULL;
334 fcdns_equal(gconstpointer v, gconstpointer w)
336 const fcdns_conv_key_t *v1 = (const fcdns_conv_key_t *)v;
337 const fcdns_conv_key_t *v2 = (const fcdns_conv_key_t *)w;
339 return (v1->conv_idx == v2->conv_idx);
343 fcdns_hash (gconstpointer v)
345 const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
354 * Protocol initialization
357 fcdns_init_protocol(void)
360 g_hash_table_destroy(fcdns_req_hash);
362 fcdns_req_hash = g_hash_table_new(fcdns_hash, fcdns_equal);
367 dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, const header_field_info *hfinfo)
369 proto_item *item=NULL;
370 proto_tree *tree=NULL;
373 flags = tvb_get_ntohl (tvb, offset);
375 item=proto_tree_add_uint(parent_tree, hfinfo,
376 tvb, offset, 1, flags);
377 tree=proto_item_add_subtree(item, ett_cos_flags);
381 proto_tree_add_boolean(tree, &hfi_fcdns_cos_f, tvb, offset, 4, flags);
383 proto_item_append_text(item, " F");
387 proto_tree_add_boolean(tree, &hfi_fcdns_cos_1, tvb, offset, 4, flags);
389 proto_item_append_text(item, " 1");
393 proto_tree_add_boolean(tree, &hfi_fcdns_cos_2, tvb, offset, 4, flags);
395 proto_item_append_text(item, " 2");
399 proto_tree_add_boolean(tree, &hfi_fcdns_cos_3, tvb, offset, 4, flags);
401 proto_item_append_text(item, " 3");
405 proto_tree_add_boolean(tree, &hfi_fcdns_cos_4, tvb, offset, 4, flags);
407 proto_item_append_text(item, " 4");
411 proto_tree_add_boolean(tree, &hfi_fcdns_cos_6, tvb, offset, 4, flags);
413 proto_item_append_text(item, " 6");
415 /*flags&=(~( 0x40 ));*/
420 /* The feature routines just decode FCP's FC-4 features field
421 * based on the flahs in offset and the type in offset+1
424 dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
426 proto_item *item=NULL;
427 proto_tree *tree=NULL;
430 flags = tvb_get_guint8(tvb, offset);
431 type = tvb_get_guint8(tvb, offset+1);
433 item=proto_tree_add_uint(parent_tree, &hfi_fcdns_fc4features,
434 tvb, offset, 1, flags);
435 tree=proto_item_add_subtree(item, ett_fc4features);
438 if(type==FC_TYPE_SCSI){
439 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_i, tvb, offset, 1, flags);
441 proto_item_append_text(item, " I");
445 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
447 proto_item_append_text(item, " T");
449 /*flags&=(~( 0x01 ));*/
452 proto_tree_add_item (tree, &hfi_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
455 /* The feature routines just decode FCP's FC-4 features field
458 dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
460 proto_item *item=NULL;
461 proto_tree *tree=NULL;
464 flags = tvb_get_guint8(tvb, offset);
466 item=proto_tree_add_uint(parent_tree, &hfi_fcdns_fc4features,
467 tvb, offset, 1, flags);
468 tree=proto_item_add_subtree(item, ett_fc4features);
471 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_i, tvb, offset, 1, flags);
473 proto_item_append_text(item, " I");
477 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
479 proto_item_append_text(item, " T");
481 /*flags&=(~( 0x01 ));*/
486 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
488 dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, header_field_info *hfinfo)
490 proto_item *item=NULL;
491 proto_tree *tree=NULL;
495 item=proto_tree_add_item(parent_tree, hfinfo, tvb, offset,
497 tree=proto_item_add_subtree(item, ett_fc4flags);
500 flags = tvb_get_ntohl (tvb, offset);
502 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_fcp, tvb, offset, 4, flags);
504 proto_item_append_text(item, " FCP");
506 flags&=(~( 0x0100 ));
508 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_ip, tvb, offset, 4, flags);
510 proto_item_append_text(item, " IP");
512 flags&=(~( 0x0020 ));
514 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
516 proto_item_append_text(item, " LLC/SNAP");
518 /*flags&=(~( 0x0010 ));*/
521 flags = tvb_get_ntohl (tvb, offset+4);
523 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
525 proto_item_append_text(item, " SW_ILS");
527 flags&=(~( 0x0010 ));
529 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
531 proto_item_append_text(item, " SNMP");
533 flags&=(~( 0x0004 ));
535 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
537 proto_item_append_text(item, " GS3");
539 /*flags&=(~( 0x0001 ));*/
542 flags = tvb_get_ntohl (tvb, offset+8);
544 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
546 proto_item_append_text(item, " VI");
548 /*flags&=(~( 0x0001 ));*/
551 /* Code to actually dissect the packets */
553 /* A bunch of get routines have a similar req packet format. The first few
554 * routines deal with this decoding. All assume that tree is valid */
556 dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
559 proto_tree_add_string (tree, &hfi_fcdns_req_portid, tvb, offset, 3,
560 tvb_fc_to_str (tvb, offset));
565 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
567 int offset = 16; /* past the fc_ct header */
572 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
575 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb, offset,
577 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
579 tvb_fc_to_str (tvb, offset+1));
580 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb,
582 tvb_fcwwn_to_str (tvb, offset+4));
583 len = tvb_get_guint8 (tvb, offset+12);
584 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spnamelen, tvb,
585 offset+12, 1, ENC_BIG_ENDIAN);
586 if (!tvb_offset_exists (tvb, 29+len))
590 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spname, tvb,
591 offset+13, len, ENC_ASCII|ENC_NA);
594 if (tvb_offset_exists (tvb, 292)) {
595 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb,
597 tvb_fcwwn_to_str (tvb, offset+268));
599 if (tvb_offset_exists (tvb, 548)) {
600 len = tvb_get_guint8 (tvb, offset+276);
601 proto_tree_add_item (req_tree, &hfi_fcdns_rply_snamelen, tvb,
602 offset+276, 1, ENC_BIG_ENDIAN);
604 proto_tree_add_item (req_tree, &hfi_fcdns_rply_sname, tvb,
605 offset+277, len, ENC_ASCII|ENC_NA);
608 if (tvb_offset_exists (tvb, 556)) {
609 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipa, tvb,
610 offset+532, 8, ENC_NA);
612 if (tvb_offset_exists (tvb, 572)) {
613 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb,
614 offset+540, 16, ENC_NA);
616 if (tvb_offset_exists (tvb, 576)) {
617 dissect_cos_flags(req_tree, tvb, offset+556, &hfi_fcdns_reply_cos);
619 if (tvb_offset_exists (tvb, 608)) {
620 dissect_fc4type(req_tree, tvb, offset+560, &hfi_fcdns_rply_gft);
622 if (tvb_offset_exists (tvb, 624)) {
623 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb,
624 offset+592, 16, ENC_NA);
626 if (tvb_offset_exists (tvb, 632)) {
627 proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb,
629 tvb_fcwwn_to_str (tvb, offset+608));
631 if (tvb_offset_exists (tvb, 635)) {
632 proto_tree_add_string (req_tree, &hfi_fcdns_rply_hrdaddr, tvb,
634 tvb_fc_to_str (tvb, offset+617));
641 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
643 int offset = 16; /* past the fc_ct header */
647 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
650 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb, offset,
651 8, tvb_fcwwn_to_str (tvb, offset));
657 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
659 int offset = 16; /* past the fc_ct header */
663 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
666 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb,
668 tvb_fcwwn_to_str (tvb, offset));
674 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
676 int offset = 16; /* past the fc_ct header */
680 dissect_fcdns_req_portid (tvb, req_tree, offset);
683 dissect_cos_flags(req_tree, tvb, offset, &hfi_fcdns_reply_cos);
689 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
691 int offset = 16; /* past the fc_ct header */
695 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
698 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_rply_gft);
704 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
706 int offset = 16; /* past the fc_ct header */
711 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
714 len = tvb_get_guint8 (tvb, offset);
715 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spnamelen,
716 tvb, offset, 1, ENC_BIG_ENDIAN);
717 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spname, tvb,
718 offset+1, len, ENC_ASCII|ENC_NA);
724 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
726 int offset = 16; /* past the fc_ct header */
730 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
733 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb,
734 offset, 1, ENC_BIG_ENDIAN);
740 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
742 int offset = 16; /* past the fc_ct header */
746 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
749 proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb,
751 tvb_fcwwn_to_str (tvb, offset));
758 dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
760 int offset = 16; /* past the fc_ct header */
761 int tot_len, desclen;
765 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
766 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_fc4type);
769 tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
770 while (tot_len > 0) {
771 /* The count of the descriptors is not returned and so we have
772 * to track the display by the length field */
773 desclen = tvb_get_guint8 (tvb, offset);
774 proto_tree_add_item (req_tree, &hfi_fcdns_rply_fc4desc, tvb,
775 offset, desclen, ENC_NA);
776 tot_len -= 255; /* descriptors are aligned to 255 bytes */
784 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
786 int offset = 16; /* past the fc_ct header */
790 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
793 dissect_fc4features(req_tree, tvb, offset);
799 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
801 int offset = 16; /* past the fc_ct header */
805 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
807 tvb_fcwwn_to_str (tvb, offset));
810 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
812 tvb_fc_to_str (tvb, offset+1));
818 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
820 int offset = 16; /* past the fc_ct header */
824 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
826 tvb_fcwwn_to_str (tvb, offset));
829 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb, offset,
836 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
838 int offset = 16; /* past the fc_ct header */
843 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
845 tvb_fcwwn_to_str (tvb, offset));
849 islast = tvb_get_guint8 (tvb, offset);
850 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
852 tvb_fc_to_str (tvb, offset+1));
854 } while (!(islast & 0x80));
860 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
862 int offset = 16; /* past the fc_ct header */
866 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
868 tvb_fcwwn_to_str (tvb, offset));
871 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb, offset,
878 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
880 int offset = 16; /* past the fc_ct header */
885 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
887 tvb_fcwwn_to_str (tvb, offset));
891 islast = tvb_get_guint8 (tvb, offset);
892 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
894 tvb_fc_to_str (tvb, offset+1));
895 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
897 tvb_fcwwn_to_str (tvb, offset+8));
899 } while (!(islast & 0x80));
905 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
907 int offset = 16; /* past the fc_ct header */
912 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
914 tvb_fcwwn_to_str (tvb, offset));
917 len = tvb_get_guint8 (tvb, offset);
918 proto_tree_add_item (req_tree, &hfi_fcdns_rply_snamelen, tvb,
919 offset, 1, ENC_BIG_ENDIAN);
920 proto_tree_add_item (req_tree, &hfi_fcdns_rply_sname, tvb,
921 offset+1, len, ENC_ASCII|ENC_NA);
927 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
929 int offset = 16; /* past the fc_ct header */
934 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
935 tvb, offset+1, 1, ENC_BIG_ENDIAN);
936 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
937 tvb, offset+2, 1, ENC_BIG_ENDIAN);
938 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
939 tvb, offset+3, 1, ENC_BIG_ENDIAN);
943 islast = tvb_get_guint8 (tvb, offset);
944 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
946 tvb_fc_to_str (tvb, offset+1));
948 } while (!(islast & 0x80));
954 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
956 int offset = 16; /* past the fc_ct header */
961 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
962 tvb, offset+1, 1, ENC_BIG_ENDIAN);
963 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
964 tvb, offset+2, 1, ENC_BIG_ENDIAN);
965 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
966 tvb, offset+3, 1, ENC_BIG_ENDIAN);
970 islast = tvb_get_guint8 (tvb, offset);
971 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
973 tvb_fc_to_str (tvb, offset+1));
974 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
976 tvb_fcwwn_to_str (tvb, offset+8));
978 } while (!(islast & 0x80));
984 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
986 int offset = 16; /* past the fc_ct header */
991 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
992 tvb, offset+1, 1, ENC_BIG_ENDIAN);
993 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
994 tvb, offset+2, 1, ENC_BIG_ENDIAN);
995 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
996 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1000 islast = tvb_get_guint8 (tvb, offset);
1001 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1003 tvb_fc_to_str (tvb, offset+1));
1004 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname,
1006 tvb_fcwwn_to_str (tvb, offset+8));
1008 } while (!(islast & 0x80));
1014 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1016 int offset = 16; /* past the fc_ct header */
1021 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype,
1022 tvb, offset, 1, ENC_BIG_ENDIAN);
1023 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
1024 tvb, offset+1, 1, ENC_BIG_ENDIAN);
1025 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
1026 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1030 islast = tvb_get_guint8 (tvb, offset);
1031 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1033 tvb_fc_to_str (tvb, offset+1));
1035 } while (!(islast & 0x80));
1041 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1043 int offset = 16; /* past the fc_ct header */
1048 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset,
1053 islast = tvb_get_guint8 (tvb, offset);
1054 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1056 tvb_fc_to_str (tvb, offset+1));
1058 } while (!(islast & 0x80));
1064 dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1066 int offset = 16; /* past the fc_ct header */
1071 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope, tvb,
1072 offset+1, 1, ENC_BIG_ENDIAN);
1073 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope, tvb,
1074 offset+2, 1, ENC_BIG_ENDIAN);
1075 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1079 islast = tvb_get_guint8 (tvb, offset);
1080 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1082 tvb_fc_to_str (tvb, offset+1));
1084 } while (!(islast & 0x80));
1090 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1092 int offset = 16; /* past the fc_ct header */
1096 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1098 tvb_fc_to_str (tvb, offset+1));
1099 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
1101 tvb_fcwwn_to_str (tvb, offset+4));
1107 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1109 int offset = 16; /* past the fc_ct header */
1113 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1115 tvb_fc_to_str (tvb, offset+1));
1116 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
1118 tvb_fcwwn_to_str (tvb, offset+4));
1124 dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1126 int offset = 16; /* past the fc_ct header */
1128 if (req_tree && isreq) {
1129 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1131 tvb_fc_to_str (tvb, offset+1));
1132 dissect_cos_flags(req_tree, tvb, offset+4, &hfi_fcdns_req_cos);
1137 dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1139 int offset = 16; /* past the fc_ct header */
1141 if (req_tree && isreq) {
1142 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1144 tvb_fc_to_str (tvb, offset+1));
1145 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype, tvb,
1146 offset+4, 1, ENC_BIG_ENDIAN);
1151 dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1153 int offset = 16; /* past the fc_ct header */
1155 if (req_tree && isreq) {
1156 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1158 tvb_fc_to_str (tvb, offset+1));
1159 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1164 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1166 int offset = 16; /* past the fc_ct header */
1169 if (req_tree && isreq) {
1170 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1172 tvb_fc_to_str (tvb, offset+1));
1173 proto_tree_add_item (req_tree, &hfi_fcdns_req_spnamelen, tvb,
1174 offset+4, 1, ENC_BIG_ENDIAN);
1175 len = tvb_get_guint8 (tvb, offset+4);
1177 proto_tree_add_item (req_tree, &hfi_fcdns_req_spname, tvb, offset+5,
1178 len, ENC_ASCII|ENC_NA);
1183 dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1185 int offset = 16; /* past the fc_ct header */
1187 if (req_tree && isreq) {
1188 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1190 tvb_fc_to_str (tvb, offset+1));
1191 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb,
1192 offset+4, 16, ENC_NA);
1197 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1199 int offset = 16; /* past the fc_ct header */
1202 if (req_tree && isreq) {
1203 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1205 tvb_fc_to_str (tvb, offset+1));
1206 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1209 len = tvb_reported_length_remaining (tvb, offset);
1212 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesclen, tvb, offset,
1214 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesc, tvb, offset+1,
1215 len, ENC_ASCII|ENC_NA);
1223 dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1225 int offset = 16; /* past the fc_ct header */
1227 if (req_tree && isreq) {
1228 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1, 3,
1229 tvb_fc_to_str (tvb, offset+1));
1230 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1235 dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1237 int offset = 16; /* past the fc_ct header */
1239 if (req_tree && isreq) {
1240 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1241 tvb_fcwwn_to_str (tvb, offset));
1242 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
1247 dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1249 int offset = 16; /* past the fc_ct header */
1252 if (req_tree && isreq) {
1253 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1254 tvb_fcwwn_to_str (tvb, offset));
1255 len = tvb_get_guint8 (tvb, offset+8);
1257 proto_tree_add_item (req_tree, &hfi_fcdns_req_snamelen, tvb, offset+8,
1259 proto_tree_add_item (req_tree, &hfi_fcdns_req_sname, tvb, offset+9,
1260 len, ENC_ASCII|ENC_NA);
1265 dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1267 int offset = 16; /* past the fc_ct header */
1269 if (req_tree && isreq) {
1270 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1, 3,
1271 tvb_fc_to_str (tvb, offset+1));
1276 zonenm_to_str (tvbuff_t *tvb, gint offset)
1278 int len = tvb_get_guint8 (tvb, offset);
1279 return tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, len, ENC_ASCII);
1283 dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
1290 mbrtype = tvb_get_guint8 (tvb, offset);
1291 proto_tree_add_uint (zmbr_tree, &hfi_fcdns_zone_mbrtype, tvb,
1292 offset, 1, mbrtype);
1293 proto_tree_add_text (zmbr_tree, tvb, offset+2, 1, "Flags: 0x%x",
1294 tvb_get_guint8 (tvb, offset+2));
1295 idlen = tvb_get_guint8 (tvb, offset+3);
1296 proto_tree_add_text (zmbr_tree, tvb, offset+3, 1,
1297 "Identifier Length: %d", idlen);
1299 case FC_SWILS_ZONEMBR_WWN:
1300 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1302 tvb_fcwwn_to_str (tvb, offset+4));
1304 case FC_SWILS_ZONEMBR_DP:
1305 g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl (tvb, offset+4));
1306 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1307 offset+4, 4, dpbuf);
1309 case FC_SWILS_ZONEMBR_FCID:
1310 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1312 tvb_fc_to_str (tvb, offset+5));
1314 case FC_SWILS_ZONEMBR_ALIAS:
1315 str = zonenm_to_str (tvb, offset+4);
1316 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1317 offset+4, idlen, str);
1320 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1322 "Unknown member type format");
1328 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1333 numrec = tvb_get_ntohl (tvb, offset);
1336 proto_tree_add_text (tree, tvb, offset, 4, "Number of Entries: %d",
1340 for (i = 0; i < numrec; i++) {
1341 objfmt = tvb_get_guint8 (tvb, offset);
1343 proto_tree_add_item (tree, &hfi_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
1344 proto_tree_add_string (tree, &hfi_fcdns_rply_ownerid, tvb, offset+1,
1345 3, fc_to_str (tvb_get_string_enc(wmem_packet_scope(), tvb, offset+1,
1347 proto_tree_add_item (tree, &hfi_fcdns_rply_ptype, tvb, offset+4,
1349 proto_tree_add_string (tree, &hfi_fcdns_rply_portid, tvb, offset+5, 3,
1350 tvb_fc_to_str (tvb, offset+5));
1351 proto_tree_add_string (tree, &hfi_fcdns_rply_pname, tvb, offset+8, 8,
1352 tvb_fcwwn_to_str (tvb, offset+8));
1354 if (!(objfmt & 0x1)) {
1355 len = tvb_get_guint8 (tvb, offset);
1356 proto_tree_add_item (tree, &hfi_fcdns_rply_spnamelen, tvb,
1357 offset, 1, ENC_BIG_ENDIAN);
1358 proto_tree_add_item (tree, &hfi_fcdns_rply_spname, tvb,
1359 offset+1, len, ENC_ASCII|ENC_NA);
1362 proto_tree_add_string (tree, &hfi_fcdns_rply_nname, tvb, offset, 8,
1363 tvb_fcwwn_to_str (tvb, offset));
1365 if (!(objfmt & 0x1)) {
1366 len = tvb_get_guint8 (tvb, offset);
1367 proto_tree_add_item (tree, &hfi_fcdns_rply_snamelen, tvb,
1368 offset, 1, ENC_BIG_ENDIAN);
1369 proto_tree_add_item (tree, &hfi_fcdns_rply_sname, tvb,
1370 offset+1, len, ENC_ASCII|ENC_NA);
1373 proto_tree_add_item (tree, &hfi_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
1374 proto_tree_add_item (tree, &hfi_fcdns_rply_ipnode, tvb, offset+8, 16,
1376 dissect_cos_flags(tree, tvb, offset+24, &hfi_fcdns_reply_cos);
1377 dissect_fc4type(tree, tvb, offset+28, &hfi_fcdns_rply_gft);
1378 proto_tree_add_item (tree, &hfi_fcdns_rply_ipport, tvb, offset+60,
1380 proto_tree_add_string (tree, &hfi_fcdns_rply_fpname, tvb, offset+76,
1381 8, tvb_fcwwn_to_str (tvb, offset+76));
1382 proto_tree_add_string (tree, &hfi_fcdns_rply_hrdaddr, tvb, offset+85,
1383 3, tvb_fc_to_str (tvb, offset+85));
1386 dissect_fc4features(tree, tvb, offset);
1387 if (tvb_get_guint8 (tvb, offset+129)) {
1388 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4type, tvb,
1389 offset+128, 1, ENC_BIG_ENDIAN);
1390 proto_tree_add_item (tree, &hfi_fcdns_num_fc4desc, tvb,
1391 offset+129, 1, ENC_BIG_ENDIAN);
1392 len = tvb_get_guint8 (tvb, offset+132);
1393 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4desclen, tvb,
1394 offset+132, 1, ENC_BIG_ENDIAN);
1395 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4desc, tvb,
1396 offset+133, len, ENC_NA);
1399 proto_tree_add_item (tree, &hfi_fcdns_num_fc4desc, tvb,
1400 offset+129, 1, ENC_BIG_ENDIAN);
1402 offset += 388; /* FC4 desc is 260 bytes, maybe padded */
1409 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1411 int offset = 16; /* past the fc_ct header */
1415 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1,
1416 3, tvb_fc_to_str (tvb, offset+1));
1420 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1425 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1427 int offset = 16; /* past the fc_ct header */
1430 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, offset, 8,
1431 tvb_fcwwn_to_str (tvb, offset));
1435 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1440 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1442 int offset = 16; /* past the fc_ct header */
1446 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1447 tvb_fcwwn_to_str (tvb, offset));
1451 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1456 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1458 int offset = 16; /* past the fc_ct header */
1462 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1466 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1471 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1473 int offset = 16; /* past the fc_ct header */
1477 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_fc4type);
1481 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1486 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1488 int offset = 16; /* past the fc_ct header */
1492 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype, tvb, offset+3,
1497 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1502 dissect_fcdns_gezm (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1504 int offset = 16; /* past the fc_ct header */
1508 dissect_fcdns_zone_mbr (tvb, req_tree, offset);
1512 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1517 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1519 int offset = 16; /* past the fc_ct header */
1524 str_len = tvb_get_guint8 (tvb, offset);
1525 proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d",
1527 proto_tree_add_item (req_tree, &hfi_fcdns_zonenm, tvb, offset+3,
1528 str_len, ENC_ASCII|ENC_NA);
1532 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1537 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1539 int offset = 16; /* past the fc_ct header */
1543 proto_tree_add_item (req_tree, &hfi_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1547 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1552 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1554 int offset = 16; /* past the fc_ct header */
1558 dissect_fc4features(req_tree, tvb, offset);
1562 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1567 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1572 proto_tree_add_item (req_tree, &hfi_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1573 proto_tree_add_item (req_tree, &hfi_fcdns_rjtdetail, tvb, offset+14, 1,
1575 proto_tree_add_item (req_tree, &hfi_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1580 dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1582 /* Set up structures needed to add the protocol subtree and manage it */
1583 proto_item *ti = NULL;
1584 proto_tree *fcdns_tree = NULL;
1589 fc_ct_preamble cthdr;
1590 conversation_t *conversation;
1591 fcdns_conv_data_t *cdata;
1592 fcdns_conv_key_t ckey, *req_key;
1595 /* Reject the packet if data is NULL */
1598 fchdr = (fc_hdr *)data;
1600 tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
1601 cthdr.revision = tvb_get_guint8 (tvb, offset);
1602 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1603 cthdr.opcode = g_ntohs (cthdr.opcode);
1604 opcode = cthdr.opcode;
1605 cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
1607 /* Determine the type of server the request/response is for */
1608 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1609 col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1611 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1614 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1615 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1618 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1621 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1624 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1628 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1629 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1630 pinfo->ptype, fchdr->oxid,
1631 fchdr->rxid, NO_PORT2);
1632 if (!conversation) {
1633 conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1634 pinfo->ptype, fchdr->oxid,
1635 fchdr->rxid, NO_PORT2);
1638 ckey.conv_idx = conversation->index;
1640 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash,
1643 /* Since we never free the memory used by an exchange, this maybe a
1644 * case of another request using the same exchange as a previous
1647 cdata->opcode = opcode;
1650 req_key = wmem_new(wmem_file_scope(), fcdns_conv_key_t);
1651 req_key->conv_idx = conversation->index;
1653 cdata = wmem_new(wmem_file_scope(), fcdns_conv_data_t);
1654 cdata->opcode = opcode;
1656 g_hash_table_insert (fcdns_req_hash, req_key, cdata);
1658 col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1662 /* Opcode is ACC or RJT */
1663 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1664 pinfo->ptype, fchdr->oxid,
1665 fchdr->rxid, NO_PORT2);
1667 if (!conversation) {
1668 if (opcode == FCCT_MSG_ACC) {
1669 col_add_str (pinfo->cinfo, COL_INFO,
1670 val_to_str (opcode, fc_dns_opcode_val,
1672 /* No record of what this accept is for. Can't decode */
1673 proto_tree_add_text (fcdns_tree, tvb, 0, -1,
1674 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1679 ckey.conv_idx = conversation->index;
1681 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash, &ckey);
1683 if (cdata != NULL) {
1684 if (opcode == FCCT_MSG_ACC) {
1685 opcode = cdata->opcode;
1688 failed_opcode = cdata->opcode;
1691 if (opcode != FCCT_MSG_RJT) {
1692 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1693 val_to_str (opcode, fc_dns_opcode_val,
1697 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1698 val_to_str (failed_opcode,
1704 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1705 /* No record of what this accept is for. Can't decode */
1706 proto_tree_add_text (fcdns_tree, tvb, 0, -1,
1707 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1715 proto_tree_add_item (fcdns_tree, &hfi_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1716 proto_tree_add_item (fcdns_tree, &hfi_fcdns_maxres_size, tvb, offset+10,
1722 dissect_fcdns_rjt (tvb, fcdns_tree);
1725 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1728 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1731 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1734 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1737 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1740 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1743 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1746 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1749 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1752 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1755 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1758 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1761 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1764 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1767 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1770 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1773 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1776 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1779 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1782 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1785 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1788 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1791 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1794 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1797 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1800 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1803 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1806 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1809 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1812 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1815 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1818 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1821 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1824 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1827 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1830 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1833 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1836 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1839 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1842 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1845 dissect_fcdns_gezm (tvb, fcdns_tree, isreq);
1848 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1851 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1854 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1860 return tvb_length(tvb);
1863 /* Register the protocol with Wireshark */
1866 proto_register_fcdns (void)
1868 #ifndef HAVE_HFI_SECTION_INIT
1869 static header_field_info *hfi[] = {
1870 /* &hfi_fcdns_gssubtype */
1872 &hfi_fcdns_req_portid,
1873 &hfi_fcdns_rply_pname,
1874 &hfi_fcdns_rply_nname,
1875 &hfi_fcdns_rply_snamelen,
1876 &hfi_fcdns_rply_sname,
1877 &hfi_fcdns_rply_ptype,
1878 &hfi_fcdns_rply_fpname,
1879 &hfi_fcdns_req_pname,
1880 &hfi_fcdns_rply_portid,
1881 &hfi_fcdns_req_nname,
1882 &hfi_fcdns_req_domainscope,
1883 &hfi_fcdns_req_areascope,
1884 &hfi_fcdns_req_fc4type,
1885 &hfi_fcdns_req_ptype,
1887 &hfi_fcdns_rply_fc4type,
1888 &hfi_fcdns_req_snamelen,
1889 &hfi_fcdns_req_sname,
1890 &hfi_fcdns_rply_spnamelen,
1891 &hfi_fcdns_rply_spname,
1892 &hfi_fcdns_rply_ipa,
1893 &hfi_fcdns_rply_ipnode,
1894 &hfi_fcdns_rply_ipport,
1895 &hfi_fcdns_rply_fc4desclen,
1896 &hfi_fcdns_rply_fc4desc,
1897 &hfi_fcdns_rply_hrdaddr,
1898 &hfi_fcdns_req_fdesclen,
1899 &hfi_fcdns_req_fdesc,
1900 &hfi_fcdns_req_spnamelen,
1901 &hfi_fcdns_req_spname,
1903 &hfi_fcdns_rjtdetail,
1905 &hfi_fcdns_zone_mbrtype,
1906 &hfi_fcdns_zone_mbrid,
1909 &hfi_fcdns_sw2_objfmt,
1910 &hfi_fcdns_num_fc4desc,
1911 &hfi_fcdns_rply_ownerid,
1912 &hfi_fcdns_maxres_size,
1913 &hfi_fcdns_reply_cos,
1921 &hfi_fcdns_fc4type_llcsnap,
1922 &hfi_fcdns_fc4type_ip,
1923 &hfi_fcdns_fc4type_fcp,
1924 &hfi_fcdns_fc4type_swils,
1925 &hfi_fcdns_fc4type_snmp,
1926 &hfi_fcdns_fc4type_gs3,
1927 &hfi_fcdns_fc4type_vi,
1928 &hfi_fcdns_rply_gft,
1929 &hfi_fcdns_req_fc4types,
1931 &hfi_fcdns_fc4features,
1932 &hfi_fcdns_fc4features_i,
1933 &hfi_fcdns_fc4features_t,
1937 static gint *ett[] = {
1946 proto_fcdns = proto_register_protocol("Fibre Channel Name Server",
1948 hfi_fcdns = proto_registrar_get_nth(proto_fcdns);
1950 proto_register_fields(proto_fcdns, hfi, array_length(hfi));
1951 proto_register_subtree_array(ett, array_length(ett));
1952 register_init_routine (&fcdns_init_protocol);
1954 dns_handle = new_create_dissector_handle (dissect_fcdns, proto_fcdns);
1958 proto_reg_handoff_fcdns (void)
1960 dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
1961 dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_handle);