1 /*        $NetBSD: isns_defs.h,v 1.1.1.1 2011/01/16 01:22:50 agc Exp $          */
2 
3 /*-
4  * Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Wasabi Systems, Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _ISNS_DEFS_H_
33 #define   _ISNS_DEFS_H_
34 
35 /*
36  * enum of iSNS Registration, query, and response types
37  */
38 
39 typedef enum {
40           isnsp_DevAttrReg = 1,
41           isnsp_DevAttrQry,
42           isnsp_DevGetNext,
43           isnsp_DevDereg,
44           isnsp_SCNReg,
45           isnsp_SCNDereg,
46           isnsp_SCNEvent,
47           isnsp_SCN,
48           isnsp_DDReg,
49           isnsp_DDDereg,
50           isnsp_DDSReg,
51           isnsp_DDSDereg,
52           isnsp_ESI,
53           isnsp_Heartbeat,    /* 0x000e */
54 
55           /* Next few are iFCP only */
56           isnsp_RqstDomId = 0x0011,
57           isnsp_RlseDomId,
58           isnsp_GetDomId,
59 
60           isnsp_DevAttrRegRsp = 0x8001,
61           isnsp_DevAttrQryRsp,
62           isnsp_DevGetNextRsp,
63           isnsp_DevDeregRsp,
64           isnsp_SCNregRsp,
65           isnsp_SCNDeregRsp,
66           isnsp_SCNeventRsp,
67           isnsp_SCNRsp,
68           isnsp_DDRegRsp,
69           isnsp_DDDeregRsp,
70           isnsp_DDSRegRsp,
71           isnsp_DDSDeregRsp,
72           isnsp_ESIRsp,                 /* 0x800d */
73 
74           /* Next few are iFCP only */
75           isnsp_RqstDomIdRsp = 0x8011,
76           isnsp_RlseDomIdRsp,
77           isnsp_GetDomIdRsp
78 } isnsp_func_id_t;
79 
80 /*
81  * enum of iSNS tag types
82  */
83 
84 typedef enum {                          /*  Len      Reg Key          Query Key  Val */
85           isnst_Delimiter = 0,          /*   0              N/A       N/A                    0 */
86           isnst_EID,                    /* 4-256   1        1|2|16&17|32|64        1 */
87           isnst_EntProtocol,  /*   4               1        1|2|16&17|32|64        2 */
88           isnst_MgtIPAddr,    /*  16               1        1|2|16&17|32|64        3 */
89           isnst_Timestamp,    /*   8              --        1|2|16&17|32|64        4 */
90           isnst_ProtVersRange,          /*   4               1        1|2|16&17|32|64        5 */
91           isnst_RegPeriod,    /*   4               1        1|2|16&17|32|64        6 */
92           isnst_EntityIndex,  /*   4               1        1|2|16&17|32|64        7 */
93           isnst_EntityNextIndex,        /*   8               1        1|2|16&17|32|64        8 */
94                                         /*                                                     */
95           isnst_EntISAKMP_P1= 11,       /*  var              1        1|2|16&17|32|64       11 */
96           isnst_Certificate,  /*  var              1        1|2|16&17|32|64       12 */
97                                         /*                                                     */
98           isnst_PortalIPAddr= 16,       /*  16               1        1|2|16&17|32|64       16 */
99           isnst_PortalPort,   /*   4               1        1|2|16&17|32|64       17 */
100           isnst_SymbName,     /* 4-256       16&17          1|16&17|32|64         18 */
101           isnst_ESIIntval,    /*   4           16&17        1|16&17|32|64         19 */
102           isnst_ESIPort,                /*   4           16&17        1|16&17|32|64         20 */
103                                         /*                                                     */
104           isnst_PortalIndex=22,         /*   4           16&17        1|16&17|32|64         22 */
105           isnst_SCNPort,                /*   4           16&17        1|16&17|32|64         23 */
106           isnst_PortalNextIndex,        /*   4              --        1|16&17|32|64         24 */
107                                         /*                                                     */
108           isnst_PortalSecBmap=27,       /*   4           16&17        1|16&17|32|64         27 */
109           isnst_PortalISAKMP_P1,        /*  var          16&17        1|16&17|32|64         28 */
110           isnst_PortalISAKMP_P2,        /*  var          16&17        1|16&17|32|64         29 */
111                                         /*                                                     */
112           isnst_PortalCert = 31,        /*  var          16&17        1|16&17|32|64         31 */
113           isnst_iSCSIName,    /* 4-224   1        1|16&17|32|33         32 */
114           isnst_iSCSINodeType,          /*   4              32        1|16&17|32            33 */
115           isnst_iSCSIAlias,   /* 4-256  32        1|16&17|32            34 */
116           isnst_iSCSISCNBmap, /*   4              32        1|16&17|32            35 */
117           isnst_iSCSINodeIndex,         /*   4              32        1|16&17|32            36 */
118           isnst_WWNNToken,    /*   8              32        1|16&17|32            37 */
119           isnst_iSCSINodeNextIdx, /*   4                    --        1|16&17|32            38 */
120                                         /*                                                     */
121           isnst_iSCSIAuthMethod=42,/* var                   32        1|16&17|32            42 */
122           isnst_iSCSINodeCert,          /*  var             32        1|16&17|32            43 */
123                                         /*                                                     */
124           isnst_PGiSCSIName=48,         /* 4-224     32|16&17         1|16&17|32|52         48 */
125           isnst_PGPortIPAddr, /*  16         32|16&17       1|16&17|32|52         49 */
126           isnst_PGPortIPPort, /*   4         32|16&17       1|16&17|32|52         50 */
127           isnst_PGTag,                  /*   4         32|16&17       1|16&17|32|52         51 */
128           isnst_PGIndex,                /*   4         32|16&17       1|16&17|32|52         52 */
129           isnst_PGNextIndex,  /*   4              --        1|16&17|32|52         53 */
130                                         /*                                                     */
131           isnst_FCPortNameWWPN=64,/*   8                     1        1|16&17|64|66|96|128
132                                                                                             64 */
133           isnst_FCPortID,     /*   4              64        1|16&17|64            65 */
134           isnst_FCPortType,   /*   4              64        1|16&17|64            66 */
135           isnst_FCSymbPortName,         /* 4-256  64        1|16&17|64            67 */
136           isnst_FCFabricPortName, /*   8                    64        1|16&17|64            68 */
137           isnst_FCHardAddr,   /*   4              64        1|16&17|64            69 */
138           isnst_FCPortIPAddr, /*  16              64        1|16&17|64            70 */
139           isnst_FCClassOService,        /*   4              64        1|16&17|64            71 */
140           isnst_FC4Types,     /*  32              64        1|16&17|64            72 */
141           isnst_FC4Descr,     /* 4-256  64        1|16&17|64            73 */
142           isnst_FC4Features,  /*  128             64        1|16&17|64            74 */
143           isnst_iFCPSCNBmap,  /*   4              64        1|16&17|64            75 */
144           isnst_iFCPPortRole, /*   4              64        1|16&17|64            76 */
145           isnst_PermPortName, /*   8              --        1|16&17|64            77 */
146                                         /*                                                     */
147           isnst_PortCert = 83,          /*  var             64        1|16&17|64            83 */
148                                         /*                                                     */
149           isnst_FC4TypeCode = 95,       /*   4              --        1|16&17|64            95 */
150           isnst_FCNodeNameWWNN,         /*   8              64        1|16&17|64|96         96 */
151           isnst_SymbNodeName, /* 4-256  96        64|96                 97 */
152           isnst_NodeIPAddr,   /*  16              96        64|96                 98 */
153           isnst_NodeIPA,                /*   8              96        64|96                 99 */
154           isnst_NodeCert,     /*  var   96        64|96                100 */
155           isnst_ProxyiSCSIName,         /* 4-256  96        64|96                101 */
156                                         /* Note: above really should be 4-224
157                                          * in the iSNS spec, but isn't                         */
158                                         /*                                                     */
159           isnst_SwitchName = 128, /*   8                 128          128                  128 */
160           isnst_PrefID,                 /*   4           128          128                  129 */
161           isnst_AssignedID,   /*   4           128          128                  130 */
162           isnst_VirtFabricID, /* 4-256       128  128                  131 */
163                                         /*                                                     */
164           isnst_iSNSSrvrVndOUI=256,/*  4                    --        SOURCE Attr          256 */
165                                         /*                                                     */
166           isnst_DDS_ID=2049,  /*   4          2049          1|32|64|2049|2065
167                                                                                           2049 */
168           isnst_DDS_SymName,  /* 4-256      2049  2049                2050 */
169           isnst_DDS_Status,   /*   4          2049          2049                2051 */
170           isnst_DDS_Next_ID,  /*   4              --        2049                2052 */
171                                         /*                                                     */
172           isnst_DD_ID = 2065, /*   4          2049          1|32|64|2049|2065
173                                                                                           2065 */
174           isnst_DD_SymName,   /* 4-256      2065  2065                2066 */
175           isnst_DD_iSCSIIndex,          /*   4          2065          2065                2067 */
176           isnst_DD_iSCSIName, /* 4-224      2065  2065                2068 */
177           isnst_DD_iFCPNode,  /*   8          2065          2065                2069 */
178           isnst_DD_PortIndex, /*   4          2065          2065                2070 */
179           isnst_DD_PortIPAddr,          /*  16          2065          2065                2071 */
180           isnst_DD_PortPort,  /*   4          2065          2065                2072 */
181           isnst_DD_Features=2078, /*   4                2065          2065                2078 */
182           isnst_DD_Next_ID    /*   4              --        2065                2079 */
183 } isnst_tag_type_t;
184 
185 /*
186  * iSNS PDU header flags
187  */
188 
189 #define ISNS_FLAG_FIRST_PDU    (0x0400)
190 #define ISNS_FLAG_LAST_PDU     (0x0800)
191 #define ISNS_FLAG_REPLACE_REG  (0x1000)
192 #define ISNS_FLAG_AUTH         (0x2000)
193 #define ISNS_FLAG_SND_SERVER   (0x4000)
194 #define ISNS_FLAG_SND_CLIENT   (0x8000)
195 
196 
197 #endif /* _ISNS_DEFS_H_ */
198