2 * Routines for Fibre Channel Single Byte Protocol (SBCCS); used in FICON.
3 * This decoder is for FC-SB3 version 1.4
4 * Copyright 2003, Dinesh G Dutt <ddutt@cisco.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
13 * is a dissector file; if you just copied this from README.developer,
14 * don't bother with the "Copied from" - you don't even need to put
15 * in a "Copied from" if you copied an existing dissector, especially
16 * if the bulk of the code in the new dissector is your code)
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41 #ifdef HAVE_SYS_TYPES_H
42 # include <sys/types.h>
45 #ifdef HAVE_NETINET_IN_H
46 # include <netinet/in.h>
51 #include <epan/prefs.h>
52 #include <epan/packet.h>
53 #include <epan/conversation.h>
54 #include <epan/etypes.h>
55 #include "packet-scsi.h"
56 #include "packet-fc.h"
57 #include "packet-fcsb3.h"
59 /* Initialize the protocol and registered fields */
60 static int proto_fc_sbccs = -1;
61 static int hf_sbccs_chid = -1;
62 static int hf_sbccs_cuid = -1;
63 static int hf_sbccs_devaddr = -1;
64 static int hf_sbccs_ccw = -1;
65 static int hf_sbccs_token = -1;
66 static int hf_sbccs_dib_iucnt = -1;
67 static int hf_sbccs_dib_datacnt = -1;
68 static int hf_sbccs_dib_ccw_cmd = -1;
69 static int hf_sbccs_dib_ccw_cnt = -1;
70 static int hf_sbccs_dib_residualcnt = -1;
71 static int hf_sbccs_dib_qtuf = -1;
72 static int hf_sbccs_dib_qtu = -1;
73 static int hf_sbccs_dib_dtuf = -1;
74 static int hf_sbccs_dib_dtu = -1;
75 static int hf_sbccs_dib_ctlfn = -1;
76 static int hf_sbccs_lrc = -1;
77 static int hf_sbccs_dib_iupacing = -1;
78 static int hf_sbccs_dev_xcp_code = -1;
79 static int hf_sbccs_prg_pth_errcode = -1;
80 static int hf_sbccs_prg_rsp_errcode = -1;
81 static int hf_sbccs_dib_ctccntr = -1;
82 static int hf_sbccs_dib_lprcode = -1;
83 static int hf_sbccs_dib_tin_imgid_cnt = -1;
84 static int hf_sbccs_dib_lrjcode = -1;
85 static int hf_sbccs_dib_ioprio = -1;
86 static int hf_sbccs_dib_linkctlfn = -1;
87 static int hf_sbccs_iui = -1;
88 static int hf_sbccs_iui_as = -1;
89 static int hf_sbccs_iui_es = -1;
90 static int hf_sbccs_iui_val = -1;
91 static int hf_sbccs_dhflags = -1;
92 static int hf_sbccs_dhflags_end = -1;
93 static int hf_sbccs_dhflags_chaining = -1;
94 static int hf_sbccs_dhflags_earlyend = -1;
95 static int hf_sbccs_dhflags_nocrc = -1;
96 static int hf_sbccs_dib_ccw_flags = -1;
97 static int hf_sbccs_dib_ccw_flags_cd = -1;
98 static int hf_sbccs_dib_ccw_flags_cc = -1;
99 static int hf_sbccs_dib_ccw_flags_sli = -1;
100 static int hf_sbccs_dib_ccw_flags_crr = -1;
101 static int hf_sbccs_dib_cmdflags = -1;
102 static int hf_sbccs_dib_cmdflags_du = -1;
103 static int hf_sbccs_dib_cmdflags_coc = -1;
104 static int hf_sbccs_dib_cmdflags_syr = -1;
105 static int hf_sbccs_dib_cmdflags_rex = -1;
106 static int hf_sbccs_dib_cmdflags_sss = -1;
107 static int hf_sbccs_dib_statusflags = -1;
108 static int hf_sbccs_dib_statusflags_ffc = -1;
109 static int hf_sbccs_dib_statusflags_ci = -1;
110 static int hf_sbccs_dib_statusflags_cr = -1;
111 static int hf_sbccs_dib_statusflags_lri = -1;
112 static int hf_sbccs_dib_statusflags_rv = -1;
113 static int hf_sbccs_dib_status = -1;
114 static int hf_sbccs_dib_status_attention = -1;
115 static int hf_sbccs_dib_status_modifier = -1;
116 static int hf_sbccs_dib_status_cue = -1;
117 static int hf_sbccs_dib_status_busy = -1;
118 static int hf_sbccs_dib_status_channelend = -1;
119 static int hf_sbccs_dib_status_deviceend = -1;
120 static int hf_sbccs_dib_status_unit_check = -1;
121 static int hf_sbccs_dib_status_unit_exception = -1;
122 static int hf_sbccs_dib_ctlparam = -1;
123 static int hf_sbccs_dib_ctlparam_rc = -1;
124 static int hf_sbccs_dib_ctlparam_ru = -1;
125 static int hf_sbccs_dib_ctlparam_ro = -1;
126 static int hf_sbccs_dib_linkctlinfo = -1;
127 static int hf_sbccs_dib_linkctlinfo_ctcconn = -1;
128 static int hf_sbccs_dib_linkctlinfo_ecrcg = -1;
130 /* Initialize the subtree pointers */
131 static gint ett_fc_sbccs = -1;
132 static gint ett_sbccs_iui = -1;
133 static gint ett_sbccs_dhflags = -1;
134 static gint ett_sbccs_dib_ccw_flags = -1;
135 static gint ett_sbccs_dib_cmdflags = -1;
136 static gint ett_sbccs_dib_statusflags = -1;
137 static gint ett_sbccs_dib_status = -1;
138 static gint ett_sbccs_dib_ctlparam = -1;
139 static gint ett_sbccs_dib_linkctlinfo = -1;
141 static dissector_handle_t data_handle;
148 static const value_string fc_sbccs_iu_val[] = {
149 {FC_SBCCS_IU_DATA, "Data"},
150 {FC_SBCCS_IU_CMD_HDR, "Command Header"},
151 {FC_SBCCS_IU_STATUS, "Status"},
152 {FC_SBCCS_IU_CTL, "Control"},
153 {FC_SBCCS_IU_CMD_DATA, "Command Header & Data"},
154 {FC_SBCCS_IU_CMD_LINK_CTL, "Link Control"},
160 static const value_string fc_sbccs_dib_cmd_val[] = {
166 {5, "Write (Modifier)"},
167 {6, "Read (Modifier)"},
168 {7, "Control (Modifier)"},
170 {9, "Write (Modifier)"},
171 {10, "Read (Modifier)"},
172 {11, "Control (Modifier)"},
173 {12, "Read Backward"},
174 {13, "Write (Modifier)"},
175 {14, "Read (Modifier)"},
176 {15, "Control (Modifier)"},
180 static const value_string fc_sbccs_dib_ctl_fn_val[] = {
181 {FC_SBCCS_CTL_FN_CTL_END, "Control End"},
182 {FC_SBCCS_CTL_FN_CMD_RSP, "Command Response"},
183 {FC_SBCCS_CTL_FN_STK_STS, "Stack Status"},
184 {FC_SBCCS_CTL_FN_CANCEL, "Cancel"},
185 {FC_SBCCS_CTL_FN_SYS_RST, "System Reset"},
186 {FC_SBCCS_CTL_FN_SEL_RST, "Selective Reset"},
187 {FC_SBCCS_CTL_FN_REQ_STS, "Request Status"},
188 {FC_SBCCS_CTL_FN_DEV_XCP, "Device Level Exception"},
189 {FC_SBCCS_CTL_FN_STS_ACC, "Status Accepted"},
190 {FC_SBCCS_CTL_FN_DEV_ACK, "Device-Level Ack"},
191 {FC_SBCCS_CTL_FN_PRG_PTH, "Purge Path"},
192 {FC_SBCCS_CTL_FN_PRG_RSP, "Purge Path Response"},
196 static const value_string fc_sbccs_dib_dev_xcpcode_val[] = {
197 {1, "Address Exception"},
201 static const value_string fc_sbccs_dib_purge_path_err_val[] = {
202 {0, "Error Code Xfer Not Supported"},
203 {1, "SB-3 Protocol Timeout"},
204 {2, "SB-3 Link Failure"},
206 {4, "SB-3 Offline Condition"},
207 {5, "FC-PH Link Failure"},
208 {6, "SB-3 Length Error"},
210 {8, "SB-3 CRC Error"},
211 {9, "IU Count Error"},
212 {10, "SB-3 Link Level Protocol Error"},
213 {11, "SB-3 Device Level Protocol Error"},
214 {12, "Receive ABTS"},
215 {13, "Cancel Function Timeout"},
216 {14, "Abnormal Termination of Xchg"},
221 static const value_string fc_sbccs_dib_purge_path_rsp_err_val[] = {
223 {1, "SB-3 Protocol Timeout"},
224 {2, "SB-3 Link Failure"},
225 {3, "Logical Path Timeout Error"},
226 {4, "SB-3 Offline Condition"},
227 {5, "FC-PH Link Failure"},
228 {6, "SB-3 Length Error"},
230 {8, "SB-3 CRC Error"},
231 {9, "IU Count Error"},
232 {10, "SB-3 Link Level Protocol Error"},
233 {11, "SB-3 Device Level Protocol Error"},
234 {12, "Receive ABTS"},
236 {14, "Abnormal Termination of Xchg"},
237 {15, "Logical Path Not Estd"},
238 {16, "Test Init Result Error"},
242 static const value_string fc_sbccs_dib_link_ctl_fn_val[] = {
243 {FC_SBCCS_LINK_CTL_FN_ELP, "ELP"},
244 {FC_SBCCS_LINK_CTL_FN_RLP, "RLP"},
245 {FC_SBCCS_LINK_CTL_FN_TIN, "TIN"},
246 {FC_SBCCS_LINK_CTL_FN_LPE, "LPE"},
247 {FC_SBCCS_LINK_CTL_FN_LPR, "LPR"},
248 {FC_SBCCS_LINK_CTL_FN_TIR, "TIR"},
249 {FC_SBCCS_LINK_CTL_FN_LRJ, "LRJ"},
250 {FC_SBCCS_LINK_CTL_FN_LBY, "LBY"},
251 {FC_SBCCS_LINK_CTL_FN_LACK, "LACK"},
255 static const value_string fc_sbccs_dib_lpr_errcode_val[] = {
256 {0x0, "Response to RLP"},
257 {0x1, "Optional Features Conflict"},
258 {0x2, "Out of Resources"},
259 {0x3, "Device Init In Progress"},
260 {0x4, "No CU Image"},
264 static const value_string fc_sbccs_dib_lrj_errcode_val[] = {
265 {0x6, "Logical Path Not Estd"},
266 {0x9, "Protocol Error"},
270 static const true_false_string tfs_sbccs_iui_as = {
274 static const true_false_string tfs_sbccs_iui_es = {
280 dissect_iui_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
282 proto_item *item=NULL;
283 proto_tree *tree=NULL;
286 item=proto_tree_add_uint(parent_tree, hf_sbccs_iui,
287 tvb, offset, 1, flags);
288 tree=proto_item_add_subtree(item, ett_sbccs_iui);
291 proto_tree_add_boolean(tree, hf_sbccs_iui_as, tvb, offset, 1, flags);
293 proto_item_append_text(item, " AS");
297 proto_tree_add_boolean(tree, hf_sbccs_iui_es, tvb, offset, 1, flags);
299 proto_item_append_text(item, " ES");
303 proto_tree_add_item (tree, hf_sbccs_iui_val, tvb, offset, 1, 0);
304 proto_item_append_text(item, val_to_str (flags & 0x7, fc_sbccs_iu_val, "0x%x"));
308 static const true_false_string tfs_sbccs_linkctlinfo_ctcconn = {
309 "CTC Conn supported",
310 "Ctc conn NOT supported"
312 static const true_false_string tfs_sbccs_linkctlinfo_ecrcg = {
313 "Enhanced CRC Generation supported",
314 "Enhanced crc generation NOT supported"
318 dissect_linkctlinfo (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
320 proto_item *item=NULL;
321 proto_tree *tree=NULL;
324 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_linkctlinfo,
325 tvb, offset, 2, flags);
326 tree=proto_item_add_subtree(item, ett_sbccs_dib_linkctlinfo);
329 proto_tree_add_boolean(tree, hf_sbccs_dib_linkctlinfo_ctcconn, tvb, offset, 2, flags);
331 proto_item_append_text(item, " CTC Conn");
335 proto_tree_add_boolean(tree, hf_sbccs_dib_linkctlinfo_ecrcg, tvb, offset, 2, flags);
337 proto_item_append_text(item, " Enhanced CRC Gen");
343 static const true_false_string tfs_sbccs_dhflags_end = {
347 static const true_false_string tfs_sbccs_dhflags_chaining = {
348 "CHAINING bit is set",
349 "chaining bit is NOT set"
351 static const true_false_string tfs_sbccs_dhflags_earlyend = {
352 "EARLYEND bit is set",
353 "earlyend bit is NOT set"
355 static const true_false_string tfs_sbccs_dhflags_nocrc = {
357 "nocrc bit is NOT set"
361 dissect_dh_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
363 proto_item *item=NULL;
364 proto_tree *tree=NULL;
367 item=proto_tree_add_uint(parent_tree, hf_sbccs_dhflags,
368 tvb, offset, 1, flags);
369 tree=proto_item_add_subtree(item, ett_sbccs_dhflags);
372 proto_tree_add_boolean(tree, hf_sbccs_dhflags_end, tvb, offset, 1, flags);
374 proto_item_append_text(item, " End");
378 proto_tree_add_boolean(tree, hf_sbccs_dhflags_chaining, tvb, offset, 1, flags);
380 proto_item_append_text(item, " Chaining");
384 proto_tree_add_boolean(tree, hf_sbccs_dhflags_earlyend, tvb, offset, 1, flags);
386 proto_item_append_text(item, " Early End");
390 proto_tree_add_boolean(tree, hf_sbccs_dhflags_nocrc, tvb, offset, 1, flags);
392 proto_item_append_text(item, " No CRC");
397 static const true_false_string tfs_sbccs_ccwflags_cd = {
401 static const true_false_string tfs_sbccs_ccwflags_cc = {
405 static const true_false_string tfs_sbccs_ccwflags_sli = {
409 static const true_false_string tfs_sbccs_ccwflags_crr = {
415 dissect_ccw_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
417 proto_item *item=NULL;
418 proto_tree *tree=NULL;
421 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ccw_flags,
422 tvb, offset, 1, flags);
423 tree=proto_item_add_subtree(item, ett_sbccs_dib_ccw_flags);
426 proto_tree_add_boolean(tree, hf_sbccs_dib_ccw_flags_cd, tvb, offset, 1, flags);
428 proto_item_append_text(item, " CD");
432 proto_tree_add_boolean(tree, hf_sbccs_dib_ccw_flags_cc, tvb, offset, 1, flags);
434 proto_item_append_text(item, " CC");
438 proto_tree_add_boolean(tree, hf_sbccs_dib_ccw_flags_sli, tvb, offset, 1, flags);
440 proto_item_append_text(item, " SLI");
444 proto_tree_add_boolean(tree, hf_sbccs_dib_ccw_flags_crr, tvb, offset, 1, flags);
446 proto_item_append_text(item, " CRR");
451 static const true_false_string tfs_sbccs_cmdflags_du = {
455 static const true_false_string tfs_sbccs_cmdflags_coc = {
459 static const true_false_string tfs_sbccs_cmdflags_syr = {
463 static const true_false_string tfs_sbccs_cmdflags_rex = {
467 static const true_false_string tfs_sbccs_cmdflags_sss = {
473 dissect_cmd_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
475 proto_item *item=NULL;
476 proto_tree *tree=NULL;
479 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_cmdflags,
480 tvb, offset, 1, flags);
481 tree=proto_item_add_subtree(item, ett_sbccs_dib_cmdflags);
484 proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_du, tvb, offset, 1, flags);
486 proto_item_append_text(item, " DU");
490 proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_coc, tvb, offset, 1, flags);
492 proto_item_append_text(item, " COC");
496 proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_syr, tvb, offset, 1, flags);
498 proto_item_append_text(item, " SYR");
502 proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_rex, tvb, offset, 1, flags);
504 proto_item_append_text(item, " REX");
508 proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_sss, tvb, offset, 1, flags);
510 proto_item_append_text(item, " SSS");
515 static const value_string status_ffc_val[] = {
517 { 1, "FFC:Queuing Information Valid" },
518 { 2, "FFC:Resetting Event" },
522 static const true_false_string tfs_sbccs_statusflags_ci = {
526 static const true_false_string tfs_sbccs_statusflags_cr = {
530 static const true_false_string tfs_sbccs_statusflags_lri = {
534 static const true_false_string tfs_sbccs_statusflags_rv = {
540 dissect_status_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
542 proto_item *item=NULL;
543 proto_tree *tree=NULL;
546 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_statusflags,
547 tvb, offset, 1, flags);
548 tree=proto_item_add_subtree(item, ett_sbccs_dib_statusflags);
552 proto_tree_add_item (tree, hf_sbccs_dib_statusflags_ffc, tvb, offset, 1, 0);
553 proto_item_append_text(item, val_to_str ((flags>>5)&0x07, status_ffc_val, "Reserved:0x%x"));
556 proto_tree_add_boolean(tree, hf_sbccs_dib_statusflags_ci, tvb, offset, 1, flags);
558 proto_item_append_text(item, " CI");
562 proto_tree_add_boolean(tree, hf_sbccs_dib_statusflags_cr, tvb, offset, 1, flags);
564 proto_item_append_text(item, " CR");
568 proto_tree_add_boolean(tree, hf_sbccs_dib_statusflags_lri, tvb, offset, 1, flags);
570 proto_item_append_text(item, " LRI");
574 proto_tree_add_boolean(tree, hf_sbccs_dib_statusflags_rv, tvb, offset, 1, flags);
576 proto_item_append_text(item, " RV");
582 static const true_false_string tfs_sbccs_status_attention = {
584 "attention is NOT set"
586 static const true_false_string tfs_sbccs_status_modifier = {
587 "STATUS MODIFIER is set",
588 "status modifier is NOT set"
590 static const true_false_string tfs_sbccs_status_cue = {
591 "CONTROL-UNIT END is set",
592 "control-unit end is NOT set"
594 static const true_false_string tfs_sbccs_status_busy = {
598 static const true_false_string tfs_sbccs_status_channelend = {
599 "CHANNEL-END is set",
600 "channel-end is NOT set"
602 static const true_false_string tfs_sbccs_status_deviceend = {
604 "device-end is NOT set"
606 static const true_false_string tfs_sbccs_status_unitcheck = {
608 "unit check is NOT set"
610 static const true_false_string tfs_sbccs_status_unitexception = {
611 "UNIT EXCEPTION is set",
612 "unit exception is NOT set"
616 dissect_status (packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
618 proto_item *item=NULL;
619 proto_tree *tree=NULL;
622 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_status,
623 tvb, offset, 1, flags);
624 tree=proto_item_add_subtree(item, ett_sbccs_dib_status);
628 proto_tree_add_boolean(tree, hf_sbccs_dib_status_attention, tvb, offset, 1, flags);
630 proto_item_append_text(item, " Attention");
631 if (check_col(pinfo->cinfo, COL_INFO)) {
632 col_append_str(pinfo->cinfo, COL_INFO, " Attention");
637 proto_tree_add_boolean(tree, hf_sbccs_dib_status_modifier, tvb, offset, 1, flags);
639 proto_item_append_text(item, " Status Modifier");
640 if (check_col(pinfo->cinfo, COL_INFO)) {
641 col_append_str(pinfo->cinfo, COL_INFO, " Status Modifier");
646 proto_tree_add_boolean(tree, hf_sbccs_dib_status_cue, tvb, offset, 1, flags);
648 proto_item_append_text(item, " Control-Unit End");
649 if (check_col(pinfo->cinfo, COL_INFO)) {
650 col_append_str(pinfo->cinfo, COL_INFO, " Control-Unit End");
655 proto_tree_add_boolean(tree, hf_sbccs_dib_status_busy, tvb, offset, 1, flags);
657 proto_item_append_text(item, " Busy");
658 if (check_col(pinfo->cinfo, COL_INFO)) {
659 col_append_str(pinfo->cinfo, COL_INFO, " Busy");
664 proto_tree_add_boolean(tree, hf_sbccs_dib_status_channelend, tvb, offset, 1, flags);
666 proto_item_append_text(item, " Channel End");
667 if (check_col(pinfo->cinfo, COL_INFO)) {
668 col_append_str(pinfo->cinfo, COL_INFO, " Channel End");
673 proto_tree_add_boolean(tree, hf_sbccs_dib_status_deviceend, tvb, offset, 1, flags);
675 proto_item_append_text(item, " Device End");
676 if (check_col(pinfo->cinfo, COL_INFO)) {
677 col_append_str(pinfo->cinfo, COL_INFO, " Device End");
682 proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_check, tvb, offset, 1, flags);
684 proto_item_append_text(item, " Unit Check");
685 if (check_col(pinfo->cinfo, COL_INFO)) {
686 col_append_str(pinfo->cinfo, COL_INFO, " Unit Check");
691 proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_exception, tvb, offset, 1, flags);
693 proto_item_append_text(item, " Unit Exception");
694 if (check_col(pinfo->cinfo, COL_INFO)) {
695 col_append_str(pinfo->cinfo, COL_INFO, " Unit Exception");
702 static const true_false_string tfs_sbccs_ctlparam_rc = {
706 static const true_false_string tfs_sbccs_ctlparam_ru = {
710 static const true_false_string tfs_sbccs_ctlparam_ro = {
716 dissect_sel_rst_param (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint32 flags)
718 proto_item *item=NULL;
719 proto_tree *tree=NULL;
722 item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ctlparam,
723 tvb, offset, 3, flags);
724 tree=proto_item_add_subtree(item, ett_sbccs_dib_ctlparam);
727 proto_tree_add_boolean(tree, hf_sbccs_dib_ctlparam_rc, tvb, offset, 3, flags);
729 proto_item_append_text(item, " RC");
733 proto_tree_add_boolean(tree, hf_sbccs_dib_ctlparam_ru, tvb, offset, 3, flags);
735 proto_item_append_text(item, " RU");
739 proto_tree_add_boolean(tree, hf_sbccs_dib_ctlparam_ro, tvb, offset, 3, flags);
741 proto_item_append_text(item, " RO");
746 static void get_fc_sbccs_conv_data (tvbuff_t *tvb, guint offset,
747 guint16 *ch_cu_id, guint16 *dev_addr,
750 *ch_cu_id = *dev_addr = *ccw = 0;
752 *ch_cu_id = (tvb_get_guint8 (tvb, offset+1)) << 8;
753 *ch_cu_id |= tvb_get_guint8 (tvb, offset+3);
754 *dev_addr = tvb_get_ntohs (tvb, offset+4);
755 *ccw = tvb_get_ntohs (tvb, offset+10);
758 /* Decode both the SB-3 and basic IU header */
760 dissect_fc_sbccs_sb3_iu_hdr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
764 proto_tree *sb3hdr_tree;
765 proto_tree *iuhdr_tree;
769 /* Decode the basic SB3 and IU header and determine type of frame */
770 type = get_fc_sbccs_iu_type (tvb, offset);
772 if (check_col (pinfo->cinfo, COL_INFO)) {
773 col_set_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val,
778 /* Dissect SB3 header first */
779 subti = proto_tree_add_text (tree, tvb, offset, FC_SBCCS_SB3_HDR_SIZE,
781 sb3hdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);
783 proto_tree_add_item (sb3hdr_tree, hf_sbccs_chid, tvb, offset+1, 1, 0);
784 proto_tree_add_item (sb3hdr_tree, hf_sbccs_cuid, tvb, offset+3, 1, 0);
785 proto_tree_add_item (sb3hdr_tree, hf_sbccs_devaddr, tvb, offset+4, 2, 0);
787 /* Dissect IU Header */
788 subti = proto_tree_add_text (tree, tvb, offset + FC_SBCCS_SB3_HDR_SIZE,
789 FC_SBCCS_IU_HDR_SIZE, "IU Header");
790 iuhdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);
791 offset += FC_SBCCS_SB3_HDR_SIZE;
793 iui = tvb_get_guint8 (tvb, offset);
794 dissect_iui_flags(iuhdr_tree, tvb, offset, iui);
796 dhflags = tvb_get_guint8 (tvb, offset+1);
797 dissect_dh_flags(iuhdr_tree, tvb, offset+1, dhflags);
799 proto_tree_add_item (iuhdr_tree, hf_sbccs_ccw, tvb, offset+2, 2, 0);
800 proto_tree_add_item (iuhdr_tree, hf_sbccs_token, tvb, offset+5, 3, 0);
804 static void dissect_fc_sbccs_dib_data_hdr (tvbuff_t *tvb,
805 packet_info *pinfo _U_,
806 proto_tree *tree, guint offset)
809 proto_tree_add_item (tree, hf_sbccs_dib_iucnt, tvb, offset+9, 1, 0);
810 proto_tree_add_item (tree, hf_sbccs_dib_datacnt, tvb, offset+10, 2, 0);
811 proto_tree_add_item (tree, hf_sbccs_lrc, tvb, offset+12, 4, 0);
815 static void dissect_fc_sbccs_dib_cmd_hdr (tvbuff_t *tvb, packet_info *pinfo,
816 proto_tree *tree, guint offset)
820 if (check_col (pinfo->cinfo, COL_INFO)) {
821 col_append_fstr (pinfo->cinfo, COL_INFO,
822 ": %s", val_to_str (tvb_get_guint8 (tvb, offset),
823 fc_sbccs_dib_cmd_val,
828 proto_tree_add_item (tree, hf_sbccs_dib_ccw_cmd, tvb, offset, 1, 0);
830 flags = tvb_get_guint8 (tvb, offset+1);
831 dissect_ccw_flags(tree, tvb, offset+1, flags);
833 proto_tree_add_item (tree, hf_sbccs_dib_ccw_cnt, tvb, offset+2, 2, 0);
834 proto_tree_add_item (tree, hf_sbccs_dib_ioprio, tvb, offset+5, 1, 0);
836 flags = tvb_get_guint8 (tvb, offset+7);
837 dissect_cmd_flags(tree, tvb, offset+7, flags);
839 proto_tree_add_item (tree, hf_sbccs_dib_iucnt, tvb, offset+9, 1, 0);
840 proto_tree_add_item (tree, hf_sbccs_dib_datacnt, tvb, offset+10, 2, 0);
841 proto_tree_add_item (tree, hf_sbccs_lrc, tvb, offset+12, 4, 0);
846 static void dissect_fc_sbccs_dib_status_hdr (tvbuff_t *tvb, packet_info *pinfo,
847 proto_tree *tree, guint offset)
850 gboolean rv_valid, qparam_valid;
852 guint16 supp_status_cnt = 0;
855 flags = tvb_get_guint8 (tvb, offset);
856 rv_valid = flags & 0x1; /* if residual count is valid */
857 qparam_valid = (((flags & 0xE0) >> 5) == 0x1); /* From the FFC field */
858 dissect_status_flags(tree, tvb, offset, flags);
860 flags = tvb_get_guint8 (tvb, offset+1);
861 dissect_status(pinfo, tree, tvb, offset+1, flags);
864 proto_tree_add_item (tree, hf_sbccs_dib_residualcnt, tvb, offset+2,
868 proto_tree_add_item (tree, hf_sbccs_dib_iupacing, tvb, offset+3,
873 proto_tree_add_item (tree, hf_sbccs_dib_qtuf, tvb, offset+4, 1, 0);
874 proto_tree_add_item (tree, hf_sbccs_dib_qtu, tvb, offset+4, 2, 0);
877 proto_tree_add_item (tree, hf_sbccs_dib_dtuf, tvb, offset+6, 1, 0);
878 proto_tree_add_item (tree, hf_sbccs_dib_dtu, tvb, offset+6, 2, 0);
880 proto_tree_add_item (tree, hf_sbccs_dib_iucnt, tvb, offset+9, 1, 0);
881 proto_tree_add_item (tree, hf_sbccs_dib_datacnt, tvb, offset+10, 2, 0);
882 supp_status_cnt = tvb_get_ntohs (tvb, offset+10);
883 proto_tree_add_item (tree, hf_sbccs_lrc, tvb, offset+12, 4, 0);
885 if (supp_status_cnt) {
886 next_tvb = tvb_new_subset (tvb, offset+FC_SBCCS_DIB_LRC_HDR_SIZE,
888 call_dissector (data_handle, next_tvb, pinfo, tree);
893 static void dissect_fc_sbccs_dib_ctl_hdr (tvbuff_t *tvb, packet_info *pinfo,
894 proto_tree *tree, guint offset)
898 ctlfn = tvb_get_guint8 (tvb, offset);
899 if (check_col (pinfo->cinfo, COL_INFO)) {
900 col_append_fstr (pinfo->cinfo, COL_INFO,
903 fc_sbccs_dib_ctl_fn_val,
907 proto_tree_add_item (tree, hf_sbccs_dib_ctlfn, tvb, offset, 1, 0);
909 /* Control Function Parameter is to be interpreted in some cases */
911 case FC_SBCCS_CTL_FN_SEL_RST:
912 dissect_sel_rst_param(tree, tvb, offset+1, tvb_get_ntoh24 (tvb, offset+1));
914 case FC_SBCCS_CTL_FN_DEV_XCP:
915 proto_tree_add_item (tree, hf_sbccs_dev_xcp_code, tvb, offset+1,
918 case FC_SBCCS_CTL_FN_PRG_PTH:
919 proto_tree_add_item (tree, hf_sbccs_prg_pth_errcode, tvb, offset+1,
923 proto_tree_add_item (tree, hf_sbccs_dib_ctlparam, tvb, offset+1,
928 proto_tree_add_item (tree, hf_sbccs_dib_iucnt, tvb, offset+9, 1, 0);
929 proto_tree_add_item (tree, hf_sbccs_dib_datacnt, tvb, offset+10, 2, 0);
930 proto_tree_add_item (tree, hf_sbccs_lrc, tvb, offset+12, 4, 0);
932 if (ctlfn == FC_SBCCS_CTL_FN_PRG_RSP) {
933 /* Need to decode the LESBs */
934 proto_tree_add_item (tree, hf_sbccs_prg_rsp_errcode, tvb, offset+60,
940 static void dissect_fc_sbccs_dib_link_hdr (tvbuff_t *tvb, packet_info *pinfo,
941 proto_tree *tree, guint offset)
945 guint link_payload_len, i;
947 if (check_col (pinfo->cinfo, COL_INFO)) {
948 col_append_fstr (pinfo->cinfo, COL_INFO,
950 val_to_str (tvb_get_guint8 (tvb, offset+1),
951 fc_sbccs_dib_link_ctl_fn_val,
956 link_ctl = tvb_get_guint8 (tvb, offset+1);
957 proto_tree_add_item (tree, hf_sbccs_dib_linkctlfn, tvb, offset+1, 1, 0);
959 ctl_info = tvb_get_ntohs (tvb, offset+2);
961 case FC_SBCCS_LINK_CTL_FN_ELP:
962 case FC_SBCCS_LINK_CTL_FN_LPE:
963 dissect_linkctlinfo(tree, tvb, offset+2, ctl_info);
965 case FC_SBCCS_LINK_CTL_FN_LPR:
966 proto_tree_add_item (tree, hf_sbccs_dib_lprcode, tvb, offset+2, 1,
969 case FC_SBCCS_LINK_CTL_FN_TIN:
970 proto_tree_add_item (tree, hf_sbccs_dib_tin_imgid_cnt, tvb,
973 case FC_SBCCS_LINK_CTL_FN_TIR:
974 proto_tree_add_item (tree, hf_sbccs_dib_tin_imgid_cnt, tvb,
977 case FC_SBCCS_LINK_CTL_FN_LRJ:
978 proto_tree_add_item (tree, hf_sbccs_dib_lrjcode, tvb, offset+2,
986 proto_tree_add_item (tree, hf_sbccs_dib_ctccntr, tvb, offset+4, 2, 0);
987 proto_tree_add_item (tree, hf_sbccs_dib_iucnt, tvb, offset+9, 1, 0);
988 proto_tree_add_item (tree, hf_sbccs_dib_datacnt, tvb, offset+10, 2, 0);
989 proto_tree_add_item (tree, hf_sbccs_lrc, tvb, offset+12, 4, 0);
991 if (link_ctl == FC_SBCCS_LINK_CTL_FN_TIR) {
992 link_payload_len = tvb_get_ntohs (tvb, offset+10);
996 while (i < link_payload_len) {
997 proto_tree_add_text (tree, tvb, offset, 4,
998 "Logical Paths %d-%d: %s",
1000 tvb_bytes_to_str_punct (tvb, offset, 4, ':'));
1008 static void dissect_fc_sbccs (tvbuff_t *tvb, packet_info *pinfo,
1012 guint16 ch_cu_id, dev_addr, ccw;
1015 proto_tree *sb3_tree = NULL,
1018 conversation_t *conversation;
1019 sb3_task_id_t task_key;
1021 /* Make entries in Protocol column and Info column on summary display */
1022 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1023 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC-SB3");
1025 /* Decode the basic SB3 and IU header and determine type of frame */
1026 type = get_fc_sbccs_iu_type (tvb, offset);
1027 get_fc_sbccs_conv_data (tvb, offset, &ch_cu_id, &dev_addr, &ccw);
1029 if (check_col (pinfo->cinfo, COL_INFO)) {
1030 col_set_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val,
1034 /* Retrieve conversation state to determine expected payload */
1035 conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1036 PT_SBCCS, ch_cu_id, dev_addr, 0);
1039 task_key.conv_id = conversation->index;
1040 task_key.task_id = ccw;
1041 pinfo->private_data = (void *)&task_key;
1044 else if ((type == FC_SBCCS_IU_CMD_HDR) ||
1045 (type != FC_SBCCS_IU_CMD_DATA)) {
1046 conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
1047 PT_SBCCS, ch_cu_id, dev_addr, 0);
1048 task_key.conv_id = conversation->index;
1049 task_key.task_id = ccw;
1050 pinfo->private_data = (void *)&task_key;
1053 pinfo->private_data = NULL;
1057 ti = proto_tree_add_protocol_format (tree, proto_fc_sbccs, tvb, 0, -1,
1059 sb3_tree = proto_item_add_subtree (ti, ett_fc_sbccs);
1061 dissect_fc_sbccs_sb3_iu_hdr (tvb, pinfo, sb3_tree, offset);
1062 offset += (FC_SBCCS_SB3_HDR_SIZE + FC_SBCCS_IU_HDR_SIZE);
1064 ti = proto_tree_add_text (sb3_tree, tvb, offset,
1065 FC_SBCCS_DIB_LRC_HDR_SIZE, "DIB Header");
1066 dib_tree = proto_item_add_subtree (ti, ett_fc_sbccs);
1069 offset += (FC_SBCCS_SB3_HDR_SIZE + FC_SBCCS_IU_HDR_SIZE);
1073 case FC_SBCCS_IU_DATA:
1074 dissect_fc_sbccs_dib_data_hdr (tvb, pinfo, dib_tree, offset);
1076 case FC_SBCCS_IU_CMD_HDR:
1077 case FC_SBCCS_IU_CMD_DATA:
1078 dissect_fc_sbccs_dib_cmd_hdr (tvb, pinfo, dib_tree, offset);
1080 case FC_SBCCS_IU_STATUS:
1081 dissect_fc_sbccs_dib_status_hdr (tvb, pinfo, dib_tree, offset);
1083 case FC_SBCCS_IU_CTL:
1084 dissect_fc_sbccs_dib_ctl_hdr (tvb, pinfo, dib_tree, offset);
1086 case FC_SBCCS_IU_CMD_LINK_CTL:
1087 dissect_fc_sbccs_dib_link_hdr (tvb, pinfo, dib_tree, offset);
1090 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
1091 call_dissector (data_handle, next_tvb, pinfo, dib_tree);
1095 if ((get_fc_sbccs_iu_type (tvb, 0) != FC_SBCCS_IU_CTL) &&
1096 (get_fc_sbccs_iu_type (tvb, 0) != FC_SBCCS_IU_CMD_LINK_CTL)) {
1097 next_tvb = tvb_new_subset (tvb, offset+FC_SBCCS_DIB_LRC_HDR_SIZE,
1099 call_dissector (data_handle, next_tvb, pinfo, tree);
1103 /* Register the protocol with Wireshark */
1105 /* this format is required because a script is used to build the C function
1106 that calls all the protocol registration.
1110 proto_register_fcsbccs (void)
1112 /* Setup list of header fields See Section 1.6.1 for details*/
1113 static hf_register_info hf[] = {
1115 {"Channel Image ID", "sbccs.chid", FT_UINT8, BASE_DEC, NULL, 0x0,
1118 {"Control Unit Image ID", "sbccs.cuid", FT_UINT8, BASE_DEC, NULL,
1120 { &hf_sbccs_devaddr,
1121 {"Device Address", "sbccs.devaddr", FT_UINT16, BASE_DEC, NULL, 0x0,
1124 {"Information Unit Identifier", "sbccs.iui", FT_UINT8, BASE_HEX,
1125 NULL, 0x0, "", HFILL}},
1126 { &hf_sbccs_dhflags,
1127 {"DH Flags", "sbccs.dhflags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
1130 {"CCW Number", "sbccs.ccw", FT_UINT16, BASE_HEX, NULL, 0x0, "",
1133 {"Token", "sbccs.token", FT_UINT24, BASE_DEC, NULL, 0x0, "",
1135 { &hf_sbccs_dib_iucnt,
1136 {"DIB IU Count", "sbccs.iucnt", FT_UINT8, BASE_DEC, NULL, 0x0,
1138 { &hf_sbccs_dib_datacnt,
1139 {"DIB Data Byte Count", "sbccs.databytecnt", FT_UINT16, BASE_DEC,
1140 NULL, 0x0, "", HFILL}},
1141 { &hf_sbccs_dib_ccw_cmd,
1142 {"CCW Command", "sbccs.ccwcmd", FT_UINT8, BASE_HEX,
1143 VALS (fc_sbccs_dib_cmd_val), 0x0, "", HFILL}},
1144 { &hf_sbccs_dib_ccw_cnt,
1145 {"CCW Count", "sbccs.ccwcnt", FT_UINT16, BASE_DEC, NULL, 0x0, "",
1147 { &hf_sbccs_dib_ioprio,
1148 {"I/O Priority", "sbccs.ioprio", FT_UINT8, BASE_DEC, NULL, 0x0,
1150 { &hf_sbccs_dib_status,
1151 {"Status", "sbccs.status", FT_UINT8, BASE_HEX, NULL, 0x0, "",
1153 { &hf_sbccs_dib_residualcnt,
1154 {"Residual Count", "sbccs.residualcnt", FT_UINT8, BASE_DEC,
1155 NULL, 0x0, "", HFILL}},
1156 { &hf_sbccs_dib_iupacing,
1157 {"IU Pacing", "sbccs.iupacing", FT_UINT8, BASE_DEC, NULL, 0x0,
1159 { &hf_sbccs_dib_qtuf,
1160 {"Queue-Time Unit Factor", "sbccs.qtuf", FT_UINT8, BASE_DEC,
1161 NULL, 0xF0, "", HFILL}},
1162 { &hf_sbccs_dib_qtu,
1163 {"Queue-Time Unit", "sbccs.qtu", FT_UINT16, BASE_DEC, NULL, 0xFFF,
1165 { &hf_sbccs_dib_dtuf,
1166 {"Defer-Time Unit Function", "sbccs.dtuf", FT_UINT8, BASE_DEC,
1167 NULL, 0xF0, "", HFILL}},
1168 { &hf_sbccs_dib_dtu,
1169 {"Defer-Time Unit", "sbccs.dtu", FT_UINT16, BASE_DEC, NULL, 0xFFF,
1171 { &hf_sbccs_dib_ctlfn,
1172 {"Control Function", "sbccs.ctlfn", FT_UINT8, BASE_HEX,
1173 VALS (fc_sbccs_dib_ctl_fn_val), 0x0, "", HFILL}},
1174 { &hf_sbccs_dib_linkctlfn,
1175 {"Link Control Function", "sbccs.linkctlfn", FT_UINT8, BASE_HEX,
1176 VALS (fc_sbccs_dib_link_ctl_fn_val), 0x0, "", HFILL}},
1177 { &hf_sbccs_dib_ctccntr,
1178 {"CTC Counter", "sbccs.ctccntr", FT_UINT16, BASE_DEC, NULL, 0x0,
1181 {"LRC", "sbccs.lrc", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
1182 { &hf_sbccs_dev_xcp_code,
1183 {"Device Level Exception Code", "sbccs.dip.xcpcode", FT_UINT8,
1184 BASE_DEC, VALS (fc_sbccs_dib_dev_xcpcode_val), 0x0, "", HFILL}},
1185 { &hf_sbccs_prg_pth_errcode,
1186 {"Purge Path Error Code", "sbccs.purgepathcode", FT_UINT8,
1187 BASE_DEC, VALS (fc_sbccs_dib_purge_path_err_val), 0x0, "", HFILL}},
1188 { &hf_sbccs_prg_rsp_errcode,
1189 {"Purge Path Response Error Code", "sbccs.purgepathrspcode",
1190 FT_UINT8, BASE_DEC, VALS (fc_sbccs_dib_purge_path_rsp_err_val),
1192 { &hf_sbccs_dib_lprcode,
1193 {"LPR Reason Code", "sbccs.lprcode", FT_UINT8, BASE_DEC,
1194 VALS (fc_sbccs_dib_lpr_errcode_val), 0xF, "", HFILL}},
1195 { &hf_sbccs_dib_tin_imgid_cnt,
1196 {"TIN Image ID", "sbccs.tinimageidcnt", FT_UINT8, BASE_DEC, NULL,
1198 { &hf_sbccs_dib_lrjcode,
1199 {"LRJ Reaspn Code", "sbccs.lrjcode", FT_UINT8, BASE_HEX,
1200 VALS (fc_sbccs_dib_lrj_errcode_val), 0x7F, "", HFILL}},
1202 {"AS", "sbccs.iui.as", FT_BOOLEAN, 8,
1203 TFS(&tfs_sbccs_iui_as), 0x10, "", HFILL}},
1205 {"ES", "sbccs.iui.es", FT_BOOLEAN, 8,
1206 TFS(&tfs_sbccs_iui_es), 0x08, "", HFILL}},
1207 { &hf_sbccs_iui_val,
1208 {"Val", "sbccs.iui.val", FT_UINT8, BASE_HEX,
1209 VALS(fc_sbccs_iu_val), 0x07, "", HFILL}},
1210 { &hf_sbccs_dhflags_end,
1211 {"End", "sbccs.dhflags.end", FT_BOOLEAN, 8,
1212 TFS(&tfs_sbccs_dhflags_end), 0x80, "", HFILL}},
1213 { &hf_sbccs_dhflags_chaining,
1214 {"Chaining", "sbccs.dhflags.chaining", FT_BOOLEAN, 8,
1215 TFS(&tfs_sbccs_dhflags_chaining), 0x10, "", HFILL}},
1216 { &hf_sbccs_dhflags_earlyend,
1217 {"Early End", "sbccs.dhflags.earlyend", FT_BOOLEAN, 8,
1218 TFS(&tfs_sbccs_dhflags_earlyend), 0x08, "", HFILL}},
1219 { &hf_sbccs_dhflags_nocrc,
1220 {"No CRC", "sbccs.dhflags.nocrc", FT_BOOLEAN, 8,
1221 TFS(&tfs_sbccs_dhflags_nocrc), 0x04, "", HFILL}},
1222 { &hf_sbccs_dib_ccw_flags,
1223 {"CCW Control Flags", "sbccs.ccwflags", FT_UINT8, BASE_HEX, NULL,
1225 { &hf_sbccs_dib_ccw_flags_cd,
1226 {"CD", "sbccs.ccwflags.cd", FT_BOOLEAN, 8,
1227 TFS(&tfs_sbccs_ccwflags_cd), 0x80, "", HFILL}},
1228 { &hf_sbccs_dib_ccw_flags_cc,
1229 {"CC", "sbccs.ccwflags.cc", FT_BOOLEAN, 8,
1230 TFS(&tfs_sbccs_ccwflags_cc), 0x40, "", HFILL}},
1231 { &hf_sbccs_dib_ccw_flags_sli,
1232 {"SLI", "sbccs.ccwflags.sli", FT_BOOLEAN, 8,
1233 TFS(&tfs_sbccs_ccwflags_sli), 0x20, "", HFILL}},
1234 { &hf_sbccs_dib_ccw_flags_crr,
1235 {"CRR", "sbccs.ccwflags.crr", FT_BOOLEAN, 8,
1236 TFS(&tfs_sbccs_ccwflags_crr), 0x08, "", HFILL}},
1237 { &hf_sbccs_dib_cmdflags,
1238 {"Command Flags", "sbccs.cmdflags", FT_UINT8, BASE_HEX, NULL, 0x0,
1240 { &hf_sbccs_dib_cmdflags_du,
1241 {"DU", "sbccs.cmdflags.du", FT_BOOLEAN, 8,
1242 TFS(&tfs_sbccs_cmdflags_du), 0x10, "", HFILL}},
1243 { &hf_sbccs_dib_cmdflags_coc,
1244 {"COC", "sbccs.cmdflags.coc", FT_BOOLEAN, 8,
1245 TFS(&tfs_sbccs_cmdflags_coc), 0x08, "", HFILL}},
1246 { &hf_sbccs_dib_cmdflags_syr,
1247 {"SYR", "sbccs.cmdflags.syr", FT_BOOLEAN, 8,
1248 TFS(&tfs_sbccs_cmdflags_syr), 0x04, "", HFILL}},
1249 { &hf_sbccs_dib_cmdflags_rex,
1250 {"REX", "sbccs.cmdflags.rex", FT_BOOLEAN, 8,
1251 TFS(&tfs_sbccs_cmdflags_rex), 0x02, "", HFILL}},
1252 { &hf_sbccs_dib_cmdflags_sss,
1253 {"SSS", "sbccs.cmdflags.sss", FT_BOOLEAN, 8,
1254 TFS(&tfs_sbccs_cmdflags_sss), 0x01, "", HFILL}},
1255 { &hf_sbccs_dib_statusflags,
1256 {"Status Flags", "sbccs.statusflags", FT_UINT8, BASE_HEX,
1257 NULL, 0, "", HFILL}},
1258 { &hf_sbccs_dib_statusflags_ffc,
1259 {"FFC", "sbccs.statusflags.ffc", FT_UINT8, BASE_HEX,
1260 VALS(status_ffc_val), 0xE0, "", HFILL}},
1261 { &hf_sbccs_dib_statusflags_ci,
1262 {"CI", "sbccs.statusflags.ci", FT_BOOLEAN, 8,
1263 TFS(&tfs_sbccs_statusflags_ci), 0x10, "", HFILL}},
1264 { &hf_sbccs_dib_statusflags_cr,
1265 {"CR", "sbccs.statusflags.cr", FT_BOOLEAN, 8,
1266 TFS(&tfs_sbccs_statusflags_cr), 0x04, "", HFILL}},
1267 { &hf_sbccs_dib_statusflags_lri,
1268 {"LRI", "sbccs.statusflags.lri", FT_BOOLEAN, 8,
1269 TFS(&tfs_sbccs_statusflags_lri), 0x02, "", HFILL}},
1270 { &hf_sbccs_dib_statusflags_rv,
1271 {"RV", "sbccs.statusflags.rv", FT_BOOLEAN, 8,
1272 TFS(&tfs_sbccs_statusflags_rv), 0x01, "", HFILL}},
1273 { &hf_sbccs_dib_status_attention,
1274 {"Attention", "sbccs.status.attention", FT_BOOLEAN, 8,
1275 TFS(&tfs_sbccs_status_attention), 0x80, "", HFILL}},
1276 { &hf_sbccs_dib_status_modifier,
1277 {"Status Modifier", "sbccs.status.modifier", FT_BOOLEAN, 8,
1278 TFS(&tfs_sbccs_status_modifier), 0x40, "", HFILL}},
1279 { &hf_sbccs_dib_status_cue,
1280 {"Control-Unit End", "sbccs.status.cue", FT_BOOLEAN, 8,
1281 TFS(&tfs_sbccs_status_cue), 0x20, "", HFILL}},
1282 { &hf_sbccs_dib_status_busy,
1283 {"Busy", "sbccs.status.busy", FT_BOOLEAN, 8,
1284 TFS(&tfs_sbccs_status_busy), 0x10, "", HFILL}},
1285 { &hf_sbccs_dib_status_channelend,
1286 {"Channel End", "sbccs.status.channel_end", FT_BOOLEAN, 8,
1287 TFS(&tfs_sbccs_status_channelend), 0x08, "", HFILL}},
1288 { &hf_sbccs_dib_status_deviceend,
1289 {"Device End", "sbccs.status.device_end", FT_BOOLEAN, 8,
1290 TFS(&tfs_sbccs_status_deviceend), 0x04, "", HFILL}},
1291 { &hf_sbccs_dib_status_unit_check,
1292 {"Unit Check", "sbccs.status.unit_check", FT_BOOLEAN, 8,
1293 TFS(&tfs_sbccs_status_unitcheck), 0x02, "", HFILL}},
1294 { &hf_sbccs_dib_status_unit_exception,
1295 {"Unit Exception", "sbccs.status.unitexception", FT_BOOLEAN, 8,
1296 TFS(&tfs_sbccs_status_unitexception), 0x01, "", HFILL}},
1297 { &hf_sbccs_dib_ctlparam,
1298 {"Control Parameters", "sbccs.ctlparam", FT_UINT24, BASE_HEX,
1299 NULL, 0x0, "", HFILL}},
1300 { &hf_sbccs_dib_ctlparam_rc,
1301 {"RC", "sbccs.ctlparam.rc", FT_BOOLEAN, 24,
1302 TFS(&tfs_sbccs_ctlparam_rc), 0x80, "", HFILL}},
1303 { &hf_sbccs_dib_ctlparam_ru,
1304 {"RU", "sbccs.ctlparam.ru", FT_BOOLEAN, 24,
1305 TFS(&tfs_sbccs_ctlparam_ru), 0x10, "", HFILL}},
1306 { &hf_sbccs_dib_ctlparam_ro,
1307 {"RO", "sbccs.ctlparam.ro", FT_BOOLEAN, 24,
1308 TFS(&tfs_sbccs_ctlparam_ro), 0x08, "", HFILL}},
1309 { &hf_sbccs_dib_linkctlinfo,
1310 {"Link Control Information", "sbccs.linkctlinfo", FT_UINT16,
1311 BASE_HEX, NULL, 0x0, "", HFILL}},
1312 { &hf_sbccs_dib_linkctlinfo_ctcconn,
1313 {"CTC Conn", "sbccs.linkctlinfo.ctc_conn", FT_BOOLEAN, 16,
1314 TFS(&tfs_sbccs_linkctlinfo_ctcconn), 0x80, "", HFILL}},
1315 { &hf_sbccs_dib_linkctlinfo_ecrcg,
1316 {"Enhanced CRC Generation", "sbccs.linkctlinfo.ecrcg", FT_BOOLEAN, 16,
1317 TFS(&tfs_sbccs_linkctlinfo_ecrcg), 0x01, "", HFILL}},
1321 /* Setup protocol subtree array */
1322 static gint *ett[] = {
1326 &ett_sbccs_dib_ccw_flags,
1327 &ett_sbccs_dib_cmdflags,
1328 &ett_sbccs_dib_statusflags,
1329 &ett_sbccs_dib_status,
1330 &ett_sbccs_dib_ctlparam,
1331 &ett_sbccs_dib_linkctlinfo,
1334 /* Register the protocol name and description */
1335 proto_fc_sbccs = proto_register_protocol ("Fibre Channel Single Byte Command",
1338 /* Required function calls to register the header fields and subtrees used */
1339 proto_register_field_array(proto_fc_sbccs, hf, array_length(hf));
1340 proto_register_subtree_array(ett, array_length(ett));
1343 /* If this dissector uses sub-dissector registration add a registration routine.
1344 This format is required because a script is used to find these routines and
1345 create the code that calls these routines.
1348 proto_reg_handoff_fcsbccs (void)
1350 dissector_handle_t fc_sbccs_handle;
1352 fc_sbccs_handle = create_dissector_handle (dissect_fc_sbccs,
1355 dissector_add("fc.ftype", FC_FTYPE_SBCCS, fc_sbccs_handle);
1357 data_handle = find_dissector ("data");