2 * Routines for FC distributed Name Server (dNS)
3 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
5 * $Id: packet-fcdns.c,v 1.2 2003/10/06 20:46:50 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
12 * is a dissector file; if you just copied this from README.developer,
13 * don't bother with the "Copied from" - you don't even need to put
14 * in a "Copied from" if you copied an existing dissector, especially
15 * if the bulk of the code in the new dissector is your code)
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 #ifdef HAVE_SYS_TYPES_H
41 # include <sys/types.h>
44 #ifdef HAVE_NETINET_IN_H
45 # include <netinet/in.h>
50 #ifdef NEED_SNPRINTF_H
51 # include "snprintf.h"
54 #include <epan/packet.h>
55 #include <epan/conversation.h>
57 #include "packet-fc.h"
58 #include "packet-fcct.h"
59 #include "packet-fcdns.h"
60 #include "packet-fcswils.h"
62 /* Initialize the protocol and registered fields */
63 static int proto_fcdns = -1;
64 static int hf_fcdns_gssubtype = -1;
65 static int hf_fcdns_opcode = -1;
66 static int hf_fcdns_reason = -1;
67 static int hf_fcdns_vendor = -1;
68 static int hf_fcdns_req_portid = -1;
69 static int hf_fcdns_rply_pname = -1;
70 static int hf_fcdns_rply_nname = -1;
71 static int hf_fcdns_rply_cos = -1;
72 static int hf_fcdns_rply_gft = -1;
73 static int hf_fcdns_rply_snamelen = -1;
74 static int hf_fcdns_rply_sname = -1;
75 static int hf_fcdns_rply_ptype = -1;
76 static int hf_fcdns_rply_fpname = -1;
77 static int hf_fcdns_fc4type = -1;
78 static int hf_fcdns_rply_fc4type = -1;
79 static int hf_fcdns_rply_fc4desc = -1;
80 static int hf_fcdns_rply_fc4feat = -1;
81 static int hf_fcdns_req_pname = -1;
82 static int hf_fcdns_rply_portid = -1;
83 static int hf_fcdns_req_nname = -1;
84 static int hf_fcdns_req_domainscope = -1;
85 static int hf_fcdns_req_areascope = -1;
86 static int hf_fcdns_req_fc4type = -1;
87 static int hf_fcdns_req_ptype = -1;
88 static int hf_fcdns_req_fc4feature = -1;
89 static int hf_fcdns_req_cos = -1;
90 static int hf_fcdns_req_fc4types = -1;
91 static int hf_fcdns_req_snamelen = -1;
92 static int hf_fcdns_req_sname = -1;
93 static int hf_fcdns_rply_spnamelen = -1;
94 static int hf_fcdns_rply_spname = -1;
95 static int hf_fcdns_req_spnamelen = -1;
96 static int hf_fcdns_req_spname = -1;
97 static int hf_fcdns_rply_ipa = -1;
98 static int hf_fcdns_rply_ipnode = -1;
99 static int hf_fcdns_rply_ipport = -1;
100 static int hf_fcdns_rply_fc4desclen = -1;
101 static int hf_fcdns_rply_hrdaddr = -1;
102 static int hf_fcdns_req_fdesclen = -1;
103 static int hf_fcdns_req_fdesc = -1;
104 static int hf_fcdns_req_ip = -1;
105 static int hf_fcdns_rjtdetail = -1;
106 static int hf_fcdns_zone_mbrtype = -1;
107 static int hf_fcdns_zone_mbrid = -1;
108 static int hf_fcdns_zonenm = -1;
109 static int hf_fcdns_portip = -1;
110 static int hf_fcdns_sw2_objfmt = -1;
111 static int hf_fcdns_num_fc4desc = -1;
112 static int hf_fcdns_rply_ownerid = -1;
113 static int hf_fcdns_maxres_size = -1;
116 /* Initialize the subtree pointers */
117 static gint ett_fcdns = -1;
119 typedef struct _fcdns_conv_key {
123 typedef struct _fcdns_conv_data {
127 GHashTable *fcdns_req_hash = NULL;
128 GMemChunk *fcdns_req_keys = NULL;
129 GMemChunk *fcdns_req_vals = NULL;
130 guint32 fcdns_init_count = 25;
132 static dissector_handle_t data_handle;
138 fcdns_equal(gconstpointer v, gconstpointer w)
140 fcdns_conv_key_t *v1 = (fcdns_conv_key_t *)v;
141 fcdns_conv_key_t *v2 = (fcdns_conv_key_t *)w;
143 return (v1->conv_idx == v2->conv_idx);
147 fcdns_hash (gconstpointer v)
149 fcdns_conv_key_t *key = (fcdns_conv_key_t *)v;
158 * Protocol initialization
161 fcdns_init_protocol(void)
164 g_mem_chunk_destroy (fcdns_req_keys);
166 g_mem_chunk_destroy (fcdns_req_vals);
168 g_hash_table_destroy(fcdns_req_hash);
170 fcdns_req_hash = g_hash_table_new(fcdns_hash, fcdns_equal);
171 fcdns_req_keys = g_mem_chunk_new ("fcdns_req_keys",
172 sizeof(fcdns_conv_key_t),
174 sizeof(fcdns_conv_key_t),
176 fcdns_req_vals = g_mem_chunk_new ("fcdns_req_vals",
177 sizeof(fcdns_conv_data_t),
179 sizeof(fcdns_conv_data_t),
184 fccos_to_str (tvbuff_t *tvb, int offset, gchar *cosstr)
192 cos = tvb_get_ntohl (tvb, offset);
197 strcpy (cosstr, "F, ");
202 strcpy (&cosstr[stroff], "1, ");
207 strcpy (&cosstr[stroff], "2, ");
212 strcpy (&cosstr[stroff], "3, ");
217 strcpy (&cosstr[stroff], "4, ");
222 strcpy (&cosstr[stroff], "6");
228 /* The feature routines just decode FCP's FC-4 features field */
230 fc4feature_to_str (guint8 fc4feature, guint8 fc4type, gchar *str)
236 if (fc4type == FC_TYPE_SCSI) {
237 if (fc4feature & 0x1) {
242 if (fc4feature & 0x2) {
243 strcpy (&str[stroff], "I");
247 sprintf (str, "0x%x", fc4feature);
253 fc4ftrs_to_str (tvbuff_t *tvb, int offset, gchar *str)
263 fc4feature = tvb_get_guint8 (tvb, offset+7);
265 if (fc4feature & 0x1) {
270 if (fc4feature & 0x2) {
271 strcpy (&str[stroff], "I");
277 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
278 /* Max len of str to be allocated by caller is 40 */
280 fc4type_to_str (tvbuff_t *tvb, int offset, gchar *str)
291 fc4tword = tvb_get_ntohl (tvb, offset);
293 if (fc4tword & 0x10) {
294 strcpy (str, "LLC/SNAP, ");
298 if (fc4tword & 0x20) {
299 strcpy (&str[stroff], "IP, ");
303 if (fc4tword & 0x0100) {
304 strcpy (&str[stroff], "FCP, ");
308 fc4tword = tvb_get_ntohl (tvb, offset+4);
310 if (fc4tword & 0x1) {
311 strcpy (&str[stroff], "GS3, ");
315 if (fc4tword & 0x4) {
316 strcpy (&str[stroff], "SNMP, ");
320 if (fc4tword & 0x10) {
321 strcpy (&str[stroff], "SW_ILS, ");
325 fc4tword = tvb_get_ntohl (tvb, offset+8);
326 if (fc4tword & 0x1) {
327 strcpy (&str[stroff], "VI, ");
333 /* Code to actually dissect the packets */
335 /* A bunch of get routines have a similar req packet format. The first few
336 * routines deal with this decoding. All assume that tree is valid */
338 dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
341 proto_tree_add_string (tree, hf_fcdns_req_portid, tvb, offset, 3,
342 fc_to_str (tvb_get_ptr (tvb, offset, 3)));
347 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
349 int offset = 16; /* past the fc_ct header */
355 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
358 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb, offset,
360 proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb,
362 fc_to_str (tvb_get_ptr (tvb, offset+1, 3)));
363 proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb,
365 fcwwn_to_str (tvb_get_ptr (tvb, offset+4,
367 len = tvb_get_guint8 (tvb, offset+12);
368 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb,
370 if (!tvb_offset_exists (tvb, 29+len))
374 proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
378 if (tvb_offset_exists (tvb, 292)) {
379 proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb,
381 fcwwn_to_str (tvb_get_ptr (tvb,
385 if (tvb_offset_exists (tvb, 548)) {
386 len = tvb_get_guint8 (tvb, offset+276);
387 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
390 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
394 if (tvb_offset_exists (tvb, 556)) {
395 proto_tree_add_item (req_tree, hf_fcdns_rply_ipa, tvb,
398 if (tvb_offset_exists (tvb, 572)) {
399 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb,
402 if (tvb_offset_exists (tvb, 576)) {
403 proto_tree_add_string (req_tree, hf_fcdns_rply_cos, tvb, offset+556,
405 fccos_to_str (tvb, offset+556, str));
407 if (tvb_offset_exists (tvb, 608)) {
408 proto_tree_add_string (req_tree, hf_fcdns_rply_gft, tvb, offset+560,
410 fc4type_to_str (tvb, offset+560, str));
412 if (tvb_offset_exists (tvb, 624)) {
413 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb,
416 if (tvb_offset_exists (tvb, 632)) {
417 proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb,
419 fcwwn_to_str (tvb_get_ptr (tvb, offset+608,
422 if (tvb_offset_exists (tvb, 635)) {
423 proto_tree_add_string (req_tree, hf_fcdns_rply_hrdaddr, tvb,
425 fc_to_str (tvb_get_ptr (tvb, offset+617,
433 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
435 int offset = 16; /* past the fc_ct header */
439 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
442 proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset,
443 8, fcwwn_to_str (tvb_get_ptr (tvb, offset,
450 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
452 int offset = 16; /* past the fc_ct header */
456 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
459 proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb,
461 fcwwn_to_str (tvb_get_ptr (tvb, offset,
468 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
470 int offset = 16; /* past the fc_ct header */
475 dissect_fcdns_req_portid (tvb, req_tree, offset);
478 proto_tree_add_string (req_tree, hf_fcdns_rply_cos, tvb,
480 fccos_to_str (tvb, offset, cosstr));
486 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
488 int offset = 16; /* past the fc_ct header */
493 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
496 proto_tree_add_string (req_tree, hf_fcdns_rply_gft, tvb,
498 fc4type_to_str (tvb, offset, fc4str));
504 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
506 int offset = 16; /* past the fc_ct header */
511 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
514 len = tvb_get_guint8 (tvb, offset);
515 proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen,
517 proto_tree_add_string (req_tree, hf_fcdns_rply_spname, tvb,
519 tvb_get_ptr (tvb, offset+1, len));
525 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
527 int offset = 16; /* past the fc_ct header */
531 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
534 proto_tree_add_item (req_tree, hf_fcdns_rply_ptype, tvb,
541 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
543 int offset = 16; /* past the fc_ct header */
547 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
550 proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb,
552 fcwwn_to_str (tvb_get_ptr (tvb, offset,
560 dissect_fcdns_gfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
562 int offset = 16; /* past the fc_ct header */
564 int tot_len, desclen;
568 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
569 proto_tree_add_string (req_tree, hf_fcdns_fc4type, tvb, offset+4,
571 fc4type_to_str (tvb, offset+4, fc4str));
574 tot_len = tvb_length (tvb) - offset; /* excluding CT header */
575 while (tot_len > 0) {
576 /* The count of the descriptors is not returned and so we have
577 * to track the display by the length field */
578 desclen = tvb_get_guint8 (tvb, offset);
579 proto_tree_add_item (req_tree, hf_fcdns_rply_fc4desc, tvb,
581 tot_len -= 255; /* descriptors are aligned to 255 bytes */
589 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
591 int offset = 16; /* past the fc_ct header */
596 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
599 proto_tree_add_string (req_tree, hf_fcdns_rply_fc4feat, tvb,
601 fc4ftrs_to_str (tvb, offset, fc4fstr));
607 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
609 int offset = 16; /* past the fc_ct header */
613 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
615 fcwwn_to_str (tvb_get_ptr (tvb, offset,
619 proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb,
621 fc_to_str (tvb_get_ptr (tvb, offset+1,
628 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
630 int offset = 16; /* past the fc_ct header */
634 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
636 fcwwn_to_str (tvb_get_ptr (tvb, offset,
640 proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset,
647 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
649 int offset = 16; /* past the fc_ct header */
654 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
656 fcwwn_to_str (tvb_get_ptr (tvb, offset,
661 islast = tvb_get_guint8 (tvb, offset);
662 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
664 fc_to_str (tvb_get_ptr (tvb, offset+1,
667 } while (!(islast & 0x80));
673 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
675 int offset = 16; /* past the fc_ct header */
679 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
681 fcwwn_to_str (tvb_get_ptr (tvb, offset,
685 proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset,
692 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
694 int offset = 16; /* past the fc_ct header */
699 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
701 fcwwn_to_str (tvb_get_ptr (tvb, offset,
706 islast = tvb_get_guint8 (tvb, offset);
707 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
709 fc_to_str (tvb_get_ptr (tvb, offset+1,
711 proto_tree_add_string (req_tree, hf_fcdns_rply_pname,
713 fcwwn_to_str (tvb_get_ptr (tvb,
717 } while (!(islast & 0x80));
723 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
725 int offset = 16; /* past the fc_ct header */
730 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
732 fcwwn_to_str (tvb_get_ptr (tvb, offset,
736 len = tvb_get_guint8 (tvb, offset);
737 proto_tree_add_item (req_tree, hf_fcdns_rply_snamelen, tvb,
739 proto_tree_add_item (req_tree, hf_fcdns_rply_sname, tvb,
746 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
748 int offset = 16; /* past the fc_ct header */
753 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
754 tvb, offset+1, 1, 0);
755 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
756 tvb, offset+2, 1, 0);
757 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
758 tvb, offset+3, 1, 0);
762 islast = tvb_get_guint8 (tvb, offset);
763 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
765 fc_to_str (tvb_get_ptr (tvb, offset+1,
768 } while (!(islast & 0x80));
774 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
776 int offset = 16; /* past the fc_ct header */
781 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
782 tvb, offset+1, 1, 0);
783 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
784 tvb, offset+2, 1, 0);
785 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
786 tvb, offset+3, 1, 0);
790 islast = tvb_get_guint8 (tvb, offset);
791 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
793 fc_to_str (tvb_get_ptr (tvb, offset+1,
795 proto_tree_add_string (req_tree, hf_fcdns_rply_pname,
797 fcwwn_to_str (tvb_get_ptr (tvb, offset+8,
800 } while (!(islast & 0x80));
806 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
808 int offset = 16; /* past the fc_ct header */
813 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
814 tvb, offset+1, 1, 0);
815 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
816 tvb, offset+2, 1, 0);
817 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type,
818 tvb, offset+3, 1, 0);
822 islast = tvb_get_guint8 (tvb, offset);
823 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
825 fc_to_str (tvb_get_ptr (tvb, offset+1,
827 proto_tree_add_string (req_tree, hf_fcdns_rply_nname,
829 fcwwn_to_str (tvb_get_ptr (tvb, offset+8,
832 } while (!(islast & 0x80));
838 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
840 int offset = 16; /* past the fc_ct header */
845 proto_tree_add_item (req_tree, hf_fcdns_req_ptype,
847 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope,
848 tvb, offset+1, 1, 0);
849 proto_tree_add_item (req_tree, hf_fcdns_req_areascope,
850 tvb, offset+2, 1, 0);
854 islast = tvb_get_guint8 (tvb, offset);
855 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
857 fc_to_str (tvb_get_ptr (tvb, offset+1,
860 } while (!(islast & 0x80));
866 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
868 int offset = 16; /* past the fc_ct header */
873 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset,
878 islast = tvb_get_guint8 (tvb, offset);
879 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
881 fc_to_str (tvb_get_ptr (tvb, offset+1,
884 } while (!(islast & 0x80));
890 dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
892 int offset = 16; /* past the fc_ct header */
898 proto_tree_add_item (req_tree, hf_fcdns_req_domainscope, tvb,
900 proto_tree_add_item (req_tree, hf_fcdns_req_areascope, tvb,
902 proto_tree_add_string (req_tree, hf_fcdns_req_fc4feature, tvb,
904 fc4feature_to_str (tvb_get_guint8 (tvb, offset+6),
905 tvb_get_guint8 (tvb, offset+7),
907 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type, tvb,
912 islast = tvb_get_guint8 (tvb, offset);
913 proto_tree_add_string (req_tree, hf_fcdns_rply_portid,
915 fc_to_str (tvb_get_ptr (tvb, offset+1,
918 } while (!(islast & 0x80));
924 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
926 int offset = 16; /* past the fc_ct header */
930 proto_tree_add_string (req_tree, hf_fcdns_req_portid,
932 fc_to_str (tvb_get_ptr (tvb, offset+1,
934 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb,
936 fcwwn_to_str (tvb_get_ptr (tvb, offset+4,
943 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
945 int offset = 16; /* past the fc_ct header */
949 proto_tree_add_string (req_tree, hf_fcdns_req_portid,
951 fc_to_str (tvb_get_ptr (tvb, offset+1,
953 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb,
955 fcwwn_to_str (tvb_get_ptr (tvb, offset+4,
962 dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
964 int offset = 16; /* past the fc_ct header */
967 if (req_tree && isreq) {
968 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
970 fc_to_str (tvb_get_ptr (tvb, offset+1,
972 proto_tree_add_string (req_tree, hf_fcdns_req_cos, tvb,
974 fccos_to_str (tvb, offset+4, cos));
979 dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
981 int offset = 16; /* past the fc_ct header */
983 if (req_tree && isreq) {
984 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
986 fc_to_str (tvb_get_ptr (tvb, offset+1,
988 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb,
994 dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
996 int offset = 16; /* past the fc_ct header */
999 if (req_tree && isreq) {
1000 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1002 fc_to_str (tvb_get_ptr (tvb, offset+1,
1004 proto_tree_add_string (req_tree, hf_fcdns_req_fc4types, tvb,
1006 fc4type_to_str (tvb, offset+4, fc4str));
1011 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1013 int offset = 16; /* past the fc_ct header */
1016 if (req_tree && isreq) {
1017 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1019 fc_to_str (tvb_get_ptr (tvb, offset+1,
1021 proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb,
1023 len = tvb_get_guint8 (tvb, offset+4);
1025 proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5,
1031 dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1033 int offset = 16; /* past the fc_ct header */
1035 if (req_tree && isreq) {
1036 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1038 fc_to_str (tvb_get_ptr (tvb, offset+1,
1040 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb,
1046 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1048 int offset = 16; /* past the fc_ct header */
1052 if (req_tree && isreq) {
1053 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb,
1055 fc_to_str (tvb_get_ptr (tvb, offset+1,
1057 proto_tree_add_string (req_tree, hf_fcdns_req_fc4types, tvb,
1059 fc4type_to_str (tvb, offset+4, fc4str));
1061 len = tvb_length (tvb) - offset - 36;
1065 dlen = tvb_get_guint8 (tvb, offset);
1066 proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset,
1068 proto_tree_add_item (req_tree, hf_fcdns_req_fdesc, tvb, offset+1,
1077 dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1079 int offset = 16; /* past the fc_ct header */
1082 if (req_tree && isreq) {
1083 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3,
1084 fc_to_str (tvb_get_ptr (tvb, offset+1, 3)));
1085 proto_tree_add_string (req_tree, hf_fcdns_req_fc4feature, tvb,
1087 fc4feature_to_str (tvb_get_guint8 (tvb,
1089 tvb_get_guint8 (tvb,
1092 proto_tree_add_item (req_tree, hf_fcdns_req_fc4type, tvb, offset+7,
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 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
1105 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, 0);
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 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
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,
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 fc_to_str (tvb_get_ptr (tvb, offset+1, 3)));
1139 zonenm_to_str (tvbuff_t *tvb, gint offset)
1141 int len = tvb_get_guint8 (tvb, offset);
1142 return ((gchar *)tvb_get_ptr (tvb, offset+4, len));
1146 dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
1148 int mbrlen = 4 + tvb_get_guint8 (tvb, offset+3);
1150 proto_tree_add_item (zmbr_tree, hf_fcdns_zone_mbrtype, tvb,
1152 proto_tree_add_text (zmbr_tree, tvb, offset+2, 1, "Flags: 0x%x",
1153 tvb_get_guint8 (tvb, offset+2));
1154 proto_tree_add_text (zmbr_tree, tvb, offset+3, 1,
1155 "Identifier Length: %d",
1156 tvb_get_guint8 (tvb, offset+3));
1157 switch (tvb_get_guint8 (tvb, offset)) {
1158 case FC_SWILS_ZONEMBR_WWN:
1159 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1161 fcwwn_to_str (tvb_get_ptr (tvb,
1165 case FC_SWILS_ZONEMBR_DP:
1166 proto_tree_add_string_format (zmbr_tree,
1167 hf_fcdns_zone_mbrid,
1168 tvb, offset+4, 4, " ",
1173 case FC_SWILS_ZONEMBR_FCID:
1174 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1176 fc_to_str (tvb_get_ptr (tvb,
1180 case FC_SWILS_ZONEMBR_ALIAS:
1181 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1183 tvb_get_guint8 (tvb, offset+3),
1184 zonenm_to_str (tvb, offset+4));
1187 proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb,
1189 "Unknown member type format");
1195 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1201 numrec = tvb_get_ntohl (tvb, offset);
1204 proto_tree_add_text (tree, tvb, offset, 4, "Number of Entries: %d",
1208 for (i = 0; i < numrec; i++) {
1209 objfmt = tvb_get_guint8 (tvb, offset);
1211 proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, 0);
1212 proto_tree_add_string (tree, hf_fcdns_rply_ownerid, tvb, offset+1,
1213 3, fc_to_str (tvb_get_ptr (tvb, offset+1,
1215 proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
1217 proto_tree_add_string (tree, hf_fcdns_rply_portid, tvb, offset+5, 3,
1218 fc_to_str (tvb_get_ptr (tvb, offset+5, 3)));
1219 proto_tree_add_string (tree, hf_fcdns_rply_pname, tvb, offset+8, 8,
1220 fcwwn_to_str (tvb_get_ptr (tvb, offset+8,
1223 if (!(objfmt & 0x1)) {
1224 len = tvb_get_guint8 (tvb, offset);
1225 proto_tree_add_item (tree, hf_fcdns_rply_spnamelen, tvb,
1227 proto_tree_add_item (tree, hf_fcdns_rply_spname, tvb,
1231 proto_tree_add_string (tree, hf_fcdns_rply_nname, tvb, offset, 8,
1232 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
1234 if (!(objfmt & 0x1)) {
1235 len = tvb_get_guint8 (tvb, offset);
1236 proto_tree_add_item (tree, hf_fcdns_rply_snamelen, tvb,
1238 proto_tree_add_item (tree, hf_fcdns_rply_sname, tvb,
1242 proto_tree_add_item (tree, hf_fcdns_rply_ipa, tvb, offset, 8, 0);
1243 proto_tree_add_item (tree, hf_fcdns_rply_ipnode, tvb, offset+8, 16,
1245 proto_tree_add_string (tree, hf_fcdns_rply_cos, tvb, offset+24, 4,
1246 fccos_to_str (tvb, offset+24, str));
1247 proto_tree_add_string (tree, hf_fcdns_rply_gft, tvb, offset+28,
1249 fc4type_to_str (tvb, offset+28, str));
1250 proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60,
1252 proto_tree_add_string (tree, hf_fcdns_rply_fpname, tvb, offset+76,
1253 8, fcwwn_to_str (tvb_get_ptr (tvb,
1256 proto_tree_add_string (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85,
1257 3, fc_to_str (tvb_get_ptr (tvb, offset+85,
1261 proto_tree_add_string (tree, hf_fcdns_rply_fc4feat, tvb,
1263 fc4ftrs_to_str (tvb, offset, str));
1264 if (tvb_get_guint8 (tvb, offset+129)) {
1265 proto_tree_add_item (tree, hf_fcdns_rply_fc4type, tvb,
1267 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1269 len = tvb_get_guint8 (tvb, offset+132);
1270 proto_tree_add_item (tree, hf_fcdns_rply_fc4desclen, tvb,
1272 proto_tree_add_item (tree, hf_fcdns_rply_fc4desc, tvb,
1273 offset+133, len, 0);
1276 proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb,
1279 offset += 388; /* FC4 desc is 260 bytes, maybe padded */
1286 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1288 int offset = 16; /* past the fc_ct header */
1292 proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1,
1293 3, fc_to_str (tvb_get_ptr (tvb, offset+1,
1298 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1303 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1305 int offset = 16; /* past the fc_ct header */
1308 proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset, 8,
1309 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
1313 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1318 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1320 int offset = 16; /* past the fc_ct header */
1324 proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8,
1325 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
1329 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1334 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1336 int offset = 16; /* past the fc_ct header */
1340 proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset, 16, 0);
1344 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1349 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1351 int offset = 16; /* past the fc_ct header */
1356 proto_tree_add_string (req_tree, hf_fcdns_fc4type, tvb, offset, 32,
1357 fc4type_to_str (tvb, offset, str));
1361 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1366 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1368 int offset = 16; /* past the fc_ct header */
1372 proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+3,
1377 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1382 dissect_fcdns_gezm (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1384 int offset = 16; /* past the fc_ct header */
1388 dissect_fcdns_zone_mbr (tvb, req_tree, offset);
1392 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1397 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1399 int offset = 16; /* past the fc_ct header */
1404 strlen = tvb_get_guint8 (tvb, offset);
1405 proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d",
1407 proto_tree_add_string (req_tree, hf_fcdns_zonenm, tvb, offset+3,
1408 strlen, tvb_get_ptr (tvb, offset+3, strlen));
1412 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1417 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1419 int offset = 16; /* past the fc_ct header */
1423 proto_tree_add_item (req_tree, hf_fcdns_portip, tvb, offset, 4, 0);
1427 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1432 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1434 int offset = 16; /* past the fc_ct header */
1439 proto_tree_add_string (req_tree, hf_fcdns_req_fc4feature, tvb, offset,
1440 128, fc4ftrs_to_str (tvb, offset, str));
1444 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1449 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1454 proto_tree_add_item (req_tree, hf_fcdns_reason, tvb, offset+13, 1, 0);
1455 proto_tree_add_item (req_tree, hf_fcdns_rjtdetail, tvb, offset+14, 1,
1457 proto_tree_add_item (req_tree, hf_fcdns_vendor, tvb, offset+15, 1, 0);
1462 dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1464 /* Set up structures needed to add the protocol subtree and manage it */
1465 proto_item *ti = NULL;
1466 proto_tree *fcdns_tree = NULL;
1471 fc_ct_preamble cthdr;
1472 conversation_t *conversation;
1473 fcdns_conv_data_t *cdata;
1474 fcdns_conv_key_t ckey, *req_key;
1476 tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
1477 cthdr.revision = tvb_get_guint8 (tvb, offset);
1478 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
1479 cthdr.opcode = ntohs (cthdr.opcode);
1480 opcode = cthdr.opcode;
1481 cthdr.maxres_size = ntohs (cthdr.maxres_size);
1483 /* Determine the type of server the request/response is for */
1484 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
1485 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC)
1486 col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS");
1488 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1492 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1493 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1494 tvb_reported_length (tvb),
1496 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1499 ti = proto_tree_add_protocol_format (tree, proto_fcdns, tvb, 0,
1500 tvb_reported_length (tvb),
1502 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1506 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
1507 conversation = find_conversation (&pinfo->src, &pinfo->dst,
1508 pinfo->ptype, pinfo->oxid,
1509 pinfo->rxid, NO_PORT2);
1510 if (!conversation) {
1511 conversation = conversation_new (&pinfo->src, &pinfo->dst,
1512 pinfo->ptype, pinfo->oxid,
1513 pinfo->rxid, NO_PORT2);
1516 ckey.conv_idx = conversation->index;
1518 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash,
1521 /* Since we never free the memory used by an exchange, this maybe a
1522 * case of another request using the same exchange as a previous
1525 cdata->opcode = opcode;
1528 req_key = g_mem_chunk_alloc (fcdns_req_keys);
1529 req_key->conv_idx = conversation->index;
1531 cdata = g_mem_chunk_alloc (fcdns_req_vals);
1532 cdata->opcode = opcode;
1534 g_hash_table_insert (fcdns_req_hash, req_key, cdata);
1536 if (check_col (pinfo->cinfo, COL_INFO)) {
1537 col_set_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val,
1542 /* Opcode is ACC or RJT */
1543 conversation = find_conversation (&pinfo->src, &pinfo->dst,
1544 pinfo->ptype, pinfo->oxid,
1545 pinfo->rxid, NO_PORT2);
1547 if (!conversation) {
1548 if (tree && (opcode == FCCT_MSG_ACC)) {
1549 if (check_col (pinfo->cinfo, COL_INFO)) {
1550 col_set_str (pinfo->cinfo, COL_INFO,
1551 val_to_str (opcode, fc_dns_opcode_val,
1554 /* No record of what this accept is for. Can't decode */
1555 proto_tree_add_text (fcdns_tree, tvb, 0, tvb_length (tvb),
1556 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1561 ckey.conv_idx = conversation->index;
1563 cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash, &ckey);
1565 if (cdata != NULL) {
1566 if (opcode == FCCT_MSG_ACC) {
1567 opcode = cdata->opcode;
1570 failed_opcode = cdata->opcode;
1573 if (check_col (pinfo->cinfo, COL_INFO)) {
1574 if (opcode != FCCT_MSG_RJT) {
1575 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1576 val_to_str (opcode, fc_dns_opcode_val,
1580 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1581 val_to_str (failed_opcode,
1588 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
1589 /* No record of what this accept is for. Can't decode */
1590 proto_tree_add_text (fcdns_tree, tvb, 0, tvb_length (tvb),
1591 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1599 proto_tree_add_item (fcdns_tree, hf_fcdns_opcode, tvb, offset+8, 2, 0);
1600 proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10,
1606 dissect_fcdns_rjt (tvb, fcdns_tree);
1609 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1612 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1615 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1618 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1621 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1624 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1627 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1630 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1633 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1636 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1639 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1642 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1645 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1648 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1651 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1654 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1657 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1660 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1663 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1666 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1669 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1672 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1675 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1678 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1681 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1684 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1687 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1690 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1693 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1696 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1699 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1702 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1705 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1708 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1711 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1714 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1717 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1720 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1723 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1726 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1729 dissect_fcdns_gezm (tvb, fcdns_tree, isreq);
1732 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1735 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1738 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1745 /* Register the protocol with Ethereal */
1747 /* this format is required because a script is used to build the C function
1748 that calls all the protocol registration.
1752 proto_register_fcdns (void)
1755 /* Setup list of header fields See Section 1.6.1 for details*/
1756 static hf_register_info hf[] = {
1757 { &hf_fcdns_gssubtype,
1758 {"GS_Subtype", "fcdns.gssubtype", FT_UINT8, BASE_HEX,
1759 VALS (fc_dns_subtype_val), 0x0, "", HFILL}},
1761 {"Opcode", "fcdns.opcode", FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val),
1763 { &hf_fcdns_req_portid,
1764 {"Port Identifier", "fcdns.req.portid", FT_STRING, BASE_HEX, NULL, 0x0,
1766 { &hf_fcdns_rply_pname,
1767 {"Port Name", "fcdns.rply.pname", FT_STRING, BASE_HEX, NULL, 0x0, "",
1769 { &hf_fcdns_rply_nname,
1770 {"Node Name", "fcdns.rply.nname", FT_STRING, BASE_HEX, NULL, 0x0, "",
1772 { &hf_fcdns_rply_cos,
1773 {"Class of Service Supported", "fcdns.rply.cos", FT_STRING, BASE_HEX,
1774 NULL, 0x0, "", HFILL}},
1775 { &hf_fcdns_rply_gft,
1776 {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_STRING, BASE_HEX,
1777 NULL, 0x0, "", HFILL}},
1778 { &hf_fcdns_rply_snamelen,
1779 {"Symbolic Node Name Length", "fcdns.rply.snamelen", FT_UINT8, BASE_DEC,
1780 NULL, 0x0, "", HFILL}},
1781 { &hf_fcdns_rply_sname,
1782 {"Symbolic Node Name", "fcdns.rply.sname", FT_STRING, BASE_HEX, NULL,
1784 { &hf_fcdns_rply_ptype,
1785 {"Port Type", "fcdns.rply.porttype", FT_UINT8, BASE_HEX,
1786 VALS (fc_dns_port_type_val), 0x0, "", HFILL}},
1787 { &hf_fcdns_rply_fpname,
1788 {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING, BASE_HEX, NULL,
1790 { &hf_fcdns_fc4type,
1791 {"FC-4 Type", "fcdns.req.fc4type", FT_STRING, BASE_HEX, NULL, 0x0,
1793 { &hf_fcdns_rply_fc4feat,
1794 {"FC-4 Features", "fcdns.rply.fc4features", FT_STRING, BASE_HEX,
1795 NULL, 0x0, "", HFILL}},
1796 { &hf_fcdns_req_pname,
1797 {"Port Name", "fcdns.req.portname", FT_STRING, BASE_HEX, NULL, 0x0,
1799 { &hf_fcdns_rply_portid,
1800 {"Port Identifier", "fcdns.rply.portid", FT_STRING, BASE_HEX, NULL,
1802 { &hf_fcdns_req_nname,
1803 {"Node Name", "fcdns.req.nname", FT_STRING, BASE_HEX, NULL, 0x0,
1805 { &hf_fcdns_req_domainscope,
1806 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8, BASE_HEX, NULL,
1808 { &hf_fcdns_req_areascope,
1809 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8, BASE_HEX, NULL,
1811 { &hf_fcdns_req_fc4type,
1812 {"FC-4 Type", "fcdns.req.fc4type", FT_UINT8, BASE_HEX,
1813 VALS (fc_fc4_val), 0x0, "", HFILL}},
1814 { &hf_fcdns_req_ptype,
1815 {"Port Type", "fcdns.req.porttype", FT_UINT8, BASE_HEX,
1816 VALS (fc_dns_port_type_val), 0x0, "", HFILL}},
1818 {"IP Address", "fcdns.req.ip", FT_IPv6, BASE_DEC, NULL, 0x0,
1820 { &hf_fcdns_req_fc4feature,
1821 {"FC-4 Feature Bits", "fcdns.req.fc4feature", FT_STRING,
1822 BASE_HEX, NULL, 0x0, "", HFILL}},
1823 { &hf_fcdns_req_cos,
1824 {"Class of Service Supported", "fcdns.req.class", FT_STRING,
1825 BASE_HEX, NULL, 0x0, "", HFILL}},
1826 { &hf_fcdns_req_fc4types,
1827 {"FC-4 TYPEs Supported", "fcdns.req.fc4types", FT_STRING,
1828 BASE_HEX, NULL, 0x0, "", HFILL}},
1829 { &hf_fcdns_rply_fc4type,
1830 {"FC-4 Descriptor Type", "fcdns.rply.fc4type", FT_UINT8, BASE_HEX,
1831 VALS (fc_fc4_val), 0x0, "", HFILL}},
1832 { &hf_fcdns_req_snamelen,
1833 {"Symbolic Name Length", "fcdns.req.snamelen", FT_UINT8, BASE_DEC,
1834 NULL, 0x0, "", HFILL}},
1835 { &hf_fcdns_req_sname,
1836 {"Symbolic Port Name", "fcdns.req.sname", FT_STRING, BASE_HEX, NULL,
1838 { &hf_fcdns_rply_spnamelen,
1839 {"Symbolic Port Name Length", "fcdns.rply.spnamelen", FT_UINT8,
1840 BASE_DEC, NULL, 0x0, "", HFILL}},
1841 {&hf_fcdns_rply_spname,
1842 {"Symbolic Port Name", "fcdns.rply.spname", FT_STRING, BASE_HEX, NULL,
1844 { &hf_fcdns_rply_ipa,
1845 {"Initial Process Associator", "fcdns.rply.ipa", FT_BYTES, BASE_HEX,
1846 NULL, 0x0, "", HFILL}},
1847 { &hf_fcdns_rply_ipnode,
1848 {"Node IP Address", "fcdns.rply.ipnode", FT_IPv6, BASE_DEC, NULL,
1850 { &hf_fcdns_rply_ipport,
1851 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6, BASE_DEC, NULL,
1853 { &hf_fcdns_rply_fc4desclen,
1854 {"FC-4 Descriptor Length", "fcdns.rply.fc4desclen", FT_UINT8,
1855 BASE_DEC, NULL, 0x0, "", HFILL}},
1856 { &hf_fcdns_rply_fc4desc,
1857 {"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_BYTES, BASE_HEX, NULL,
1859 { &hf_fcdns_rply_hrdaddr,
1860 {"Hard Address", "fcdns.rply.hrdaddr", FT_STRING, BASE_HEX, NULL,
1862 { &hf_fcdns_req_fdesclen,
1863 {"FC-4 Descriptor Length", "fcdns.req.fc4desclen", FT_UINT8, BASE_DEC,
1864 NULL, 0x0, "", HFILL}},
1865 { &hf_fcdns_req_fdesc,
1866 {"FC-4 Descriptor", "fcdns.req.fc4desc", FT_STRING, BASE_HEX, NULL,
1868 { &hf_fcdns_req_spnamelen,
1869 {"Symbolic Port Name Length", "fcdns.req.spnamelen", FT_UINT8,
1870 BASE_DEC, NULL, 0x0, "", HFILL}},
1871 { &hf_fcdns_req_spname,
1872 {"Symbolic Port Name", "fcdns.req.spname", FT_STRING, BASE_HEX, NULL,
1875 {"Reason Code", "fcdns.rply.reason", FT_UINT8, BASE_HEX,
1876 VALS (fc_ct_rjt_code_vals), 0x0, "", HFILL}},
1877 { &hf_fcdns_rjtdetail,
1878 {"Reason Code Explanantion", "fcdns.rply.reasondet", FT_UINT8,
1879 BASE_HEX, VALS (fc_dns_rjt_det_code_val), 0x0, "", HFILL}},
1881 {"Vendor Unique Reject Code", "fcdns.rply.vendor", FT_UINT8,
1882 BASE_HEX, NULL, 0x0, "", HFILL}},
1883 { &hf_fcdns_zone_mbrtype,
1884 {"Zone Member Type", "fcdns.zone.mbrtype", FT_UINT8, BASE_HEX,
1885 VALS (fc_swils_zonembr_type_val), 0x0, "", HFILL}},
1886 { &hf_fcdns_zone_mbrid,
1887 {"Member Identifier", "swils.zone.mbrid", FT_STRING, BASE_HEX, NULL,
1890 {"Zone Name", "fcdns.zonename", FT_STRING, BASE_HEX, NULL, 0x0, "",
1893 {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_DEC, NULL, 0x0,
1895 { &hf_fcdns_sw2_objfmt,
1896 {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8, BASE_HEX,
1897 NULL, 0x0, "", HFILL}},
1898 { &hf_fcdns_num_fc4desc,
1899 {"Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
1900 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
1901 { &hf_fcdns_rply_ownerid,
1902 {"Owner Id", "fcdns.rply.ownerid", FT_STRING, BASE_HEX, NULL, 0x0, "",
1904 { &hf_fcdns_maxres_size,
1905 {"Maximum/Residual Size", "fcdns.maxres_size", FT_UINT16, BASE_DEC,
1906 NULL, 0x0, "", HFILL}},
1909 static gint *ett[] = {
1913 /* Register the protocol name and description */
1914 proto_fcdns = proto_register_protocol("Fibre Channel Name Server",
1915 "FC-dNS", "FC-dNS");
1917 /* Required function calls to register the header fields and subtrees used */
1918 proto_register_field_array(proto_fcdns, hf, array_length(hf));
1919 proto_register_subtree_array(ett, array_length(ett));
1920 register_init_routine (&fcdns_init_protocol);
1923 /* If this dissector uses sub-dissector registration add a registration routine.
1924 This format is required because a script is used to find these routines and
1925 create the code that calls these routines.
1928 proto_reg_handoff_fcdns (void)
1930 dissector_handle_t dns_handle;
1932 dns_handle = create_dissector_handle (dissect_fcdns, proto_fcdns);
1933 dissector_add("fcct.server", FCCT_GSRVR_DNS, dns_handle);
1934 dissector_add("fcct.server", FCCT_GSRVR_UNS, dns_handle);
1936 data_handle = find_dissector ("data");