2 * Routines for FC Link Control Frames
3 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/wmem/wmem.h>
32 #include <epan/etypes.h>
33 #include <epan/conversation.h>
34 #include "packet-scsi.h"
35 #include "packet-fc.h"
36 #include "packet-fclctl.h"
38 const value_string fc_lctl_proto_val
[] = {
39 {FC_LCTL_ACK1
, "ACK1"},
40 {FC_LCTL_ACK0
, "ACK0"},
41 {FC_LCTL_PRJT
, "P_RJT"},
42 {FC_LCTL_FRJT
, "F_RJT"},
43 {FC_LCTL_PBSY
, "P_BSY"},
44 {FC_LCTL_FBSYL
, "F_BSY (Data frame)"},
45 {FC_LCTL_FBSYB
, "F_BSY (Link Ctl)"},
46 {FC_LCTL_LCR
, "LCR"},
47 {FC_LCTL_NTY
, "NTY"},
48 {FC_LCTL_END
, "END"},
52 static const value_string fc_lctl_fbsy_val
[] = {
53 {FC_LCTL_FBSY_FBSY
, "Fabric Busy"},
54 {FC_LCTL_FBSY_NBSY
, "N_Port Busy"},
58 static const value_string fc_lctl_pbsy_acode_val
[] = {
59 {FC_LCTL_PBSY_ACODE_SEQBSY
, "Sequence Marked Busy"},
60 {FC_LCTL_PBSY_ACODE_C2BSY
, "Class 2 Frame Busy"},
64 static const value_string fc_lctl_pbsy_rjt_val
[] = {
65 {FC_LCTL_PBSY_PORTBSY
, "Physical N_Port Busy"},
66 {FC_LCTL_PBSY_RSRCBSY
, "N_Port Resource Busy"},
67 {FC_LCTL_PBSY_MCASTBSY
, "Partial Multicast Busy"},
68 {FC_LCTL_PBSY_VENDBSY
, "Vendor unique Busy"},
72 static const value_string fc_lctl_rjt_acode_val
[] = {
73 {FC_LCTL_RJT_ACODE_RETRY
, "Retryable Error"},
74 {FC_LCTL_RJT_ACODE_NORETRY
, "Non-retryable Error"},
78 static const value_string fc_lctl_rjt_val
[] = {
79 {FC_LCTL_RJT_INVSID
, "Invalid S_ID"},
80 {FC_LCTL_RJT_INVDID
, "Invalid D_ID"},
81 {FC_LCTL_RJT_NPORT_NOTAVAIL_T
, "N_Port Not Avail (Temporary)"},
82 {FC_LCTL_RJT_NPORT_NOTAVAIL_P
, "N_Port Not Avail (Permanent)"},
83 {FC_LCTL_RJT_CLASS_NOTSUPP
, "Class Not Supported"},
84 {FC_LCTL_RJT_DELIM_USERR
, "Delimiter Usage Error"},
85 {FC_LCTL_RJT_TYPE_NOTSUPP
, "Type Not Supported"},
86 {FC_LCTL_RJT_INV_LCTL
, "Invalid Link Ctl Frame"},
87 {FC_LCTL_RJT_INV_RCTL
, "Invalid R_CTL"},
88 {FC_LCTL_RJT_INV_FCTL
, "Invalid F_CTL"},
89 {FC_LCTL_RJT_INV_OXID
, "Invalid OX_ID"},
90 {FC_LCTL_RJT_INV_RXID
, "Invalid RX_ID"},
91 {FC_LCTL_RJT_INV_SEQID
, "Invalid SEQID"},
92 {FC_LCTL_RJT_INV_DFCTL
, "Invalid DF_CTL"},
93 {FC_LCTL_RJT_INV_SEQCNT
, "Invalid SEQCNT"},
94 {FC_LCTL_RJT_INV_PARAM
, "Invalid Parameter"},
95 {FC_LCTL_RJT_EXCHG_ERR
, "Exchange Error"},
96 {FC_LCTL_RJT_PROTO_ERR
, "Protocol Error"},
97 {FC_LCTL_RJT_INV_LEN
, "Incorrect Length"},
98 {FC_LCTL_RJT_UNEXP_ACK
, "Unexpected ACK"},
99 {FC_LCTL_RJT_CLS_NOTSUPP
, "Class Not Supported by Entity at 0xFFFFFE"},
100 {FC_LCTL_RJT_LOGI_REQD
, "Login Required"},
101 {FC_LCTL_RJT_TOOMANY_SEQ
, "Excessive Sequences Attempted"},
102 {FC_LCTL_RJT_EXCHG_NOTESTD
, "Exchange Not Established"},
103 {FC_LCTL_RJT_RSVD
, "Reserved"},
104 {FC_LCTL_RJT_FPATH_NOTAVAIL
, "Fabric Path Not Available"},
105 {FC_LCTL_RJT_INV_VCID
, "Invalid VC_ID"},
106 {FC_LCTL_RJT_INV_CSCTL
, "Invalid CS_CTL"},
107 {FC_LCTL_RJT_OORSRC
, "Insufficient Resources of VC (Class 4)"},
108 {FC_LCTL_RJT_INV_CLASS
, "Invalid Class of Service"},
109 {FC_LCTL_RJT_PRMPT_RJT
, "Preemption Request Rejected"},
110 {FC_LCTL_RJT_PRMPT_DIS
, "Preemption Not Enabled"},
111 {FC_LCTL_RJT_MCAST_ERR
, "Multicast Error"},
112 {FC_LCTL_RJT_MCAST_TERM
, "Multicast Error Terminate"},
113 {FC_LCTL_RJT_PRLI_REQD
, "PRLI Required"},
114 {FC_LCTL_RJT_VEND_ERR
, "Vendor Unique Error"},
119 fclctl_get_typestr (guint8 linkctl_type
, guint8 type
)
121 if ((linkctl_type
== FC_LCTL_FBSYB
) ||
122 (linkctl_type
== FC_LCTL_FBSYL
)) {
123 return (val_to_str ((type
& 0xF0), fc_lctl_fbsy_val
, "0x%x"));
129 fclctl_get_paramstr (guint32 linkctl_type
, guint32 param
)
131 if (linkctl_type
== FC_LCTL_PBSY
) {
132 return wmem_strdup_printf(wmem_packet_scope(), "%s, %s",
133 val_to_str (((param
& 0xFF000000) >> 24), fc_lctl_pbsy_acode_val
, "0x%x"),
134 val_to_str (((param
& 0x00FF0000) >> 16), fc_lctl_pbsy_rjt_val
, "0x%x"));
136 if ((linkctl_type
== FC_LCTL_FRJT
) ||
137 (linkctl_type
== FC_LCTL_PRJT
)) {
138 return wmem_strdup_printf(wmem_packet_scope(), "%s, %s",
139 val_to_str (((param
& 0xFF000000) >> 24), fc_lctl_rjt_acode_val
, "0x%x"),
140 val_to_str (((param
& 0x00FF0000) >> 16), fc_lctl_rjt_val
, "%x"));