Add HP Switch Protocol SAP value
[obnox/wireshark/wip.git] / epan / dissectors / packet-fcsb3.h
1 /* packet-fc-sb3.h
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)
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifndef __PACKET_FCSB3_H_
28 #define __PACKET_FCSB3_H_
29
30 /* SB-3 IU Types */
31 #define FC_SBCCS_IU_DATA          0x0
32 #define FC_SBCCS_IU_CMD_HDR       0x1
33 #define FC_SBCCS_IU_STATUS        0x2
34 #define FC_SBCCS_IU_CTL           0x3
35 #define FC_SBCCS_IU_CMD_DATA      0x4
36 #define FC_SBCCS_IU_CMD_LINK_CTL  0x5
37
38 /* Control Function Types */
39 #define FC_SBCCS_CTL_FN_CTL_END     0x0
40 #define FC_SBCCS_CTL_FN_CMD_RSP     0x10
41 #define FC_SBCCS_CTL_FN_STK_STS     0x20
42 #define FC_SBCCS_CTL_FN_CANCEL      0x30
43 #define FC_SBCCS_CTL_FN_SYS_RST     0x40
44 #define FC_SBCCS_CTL_FN_SEL_RST     0x50
45 #define FC_SBCCS_CTL_FN_REQ_STS     0x70
46 #define FC_SBCCS_CTL_FN_DEV_XCP     0x80
47 #define FC_SBCCS_CTL_FN_STS_ACC     0xA0
48 #define FC_SBCCS_CTL_FN_DEV_ACK     0xB0
49 #define FC_SBCCS_CTL_FN_PRG_PTH     0xC1
50 #define FC_SBCCS_CTL_FN_PRG_RSP     0xD0
51
52 /* Link Control Function Types */
53 #define FC_SBCCS_LINK_CTL_FN_ELP     0x41
54 #define FC_SBCCS_LINK_CTL_FN_RLP     0x49
55 #define FC_SBCCS_LINK_CTL_FN_TIN     0x09
56 #define FC_SBCCS_LINK_CTL_FN_LPE     0x51
57 #define FC_SBCCS_LINK_CTL_FN_LPR     0x59
58 #define FC_SBCCS_LINK_CTL_FN_TIR     0x01
59 #define FC_SBCCS_LINK_CTL_FN_LRJ     0x11
60 #define FC_SBCCS_LINK_CTL_FN_LBY     0x21
61 #define FC_SBCCS_LINK_CTL_FN_LACK    0x61
62
63 #define FC_SBCCS_SB3_HDR_SIZE        8
64 #define FC_SBCCS_IU_HDR_SIZE         8
65 #define FC_SBCCS_DIB_LRC_HDR_SIZE    16
66
67 /* Decodes the DIB Type from the IU header and returns type */
68 static inline guint get_fc_sbccs_iu_type (tvbuff_t *tvb, guint offset)
69 {
70     /* This is in the IUI field of the IU header */
71     return (tvb_get_guint8 (tvb, offset+FC_SBCCS_SB3_HDR_SIZE) & 0x7);
72 }
73
74 #endif