2 * Routines for FC Fabric Configuration Server
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifdef HAVE_SYS_TYPES_H
35 # include <sys/types.h>
38 #ifdef HAVE_NETINET_IN_H
39 # include <netinet/in.h>
44 #include <epan/packet.h>
45 #include <epan/emem.h>
46 #include <epan/conversation.h>
47 #include <epan/etypes.h>
48 #include "packet-scsi.h"
49 #include "packet-fc.h"
50 #include "packet-fcct.h"
51 #include "packet-fcfcs.h"
54 * See the FC-GS3 specification.
57 /* Initialize the protocol and registered fields */
58 static int proto_fcfcs = -1;
59 static int hf_fcs_opcode = -1;
60 static int hf_fcs_iename = -1;
61 static int hf_fcs_ietype = -1;
62 static int hf_fcs_iedomainid = -1;
63 static int hf_fcs_mgmtid = -1;
64 static int hf_fcs_fabricname = -1;
65 static int hf_fcs_mgmtaddr = -1;
66 static int hf_fcs_lname = -1;
67 static int hf_fcs_vendorname = -1;
68 static int hf_fcs_modelname = -1;
69 static int hf_fcs_portname = -1;
70 static int hf_fcs_portmodtype = -1;
71 static int hf_fcs_porttxtype = -1;
72 static int hf_fcs_porttype = -1;
73 static int hf_fcs_physportnum = -1;
74 static int hf_fcs_portflags = -1;
75 static int hf_fcs_portstate = -1;
76 static int hf_fcs_platformname = -1;
77 static int hf_fcs_platformnname = -1;
78 static int hf_fcs_platformtype = -1;
79 static int hf_fcs_platformaddr = -1;
80 static int hf_fcs_reason = -1;
81 static int hf_fcs_rjtdetail = -1;
82 static int hf_fcs_vendor = -1;
83 static int hf_fcs_numcap = -1;
84 static int hf_fcs_mgmt_subtype = -1;
85 static int hf_fcs_unsmask = -1;
86 static int hf_fcs_vnd_capmask = -1;
87 static int hf_fcs_fcsmask = -1;
88 static int hf_fcs_maxres_size = -1;
89 static int hf_fcs_releasecode = -1;
92 /* Initialize the subtree pointers */
93 static gint ett_fcfcs = -1;
95 typedef struct _fcfcs_conv_key {
99 typedef struct _fcfcs_conv_data {
103 GHashTable *fcfcs_req_hash = NULL;
105 static dissector_handle_t data_handle;
111 fcfcs_equal(gconstpointer v, gconstpointer w)
113 const fcfcs_conv_key_t *v1 = v;
114 const fcfcs_conv_key_t *v2 = w;
116 return (v1->conv_idx == v2->conv_idx);
120 fcfcs_hash (gconstpointer v)
122 const fcfcs_conv_key_t *key = v;
131 * Protocol initialization
134 fcfcs_init_protocol(void)
137 g_hash_table_destroy (fcfcs_req_hash);
139 fcfcs_req_hash = g_hash_table_new(fcfcs_hash, fcfcs_equal);
142 /* Code to actually dissect the packets */
144 dissect_fcfcs_giel (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
146 int offset = 16; /* past the ct header */
149 if (!isreq && tree) {
150 numelem = tvb_get_ntohl (tvb, offset);
152 proto_tree_add_text (tree, tvb, offset, 4, "Number of IE entries: 0x%d",
155 for (i = 0; i < numelem; i++) {
156 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
157 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
158 proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+11, 1, 0);
165 dissect_fcfcs_giet (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
167 int offset = 16; /* past the fcct header */
171 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
172 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
175 proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+3, 1, 0);
181 dissect_fcfcs_gdid (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
183 int offset = 16; /* past the fcct header */
187 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
188 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
191 proto_tree_add_item (tree, hf_fcs_iedomainid, tvb, offset+1, 1, 0);
197 dissect_fcfcs_gmid (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
199 int offset = 16; /* past the fcct header */
203 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
204 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
207 proto_tree_add_string (tree, hf_fcs_mgmtid, tvb, offset+1, 3,
208 fc_to_str (tvb_get_ptr (tvb, offset+1, 3)));
214 dissect_fcfcs_gfn (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
216 int offset = 16; /* past the fcct header */
220 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
221 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
224 proto_tree_add_string (tree, hf_fcs_fabricname, tvb, offset, 8,
225 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
231 dissect_fcfcs_gieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
233 int offset = 16; /* past the fcct header */
237 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
238 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
241 proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d",
242 tvb_get_guint8 (tvb, offset));
243 proto_tree_add_item (tree, hf_fcs_lname, tvb, offset+1,
244 tvb_get_guint8 (tvb, offset), 0);
250 dissect_fcfcs_gmal (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
252 int offset = 16; /* past the fcct header */
257 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
258 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
261 numelem = tvb_get_ntohl (tvb, offset);
262 proto_tree_add_text (tree, tvb, offset, 4,
263 "Number of Mgmt. Addresses: 0x%d", numelem);
266 for (i = 0; i < numelem; i++) {
267 proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d",
268 tvb_get_guint8 (tvb, offset));
269 proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset+1,
270 tvb_get_guint8 (tvb, offset), 0);
278 dissect_fcfcs_gieil (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
280 int offset = 16; /* past the fcct header */
281 int len, tot_len, prevlen;
285 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
286 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
289 tot_len = tvb_get_guint8 (tvb, offset+3);
290 proto_tree_add_text (tree, tvb, offset+3, 1, "List Length: %d",
294 len = tvb_strsize(tvb, offset+4);
295 proto_tree_add_item (tree, hf_fcs_vendorname, tvb, offset+4,
299 len = tvb_strsize(tvb, offset+4+prevlen);
300 proto_tree_add_item (tree, hf_fcs_modelname, tvb, offset+4+prevlen,
304 len = tvb_strsize(tvb, offset+4+prevlen);
305 proto_tree_add_item (tree, hf_fcs_releasecode, tvb,
306 offset+4+prevlen, len, FALSE);
308 offset += (4+prevlen);
309 while (tot_len > prevlen) {
310 len = tvb_strsize(tvb, offset);
311 proto_tree_add_text (tree, tvb, offset, len,
312 "Vendor-specific Information: %s",
313 tvb_format_text(tvb, offset, len-1));
322 dissect_fcfcs_gpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
324 int offset = 16; /* past the fcct header */
329 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
330 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
333 numelem = tvb_get_ntohl (tvb, offset);
334 proto_tree_add_text (tree, tvb, offset, 4,
335 "Number of Port Entries: %d",
339 for (i = 0; i < numelem; i++) {
340 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
341 fcwwn_to_str (tvb_get_ptr (tvb, offset,
343 proto_tree_add_item (tree, hf_fcs_portmodtype, tvb, offset+9,
345 proto_tree_add_item (tree, hf_fcs_porttxtype, tvb, offset+10,
347 proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+11,
356 dissect_fcfcs_gpt (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
358 int offset = 16; /* past the fcct header */
362 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
363 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
366 proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, 0);
372 dissect_fcfcs_gppn (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
374 int offset = 16; /* past the fcct header */
378 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
379 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
382 proto_tree_add_item (tree, hf_fcs_physportnum, tvb, offset, 4, 0);
388 dissect_fcfcs_gapnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
390 int offset = 16; /* past the fcct header */
395 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
396 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
399 numelem = tvb_get_ntohl (tvb, offset);
400 proto_tree_add_text (tree, tvb, offset, 4,
401 "Number of Attached Port Entries: %d",
404 for (i = 0; i < numelem; i++) {
405 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
406 fcwwn_to_str (tvb_get_ptr (tvb, offset,
408 proto_tree_add_item (tree, hf_fcs_portflags, tvb, offset+10,
410 proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+11,
419 dissect_fcfcs_gps (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
421 int offset = 16; /* past the fcct header */
425 proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8,
426 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
429 proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, 0);
430 proto_tree_add_item (tree, hf_fcs_portstate, tvb, offset+7, 1, 0);
436 dissect_fcfcs_gplnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
438 int offset = 16; /* past the fcct header */
443 len = tvb_get_guint8 (tvb, offset);
444 proto_tree_add_text (tree, tvb, offset, 1,
445 "Platform Name Length: %d", len);
446 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
450 numelem = tvb_get_ntohl (tvb, offset);
451 proto_tree_add_text (tree, tvb, offset, 4,
452 "Number of Platform Node Name Entries: %d",
455 for (i = 0; i < numelem; i++) {
456 proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset,
458 fcwwn_to_str (tvb_get_ptr (tvb, offset,
467 dissect_fcfcs_gplt (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
469 int offset = 16; /* past the fcct header */
474 len = tvb_get_guint8 (tvb, offset);
475 proto_tree_add_text (tree, tvb, offset, 1,
476 "Platform Name Length: %d", len);
477 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
481 proto_tree_add_item (tree, hf_fcs_platformtype, tvb, offset+3,
488 dissect_fcfcs_gplml (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
490 int offset = 16; /* past the fcct header */
495 len = tvb_get_guint8 (tvb, offset);
496 proto_tree_add_text (tree, tvb, offset, 1,
497 "Platform Name Length: %d", len);
498 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
502 numelem = tvb_get_ntohl (tvb, offset);
503 proto_tree_add_text (tree, tvb, offset, 4,
504 "Number of Mgmt. Address Entries: %d",
507 for (i = 0; i < numelem; i++) {
508 len = tvb_get_guint8 (tvb, offset);
509 proto_tree_add_text (tree, tvb, offset, 1,
510 "Mgmt Address Length: %d",
512 proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset+1,
521 dissect_fcfcs_gnpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
523 int offset = 16; /* past the fcct header */
528 proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, 8,
529 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
532 len = tvb_get_guint8 (tvb, offset);
533 proto_tree_add_text (tree, tvb, offset, 1,
534 "Platform Name Length: %d", len);
535 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
542 dissect_fcfcs_gpnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
544 int offset = 16; /* past the fcct header */
549 numelem = tvb_get_ntohl (tvb, offset);
551 proto_tree_add_text (tree, tvb, offset, 4,
552 "Number of Platform Name Entries: %d",
555 for (i = 0; i < numelem; i++) {
556 len = tvb_get_guint8 (tvb, offset);
557 proto_tree_add_text (tree, tvb, offset, 1,
558 "Platform Name Length: %d",
560 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
569 dissect_fcfcs_rieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
571 int offset = 16; /* past the fc_ct header */
576 proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8,
577 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
578 len = tvb_get_guint8 (tvb, offset+8);
579 proto_tree_add_text (tree, tvb, offset+8, 1,
580 "Logical Name Length: %d", len);
581 proto_tree_add_item (tree, hf_fcs_lname, tvb, offset+9, len, 0);
587 dissect_fcfcs_rpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
589 int offset = 16; /* past the fc_ct header */
594 len = tvb_get_guint8 (tvb, offset);
595 proto_tree_add_text (tree, tvb, offset, 1,
596 "Platform Name Length: %d", len);
597 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
599 proto_tree_add_item (tree, hf_fcs_platformtype, tvb, offset+256, 4,
601 numelem = tvb_get_ntohl (tvb, offset+260);
602 proto_tree_add_text (tree, tvb, offset+260, 4,
603 "Number of Mgmt. Addr Entries: %d", numelem);
605 for (i = 0; i < numelem; i++) {
606 len = tvb_get_guint8 (tvb, offset);
607 proto_tree_add_text (tree, tvb, offset, 1,
608 "Mgmt. Addr Length: %d", len);
609 proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset+1,
614 numelem = tvb_get_ntohl (tvb, offset);
615 proto_tree_add_text (tree, tvb, offset, 4,
616 "Number of Platform Node Name Entries: %d",
619 for (i = 0; i < numelem; i++) {
620 proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset,
622 fcwwn_to_str (tvb_get_ptr (tvb, offset,
631 dissect_fcfcs_rpln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
633 int offset = 16; /* past the fc_ct header */
638 len = tvb_get_guint8 (tvb, offset);
639 proto_tree_add_text (tree, tvb, offset, 1,
640 "Platform Name Length: %d", len);
641 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
643 proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset+256,
645 fcwwn_to_str (tvb_get_ptr (tvb, offset+256,
652 dissect_fcfcs_rplt (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
654 int offset = 16; /* past the fc_ct header */
659 len = tvb_get_guint8 (tvb, offset);
660 proto_tree_add_text (tree, tvb, offset, 1,
661 "Platform Name Length: %d", len);
662 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
664 proto_tree_add_item (tree, hf_fcs_platformtype, tvb, offset+256,
671 dissect_fcfcs_rplm (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
673 int offset = 16; /* past the fc_ct header */
678 len = tvb_get_guint8 (tvb, offset);
679 proto_tree_add_text (tree, tvb, offset, 1,
680 "Platform Name Length: %d", len);
681 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
683 len = tvb_get_guint8 (tvb, offset+256);
684 proto_tree_add_text (tree, tvb, offset+256, 1,
685 "Platform Mgmt. Address Length: %d", len);
686 proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset+257,
693 dissect_fcfcs_dpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
695 int offset = 16; /* past the fc_ct header */
700 len = tvb_get_guint8 (tvb, offset);
701 proto_tree_add_text (tree, tvb, offset, 1,
702 "Platform Name Length: %d", len);
703 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
710 dissect_fcfcs_dpln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
712 int offset = 16; /* past the fc_ct header */
716 proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, 8,
717 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
723 dissect_fcfcs_dplml (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
725 int offset = 16; /* past the fc_ct header */
730 len = tvb_get_guint8 (tvb, offset);
731 proto_tree_add_text (tree, tvb, offset, 1,
732 "Platform Name Length: %d", len);
733 proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1,
740 dissect_fcfcs_gcap (tvbuff_t *tvb, proto_tree *tree, gboolean isreq)
742 int offset = 16; /* past the fc_ct header */
748 numrec = tvb_get_ntohl (tvb, offset);
749 proto_tree_add_item (tree, hf_fcs_numcap, tvb, offset, 4, 0);
752 for (i = 0; i < numrec; i++) {
753 subtype = tvb_get_guint8 (tvb, offset);
754 proto_tree_add_uint (tree, hf_fcs_mgmt_subtype, tvb, offset,
757 proto_tree_add_item (tree, hf_fcs_vnd_capmask, tvb, offset+1,
759 if (subtype == FCCT_GSSUBTYPE_FCS) {
760 proto_tree_add_item (tree, hf_fcs_fcsmask, tvb, offset+4,
763 else if (subtype == FCCT_GSSUBTYPE_UNS) {
764 proto_tree_add_item (tree, hf_fcs_unsmask, tvb, offset+4,
774 dissect_fcfcs_rjt (tvbuff_t *tvb, proto_tree *tree)
779 proto_tree_add_item (tree, hf_fcs_reason, tvb, offset+13, 1, 0);
780 proto_tree_add_item (tree, hf_fcs_rjtdetail, tvb, offset+14, 1,
782 proto_tree_add_item (tree, hf_fcs_vendor, tvb, offset+15, 1, 0);
788 dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
791 /* Set up structures needed to add the protocol subtree and manage it */
794 proto_tree *fcfcs_tree = NULL;
795 fc_ct_preamble cthdr;
797 conversation_t *conversation;
798 fcfcs_conv_data_t *cdata;
799 fcfcs_conv_key_t ckey, *req_key;
803 /* Make entries in Protocol column and Info column on summary display */
804 if (check_col(pinfo->cinfo, COL_PROTOCOL))
805 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC-FCS");
808 ti = proto_tree_add_protocol_format (tree, proto_fcfcs, tvb, 0,
809 tvb_reported_length (tvb),
811 fcfcs_tree = proto_item_add_subtree (ti, ett_fcfcs);
814 tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
815 cthdr.revision = tvb_get_guint8 (tvb, offset);
816 cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1);
817 cthdr.opcode = ntohs (cthdr.opcode);
818 opcode = tvb_get_ntohs (tvb, offset+8);
819 cthdr.maxres_size = ntohs (cthdr.maxres_size);
821 if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
822 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
823 pinfo->ptype, pinfo->oxid,
824 pinfo->rxid, NO_PORT2);
826 conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
827 pinfo->ptype, pinfo->oxid,
828 pinfo->rxid, NO_PORT2);
831 ckey.conv_idx = conversation->index;
833 cdata = (fcfcs_conv_data_t *)g_hash_table_lookup (fcfcs_req_hash,
836 /* Since we never free the memory used by an exchange, this maybe a
837 * case of another request using the same exchange as a previous
840 cdata->opcode = opcode;
843 req_key = se_alloc (sizeof(fcfcs_conv_key_t));
844 req_key->conv_idx = conversation->index;
846 cdata = se_alloc (sizeof(fcfcs_conv_data_t));
847 cdata->opcode = opcode;
849 g_hash_table_insert (fcfcs_req_hash, req_key, cdata);
851 if (check_col (pinfo->cinfo, COL_INFO)) {
852 col_set_str (pinfo->cinfo, COL_INFO,
853 val_to_str (opcode, fc_fcs_opcode_abbrev_val, "0x%x"));
857 /* Opcode is ACC or RJT */
858 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
859 pinfo->ptype, pinfo->oxid,
860 pinfo->rxid, NO_PORT2);
863 if (tree && (opcode == FCCT_MSG_ACC)) {
864 if (check_col (pinfo->cinfo, COL_INFO)) {
865 col_set_str (pinfo->cinfo, COL_INFO,
866 val_to_str (opcode, fc_fcs_opcode_abbrev_val,
869 /* No record of what this accept is for. Can't decode */
870 proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb),
871 "No record of Exchg. Unable to decode MSG_ACC/RJT");
876 ckey.conv_idx = conversation->index;
878 cdata = (fcfcs_conv_data_t *)g_hash_table_lookup (fcfcs_req_hash,
882 if (opcode == FCCT_MSG_ACC)
883 opcode = cdata->opcode;
885 failed_opcode = cdata->opcode;
888 if (check_col (pinfo->cinfo, COL_INFO)) {
889 if (opcode != FCCT_MSG_RJT) {
890 col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_ACC (%s)",
891 val_to_str (opcode, fc_fcs_opcode_abbrev_val,
895 col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_RJT (%s)",
896 val_to_str (failed_opcode,
897 fc_fcs_opcode_abbrev_val,
903 if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) {
904 /* No record of what this accept is for. Can't decode */
905 proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb),
906 "No record of Exchg. Unable to decode MSG_ACC/RJT");
915 proto_tree_add_item (fcfcs_tree, hf_fcs_opcode, tvb, offset+8, 2, 0);
916 proto_tree_add_item (fcfcs_tree, hf_fcs_maxres_size, tvb, offset+10,
922 dissect_fcfcs_rjt (tvb, fcfcs_tree);
925 dissect_fcfcs_giel (tvb, fcfcs_tree, isreq);
928 dissect_fcfcs_giet (tvb, fcfcs_tree, isreq);
931 dissect_fcfcs_gdid (tvb, fcfcs_tree, isreq);
934 dissect_fcfcs_gmid (tvb, fcfcs_tree, isreq);
937 dissect_fcfcs_gfn (tvb, fcfcs_tree, isreq);
940 dissect_fcfcs_gieln (tvb, fcfcs_tree, isreq);
943 dissect_fcfcs_gmal (tvb, fcfcs_tree, isreq);
946 dissect_fcfcs_gieil (tvb, fcfcs_tree, isreq);
949 dissect_fcfcs_gpl (tvb, fcfcs_tree, isreq);
952 dissect_fcfcs_gpt (tvb, fcfcs_tree, isreq);
955 dissect_fcfcs_gppn (tvb, fcfcs_tree, isreq);
958 dissect_fcfcs_gapnl (tvb, fcfcs_tree, isreq);
961 dissect_fcfcs_gps (tvb, fcfcs_tree, isreq);
964 dissect_fcfcs_gplnl (tvb, fcfcs_tree, isreq);
967 dissect_fcfcs_gplt (tvb, fcfcs_tree, isreq);
970 dissect_fcfcs_gplml (tvb, fcfcs_tree, isreq);
973 dissect_fcfcs_gnpl (tvb, fcfcs_tree, isreq);
976 dissect_fcfcs_gpnl (tvb, fcfcs_tree, isreq);
979 dissect_fcfcs_rieln (tvb, fcfcs_tree, isreq);
982 dissect_fcfcs_rpl (tvb, fcfcs_tree, isreq);
985 dissect_fcfcs_rpln (tvb, fcfcs_tree, isreq);
988 dissect_fcfcs_rplt (tvb, fcfcs_tree, isreq);
991 dissect_fcfcs_rplm (tvb, fcfcs_tree, isreq);
994 dissect_fcfcs_dpl (tvb, fcfcs_tree, isreq);
997 dissect_fcfcs_dpln (tvb, fcfcs_tree, isreq);
1000 dissect_fcfcs_dplml (tvb, fcfcs_tree, isreq);
1003 dissect_fcfcs_gcap (tvb, fcfcs_tree, isreq);
1006 call_dissector (data_handle, tvb, pinfo, fcfcs_tree);
1011 /* Register the protocol with Wireshark */
1013 /* this format is require because a script is used to build the C function
1014 that calls all the protocol registration.
1018 proto_register_fcfcs (void)
1021 /* Setup list of header fields See Section 1.6.1 for details*/
1022 static hf_register_info hf[] = {
1024 {"Opcode", "fcs.opcode", FT_UINT16, BASE_HEX,
1025 VALS (fc_fcs_opcode_val), 0x0, "", HFILL}},
1027 {"Interconnect Element Name", "fcs.ie.name", FT_STRING, BASE_HEX,
1028 NULL, 0x0, "", HFILL}},
1030 {"Interconnect Element Type", "fcs.ie.type", FT_UINT8, BASE_HEX,
1031 VALS (fc_fcs_ietype_val), 0x0, "", HFILL}},
1032 { &hf_fcs_iedomainid,
1033 {"Interconnect Element Domain ID", "fcs.ie.domainid", FT_UINT8,
1034 BASE_HEX, NULL, 0x0, "", HFILL}},
1036 {"Interconnect Element Mgmt. ID", "fcs.ie.mgmtid", FT_STRING,
1037 BASE_HEX, NULL, 0x0, "", HFILL}},
1038 { &hf_fcs_fabricname,
1039 {"Interconnect Element Fabric Name", "fcs.ie.fname", FT_STRING,
1040 BASE_HEX, NULL, 0x0, "", HFILL}},
1042 {"Interconnect Element Mgmt. Address", "fcs.ie.mgmtaddr", FT_STRING,
1043 BASE_HEX, NULL, 0x0, "", HFILL}},
1045 {"Interconnect Element Logical Name", "fcs.ie.logname", FT_STRING,
1046 BASE_HEX, NULL, 0x0, "", HFILL}},
1047 { &hf_fcs_vendorname,
1048 {"Vendor Name", "fcs.vendorname", FT_STRING, BASE_HEX, NULL, 0x0, "",
1050 { &hf_fcs_modelname,
1051 {"Model Name/Number", "fcs.modelname", FT_STRING, BASE_HEX, NULL,
1054 {"Port Name", "fcs.port.name", FT_STRING, BASE_HEX, NULL, 0x0, "",
1056 { &hf_fcs_portmodtype,
1057 {"Port Module Type", "fcs.port.moduletype", FT_UINT8, BASE_HEX,
1058 VALS (fc_fcs_port_modtype_val), 0x0, "", HFILL}},
1059 { &hf_fcs_porttxtype,
1060 {"Port TX Type", "fcs.port.txtype", FT_UINT8, BASE_HEX,
1061 VALS (fc_fcs_port_txtype_val), 0x0, "", HFILL}},
1063 {"Port Type", "fcs.port.type", FT_UINT8, BASE_HEX,
1064 VALS (fc_fcs_port_type_val), 0x0, "", HFILL}},
1065 { &hf_fcs_physportnum,
1066 {"Physical Port Number", "fcs.port.physportnum", FT_BYTES, BASE_HEX,
1067 NULL, 0x0, "", HFILL}},
1068 { &hf_fcs_portflags,
1069 {"Port Flags", "fcs.port.flags", FT_BOOLEAN, BASE_NONE,
1070 TFS (&fc_fcs_portflags_tfs), 0x0, "", HFILL}},
1071 { &hf_fcs_portstate,
1072 {"Port State", "fcs.port.state", FT_UINT8, BASE_HEX,
1073 VALS (fc_fcs_port_state_val), 0x0, "", HFILL}},
1074 { &hf_fcs_platformname,
1075 {"Platform Name", "fcs.platform.name", FT_BYTES, BASE_HEX, NULL, 0x0,
1077 { &hf_fcs_platformnname,
1078 {"Platform Node Name", "fcs.platform.nodename", FT_STRING, BASE_HEX,
1079 NULL, 0x0, "", HFILL}},
1080 { &hf_fcs_platformtype,
1081 {"Platform Type", "fcs.platform.type", FT_UINT8, BASE_HEX,
1082 VALS (fc_fcs_plat_type_val), 0x0, "", HFILL}},
1083 { &hf_fcs_platformaddr,
1084 {"Management Address", "fcs.platform.mgmtaddr", FT_STRING, BASE_HEX,
1085 NULL, 0x0, "", HFILL}},
1087 {"Reason Code", "fcs.reason", FT_UINT8, BASE_HEX,
1088 VALS (fc_ct_rjt_code_vals), 0x0, "", HFILL}},
1089 { &hf_fcs_rjtdetail,
1090 {"Reason Code Explanantion", "fcs.reasondet", FT_UINT8, BASE_HEX,
1091 VALS (fc_fcs_rjt_code_val), 0x0, "", HFILL}},
1093 {"Vendor Unique Reject Code", "fcs.err.vendor", FT_UINT8, BASE_HEX,
1094 NULL, 0x0, "", HFILL}},
1096 {"Number of Capabilities", "fcs.numcap", FT_UINT32, BASE_DEC, NULL,
1098 { &hf_fcs_mgmt_subtype,
1099 {"Management GS Subtype", "fcs.gssubtype", FT_UINT8, BASE_HEX, NULL,
1101 { &hf_fcs_vnd_capmask,
1102 {"Vendor Unique Capability Bitmask", "fcs.vbitmask", FT_UINT24,
1103 BASE_HEX, NULL, 0x0, "", HFILL}},
1105 {"Subtype Capability Bitmask", "fcs.fcsmask", FT_UINT32, BASE_HEX,
1106 VALS (fc_fcs_fcsmask_val), 0x0, "", HFILL}},
1108 {"Subtype Capability Bitmask", "fcs.unsmask", FT_UINT32, BASE_HEX,
1109 VALS (fc_fcs_unsmask_val), 0x0, "", HFILL}},
1110 { &hf_fcs_maxres_size,
1111 {"Maximum/Residual Size", "fcs.maxres_size", FT_UINT16, BASE_DEC,
1112 NULL, 0x0, "", HFILL}},
1113 { &hf_fcs_releasecode,
1114 {"Release Code", "fcs.releasecode", FT_STRING, BASE_HEX, NULL, 0x0,
1118 /* Setup protocol subtree array */
1119 static gint *ett[] = {
1123 /* Register the protocol name and description */
1124 proto_fcfcs = proto_register_protocol("FC Fabric Configuration Server",
1127 /* Required function calls to register the header fields and subtrees used */
1128 proto_register_field_array(proto_fcfcs, hf, array_length(hf));
1129 proto_register_subtree_array(ett, array_length(ett));
1130 register_init_routine (&fcfcs_init_protocol);
1133 /* If this dissector uses sub-dissector registration add a registration routine.
1134 This format is required because a script is used to find these routines and
1135 create the code that calls these routines.
1138 proto_reg_handoff_fcfcs (void)
1140 dissector_handle_t fcs_handle;
1142 fcs_handle = create_dissector_handle (dissect_fcfcs, proto_fcfcs);
1144 dissector_add("fcct.server", FCCT_GSRVR_FCS, fcs_handle);
1146 data_handle = find_dissector ("data");