2 * Routines for FC distributed Name Server (dNS)
3 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #ifdef HAVE_NETINET_IN_H
29 # include <netinet/in.h>
34 #include <epan/packet.h>
35 #include <epan/emem.h>
36 #include <epan/conversation.h>
37 #include <epan/etypes.h>
38 #include "packet-scsi.h"
39 #include "packet-fc.h"
40 #include "packet-fcct.h"
41 #include "packet-fcdns.h"
42 #include "packet-fcswils.h"
48 /* Initialize the protocol and registered fields */
49 static int proto_fcdns = -1;
50 /* static int hf_fcdns_gssubtype = -1; */
51 static int hf_fcdns_opcode = -1;
52 static int hf_fcdns_reason = -1;
53 static int hf_fcdns_vendor = -1;
54 static int hf_fcdns_req_portid = -1;
55 static int hf_fcdns_rply_pname = -1;
56 static int hf_fcdns_rply_nname = -1;
57 static int hf_fcdns_rply_gft = -1;
58 static int hf_fcdns_rply_snamelen = -1;
59 static int hf_fcdns_rply_sname = -1;
60 static int hf_fcdns_rply_ptype = -1;
61 static int hf_fcdns_rply_fpname = -1;
62 static int hf_fcdns_fc4type = -1;
63 static int hf_fcdns_rply_fc4type = -1;
64 static int hf_fcdns_rply_fc4desc = -1;
65 static int hf_fcdns_req_pname = -1;
66 static int hf_fcdns_rply_portid = -1;
67 static int hf_fcdns_req_nname = -1;
68 static int hf_fcdns_req_domainscope = -1;
69 static int hf_fcdns_req_areascope = -1;
70 static int hf_fcdns_req_ptype = -1;
71 static int hf_fcdns_req_cos = -1;
72 static int hf_fcdns_req_fc4types = -1;
73 static int hf_fcdns_req_snamelen = -1;
74 static int hf_fcdns_req_sname = -1;
75 static int hf_fcdns_rply_spnamelen = -1;
76 static int hf_fcdns_rply_spname = -1;
77 static int hf_fcdns_req_spnamelen = -1;
78 static int hf_fcdns_req_spname = -1;
79 static int hf_fcdns_rply_ipa = -1;
80 static int hf_fcdns_rply_ipnode = -1;
81 static int hf_fcdns_rply_ipport = -1;
82 static int hf_fcdns_rply_fc4desclen = -1;
83 static int hf_fcdns_rply_hrdaddr = -1;
84 static int hf_fcdns_req_fdesclen = -1;
85 static int hf_fcdns_req_fdesc = -1;
86 static int hf_fcdns_req_ip = -1;
87 static int hf_fcdns_rjtdetail = -1;
88 static int hf_fcdns_zone_mbrtype = -1;
89 static int hf_fcdns_zone_mbrid = -1;
90 static int hf_fcdns_zonenm = -1;
91 static int hf_fcdns_portip = -1;
92 static int hf_fcdns_sw2_objfmt = -1;
93 static int hf_fcdns_num_fc4desc = -1;
94 static int hf_fcdns_rply_ownerid = -1;
95 static int hf_fcdns_maxres_size = -1;
96 static int hf_fcdns_reply_cos = -1;
97 static int hf_fcdns_cos_f = -1;
98 static int hf_fcdns_cos_1 = -1;
99 static int hf_fcdns_cos_2 = -1;
100 static int hf_fcdns_cos_3 = -1;
101 static int hf_fcdns_cos_4 = -1;
102 static int hf_fcdns_cos_6 = -1;
103 static int hf_fcdns_fc4type_llcsnap = -1;
104 static int hf_fcdns_fc4type_ip = -1;
105 static int hf_fcdns_fc4type_fcp = -1;
106 static int hf_fcdns_fc4type_swils = -1;
107 static int hf_fcdns_fc4type_snmp = -1;
108 static int hf_fcdns_fc4type_gs3 = -1;
109 static int hf_fcdns_fc4type_vi = -1;
110 static int hf_fcdns_fc4features = -1;
111 static int hf_fcdns_fc4features_i = -1;
112 static int hf_fcdns_fc4features_t = -1;
113 static int hf_fcdns_req_fc4type = -1;
115 /* Initialize the subtree pointers */
116 static gint ett_fcdns = -1;
117 static gint ett_cos_flags = -1;
118 static gint ett_fc4flags = -1;
119 static gint ett_fc4features = -1;
121 typedef struct _fcdns_conv_key {
125 typedef struct _fcdns_conv_data {
129 static GHashTable *fcdns_req_hash = NULL;
131 static dissector_handle_t data_handle;
137 fcdns_equal(gconstpointer v, gconstpointer w)
139 const fcdns_conv_key_t *v1 = v;
140 const fcdns_conv_key_t *v2 = w;
142 return (v1->conv_idx == v2->conv_idx);
146 fcdns_hash (gconstpointer v)
148 const fcdns_conv_key_t *key = v;
157 * Protocol initialization
160 fcdns_init_protocol(void)
163 g_hash_table_destroy(fcdns_req_hash);
165 fcdns_req_hash = g_hash_table_new(fcdns_hash, fcdns_equal);
169 static const true_false_string tfs_fcdns_cos_f = {
173 static const true_false_string tfs_fcdns_cos_1 = {
177 static const true_false_string tfs_fcdns_cos_2 = {
181 static const true_false_string tfs_fcdns_cos_3 = {
185 static const true_false_string tfs_fcdns_cos_4 = {
189 static const true_false_string tfs_fcdns_cos_6 = {
194 dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
196 proto_item *item=NULL;
197 proto_tree *tree=NULL;
200 flags = tvb_get_ntohl (tvb, offset);
202 item=proto_tree_add_uint(parent_tree, hfindex,
203 tvb, offset, 1, flags);
204 tree=proto_item_add_subtree(item, ett_cos_flags);
208 proto_tree_add_boolean(tree, hf_fcdns_cos_f, tvb, offset, 4, flags);
210 proto_item_append_text(item, " F");
214 proto_tree_add_boolean(tree, hf_fcdns_cos_1, tvb, offset, 4, flags);
216 proto_item_append_text(item, " 1");
220 proto_tree_add_boolean(tree, hf_fcdns_cos_2, tvb, offset, 4, flags);
222 proto_item_append_text(item, " 2");
226 proto_tree_add_boolean(tree, hf_fcdns_cos_3, tvb, offset, 4, flags);
228 proto_item_append_text(item, " 3");
232 proto_tree_add_boolean(tree, hf_fcdns_cos_4, tvb, offset, 4, flags);
234 proto_item_append_text(item, " 4");
238 proto_tree_add_boolean(tree, hf_fcdns_cos_6, tvb, offset, 4, flags);
240 proto_item_append_text(item, " 6");
246 static const true_false_string tfs_fcdns_fc4features_i = {
250 static const true_false_string tfs_fcdns_fc4features_t = {
255 /* The feature routines just decode FCP's FC-4 features field
256 * based on the flahs in offset and the type in offset+1
259 dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
261 proto_item *item=NULL;
262 proto_tree *tree=NULL;
265 flags = tvb_get_guint8(tvb, offset);
266 type = tvb_get_guint8(tvb, offset+1);
268 item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features,
269 tvb, offset, 1, flags);
270 tree=proto_item_add_subtree(item, ett_fc4features);
273 if(type==FC_TYPE_SCSI){
274 proto_tree_add_boolean(tree, hf_fcdns_fc4features_i, tvb, offset, 1, flags);
276 proto_item_append_text(item, " I");
280 proto_tree_add_boolean(tree, hf_fcdns_fc4features_t, tvb, offset, 1, flags);
282 proto_item_append_text(item, " T");
284 /*flags&=(~( 0x01 ));*/
287 proto_tree_add_item (tree, hf_fcdns_req_fc4type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
290 /* The feature routines just decode FCP's FC-4 features field
293 dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
295 proto_item *item=NULL;
296 proto_tree *tree=NULL;
299 flags = tvb_get_guint8(tvb, offset);
301 item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features,
302 tvb, offset, 1, flags);
303 tree=proto_item_add_subtree(item, ett_fc4features);
306 proto_tree_add_boolean(tree, hf_fcdns_fc4features_i, tvb, offset, 1, flags);
308 proto_item_append_text(item, " I");
312 proto_tree_add_boolean(tree, hf_fcdns_fc4features_t, tvb, offset, 1, flags);
314 proto_item_append_text(item, " T");
316 /*flags&=(~( 0x01 ));*/
320 static const true_false_string tfs_fcdns_fc4type_llcsnap = {
322 "Llc/snap is NOT set"
324 static const true_false_string tfs_fcdns_fc4type_ip = {
328 static const true_false_string tfs_fcdns_fc4type_fcp = {
332 static const true_false_string tfs_fcdns_fc4type_swils = {
336 static const true_false_string tfs_fcdns_fc4type_snmp = {
340 static const true_false_string tfs_fcdns_fc4type_gs3 = {
344 static const true_false_string tfs_fcdns_fc4type_vi = {
349 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
351 dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex)
353 proto_item *item=NULL;
354 proto_tree *tree=NULL;
358 item=proto_tree_add_item(parent_tree, hfindex, tvb, offset,
360 tree=proto_item_add_subtree(item, ett_fc4flags);
363 flags = tvb_get_ntohl (tvb, offset);
365 proto_tree_add_boolean(tree, hf_fcdns_fc4type_fcp, tvb, offset, 4, flags);
367 proto_item_append_text(item, " FCP");
369 flags&=(~( 0x0100 ));
371 proto_tree_add_boolean(tree, hf_fcdns_fc4type_ip, tvb, offset, 4, flags);
373 proto_item_append_text(item, " IP");
375 flags&=(~( 0x0020 ));
377 proto_tree_add_boolean(tree, hf_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
379 proto_item_append_text(item, " LLC/SNAP");
381 /*flags&=(~( 0x0010 ));*/
384 flags = tvb_get_ntohl (tvb, offset+4);
386 proto_tree_add_boolean(tree, hf_fcdns_fc4type_swils, tvb, offset+4, 4, flags);
388 proto_item_append_text(item, " SW_ILS");
390 flags&=(~( 0x0010 ));
392 proto_tree_add_boolean(tree, hf_fcdns_fc4type_snmp, tvb, offset+4, 4, flags);
394 proto_item_append_text(item, " SNMP");
396 flags&=(~( 0x0004 ));
398 proto_tree_add_boolean(tree, hf_fcdns_fc4type_gs3, tvb, offset+4, 4, flags);
400 proto_item_append_text(item, " GS3");
402 /*flags&=(~( 0x0001 ));*/
405 flags = tvb_get_ntohl (tvb, offset+8);
407 proto_tree_add_boolean(tree, hf_fcdns_fc4type_vi, tvb, offset+8, 4, flags);
409 proto_item_append_text(item, " VI");
411 /*flags&=(~( 0x0001 ));*/
414 /* Code to actually dissect the packets */
416 /* A bunch of get routines have a similar req packet format. The first few
417 * routines deal with this decoding. All assume that tree is valid */
419 dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
422 proto_tree_add_string (tree, hf_fcdns_req_portid, tvb, offset, 3,
423 tvb_fc_to_str (tvb, offset));
428 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
430 int offset = 16; /* past the fc_ct header */
435 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
438 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb, offset,
440 proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb,
442 tvb_fc_to_str (tvb, offset+1));
443 proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb,
445 tvb_fcwwn_to_str (tvb, offset+4));
446 len = tvb_get_guint8 (tvb, offset+12);
447 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb,
448 offset+12, 1, ENC_BIG_ENDIAN);
449 if (!tvb_offset_exists (tvb, 29+len))
453 proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
454 offset+13, len, ENC_ASCII|ENC_NA);
457 if (tvb_offset_exists (tvb, 292)) {
458 proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb,
460 tvb_fcwwn_to_str (tvb, offset+268));
462 if (tvb_offset_exists (tvb, 548)) {
463 len = tvb_get_guint8 (tvb, offset+276);
464 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
465 offset+276, 1, ENC_BIG_ENDIAN);
467 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
468 offset+277, len, ENC_ASCII|ENC_NA);
471 if (tvb_offset_exists (tvb, 556)) {
472 proto_tree_add_item (req_tree, hf_fcdns_rply_ipa, tvb,
473 offset+532, 8, ENC_NA);
475 if (tvb_offset_exists (tvb, 572)) {
476 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb,
477 offset+540, 16, ENC_NA);
479 if (tvb_offset_exists (tvb, 576)) {
480 dissect_cos_flags(req_tree, tvb, offset+556, hf_fcdns_reply_cos);
482 if (tvb_offset_exists (tvb, 608)) {
483 dissect_fc4type(req_tree, tvb, offset+560, hf_fcdns_rply_gft);
485 if (tvb_offset_exists (tvb, 624)) {
486 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb,
487 offset+592, 16, ENC_NA);
489 if (tvb_offset_exists (tvb, 632)) {
490 proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb,
492 tvb_fcwwn_to_str (tvb, offset+608));
494 if (tvb_offset_exists (tvb, 635)) {
495 proto_tree_add_string (req_tree, hf_fcdns_rply_hrdaddr, tvb,
497 tvb_fc_to_str (tvb, offset+617));
504 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
506 int offset = 16; /* past the fc_ct header */
510 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
513 proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset,
514 8, tvb_fcwwn_to_str (tvb, offset));
520 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
522 int offset = 16; /* past the fc_ct header */
526 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
529 proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb,
531 tvb_fcwwn_to_str (tvb, offset));
537 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
539 int offset = 16; /* past the fc_ct header */
543 dissect_fcdns_req_portid (tvb, req_tree, offset);
546 dissect_cos_flags(req_tree, tvb, offset, hf_fcdns_reply_cos);
552 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
554 int offset = 16; /* past the fc_ct header */
558 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
561 dissect_fc4type(req_tree, tvb, offset, hf_fcdns_rply_gft);
567 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
569 int offset = 16; /* past the fc_ct header */
574 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
577 len = tvb_get_guint8 (tvb, offset);
578 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen,
579 tvb, offset, 1, ENC_BIG_ENDIAN);
580 proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
581 offset+1, len, ENC_ASCII|ENC_NA);
587 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
589 int offset = 16; /* past the fc_ct header */
593 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
596 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb,
597 offset, 1, ENC_BIG_ENDIAN);
603 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
605 int offset = 16; /* past the fc_ct header */
609 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
612 proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb,
614 tvb_fcwwn_to_str (tvb, offset));
621 dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
623 int offset = 16; /* past the fc_ct header */
624 int tot_len, desclen;
628 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
629 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_fc4type);
632 tot_len = tvb_reported_length_remaining (tvb, offset); /* excluding CT header */
633 while (tot_len > 0) {
634 /* The count of the descriptors is not returned and so we have
635 * to track the display by the length field */
636 desclen = tvb_get_guint8 (tvb, offset);
637 proto_tree_add_item (req_tree, hf_fcdns_rply_fc4desc, tvb,
638 offset, desclen, ENC_NA);
639 tot_len -= 255; /* descriptors are aligned to 255 bytes */
647 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
649 int offset = 16; /* past the fc_ct header */
653 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
656 dissect_fc4features(req_tree, tvb, offset);
662 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
664 int offset = 16; /* past the fc_ct header */
668 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
670 tvb_fcwwn_to_str (tvb, offset));
673 proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb,
675 tvb_fc_to_str (tvb, offset+1));
681 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
683 int offset = 16; /* past the fc_ct header */
687 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
689 tvb_fcwwn_to_str (tvb, offset));
692 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset,
699 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
701 int offset = 16; /* past the fc_ct header */
706 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
708 tvb_fcwwn_to_str (tvb, offset));
712 islast = tvb_get_guint8 (tvb, offset);
713 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
715 tvb_fc_to_str (tvb, offset+1));
717 } while (!(islast & 0x80));
723 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
725 int offset = 16; /* past the fc_ct header */
729 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
731 tvb_fcwwn_to_str (tvb, offset));
734 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset,
741 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
743 int offset = 16; /* past the fc_ct header */
748 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
750 tvb_fcwwn_to_str (tvb, offset));
754 islast = tvb_get_guint8 (tvb, offset);
755 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
757 tvb_fc_to_str (tvb, offset+1));
758 proto_tree_add_string (req_tree, hf_fcdns_rply_pname,
760 tvb_fcwwn_to_str (tvb, offset+8));
762 } while (!(islast & 0x80));
768 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
770 int offset = 16; /* past the fc_ct header */
775 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
777 tvb_fcwwn_to_str (tvb, offset));
780 len = tvb_get_guint8 (tvb, offset);
781 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
782 offset, 1, ENC_BIG_ENDIAN);
783 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
784 offset+1, len, ENC_ASCII|ENC_NA);
790 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
792 int offset = 16; /* past the fc_ct header */
797 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
798 tvb, offset+1, 1, ENC_BIG_ENDIAN);
799 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
800 tvb, offset+2, 1, ENC_BIG_ENDIAN);
801 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
802 tvb, offset+3, 1, ENC_BIG_ENDIAN);
806 islast = tvb_get_guint8 (tvb, offset);
807 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
809 tvb_fc_to_str (tvb, offset+1));
811 } while (!(islast & 0x80));
817 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
819 int offset = 16; /* past the fc_ct header */
824 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
825 tvb, offset+1, 1, ENC_BIG_ENDIAN);
826 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
827 tvb, offset+2, 1, ENC_BIG_ENDIAN);
828 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
829 tvb, offset+3, 1, ENC_BIG_ENDIAN);
833 islast = tvb_get_guint8 (tvb, offset);
834 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
836 tvb_fc_to_str (tvb, offset+1));
837 proto_tree_add_string (req_tree, hf_fcdns_rply_pname,
839 tvb_fcwwn_to_str (tvb, offset+8));
841 } while (!(islast & 0x80));
847 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
849 int offset = 16; /* past the fc_ct header */
854 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
855 tvb, offset+1, 1, ENC_BIG_ENDIAN);
856 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
857 tvb, offset+2, 1, ENC_BIG_ENDIAN);
858 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
859 tvb, offset+3, 1, ENC_BIG_ENDIAN);
863 islast = tvb_get_guint8 (tvb, offset);
864 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
866 tvb_fc_to_str (tvb, offset+1));
867 proto_tree_add_string (req_tree, hf_fcdns_rply_nname,
869 tvb_fcwwn_to_str (tvb, offset+8));
871 } while (!(islast & 0x80));
877 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
879 int offset = 16; /* past the fc_ct header */
884 proto_tree_add_item (req_tree, hf_fcdns_req_ptype,
885 tvb, offset, 1, ENC_BIG_ENDIAN);
886 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
887 tvb, offset+1, 1, ENC_BIG_ENDIAN);
888 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
889 tvb, offset+2, 1, ENC_BIG_ENDIAN);
893 islast = tvb_get_guint8 (tvb, offset);
894 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
896 tvb_fc_to_str (tvb, offset+1));
898 } while (!(islast & 0x80));
904 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
906 int offset = 16; /* past the fc_ct header */
911 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset,
916 islast = tvb_get_guint8 (tvb, offset);
917 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
919 tvb_fc_to_str (tvb, offset+1));
921 } while (!(islast & 0x80));
927 dissect_fcdns_gidff (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, hf_fcdns_req_domainscope, tvb,
935 offset+1, 1, ENC_BIG_ENDIAN);
936 proto_tree_add_item (req_tree, hf_fcdns_req_areascope, tvb,
937 offset+2, 1, ENC_BIG_ENDIAN);
938 dissect_fc4features_and_type(req_tree, tvb, offset+6);
942 islast = tvb_get_guint8 (tvb, offset);
943 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
945 tvb_fc_to_str (tvb, offset+1));
947 } while (!(islast & 0x80));
953 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
955 int offset = 16; /* past the fc_ct header */
959 proto_tree_add_string (req_tree, hf_fcdns_req_portid,
961 tvb_fc_to_str (tvb, offset+1));
962 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
964 tvb_fcwwn_to_str (tvb, offset+4));
970 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
972 int offset = 16; /* past the fc_ct header */
976 proto_tree_add_string (req_tree, hf_fcdns_req_portid,
978 tvb_fc_to_str (tvb, offset+1));
979 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
981 tvb_fcwwn_to_str (tvb, offset+4));
987 dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
989 int offset = 16; /* past the fc_ct header */
991 if (req_tree && isreq) {
992 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
994 tvb_fc_to_str (tvb, offset+1));
995 dissect_cos_flags(req_tree, tvb, offset+4, hf_fcdns_req_cos);
1000 dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1002 int offset = 16; /* past the fc_ct header */
1004 if (req_tree && isreq) {
1005 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1007 tvb_fc_to_str (tvb, offset+1));
1008 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb,
1009 offset+4, 1, ENC_BIG_ENDIAN);
1014 dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1016 int offset = 16; /* past the fc_ct header */
1018 if (req_tree && isreq) {
1019 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1021 tvb_fc_to_str (tvb, offset+1));
1022 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1027 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1029 int offset = 16; /* past the fc_ct header */
1032 if (req_tree && isreq) {
1033 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1035 tvb_fc_to_str (tvb, offset+1));
1036 proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb,
1037 offset+4, 1, ENC_BIG_ENDIAN);
1038 len = tvb_get_guint8 (tvb, offset+4);
1040 proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5,
1041 len, ENC_ASCII|ENC_NA);
1046 dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1048 int offset = 16; /* past the fc_ct header */
1050 if (req_tree && isreq) {
1051 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1053 tvb_fc_to_str (tvb, offset+1));
1054 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb,
1055 offset+4, 16, ENC_NA);
1060 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1062 int offset = 16; /* past the fc_ct header */
1065 if (req_tree && isreq) {
1066 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1068 tvb_fc_to_str (tvb, offset+1));
1069 dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types);
1072 len = tvb_reported_length_remaining (tvb, offset);
1075 proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset,
1077 proto_tree_add_item (req_tree, hf_fcdns_req_fdesc, tvb, offset+1,
1078 len, ENC_ASCII|ENC_NA);
1086 dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1088 int offset = 16; /* past the fc_ct header */
1090 if (req_tree && isreq) {
1091 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3,
1092 tvb_fc_to_str (tvb, offset+1));
1093 dissect_fc4features_and_type(req_tree, tvb, offset+6);
1098 dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1100 int offset = 16; /* past the fc_ct header */
1102 if (req_tree && isreq) {
1103 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8,
1104 tvb_fcwwn_to_str (tvb, offset));
1105 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, ENC_NA);
1110 dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1112 int offset = 16; /* past the fc_ct header */
1115 if (req_tree && isreq) {
1116 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8,
1117 tvb_fcwwn_to_str (tvb, offset));
1118 len = tvb_get_guint8 (tvb, offset+8);
1120 proto_tree_add_item (req_tree, hf_fcdns_req_snamelen, tvb, offset+8,
1122 proto_tree_add_item (req_tree, hf_fcdns_req_sname, tvb, offset+9,
1123 len, ENC_ASCII|ENC_NA);
1128 dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1130 int offset = 16; /* past the fc_ct header */
1132 if (req_tree && isreq) {
1133 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3,
1134 tvb_fc_to_str (tvb, offset+1));
1139 zonenm_to_str (tvbuff_t *tvb, gint offset)
1141 int len = tvb_get_guint8 (tvb, offset);
1142 return tvb_get_ephemeral_string (tvb, offset+4, len);
1146 dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
1153 mbrtype = tvb_get_guint8 (tvb, offset);
1154 proto_tree_add_uint (zmbr_tree, hf_fcdns_zone_mbrtype, tvb,
1155 offset, 1, mbrtype);
1156 proto_tree_add_text (zmbr_tree, tvb, offset+2, 1, "Flags: 0x%x",
1157 tvb_get_guint8 (tvb, offset+2));
1158 idlen = tvb_get_guint8 (tvb, offset+3);
1159 proto_tree_add_text (zmbr_tree, tvb, offset+3, 1,
1160 "Identifier Length: %d", idlen);
1162 case FC_SWILS_ZONEMBR_WWN:
1163 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1165 tvb_fcwwn_to_str (tvb, offset+4));
1167 case FC_SWILS_ZONEMBR_DP:
1168 g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl (tvb, offset+4));
1169 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1170 offset+4, 4, dpbuf);
1172 case FC_SWILS_ZONEMBR_FCID:
1173 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1175 tvb_fc_to_str (tvb, offset+5));
1177 case FC_SWILS_ZONEMBR_ALIAS:
1178 str = zonenm_to_str (tvb, offset+4);
1179 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1180 offset+4, idlen, str);
1183 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1185 "Unknown member type format");
1191 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1196 numrec = tvb_get_ntohl (tvb, offset);
1199 proto_tree_add_text (tree, tvb, offset, 4, "Number of Entries: %d",
1203 for (i = 0; i < numrec; i++) {
1204 objfmt = tvb_get_guint8 (tvb, offset);
1206 proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, ENC_BIG_ENDIAN);
1207 proto_tree_add_string (tree, hf_fcdns_rply_ownerid, tvb, offset+1,
1208 3, fc_to_str (tvb_get_ephemeral_string (tvb, offset+1,
1210 proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
1212 proto_tree_add_string (tree, hf_fcdns_rply_portid, tvb, offset+5, 3,
1213 tvb_fc_to_str (tvb, offset+5));
1214 proto_tree_add_string (tree, hf_fcdns_rply_pname, tvb, offset+8, 8,
1215 tvb_fcwwn_to_str (tvb, offset+8));
1217 if (!(objfmt & 0x1)) {
1218 len = tvb_get_guint8 (tvb, offset);
1219 proto_tree_add_item (tree, hf_fcdns_rply_spnamelen, tvb,
1220 offset, 1, ENC_BIG_ENDIAN);
1221 proto_tree_add_item (tree, hf_fcdns_rply_spname, tvb,
1222 offset+1, len, ENC_ASCII|ENC_NA);
1225 proto_tree_add_string (tree, hf_fcdns_rply_nname, tvb, offset, 8,
1226 tvb_fcwwn_to_str (tvb, offset));
1228 if (!(objfmt & 0x1)) {
1229 len = tvb_get_guint8 (tvb, offset);
1230 proto_tree_add_item (tree, hf_fcdns_rply_snamelen, tvb,
1231 offset, 1, ENC_BIG_ENDIAN);
1232 proto_tree_add_item (tree, hf_fcdns_rply_sname, tvb,
1233 offset+1, len, ENC_ASCII|ENC_NA);
1236 proto_tree_add_item (tree, hf_fcdns_rply_ipa, tvb, offset, 8, ENC_NA);
1237 proto_tree_add_item (tree, hf_fcdns_rply_ipnode, tvb, offset+8, 16,
1239 dissect_cos_flags(tree, tvb, offset+24, hf_fcdns_reply_cos);
1240 dissect_fc4type(tree, tvb, offset+28, hf_fcdns_rply_gft);
1241 proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60,
1243 proto_tree_add_string (tree, hf_fcdns_rply_fpname, tvb, offset+76,
1244 8, tvb_fcwwn_to_str (tvb, offset+76));
1245 proto_tree_add_string (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85,
1246 3, tvb_fc_to_str (tvb, offset+85));
1249 dissect_fc4features(tree, tvb, offset);
1250 if (tvb_get_guint8 (tvb, offset+129)) {
1251 proto_tree_add_item (tree, hf_fcdns_rply_fc4type, tvb,
1252 offset+128, 1, ENC_BIG_ENDIAN);
1253 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1254 offset+129, 1, ENC_BIG_ENDIAN);
1255 len = tvb_get_guint8 (tvb, offset+132);
1256 proto_tree_add_item (tree, hf_fcdns_rply_fc4desclen, tvb,
1257 offset+132, 1, ENC_BIG_ENDIAN);
1258 proto_tree_add_item (tree, hf_fcdns_rply_fc4desc, tvb,
1259 offset+133, len, ENC_NA);
1262 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1263 offset+129, 1, ENC_BIG_ENDIAN);
1265 offset += 388; /* FC4 desc is 260 bytes, maybe padded */
1272 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1274 int offset = 16; /* past the fc_ct header */
1278 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1,
1279 3, tvb_fc_to_str (tvb, offset+1));
1283 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1288 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1290 int offset = 16; /* past the fc_ct header */
1293 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset, 8,
1294 tvb_fcwwn_to_str (tvb, offset));
1298 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1303 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1305 int offset = 16; /* past the fc_ct header */
1309 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8,
1310 tvb_fcwwn_to_str (tvb, offset));
1314 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1319 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1321 int offset = 16; /* past the fc_ct header */
1325 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1329 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1334 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1336 int offset = 16; /* past the fc_ct header */
1340 dissect_fc4type(req_tree, tvb, offset, hf_fcdns_fc4type);
1344 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1349 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1351 int offset = 16; /* past the fc_ct header */
1355 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+3,
1360 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1365 dissect_fcdns_gezm (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1367 int offset = 16; /* past the fc_ct header */
1371 dissect_fcdns_zone_mbr (tvb, req_tree, offset);
1375 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1380 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1382 int offset = 16; /* past the fc_ct header */
1387 str_len = tvb_get_guint8 (tvb, offset);
1388 proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d",
1390 proto_tree_add_item (req_tree, hf_fcdns_zonenm, tvb, offset+3,
1391 str_len, ENC_ASCII|ENC_NA);
1395 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1400 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1402 int offset = 16; /* past the fc_ct header */
1406 proto_tree_add_item (req_tree, hf_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1410 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1415 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1417 int offset = 16; /* past the fc_ct header */
1421 dissect_fc4features(req_tree, tvb, offset);
1425 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1430 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1435 proto_tree_add_item (req_tree, hf_fcdns_reason, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1436 proto_tree_add_item (req_tree, hf_fcdns_rjtdetail, tvb, offset+14, 1,
1438 proto_tree_add_item (req_tree, hf_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1443 dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1445 /* Set up structures needed to add the protocol subtree and manage it */
1446 proto_item *ti = NULL;
1447 proto_tree *fcdns_tree = NULL;
1452 fc_ct_preamble cthdr;
1453 conversation_t *conversation;
1454 fcdns_conv_data_t *cdata;
1455 fcdns_conv_key_t ckey, *req_key;
1457 tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
1458 cthdr.revision = tvb_get_guint8 (tvb, offset);
1459 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1460 cthdr.opcode = g_ntohs (cthdr.opcode);
1461 opcode = cthdr.opcode;
1462 cthdr.maxres_size = g_ntohs (cthdr.maxres_size);
1464 /* Determine the type of server the request/response is for */
1465 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
1466 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1467 col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1469 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1473 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1474 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1477 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1480 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1483 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1487 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1488 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1489 pinfo->ptype, pinfo->oxid,
1490 pinfo->rxid, NO_PORT2);
1491 if (!conversation) {
1492 conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1493 pinfo->ptype, pinfo->oxid,
1494 pinfo->rxid, NO_PORT2);
1497 ckey.conv_idx = conversation->index;
1499 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash,
1502 /* Since we never free the memory used by an exchange, this maybe a
1503 * case of another request using the same exchange as a previous
1506 cdata->opcode = opcode;
1509 req_key = se_alloc (sizeof(fcdns_conv_key_t));
1510 req_key->conv_idx = conversation->index;
1512 cdata = se_alloc (sizeof(fcdns_conv_data_t));
1513 cdata->opcode = opcode;
1515 g_hash_table_insert (fcdns_req_hash, req_key, cdata);
1517 if (check_col (pinfo->cinfo, COL_INFO)) {
1518 col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1523 /* Opcode is ACC or RJT */
1524 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1525 pinfo->ptype, pinfo->oxid,
1526 pinfo->rxid, NO_PORT2);
1528 if (!conversation) {
1529 if (tree && (opcode == FCCT_MSG_ACC)) {
1530 if (check_col (pinfo->cinfo, COL_INFO)) {
1531 col_add_str (pinfo->cinfo, COL_INFO,
1532 val_to_str (opcode, fc_dns_opcode_val,
1535 /* No record of what this accept is for. Can't decode */
1536 proto_tree_add_text (fcdns_tree, tvb, 0, -1,
1537 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1542 ckey.conv_idx = conversation->index;
1544 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash, &ckey);
1546 if (cdata != NULL) {
1547 if (opcode == FCCT_MSG_ACC) {
1548 opcode = cdata->opcode;
1551 failed_opcode = cdata->opcode;
1554 if (check_col (pinfo->cinfo, COL_INFO)) {
1555 if (opcode != FCCT_MSG_RJT) {
1556 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1557 val_to_str (opcode, fc_dns_opcode_val,
1561 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1562 val_to_str (failed_opcode,
1569 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1570 /* No record of what this accept is for. Can't decode */
1571 proto_tree_add_text (fcdns_tree, tvb, 0, -1,
1572 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1580 proto_tree_add_item (fcdns_tree, hf_fcdns_opcode, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1581 proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10,
1587 dissect_fcdns_rjt (tvb, fcdns_tree);
1590 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1593 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1596 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1599 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1602 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1605 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1608 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1611 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1614 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1617 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1620 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1623 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1626 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1629 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1632 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1635 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1638 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1641 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1644 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1647 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1650 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1653 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1656 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1659 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1662 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1665 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1668 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1671 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1674 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1677 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1680 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1683 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1686 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1689 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1692 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1695 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1698 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1701 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1704 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1707 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1710 dissect_fcdns_gezm (tvb, fcdns_tree, isreq);
1713 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1716 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1719 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1726 /* Register the protocol with Wireshark */
1729 proto_register_fcdns (void)
1732 static hf_register_info hf[] = {
1734 { &hf_fcdns_gssubtype,
1735 {"GS_Subtype", "fcdns.gssubtype", FT_UINT8, BASE_HEX,
1736 VALS (fc_dns_subtype_val), 0x0, NULL, HFILL}},
1739 {"Opcode", "fcdns.opcode", FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val),
1741 { &hf_fcdns_req_portid,
1742 {"Port Identifier", "fcdns.req.portid", FT_STRING, BASE_NONE, NULL, 0x0,
1744 { &hf_fcdns_rply_pname,
1745 {"Port Name", "fcdns.rply.pname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1747 { &hf_fcdns_rply_nname,
1748 {"Node Name", "fcdns.rply.nname", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1750 { &hf_fcdns_rply_snamelen,
1751 {"Symbolic Node Name Length", "fcdns.rply.snamelen", FT_UINT8, BASE_DEC,
1752 NULL, 0x0, NULL, HFILL}},
1753 { &hf_fcdns_rply_sname,
1754 {"Symbolic Node Name", "fcdns.rply.sname", FT_STRING, BASE_NONE, NULL,
1756 { &hf_fcdns_rply_ptype,
1757 {"Port Type", "fcdns.rply.porttype", FT_UINT8, BASE_HEX,
1758 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL}},
1759 { &hf_fcdns_rply_fpname,
1760 {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING, BASE_NONE, NULL,
1762 { &hf_fcdns_req_pname,
1763 {"Port Name", "fcdns.req.portname", FT_STRING, BASE_NONE, NULL, 0x0,
1765 { &hf_fcdns_rply_portid,
1766 {"Port Identifier", "fcdns.rply.portid", FT_STRING, BASE_NONE, NULL,
1768 { &hf_fcdns_req_nname,
1769 {"Node Name", "fcdns.req.nname", FT_STRING, BASE_NONE, NULL, 0x0,
1771 { &hf_fcdns_req_domainscope,
1772 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8, BASE_HEX, NULL,
1774 { &hf_fcdns_req_areascope,
1775 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8, BASE_HEX, NULL,
1777 { &hf_fcdns_req_fc4type,
1778 {"FC-4 Type", "fcdns.req.fc4type", FT_UINT8, BASE_HEX,
1779 VALS (fc_fc4_val), 0x0, NULL, HFILL}},
1780 { &hf_fcdns_req_ptype,
1781 {"Port Type", "fcdns.req.porttype", FT_UINT8, BASE_HEX,
1782 VALS (fc_dns_port_type_val), 0x0, NULL, HFILL}},
1784 {"IP Address", "fcdns.req.ip", FT_IPv6, BASE_NONE, NULL, 0x0,
1786 { &hf_fcdns_rply_fc4type,
1787 {"FC-4 Descriptor Type", "fcdns.rply.fc4type", FT_UINT8, BASE_HEX,
1788 VALS (fc_fc4_val), 0x0, NULL, HFILL}},
1789 { &hf_fcdns_req_snamelen,
1790 {"Symbolic Name Length", "fcdns.req.snamelen", FT_UINT8, BASE_DEC,
1791 NULL, 0x0, NULL, HFILL}},
1792 { &hf_fcdns_req_sname,
1793 {"Symbolic Port Name", "fcdns.req.sname", FT_STRING, BASE_NONE, NULL,
1795 { &hf_fcdns_rply_spnamelen,
1796 {"Symbolic Port Name Length", "fcdns.rply.spnamelen", FT_UINT8,
1797 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1798 {&hf_fcdns_rply_spname,
1799 {"Symbolic Port Name", "fcdns.rply.spname", FT_STRING, BASE_NONE, NULL,
1801 { &hf_fcdns_rply_ipa,
1802 {"Initial Process Associator", "fcdns.rply.ipa", FT_BYTES, BASE_NONE,
1803 NULL, 0x0, NULL, HFILL}},
1804 { &hf_fcdns_rply_ipnode,
1805 {"Node IP Address", "fcdns.rply.ipnode", FT_IPv6, BASE_NONE, NULL,
1807 { &hf_fcdns_rply_ipport,
1808 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6, BASE_NONE, NULL,
1810 { &hf_fcdns_rply_fc4desclen,
1811 {"FC-4 Descriptor Length", "fcdns.rply.fc4desclen", FT_UINT8,
1812 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1813 { &hf_fcdns_rply_fc4desc,
1814 {"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_BYTES, BASE_NONE, NULL,
1816 { &hf_fcdns_rply_hrdaddr,
1817 {"Hard Address", "fcdns.rply.hrdaddr", FT_STRING, BASE_NONE, NULL,
1819 { &hf_fcdns_req_fdesclen,
1820 {"FC-4 Descriptor Length", "fcdns.req.fc4desclen", FT_UINT8, BASE_DEC,
1821 NULL, 0x0, NULL, HFILL}},
1822 { &hf_fcdns_req_fdesc,
1823 {"FC-4 Descriptor", "fcdns.req.fc4desc", FT_STRING, BASE_NONE, NULL,
1825 { &hf_fcdns_req_spnamelen,
1826 {"Symbolic Port Name Length", "fcdns.req.spnamelen", FT_UINT8,
1827 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1828 { &hf_fcdns_req_spname,
1829 {"Symbolic Port Name", "fcdns.req.spname", FT_STRING, BASE_NONE, NULL,
1832 {"Reason Code", "fcdns.rply.reason", FT_UINT8, BASE_HEX,
1833 VALS (fc_ct_rjt_code_vals), 0x0, NULL, HFILL}},
1834 { &hf_fcdns_rjtdetail,
1835 {"Reason Code Explanantion", "fcdns.rply.reasondet", FT_UINT8,
1836 BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0, NULL, HFILL}},
1838 {"Vendor Unique Reject Code", "fcdns.rply.vendor", FT_UINT8,
1839 BASE_HEX, NULL, 0x0, NULL, HFILL}},
1840 { &hf_fcdns_zone_mbrtype,
1841 {"Zone Member Type", "fcdns.zone.mbrtype", FT_UINT8, BASE_HEX,
1842 VALS (fc_swils_zonembr_type_val), 0x0, NULL, HFILL}},
1843 { &hf_fcdns_zone_mbrid,
1844 {"Member Identifier", "fcdns.zone.mbrid", FT_STRING, BASE_NONE, NULL,
1847 {"Zone Name", "fcdns.zonename", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1850 {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_NONE, NULL, 0x0,
1852 { &hf_fcdns_sw2_objfmt,
1853 {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8, BASE_HEX,
1854 NULL, 0x0, NULL, HFILL}},
1855 { &hf_fcdns_num_fc4desc,
1856 {"Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
1857 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1858 { &hf_fcdns_rply_ownerid,
1859 {"Owner Id", "fcdns.rply.ownerid", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1861 { &hf_fcdns_maxres_size,
1862 {"Maximum/Residual Size", "fcdns.maxres_size", FT_UINT16, BASE_DEC,
1863 NULL, 0x0, NULL, HFILL}},
1864 { &hf_fcdns_reply_cos,
1865 {"Class of Service Supported", "fcdns.reply.cos", FT_UINT32, BASE_HEX,
1866 NULL, 0x0, NULL, HFILL}},
1867 { &hf_fcdns_req_cos,
1868 {"Requested Class of Service", "fcdns.req.class", FT_UINT32, BASE_HEX,
1869 NULL, 0x0, NULL, HFILL}},
1871 {"F", "fcdns.cos.f", FT_BOOLEAN, 32,
1872 TFS(&tfs_fcdns_cos_f), 0x01, NULL, HFILL}},
1874 {"1", "fcdns.cos.1", FT_BOOLEAN, 32,
1875 TFS(&tfs_fcdns_cos_1), 0x02, NULL, HFILL}},
1877 {"2", "fcdns.cos.2", FT_BOOLEAN, 32,
1878 TFS(&tfs_fcdns_cos_2), 0x04, NULL, HFILL}},
1880 {"3", "fcdns.cos.3", FT_BOOLEAN, 32,
1881 TFS(&tfs_fcdns_cos_3), 0x08, NULL, HFILL}},
1883 {"4", "fcdns.cos.4", FT_BOOLEAN, 32,
1884 TFS(&tfs_fcdns_cos_4), 0x10, NULL, HFILL}},
1886 {"6", "fcdns.cos.6", FT_BOOLEAN, 32,
1887 TFS(&tfs_fcdns_cos_6), 0x40, NULL, HFILL}},
1888 { &hf_fcdns_fc4type_llcsnap,
1889 {"LLC/SNAP", "fcdns.fc4types.llc_snap", FT_BOOLEAN, 32,
1890 TFS(&tfs_fcdns_fc4type_llcsnap), 0x0010, NULL, HFILL}},
1891 { &hf_fcdns_fc4type_ip,
1892 {"IP", "fcdns.fc4types.ip", FT_BOOLEAN, 32,
1893 TFS(&tfs_fcdns_fc4type_ip), 0x0020, NULL, HFILL}},
1894 { &hf_fcdns_fc4type_fcp,
1895 {"FCP", "fcdns.fc4types.fcp", FT_BOOLEAN, 32,
1896 TFS(&tfs_fcdns_fc4type_fcp), 0x0100, NULL, HFILL}},
1897 { &hf_fcdns_fc4type_swils,
1898 {"SW_ILS", "fcdns.fc4types.swils", FT_BOOLEAN, 32,
1899 TFS(&tfs_fcdns_fc4type_swils), 0x0010, NULL, HFILL}},
1900 { &hf_fcdns_fc4type_snmp,
1901 {"SNMP", "fcdns.fc4types.snmp", FT_BOOLEAN, 32,
1902 TFS(&tfs_fcdns_fc4type_snmp), 0x0004, NULL, HFILL}},
1903 { &hf_fcdns_fc4type_gs3,
1904 {"GS3", "fcdns.fc4types.gs3", FT_BOOLEAN, 32,
1905 TFS(&tfs_fcdns_fc4type_gs3), 0x0001, NULL, HFILL}},
1906 { &hf_fcdns_fc4type_vi,
1907 {"VI", "fcdns.fc4types.vi", FT_BOOLEAN, 32,
1908 TFS(&tfs_fcdns_fc4type_vi), 0x0001, NULL, HFILL}},
1909 { &hf_fcdns_rply_gft,
1910 {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_NONE, BASE_NONE,
1911 NULL, 0x0, NULL, HFILL}},
1912 { &hf_fcdns_req_fc4types,
1913 {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE, BASE_NONE,
1914 NULL, 0x0, NULL, HFILL}},
1915 { &hf_fcdns_fc4type,
1916 {"FC-4 Types", "fcdns.req.fc4type", FT_NONE, BASE_NONE,
1917 NULL, 0x0, NULL, HFILL}},
1918 { &hf_fcdns_fc4features,
1919 {"FC-4 Feature Bits", "fcdns.fc4features", FT_UINT8,
1920 BASE_HEX, NULL, 0x0, NULL, HFILL}},
1921 { &hf_fcdns_fc4features_i,
1922 {"I", "fcdns.fc4features.i", FT_BOOLEAN, 8,
1923 TFS(&tfs_fcdns_fc4features_i), 0x02, NULL, HFILL}},
1924 { &hf_fcdns_fc4features_t,
1925 {"T", "fcdns.fc4features.t", FT_BOOLEAN, 8,
1926 TFS(&tfs_fcdns_fc4features_t), 0x01, NULL, HFILL}},
1929 static gint *ett[] = {
1936 proto_fcdns = proto_register_protocol("Fibre Channel Name Server",
1939 proto_register_field_array(proto_fcdns, hf, array_length(hf));
1940 proto_register_subtree_array(ett, array_length(ett));
1941 register_init_routine (&fcdns_init_protocol);
1945 proto_reg_handoff_fcdns (void)
1947 dissector_handle_t dns_handle;
1949 dns_handle = create_dissector_handle (dissect_fcdns, proto_fcdns);
1950 dissector_add_uint("fcct.server", FCCT_GSRVR_DNS, dns_handle);
1951 dissector_add_uint("fcct.server", FCCT_GSRVR_UNS, dns_handle);
1953 data_handle = find_dissector ("data");