Pull much of the processing done after a call to "fragment_add_check()"
[obnox/wireshark/wip.git] / packet-fcswils.h
1 /* packet-fcswils.h
2  * Fibre Channel Switch InterLink Services Definitions
3  * Copyright 2001 Dinesh G Dutt (ddutt@cisco.com)
4  *
5  * $Id: packet-fcswils.h,v 1.1 2002/12/08 02:32:17 gerald Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __PACKET_FCSWILS_H_
27 #define __PACKET_FCSWILS_H_
28
29 /* Command codes */
30 #define FC_SWILS_SWRJT          0x01
31 #define FC_SWILS_SWACC          0x02
32 #define FC_SWILS_ELP            0x10
33 #define FC_SWILS_EFP            0x11
34 #define FC_SWILS_DIA            0x12
35 #define FC_SWILS_RDI            0x13
36 #define FC_SWILS_HLO            0x14
37 #define FC_SWILS_LSU            0x15
38 #define FC_SWILS_LSA            0x16
39 #define FC_SWILS_BF             0x17
40 #define FC_SWILS_RCF            0x18
41 #define FC_SWILS_RSCN           0x1B
42 #define FC_SWILS_DRLIR          0x1E
43 #define FC_SWILS_DSCN           0x20
44 #define FC_SWILS_LOOPD          0x21
45 #define FC_SWILS_MR             0x22
46 #define FC_SWILS_ACA            0x23
47 #define FC_SWILS_RCA            0x24
48 #define FC_SWILS_SFC            0x25
49 #define FC_SWILS_UFC            0x26
50 #define FC_SWILS_ESC            0x30
51
52 /* Used in filters */
53 static const value_string fc_swils_opcode_key_val[] = {
54     {FC_SWILS_SWRJT  , "SW_RJT"},
55     {FC_SWILS_SWACC  , "SW_ACC"},
56     {FC_SWILS_ELP    , "ELP"},
57     {FC_SWILS_EFP    , "EFP"},
58     {FC_SWILS_DIA    , "DIA"},
59     {FC_SWILS_RDI    , "RDI"},
60     {FC_SWILS_HLO    , "HLO"},
61     {FC_SWILS_LSU    , "LSU"},
62     {FC_SWILS_LSA    , "LSA"},
63     {FC_SWILS_BF     , "BF"},
64     {FC_SWILS_RCF    , "RCF"},
65     {FC_SWILS_RSCN   , "SW_RSCN"},
66     {FC_SWILS_DRLIR  , "DRLIR"},
67     {FC_SWILS_DSCN   , "DSCN"},
68     {FC_SWILS_LOOPD  , "LOOPD"},
69     {FC_SWILS_MR     , "MR"},
70     {FC_SWILS_ACA    , "ACA"},
71     {FC_SWILS_RCA    , "RCA"},
72     {FC_SWILS_SFC    , "SFC"},
73     {FC_SWILS_UFC    , "UFC"},
74     {FC_SWILS_ESC    , "ESC"},
75     {0, NULL},
76 };
77
78 /* Used in Info field */
79 static const value_string fc_swils_opcode_val[] = {
80     {FC_SWILS_SWRJT  , "SW_RJT"},
81     {FC_SWILS_SWACC  , "SW_ACC"},
82     {FC_SWILS_ELP    , "ELP"},
83     {FC_SWILS_EFP    , "EFP"},
84     {FC_SWILS_DIA    , "Domain ID Assigned"},
85     {FC_SWILS_RDI    , "Request Domain ID"},
86     {FC_SWILS_HLO    , "Hello"},
87     {FC_SWILS_LSU    , "Link State Update"},
88     {FC_SWILS_LSA    , "Link State Ack"},
89     {FC_SWILS_BF     , "Build Fabric"},
90     {FC_SWILS_RCF    , "Reconfigure Fabric"},
91     {FC_SWILS_RSCN   , "Interswitch RSCN"},
92     {FC_SWILS_DRLIR  , "DRLIR"},
93     {FC_SWILS_DSCN   , "SW_RSCN"},
94     {FC_SWILS_LOOPD  , "LOOPD"},
95     {FC_SWILS_MR     , "Merge Req"},
96     {FC_SWILS_ACA    , "Acquire Change Auth"},
97     {FC_SWILS_RCA    , "Release Change Auth"},
98     {FC_SWILS_SFC    , "Stage Fabric Conf"},
99     {FC_SWILS_UFC    , "Update Fabric Conf"},
100     {FC_SWILS_ESC    , "ESC"},
101     {0, NULL},
102 };
103
104 /* Reject reason codes */
105
106 #define FC_SWILS_RJT_INVCODE       0x01
107 #define FC_SWILS_RJT_INVVER        0x02
108 #define FC_SWILS_RJT_LOGERR        0x03
109 #define FC_SWILS_RJT_INVSIZE       0x04
110 #define FC_SWILS_RJT_LOGBSY        0x05
111 #define FC_SWILS_RJT_PROTERR       0x07
112 #define FC_SWILS_RJT_GENFAIL       0x09
113 #define FC_SWILS_RJT_CMDNOTSUPP    0x0B
114 #define FC_SWILS_RJT_VENDUNIQ      0xFF
115
116 static const value_string fc_swils_rjt_val [] = {
117     {FC_SWILS_RJT_INVCODE   , "Invalid Cmd Code"},
118     {FC_SWILS_RJT_INVVER    , "Invalid Revision"},
119     {FC_SWILS_RJT_LOGERR    , "Logical Error"},
120     {FC_SWILS_RJT_INVSIZE   , "Invalid Size"},
121     {FC_SWILS_RJT_LOGBSY    , "Logical Busy"},
122     {FC_SWILS_RJT_PROTERR   , "Protocol Error"},
123     {FC_SWILS_RJT_GENFAIL   , "Unable to Perform"},
124     {FC_SWILS_RJT_CMDNOTSUPP, "Unsupported Cmd"},
125     {FC_SWILS_RJT_VENDUNIQ  , "Vendor Unique Err"},
126     {0, NULL},
127 };
128
129 /* Detailed reason code defines */
130 #define FC_SWILS_RJT_NODET         0x0
131 #define FC_SWILS_RJT_CLSF_ERR      0x1
132 #define FC_SWILS_RJT_CLSN_ERR      0x3
133 #define FC_SWILS_RJT_INVFC_CODE    0x4
134 #define FC_SWILS_RJT_INVFC_PARM    0x5
135 #define FC_SWILS_RJT_INV_PNAME     0xD
136 #define FC_SWILS_RJT_INV_SNAME     0xE
137 #define FC_SWILS_RJT_TOV_MSMTCH    0xF
138 #define FC_SWILS_RJT_INV_DIDLST    0x10
139 #define FC_SWILS_RJT_CMD_INPROG    0x19
140 #define FC_SWILS_RJT_OORSRC        0x29
141 #define FC_SWILS_RJT_NO_DID        0x2A
142 #define FC_SWILS_RJT_INV_DID       0x2B
143 #define FC_SWILS_RJT_NO_REQ        0x2C
144 #define FC_SWILS_RJT_NOLNK_PARM    0x2D
145 #define FC_SWILS_RJT_NO_REQDID     0x2E
146 #define FC_SWILS_RJT_EP_ISOL       0x2F
147
148 static const value_string fc_swils_deterr_val [] = {
149     {FC_SWILS_RJT_NODET ,      "No Additional Details"},
150     {FC_SWILS_RJT_CLSF_ERR ,   "Class F Svc Param Err"},
151     {FC_SWILS_RJT_CLSN_ERR ,   "Class N Svc Param Err"},
152     {FC_SWILS_RJT_INVFC_CODE , "Unknown Flow Ctrl Code"},
153     {FC_SWILS_RJT_INVFC_PARM , "Invalid Flow Ctrl Parm"},
154     {FC_SWILS_RJT_INV_PNAME ,  "Invalid Port Name"},
155     {FC_SWILS_RJT_INV_SNAME ,  "Invalid Switch Name"},
156     {FC_SWILS_RJT_TOV_MSMTCH , "R_A_/E_D_TOV Mismatch"},
157     {FC_SWILS_RJT_INV_DIDLST,  "Invalid Domain ID List"},
158     {FC_SWILS_RJT_CMD_INPROG , "Cmd Already in Progress"},
159     {FC_SWILS_RJT_OORSRC ,     "Insufficient Resources"},
160     {FC_SWILS_RJT_NO_DID ,     "Domain ID Unavailable"},
161     {FC_SWILS_RJT_INV_DID,     "Invalid Domain ID"},
162     {FC_SWILS_RJT_NO_REQ ,     "Request Not Supported"},
163     {FC_SWILS_RJT_NOLNK_PARM , "Link Parm Not Estd."},
164     {FC_SWILS_RJT_NO_REQDID ,  "Group of Domain IDs Unavail"},
165     {FC_SWILS_RJT_EP_ISOL ,    "E_Port Isolated"},
166     {0, NULL}
167 };
168
169 typedef struct _fcswils_elp {
170     guint8 revision;
171     guint8 flags[2];
172     guint8 rsvd1;
173     guint32 r_a_tov;
174     guint32 e_d_tov;
175     guint8  req_epname[8];
176     guint8  req_sname[8];
177     guint8  clsf_svcparm[6];
178     guint16 clsf_rcvsize;
179     guint16 clsf_conseq;
180     guint16 clsf_e2e;
181     guint16 clsf_openseq;
182     guint16 rsvd;
183     guint8  cls1_svcparm[2];
184     guint16 cls1_rcvsize;
185     guint8  cls2_svcparm[2];
186     guint16 cls2_rcvsize;
187     guint8  cls3_svcparm[2];
188     guint16 cls3_rcvsize;
189     guint8  rsvd2[20];
190     guint16 isl_flwctrl_mode;
191     guint16 flw_ctrl_parmlen;
192     guint32 b2b_credit;
193     guint32 compat_p1;
194     guint32 compat_p2;
195     guint32 compat_p3;
196     guint32 compat_p4;
197 } fcswils_elp;
198 #define FC_SWILS_ELP_SIZE 100
199
200 #define FC_SWILS_ELP_FC_VENDOR   0x1
201 #define FC_SWILS_ELP_FC_RRDY     0x2
202
203 static const value_string fcswils_elp_fc_val[] = {
204     {FC_SWILS_ELP_FC_VENDOR, "Vendor Unique"},
205     {FC_SWILS_ELP_FC_RRDY,   "R_RDY Flow Ctrl"},
206     {0, NULL},
207 };
208
209 struct _fcswils_efp_didrec {
210     guint8 rec_type;
211     guint8 dom_id;
212     guint16 rsvd1;
213     guint32 rsvd2;
214     guint8  sname[8];
215 };
216 struct _fcswils_efp_mcastrec {
217     guint8 rec_type;
218     guint8 mcast_grpnum;
219     guint8 rsvd[14];
220 };
221
222 typedef union _fcswils_efp_listrec {
223     struct _fcswils_efp_didrec didrec;
224     struct _fcswils_efp_mcastrec mcastrec;
225 } fcswils_efp_listrec;
226
227 #define FC_SWILS_LRECTYPE_DOMAIN 0x1
228 #define FC_SWILS_LRECTYPE_MCAST  0x2
229
230 static const value_string fcswils_rectype_val[] = {
231     {FC_SWILS_LRECTYPE_DOMAIN, "Domain ID List Rec"},
232     {FC_SWILS_LRECTYPE_MCAST, "Multicast ID List Rec"},
233     {0, NULL},
234 };
235
236 typedef struct _fcswils_efp {
237     guint8  opcode;
238     guint8  reclen;
239     guint16 payload_len;
240     guint8  rsvd1[3];
241     guint8  pswitch_prio;
242     guint8  pswitch_name[8];
243     fcswils_efp_listrec *listrec;
244 } fcswils_efp;
245 #define FC_SWILS_EFP_SIZE 16    /* not including listrec */
246
247 typedef struct _fcswils_dia {
248     guint8 switch_name[8];
249     guint8 rsvd[4];
250 } fcswils_dia;
251
252 typedef struct _fcswils_rdi_req {
253     guint8 rsvd[3];
254     guint8 domain_id;
255 } fcswils_rdi_req;
256 #define FC_SWILS_RDIREQ_SIZE 4
257
258 static const value_string fc_swils_link_type_val[] = {
259     {0x01, "P2P Link"},
260     {0xF0, "Vendor Specific"},
261     {0xF1, "Vendor Specific"},
262     {0xF2, "Vendor Specific"},
263     {0xF3, "Vendor Specific"},
264     {0xF4, "Vendor Specific"},
265     {0xF5, "Vendor Specific"},
266     {0xF6, "Vendor Specific"},
267     {0xF7, "Vendor Specific"},
268     {0xF8, "Vendor Specific"},
269     {0xF9, "Vendor Specific"},
270     {0xFA, "Vendor Specific"},
271     {0xFB, "Vendor Specific"},
272     {0xFC, "Vendor Specific"},
273     {0xFD, "Vendor Specific"},
274     {0xFE, "Vendor Specific"},
275     {0xFF, "Vendor Specific"},
276     {0, NULL},
277 };
278
279 #define FC_SWILS_LSR_SLR    0x1 /* switch link record */
280 #define FC_SWILS_LSR_ARS    0x2 /* AR Summary record */
281
282 static const value_string fc_swils_fspf_linkrec_val[] = {
283     {FC_SWILS_LSR_SLR, "Switch Link Record"},
284     {FC_SWILS_LSR_ARS, "AR Summary Record"},
285     {0, NULL},
286 };
287
288 static const value_string fc_swils_fspf_lsrflags_val[] = {
289     {0x0, "LSR is for a Topology Update"},
290     {0x1, "LSR is for Initial DB Sync | Not the last seq in DB sync"},
291     {0x2, "Last Seq in DB Sync. LSU has no LSRs"},
292     {0x3, "LSR is for Initial DB Sync | Last Seq in DB Sync"},
293     {0, NULL},
294 };
295
296 #define FC_SWILS_PDESC_FSPF_BB 0x01
297 #define FC_SWILS_PDESC_FSPF    0x02
298
299 static const value_string fc_swils_rscn_portstate_val[] = {
300     {0, "No Additional Info"},
301     {1, "Port is online"},
302     {2, "Port is offline"},
303     {0, NULL},
304 };
305
306 static const value_string fc_swils_rscn_addrfmt_val[] = {
307     {0, "Port Addr Format"},
308     {1, "Area Addr Format"},
309     {2, "Domain Addr Format"},
310     {3, "Fabric Addr Format"},
311 };
312
313 static const value_string fc_swils_rscn_detectfn_val[] = {
314     {1, "Fabric Detected"},
315     {2, "N_Port Detected"},
316     {0, NULL},
317 };
318
319 static const value_string fc_swils_esc_protocol_val[] = {
320     {0, "Reserved"},
321     {1, "FSPF-Backbone Protocol"},
322     {2, "FSPF Protocol"},
323     {0, NULL},
324 };
325
326 #define FC_SWILS_ZONEOBJ_ZONESET    1
327 #define FC_SWILS_ZONEOBJ_ZONE       2
328 #define FC_SWILS_ZONEOBJ_ZONEALIAS  3
329
330 static const value_string fc_swils_zoneobj_type_val[] = {
331     {0, "Reserved"},
332     {FC_SWILS_ZONEOBJ_ZONESET  , "Zone Set"},
333     {FC_SWILS_ZONEOBJ_ZONE     , "Zone"},
334     {FC_SWILS_ZONEOBJ_ZONEALIAS, "Zone Alias"},
335     {0, NULL},
336 };
337
338 #define FC_SWILS_ZONEMBR_WWN             1
339 #define FC_SWILS_ZONEMBR_DP              2
340 #define FC_SWILS_ZONEMBR_FCID            3
341 #define FC_SWILS_ZONEMBR_ALIAS           4
342 #define FC_SWILS_ZONEMBR_WWN_LUN         0xE1
343 #define FC_SWILS_ZONEMBR_DP_LUN          0xE2
344 #define FC_SWILS_ZONEMBR_FCID_LUN        0xE3
345
346 static const value_string fc_swils_zonembr_type_val[] = {
347     {0, "Reserved"},
348     {FC_SWILS_ZONEMBR_WWN, "WWN"},
349     {FC_SWILS_ZONEMBR_DP, "Domain/Physical Port (0x00ddpppp)"},
350     {FC_SWILS_ZONEMBR_FCID, "FC Address"},
351     {FC_SWILS_ZONEMBR_ALIAS, "Zone Alias"},
352     {FC_SWILS_ZONEMBR_WWN_LUN, "WWN+LUN"},
353     {FC_SWILS_ZONEMBR_DP_LUN, "Domain/Physical Port+LUN"},
354     {FC_SWILS_ZONEMBR_FCID_LUN, "FCID+LUN"},
355     {0, NULL},
356 };
357
358 static const value_string fc_swils_mr_rsp_val[] = {
359     {0, "Successful"},
360     {1, "Fabric Busy"},
361     {2, "Failed"},
362     {0, NULL},
363 };
364
365 static const value_string fc_swils_mr_reason_val[] = {
366     {0x0, "No Reason"},
367     {0x1, "Invalid Data Length"},
368     {0x2, "Unsupported Command"},
369     {0x3, "Reserved"},
370     {0x4, "Not Authorized"},
371     {0x5, "Invalid Request"},
372     {0x6, "Fabric Changing"},
373     {0x7, "Update Not Staged"},
374     {0x8, "Invalid Zone Set Format"},
375     {0x9, "Invalid Data"},
376     {0xA, "Cannot Merge"},
377     {0, NULL},
378 };
379
380 static const value_string fc_swils_sfc_op_val[] = {
381     {0, "Reserved"},
382     {1, "Reserved"},
383     {2, "Reserved"},
384     {3, "Activate Zone Set"},
385     {4, "Deactivate Zone Set"},
386     {0, NULL},
387 };
388
389 #endif