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/expert.h>
32 #include <epan/to_str.h>
33 #include <epan/wmem/wmem.h>
34 #include <epan/conversation.h>
35 #include <epan/etypes.h>
36 #include "packet-fc.h"
37 #include "packet-fcct.h"
38 #include "packet-fcdns.h"
39 #include "packet-fcswils.h"
41 void proto_register_fcdns(void);
42 void proto_reg_handoff_fcdns(void);
48 static dissector_handle_t dns_handle;
50 /* protocol and registered fields */
52 static header_field_info *hfi_fcdns = NULL;
54 #define FCDNS_HFI_INIT HFI_INIT(proto_fcdns)
57 static header_field_info hfi_fcdns_gssubtype FCDNS_HFI_INIT =
58 {"GS_Subtype", "fcdns.gssubtype", FT_UINT8, BASE_HEX,
59 VALS(fc_dns_subtype_val), 0x0, NULL, HFILL};
62 static header_field_info hfi_fcdns_opcode FCDNS_HFI_INIT =
63 {"Opcode", "fcdns.opcode", FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val),
66 static header_field_info hfi_fcdns_reason FCDNS_HFI_INIT =
67 {"Reason Code", "fcdns.rply.reason", FT_UINT8, BASE_HEX,
68 VALS (fc_ct_rjt_code_vals), 0x0, NULL, HFILL};
70 static header_field_info hfi_fcdns_vendor FCDNS_HFI_INIT =
71 {"Vendor Unique Reject Code", "fcdns.rply.vendor", FT_UINT8,
72 BASE_HEX, NULL, 0x0, NULL, HFILL};
74 static header_field_info hfi_fcdns_req_portid FCDNS_HFI_INIT =
75 {"Port Identifier", "fcdns.req.portid", FT_STRING, BASE_NONE, NULL, 0x0,
78 static header_field_info hfi_fcdns_rply_pname FCDNS_HFI_INIT =
79 {"Port Name", "fcdns.rply.pname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
82 static header_field_info hfi_fcdns_rply_nname FCDNS_HFI_INIT =
83 {"Node Name", "fcdns.rply.nname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
86 static header_field_info hfi_fcdns_rply_gft FCDNS_HFI_INIT =
87 {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_NONE, BASE_NONE,
88 NULL, 0x0, NULL, HFILL};
90 static header_field_info hfi_fcdns_rply_snamelen FCDNS_HFI_INIT =
91 {"Symbolic Node Name Length", "fcdns.rply.snamelen", FT_UINT8, BASE_DEC,
92 NULL, 0x0, NULL, HFILL};
94 static header_field_info hfi_fcdns_rply_sname FCDNS_HFI_INIT =
95 {"Symbolic Node Name", "fcdns.rply.sname", FT_STRING, BASE_NONE, NULL,
98 static header_field_info hfi_fcdns_rply_ptype FCDNS_HFI_INIT =
99 {"Port Type", "fcdns.rply.porttype", FT_UINT8, BASE_HEX,
100 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL};
102 static header_field_info hfi_fcdns_rply_fpname FCDNS_HFI_INIT =
103 {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING, BASE_NONE, NULL,
106 static header_field_info hfi_fcdns_fc4type FCDNS_HFI_INIT =
107 {"FC-4 Types", "fcdns.req.fc4type", FT_NONE, BASE_NONE,
108 NULL, 0x0, NULL, HFILL};
110 static header_field_info hfi_fcdns_rply_fc4type FCDNS_HFI_INIT =
111 {"FC-4 Descriptor Type", "fcdns.rply.fc4type", FT_UINT8, BASE_HEX,
112 VALS (fc_fc4_val), 0x0, NULL, HFILL};
114 static header_field_info hfi_fcdns_rply_fc4desc FCDNS_HFI_INIT =
115 {"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_BYTES, BASE_NONE, NULL,
118 static header_field_info hfi_fcdns_req_pname FCDNS_HFI_INIT =
119 {"Port Name", "fcdns.req.portname", FT_STRING, BASE_NONE, NULL, 0x0,
122 static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT =
123 {"Port Identifier", "fcdns.rply.portid", FT_STRING, BASE_NONE, NULL,
126 static header_field_info hfi_fcdns_req_nname FCDNS_HFI_INIT =
127 {"Node Name", "fcdns.req.nname", FT_STRING, BASE_NONE, NULL, 0x0,
130 static header_field_info hfi_fcdns_req_domainscope FCDNS_HFI_INIT =
131 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8, BASE_HEX, NULL,
134 static header_field_info hfi_fcdns_req_areascope FCDNS_HFI_INIT =
135 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8, BASE_HEX, NULL,
138 static header_field_info hfi_fcdns_req_ptype FCDNS_HFI_INIT =
139 {"Port Type", "fcdns.req.porttype", FT_UINT8, BASE_HEX,
140 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL};
142 static header_field_info hfi_fcdns_req_cos FCDNS_HFI_INIT =
143 {"Requested Class of Service", "fcdns.req.class", FT_UINT32, BASE_HEX,
144 NULL, 0x0, NULL, HFILL};
146 static header_field_info hfi_fcdns_req_fc4types FCDNS_HFI_INIT =
147 {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE, BASE_NONE,
148 NULL, 0x0, NULL, HFILL};
150 static header_field_info hfi_fcdns_req_snamelen FCDNS_HFI_INIT =
151 {"Symbolic Name Length", "fcdns.req.snamelen", FT_UINT8, BASE_DEC,
152 NULL, 0x0, NULL, HFILL};
154 static header_field_info hfi_fcdns_req_sname FCDNS_HFI_INIT =
155 {"Symbolic Port Name", "fcdns.req.sname", FT_STRING, BASE_NONE, NULL,
158 static header_field_info hfi_fcdns_rply_spnamelen FCDNS_HFI_INIT =
159 {"Symbolic Port Name Length", "fcdns.rply.spnamelen", FT_UINT8,
160 BASE_DEC, NULL, 0x0, NULL, HFILL};
162 static header_field_info hfi_fcdns_rply_spname FCDNS_HFI_INIT =
163 {"Symbolic Port Name", "fcdns.rply.spname", FT_STRING, BASE_NONE, NULL,
166 static header_field_info hfi_fcdns_req_spnamelen FCDNS_HFI_INIT =
167 {"Symbolic Port Name Length", "fcdns.req.spnamelen", FT_UINT8,
168 BASE_DEC, NULL, 0x0, NULL, HFILL};
170 static header_field_info hfi_fcdns_req_spname FCDNS_HFI_INIT =
171 {"Symbolic Port Name", "fcdns.req.spname", FT_STRING, BASE_NONE, NULL,
174 static header_field_info hfi_fcdns_rply_ipa FCDNS_HFI_INIT =
175 {"Initial Process Associator", "fcdns.rply.ipa", FT_BYTES, BASE_NONE,
176 NULL, 0x0, NULL, HFILL};
178 static header_field_info hfi_fcdns_rply_ipnode FCDNS_HFI_INIT =
179 {"Node IP Address", "fcdns.rply.ipnode", FT_IPv6, BASE_NONE, NULL,
182 static header_field_info hfi_fcdns_rply_ipport FCDNS_HFI_INIT =
183 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6, BASE_NONE, NULL,
186 static header_field_info hfi_fcdns_rply_fc4desclen FCDNS_HFI_INIT =
187 {"FC-4 Descriptor Length", "fcdns.rply.fc4desclen", FT_UINT8,
188 BASE_DEC, NULL, 0x0, NULL, HFILL};
190 static header_field_info hfi_fcdns_rply_hrdaddr FCDNS_HFI_INIT =
191 {"Hard Address", "fcdns.rply.hrdaddr", FT_STRING, BASE_NONE, NULL,
194 static header_field_info hfi_fcdns_req_fdesclen FCDNS_HFI_INIT =
195 {"FC-4 Descriptor Length", "fcdns.req.fc4desclen", FT_UINT8, BASE_DEC,
196 NULL, 0x0, NULL, HFILL};
198 static header_field_info hfi_fcdns_req_fdesc FCDNS_HFI_INIT =
199 {"FC-4 Descriptor", "fcdns.req.fc4desc", FT_STRING, BASE_NONE, NULL,
202 static header_field_info hfi_fcdns_req_ip FCDNS_HFI_INIT =
203 {"IP Address", "fcdns.req.ip", FT_IPv6, BASE_NONE, NULL, 0x0,
206 static header_field_info hfi_fcdns_rjtdetail FCDNS_HFI_INIT =
207 {"Reason Code Explanantion", "fcdns.rply.reasondet", FT_UINT8,
208 BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0, NULL, HFILL};
210 static header_field_info hfi_fcdns_zone_mbrtype FCDNS_HFI_INIT =
211 {"Zone Member Type", "fcdns.zone.mbrtype", FT_UINT8, BASE_HEX,
212 VALS (fc_swils_zonembr_type_val), 0x0, NULL, HFILL};
214 static header_field_info hfi_fcdns_zone_mbrid FCDNS_HFI_INIT =
215 {"Member Identifier", "fcdns.zone.mbrid", FT_STRING, BASE_NONE, NULL,
218 static header_field_info hfi_fcdns_id_length FCDNS_HFI_INIT =
219 {"Identifier Length", "fcdns.id_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
222 static header_field_info hfi_fcdns_zone_flags FCDNS_HFI_INIT =
223 {"Flags", "fcdns.zone_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
226 static header_field_info hfi_fcdns_zonelen FCDNS_HFI_INIT =
227 {"Name Length", "fcdns.zone_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
230 static header_field_info hfi_fcdns_zonenm FCDNS_HFI_INIT =
231 {"Zone Name", "fcdns.zonename", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
234 static header_field_info hfi_fcdns_portip FCDNS_HFI_INIT =
235 {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_NONE, NULL, 0x0,
238 static header_field_info hfi_fcdns_num_entries FCDNS_HFI_INIT =
239 {"Number of Entries", "fcdns.num_entries", FT_UINT32, BASE_HEX,
240 NULL, 0x0, NULL, HFILL};
242 static header_field_info hfi_fcdns_sw2_objfmt FCDNS_HFI_INIT =
243 {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8, BASE_HEX,
244 NULL, 0x0, NULL, HFILL};
246 static header_field_info hfi_fcdns_num_fc4desc FCDNS_HFI_INIT =
247 {"Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
248 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL};
250 static header_field_info hfi_fcdns_rply_ownerid FCDNS_HFI_INIT =
251 {"Owner Id", "fcdns.rply.ownerid", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
254 static header_field_info hfi_fcdns_maxres_size FCDNS_HFI_INIT =
255 {"Maximum/Residual Size", "fcdns.maxres_size", FT_UINT16, BASE_DEC,
256 NULL, 0x0, NULL, HFILL};
258 static header_field_info hfi_fcdns_reply_cos FCDNS_HFI_INIT =
259 {"Class of Service Supported", "fcdns.reply.cos", FT_UINT32, BASE_HEX,
260 NULL, 0x0, NULL, HFILL};
262 static header_field_info hfi_fcdns_cos_f FCDNS_HFI_INIT =
263 {"F", "fcdns.cos.f", FT_BOOLEAN, 32,
264 TFS(&tfs_set_notset), 0x01, NULL, HFILL};
266 static header_field_info hfi_fcdns_cos_1 FCDNS_HFI_INIT =
267 {"1", "fcdns.cos.1", FT_BOOLEAN, 32,
268 TFS(&tfs_set_notset), 0x02, NULL, HFILL};
270 static header_field_info hfi_fcdns_cos_2 FCDNS_HFI_INIT =
271 {"2", "fcdns.cos.2", FT_BOOLEAN, 32,
272 TFS(&tfs_set_notset), 0x04, NULL, HFILL};
274 static header_field_info hfi_fcdns_cos_3 FCDNS_HFI_INIT =
275 {"3", "fcdns.cos.3", FT_BOOLEAN, 32,
276 TFS(&tfs_set_notset), 0x08, NULL, HFILL};
278 static header_field_info hfi_fcdns_cos_4 FCDNS_HFI_INIT =
279 {"4", "fcdns.cos.4", FT_BOOLEAN, 32,
280 TFS(&tfs_set_notset), 0x10, NULL, HFILL};
282 static header_field_info hfi_fcdns_cos_6 FCDNS_HFI_INIT =
283 {"6", "fcdns.cos.6", FT_BOOLEAN, 32,
284 TFS(&tfs_set_notset), 0x40, NULL, HFILL};
286 static header_field_info hfi_fcdns_fc4type_llcsnap FCDNS_HFI_INIT =
287 {"LLC/SNAP", "fcdns.fc4types.llc_snap", FT_BOOLEAN, 32,
288 TFS(&tfs_set_notset), 0x0010, NULL, HFILL};
290 static header_field_info hfi_fcdns_fc4type_ip FCDNS_HFI_INIT =
291 {"IP", "fcdns.fc4types.ip", FT_BOOLEAN, 32,
292 TFS(&tfs_set_notset), 0x0020, NULL, HFILL};
294 static header_field_info hfi_fcdns_fc4type_fcp FCDNS_HFI_INIT =
295 {"FCP", "fcdns.fc4types.fcp", FT_BOOLEAN, 32,
296 TFS(&tfs_set_notset), 0x0100, NULL, HFILL};
298 static header_field_info hfi_fcdns_fc4type_swils FCDNS_HFI_INIT =
299 {"SW_ILS", "fcdns.fc4types.swils", FT_BOOLEAN, 32,
300 TFS(&tfs_set_notset), 0x0010, NULL, HFILL};
302 static header_field_info hfi_fcdns_fc4type_snmp FCDNS_HFI_INIT =
303 {"SNMP", "fcdns.fc4types.snmp", FT_BOOLEAN, 32,
304 TFS(&tfs_set_notset), 0x0004, NULL, HFILL};
306 static header_field_info hfi_fcdns_fc4type_gs3 FCDNS_HFI_INIT =
307 {"GS3", "fcdns.fc4types.gs3", FT_BOOLEAN, 32,
308 TFS(&tfs_set_notset), 0x0001, NULL, HFILL};
310 static header_field_info hfi_fcdns_fc4type_vi FCDNS_HFI_INIT =
311 {"VI", "fcdns.fc4types.vi", FT_BOOLEAN, 32,
312 TFS(&tfs_set_notset), 0x0001, NULL, HFILL};
314 static header_field_info hfi_fcdns_fc4features FCDNS_HFI_INIT =
315 {"FC-4 Feature Bits", "fcdns.fc4features", FT_UINT8,
316 BASE_HEX, NULL, 0x0, NULL, HFILL};
318 static header_field_info hfi_fcdns_fc4features_i FCDNS_HFI_INIT =
319 {"I", "fcdns.fc4features.i", FT_BOOLEAN, 8,
320 TFS(&tfs_set_notset), 0x02, NULL, HFILL};
322 static header_field_info hfi_fcdns_fc4features_t FCDNS_HFI_INIT =
323 {"T", "fcdns.fc4features.t", FT_BOOLEAN, 8,
324 TFS(&tfs_set_notset), 0x01, NULL, HFILL};
326 static header_field_info hfi_fcdns_req_fc4type FCDNS_HFI_INIT =
327 {"FC-4 Type", "fcdns.req.fc4type", FT_UINT8, BASE_HEX,
328 VALS (fc_fc4_val), 0x0, NULL, HFILL};
331 /* Initialize the subtree pointers */
332 static gint ett_fcdns = -1;
333 static gint ett_cos_flags = -1;
334 static gint ett_fc4flags = -1;
335 static gint ett_fc4features = -1;
337 static expert_field ei_fcdns_no_record_of_exchange = EI_INIT;
339 typedef struct _fcdns_conv_key {
343 typedef struct _fcdns_conv_data {
347 static GHashTable *fcdns_req_hash = NULL;
353 fcdns_equal(gconstpointer v, gconstpointer w)
355 const fcdns_conv_key_t *v1 = (const fcdns_conv_key_t *)v;
356 const fcdns_conv_key_t *v2 = (const fcdns_conv_key_t *)w;
358 return (v1->conv_idx == v2->conv_idx);
362 fcdns_hash (gconstpointer v)
364 const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
373 * Protocol initialization
376 fcdns_init_protocol(void)
379 g_hash_table_destroy(fcdns_req_hash);
381 fcdns_req_hash = g_hash_table_new(fcdns_hash, fcdns_equal);
386 dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, const header_field_info *hfinfo)
392 flags = tvb_get_ntohl (tvb, offset);
394 item=proto_tree_add_uint(parent_tree, hfinfo,
395 tvb, offset, 1, flags);
396 tree=proto_item_add_subtree(item, ett_cos_flags);
398 proto_tree_add_boolean(tree, &hfi_fcdns_cos_f, tvb, offset, 4, flags);
400 proto_item_append_text(item, " F");
404 proto_tree_add_boolean(tree, &hfi_fcdns_cos_1, tvb, offset, 4, flags);
406 proto_item_append_text(item, " 1");
410 proto_tree_add_boolean(tree, &hfi_fcdns_cos_2, tvb, offset, 4, flags);
412 proto_item_append_text(item, " 2");
416 proto_tree_add_boolean(tree, &hfi_fcdns_cos_3, tvb, offset, 4, flags);
418 proto_item_append_text(item, " 3");
422 proto_tree_add_boolean(tree, &hfi_fcdns_cos_4, tvb, offset, 4, flags);
424 proto_item_append_text(item, " 4");
428 proto_tree_add_boolean(tree, &hfi_fcdns_cos_6, tvb, offset, 4, flags);
430 proto_item_append_text(item, " 6");
432 /*flags&=(~( 0x40 ));*/
437 /* The feature routines just decode FCP's FC-4 features field
438 * based on the flahs in offset and the type in offset+1
441 dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
447 flags = tvb_get_guint8(tvb, offset);
448 type = tvb_get_guint8(tvb, offset+1);
450 item=proto_tree_add_uint(parent_tree, &hfi_fcdns_fc4features,
451 tvb, offset, 1, flags);
452 tree=proto_item_add_subtree(item, ett_fc4features);
454 if(type==FC_TYPE_SCSI){
455 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_i, tvb, offset, 1, flags);
457 proto_item_append_text(item, " I");
461 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
463 proto_item_append_text(item, " T");
465 /*flags&=(~( 0x01 ));*/
468 proto_tree_add_item (tree, &hfi_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
471 /* The feature routines just decode FCP's FC-4 features field
474 dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
480 flags = tvb_get_guint8(tvb, offset);
481 item=proto_tree_add_uint(parent_tree, &hfi_fcdns_fc4features,
482 tvb, offset, 1, flags);
483 tree=proto_item_add_subtree(item, ett_fc4features);
485 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_i, tvb, offset, 1, flags);
487 proto_item_append_text(item, " I");
491 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
493 proto_item_append_text(item, " T");
495 /*flags&=(~( 0x01 ));*/
500 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
502 dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, header_field_info *hfinfo)
508 item=proto_tree_add_item(parent_tree, hfinfo, tvb, offset,
510 tree=proto_item_add_subtree(item, ett_fc4flags);
512 flags = tvb_get_ntohl (tvb, offset);
514 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_fcp, tvb, offset, 4, flags);
516 proto_item_append_text(item, " FCP");
518 flags&=(~( 0x0100 ));
520 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_ip, tvb, offset, 4, flags);
522 proto_item_append_text(item, " IP");
524 flags&=(~( 0x0020 ));
526 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
528 proto_item_append_text(item, " LLC/SNAP");
530 /*flags&=(~( 0x0010 ));*/
533 flags = tvb_get_ntohl (tvb, offset+4);
535 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
537 proto_item_append_text(item, " SW_ILS");
539 flags&=(~( 0x0010 ));
541 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
543 proto_item_append_text(item, " SNMP");
545 flags&=(~( 0x0004 ));
547 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
549 proto_item_append_text(item, " GS3");
551 /*flags&=(~( 0x0001 ));*/
554 flags = tvb_get_ntohl (tvb, offset+8);
556 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
558 proto_item_append_text(item, " VI");
560 /*flags&=(~( 0x0001 ));*/
563 /* Code to actually dissect the packets */
565 /* A bunch of get routines have a similar req packet format. The first few
566 * routines deal with this decoding. All assume that tree is valid */
568 dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
571 proto_tree_add_string (tree, &hfi_fcdns_req_portid, tvb, offset, 3,
572 tvb_fc_to_str (tvb, offset));
577 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
579 int offset = 16; /* past the fc_ct header */
584 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
587 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb, offset,
589 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
591 tvb_fc_to_str (tvb, offset+1));
592 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb,
594 tvb_fcwwn_to_str (tvb, offset+4));
595 len = tvb_get_guint8 (tvb, offset+12);
596 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spnamelen, tvb,
597 offset+12, 1, ENC_BIG_ENDIAN);
598 if (!tvb_offset_exists (tvb, 29+len))
602 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spname, tvb,
603 offset+13, len, ENC_ASCII|ENC_NA);
606 if (tvb_offset_exists (tvb, 292)) {
607 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb,
609 tvb_fcwwn_to_str (tvb, offset+268));
611 if (tvb_offset_exists (tvb, 548)) {
612 len = tvb_get_guint8 (tvb, offset+276);
613 proto_tree_add_item (req_tree, &hfi_fcdns_rply_snamelen, tvb,
614 offset+276, 1, ENC_BIG_ENDIAN);
616 proto_tree_add_item (req_tree, &hfi_fcdns_rply_sname, tvb,
617 offset+277, len, ENC_ASCII|ENC_NA);
620 if (tvb_offset_exists (tvb, 556)) {
621 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipa, tvb,
622 offset+532, 8, ENC_NA);
624 if (tvb_offset_exists (tvb, 572)) {
625 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb,
626 offset+540, 16, ENC_NA);
628 if (tvb_offset_exists (tvb, 576)) {
629 dissect_cos_flags(req_tree, tvb, offset+556, &hfi_fcdns_reply_cos);
631 if (tvb_offset_exists (tvb, 608)) {
632 dissect_fc4type(req_tree, tvb, offset+560, &hfi_fcdns_rply_gft);
634 if (tvb_offset_exists (tvb, 624)) {
635 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb,
636 offset+592, 16, ENC_NA);
638 if (tvb_offset_exists (tvb, 632)) {
639 proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb,
641 tvb_fcwwn_to_str (tvb, offset+608));
643 if (tvb_offset_exists (tvb, 635)) {
644 proto_tree_add_string (req_tree, &hfi_fcdns_rply_hrdaddr, tvb,
646 tvb_fc_to_str (tvb, offset+617));
653 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
655 int offset = 16; /* past the fc_ct header */
659 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
662 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb, offset,
663 8, tvb_fcwwn_to_str (tvb, offset));
669 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
671 int offset = 16; /* past the fc_ct header */
675 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
678 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb,
680 tvb_fcwwn_to_str (tvb, offset));
686 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
688 int offset = 16; /* past the fc_ct header */
692 dissect_fcdns_req_portid (tvb, req_tree, offset);
695 dissect_cos_flags(req_tree, tvb, offset, &hfi_fcdns_reply_cos);
701 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
703 int offset = 16; /* past the fc_ct header */
707 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
710 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_rply_gft);
716 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
718 int offset = 16; /* past the fc_ct header */
723 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
726 len = tvb_get_guint8 (tvb, offset);
727 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spnamelen,
728 tvb, offset, 1, ENC_BIG_ENDIAN);
729 proto_tree_add_item (req_tree, &hfi_fcdns_rply_spname, tvb,
730 offset+1, len, ENC_ASCII|ENC_NA);
736 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
738 int offset = 16; /* past the fc_ct header */
742 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
745 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb,
746 offset, 1, ENC_BIG_ENDIAN);
752 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
754 int offset = 16; /* past the fc_ct header */
758 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
761 proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb,
763 tvb_fcwwn_to_str (tvb, offset));
770 dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
772 int offset = 16; /* past the fc_ct header */
773 int tot_len, desclen;
777 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
778 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_fc4type);
781 tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
782 while (tot_len > 0) {
783 /* The count of the descriptors is not returned and so we have
784 * to track the display by the length field */
785 desclen = tvb_get_guint8 (tvb, offset);
786 proto_tree_add_item (req_tree, &hfi_fcdns_rply_fc4desc, tvb,
787 offset, desclen, ENC_NA);
788 tot_len -= 255; /* descriptors are aligned to 255 bytes */
796 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
798 int offset = 16; /* past the fc_ct header */
802 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
805 dissect_fc4features(req_tree, tvb, offset);
811 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
813 int offset = 16; /* past the fc_ct header */
817 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
819 tvb_fcwwn_to_str (tvb, offset));
822 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
824 tvb_fc_to_str (tvb, offset+1));
830 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
832 int offset = 16; /* past the fc_ct header */
836 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
838 tvb_fcwwn_to_str (tvb, offset));
841 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb, offset,
848 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
850 int offset = 16; /* past the fc_ct header */
855 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
857 tvb_fcwwn_to_str (tvb, offset));
861 islast = tvb_get_guint8 (tvb, offset);
862 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
864 tvb_fc_to_str (tvb, offset+1));
866 } while (!(islast & 0x80));
872 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
874 int offset = 16; /* past the fc_ct header */
878 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
880 tvb_fcwwn_to_str (tvb, offset));
883 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb, offset,
890 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
892 int offset = 16; /* past the fc_ct header */
897 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
899 tvb_fcwwn_to_str (tvb, offset));
903 islast = tvb_get_guint8 (tvb, offset);
904 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
906 tvb_fc_to_str (tvb, offset+1));
907 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
909 tvb_fcwwn_to_str (tvb, offset+8));
911 } while (!(islast & 0x80));
917 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
919 int offset = 16; /* past the fc_ct header */
924 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
926 tvb_fcwwn_to_str (tvb, offset));
929 len = tvb_get_guint8 (tvb, offset);
930 proto_tree_add_item (req_tree, &hfi_fcdns_rply_snamelen, tvb,
931 offset, 1, ENC_BIG_ENDIAN);
932 proto_tree_add_item (req_tree, &hfi_fcdns_rply_sname, tvb,
933 offset+1, len, ENC_ASCII|ENC_NA);
939 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
941 int offset = 16; /* past the fc_ct header */
946 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
947 tvb, offset+1, 1, ENC_BIG_ENDIAN);
948 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
949 tvb, offset+2, 1, ENC_BIG_ENDIAN);
950 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
951 tvb, offset+3, 1, ENC_BIG_ENDIAN);
955 islast = tvb_get_guint8 (tvb, offset);
956 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
958 tvb_fc_to_str (tvb, offset+1));
960 } while (!(islast & 0x80));
966 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
968 int offset = 16; /* past the fc_ct header */
973 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
974 tvb, offset+1, 1, ENC_BIG_ENDIAN);
975 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
976 tvb, offset+2, 1, ENC_BIG_ENDIAN);
977 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
978 tvb, offset+3, 1, ENC_BIG_ENDIAN);
982 islast = tvb_get_guint8 (tvb, offset);
983 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
985 tvb_fc_to_str (tvb, offset+1));
986 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
988 tvb_fcwwn_to_str (tvb, offset+8));
990 } while (!(islast & 0x80));
996 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
998 int offset = 16; /* past the fc_ct header */
1003 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
1004 tvb, offset+1, 1, ENC_BIG_ENDIAN);
1005 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
1006 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1007 proto_tree_add_item (req_tree, &hfi_fcdns_req_fc4type,
1008 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1012 islast = tvb_get_guint8 (tvb, offset);
1013 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1015 tvb_fc_to_str (tvb, offset+1));
1016 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname,
1018 tvb_fcwwn_to_str (tvb, offset+8));
1020 } while (!(islast & 0x80));
1026 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1028 int offset = 16; /* past the fc_ct header */
1033 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype,
1034 tvb, offset, 1, ENC_BIG_ENDIAN);
1035 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope,
1036 tvb, offset+1, 1, ENC_BIG_ENDIAN);
1037 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope,
1038 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1042 islast = tvb_get_guint8 (tvb, offset);
1043 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1045 tvb_fc_to_str (tvb, offset+1));
1047 } while (!(islast & 0x80));
1053 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1055 int offset = 16; /* past the fc_ct header */
1060 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset,
1065 islast = tvb_get_guint8 (tvb, offset);
1066 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1068 tvb_fc_to_str (tvb, offset+1));
1070 } while (!(islast & 0x80));
1076 dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1078 int offset = 16; /* past the fc_ct header */
1083 proto_tree_add_item (req_tree, &hfi_fcdns_req_domainscope, tvb,
1084 offset+1, 1, ENC_BIG_ENDIAN);
1085 proto_tree_add_item (req_tree, &hfi_fcdns_req_areascope, tvb,
1086 offset+2, 1, ENC_BIG_ENDIAN);
1087 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1091 islast = tvb_get_guint8 (tvb, offset);
1092 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1094 tvb_fc_to_str (tvb, offset+1));
1096 } while (!(islast & 0x80));
1102 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1104 int offset = 16; /* past the fc_ct header */
1108 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1110 tvb_fc_to_str (tvb, offset+1));
1111 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
1113 tvb_fcwwn_to_str (tvb, offset+4));
1119 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1121 int offset = 16; /* past the fc_ct header */
1125 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1127 tvb_fc_to_str (tvb, offset+1));
1128 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
1130 tvb_fcwwn_to_str (tvb, offset+4));
1136 dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1138 int offset = 16; /* past the fc_ct header */
1140 if (req_tree && isreq) {
1141 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1143 tvb_fc_to_str (tvb, offset+1));
1144 dissect_cos_flags(req_tree, tvb, offset+4, &hfi_fcdns_req_cos);
1149 dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1151 int offset = 16; /* past the fc_ct header */
1153 if (req_tree && isreq) {
1154 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1156 tvb_fc_to_str (tvb, offset+1));
1157 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype, tvb,
1158 offset+4, 1, ENC_BIG_ENDIAN);
1163 dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1165 int offset = 16; /* past the fc_ct header */
1167 if (req_tree && isreq) {
1168 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1170 tvb_fc_to_str (tvb, offset+1));
1171 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1176 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1178 int offset = 16; /* past the fc_ct header */
1181 if (req_tree && isreq) {
1182 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1184 tvb_fc_to_str (tvb, offset+1));
1185 proto_tree_add_item (req_tree, &hfi_fcdns_req_spnamelen, tvb,
1186 offset+4, 1, ENC_BIG_ENDIAN);
1187 len = tvb_get_guint8 (tvb, offset+4);
1189 proto_tree_add_item (req_tree, &hfi_fcdns_req_spname, tvb, offset+5,
1190 len, ENC_ASCII|ENC_NA);
1195 dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1197 int offset = 16; /* past the fc_ct header */
1199 if (req_tree && isreq) {
1200 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1202 tvb_fc_to_str (tvb, offset+1));
1203 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb,
1204 offset+4, 16, ENC_NA);
1209 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1211 int offset = 16; /* past the fc_ct header */
1214 if (req_tree && isreq) {
1215 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1217 tvb_fc_to_str (tvb, offset+1));
1218 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1221 len = tvb_reported_length_remaining (tvb, offset);
1224 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesclen, tvb, offset,
1226 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesc, tvb, offset+1,
1227 len, ENC_ASCII|ENC_NA);
1235 dissect_fcdns_rffid (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_portid, tvb, offset+1, 3,
1241 tvb_fc_to_str (tvb, offset+1));
1242 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1247 dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1249 int offset = 16; /* past the fc_ct header */
1251 if (req_tree && isreq) {
1252 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1253 tvb_fcwwn_to_str (tvb, offset));
1254 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
1259 dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1261 int offset = 16; /* past the fc_ct header */
1264 if (req_tree && isreq) {
1265 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1266 tvb_fcwwn_to_str (tvb, offset));
1267 len = tvb_get_guint8 (tvb, offset+8);
1269 proto_tree_add_item (req_tree, &hfi_fcdns_req_snamelen, tvb, offset+8,
1271 proto_tree_add_item (req_tree, &hfi_fcdns_req_sname, tvb, offset+9,
1272 len, ENC_ASCII|ENC_NA);
1277 dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1279 int offset = 16; /* past the fc_ct header */
1281 if (req_tree && isreq) {
1282 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1, 3,
1283 tvb_fc_to_str (tvb, offset+1));
1288 zonenm_to_str (tvbuff_t *tvb, gint offset)
1290 int len = tvb_get_guint8 (tvb, offset);
1291 return tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, len, ENC_ASCII);
1295 dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
1302 mbrtype = tvb_get_guint8 (tvb, offset);
1303 proto_tree_add_uint (zmbr_tree, &hfi_fcdns_zone_mbrtype, tvb,
1304 offset, 1, mbrtype);
1305 proto_tree_add_item(zmbr_tree, &hfi_fcdns_zone_flags, tvb, offset+2, 1, ENC_NA);
1306 idlen = tvb_get_guint8 (tvb, offset+3);
1307 proto_tree_add_uint(zmbr_tree, &hfi_fcdns_id_length, tvb, offset+3, 1, idlen);
1309 case FC_SWILS_ZONEMBR_WWN:
1310 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1312 tvb_fcwwn_to_str (tvb, offset+4));
1314 case FC_SWILS_ZONEMBR_DP:
1315 g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl (tvb, offset+4));
1316 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1317 offset+4, 4, dpbuf);
1319 case FC_SWILS_ZONEMBR_FCID:
1320 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1322 tvb_fc_to_str (tvb, offset+5));
1324 case FC_SWILS_ZONEMBR_ALIAS:
1325 str = zonenm_to_str (tvb, offset+4);
1326 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1327 offset+4, idlen, str);
1330 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1332 "Unknown member type format");
1338 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1344 numrec = tvb_get_ntohl (tvb, offset);
1345 proto_tree_add_uint(tree, &hfi_fcdns_num_entries, tvb, offset, 4, numrec);
1348 for (i = 0; i < numrec; i++) {
1349 objfmt = tvb_get_guint8 (tvb, offset);
1351 proto_tree_add_item (tree, &hfi_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
1352 proto_tree_add_string (tree, &hfi_fcdns_rply_ownerid, tvb, offset+1,
1353 3, fc_to_str (tvb_get_string_enc(wmem_packet_scope(), tvb, offset+1,
1355 proto_tree_add_item (tree, &hfi_fcdns_rply_ptype, tvb, offset+4,
1357 proto_tree_add_string (tree, &hfi_fcdns_rply_portid, tvb, offset+5, 3,
1358 tvb_fc_to_str (tvb, offset+5));
1359 proto_tree_add_string (tree, &hfi_fcdns_rply_pname, tvb, offset+8, 8,
1360 tvb_fcwwn_to_str (tvb, offset+8));
1362 if (!(objfmt & 0x1)) {
1363 len = tvb_get_guint8 (tvb, offset);
1364 proto_tree_add_item (tree, &hfi_fcdns_rply_spnamelen, tvb,
1365 offset, 1, ENC_BIG_ENDIAN);
1366 proto_tree_add_item (tree, &hfi_fcdns_rply_spname, tvb,
1367 offset+1, len, ENC_ASCII|ENC_NA);
1370 proto_tree_add_string (tree, &hfi_fcdns_rply_nname, tvb, offset, 8,
1371 tvb_fcwwn_to_str (tvb, offset));
1373 if (!(objfmt & 0x1)) {
1374 len = tvb_get_guint8 (tvb, offset);
1375 proto_tree_add_item (tree, &hfi_fcdns_rply_snamelen, tvb,
1376 offset, 1, ENC_BIG_ENDIAN);
1377 proto_tree_add_item (tree, &hfi_fcdns_rply_sname, tvb,
1378 offset+1, len, ENC_ASCII|ENC_NA);
1381 proto_tree_add_item (tree, &hfi_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
1382 proto_tree_add_item (tree, &hfi_fcdns_rply_ipnode, tvb, offset+8, 16,
1384 dissect_cos_flags(tree, tvb, offset+24, &hfi_fcdns_reply_cos);
1385 dissect_fc4type(tree, tvb, offset+28, &hfi_fcdns_rply_gft);
1386 proto_tree_add_item (tree, &hfi_fcdns_rply_ipport, tvb, offset+60,
1388 proto_tree_add_string (tree, &hfi_fcdns_rply_fpname, tvb, offset+76,
1389 8, tvb_fcwwn_to_str (tvb, offset+76));
1390 proto_tree_add_string (tree, &hfi_fcdns_rply_hrdaddr, tvb, offset+85,
1391 3, tvb_fc_to_str (tvb, offset+85));
1394 dissect_fc4features(tree, tvb, offset);
1395 if (tvb_get_guint8 (tvb, offset+129)) {
1396 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4type, tvb,
1397 offset+128, 1, ENC_BIG_ENDIAN);
1398 proto_tree_add_item (tree, &hfi_fcdns_num_fc4desc, tvb,
1399 offset+129, 1, ENC_BIG_ENDIAN);
1400 len = tvb_get_guint8 (tvb, offset+132);
1401 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4desclen, tvb,
1402 offset+132, 1, ENC_BIG_ENDIAN);
1403 proto_tree_add_item (tree, &hfi_fcdns_rply_fc4desc, tvb,
1404 offset+133, len, ENC_NA);
1407 proto_tree_add_item (tree, &hfi_fcdns_num_fc4desc, tvb,
1408 offset+129, 1, ENC_BIG_ENDIAN);
1410 offset += 388; /* FC4 desc is 260 bytes, maybe padded */
1417 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1419 int offset = 16; /* past the fc_ct header */
1423 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1,
1424 3, tvb_fc_to_str (tvb, offset+1));
1428 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1433 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1435 int offset = 16; /* past the fc_ct header */
1438 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, offset, 8,
1439 tvb_fcwwn_to_str (tvb, offset));
1443 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1448 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1450 int offset = 16; /* past the fc_ct header */
1454 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1455 tvb_fcwwn_to_str (tvb, offset));
1459 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1464 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1466 int offset = 16; /* past the fc_ct header */
1470 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1474 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1479 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1481 int offset = 16; /* past the fc_ct header */
1485 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_fc4type);
1489 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1494 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1496 int offset = 16; /* past the fc_ct header */
1500 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype, tvb, offset+3,
1505 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1510 dissect_fcdns_gezm (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1512 int offset = 16; /* past the fc_ct header */
1516 dissect_fcdns_zone_mbr (tvb, req_tree, offset);
1520 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1525 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1527 int offset = 16; /* past the fc_ct header */
1532 str_len = tvb_get_guint8 (tvb, offset);
1533 proto_tree_add_uint(req_tree, &hfi_fcdns_zonelen, tvb, offset, 1, str_len);
1534 proto_tree_add_item (req_tree, &hfi_fcdns_zonenm, tvb, offset+3,
1535 str_len, ENC_ASCII|ENC_NA);
1539 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1544 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1546 int offset = 16; /* past the fc_ct header */
1550 proto_tree_add_item (req_tree, &hfi_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1554 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1559 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1561 int offset = 16; /* past the fc_ct header */
1565 dissect_fc4features(req_tree, tvb, offset);
1569 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1574 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1579 proto_tree_add_item (req_tree, &hfi_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1580 proto_tree_add_item (req_tree, &hfi_fcdns_rjtdetail, tvb, offset+14, 1,
1582 proto_tree_add_item (req_tree, &hfi_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1587 dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1589 /* Set up structures needed to add the protocol subtree and manage it */
1590 proto_item *ti = NULL;
1591 proto_tree *fcdns_tree = NULL;
1596 fc_ct_preamble cthdr;
1597 conversation_t *conversation;
1598 fcdns_conv_data_t *cdata;
1599 fcdns_conv_key_t ckey, *req_key;
1602 /* Reject the packet if data is NULL */
1605 fchdr = (fc_hdr *)data;
1607 tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
1608 cthdr.revision = tvb_get_guint8 (tvb, offset);
1609 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1610 cthdr.opcode = g_ntohs (cthdr.opcode);
1611 opcode = cthdr.opcode;
1612 cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
1614 /* Determine the type of server the request/response is for */
1615 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1616 col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1618 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1621 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1622 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1625 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1628 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1631 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1635 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1636 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1637 pinfo->ptype, fchdr->oxid,
1638 fchdr->rxid, NO_PORT2);
1639 if (!conversation) {
1640 conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1641 pinfo->ptype, fchdr->oxid,
1642 fchdr->rxid, NO_PORT2);
1645 ckey.conv_idx = conversation->index;
1647 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash,
1650 /* Since we never free the memory used by an exchange, this maybe a
1651 * case of another request using the same exchange as a previous
1654 cdata->opcode = opcode;
1657 req_key = wmem_new(wmem_file_scope(), fcdns_conv_key_t);
1658 req_key->conv_idx = conversation->index;
1660 cdata = wmem_new(wmem_file_scope(), fcdns_conv_data_t);
1661 cdata->opcode = opcode;
1663 g_hash_table_insert (fcdns_req_hash, req_key, cdata);
1665 col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1669 /* Opcode is ACC or RJT */
1670 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1671 pinfo->ptype, fchdr->oxid,
1672 fchdr->rxid, NO_PORT2);
1674 if (!conversation) {
1675 if (opcode == FCCT_MSG_ACC) {
1676 col_add_str (pinfo->cinfo, COL_INFO,
1677 val_to_str (opcode, fc_dns_opcode_val,
1679 /* No record of what this accept is for. Can't decode */
1680 proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1685 ckey.conv_idx = conversation->index;
1687 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash, &ckey);
1689 if (cdata != NULL) {
1690 if (opcode == FCCT_MSG_ACC) {
1691 opcode = cdata->opcode;
1694 failed_opcode = cdata->opcode;
1697 if (opcode != FCCT_MSG_RJT) {
1698 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1699 val_to_str (opcode, fc_dns_opcode_val,
1703 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1704 val_to_str (failed_opcode,
1710 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1711 /* No record of what this accept is for. Can't decode */
1712 proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1);
1720 proto_tree_add_item (fcdns_tree, &hfi_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1721 proto_tree_add_item (fcdns_tree, &hfi_fcdns_maxres_size, tvb, offset+10,
1727 dissect_fcdns_rjt (tvb, fcdns_tree);
1730 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1733 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1736 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1739 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1742 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1745 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1748 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1751 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1754 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1757 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1760 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1763 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1766 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1769 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1772 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1775 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1778 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1781 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1784 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1787 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1790 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1793 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1796 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1799 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1802 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1805 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1808 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1811 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1814 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1817 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1820 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1823 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1826 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1829 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1832 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1835 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1838 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1841 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1844 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1847 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1850 dissect_fcdns_gezm (tvb, fcdns_tree, isreq);
1853 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1856 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1859 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1865 return tvb_length(tvb);
1868 /* Register the protocol with Wireshark */
1871 proto_register_fcdns (void)
1873 #ifndef HAVE_HFI_SECTION_INIT
1874 static header_field_info *hfi[] = {
1875 /* &hfi_fcdns_gssubtype */
1877 &hfi_fcdns_req_portid,
1878 &hfi_fcdns_rply_pname,
1879 &hfi_fcdns_rply_nname,
1880 &hfi_fcdns_rply_snamelen,
1881 &hfi_fcdns_rply_sname,
1882 &hfi_fcdns_rply_ptype,
1883 &hfi_fcdns_rply_fpname,
1884 &hfi_fcdns_req_pname,
1885 &hfi_fcdns_rply_portid,
1886 &hfi_fcdns_req_nname,
1887 &hfi_fcdns_req_domainscope,
1888 &hfi_fcdns_req_areascope,
1889 &hfi_fcdns_req_fc4type,
1890 &hfi_fcdns_req_ptype,
1892 &hfi_fcdns_rply_fc4type,
1893 &hfi_fcdns_req_snamelen,
1894 &hfi_fcdns_req_sname,
1895 &hfi_fcdns_rply_spnamelen,
1896 &hfi_fcdns_rply_spname,
1897 &hfi_fcdns_rply_ipa,
1898 &hfi_fcdns_rply_ipnode,
1899 &hfi_fcdns_rply_ipport,
1900 &hfi_fcdns_rply_fc4desclen,
1901 &hfi_fcdns_rply_fc4desc,
1902 &hfi_fcdns_rply_hrdaddr,
1903 &hfi_fcdns_req_fdesclen,
1904 &hfi_fcdns_req_fdesc,
1905 &hfi_fcdns_req_spnamelen,
1906 &hfi_fcdns_req_spname,
1908 &hfi_fcdns_rjtdetail,
1910 &hfi_fcdns_zone_mbrtype,
1911 &hfi_fcdns_zone_mbrid,
1914 &hfi_fcdns_sw2_objfmt,
1915 &hfi_fcdns_num_fc4desc,
1916 &hfi_fcdns_rply_ownerid,
1917 &hfi_fcdns_maxres_size,
1918 &hfi_fcdns_reply_cos,
1926 &hfi_fcdns_fc4type_llcsnap,
1927 &hfi_fcdns_fc4type_ip,
1928 &hfi_fcdns_fc4type_fcp,
1929 &hfi_fcdns_fc4type_swils,
1930 &hfi_fcdns_fc4type_snmp,
1931 &hfi_fcdns_fc4type_gs3,
1932 &hfi_fcdns_fc4type_vi,
1933 &hfi_fcdns_rply_gft,
1934 &hfi_fcdns_req_fc4types,
1936 &hfi_fcdns_fc4features,
1937 &hfi_fcdns_fc4features_i,
1938 &hfi_fcdns_fc4features_t,
1942 static gint *ett[] = {
1949 static ei_register_info ei[] = {
1950 { &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 }},
1953 expert_module_t* expert_fcdns;
1956 proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns");
1957 hfi_fcdns = proto_registrar_get_nth(proto_fcdns);
1959 proto_register_fields(proto_fcdns, hfi, array_length(hfi));
1960 proto_register_subtree_array(ett, array_length(ett));
1961 expert_fcdns = expert_register_protocol(proto_fcdns);
1962 expert_register_field_array(expert_fcdns, ei, array_length(ei));
1963 register_init_routine (&fcdns_init_protocol);
1965 dns_handle = new_create_dissector_handle (dissect_fcdns, proto_fcdns);
1969 proto_reg_handoff_fcdns (void)
1971 dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
1972 dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_handle);
1976 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1981 * indent-tabs-mode: nil
1984 * vi: set shiftwidth=4 tabstop=8 expandtab:
1985 * :indentSize=4:tabSize=8:noTabs=true: