2 * Routines for Fibre Channel Decoding (FC Header, Link Ctl & Basic Link Svc)
3 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
4 * Copyright 2003 Ronnie Sahlberg, exchange first/last matching and
5 * tap listener and misc updates
7 * $Id: packet-fc.c,v 1.14 2003/08/24 01:06:20 guy Exp $
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@ethereal.com>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
41 #ifdef HAVE_NETINET_IN_H
42 # include <netinet/in.h>
47 #ifdef NEED_SNPRINTF_H
48 # include "snprintf.h"
51 #include <epan/packet.h>
53 #include "reassemble.h"
55 #include "packet-fc.h"
56 #include "packet-fclctl.h"
57 #include "packet-fcbls.h"
60 #define FC_HEADER_SIZE 24
61 #define FC_RCTL_EISL 0x50
62 #define MDSHDR_TRAILER_SIZE 6
64 /* Size of various fields in FC header in bytes */
65 #define FC_RCTL_SIZE 1
67 #define FC_CSCTL_SIZE 1
69 #define FC_TYPE_SIZE 1
70 #define FC_FCTL_SIZE 3
71 #define FC_SEQID_SIZE 1
72 #define FC_DFCTL_SIZE 1
73 #define FC_SEQCNT_SIZE 2
74 #define FC_OXID_SIZE 2
75 #define FC_RXID_SIZE 2
76 #define FC_PARAM_SIZE 4
78 /* Initialize the protocol and registered fields */
79 static int proto_fc = -1;
80 static int hf_fc_time = -1;
81 static int hf_fc_exchange_first_frame = -1;
82 static int hf_fc_exchange_last_frame = -1;
83 static int hf_fc_rctl = -1;
84 static int hf_fc_did = -1;
85 static int hf_fc_csctl = -1;
86 static int hf_fc_sid = -1;
87 static int hf_fc_id = -1;
88 static int hf_fc_type = -1;
89 static int hf_fc_fctl = -1;
90 static int hf_fc_fctl_exchange_responder = -1;
91 static int hf_fc_fctl_seq_recipient = -1;
92 static int hf_fc_fctl_exchange_first = -1;
93 static int hf_fc_fctl_exchange_last = -1;
94 static int hf_fc_fctl_seq_last = -1;
95 static int hf_fc_fctl_priority = -1;
96 static int hf_fc_fctl_transfer_seq_initiative = -1;
97 static int hf_fc_fctl_rexmitted_seq = -1;
98 static int hf_fc_fctl_rel_offset = -1;
99 static int hf_fc_fctl_abts_ack = -1;
100 static int hf_fc_fctl_abts_not_ack = -1;
101 static int hf_fc_fctl_last_data_frame = -1;
102 static int hf_fc_fctl_ack_0_1 = -1;
103 static int hf_fc_seqid = -1;
104 static int hf_fc_dfctl = -1;
105 static int hf_fc_seqcnt = -1;
106 static int hf_fc_oxid = -1;
107 static int hf_fc_rxid = -1;
108 static int hf_fc_param = -1;
109 static int hf_fc_ftype = -1; /* Derived field, non-existent in FC hdr */
110 static int hf_fc_reassembled = -1;
112 /* Network_Header fields */
113 static int hf_fc_nh_da = -1;
114 static int hf_fc_nh_sa = -1;
116 /* For Basic Link Svc */
117 static int hf_fc_bls_seqid_vld = -1;
118 static int hf_fc_bls_lastvld_seqid = -1;
119 static int hf_fc_bls_oxid = -1;
120 static int hf_fc_bls_rxid = -1;
121 static int hf_fc_bls_lowseqcnt = -1;
122 static int hf_fc_bls_hiseqcnt = -1;
123 static int hf_fc_bls_rjtcode = -1;
124 static int hf_fc_bls_rjtdetail = -1;
125 static int hf_fc_bls_vendor = -1;
128 /* Initialize the subtree pointers */
129 static gint ett_fc = -1;
130 static gint ett_fctl = -1;
131 static gint ett_fcbls = -1;
133 static dissector_table_t fcftype_dissector_table;
134 static dissector_handle_t data_handle;
136 static int fc_tap = -1;
138 /* Reassembly stuff */
139 static gboolean fc_reassemble = TRUE;
140 static guint32 fc_max_frame_size = 1024;
141 static GHashTable *fc_fragment_table = NULL;
144 static GHashTable *fc_exchange_unmatched = NULL;
145 static GHashTable *fc_exchange_matched = NULL;
146 static GMemChunk *fc_exchange_vals = NULL;
147 static guint32 fc_exchange_init_count = 200;
150 fc_exchange_hash_unmatched(gconstpointer v)
152 const fc_exchange_data *fced=(const fc_exchange_data *)v;
157 fc_exchange_equal_unmatched(gconstpointer v1, gconstpointer v2)
159 const fc_exchange_data *fced1=(const fc_exchange_data *)v1;
160 const fc_exchange_data *fced2=(const fc_exchange_data *)v2;
162 /* oxid must match */
163 if(fced1->oxid!=fced2->oxid){
166 /* compare s_id, d_id and treat the fc address
167 s_id==00.00.00 as a wildcard matching anything */
168 if( ((fced1->s_id.data[0]!=0)||(fced1->s_id.data[1]!=0)||(fced1->s_id.data[2]!=0)) && CMP_ADDRESS(&fced1->s_id, &fced2->s_id) ){
171 if(CMP_ADDRESS(&fced1->d_id, &fced2->d_id)){
179 fc_exchange_hash_matched(gconstpointer v)
181 const fc_exchange_data *fced=(const fc_exchange_data *)v;
186 fc_exchange_equal_matched(gconstpointer v1, gconstpointer v2)
188 const fc_exchange_data *fced1=(const fc_exchange_data *)v1;
189 const fc_exchange_data *fced2=(const fc_exchange_data *)v2;
190 guint32 fef1, fef2, lef1, lef2;
192 /* oxid must match */
193 if(fced1->oxid!=fced2->oxid){
196 fef1=fced1->first_exchange_frame;
197 fef2=fced2->first_exchange_frame;
198 lef1=fced1->last_exchange_frame;
199 lef2=fced2->last_exchange_frame;
216 fc_exchange_init_protocol(void)
218 if(fc_exchange_vals){
219 g_mem_chunk_destroy(fc_exchange_vals);
220 fc_exchange_vals=NULL;
222 if(fc_exchange_unmatched){
223 g_hash_table_destroy(fc_exchange_unmatched);
224 fc_exchange_unmatched=NULL;
226 if(fc_exchange_matched){
227 g_hash_table_destroy(fc_exchange_matched);
228 fc_exchange_matched=NULL;
231 fc_exchange_unmatched=g_hash_table_new(fc_exchange_hash_unmatched, fc_exchange_equal_unmatched);
232 fc_exchange_matched=g_hash_table_new(fc_exchange_hash_matched, fc_exchange_equal_matched);
233 fc_exchange_vals=g_mem_chunk_new("fc_exchange_vals", sizeof(fc_exchange_data), fc_exchange_init_count*sizeof(fc_exchange_data), G_ALLOC_AND_FREE);
241 const value_string fc_fc4_val[] = {
242 {FC_TYPE_ELS , "Ext Link Svc"},
243 {FC_TYPE_LLCSNAP , "LLC_SNAP"},
244 {FC_TYPE_IP , "IP/FC"},
245 {FC_TYPE_SCSI , "FCP"},
246 {FC_TYPE_FCCT , "FC_CT"},
247 {FC_TYPE_SWILS , "SW_ILS"},
249 {FC_TYPE_SNMP , "SNMP"},
253 static const value_string fc_ftype_vals [] = {
254 {FC_FTYPE_UNDEF , "Unknown frame"},
255 {FC_FTYPE_SWILS, "SW_ILS"},
256 {FC_FTYPE_IP , "IP/FC"},
257 {FC_FTYPE_SCSI , "FCP"},
258 {FC_FTYPE_BLS , "Basic Link Svc"},
259 {FC_FTYPE_ELS , "ELS"},
260 {FC_FTYPE_FCCT , "FC_CT"},
261 {FC_FTYPE_LINKDATA, "Link Data"},
262 {FC_FTYPE_VDO, "Video Data"},
263 {FC_FTYPE_LINKCTL, "Link Ctl"},
267 static const value_string fc_wka_vals[] = {
268 {FC_WKA_MULTICAST, "Multicast Server"},
269 {FC_WKA_CLKSYNC, "Clock Sync Server"},
270 {FC_WKA_KEYDIST, "Key Distribution Server"},
271 {FC_WKA_ALIAS, "Alias Server"},
272 {FC_WKA_QOSF, "QoS Facilitator"},
273 {FC_WKA_MGMT, "Management Server"},
274 {FC_WKA_TIME, "Time Server"},
275 {FC_WKA_DNS, "Directory Server"},
276 {FC_WKA_FABRIC_CTRLR, "Fabric Ctlr"},
277 {FC_WKA_FPORT, "F_Port Server"},
278 {FC_WKA_BCAST, "Broadcast ID"},
282 static const value_string fc_routing_val[] = {
283 {FC_RCTL_DEV_DATA, "Device_Data"},
284 {FC_RCTL_ELS, "Extended Link Services"},
285 {FC_RCTL_LINK_DATA, "FC-4 Link_Data"},
286 {FC_RCTL_VIDEO, "Video_Data"},
287 {FC_RCTL_BLS, "Basic Link Services"},
288 {FC_RCTL_LINK_CTL, "Link_Control Frame"},
292 static const value_string fc_iu_val[] = {
293 {FC_IU_UNCATEGORIZED , "Uncategorized Data"},
294 {FC_IU_SOLICITED_DATA , "Solicited Data"},
295 {FC_IU_UNSOLICITED_CTL , "Unsolicited Control"},
296 {FC_IU_SOLICITED_CTL , "Solicited Control"},
297 {FC_IU_UNSOLICITED_DATA, "Solicited Data"},
298 {FC_IU_DATA_DESCRIPTOR , "Data Descriptor"},
299 {FC_IU_UNSOLICITED_CMD , "Unsolicited Command"},
300 {FC_IU_CMD_STATUS , "Command Status"},
305 static void fc_defragment_init(void)
307 fragment_table_init(&fc_fragment_table);
312 fctl_to_str (const guint8 *fctl, gchar *str, gboolean is_ack)
320 if (fctl[0] & 0x80) {
321 strcpy (str, "Exchange Responder, ");
325 strcpy (str, "Exchange Originator, ");
329 if (fctl[0] & 0x40) {
330 strcpy (&str[stroff], "Seq Recipient, ");
334 strcpy (&str[stroff], "Seq Initiator, ");
338 if (fctl[0] & 0x20) {
339 strcpy (&str[stroff], "Exchg First, ");
343 if (fctl[0] & 0x10) {
344 strcpy (&str[stroff], "Exchg Last, ");
349 strcpy (&str[stroff], "Seq Last, ");
354 strcpy (&str[stroff], "Priority, ");
358 strcpy (&str[stroff], "CS_CTL, ");
363 strcpy (&str[stroff], "Transfer Seq Initiative, ");
367 if (fctl[1] & 0x30) {
368 strcpy (&str[stroff], "ACK_0 Reqd, ");
371 else if (fctl[1] & 0x10) {
372 strcpy (&str[stroff], "ACK_1 Reqd, ");
377 strcpy (&str[stroff], "Rexmitted Seq, ");
381 tmp = fctl[2] & 0xC0;
384 strcpy (&str[stroff], "Last Data Frame - No Info, ");
388 strcpy (&str[stroff], "Last Data Frame - Seq Imm, ");
392 strcpy (&str[stroff], "Last Data Frame - Seq Soon, ");
396 strcpy (&str[stroff], "Last Data Frame - Seq Delyd, ");
401 tmp = fctl[2] & 0x30;
405 strcpy (&str[stroff], "ABTS - Cont, ");
409 strcpy (&str[stroff], "ABTS - Abort/MS, ");
415 strcpy (&str[stroff], "ABTS - AbortABTS - Abort, ");
419 strcpy (&str[stroff], "ABTS - Abort/SS, ");
425 strcpy (&str[stroff], "ABTS - Stop, ");
429 strcpy (&str[stroff], "ABTS - Process/IB, ");
435 strcpy (&str[stroff], "ABTS - Imm Seq Retx, ");
439 strcpy (&str[stroff], "ABTS - Discard/MS/Imm Retx, ");
446 strcpy (&str[stroff], "Rel Offset = 1");
453 /* BA_ACC & BA_RJT are decoded in this file itself instead of a traditional
454 * dedicated file and dissector format because the dissector would require some
455 * fields of the FC_HDR such as param in some cases, type in some others, the
456 * lower 4 bits of r_ctl in some other cases etc. So, we decode BLS & Link Ctl
457 * in this file itself.
460 dissect_fc_ba_acc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
462 /* Set up structures needed to add the protocol subtree and manage it */
464 proto_tree *acc_tree;
467 /* Make entries in Protocol column and Info column on summary display */
468 if (check_col(pinfo->cinfo, COL_PROTOCOL))
469 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BLS");
471 if (check_col(pinfo->cinfo, COL_INFO))
472 col_set_str(pinfo->cinfo, COL_INFO, "BA_ACC");
475 ti = proto_tree_add_text (tree, tvb, 0, tvb_length (tvb), "Basic Link Svc");
476 acc_tree = proto_item_add_subtree (ti, ett_fcbls);
478 proto_tree_add_item (acc_tree, hf_fc_bls_seqid_vld, tvb, offset++, 1, FALSE);
479 proto_tree_add_item (acc_tree, hf_fc_bls_lastvld_seqid, tvb, offset++, 1, FALSE);
480 offset += 2; /* Skip reserved field */
481 proto_tree_add_item (acc_tree, hf_fc_bls_oxid, tvb, offset, 2, FALSE);
483 proto_tree_add_item (acc_tree, hf_fc_bls_rxid, tvb, offset, 2, FALSE);
485 proto_tree_add_item (acc_tree, hf_fc_bls_lowseqcnt, tvb, offset, 2, FALSE);
487 proto_tree_add_item (acc_tree, hf_fc_bls_hiseqcnt, tvb, offset, 2, FALSE);
492 dissect_fc_ba_rjt (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
494 /* Set up structures needed to add the protocol subtree and manage it */
496 proto_tree *rjt_tree;
499 /* Make entries in Protocol column and Info column on summary display */
500 if (check_col(pinfo->cinfo, COL_PROTOCOL))
501 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BLS");
503 if (check_col(pinfo->cinfo, COL_INFO))
504 col_set_str(pinfo->cinfo, COL_INFO, "BA_RJT");
507 ti = proto_tree_add_text (tree, tvb, 0, tvb_length (tvb), "Basic Link Svc");
508 rjt_tree = proto_item_add_subtree (ti, ett_fcbls);
510 proto_tree_add_item (rjt_tree, hf_fc_bls_rjtcode, tvb, offset+1, 1, FALSE);
511 proto_tree_add_item (rjt_tree, hf_fc_bls_rjtdetail, tvb, offset+2, 1, FALSE);
512 proto_tree_add_item (rjt_tree, hf_fc_bls_vendor, tvb, offset+3, 1, FALSE);
517 fc_get_ftype (guint8 r_ctl, guint8 type)
519 /* A simple attempt to determine the upper level protocol based on the
520 * r_ctl & type fields.
522 switch (r_ctl & 0xF0) {
523 case FC_RCTL_DEV_DATA:
526 if ((r_ctl == 0x2) || (r_ctl == 0x3))
527 return FC_FTYPE_SWILS;
529 return FC_FTYPE_UNDEF;
533 return FC_FTYPE_SCSI;
535 return FC_FTYPE_FCCT;
537 return FC_FTYPE_UNDEF;
541 if (((r_ctl & 0x0F) == 0x2) || ((r_ctl & 0x0F) == 0x3))
544 return FC_FTYPE_UNDEF;
546 case FC_RCTL_LINK_DATA:
547 return FC_FTYPE_LINKDATA;
556 return FC_FTYPE_UNDEF;
558 case FC_RCTL_LINK_CTL:
559 return FC_FTYPE_LINKCTL;
562 return FC_FTYPE_UNDEF;
567 static const value_string abts_ack_vals[] = {
568 {0x000000, "ABTS - Cont"},
569 {0x000010, "ABTS - Abort"},
570 {0x000020, "ABTS - Stop"},
571 {0x000030, "ABTS - Imm Seq Retx"},
574 static const value_string abts_not_ack_vals[] = {
575 {0x000000, "ABTS - Abort/MS"},
576 {0x000010, "ABTS - Abort/SS"},
577 {0x000020, "ABTS - Process/IB"},
578 {0x000030, "ABTS - Discard/MS/Imm Retx"},
581 static const value_string last_data_frame_vals[] = {
582 {0x000000, "Last Data Frame - No Info"},
583 {0x004000, "Last Data Frame - Seq Imm"},
584 {0x008000, "Last Data Frame - Seq Soon"},
585 {0x00c000, "Last Data Frame - Seq Delyd"},
588 static const value_string ack_0_1_vals[] = {
589 {0x003000, "ACK_0 Required"},
590 {0x002000, "ACK_0 Required"},
591 {0x001000, "ACK_1 Required"},
592 {0x000000, "no ack required"},
595 static const true_false_string tfs_fc_fctl_exchange_responder = {
596 "Exchange Responder",
597 "Exchange Originator"
599 static const true_false_string tfs_fc_fctl_seq_recipient = {
603 static const true_false_string tfs_fc_fctl_exchange_first = {
607 static const true_false_string tfs_fc_fctl_exchange_last = {
611 static const true_false_string tfs_fc_fctl_seq_last = {
615 static const true_false_string tfs_fc_fctl_priority = {
619 static const true_false_string tfs_fc_fctl_transfer_seq_initiative = {
620 "Transfer Seq Initiative",
621 "NOT transfer seq initiative"
623 static const true_false_string tfs_fc_fctl_rexmitted_seq = {
624 "Retransmitted Sequence",
625 "NOT retransmitted sequence"
627 static const true_false_string tfs_fc_fctl_rel_offset = {
635 /* code to dissect the F_CTL bitmask */
637 dissect_fc_fctl(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, gboolean is_ack, guint32 fctl)
643 item=proto_tree_add_uint(parent_tree, hf_fc_fctl, tvb, offset, 3, fctl);
644 tree=proto_item_add_subtree(item, ett_fctl);
647 proto_tree_add_boolean(tree, hf_fc_fctl_exchange_responder, tvb, offset, 3, fctl);
649 proto_tree_add_boolean(tree, hf_fc_fctl_seq_recipient, tvb, offset, 3, fctl);
651 proto_tree_add_boolean(tree, hf_fc_fctl_exchange_first, tvb, offset, 3, fctl);
653 proto_tree_add_boolean(tree, hf_fc_fctl_exchange_last, tvb, offset, 3, fctl);
655 proto_tree_add_boolean(tree, hf_fc_fctl_seq_last, tvb, offset, 3, fctl);
657 proto_tree_add_boolean(tree, hf_fc_fctl_priority, tvb, offset, 3, fctl);
659 proto_tree_add_boolean(tree, hf_fc_fctl_transfer_seq_initiative, tvb, offset, 3, fctl);
661 proto_tree_add_uint(tree, hf_fc_fctl_last_data_frame, tvb, offset, 3, fctl);
663 proto_tree_add_uint(tree, hf_fc_fctl_ack_0_1, tvb, offset, 3, fctl);
666 proto_tree_add_boolean(tree, hf_fc_fctl_rexmitted_seq, tvb, offset, 3, fctl);
669 proto_tree_add_uint(tree, hf_fc_fctl_abts_ack, tvb, offset, 3, fctl);
671 proto_tree_add_uint(tree, hf_fc_fctl_abts_ack, tvb, offset, 3, fctl);
674 proto_tree_add_boolean(tree, hf_fc_fctl_rel_offset, tvb, offset, 3, fctl);
676 fctl_to_str( ((guint8 *)&fctl)+1, str, is_ack);
677 proto_item_append_text(item, " %s", str);
680 static const value_string fc_bls_proto_val[] = {
681 {FC_BLS_NOP , "NOP"},
682 {FC_BLS_ABTS , "ABTS"},
683 {FC_BLS_RMC , "RMC"},
684 {FC_BLS_BAACC , "BA_ACC"},
685 {FC_BLS_BARJT , "BA_RJT"},
686 {FC_BLS_PRMT , "PRMT"},
690 static const value_string fc_els_proto_val[] = {
691 {0x01 , "Solicited Data"},
697 /* Code to actually dissect the packets */
699 dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
701 /* Set up structures needed to add the protocol subtree and manage it */
703 proto_tree *fc_tree = NULL;
705 int offset = 0, next_offset;
706 gboolean is_lastframe_inseq;
707 gboolean is_exchg_resp = 0;
708 fragment_data *fcfrag_head;
718 fc_exchange_data *fc_ex=NULL;
722 /* Make entries in Protocol column and Info column on summary display */
723 if (check_col(pinfo->cinfo, COL_PROTOCOL))
724 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC");
726 fchdr.r_ctl = tvb_get_guint8 (tvb, offset);
728 /* If the R_CTL is the EISL field, skip the first 8 bytes to retrieve the
729 * real FC header. EISL is Cisco-proprietary and is not decoded.
731 if (fchdr.r_ctl == FC_RCTL_EISL) {
733 fchdr.r_ctl = tvb_get_guint8 (tvb, offset);
736 SET_ADDRESS (&pinfo->dst, AT_FC, 3, tvb_get_ptr(tvb,offset+1,3));
737 SET_ADDRESS (&fchdr.d_id, AT_FC, 3, tvb_get_ptr(tvb,offset+1,3));
738 SET_ADDRESS (&pinfo->src, AT_FC, 3, tvb_get_ptr(tvb,offset+5,3));
739 SET_ADDRESS (&fchdr.s_id, AT_FC, 3, tvb_get_ptr(tvb,offset+5,3));
740 fchdr.cs_ctl = tvb_get_guint8 (tvb, offset+4);
741 fchdr.type = tvb_get_guint8 (tvb, offset+8);
742 fchdr.fctl=tvb_get_ntoh24(tvb,offset+9);
743 fchdr.seqcnt = tvb_get_ntohs (tvb, offset+14);
744 fchdr.oxid=tvb_get_ntohs(tvb,offset+16);
745 fchdr.rxid=tvb_get_ntohs(tvb,offset+18);
746 param = tvb_get_ntohl (tvb, offset+20);
748 pinfo->oxid = fchdr.oxid;
749 pinfo->rxid = fchdr.rxid;
750 pinfo->ptype = PT_EXCHG;
751 pinfo->r_ctl = fchdr.r_ctl;
753 is_ack = ((fchdr.r_ctl == 0xC0) || (fchdr.r_ctl == 0xC1));
755 ftype = fc_get_ftype (fchdr.r_ctl, fchdr.type);
757 if (check_col (pinfo->cinfo, COL_INFO)) {
758 col_add_str (pinfo->cinfo, COL_INFO, match_strval (ftype, fc_ftype_vals));
760 if (ftype == FC_FTYPE_LINKCTL)
761 col_append_fstr (pinfo->cinfo, COL_INFO, ", %s",
762 match_strval ((fchdr.r_ctl & 0x0F),
766 /* In the interest of speed, if "tree" is NULL, don't do any work not
767 necessary to generate protocol tree items. */
769 ti = proto_tree_add_protocol_format (tree, proto_fc, tvb, offset,
770 FC_HEADER_SIZE, "Fibre Channel");
771 fc_tree = proto_item_add_subtree (ti, ett_fc);
774 /* match first exchange with last exchange */
775 if(fchdr.fctl&FC_FCTL_EXCHANGE_FIRST){
776 if(!pinfo->fd->flags.visited){
777 fc_exchange_data fced, *old_fced;
779 /* first check if we already have seen this exchange and it
780 is still open/unmatched.
782 fced.oxid=fchdr.oxid;
783 SET_ADDRESS(&fced.s_id, fchdr.s_id.type, fchdr.s_id.len, fchdr.s_id.data);
784 SET_ADDRESS(&fced.d_id, fchdr.d_id.type, fchdr.d_id.len, fchdr.d_id.data);
785 old_fced=g_hash_table_lookup(fc_exchange_unmatched, &fced);
787 g_hash_table_remove(fc_exchange_unmatched, old_fced);
789 old_fced=g_mem_chunk_alloc(fc_exchange_vals);
790 old_fced->oxid=fchdr.oxid;
791 COPY_ADDRESS(&old_fced->s_id, &fchdr.s_id);
792 COPY_ADDRESS(&old_fced->d_id, &fchdr.d_id);
793 old_fced->first_exchange_frame=pinfo->fd->num;
794 old_fced->fc_time.nsecs = pinfo->fd->abs_usecs*1000;
795 old_fced->fc_time.secs = pinfo->fd->abs_secs;
796 g_hash_table_insert(fc_exchange_unmatched, old_fced, old_fced);
799 fc_exchange_data fced, *old_fced;
800 fced.oxid=fchdr.oxid;
801 fced.first_exchange_frame=pinfo->fd->num;
802 fced.last_exchange_frame=0;
803 old_fced=g_hash_table_lookup(fc_exchange_matched, &fced);
807 if(fchdr.fctl&FC_FCTL_EXCHANGE_LAST){
808 if(!pinfo->fd->flags.visited){
809 fc_exchange_data fced, *old_fced;
811 fced.oxid=fchdr.oxid;
812 SET_ADDRESS(&fced.s_id, fchdr.d_id.type, fchdr.d_id.len, fchdr.d_id.data);
813 SET_ADDRESS(&fced.d_id, fchdr.s_id.type, fchdr.s_id.len, fchdr.s_id.data);
814 old_fced=g_hash_table_lookup(fc_exchange_unmatched, &fced);
816 g_hash_table_remove(fc_exchange_unmatched, old_fced);
817 old_fced->last_exchange_frame=pinfo->fd->num;
818 g_hash_table_insert(fc_exchange_matched, old_fced, old_fced);
822 fc_exchange_data fced, *old_fced;
823 fced.oxid=fchdr.oxid;
824 fced.first_exchange_frame=0;
825 fced.last_exchange_frame=pinfo->fd->num;
826 old_fced=g_hash_table_lookup(fc_exchange_matched, &fced);
831 if(fchdr.fctl&FC_FCTL_EXCHANGE_FIRST){
832 proto_tree_add_uint(fc_tree, hf_fc_exchange_last_frame, tvb, 0, 0, fc_ex->last_exchange_frame);
834 if(fchdr.fctl&FC_FCTL_EXCHANGE_LAST){
836 proto_tree_add_uint(fc_tree, hf_fc_exchange_first_frame, tvb, 0, 0, fc_ex->first_exchange_frame);
837 delta_time.secs = pinfo->fd->abs_secs - fc_ex->fc_time.secs;
838 delta_time.nsecs = pinfo->fd->abs_usecs*1000 - fc_ex->fc_time.nsecs;
839 if (delta_time.nsecs<0){
840 delta_time.nsecs+=1000000000;
843 proto_tree_add_time(ti, hf_fc_time, tvb, 0, 0, &delta_time);
848 switch (fchdr.r_ctl & 0xF0) {
850 case FC_RCTL_DEV_DATA:
851 case FC_RCTL_LINK_DATA:
853 /* the lower 4 bits of R_CTL are the information category */
854 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
855 FC_RCTL_SIZE, fchdr.r_ctl,
856 "R_CTL: 0x%x(%s/%s)",
858 val_to_str ((fchdr.r_ctl & 0xF0),
859 fc_routing_val, "0x%x"),
860 val_to_str ((fchdr.r_ctl & 0x0F),
864 case FC_RCTL_LINK_CTL:
865 /* the lower 4 bits of R_CTL indicate the type of link ctl frame */
866 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
867 FC_RCTL_SIZE, fchdr.r_ctl,
868 "R_CTL: 0x%x(%s/%s)",
870 val_to_str ((fchdr.r_ctl & 0xF0),
871 fc_routing_val, "0x%x"),
872 val_to_str ((fchdr.r_ctl & 0x0F),
873 fc_lctl_proto_val, "0x%x"));
877 switch (fchdr.type) {
880 /* the lower 4 bits of R_CTL indicate the type of BLS frame */
881 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
882 FC_RCTL_SIZE, fchdr.r_ctl,
883 "R_CTL: 0x%x(%s/%s)",
885 val_to_str ((fchdr.r_ctl & 0xF0),
886 fc_routing_val, "0x%x"),
887 val_to_str ((fchdr.r_ctl & 0x0F),
888 fc_bls_proto_val, "0x%x"));
892 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
893 FC_RCTL_SIZE, fchdr.r_ctl,
894 "R_CTL: 0x%x(%s/0x%x)",
896 val_to_str ((fchdr.r_ctl & 0xF0),
897 fc_routing_val, "0x%x"),
904 switch (fchdr.type) {
907 /* the lower 4 bits of R_CTL indicate the type of ELS frame */
908 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
909 FC_RCTL_SIZE, fchdr.r_ctl,
910 "R_CTL: 0x%x(%s/%s)",
912 val_to_str ((fchdr.r_ctl & 0xF0),
913 fc_routing_val, "0x%x"),
914 val_to_str ((fchdr.r_ctl & 0x0F),
915 fc_els_proto_val, "0x%x"));
919 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
920 FC_RCTL_SIZE, fchdr.r_ctl,
921 "R_CTL: 0x%x(%s/0x%x)",
923 val_to_str ((fchdr.r_ctl & 0xF0),
924 fc_routing_val, "0x%x"),
931 proto_tree_add_uint_format (fc_tree, hf_fc_rctl, tvb, offset,
932 FC_RCTL_SIZE, fchdr.r_ctl,
933 "R_CTL: 0x%x(%s/0x%x)",
935 val_to_str ((fchdr.r_ctl & 0xF0),
936 fc_routing_val, "0x%x"),
941 proto_tree_add_uint_hidden (fc_tree, hf_fc_ftype, tvb, offset, 1,
944 /* XXX - use "fc_wka_vals[]" on this? */
945 proto_tree_add_string (fc_tree, hf_fc_did, tvb, offset+1, 3,
946 fc_to_str (fchdr.d_id.data));
947 proto_tree_add_string_hidden (fc_tree, hf_fc_id, tvb, offset+1, 3,
948 fc_to_str (fchdr.d_id.data));
950 proto_tree_add_uint (fc_tree, hf_fc_csctl, tvb, offset+4, 1, fchdr.cs_ctl);
952 /* XXX - use "fc_wka_vals[]" on this? */
953 proto_tree_add_string (fc_tree, hf_fc_sid, tvb, offset+5, 3,
954 fc_to_str (fchdr.s_id.data));
955 proto_tree_add_string_hidden (fc_tree, hf_fc_id, tvb, offset+5, 3,
956 fc_to_str (fchdr.s_id.data));
958 if (ftype == FC_FTYPE_LINKCTL) {
959 if (((fchdr.r_ctl & 0x0F) == FC_LCTL_FBSYB) ||
960 ((fchdr.r_ctl & 0x0F) == FC_LCTL_FBSYL)) {
961 /* for F_BSY frames, the upper 4 bits of the type field specify the
962 * reason for the BSY.
964 proto_tree_add_uint_format (fc_tree, hf_fc_type, tvb,
965 offset+8, FC_TYPE_SIZE,
966 fchdr.type,"Type: 0x%x(%s)", fchdr.type,
967 fclctl_get_typestr (fchdr.r_ctl & 0x0F,
970 proto_tree_add_item (fc_tree, hf_fc_type, tvb, offset+8, 1, FALSE);
973 proto_tree_add_item (fc_tree, hf_fc_type, tvb, offset+8, 1, FALSE);
977 dissect_fc_fctl(pinfo, fc_tree, tvb, offset+9, is_ack, fchdr.fctl);
980 proto_tree_add_item (fc_tree, hf_fc_seqid, tvb, offset+12, 1, FALSE);
982 df_ctl = tvb_get_guint8(tvb, offset+13);
984 proto_tree_add_uint (fc_tree, hf_fc_dfctl, tvb, offset+13, 1, df_ctl);
985 proto_tree_add_uint (fc_tree, hf_fc_seqcnt, tvb, offset+14, 2, fchdr.seqcnt);
986 proto_tree_add_uint (fc_tree, hf_fc_oxid, tvb, offset+16, 2, fchdr.oxid);
987 proto_tree_add_uint (fc_tree, hf_fc_rxid, tvb, offset+18, 2, fchdr.rxid);
989 if (ftype == FC_FTYPE_LINKCTL) {
990 if (((fchdr.r_ctl & 0x0F) == FC_LCTL_FRJT) ||
991 ((fchdr.r_ctl & 0x0F) == FC_LCTL_PRJT) ||
992 ((fchdr.r_ctl & 0x0F) == FC_LCTL_PBSY)) {
993 /* In all these cases of Link Ctl frame, the parameter field
994 * encodes the detailed error message
996 proto_tree_add_uint_format (fc_tree, hf_fc_param, tvb,
998 "Parameter: 0x%x(%s)", param,
999 fclctl_get_paramstr ((fchdr.r_ctl & 0x0F),
1002 proto_tree_add_item (fc_tree, hf_fc_param, tvb, offset+20, 4, FALSE);
1004 } else if (ftype == FC_FTYPE_BLS) {
1005 if ((fchdr.r_ctl & 0x0F) == FC_BLS_ABTS) {
1006 proto_tree_add_uint_format (fc_tree, hf_fc_param, tvb,
1007 offset+20, 4, param,
1008 "Parameter: 0x%x(%s)", param,
1009 ((param & 0x0F) == 1 ? "Abort Sequence" :
1012 proto_tree_add_item (fc_tree, hf_fc_param, tvb, offset+20,
1016 proto_tree_add_item (fc_tree, hf_fc_param, tvb, offset+20, 4, FALSE);
1019 /* Skip the Frame_Header */
1020 next_offset = offset + FC_HEADER_SIZE;
1022 /* Network_Header present? */
1023 if (df_ctl & FC_DFCTL_NH) {
1024 /* Yes - dissect it. */
1026 proto_tree_add_string (fc_tree, hf_fc_nh_da, tvb, next_offset, 8,
1027 fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
1028 proto_tree_add_string (fc_tree, hf_fc_nh_sa, tvb, offset+8, 8,
1029 fcwwn_to_str (tvb_get_ptr (tvb, offset+8, 8)));
1034 /* XXX - handle Association_Header and Device_Header here */
1036 if (ftype == FC_FTYPE_LINKCTL) {
1037 /* ACK_1 frames and other LINK_CTL frames echo the last seq bit if the
1038 * packet they're ack'ing did not have it set. So, we'll incorrectly
1039 * flag them as being fragmented when they're not. This fixes the
1042 is_lastframe_inseq = TRUE;
1044 is_lastframe_inseq = fchdr.fctl & FC_FCTL_SEQ_LAST;
1045 /* XXX is this right? offset 20, shouldnt it be offset 9? */
1046 is_exchg_resp = ((tvb_get_guint8 (tvb, offset+20) & 0x80) == 0x80);
1049 frag_size = tvb_reported_length (tvb)-FC_HEADER_SIZE;
1051 /* If there is an MDS header, we need to subtract the MDS trailer size */
1052 if ((pinfo->ethertype == ETHERTYPE_UNK) || (pinfo->ethertype == ETHERTYPE_FCFT)) {
1053 frag_size -= MDSHDR_TRAILER_SIZE;
1054 } else if (pinfo->ethertype == ETHERTYPE_BRDWALK) {
1055 frag_size -= 8; /* 4 byte of FC CRC +
1056 4 bytes of error+EOF = 8 bytes */
1059 if (!is_lastframe_inseq) {
1060 /* Show this only as a fragmented FC frame */
1061 if (check_col (pinfo->cinfo, COL_INFO)) {
1062 col_append_str (pinfo->cinfo, COL_INFO, " (Fragmented)");
1066 /* If this is a fragment, attempt to check if fully reassembled frame is
1067 * present, if we're configured to reassemble.
1069 if ((ftype != FC_FTYPE_LINKCTL) && (ftype != FC_FTYPE_BLS) &&
1070 (!is_lastframe_inseq || fchdr.seqcnt) && fc_reassemble &&
1071 tvb_bytes_exist(tvb, FC_HEADER_SIZE, frag_size)) {
1072 /* Add this to the list of fragments */
1073 frag_id = (pinfo->oxid << 16) | is_exchg_resp;
1075 /* We assume that all frames are of the same max size */
1076 fcfrag_head = fragment_add (tvb, FC_HEADER_SIZE, pinfo, frag_id,
1078 fchdr.seqcnt * fc_max_frame_size,
1080 !is_lastframe_inseq);
1083 next_tvb = tvb_new_real_data (fcfrag_head->data,
1084 fcfrag_head->datalen,
1085 fcfrag_head->datalen);
1086 tvb_set_child_real_data_tvbuff(tvb, next_tvb);
1088 /* Add the defragmented data to the data source list. */
1089 add_new_data_source(pinfo, next_tvb, "Reassembled FC");
1092 proto_tree_add_boolean_hidden (fc_tree, hf_fc_reassembled,
1093 tvb, offset+9, 1, 1);
1097 proto_tree_add_boolean_hidden (fc_tree, hf_fc_reassembled,
1098 tvb, offset+9, 1, 0);
1100 next_tvb = tvb_new_subset (tvb, next_offset, -1, -1);
1101 call_dissector (data_handle, next_tvb, pinfo, tree);
1106 proto_tree_add_boolean_hidden (fc_tree, hf_fc_reassembled,
1107 tvb, offset+9, 1, 0);
1109 next_tvb = tvb_new_subset (tvb, next_offset, -1, -1);
1112 if ((ftype != FC_FTYPE_LINKCTL) && (ftype != FC_FTYPE_BLS)) {
1113 if (!dissector_try_port (fcftype_dissector_table, ftype, next_tvb,
1115 call_dissector (data_handle, next_tvb, pinfo, tree);
1117 } else if (ftype == FC_FTYPE_BLS) {
1118 if ((fchdr.r_ctl & 0x0F) == FC_BLS_BAACC) {
1119 dissect_fc_ba_acc (next_tvb, pinfo, tree);
1120 } else if ((fchdr.r_ctl & 0x0F) == FC_BLS_BARJT) {
1121 dissect_fc_ba_rjt (next_tvb, pinfo, tree);
1125 tap_queue_packet(fc_tap, pinfo, &fchdr);
1129 /* Register the protocol with Ethereal */
1131 /* this format is require because a script is used to build the C function
1132 that calls all the protocol registration.
1136 proto_register_fc(void)
1139 /* Setup list of header fields See Section 1.6.1 for details*/
1140 static hf_register_info hf[] = {
1142 { "R_CTL", "fc.r_ctl", FT_UINT8, BASE_HEX, NULL, 0x0,
1145 {"Frame type", "fc.ftype", FT_UINT8, BASE_HEX, VALS(fc_ftype_vals),
1146 0x0, "Derived Type", HFILL}},
1148 { "Dest Addr", "fc.d_id", FT_STRING, BASE_HEX, NULL, 0x0,
1149 "Destination Address", HFILL}},
1151 {"CS_CTL", "fc.cs_ctl", FT_UINT8, BASE_HEX, NULL, 0x0,
1154 {"Src Addr", "fc.s_id", FT_STRING, BASE_HEX, NULL, 0x0,
1155 "Source Address", HFILL}},
1157 {"Addr", "fc.id", FT_STRING, BASE_HEX, NULL, 0x0,
1158 "Source or Destination Address", HFILL}},
1160 {"Type", "fc.type", FT_UINT8, BASE_HEX, VALS (fc_fc4_val), 0x0,
1163 {"F_CTL", "fc.f_ctl", FT_UINT24, BASE_HEX, NULL, 0x0, "", HFILL}},
1165 {"SEQ_ID", "fc.seq_id", FT_UINT8, BASE_HEX, NULL, 0x0,
1166 "Sequence ID", HFILL}},
1168 {"DF_CTL", "fc.df_ctl", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL}},
1170 {"SEQ_CNT", "fc.seq_cnt", FT_UINT16, BASE_DEC, NULL, 0x0,
1171 "Sequence Count", HFILL}},
1173 {"OX_ID", "fc.ox_id", FT_UINT16, BASE_HEX, NULL, 0x0, "Originator ID",
1176 {"RX_ID", "fc.rx_id", FT_UINT16, BASE_HEX, NULL, 0x0, "Receiver ID",
1179 {"Parameter", "fc.parameter", FT_UINT32, BASE_HEX, NULL, 0x0, "Parameter",
1182 { &hf_fc_reassembled,
1183 {"Reassembled Frame", "fc.reassembled", FT_BOOLEAN, BASE_HEX, NULL,
1186 {"Network DA", "fc.nethdr.da", FT_STRING, BASE_HEX, NULL,
1189 {"Network SA", "fc.nethdr.sa", FT_STRING, BASE_HEX, NULL,
1192 /* Basic Link Svc field definitions */
1193 { &hf_fc_bls_seqid_vld,
1194 {"SEQID Valid", "fc.bls_seqidvld", FT_UINT8, BASE_HEX,
1195 VALS (fc_bls_seqid_val), 0x0, "", HFILL}},
1196 { &hf_fc_bls_lastvld_seqid,
1197 {"Last Valid SEQID", "fc.bls_lastseqid", FT_UINT8, BASE_HEX, NULL,
1200 {"OXID", "fc.bls_oxid", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
1202 {"RXID", "fc.bls_rxid", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
1203 { &hf_fc_bls_lowseqcnt,
1204 {"Low SEQCNT", "fc.bls_lseqcnt", FT_UINT16, BASE_HEX, NULL, 0x0, "",
1206 { &hf_fc_bls_hiseqcnt,
1207 {"High SEQCNT", "fc.bls_hseqcnt", FT_UINT16, BASE_HEX, NULL, 0x0, "",
1209 { &hf_fc_bls_rjtcode,
1210 {"Reason", "fc.bls_reason", FT_UINT8, BASE_HEX, VALS(fc_bls_barjt_val),
1212 { &hf_fc_bls_rjtdetail,
1213 {"Reason Explanantion", "fc.bls_rjtdetail", FT_UINT8, BASE_HEX,
1214 VALS (fc_bls_barjt_det_val), 0x0, "", HFILL}},
1215 { &hf_fc_bls_vendor,
1216 {"Vendor Unique Reason", "fc.bls_vnduniq", FT_UINT8, BASE_HEX, NULL,
1218 { &hf_fc_fctl_exchange_responder,
1219 {"ExgRpd", "fc.fctl.exchange_responder", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_exchange_responder),
1220 FC_FCTL_EXCHANGE_RESPONDER, "Exchange Responder?", HFILL}},
1221 { &hf_fc_fctl_seq_recipient,
1222 {"SeqRec", "fc.fctl.seq_recipient", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_seq_recipient),
1223 FC_FCTL_SEQ_RECIPIENT, "Seq Recipient?", HFILL}},
1224 { &hf_fc_fctl_exchange_first,
1225 {"ExgFst", "fc.fctl.exchange_first", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_exchange_first),
1226 FC_FCTL_EXCHANGE_FIRST, "First Exchange?", HFILL}},
1227 { &hf_fc_fctl_exchange_last,
1228 {"ExgLst", "fc.fctl.exchange_last", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_exchange_last),
1229 FC_FCTL_EXCHANGE_LAST, "Last Exchange?", HFILL}},
1230 { &hf_fc_fctl_seq_last,
1231 {"SeqLst", "fc.fctl.seq_last", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_seq_last),
1232 FC_FCTL_SEQ_LAST, "Last Sequence?", HFILL}},
1233 { &hf_fc_fctl_priority,
1234 {"Pri", "fc.fctl.priority", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_priority),
1235 FC_FCTL_PRIORITY, "Priority", HFILL}},
1236 { &hf_fc_fctl_transfer_seq_initiative,
1237 {"TSI", "fc.fctl.transfer_seq_initiative", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_transfer_seq_initiative),
1238 FC_FCTL_TRANSFER_SEQ_INITIATIVE, "Transfer Seq Initiative", HFILL}},
1239 { &hf_fc_fctl_rexmitted_seq,
1240 {"RetSeq", "fc.fctl.rexmitted_seq", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_rexmitted_seq),
1241 FC_FCTL_REXMITTED_SEQ, "Retransmitted Sequence", HFILL}},
1242 { &hf_fc_fctl_rel_offset,
1243 {"RelOff", "fc.fctl.rel_offset", FT_BOOLEAN, 24, TFS(&tfs_fc_fctl_rel_offset),
1244 FC_FCTL_REL_OFFSET, "rel offset", HFILL}},
1245 { &hf_fc_fctl_last_data_frame,
1246 {"LDF", "fc.fctl.last_data_frame", FT_UINT24, BASE_HEX, VALS(last_data_frame_vals),
1247 FC_FCTL_LAST_DATA_FRAME_MASK, "Last Data Frame?", HFILL}},
1248 { &hf_fc_fctl_ack_0_1,
1249 {"A01", "fc.fctl.ack_0_1", FT_UINT24, BASE_HEX, VALS(ack_0_1_vals),
1250 FC_FCTL_ACK_0_1_MASK, "Ack 0/1 value", HFILL}},
1251 { &hf_fc_fctl_abts_ack,
1252 {"AA", "fc.fctl.abts_ack", FT_UINT24, BASE_HEX, VALS(abts_ack_vals),
1253 FC_FCTL_ABTS_MASK, "ABTS ACK values", HFILL}},
1254 { &hf_fc_fctl_abts_not_ack,
1255 {"AnA", "fc.fctl.abts_not_ack", FT_UINT24, BASE_HEX, VALS(abts_not_ack_vals),
1256 FC_FCTL_ABTS_MASK, "ABTS not ACK vals", HFILL}},
1257 { &hf_fc_exchange_first_frame,
1258 { "Exchange First In", "fc.exchange_first_frame", FT_FRAMENUM, BASE_NONE, NULL,
1259 0, "The first frame of this exchange is in this frame", HFILL }},
1260 { &hf_fc_exchange_last_frame,
1261 { "Exchange Last In", "fc.exchange_last_frame", FT_FRAMENUM, BASE_NONE, NULL,
1262 0, "The last frame of this exchange is in this frame", HFILL }},
1264 { "Time from Exchange First", "fc.time", FT_RELATIVE_TIME, BASE_NONE, NULL,
1265 0, "Time since the first frame of the Exchange", HFILL }},
1268 /* Setup protocol subtree array */
1269 static gint *ett[] = {
1275 module_t *fc_module;
1277 /* Register the protocol name and description */
1278 proto_fc = proto_register_protocol ("Fibre Channel", "FC", "fc");
1279 register_dissector ("fc", dissect_fc, proto_fc);
1280 fc_tap = register_tap("fc");
1282 /* Required function calls to register the header fields and subtrees used */
1283 proto_register_field_array(proto_fc, hf, array_length(hf));
1284 proto_register_subtree_array(ett, array_length(ett));
1286 fcftype_dissector_table = register_dissector_table ("fc.ftype",
1288 FT_UINT8, BASE_HEX);
1290 /* Register preferences */
1291 fc_module = prefs_register_protocol (proto_fc, NULL);
1292 prefs_register_bool_preference (fc_module,
1294 "Reassemble multi-frame sequences",
1295 "If enabled, reassembly of multi-frame "
1296 "sequences is done",
1298 prefs_register_uint_preference (fc_module,
1299 "max_frame_size", "Max FC Frame Size",
1300 "This is the size of non-last frames in a "
1301 "multi-frame sequence", 10,
1302 &fc_max_frame_size);
1304 register_init_routine(fc_defragment_init);
1305 register_init_routine (fc_exchange_init_protocol);
1309 /* If this dissector uses sub-dissector registration add a registration routine.
1310 This format is required because a script is used to find these routines and
1311 create the code that calls these routines.
1314 proto_reg_handoff_fc (void)
1316 dissector_handle_t fc_handle;
1318 fc_handle = create_dissector_handle (dissect_fc, proto_fc);
1320 data_handle = find_dissector("data");