Export libwireshark symbols using WS_DLL_PUBLIC define
[metze/wireshark/wip.git] / epan / dissectors / packet-fc.h
1 /* packet-fc.h
2  * Basic Fibre Channel Header definitions
3  * Copyright 2002 Dinesh G Dutt (ddutt@cisco.com)
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  * 
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.
15  * 
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.
20  * 
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.
24  */
25
26 #ifndef __PACKET_FC_H_
27 #define __PACKET_FC_H_
28
29 #include "packet-scsi.h"
30 #include "ws_symbol_export.h"
31
32 /* R_CTL upper bits creates a classification tree */
33 #define FC_RCTL_DEV_DATA       0x00
34 #define FC_RCTL_ELS            0x20
35 #define FC_RCTL_LINK_DATA      0x30
36 #define FC_RCTL_VIDEO          0x40
37 #define FC_RCTL_BLS            0x80
38 #define FC_RCTL_LINK_CTL       0xC0
39 /* XXX - is 0xF0 Extended Routing?  It is in the FC-FS draft on the T11
40    Web site. */
41
42 #define FC_TYPE_CMNSVC         0x0  /* Used in PRLI Svc Param Page */
43
44 /* TYPE definitions for Basic or Extended Link_Data */
45 #define FC_TYPE_BLS            0x0
46 #define FC_TYPE_ELS            0x1
47
48 /* TYPE definitions for FC-4 */
49 #define FC_TYPE_LLCSNAP        0x4
50 #define FC_TYPE_IP             0x5
51 #define FC_TYPE_SCSI           0x8
52 #define FC_TYPE_SB_TO_CU       0x1B
53 #define FC_TYPE_SB_FROM_CU     0x1C
54 #define FC_TYPE_FCCT           0x20
55 #define FC_TYPE_SWILS          0x22
56 #define FC_TYPE_AL             0x23
57 #define FC_TYPE_SNMP           0x24
58 #define FC_TYPE_VENDOR         0xFF
59
60
61 /*
62  * the following allows TAP code access to the messages
63  * without having to duplicate it. With MSVC and a 
64  * libwireshark.dll, we need a special declaration.
65  */
66 WS_DLL_PUBLIC const value_string fc_fc4_val[];
67
68 /* DF_CTL bits */
69 #define FC_DFCTL_DH         0x03   /* Device_Header type bits: */
70 #define FC_DFCTL_DH_NONE    0x00   /* No Device_Header */
71 #define FC_DFCTL_DH_16_BYTE 0x01   /* 16 Byte Device_Header */
72 #define FC_DFCTL_DH_32_BYTE 0x02   /* 32 Byte Device_Header */
73 #define FC_DFCTL_DH_64_BYTE 0x03   /* 64 Byte Device_Header */
74 #define FC_DFCTL_AH         0x10   /* Association_Header bit */
75 #define FC_DFCTL_NH         0x20   /* Association_Header bit */
76 #define FC_DFCTL_SH         0x40   /* reserved for security header */
77
78 /* Derived Frame types (used for ULP demux) */
79 #define FC_FTYPE_UNDEF         0x0
80 #define FC_FTYPE_SWILS         0x1
81 #define FC_FTYPE_IP            0x2
82 #define FC_FTYPE_SCSI          0x3
83 #define FC_FTYPE_BLS           0x4
84 #define FC_FTYPE_ELS           0x5
85 #define FC_FTYPE_FCCT          0x7
86 #define FC_FTYPE_LINKDATA      0x8
87 #define FC_FTYPE_VDO           0x9
88 #define FC_FTYPE_LINKCTL       0xA
89 #define FC_FTYPE_SWILS_RSP     0xB
90 #define FC_FTYPE_SBCCS         0xC
91 #define FC_FTYPE_OHMS          0xD
92
93 /* Well-known Address Definitions (in Network order) */
94 #define FC_WKA_MULTICAST       0xFFFFF5
95 #define FC_WKA_CLKSYNC         0xFFFFF6
96 #define FC_WKA_KEYDIST         0xFFFFF7
97 #define FC_WKA_ALIAS           0xFFFFF8
98 #define FC_WKA_QOSF            0xFFFFF9
99 #define FC_WKA_MGMT            0xFFFFFA
100 #define FC_WKA_TIME            0xFFFFFB
101 #define FC_WKA_DNS             0xFFFFFC
102 #define FC_WKA_FABRIC_CTRLR    0xFFFFFD
103 #define FC_WKA_FPORT           0xFFFFFE
104 #define FC_WKA_BCAST           0xFFFFFF
105
106 /* Well-known Address Definitions (in little endian) */
107
108 /* Information Categories for Link Data & Link Control Frames */
109 #define FC_IU_UNCATEGORIZED     0x0
110 #define FC_IU_SOLICITED_DATA    0x1
111 #define FC_IU_UNSOLICITED_CTL   0x2
112 #define FC_IU_SOLICITED_CTL     0x3
113 #define FC_IU_UNSOLICITED_DATA  0x4
114 #define FC_IU_DATA_DESCRIPTOR   0x5
115 #define FC_IU_UNSOLICITED_CMD   0x6
116 #define FC_IU_CMD_STATUS        0x7
117
118 /* FC_CTL bits */
119 #define FC_FCTL_EXCHANGE_RESPONDER      0x800000
120 #define FC_FCTL_SEQ_RECIPIENT           0x400000
121 #define FC_FCTL_EXCHANGE_FIRST          0x200000
122 #define FC_FCTL_EXCHANGE_LAST           0x100000
123 #define FC_FCTL_SEQ_LAST                0x080000
124 #define FC_FCTL_PRIORITY                0x020000
125 #define FC_FCTL_TRANSFER_SEQ_INITIATIVE 0x010000
126 #define FC_FCTL_LAST_DATA_FRAME_MASK    0x00c000
127 #define FC_FCTL_ACK_0_1_MASK            0x003000
128 #define FC_FCTL_REXMITTED_SEQ           0x000200
129 #define FC_FCTL_ABTS_MASK               0x000030
130 #define FC_FCTL_REL_OFFSET              0x000008
131
132
133
134 /* FC header structure */
135 typedef struct _fc_hdr {
136     address s_id;
137     address d_id;
138     guint32 fctl;
139     guint8 type;
140     guint16 seqcnt;
141     guint16 oxid;
142     guint16 rxid;
143     guint8 r_ctl;
144     guint8 cs_ctl;
145     itlq_nexus_t *itlq;
146     guint32 relative_offset;
147 } fc_hdr;
148
149 #endif /* __PACKET_FC_H_ */