Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-fcswils.c
blob4e7dee73cf52d6561cc1ac89c61477721a510acc
1 /* packet-fcswils.c
2 * Routines for FC Inter-switch link services
3 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/expert.h>
16 #include <epan/unit_strings.h>
18 #include "packet-fc.h"
19 #include "packet-fcswils.h"
20 #include "packet-fcct.h"
22 void proto_register_fcswils(void);
23 void proto_reg_handoff_fcswils(void);
25 static dissector_handle_t swils_handle;
28 * See the FC-SW specifications.
31 #define FC_SWILS_RPLY 0x0
32 #define FC_SWILS_REQ 0x1
33 #define FC_SWILS_RSCN_DEVENTRY_SIZE 20
35 /* Zone name has the structure:
36 * name_len (1 byte), rsvd (3 bytes), name (m bytes), fill (n bytes)
37 * name_len excludes the 4 initial bytes before the name
39 #define ZONENAME_LEN(x, y) (tvb_get_uint8(x, y)+4)
41 /* Initialize the protocol and registered fields */
42 static int proto_fcswils;
43 static int hf_swils_opcode;
44 static int hf_swils_elp_rev;
45 static int hf_swils_elp_flags;
46 static int hf_swils_elp_r_a_tov;
47 static int hf_swils_elp_e_d_tov;
48 static int hf_swils_elp_req_epn;
49 static int hf_swils_elp_req_esn;
50 static int hf_swils_elp_clsf_svcp;
51 static int hf_swils_elp_clsf_rcvsz;
52 static int hf_swils_elp_clsf_conseq;
53 static int hf_swils_elp_clsf_e2e;
54 static int hf_swils_elp_clsf_openseq;
55 static int hf_swils_elp_cls1_svcp;
56 static int hf_swils_elp_cls1_rcvsz;
57 static int hf_swils_elp_cls2_svcp;
58 static int hf_swils_elp_cls2_rcvsz;
59 static int hf_swils_elp_cls3_svcp;
60 static int hf_swils_elp_cls3_rcvsz;
61 static int hf_swils_elp_isl_fc_mode;
62 static int hf_swils_elp_fcplen;
63 static int hf_swils_elp_b2bcredit;
64 static int hf_swils_elp_compat1;
65 static int hf_swils_elp_compat2;
66 static int hf_swils_elp_compat3;
67 static int hf_swils_elp_compat4;
68 static int hf_swils_efp_rec_type;
69 static int hf_swils_efp_dom_id;
70 static int hf_swils_efp_switch_name;
71 static int hf_swils_efp_mcast_grpno;
72 /* static int hf_swils_efp_alias_token; */
73 static int hf_swils_efp_record_len;
74 static int hf_swils_efp_payload_len;
75 static int hf_swils_efp_pswitch_pri;
76 static int hf_swils_efp_pswitch_name;
77 static int hf_swils_dia_switch_name;
78 static int hf_swils_rdi_payload_len;
79 static int hf_swils_rdi_req_sname;
80 /* static int hf_swils_fspfh_cmd; */
81 static int hf_swils_fspfh_rev;
82 static int hf_swils_fspfh_ar_num;
83 static int hf_swils_fspfh_auth_type;
84 static int hf_swils_fspfh_dom_id;
85 static int hf_swils_fspfh_auth;
86 static int hf_swils_hlo_options;
87 static int hf_swils_hlo_hloint;
88 static int hf_swils_hlo_deadint;
89 static int hf_swils_hlo_rcv_domid;
90 static int hf_swils_hlo_orig_pidx;
91 static int hf_swils_ldrec_linkid;
92 static int hf_swils_ldrec_out_pidx;
93 static int hf_swils_ldrec_nbr_pidx;
94 static int hf_swils_ldrec_link_type;
95 static int hf_swils_ldrec_link_cost;
96 static int hf_swils_lsrh_lsr_type;
97 static int hf_swils_lsrh_lsid;
98 static int hf_swils_lsrh_adv_domid;
99 static int hf_swils_lsrh_ls_incid;
100 static int hf_swils_esc_pdesc_vendorid;
101 static int hf_swils_esc_swvendorid;
102 static int hf_swils_esc_protocolid;
103 static int hf_swils_rscn_evtype;
104 static int hf_swils_rscn_addrfmt;
105 static int hf_swils_rscn_detectfn;
106 static int hf_swils_rscn_affectedport;
107 static int hf_swils_rscn_portstate;
108 static int hf_swils_rscn_portid;
109 static int hf_swils_rscn_pwwn;
110 static int hf_swils_rscn_nwwn;
111 static int hf_swils_zone_activezonenm;
112 static int hf_swils_zone_objname;
113 static int hf_swils_zone_objtype;
114 static int hf_swils_zone_mbrtype;
115 static int hf_swils_zone_protocol;
116 static int hf_swils_zone_mbrid;
117 static int hf_swils_zone_mbrid_fcwwn;
118 static int hf_swils_zone_mbrid_fc;
119 static int hf_swils_zone_mbrid_uint;
120 static int hf_swils_zone_status;
121 static int hf_swils_zone_reason;
122 static int hf_swils_aca_domainid;
123 static int hf_swils_sfc_opcode;
124 static int hf_swils_sfc_zonenm;
125 static int hf_swils_rjt;
126 static int hf_swils_rjtdet;
127 static int hf_swils_rjtvendor;
128 static int hf_swils_zone_mbrid_lun;
129 static int hf_swils_ess_rev;
130 static int hf_swils_ess_len;
131 static int hf_swils_ess_numobj;
132 static int hf_swils_interconnect_list_len;
133 static int hf_swils_ess_vendorname;
134 static int hf_swils_ess_modelname;
135 static int hf_swils_ess_relcode;
136 static int hf_swils_ess_vendorspecific;
137 static int hf_swils_ess_cap_type;
138 static int hf_swils_ess_cap_subtype;
139 static int hf_swils_ess_cap_numentries;
140 static int hf_swils_ess_cap_svc;
141 static int hf_swils_ess_dns_obj0h;
142 static int hf_swils_ess_dns_obj1h;
143 static int hf_swils_ess_dns_obj2h;
144 static int hf_swils_ess_dns_obj3h;
145 static int hf_swils_ess_dns_zlacc;
146 static int hf_swils_ess_dns_vendor;
147 static int hf_swils_ess_fctlr_rscn;
148 static int hf_swils_ess_fctlr_vendor;
149 static int hf_swils_ess_fcs_basic;
150 static int hf_swils_ess_fcs_platform;
151 static int hf_swils_ess_fcs_topology;
152 static int hf_swils_ess_fcs_enhanced;
153 static int hf_swils_ess_fzs_enh_supp;
154 static int hf_swils_ess_fzs_enh_ena;
155 static int hf_swils_ess_fzs_mr;
156 static int hf_swils_ess_fzs_zsdb_supp;
157 static int hf_swils_ess_fzs_zsdb_ena;
158 static int hf_swils_ess_fzs_adc_supp;
159 static int hf_swils_ess_fzs_hardzone;
160 static int hf_swils_mrra_rev;
161 static int hf_swils_mrra_size;
162 static int hf_swils_mrra_vendorid;
163 static int hf_swils_mrra_reply;
164 static int hf_swils_mrra_reply_size;
165 static int hf_swils_mrra_waittime;
166 static int hf_swils_ess_cap_t10;
167 static int hf_swils_ess_cap_vendorobj;
168 static int hf_swils_ess_fzs_defzone;
169 static int hf_swils_ess_cap_len;
170 static int hf_swils_mrra_vendorinfo;
172 /* Generated from convert_proto_tree_add_text.pl */
173 static int hf_swils_lsrh_lsr_age;
174 static int hf_swils_zone_full_zone_set_length;
175 static int hf_swils_zone_num_zoning_objects;
176 static int hf_swils_lsrec_number_of_links;
177 static int hf_swils_sfc_zoneset_length;
178 static int hf_swils_zone_vendor_unique;
179 static int hf_swils_zone_num_members;
180 static int hf_swils_zone_active_zoneset_length;
181 static int hf_swils_lsack_num_of_lsr_headers;
182 static int hf_swils_lsrh_lsr_length;
183 static int hf_swils_esc_payload_length;
184 static int hf_swils_lsupdate_num_of_lsrs;
185 static int hf_swils_zone_mbr_identifier_length;
186 static int hf_swils_zone_mbrflags;
187 static int hf_swils_lsrh_options;
188 static int hf_swils_domain_id_list_length;
189 static int hf_swils_lsack_flags;
190 static int hf_swils_rscn_num_entries;
191 static int hf_swils_requested_domain_id;
192 static int hf_swils_lsrh_checksum;
193 static int hf_swils_granted_domain_id;
194 static int hf_swils_lsupdate_flags;
197 static expert_field ei_swils_efp_record_len;
198 static expert_field ei_swils_no_exchange;
199 static expert_field ei_swils_zone_mbrid;
201 /* Initialize the subtree pointers */
202 static int ett_fcswils;
203 static int ett_fcswils_swacc;
204 static int ett_fcswils_swrjt;
205 static int ett_fcswils_elp;
206 static int ett_fcswils_efp;
207 static int ett_fcswils_efplist;
208 static int ett_fcswils_dia;
209 static int ett_fcswils_rdi;
210 static int ett_fcswils_fspfhdr;
211 static int ett_fcswils_hlo;
212 static int ett_fcswils_lsrec;
213 static int ett_fcswils_lsrechdr;
214 static int ett_fcswils_ldrec;
215 static int ett_fcswils_lsu;
216 static int ett_fcswils_lsa;
217 static int ett_fcswils_bf;
218 static int ett_fcswils_rcf;
219 static int ett_fcswils_rscn;
220 static int ett_fcswils_rscn_dev;
221 static int ett_fcswils_drlir;
222 static int ett_fcswils_mr;
223 static int ett_fcswils_zoneobjlist;
224 static int ett_fcswils_zoneobj;
225 static int ett_fcswils_zonembr;
226 static int ett_fcswils_aca;
227 static int ett_fcswils_rca;
228 static int ett_fcswils_sfc;
229 static int ett_fcswils_ufc;
230 static int ett_fcswils_esc;
231 static int ett_fcswils_esc_pdesc;
232 static int ett_fcswils_ieinfo;
233 static int ett_fcswils_capinfo;
235 static const value_string fc_swils_opcode_key_val[] = {
236 {FC_SWILS_SWRJT , "SW_RJT"},
237 {FC_SWILS_SWACC , "SW_ACC"},
238 {FC_SWILS_ELP , "ELP"},
239 {FC_SWILS_EFP , "EFP"},
240 {FC_SWILS_DIA , "DIA"},
241 {FC_SWILS_RDI , "RDI"},
242 {FC_SWILS_HLO , "HLO"},
243 {FC_SWILS_LSU , "LSU"},
244 {FC_SWILS_LSA , "LSA"},
245 {FC_SWILS_BF , "BF"},
246 {FC_SWILS_RCF , "RCF"},
247 {FC_SWILS_RSCN , "SW_RSCN"},
248 {FC_SWILS_DRLIR , "DRLIR"},
249 {FC_SWILS_DSCN , "DSCN"},
250 {FC_SWILS_LOOPD , "LOOPD"},
251 {FC_SWILS_MR , "MR"},
252 {FC_SWILS_ACA , "ACA"},
253 {FC_SWILS_RCA , "RCA"},
254 {FC_SWILS_SFC , "SFC"},
255 {FC_SWILS_UFC , "UFC"},
256 {FC_SWILS_ESC , "ESC"},
257 {FC_SWILS_ESS , "ESS"},
258 {FC_SWILS_MRRA , "MRRA"},
259 {FC_SWILS_AUTH_ILS, "AUTH_ILS"},
260 {0, NULL},
263 static const value_string fc_swils_rjt_val [] = {
264 {FC_SWILS_RJT_INVCODE , "Invalid Cmd Code"},
265 {FC_SWILS_RJT_INVVER , "Invalid Revision"},
266 {FC_SWILS_RJT_LOGERR , "Logical Error"},
267 {FC_SWILS_RJT_INVSIZE , "Invalid Size"},
268 {FC_SWILS_RJT_LOGBSY , "Logical Busy"},
269 {FC_SWILS_RJT_PROTERR , "Protocol Error"},
270 {FC_SWILS_RJT_GENFAIL , "Unable to Perform"},
271 {FC_SWILS_RJT_CMDNOTSUPP, "Unsupported Cmd"},
272 {FC_SWILS_RJT_VENDUNIQ , "Vendor Unique Err"},
273 {0, NULL},
276 static const value_string fc_swils_deterr_val [] = {
277 {FC_SWILS_RJT_NODET , "No Additional Details"},
278 {FC_SWILS_RJT_CLSF_ERR , "Class F Svc Param Err"},
279 {FC_SWILS_RJT_CLSN_ERR , "Class N Svc Param Err"},
280 {FC_SWILS_RJT_INVFC_CODE, "Unknown Flow Ctrl Code"},
281 {FC_SWILS_RJT_INVFC_PARM, "Invalid Flow Ctrl Parm"},
282 {FC_SWILS_RJT_INV_PNAME , "Invalid Port Name"},
283 {FC_SWILS_RJT_INV_SNAME , "Invalid Switch Name"},
284 {FC_SWILS_RJT_TOV_MSMTCH, "R_A_/E_D_TOV Mismatch"},
285 {FC_SWILS_RJT_INV_DIDLST, "Invalid Domain ID List"},
286 {FC_SWILS_RJT_CMD_INPROG, "Cmd Already in Progress"},
287 {FC_SWILS_RJT_OORSRC , "Insufficient Resources"},
288 {FC_SWILS_RJT_NO_DID , "Domain ID Unavailable"},
289 {FC_SWILS_RJT_INV_DID , "Invalid Domain ID"},
290 {FC_SWILS_RJT_NO_REQ , "Request Not Supported"},
291 {FC_SWILS_RJT_NOLNK_PARM, "Link Parm Not Estd."},
292 {FC_SWILS_RJT_NO_REQDID , "Group of Domain IDs Unavail"},
293 {FC_SWILS_RJT_EP_ISOL , "E_Port Isolated"},
294 {0, NULL}
297 static const value_string fcswils_elp_fc_val[] = {
298 {FC_SWILS_ELP_FC_VENDOR, "Vendor Unique"},
299 {FC_SWILS_ELP_FC_RRDY , "R_RDY Flow Ctrl"},
300 {0, NULL},
303 static const value_string fcswils_rectype_val[] = {
304 {FC_SWILS_LRECTYPE_DOMAIN, "Domain ID Record"},
305 {FC_SWILS_LRECTYPE_MCAST , "Multicast ID Record"},
306 {0, NULL},
309 static const value_string fc_swils_link_type_val[] = {
310 {0x01, "P2P Link"},
311 {0xF0, "Vendor Specific"},
312 {0xF1, "Vendor Specific"},
313 {0xF2, "Vendor Specific"},
314 {0xF3, "Vendor Specific"},
315 {0xF4, "Vendor Specific"},
316 {0xF5, "Vendor Specific"},
317 {0xF6, "Vendor Specific"},
318 {0xF7, "Vendor Specific"},
319 {0xF8, "Vendor Specific"},
320 {0xF9, "Vendor Specific"},
321 {0xFA, "Vendor Specific"},
322 {0xFB, "Vendor Specific"},
323 {0xFC, "Vendor Specific"},
324 {0xFD, "Vendor Specific"},
325 {0xFE, "Vendor Specific"},
326 {0xFF, "Vendor Specific"},
327 {0, NULL},
330 static const value_string fc_swils_fspf_linkrec_val[] = {
331 {FC_SWILS_LSR_SLR, "Switch Link Record"},
332 {FC_SWILS_LSR_ARS, "AR Summary Record"},
333 {0, NULL},
336 static const value_string fc_swils_fspf_lsrflags_val[] = {
337 {0x0, "LSR is for a Topology Update"},
338 {0x1, "LSR is for Initial DB Sync | Not the last seq in DB sync"},
339 {0x2, "Last Seq in DB Sync. LSU has no LSRs"},
340 {0x3, "LSR is for Initial DB Sync | Last Seq in DB Sync"},
341 {0, NULL},
344 static const value_string fc_swils_rscn_portstate_val[] = {
345 {0, "No Additional Info"},
346 {1, "Port is online"},
347 {2, "Port is offline"},
348 {0, NULL},
351 static const value_string fc_swils_rscn_addrfmt_val[] = {
352 {0, "Port Addr Format"},
353 {1, "Area Addr Format"},
354 {2, "Domain Addr Format"},
355 {3, "Fabric Addr Format"},
356 {0, NULL},
359 static const value_string fc_swils_rscn_detectfn_val[] = {
360 {1, "Fabric Detected"},
361 {2, "N_Port Detected"},
362 {0, NULL},
365 static const value_string fc_swils_esc_protocol_val[] = {
366 {0, "Reserved"},
367 {1, "FSPF-Backbone Protocol"},
368 {2, "FSPF Protocol"},
369 {0, NULL},
372 static const value_string fc_swils_zoneobj_type_val[] = {
373 {0, "Reserved"},
374 {FC_SWILS_ZONEOBJ_ZONESET , "Zone Set"},
375 {FC_SWILS_ZONEOBJ_ZONE , "Zone"},
376 {FC_SWILS_ZONEOBJ_ZONEALIAS, "Zone Alias"},
377 {0, NULL},
380 const value_string fc_swils_zonembr_type_val[] = {
381 {0 , "Reserved"},
382 {FC_SWILS_ZONEMBR_WWN , "WWN"},
383 {FC_SWILS_ZONEMBR_DP , "Domain/Physical Port (0x00ddpppp)"},
384 {FC_SWILS_ZONEMBR_FCID , "FC Address"},
385 {FC_SWILS_ZONEMBR_ALIAS , "Zone Alias"},
386 {FC_SWILS_ZONEMBR_WWN_LUN , "WWN+LUN"},
387 {FC_SWILS_ZONEMBR_DP_LUN , "Domain/Physical Port+LUN"},
388 {FC_SWILS_ZONEMBR_FCID_LUN, "FCID+LUN"},
389 {0, NULL},
392 static const value_string fc_swils_mr_rsp_val[] = {
393 {0, "Successful"},
394 {1, "Fabric Busy"},
395 {2, "Failed"},
396 {0, NULL},
399 static const value_string fc_swils_mr_reason_val[] = {
400 {0x0, "No Reason"},
401 {0x1, "Invalid Data Length"},
402 {0x2, "Unsupported Command"},
403 {0x3, "Reserved"},
404 {0x4, "Not Authorized"},
405 {0x5, "Invalid Request"},
406 {0x6, "Fabric Changing"},
407 {0x7, "Update Not Staged"},
408 {0x8, "Invalid Zone Set Format"},
409 {0x9, "Invalid Data"},
410 {0xA, "Cannot Merge"},
411 {0, NULL},
414 static const value_string fc_swils_sfc_op_val[] = {
415 {0, "Reserved"},
416 {1, "Reserved"},
417 {2, "Reserved"},
418 {3, "Activate Zone Set"},
419 {4, "Deactivate Zone Set"},
420 {0, NULL},
423 typedef struct _zonename {
424 uint32_t namelen:8,
425 rsvd:24;
426 char *name;
427 char *pad;
428 } zonename_t;
430 typedef struct _fcswils_conv_key {
431 uint32_t conv_idx;
432 } fcswils_conv_key_t;
434 typedef struct _fcswils_conv_data {
435 uint32_t opcode;
436 } fcswils_conv_data_t;
438 static wmem_map_t *fcswils_req_hash;
440 /* list of commands for each commandset */
441 typedef void (*fcswils_dissector_t)(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, uint8_t isreq);
443 typedef struct _fcswils_func_table_t {
444 fcswils_dissector_t func;
445 } fcswils_func_table_t;
447 static dissector_handle_t fcsp_handle;
449 static int get_zoneobj_len(tvbuff_t *tvb, int offset);
452 * Hash Functions
454 static int
455 fcswils_equal(const void *v, const void *w)
457 const fcswils_conv_key_t *v1 = (const fcswils_conv_key_t *)v;
458 const fcswils_conv_key_t *v2 = (const fcswils_conv_key_t *)w;
460 return (v1->conv_idx == v2->conv_idx);
463 static unsigned
464 fcswils_hash(const void *v)
466 const fcswils_conv_key_t *key = (const fcswils_conv_key_t *)v;
467 unsigned val;
469 val = key->conv_idx;
471 return val;
474 static uint8_t *
475 zonenm_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int offset)
477 int len = tvb_get_uint8(tvb, offset);
478 return tvb_get_string_enc(scope, tvb, offset+4, len, ENC_ASCII);
481 /* Offset points to the start of the zone object */
482 static int
483 get_zoneobj_len(tvbuff_t *tvb, int offset)
485 int numrec, numrec1;
486 uint8_t objtype;
487 int i, j, len;
489 /* zone object structure is:
490 * type (1 byte), protocol (1 byte), rsvd (2 bytes), obj name (x bytes),
491 * num of zone mbrs (4 bytes ), list of zone members (each member if of
492 * variable length).
494 * zone member structure is:
495 * type (1 byte), rsvd (1 byte), flags (1 byte), id_len (1 byte),
496 * id (id_len bytes)
498 objtype = tvb_get_uint8(tvb, offset);
499 len = 4 + ZONENAME_LEN(tvb, offset+4); /* length up to num_of_mbrs field */
500 numrec = tvb_get_ntohl(tvb, offset+len); /* gets us num of zone mbrs */
502 len += 4; /* + num_mbrs */
503 for (i = 0; i < numrec; i++) {
504 if (objtype == FC_SWILS_ZONEOBJ_ZONESET) {
505 len += 4 + ZONENAME_LEN(tvb, offset+4+len); /* length up to num_of_mbrs field */
506 numrec1 = tvb_get_ntohl(tvb, offset+len);
508 len += 4;
509 for (j = 0; j < numrec1; j++) {
510 len += 4 + tvb_get_uint8(tvb, offset+3+len);
513 else {
514 len += 4 + tvb_get_uint8(tvb, offset+3+len);
518 return len;
521 #define MAX_INTERCONNECT_ELEMENT_INFO_LEN 252
522 static int
523 dissect_swils_interconnect_element_info(tvbuff_t *tvb, proto_tree *tree, int offset)
526 int len, max_len = MAX_INTERCONNECT_ELEMENT_INFO_LEN;
528 if (tree) {
529 proto_tree_add_item(tree, hf_swils_interconnect_list_len, tvb, offset+3, 1, ENC_BIG_ENDIAN);
530 len = tvb_strsize(tvb, offset+4);
531 proto_tree_add_item(tree, hf_swils_ess_vendorname, tvb, offset+4, len, ENC_ASCII);
532 offset += (4 + len);
533 max_len -= len;
534 len = tvb_strsize(tvb, offset);
535 proto_tree_add_item(tree, hf_swils_ess_modelname, tvb, offset, len, ENC_ASCII);
536 offset += len;
537 max_len -= len;
538 len = tvb_strsize(tvb, offset);
539 proto_tree_add_item(tree, hf_swils_ess_relcode, tvb, offset, len, ENC_ASCII);
540 offset += len;
541 max_len -= len;
542 while (max_len > 0) {
543 /* Vendor specific field is a set of one or more null-terminated
544 * strings
546 len = tvb_strsize(tvb, offset);
547 proto_tree_add_item(tree, hf_swils_ess_vendorspecific, tvb, offset, len, ENC_ASCII);
548 offset += len;
549 max_len -= len;
553 return true;
556 static void
557 dissect_swils_ess_capability(tvbuff_t *tvb, proto_tree *tree, int offset,
558 uint8_t srvr_type)
560 if (tree) {
561 switch (srvr_type) {
562 case FCCT_GSRVR_DNS:
563 proto_tree_add_item(tree, hf_swils_ess_dns_zlacc, tvb, offset+3,
564 1, ENC_BIG_ENDIAN);
565 proto_tree_add_item(tree, hf_swils_ess_dns_obj3h, tvb, offset+3,
566 1, ENC_BIG_ENDIAN);
567 proto_tree_add_item(tree, hf_swils_ess_dns_obj2h, tvb, offset+3,
568 1, ENC_BIG_ENDIAN);
569 proto_tree_add_item(tree, hf_swils_ess_dns_obj1h, tvb, offset+3,
570 1, ENC_BIG_ENDIAN);
571 proto_tree_add_item(tree, hf_swils_ess_dns_obj0h, tvb, offset+3,
572 1, ENC_BIG_ENDIAN);
573 proto_tree_add_item(tree, hf_swils_ess_dns_vendor, tvb,
574 offset+4, 4, ENC_BIG_ENDIAN);
575 break;
576 case FCCT_GSRVR_FCTLR:
577 proto_tree_add_item(tree, hf_swils_ess_fctlr_rscn, tvb,
578 offset+3, 1, ENC_BIG_ENDIAN);
579 proto_tree_add_item(tree, hf_swils_ess_fctlr_vendor, tvb,
580 offset+4, 4, ENC_BIG_ENDIAN);
581 break;
582 case FCCT_GSRVR_FCS:
583 proto_tree_add_item(tree, hf_swils_ess_fcs_basic, tvb,
584 offset+3, 1, ENC_BIG_ENDIAN);
585 proto_tree_add_item(tree, hf_swils_ess_fcs_platform, tvb,
586 offset+3, 1, ENC_BIG_ENDIAN);
587 proto_tree_add_item(tree, hf_swils_ess_fcs_topology, tvb,
588 offset+3, 1, ENC_BIG_ENDIAN);
589 proto_tree_add_item(tree, hf_swils_ess_fcs_enhanced, tvb,
590 offset+3, 1, ENC_BIG_ENDIAN);
591 break;
592 case FCCT_GSRVR_FZS:
593 proto_tree_add_item(tree, hf_swils_ess_fzs_enh_supp, tvb,
594 offset+3, 1, ENC_BIG_ENDIAN);
595 proto_tree_add_item(tree, hf_swils_ess_fzs_enh_ena, tvb,
596 offset+3, 1, ENC_BIG_ENDIAN);
597 proto_tree_add_item(tree, hf_swils_ess_fzs_mr, tvb, offset+3,
598 1, ENC_BIG_ENDIAN);
599 proto_tree_add_item(tree, hf_swils_ess_fzs_defzone, tvb,
600 offset+3, 1, ENC_BIG_ENDIAN);
601 proto_tree_add_item(tree, hf_swils_ess_fzs_zsdb_supp, tvb,
602 offset+3, 1, ENC_BIG_ENDIAN);
603 proto_tree_add_item(tree, hf_swils_ess_fzs_zsdb_ena, tvb,
604 offset+3, 1, ENC_BIG_ENDIAN);
605 proto_tree_add_item(tree, hf_swils_ess_fzs_adc_supp, tvb,
606 offset+3, 1, ENC_BIG_ENDIAN);
607 proto_tree_add_item(tree, hf_swils_ess_fzs_hardzone, tvb,
608 offset+3, 1, ENC_BIG_ENDIAN);
609 break;
610 default:
611 break;
615 return;
618 static int
619 dissect_swils_ess_capability_obj(tvbuff_t *tvb, proto_tree *tree, int offset)
621 int i = 0, num_entries = 0, len = 0, total_len = 0;
622 uint8_t type, subtype, srvr_type;
623 proto_tree *capinfo_tree = NULL;
625 if (tree) {
627 * Structure of capability object is: WK type (1B), WK subtype(1),
628 * rsvd (1), num_cap_entries (1), entry_1 (8) ... entry_n (8)
630 /* Compute length first to create subtree of cap object */
631 type = tvb_get_uint8(tvb, offset);
632 if (type != FCCT_GSTYPE_VENDOR) {
633 num_entries = tvb_get_uint8(tvb, offset+3);
634 total_len = 4 + (num_entries*8);
635 capinfo_tree = proto_tree_add_subtree_format(tree, tvb, offset,
636 total_len, ett_fcswils_capinfo, NULL, "Capability Object (%s)",
637 val_to_str(type, fc_ct_gstype_vals,
638 "Unknown (0x%x)"));
639 } else {
640 i = tvb_get_uint8(tvb, offset+3);
641 i += 12;
643 capinfo_tree = proto_tree_add_subtree_format(tree, tvb, offset,
644 i, ett_fcswils_capinfo, NULL, "Capability Object (Vendor-specific 0x%x)",
645 type);
648 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
649 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_subtype, tvb, offset+1,
650 1, ENC_BIG_ENDIAN);
651 subtype = tvb_get_uint8(tvb, offset+1);
653 if (type != FCCT_GSTYPE_VENDOR) {
654 srvr_type = get_gs_server(type, subtype);
655 proto_tree_add_uint(capinfo_tree, hf_swils_ess_cap_svc, tvb, offset, 2,
656 srvr_type);
657 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_numentries, tvb,
658 offset+3, 1, ENC_BIG_ENDIAN);
659 offset += 4;
660 len += 4;
662 while ((num_entries > 0) && tvb_bytes_exist(tvb, offset, 8)) {
663 dissect_swils_ess_capability(tvb, capinfo_tree, offset, srvr_type);
664 num_entries--;
665 offset += 8;
666 len += 8;
668 } else {
669 /* Those damn T11 guys defined another format for
670 * Vendor-specific objects.
672 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_len, tvb, offset+3,
673 1, ENC_BIG_ENDIAN);
674 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_t10, tvb, offset+4,
675 8, ENC_ASCII);
676 i -= 8; /* reduce length by t10 object size */
677 offset += 12;
678 len += 12;
680 while ((i > 0) && tvb_bytes_exist(tvb, offset, 8)) {
681 proto_tree_add_item(capinfo_tree, hf_swils_ess_cap_vendorobj,
682 tvb, offset, 8, ENC_NA);
683 i -= 8;
684 offset += 8;
685 len += 12;
689 return len;
692 static void
693 dissect_swils_nullpayload(tvbuff_t *tvb _U_, packet_info* pinfo _U_, proto_tree *tree _U_,
694 uint8_t isreq _U_)
696 /* Common dissector for those ILSs without a payload */
697 return;
700 static void
701 dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *elp_tree, uint8_t isreq _U_)
704 /* Set up structures needed to add the protocol subtree and manage it */
705 /* Response i.e. SW_ACC for an ELP has the same format as the request */
706 /* We skip the initial 4 bytes as we don't care about the opcode */
707 int offset = 4;
708 const char *flags;
709 uint16_t isl_flwctrl_mode;
710 uint8_t clsf_svcparm[6], cls1_svcparm[2], cls2_svcparm[2], cls3_svcparm[2];
712 if (elp_tree) {
713 offset += 4;
714 proto_tree_add_item(elp_tree, hf_swils_elp_rev, tvb, offset++, 1, ENC_BIG_ENDIAN);
715 proto_tree_add_item(elp_tree, hf_swils_elp_flags, tvb, offset, 2, ENC_NA);
716 offset += 3;
717 proto_tree_add_item(elp_tree, hf_swils_elp_r_a_tov, tvb, offset, 4, ENC_BIG_ENDIAN);
718 offset += 4;
719 proto_tree_add_item(elp_tree, hf_swils_elp_e_d_tov, tvb, offset, 4, ENC_BIG_ENDIAN);
720 offset += 4;
721 proto_tree_add_item(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8, ENC_NA);
722 offset += 8;
723 proto_tree_add_item(elp_tree, hf_swils_elp_req_esn, tvb, offset, 8, ENC_NA);
724 offset += 8;
726 tvb_memcpy(tvb, clsf_svcparm, offset, 6);
727 if (clsf_svcparm[0] & 0x80) {
728 if (clsf_svcparm[4] & 0x20) {
729 flags="Class F Valid | X_ID Interlock";
730 } else {
731 flags="Class F Valid | No X_ID Interlk";
733 } else {
734 flags="Class F Invld";
736 proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_clsf_svcp, tvb, offset, 6,
737 clsf_svcparm, "(%s)", flags);
738 offset += 6;
740 proto_tree_add_item(elp_tree, hf_swils_elp_clsf_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
741 offset += 2;
742 proto_tree_add_item(elp_tree, hf_swils_elp_clsf_conseq, tvb, offset, 2, ENC_BIG_ENDIAN);
743 offset += 2;
744 proto_tree_add_item(elp_tree, hf_swils_elp_clsf_e2e, tvb, offset, 2, ENC_BIG_ENDIAN);
745 offset += 2;
746 proto_tree_add_item(elp_tree, hf_swils_elp_clsf_openseq, tvb, offset, 2, ENC_BIG_ENDIAN);
747 offset += 4;
749 tvb_memcpy(tvb, cls1_svcparm, offset, 2);
750 if (cls1_svcparm[0] & 0x80) {
751 #define MAX_FLAGS_LEN 40
752 char *flagsbuf;
753 int stroff, returned_length;
755 flagsbuf=(char *)wmem_alloc(pinfo->pool, MAX_FLAGS_LEN);
756 stroff = 0;
758 returned_length = snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff,
759 "Class 1 Valid");
760 stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
761 if (cls1_svcparm[0] & 0x40) {
762 returned_length = snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IMX");
763 stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
765 if (cls1_svcparm[0] & 0x20) {
766 returned_length = snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IPS");
767 stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
769 if (cls1_svcparm[0] & 0x10) {
770 /*returned_length =*/ snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | LKS");
772 flags=flagsbuf;
774 else {
775 flags="Class 1 Invalid";
778 proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls1_svcp, tvb, offset, 2,
779 NULL, "(%s)", flags);
780 offset += 2;
781 if (cls1_svcparm[0] & 0x80) {
782 proto_tree_add_item(elp_tree, hf_swils_elp_cls1_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
784 offset += 2;
786 tvb_memcpy(tvb, cls2_svcparm, offset, 2);
787 if (cls2_svcparm[0] & 0x80) {
788 if (cls2_svcparm[0] & 0x08) {
789 flags="Class 2 Valid | Seq Delivery";
791 else {
792 flags="Class 2 Valid | No Seq Delivery";
795 else {
796 flags="Class 2 Invld";
799 proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls2_svcp, tvb, offset, 2,
800 cls2_svcparm,
801 "(%s)", flags);
802 offset += 2;
804 if (cls2_svcparm[0] & 0x80) {
805 proto_tree_add_item(elp_tree, hf_swils_elp_cls2_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
807 offset += 2;
809 tvb_memcpy(tvb, cls3_svcparm, offset, 2);
810 if (cls3_svcparm[0] & 0x80) {
811 if (cls3_svcparm[0] & 0x08) {
812 flags="Class 3 Valid | Seq Delivery";
814 else {
815 flags="Class 3 Valid | No Seq Delivery";
818 else {
819 flags="Class 3 Invld";
821 proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls3_svcp, tvb, offset, 2,
822 cls3_svcparm,
823 "(%s)", flags);
824 offset += 2;
826 if (cls3_svcparm[0] & 0x80) {
827 proto_tree_add_item(elp_tree, hf_swils_elp_cls3_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
829 offset += 22;
831 isl_flwctrl_mode = tvb_get_ntohs(tvb, offset);
832 proto_tree_add_string(elp_tree, hf_swils_elp_isl_fc_mode, tvb, offset, 2,
833 val_to_str_const(isl_flwctrl_mode, fcswils_elp_fc_val, "Vendor Unique"));
834 offset += 2;
835 proto_tree_add_item(elp_tree, hf_swils_elp_fcplen, tvb, offset, 2, ENC_BIG_ENDIAN);
836 offset += 2;
837 proto_tree_add_item(elp_tree, hf_swils_elp_b2bcredit, tvb, offset, 4, ENC_BIG_ENDIAN);
838 offset += 4;
839 proto_tree_add_item(elp_tree, hf_swils_elp_compat1, tvb, offset, 4, ENC_BIG_ENDIAN);
840 offset += 4;
841 proto_tree_add_item(elp_tree, hf_swils_elp_compat2, tvb, offset, 4, ENC_BIG_ENDIAN);
842 offset += 4;
843 proto_tree_add_item(elp_tree, hf_swils_elp_compat3, tvb, offset, 4, ENC_BIG_ENDIAN);
844 offset += 4;
845 proto_tree_add_item(elp_tree, hf_swils_elp_compat4, tvb, offset, 4, ENC_BIG_ENDIAN);
850 static void
851 dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, uint8_t isreq _U_)
854 /* Set up structures needed to add the protocol subtree and manage it */
855 proto_tree *lrec_tree;
856 proto_item *rec_item;
857 int num_listrec = 0;
858 int offset = 1; /* Skip opcode */
859 uint8_t reclen;
860 uint16_t payload_len;
861 uint8_t rec_type;
863 reclen = tvb_get_uint8(tvb, offset);
864 rec_item = proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, reclen);
865 offset += 1;
866 payload_len = tvb_get_ntohs(tvb, offset);
867 if (payload_len < FC_SWILS_EFP_SIZE) {
868 proto_tree_add_uint_format_value(efp_tree, hf_swils_efp_payload_len,
869 tvb, offset, 2, payload_len,
870 "%u (bogus, must be >= %u)",
871 payload_len, FC_SWILS_EFP_SIZE);
872 return;
874 proto_tree_add_item(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN);
875 offset += 5; /* skip 3 reserved bytes, too */
876 proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_pri, tvb,
877 offset, 1, ENC_BIG_ENDIAN);
878 offset += 1;
879 proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, 8, ENC_NA);
880 offset += 8;
882 if (reclen == 0) {
883 expert_add_info(pinfo, rec_item, &ei_swils_efp_record_len);
884 return;
886 /* Add List Records now */
887 if (efp_tree) {
888 num_listrec = (payload_len - FC_SWILS_EFP_SIZE)/reclen;
889 while (num_listrec-- > 0) {
890 rec_type = tvb_get_uint8(tvb, offset);
891 lrec_tree = proto_tree_add_subtree(efp_tree, tvb, offset, -1,
892 ett_fcswils_efplist, NULL,
893 val_to_str(rec_type,
894 fcswils_rectype_val,
895 "Unknown record type (0x%02x)"));
896 proto_tree_add_uint(lrec_tree, hf_swils_efp_rec_type, tvb, offset, 1,
897 rec_type);
898 switch (rec_type) {
900 case FC_SWILS_LRECTYPE_DOMAIN:
901 proto_tree_add_item(lrec_tree, hf_swils_efp_dom_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
902 proto_tree_add_item(lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8, ENC_NA);
903 break;
905 case FC_SWILS_LRECTYPE_MCAST:
906 proto_tree_add_item(lrec_tree, hf_swils_efp_mcast_grpno, tvb, offset+1, 1, ENC_BIG_ENDIAN);
907 break;
909 offset += reclen;
914 static void
915 dissect_swils_dia(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *dia_tree, uint8_t isreq _U_)
917 /* Set up structures needed to add the protocol subtree and manage it */
918 int offset = 0;
920 if (dia_tree) {
921 proto_tree_add_item(dia_tree, hf_swils_dia_switch_name, tvb, offset+4,
922 8, ENC_NA);
926 static void
927 dissect_swils_rdi(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rdi_tree, uint8_t isreq)
929 /* Set up structures needed to add the protocol subtree and manage it */
930 int offset = 0;
931 int i, plen, numrec;
933 if (rdi_tree) {
934 plen = tvb_get_ntohs(tvb, offset+2);
936 proto_tree_add_item(rdi_tree, hf_swils_rdi_payload_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
937 proto_tree_add_item(rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4, 8, ENC_NA);
939 /* 12 is the length of the initial header and 4 is the size of each
940 * domain request record.
942 numrec = (plen - 12)/4;
943 offset = 12;
944 for (i = 0; i < numrec; i++) {
945 if (isreq) {
946 proto_tree_add_item(rdi_tree, hf_swils_requested_domain_id, tvb, offset+3, 1, ENC_BIG_ENDIAN);
948 else {
949 proto_tree_add_item(rdi_tree, hf_swils_granted_domain_id, tvb, offset+3, 1, ENC_BIG_ENDIAN);
951 offset += 4;
956 static void
957 dissect_swils_fspf_hdr(tvbuff_t *tvb, proto_tree *tree, int offset)
959 proto_tree *fspfh_tree;
961 if (tree) {
962 /* 20 is the size of FSPF header */
963 fspfh_tree = proto_tree_add_subtree(tree, tvb, offset, 20, ett_fcswils_fspfhdr, NULL, "FSPF Header");
965 proto_tree_add_item(fspfh_tree, hf_swils_fspfh_rev, tvb, offset+4,
966 1, ENC_BIG_ENDIAN);
967 proto_tree_add_item(fspfh_tree, hf_swils_fspfh_ar_num, tvb,
968 offset+5, 1, ENC_BIG_ENDIAN);
969 proto_tree_add_item(fspfh_tree, hf_swils_fspfh_auth_type, tvb,
970 offset+6, 1, ENC_BIG_ENDIAN);
971 proto_tree_add_item(fspfh_tree, hf_swils_fspfh_dom_id, tvb, offset+11,
972 1, ENC_BIG_ENDIAN);
973 proto_tree_add_item(fspfh_tree, hf_swils_fspfh_auth, tvb, offset+12,
974 8, ENC_NA);
978 static void
979 dissect_swils_fspf_lsrechdr(tvbuff_t *tvb, proto_tree *tree, int offset)
981 proto_tree_add_item(tree, hf_swils_lsrh_lsr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
982 proto_tree_add_item(tree, hf_swils_lsrh_lsr_age, tvb, offset+2, 2, ENC_BIG_ENDIAN);
983 proto_tree_add_item(tree, hf_swils_lsrh_options, tvb, offset+4, 4, ENC_BIG_ENDIAN);
984 proto_tree_add_item(tree, hf_swils_lsrh_lsid, tvb, offset+11, 1, ENC_BIG_ENDIAN);
985 proto_tree_add_item(tree, hf_swils_lsrh_adv_domid, tvb, offset+15, 1, ENC_BIG_ENDIAN);
986 proto_tree_add_item(tree, hf_swils_lsrh_ls_incid, tvb, offset+16, 4, ENC_BIG_ENDIAN);
987 proto_tree_add_checksum(tree, tvb, offset+20, hf_swils_lsrh_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
988 proto_tree_add_item(tree, hf_swils_lsrh_lsr_length, tvb, offset+22, 2, ENC_BIG_ENDIAN);
991 static void
992 dissect_swils_fspf_ldrec(tvbuff_t *tvb, proto_tree *tree, int offset)
994 proto_tree_add_item(tree, hf_swils_ldrec_linkid, tvb, offset+1, 3, ENC_NA);
995 proto_tree_add_item(tree, hf_swils_ldrec_out_pidx, tvb, offset+5, 3, ENC_BIG_ENDIAN);
996 proto_tree_add_item(tree, hf_swils_ldrec_nbr_pidx, tvb, offset+9, 3, ENC_BIG_ENDIAN);
997 proto_tree_add_item(tree, hf_swils_ldrec_link_type, tvb, offset+12, 1, ENC_BIG_ENDIAN);
998 proto_tree_add_item(tree, hf_swils_ldrec_link_cost, tvb, offset+14, 2, ENC_BIG_ENDIAN);
1001 static void
1002 dissect_swils_fspf_lsrec(tvbuff_t *tvb, proto_tree *tree, int offset,
1003 int num_lsrec)
1005 int i, j, num_ldrec;
1006 proto_tree *lsrec_tree, *ldrec_tree, *lsrechdr_tree;
1008 if (tree) {
1009 for (j = 0; j < num_lsrec; j++) {
1010 num_ldrec = tvb_get_ntohs(tvb, offset+26);
1011 lsrec_tree = proto_tree_add_subtree_format(tree, tvb, offset, (28+num_ldrec*16),
1012 ett_fcswils_lsrec, NULL, "Link State Record %d (Domain %d)", j,
1013 tvb_get_uint8(tvb, offset+15));
1015 lsrechdr_tree = proto_tree_add_subtree(lsrec_tree, tvb, offset, 24,
1016 ett_fcswils_lsrechdr, NULL, "Link State Record Header");
1018 dissect_swils_fspf_lsrechdr(tvb, lsrechdr_tree, offset);
1019 proto_tree_add_item(tree, hf_swils_lsrec_number_of_links, tvb, offset+26, 2, ENC_BIG_ENDIAN);
1020 offset += 28;
1022 for (i = 0; i < num_ldrec; i++) {
1023 ldrec_tree = proto_tree_add_subtree_format(lsrec_tree, tvb, offset, 16,
1024 ett_fcswils_ldrec, NULL, "Link Descriptor %d "
1025 "(Neighbor domain %d)", i,
1026 tvb_get_uint8(tvb, offset+3));
1027 dissect_swils_fspf_ldrec(tvb, ldrec_tree, offset);
1028 offset += 16;
1034 static void
1035 dissect_swils_hello(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *hlo_tree, uint8_t isreq _U_)
1037 /* Set up structures needed to add the protocol subtree and manage it */
1038 int offset = 0;
1040 if (hlo_tree) {
1041 dissect_swils_fspf_hdr(tvb, hlo_tree, offset);
1043 proto_tree_add_item(hlo_tree, hf_swils_hlo_options, tvb, offset+20, 4, ENC_NA);
1044 proto_tree_add_item(hlo_tree, hf_swils_hlo_hloint, tvb, offset+24, 4, ENC_BIG_ENDIAN);
1045 proto_tree_add_item(hlo_tree, hf_swils_hlo_deadint, tvb, offset+28, 4, ENC_BIG_ENDIAN);
1046 proto_tree_add_item(hlo_tree, hf_swils_hlo_rcv_domid, tvb, offset+35, 1, ENC_BIG_ENDIAN);
1047 proto_tree_add_item(hlo_tree, hf_swils_hlo_orig_pidx, tvb, offset+37, 3, ENC_BIG_ENDIAN);
1051 static void
1052 dissect_swils_lsupdate(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *lsu_tree, uint8_t isreq _U_)
1054 /* Set up structures needed to add the protocol subtree and manage it */
1055 int offset = 0;
1056 int num_lsrec;
1058 if (lsu_tree) {
1059 dissect_swils_fspf_hdr(tvb, lsu_tree, offset);
1061 proto_tree_add_item(lsu_tree, hf_swils_lsupdate_flags, tvb, offset+23, 1, ENC_BIG_ENDIAN);
1062 num_lsrec = tvb_get_ntohl(tvb, offset+24);
1064 proto_tree_add_item(lsu_tree, hf_swils_lsupdate_num_of_lsrs, tvb, offset+24, 4, ENC_BIG_ENDIAN);
1066 offset = 28;
1067 dissect_swils_fspf_lsrec(tvb, lsu_tree, offset, num_lsrec);
1071 static void
1072 dissect_swils_lsack(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *lsa_tree, uint8_t isreq _U_)
1074 /* Set up structures needed to add the protocol subtree and manage it */
1075 int offset = 0;
1076 int num_lsrechdr, i;
1077 proto_tree *lsrechdr_tree;
1079 if (lsa_tree) {
1080 dissect_swils_fspf_hdr(tvb, lsa_tree, offset);
1082 proto_tree_add_item(lsa_tree, hf_swils_lsack_flags, tvb, offset+23, 1, ENC_BIG_ENDIAN);
1083 num_lsrechdr = tvb_get_ntohl(tvb, offset+24);
1085 proto_tree_add_item(lsa_tree, hf_swils_lsack_num_of_lsr_headers, tvb, offset+24, 4, ENC_BIG_ENDIAN);
1087 offset = 28;
1089 for (i = 0; i < num_lsrechdr; i++) {
1090 lsrechdr_tree = proto_tree_add_subtree_format(lsa_tree, tvb, offset, 24,
1091 ett_fcswils_lsrechdr, NULL, "Link State Record Header (Domain %d)",
1092 tvb_get_uint8(tvb, offset+15));
1093 dissect_swils_fspf_lsrechdr(tvb, lsrechdr_tree, offset);
1094 offset += 24;
1099 static void
1100 dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree, uint8_t isreq)
1102 /* Set up structures needed to add the protocol subtree and manage it */
1103 int offset = 0;
1104 proto_tree *dev_tree;
1105 int numrec, i;
1107 if (rscn_tree) {
1108 if (!isreq)
1109 return;
1111 proto_tree_add_item(rscn_tree, hf_swils_rscn_evtype, tvb, offset+4,
1112 1, ENC_BIG_ENDIAN);
1113 proto_tree_add_item(rscn_tree, hf_swils_rscn_addrfmt, tvb, offset+4,
1114 1, ENC_BIG_ENDIAN);
1115 proto_tree_add_item(rscn_tree, hf_swils_rscn_affectedport, tvb,
1116 offset+5, 3, ENC_NA);
1117 proto_tree_add_item(rscn_tree, hf_swils_rscn_detectfn, tvb,
1118 offset+8, 4, ENC_BIG_ENDIAN);
1119 numrec = tvb_get_ntohl(tvb, offset+12);
1121 if (!tvb_bytes_exist(tvb, offset+16, FC_SWILS_RSCN_DEVENTRY_SIZE*numrec)) {
1122 /* Some older devices do not include device entry information. */
1123 return;
1126 proto_tree_add_item(rscn_tree, hf_swils_rscn_num_entries, tvb, offset+12, 4, ENC_BIG_ENDIAN);
1128 offset = 16;
1129 for (i = 0; i < numrec; i++) {
1130 dev_tree = proto_tree_add_subtree_format(rscn_tree, tvb, offset, 20,
1131 ett_fcswils_rscn_dev, NULL, "Device Entry %d", i);
1133 proto_tree_add_item(dev_tree, hf_swils_rscn_portstate, tvb, offset, 1, ENC_BIG_ENDIAN);
1134 proto_tree_add_item(dev_tree, hf_swils_rscn_portid, tvb, offset+1, 3, ENC_NA);
1135 proto_tree_add_item(dev_tree, hf_swils_rscn_pwwn, tvb, offset+4, 8, ENC_NA);
1136 proto_tree_add_item(dev_tree, hf_swils_rscn_nwwn, tvb, offset+12, 8, ENC_NA);
1137 offset += 20;
1143 * Merge Request contains zoning objects organized in the following format:
1145 * Zone Set Object
1147 * +---------------- Zone Object
1148 * | |
1149 * +-- +---------------- Zone Member
1150 * | | |
1151 * +-- +---- +-----
1153 * So the decoding of the zone merge request is based on this structure
1156 static void
1157 dissect_swils_zone_mbr(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree, int offset)
1159 uint8_t mbrtype;
1160 int idlen;
1161 proto_item* ti;
1163 mbrtype = tvb_get_uint8(tvb, offset);
1164 ti = proto_tree_add_uint(zmbr_tree, hf_swils_zone_mbrtype, tvb,
1165 offset, 1, mbrtype);
1166 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrflags, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1167 idlen = tvb_get_uint8(tvb, offset+3);
1168 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbr_identifier_length, tvb, offset+3, 1, ENC_BIG_ENDIAN);
1169 switch (mbrtype) {
1170 case FC_SWILS_ZONEMBR_WWN:
1171 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fcwwn, tvb,
1172 offset+4, 8, ENC_NA);
1173 break;
1174 case FC_SWILS_ZONEMBR_DP:
1175 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_uint, tvb,
1176 offset+4, 4, ENC_BIG_ENDIAN);
1177 break;
1178 case FC_SWILS_ZONEMBR_FCID:
1179 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fc, tvb,
1180 offset+4, 3, ENC_NA);
1181 break;
1182 case FC_SWILS_ZONEMBR_ALIAS:
1183 proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
1184 offset+4, idlen, zonenm_to_str(pinfo->pool, tvb, offset+4));
1185 break;
1186 case FC_SWILS_ZONEMBR_WWN_LUN:
1187 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fcwwn, tvb,
1188 offset+4, 8, ENC_NA);
1189 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
1190 offset+12, 8, ENC_NA);
1191 break;
1192 case FC_SWILS_ZONEMBR_DP_LUN:
1193 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_uint, tvb,
1194 offset+4, 4, ENC_BIG_ENDIAN);
1195 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
1196 offset+8, 8, ENC_NA);
1197 break;
1198 case FC_SWILS_ZONEMBR_FCID_LUN:
1199 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fc, tvb,
1200 offset+4, 3, ENC_NA);
1201 proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
1202 offset+8, 8, ENC_NA);
1203 break;
1204 default:
1205 expert_add_info(pinfo, ti, &ei_swils_zone_mbrid);
1210 static void
1211 // NOLINTNEXTLINE(misc-no-recursion)
1212 dissect_swils_zone_obj(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zobj_tree, int offset)
1214 proto_tree *zmbr_tree;
1215 int mbrlen, numrec, i, objtype;
1216 char *str;
1218 objtype = tvb_get_uint8(tvb, offset);
1220 proto_tree_add_item(zobj_tree, hf_swils_zone_objtype, tvb, offset,
1221 1, ENC_BIG_ENDIAN);
1222 proto_tree_add_item(zobj_tree, hf_swils_zone_protocol, tvb,
1223 offset+1, 1, ENC_BIG_ENDIAN);
1224 str = zonenm_to_str(pinfo->pool, tvb, offset+4);
1225 proto_tree_add_string(zobj_tree, hf_swils_zone_objname, tvb,
1226 offset+4, ZONENAME_LEN(tvb, offset+4), str);
1228 numrec = tvb_get_ntohl(tvb, offset+4+ZONENAME_LEN(tvb, offset+4));
1229 proto_tree_add_item(zobj_tree, hf_swils_zone_num_members, tvb, offset+4+ZONENAME_LEN(tvb,offset+4), 4, ENC_BIG_ENDIAN);
1231 offset += 8 + ZONENAME_LEN(tvb, offset+4);
1232 for (i = 0; i < numrec; i++) {
1233 if (objtype == FC_SWILS_ZONEOBJ_ZONESET) {
1234 // We recurse here, but we'll run out of packet before we run out of stack.
1235 dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
1236 offset += get_zoneobj_len(tvb, offset);
1238 else {
1239 mbrlen = 4 + tvb_get_uint8(tvb, offset+3);
1240 zmbr_tree = proto_tree_add_subtree_format(zobj_tree, tvb, offset, mbrlen,
1241 ett_fcswils_zonembr, NULL, "Zone Member %d", i);
1242 dissect_swils_zone_mbr(tvb, pinfo, zmbr_tree, offset);
1243 offset += mbrlen;
1248 static void
1249 dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo, proto_tree *mr_tree, uint8_t isreq)
1251 /* Set up structures needed to add the protocol subtree and manage it */
1252 int offset = 0;
1253 proto_tree *zobjlist_tree, *zobj_tree;
1254 int numrec, i, zonesetlen, objlistlen, objlen;
1255 char *str;
1257 if (isreq) {
1258 /* zonesetlen is the size of the zoneset including the zone name */
1259 zonesetlen = tvb_get_ntohs(tvb, offset+2);
1260 proto_tree_add_item(mr_tree, hf_swils_zone_active_zoneset_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1262 if (zonesetlen) {
1263 str = zonenm_to_str(pinfo->pool, tvb, offset+4);
1264 proto_tree_add_string(mr_tree, hf_swils_zone_activezonenm, tvb,
1265 offset+4, ZONENAME_LEN(tvb, offset+4),
1266 str);
1268 /* objlistlen gives the size of the active zoneset object list */
1269 objlistlen = zonesetlen - ZONENAME_LEN(tvb, offset+4);
1270 /* Offset = start of the active zoneset zoning object list */
1271 offset = offset + (4 + ZONENAME_LEN(tvb, offset+4));
1272 numrec = tvb_get_ntohl(tvb, offset);
1274 zobjlist_tree = proto_tree_add_subtree(mr_tree, tvb, offset, objlistlen,
1275 ett_fcswils_zoneobjlist, NULL, "Active Zone Set");
1277 proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN);
1279 offset += 4;
1280 for (i = 0; i < numrec; i++) {
1281 objlen = get_zoneobj_len(tvb, offset);
1282 zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset+4, objlen,
1283 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
1284 dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
1285 offset += objlen;
1288 else {
1289 offset += 4;
1292 zonesetlen = tvb_get_ntohl(tvb, offset);
1293 proto_tree_add_item(mr_tree, hf_swils_zone_full_zone_set_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1295 if (zonesetlen) {
1296 objlistlen = zonesetlen;
1297 /* Offset = start of the active zoneset zoning object list */
1298 offset += 4;
1299 numrec = tvb_get_ntohl(tvb, offset);
1301 zobjlist_tree = proto_tree_add_subtree(mr_tree, tvb, offset, objlistlen,
1302 ett_fcswils_zoneobjlist, NULL, "Full Zone Set");
1304 proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN);
1305 offset += 4;
1306 for (i = 0; i < numrec; i++) {
1307 objlen = get_zoneobj_len(tvb, offset);
1308 zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset,
1309 objlen, ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
1310 dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
1311 offset += objlen;
1315 else {
1316 proto_tree_add_item(mr_tree, hf_swils_zone_status, tvb,
1317 offset+5, 1, ENC_BIG_ENDIAN);
1318 proto_tree_add_item(mr_tree, hf_swils_zone_reason, tvb,
1319 offset+6, 1, ENC_BIG_ENDIAN);
1320 proto_tree_add_item(mr_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1324 static void
1325 dissect_swils_aca(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *aca_tree, uint8_t isreq)
1327 /* Set up structures needed to add the protocol subtree and manage it */
1328 int offset = 0;
1329 int numrec, plen, i;
1331 if (aca_tree) {
1332 if (isreq) {
1333 plen = tvb_get_ntohs(tvb, offset+2);
1334 proto_tree_add_item(aca_tree, hf_swils_domain_id_list_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1335 numrec = plen/4;
1336 offset = 4;
1338 for (i = 0; i < numrec; i++) {
1339 proto_tree_add_uint_format(aca_tree, hf_swils_aca_domainid,
1340 tvb, offset+3, 1,
1341 tvb_get_uint8(tvb, offset+3),
1342 "Domain ID %d: %d", i,
1343 tvb_get_uint8(tvb, offset+3));
1344 offset += 4;
1347 else {
1348 proto_tree_add_item(aca_tree, hf_swils_zone_status, tvb,
1349 offset+5, 1, ENC_BIG_ENDIAN);
1350 proto_tree_add_item(aca_tree, hf_swils_zone_reason, tvb,
1351 offset+6, 1, ENC_BIG_ENDIAN);
1352 proto_tree_add_item(aca_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1357 static void
1358 dissect_swils_rca(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rca_tree, uint8_t isreq)
1360 /* Set up structures needed to add the protocol subtree and manage it */
1361 int offset = 0;
1363 if (rca_tree) {
1364 if (!isreq) {
1365 proto_tree_add_item(rca_tree, hf_swils_zone_status, tvb,
1366 offset+5, 1, ENC_BIG_ENDIAN);
1367 proto_tree_add_item(rca_tree, hf_swils_zone_reason, tvb,
1368 offset+6, 1, ENC_BIG_ENDIAN);
1369 proto_tree_add_item(rca_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1374 static void
1375 dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo, proto_tree *sfc_tree, uint8_t isreq)
1377 /* Set up structures needed to add the protocol subtree and manage it */
1378 int offset = 0;
1379 proto_tree *zobjlist_tree, *zobj_tree;
1380 int numrec, i, zonesetlen, objlistlen, objlen;
1381 char *str;
1383 if (isreq) {
1384 proto_tree_add_item(sfc_tree, hf_swils_sfc_opcode, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1386 zonesetlen = tvb_get_ntohs(tvb, offset+2);
1387 proto_tree_add_item(sfc_tree, hf_swils_sfc_zoneset_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1389 if (zonesetlen) {
1390 str = zonenm_to_str(pinfo->pool, tvb, offset+4);
1391 proto_tree_add_string(sfc_tree, hf_swils_sfc_zonenm, tvb,
1392 offset+4, ZONENAME_LEN(tvb, offset+4),
1393 str);
1395 /* objlistlen gives the size of the active zoneset object list */
1396 objlistlen = zonesetlen - ZONENAME_LEN(tvb, offset+4);
1397 /* Offset = start of the active zoneset zoning object list */
1398 offset = offset + (4 + ZONENAME_LEN(tvb, offset+4));
1399 numrec = tvb_get_ntohl(tvb, offset);
1401 zobjlist_tree = proto_tree_add_subtree(sfc_tree, tvb, offset, objlistlen,
1402 ett_fcswils_zoneobjlist, NULL, "Zone Set");
1404 proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN);
1406 offset += 4;
1407 for (i = 0; i < numrec; i++) {
1408 objlen = get_zoneobj_len(tvb, offset);
1409 zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset, objlen,
1410 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
1411 dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
1412 offset += objlen;
1415 else {
1416 offset += 4;
1419 zonesetlen = tvb_get_ntohl(tvb, offset);
1420 proto_tree_add_item(sfc_tree, hf_swils_zone_full_zone_set_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1422 if (zonesetlen) {
1423 objlistlen = zonesetlen;
1424 /* Offset = start of the active zoneset zoning object list */
1425 offset += 4;
1426 numrec = tvb_get_ntohl(tvb, offset);
1428 zobjlist_tree = proto_tree_add_subtree(sfc_tree, tvb, offset, objlistlen,
1429 ett_fcswils_zoneobjlist, NULL, "Full Zone Set");
1431 proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN);
1432 offset += 4;
1433 for (i = 0; i < numrec; i++) {
1434 objlen = get_zoneobj_len(tvb, offset);
1435 zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset, objlen,
1436 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
1437 dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
1438 offset += objlen;
1442 else {
1443 proto_tree_add_item(sfc_tree, hf_swils_zone_status, tvb,
1444 offset+5, 1, ENC_BIG_ENDIAN);
1445 proto_tree_add_item(sfc_tree, hf_swils_zone_reason, tvb,
1446 offset+6, 1, ENC_BIG_ENDIAN);
1447 proto_tree_add_item(sfc_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1451 static void
1452 dissect_swils_ufc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *ufc_tree, uint8_t isreq)
1454 /* Set up structures needed to add the protocol subtree and manage it */
1455 int offset = 0;
1457 if (ufc_tree) {
1458 if (!isreq) {
1459 proto_tree_add_item(ufc_tree, hf_swils_zone_status, tvb,
1460 offset+5, 1, ENC_BIG_ENDIAN);
1461 proto_tree_add_item(ufc_tree, hf_swils_zone_reason, tvb,
1462 offset+6, 1, ENC_BIG_ENDIAN);
1463 proto_tree_add_item(ufc_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1468 static void
1469 dissect_swils_esc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *esc_tree, uint8_t isreq)
1471 /* Set up structures needed to add the protocol subtree and manage it */
1472 int offset = 0;
1473 int i, numrec, plen;
1474 proto_tree *pdesc_tree;
1476 if (esc_tree) {
1477 if (isreq) {
1478 plen = tvb_get_ntohs(tvb, offset+2);
1479 proto_tree_add_item(esc_tree, hf_swils_esc_payload_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1480 proto_tree_add_item(esc_tree, hf_swils_esc_swvendorid, tvb,
1481 offset+4, 8, ENC_ASCII);
1482 numrec = (plen - 12)/12;
1483 offset = 12;
1485 for (i = 0; i < numrec; i++) {
1486 pdesc_tree = proto_tree_add_subtree_format(esc_tree, tvb, offset, 12,
1487 ett_fcswils_esc_pdesc, NULL, "Protocol Descriptor %d", i);
1488 proto_tree_add_item(pdesc_tree, hf_swils_esc_pdesc_vendorid, tvb,
1489 offset, 8, ENC_ASCII);
1490 proto_tree_add_item(pdesc_tree, hf_swils_esc_protocolid,
1491 tvb, offset+10, 2, ENC_BIG_ENDIAN);
1492 offset += 12;
1495 else {
1496 proto_tree_add_item(esc_tree, hf_swils_esc_swvendorid, tvb,
1497 offset+4, 8, ENC_ASCII);
1498 pdesc_tree = proto_tree_add_subtree(esc_tree, tvb, offset+12, 12,
1499 ett_fcswils_esc_pdesc, NULL, "Accepted Protocol Descriptor");
1501 proto_tree_add_item(pdesc_tree, hf_swils_esc_pdesc_vendorid, tvb,
1502 offset+12, 8, ENC_ASCII);
1503 proto_tree_add_item(pdesc_tree, hf_swils_esc_protocolid,
1504 tvb, offset+22, 2, ENC_BIG_ENDIAN);
1509 static void
1510 dissect_swils_drlir(tvbuff_t *tvb _U_, packet_info* pinfo _U_, proto_tree *drlir_tree _U_,
1511 uint8_t isreq _U_)
1513 /* Set up structures needed to add the protocol subtree and manage it */
1514 return;
1517 static void
1518 dissect_swils_swrjt(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *swrjt_tree, uint8_t isreq _U_)
1520 /* Set up structures needed to add the protocol subtree and manage it */
1521 int offset = 0;
1523 if (swrjt_tree) {
1524 proto_tree_add_item(swrjt_tree, hf_swils_rjt, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1525 proto_tree_add_item(swrjt_tree, hf_swils_rjtdet, tvb, offset+6, 1, ENC_BIG_ENDIAN);
1526 proto_tree_add_item(swrjt_tree, hf_swils_rjtvendor, tvb, offset+7,
1527 1, ENC_BIG_ENDIAN);
1531 static void
1532 dissect_swils_ess(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *ess_tree, uint8_t isreq _U_)
1534 int offset = 0;
1535 int16_t numcapobj = 0;
1536 int len = 0;
1537 int capobjlen = 0;
1538 proto_tree *ieinfo_tree;
1540 if (!ess_tree) {
1541 return;
1544 proto_tree_add_item(ess_tree, hf_swils_ess_rev, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1545 proto_tree_add_item(ess_tree, hf_swils_ess_len, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1546 len = tvb_get_ntohl(tvb, offset+8);
1548 ieinfo_tree = proto_tree_add_subtree(ess_tree, tvb, offset+12,
1549 MAX_INTERCONNECT_ELEMENT_INFO_LEN+4,
1550 ett_fcswils_ieinfo, NULL, "Interconnect Element Info");
1551 dissect_swils_interconnect_element_info(tvb, ieinfo_tree, offset+12);
1552 len -= 256; /* the interconnect obj above is 256 bytes */
1553 offset += 268;
1555 proto_tree_add_item(ess_tree, hf_swils_ess_numobj, tvb, offset, 2, ENC_BIG_ENDIAN);
1556 numcapobj = tvb_get_ntohs(tvb, offset);
1558 len -= 4; /* 2B numcapobj + 2B rsvd */
1559 offset += 4;
1561 while ((len > 0) && (numcapobj > 0)) {
1562 capobjlen = dissect_swils_ess_capability_obj(tvb, ess_tree, offset);
1563 numcapobj--;
1564 len -= capobjlen;
1565 offset += capobjlen;
1569 static void
1570 dissect_swils_mrra(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, uint8_t isreq)
1573 int offset = 0;
1575 if (!tree) {
1576 return;
1579 if (isreq) {
1580 proto_tree_add_item(tree, hf_swils_mrra_rev, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1581 proto_tree_add_item(tree, hf_swils_mrra_size, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1582 proto_tree_add_item(tree, hf_swils_mrra_vendorid, tvb, offset+12, 8, ENC_ASCII);
1583 proto_tree_add_item(tree, hf_swils_mrra_vendorinfo, tvb, offset+20,
1584 8, ENC_NA);
1585 } else {
1586 proto_tree_add_item(tree, hf_swils_mrra_vendorid, tvb, offset+4,
1587 8, ENC_ASCII);
1588 proto_tree_add_item(tree, hf_swils_mrra_reply, tvb, offset+12,
1589 4, ENC_BIG_ENDIAN);
1590 proto_tree_add_item(tree, hf_swils_mrra_reply_size, tvb, offset+16,
1591 4, ENC_BIG_ENDIAN);
1592 proto_tree_add_item(tree, hf_swils_mrra_waittime, tvb, offset+20,
1593 4, ENC_BIG_ENDIAN);
1599 static fcswils_func_table_t fcswils_func_table[FC_SWILS_MAXCODE] = {
1600 /* 0x00 */ {NULL},
1601 /* 0x01 */ {dissect_swils_swrjt},
1602 /* 0x02 */ {NULL},
1603 /* 0x03 */ {NULL},
1604 /* 0x04 */ {NULL},
1605 /* 0x05 */ {NULL},
1606 /* 0x06 */ {NULL},
1607 /* 0x07 */ {NULL},
1608 /* 0x08 */ {NULL},
1609 /* 0x09 */ {NULL},
1610 /* 0x0a */ {NULL},
1611 /* 0x0b */ {NULL},
1612 /* 0x0c */ {NULL},
1613 /* 0x0d */ {NULL},
1614 /* 0x0e */ {NULL},
1615 /* 0x0f */ {NULL},
1616 /* 0x10 */ {dissect_swils_elp},
1617 /* 0x11 */ {dissect_swils_efp},
1618 /* 0x12 */ {dissect_swils_dia},
1619 /* 0x13 */ {dissect_swils_rdi},
1620 /* 0x14 */ {dissect_swils_hello},
1621 /* 0x15 */ {dissect_swils_lsupdate},
1622 /* 0x16 */ {dissect_swils_lsack},
1623 /* 0x17 */ {dissect_swils_nullpayload},
1624 /* 0x18 */ {dissect_swils_nullpayload},
1625 /* 0x19 */ {NULL},
1626 /* 0x1a */ {NULL},
1627 /* 0x1b */ {dissect_swils_rscn},
1628 /* 0x1c */ {NULL},
1629 /* 0x1d */ {NULL},
1630 /* 0x1e */ {dissect_swils_drlir},
1631 /* 0x1f */ {NULL},
1632 /* 0x20 */ {NULL /*dissect_swils_dscn*/},
1633 /* 0x21 */ {NULL /*dissect_swils_loopd*/},
1634 /* 0x22 */ {dissect_swils_mergereq},
1635 /* 0x23 */ {dissect_swils_aca},
1636 /* 0x24 */ {dissect_swils_rca},
1637 /* 0x25 */ {dissect_swils_sfc},
1638 /* 0x26 */ {dissect_swils_ufc},
1639 /* 0x27 */ {NULL},
1640 /* 0x28 */ {NULL},
1641 /* 0x29 */ {NULL},
1642 /* 0x2a */ {NULL},
1643 /* 0x2b */ {NULL},
1644 /* 0x2c */ {NULL},
1645 /* 0x2d */ {NULL},
1646 /* 0x2e */ {NULL},
1647 /* 0x2f */ {NULL},
1648 /* 0x30 */ {dissect_swils_esc},
1649 /* 0x31 */ {dissect_swils_ess},
1650 /* 0x32 */ {NULL},
1651 /* 0x33 */ {NULL},
1652 /* 0x34 */ {dissect_swils_mrra}
1655 /* Code to actually dissect the packets */
1656 static int
1657 dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1659 proto_item *ti = NULL;
1660 uint8_t opcode;
1661 uint8_t failed_opcode = 0;
1662 int offset = 0;
1663 conversation_t *conversation;
1664 fcswils_conv_data_t *cdata;
1665 fcswils_conv_key_t ckey, *req_key;
1666 proto_tree *swils_tree = NULL;
1667 uint8_t isreq = FC_SWILS_REQ;
1668 tvbuff_t *next_tvb;
1669 fc_hdr *fchdr;
1671 /* Reject the packet if data is NULL */
1672 if (data == NULL)
1673 return 0;
1674 fchdr = (fc_hdr *)data;
1676 /* Make entries in Protocol column and Info column on summary display */
1677 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SW_ILS");
1679 /* decoding of this is done by each individual opcode handler */
1680 opcode = tvb_get_uint8(tvb, 0);
1682 ti = proto_tree_add_protocol_format(tree, proto_fcswils, tvb, 0, -1, "SW_ILS");
1683 swils_tree = proto_item_add_subtree(ti, ett_fcswils);
1685 /* Register conversation if this is not a response */
1686 if ((opcode != FC_SWILS_SWACC) && (opcode != FC_SWILS_SWRJT)) {
1687 conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
1688 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1689 fchdr->rxid, NO_PORT_B);
1690 if (!conversation) {
1691 conversation = conversation_new(pinfo->num, &pinfo->src, &pinfo->dst,
1692 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1693 fchdr->rxid, NO_PORT2);
1696 ckey.conv_idx = conversation->conv_index;
1698 cdata = (fcswils_conv_data_t *)wmem_map_lookup(fcswils_req_hash,
1699 &ckey);
1700 if (cdata) {
1701 /* Since we never free the memory used by an exchange, this maybe a
1702 * case of another request using the same exchange as a previous
1703 * req.
1705 cdata->opcode = opcode;
1707 else {
1708 req_key = wmem_new(wmem_file_scope(), fcswils_conv_key_t);
1709 req_key->conv_idx = conversation->conv_index;
1711 cdata = wmem_new(wmem_file_scope(), fcswils_conv_data_t);
1712 cdata->opcode = opcode;
1714 wmem_map_insert(fcswils_req_hash, req_key, cdata);
1717 else {
1718 /* Opcode is ACC or RJT */
1719 conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
1720 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1721 fchdr->rxid, NO_PORT_B);
1722 isreq = FC_SWILS_RPLY;
1723 if (!conversation) {
1724 if (tree && (opcode == FC_SWILS_SWACC)) {
1725 /* No record of what this accept is for. Can't decode */
1726 proto_tree_add_expert_format(swils_tree, pinfo, &ei_swils_no_exchange, tvb, 0, -1, "No record of Exchg. Unable to decode SW_ACC");
1727 return 0;
1730 else {
1731 ckey.conv_idx = conversation->conv_index;
1733 cdata = (fcswils_conv_data_t *)wmem_map_lookup(fcswils_req_hash, &ckey);
1735 if (cdata != NULL) {
1736 if (opcode == FC_SWILS_SWACC)
1737 opcode = cdata->opcode;
1738 else
1739 failed_opcode = cdata->opcode;
1742 if (tree) {
1743 if ((cdata == NULL) && (opcode != FC_SWILS_SWRJT)) {
1744 /* No record of what this accept is for. Can't decode */
1745 proto_tree_add_expert_format(swils_tree, pinfo, &ei_swils_no_exchange, tvb, 0, -1, "No record of SW_ILS Req. Unable to decode SW_ACC");
1746 return 0;
1752 if (isreq == FC_SWILS_REQ) {
1753 col_add_str(pinfo->cinfo, COL_INFO,
1754 val_to_str(opcode, fc_swils_opcode_key_val, "0x%x"));
1756 else if (opcode == FC_SWILS_SWRJT) {
1757 col_add_fstr(pinfo->cinfo, COL_INFO, "SW_RJT (%s)",
1758 val_to_str(failed_opcode, fc_swils_opcode_key_val, "0x%x"));
1760 else {
1761 col_add_fstr(pinfo->cinfo, COL_INFO, "SW_ACC (%s)",
1762 val_to_str(opcode, fc_swils_opcode_key_val, "0x%x"));
1765 proto_tree_add_item(swils_tree, hf_swils_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1767 if ((opcode < FC_SWILS_MAXCODE) && fcswils_func_table[opcode].func) {
1768 fcswils_func_table[opcode].func(tvb, pinfo, swils_tree, isreq);
1769 } else if (opcode == FC_SWILS_AUTH_ILS) {
1770 /* This is treated differently */
1771 if (isreq && fcsp_handle)
1772 call_dissector(fcsp_handle, tvb, pinfo, swils_tree);
1773 } else {
1774 /* data dissector */
1775 next_tvb = tvb_new_subset_remaining(tvb, offset+4);
1776 call_data_dissector(next_tvb, pinfo, tree);
1779 return tvb_captured_length(tvb);
1782 /* Register the protocol with Wireshark */
1784 void
1785 proto_register_fcswils(void)
1787 static hf_register_info hf[] = {
1788 { &hf_swils_opcode,
1789 {"Cmd Code", "swils.opcode",
1790 FT_UINT8, BASE_HEX, VALS(fc_swils_opcode_key_val), 0x0,
1791 NULL, HFILL}},
1793 { &hf_swils_elp_rev,
1794 {"Revision", "swils.elp.rev",
1795 FT_UINT8, BASE_DEC, NULL, 0x0,
1796 NULL, HFILL}},
1798 { &hf_swils_elp_flags,
1799 {"Flag", "swils.elp.flag",
1800 FT_BYTES, BASE_NONE, NULL, 0x0,
1801 NULL, HFILL}},
1803 { &hf_swils_elp_r_a_tov,
1804 {"R_A_TOV", "swils.elp.ratov",
1805 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1806 NULL, HFILL}},
1808 { &hf_swils_elp_e_d_tov,
1809 {"E_D_TOV", "swils.elp.edtov",
1810 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1811 NULL, HFILL}},
1813 { &hf_swils_elp_req_epn,
1814 {"Req Eport Name", "swils.elp.reqepn",
1815 FT_FCWWN, BASE_NONE, NULL, 0x0,
1816 NULL, HFILL}},
1818 { &hf_swils_elp_req_esn,
1819 {"Req Switch Name", "swils.elp.reqesn",
1820 FT_FCWWN, BASE_NONE, NULL, 0x0,
1821 NULL, HFILL}},
1823 { &hf_swils_elp_clsf_svcp,
1824 {"Class F Svc Parameters", "swils.elp.clsfp",
1825 FT_BYTES, BASE_NONE, NULL, 0x0,
1826 NULL, HFILL}},
1828 { &hf_swils_elp_clsf_rcvsz,
1829 {"Max Class F Frame Size", "swils.elp.clsfrsz",
1830 FT_UINT16, BASE_DEC, NULL, 0x0,
1831 NULL, HFILL}},
1833 { &hf_swils_elp_clsf_conseq,
1834 {"Class F Max Concurrent Seq", "swils.elp.clsfcs",
1835 FT_UINT16, BASE_DEC, NULL, 0x0,
1836 NULL, HFILL}},
1838 { &hf_swils_elp_clsf_e2e,
1839 {"Class F E2E Credit", "swils.elp.cfe2e",
1840 FT_UINT16, BASE_DEC, NULL, 0x0,
1841 NULL, HFILL}},
1843 { &hf_swils_elp_clsf_openseq,
1844 {"Class F Max Open Seq", "swils.elp.oseq",
1845 FT_UINT16, BASE_DEC, NULL, 0x0,
1846 NULL, HFILL}},
1848 { &hf_swils_elp_cls1_svcp,
1849 {"Class 1 Svc Parameters", "swils.elp.cls1p",
1850 FT_BYTES, BASE_NONE, NULL, 0x0,
1851 NULL, HFILL}},
1853 { &hf_swils_elp_cls1_rcvsz,
1854 {"Class 1 Frame Size", "swils.elp.cls1rsz",
1855 FT_UINT16, BASE_DEC, NULL, 0x0,
1856 NULL, HFILL}},
1858 { &hf_swils_elp_cls2_svcp,
1859 {"Class 2 Svc Parameters", "swils.elp.cls2p",
1860 FT_BYTES, BASE_NONE, NULL, 0x0,
1861 NULL, HFILL}},
1863 { &hf_swils_elp_cls2_rcvsz,
1864 {"Class 2 Frame Size", "swils.elp.cls2rsz",
1865 FT_UINT16, BASE_DEC, NULL, 0x0,
1866 NULL, HFILL}},
1868 { &hf_swils_elp_cls3_svcp,
1869 {"Class 3 Svc Parameters", "swils.elp.cls3p",
1870 FT_BYTES, BASE_NONE, NULL, 0x0,
1871 NULL, HFILL}},
1873 { &hf_swils_elp_cls3_rcvsz,
1874 {"Class 3 Frame Size", "swils.elp.cls3rsz",
1875 FT_UINT16, BASE_DEC, NULL, 0x0,
1876 NULL, HFILL}},
1878 { &hf_swils_elp_isl_fc_mode,
1879 {"ISL Flow Ctrl Mode", "swils.elp.fcmode",
1880 FT_STRING, BASE_NONE, NULL, 0x0,
1881 NULL, HFILL}},
1883 { &hf_swils_elp_fcplen,
1884 {"Flow Ctrl Param Len", "swils.elp.fcplen",
1885 FT_UINT16, BASE_DEC, NULL, 0x0,
1886 NULL, HFILL}},
1888 { &hf_swils_elp_b2bcredit,
1889 {"B2B Credit", "swils.elp.b2b",
1890 FT_UINT32, BASE_DEC, NULL, 0x0,
1891 NULL, HFILL}},
1893 { &hf_swils_elp_compat1,
1894 {"Compatibility Param 1", "swils.elp.compat1",
1895 FT_UINT32, BASE_DEC, NULL, 0x0,
1896 NULL, HFILL}},
1898 { &hf_swils_elp_compat2,
1899 {"Compatibility Param 2", "swils.elp.compat2",
1900 FT_UINT32, BASE_DEC, NULL, 0x0,
1901 NULL, HFILL}},
1903 { &hf_swils_elp_compat3,
1904 {"Compatibility Param 3", "swils.elp.compat3",
1905 FT_UINT32, BASE_DEC, NULL, 0x0,
1906 NULL, HFILL}},
1908 { &hf_swils_elp_compat4,
1909 {"Compatibility Param 4", "swils.elp.compat4",
1910 FT_UINT32, BASE_DEC, NULL, 0x0,
1911 NULL, HFILL}},
1913 { &hf_swils_efp_rec_type,
1914 {"Record Type", "swils.efp.rectype",
1915 FT_UINT8, BASE_HEX, VALS(fcswils_rectype_val), 0x0,
1916 NULL, HFILL}},
1918 { &hf_swils_efp_dom_id,
1919 {"Domain ID", "swils.efp.domid",
1920 FT_UINT8, BASE_HEX, NULL, 0x0,
1921 NULL, HFILL}},
1923 { &hf_swils_efp_switch_name,
1924 {"Switch Name", "swils.efp.sname",
1925 FT_FCWWN, BASE_NONE, NULL, 0x0,
1926 NULL, HFILL}},
1928 { &hf_swils_efp_mcast_grpno,
1929 {"Mcast Grp#", "swils.efp.mcastno",
1930 FT_UINT8, BASE_HEX, NULL, 0x0,
1931 NULL, HFILL}},
1933 #if 0
1934 { &hf_swils_efp_alias_token,
1935 {"Alias Token", "swils.efp.aliastok",
1936 FT_BYTES, BASE_NONE, NULL, 0x0,
1937 NULL, HFILL}},
1938 #endif
1940 { &hf_swils_efp_record_len,
1941 {"Record Len", "swils.efp.recordlen",
1942 FT_UINT8, BASE_DEC, NULL, 0x0,
1943 NULL, HFILL}},
1945 { &hf_swils_efp_payload_len,
1946 {"Payload Len", "swils.efp.payloadlen",
1947 FT_UINT16, BASE_DEC, NULL, 0x0,
1948 NULL, HFILL}},
1950 { &hf_swils_efp_pswitch_pri,
1951 {"Principal Switch Priority", "swils.efp.psprio",
1952 FT_UINT8, BASE_DEC, NULL, 0x0,
1953 NULL, HFILL}},
1955 { &hf_swils_efp_pswitch_name,
1956 {"Principal Switch Name", "swils.efp.psname",
1957 FT_FCWWN, BASE_NONE, NULL, 0x0,
1958 NULL, HFILL}},
1960 { &hf_swils_dia_switch_name,
1961 {"Switch Name", "swils.dia.sname",
1962 FT_FCWWN, BASE_NONE, NULL, 0x0,
1963 NULL, HFILL}},
1965 { &hf_swils_rdi_payload_len,
1966 {"Payload Len", "swils.rdi.len",
1967 FT_UINT16, BASE_DEC, NULL, 0x0,
1968 NULL, HFILL}},
1970 { &hf_swils_rdi_req_sname,
1971 {"Req Switch Name", "swils.rdi.reqsn",
1972 FT_FCWWN, BASE_NONE, NULL, 0x0,
1973 NULL, HFILL}},
1975 #if 0
1976 { &hf_swils_fspfh_cmd,
1977 {"Command", "swils.fspf.cmd",
1978 FT_UINT8, BASE_HEX, NULL, 0x0,
1979 NULL, HFILL}},
1980 #endif
1982 { &hf_swils_fspfh_rev,
1983 {"Version", "swils.fspf.ver",
1984 FT_UINT8, BASE_HEX, NULL, 0x0,
1985 NULL, HFILL}},
1987 { &hf_swils_fspfh_ar_num,
1988 {"AR Number", "swils.fspf.arnum",
1989 FT_UINT8, BASE_HEX, NULL, 0x0,
1990 NULL, HFILL}},
1992 { &hf_swils_fspfh_auth_type,
1993 {"Authentication Type", "swils.fspf.authtype",
1994 FT_UINT8, BASE_HEX, NULL, 0x0,
1995 NULL, HFILL}},
1997 { &hf_swils_fspfh_dom_id,
1998 {"Originating Domain ID", "swils.fspf.origdomid",
1999 FT_UINT8, BASE_DEC, NULL, 0x0,
2000 NULL, HFILL}},
2002 { &hf_swils_fspfh_auth,
2003 {"Authentication", "swils.fspf.auth",
2004 FT_BYTES, BASE_NONE, NULL, 0x0,
2005 NULL, HFILL}},
2007 { &hf_swils_hlo_options,
2008 {"Options", "swils.hlo.options",
2009 FT_BYTES, BASE_NONE, NULL, 0x0,
2010 NULL, HFILL}},
2012 { &hf_swils_hlo_hloint,
2013 {"Hello Interval (secs)", "swils.hlo.hloint",
2014 FT_UINT32, BASE_DEC, NULL, 0x0,
2015 NULL, HFILL}},
2017 { &hf_swils_hlo_deadint,
2018 {"Dead Interval (secs)", "swils.hlo.deadint",
2019 FT_UINT32, BASE_DEC, NULL, 0x0,
2020 NULL, HFILL}},
2022 { &hf_swils_hlo_rcv_domid,
2023 {"Recipient Domain ID", "swils.hlo.rcvdomid",
2024 FT_UINT8, BASE_DEC, NULL, 0x0,
2025 NULL, HFILL}},
2027 { &hf_swils_hlo_orig_pidx,
2028 {"Originating Port Idx", "swils.hlo.origpidx",
2029 FT_UINT24, BASE_HEX, NULL, 0x0,
2030 NULL, HFILL}},
2032 { &hf_swils_lsrh_lsr_type,
2033 {"LSR Type", "swils.lsr.type",
2034 FT_UINT8, BASE_HEX, VALS(fc_swils_fspf_linkrec_val), 0x0,
2035 NULL, HFILL}},
2037 { &hf_swils_lsrh_lsid,
2038 {"Link State Id", "swils.ls.id",
2039 FT_UINT8, BASE_DEC, NULL, 0x0,
2040 NULL, HFILL}},
2042 { &hf_swils_lsrh_adv_domid,
2043 {"Advertising Domain Id", "swils.lsr.advdomid",
2044 FT_UINT8, BASE_DEC, NULL, 0x0,
2045 NULL, HFILL}},
2047 { &hf_swils_lsrh_ls_incid,
2048 {"LS Incarnation Number", "swils.lsr.incid",
2049 FT_UINT32, BASE_DEC, NULL, 0x0,
2050 NULL, HFILL}},
2052 { &hf_swils_ldrec_linkid,
2053 {"Link ID", "swils.ldr.linkid",
2054 FT_BYTES, SEP_DOT, NULL, 0x0,
2055 NULL, HFILL}},
2057 { &hf_swils_ldrec_out_pidx,
2058 {"Output Port Idx", "swils.ldr.out_portidx",
2059 FT_UINT24, BASE_HEX, NULL, 0x0,
2060 NULL, HFILL}},
2062 { &hf_swils_ldrec_nbr_pidx,
2063 {"Neighbor Port Idx", "swils.ldr.nbr_portidx",
2064 FT_UINT24, BASE_HEX, NULL, 0x0,
2065 NULL, HFILL}},
2067 { &hf_swils_ldrec_link_type,
2068 {"Link Type", "swils.ldr.linktype",
2069 FT_UINT8, BASE_HEX, VALS(fc_swils_link_type_val), 0x0,
2070 NULL, HFILL}},
2072 { &hf_swils_ldrec_link_cost,
2073 {"Link Cost", "swils.ldr.linkcost",
2074 FT_UINT16, BASE_DEC, NULL, 0x0,
2075 NULL, HFILL}},
2077 { &hf_swils_rscn_evtype,
2078 {"Event Type", "swils.rscn.evtype",
2079 FT_UINT8, BASE_DEC, VALS(fc_swils_rscn_portstate_val), 0xF0,
2080 NULL, HFILL}},
2082 { &hf_swils_rscn_addrfmt,
2083 {"Address Format", "swils.rscn.addrfmt",
2084 FT_UINT8, BASE_DEC, VALS(fc_swils_rscn_addrfmt_val), 0x0F,
2085 NULL, HFILL}},
2087 { &hf_swils_rscn_affectedport,
2088 {"Affected Port ID", "swils.rscn.affectedport",
2089 FT_BYTES, SEP_DOT, NULL, 0x0,
2090 NULL, HFILL}},
2092 { &hf_swils_rscn_detectfn,
2093 {"Detection Function", "swils.rscn.detectfn",
2094 FT_UINT32, BASE_HEX, VALS(fc_swils_rscn_detectfn_val), 0x0,
2095 NULL, HFILL}},
2097 { &hf_swils_rscn_portstate,
2098 {"Port State", "swils.rscn.portstate",
2099 FT_UINT8, BASE_HEX, NULL, 0x0,
2100 NULL, HFILL}},
2102 { &hf_swils_rscn_portid,
2103 {"Port Id", "swils.rscn.portid",
2104 FT_BYTES, SEP_DOT, NULL, 0x0,
2105 NULL, HFILL}},
2107 { &hf_swils_rscn_pwwn,
2108 {"Port WWN", "swils.rscn.pwwn",
2109 FT_FCWWN, BASE_NONE, NULL, 0x0,
2110 NULL, HFILL}},
2112 { &hf_swils_rscn_nwwn,
2113 {"Node WWN", "swils.rscn.nwwn",
2114 FT_FCWWN, BASE_NONE, NULL, 0x0,
2115 NULL, HFILL}},
2117 { &hf_swils_esc_swvendorid,
2118 {"Switch Vendor ID", "swils.esc.swvendor",
2119 FT_STRING, BASE_NONE, NULL, 0x0,
2120 NULL, HFILL}},
2122 { &hf_swils_esc_pdesc_vendorid,
2123 {"Vendor ID", "swils.esc.vendorid",
2124 FT_STRING, BASE_NONE, NULL, 0x0,
2125 NULL, HFILL}},
2127 { &hf_swils_esc_protocolid,
2128 {"Protocol ID", "swils.esc.protocol",
2129 FT_UINT16, BASE_HEX, VALS(fc_swils_esc_protocol_val), 0x0,
2130 NULL, HFILL}},
2132 { &hf_swils_zone_activezonenm,
2133 {"Active Zoneset Name", "swils.mr.activezonesetname",
2134 FT_STRING, BASE_NONE, NULL, 0x0,
2135 NULL, HFILL}},
2137 { &hf_swils_zone_objname,
2138 {"Zone Object Name", "swils.zone.zoneobjname",
2139 FT_STRING, BASE_NONE, NULL, 0x0,
2140 NULL, HFILL}},
2142 { &hf_swils_zone_objtype,
2143 {"Zone Object Type", "swils.zone.zoneobjtype",
2144 FT_UINT8, BASE_HEX, VALS(fc_swils_zoneobj_type_val), 0x0,
2145 NULL, HFILL}},
2147 { &hf_swils_zone_mbrtype,
2148 {"Zone Member Type", "swils.zone.mbrtype",
2149 FT_UINT8, BASE_HEX, VALS(fc_swils_zonembr_type_val), 0x0,
2150 NULL, HFILL}},
2152 { &hf_swils_zone_protocol,
2153 {"Zone Protocol", "swils.zone.protocol",
2154 FT_UINT8, BASE_HEX, NULL, 0x0,
2155 NULL, HFILL}},
2157 { &hf_swils_zone_mbrid,
2158 {"Member Identifier", "swils.zone.mbrid",
2159 FT_STRING, BASE_NONE, NULL, 0x0,
2160 NULL, HFILL}},
2162 { &hf_swils_zone_mbrid_fcwwn,
2163 {"Member Identifier", "swils.zone.mbrid.fcwwn",
2164 FT_FCWWN, BASE_NONE, NULL, 0x0,
2165 NULL, HFILL}},
2167 { &hf_swils_zone_mbrid_fc,
2168 {"Member Identifier", "swils.zone.mbrid.fc",
2169 FT_BYTES, SEP_DOT, NULL, 0x0,
2170 NULL, HFILL}},
2172 { &hf_swils_zone_mbrid_uint,
2173 {"Member Identifier", "swils.zone.mbrid.uint",
2174 FT_UINT32, BASE_HEX, NULL, 0x0,
2175 NULL, HFILL}},
2177 { &hf_swils_zone_status,
2178 {"Zone Command Status", "swils.zone.status",
2179 FT_UINT8, BASE_HEX, VALS(fc_swils_mr_rsp_val), 0x0,
2180 "Applies to MR, ACA, RCA, SFC, UFC", HFILL}},
2182 { &hf_swils_zone_reason,
2183 {"Zone Command Reason Code", "swils.zone.reason",
2184 FT_UINT8, BASE_HEX, VALS(fc_swils_mr_reason_val), 0x0,
2185 "Applies to MR, ACA, RCA, SFC, UFC", HFILL}},
2187 { &hf_swils_aca_domainid,
2188 {"Known Domain ID", "swils.aca.domainid",
2189 FT_UINT8, BASE_HEX, NULL, 0x0,
2190 NULL, HFILL}},
2192 { &hf_swils_sfc_opcode,
2193 {"Operation Request", "swils.sfc.opcode",
2194 FT_UINT8, BASE_HEX, VALS(fc_swils_sfc_op_val), 0x0,
2195 NULL, HFILL}},
2197 { &hf_swils_sfc_zonenm,
2198 {"Zone Set Name", "swils.sfc.zonename",
2199 FT_STRING, BASE_NONE, NULL, 0x0,
2200 NULL, HFILL}},
2202 { &hf_swils_rjt,
2203 {"Reason Code", "swils.rjt.reason",
2204 FT_UINT8, BASE_HEX, VALS(fc_swils_rjt_val), 0x0,
2205 NULL, HFILL}},
2207 { &hf_swils_rjtdet,
2208 {"Reason Code Explanation", "swils.rjt.reasonexpl",
2209 FT_UINT8, BASE_HEX, VALS(fc_swils_deterr_val), 0x0,
2210 NULL, HFILL}},
2212 { &hf_swils_rjtvendor,
2213 {"Vendor Unique Error Code", "swils.rjt.vendor",
2214 FT_UINT8, BASE_HEX, NULL, 0x0,
2215 NULL, HFILL}},
2217 { &hf_swils_zone_mbrid_lun,
2218 {"LUN", "swils.zone.lun",
2219 FT_BYTES, BASE_NONE, NULL, 0x0,
2220 NULL, HFILL}},
2222 { &hf_swils_ess_rev,
2223 {"Revision", "swils.ess.revision",
2224 FT_UINT32, BASE_DEC, NULL, 0x0,
2225 NULL, HFILL}},
2227 { &hf_swils_ess_len,
2228 {"Payload Length", "swils.ess.leb",
2229 FT_UINT32, BASE_DEC, NULL, 0x0,
2230 NULL, HFILL}},
2232 { &hf_swils_ess_numobj,
2233 {"Number of Capability Objects", "swils.ess.numobj",
2234 FT_UINT16, BASE_DEC, NULL, 0x0,
2235 NULL, HFILL}},
2237 { &hf_swils_interconnect_list_len,
2238 {"List Length", "swils.ess.listlen",
2239 FT_UINT8, BASE_DEC, NULL, 0x0,
2240 NULL, HFILL}},
2242 { &hf_swils_ess_vendorname,
2243 {"Vendor Name", "swils.ess.vendorname",
2244 FT_STRING, BASE_NONE, NULL, 0x0,
2245 NULL, HFILL}},
2247 { &hf_swils_ess_modelname,
2248 {"Model Name", "swils.ess.modelname",
2249 FT_STRING, BASE_NONE, NULL, 0x0,
2250 NULL, HFILL}},
2252 { &hf_swils_ess_relcode,
2253 {"Release Code", "swils.ess.relcode",
2254 FT_STRING, BASE_NONE, NULL, 0x0,
2255 NULL, HFILL}},
2257 { &hf_swils_ess_vendorspecific,
2258 {"Vendor Specific", "swils.ess.vendorspecific",
2259 FT_STRING, BASE_NONE, NULL, 0x0,
2260 NULL, HFILL}},
2262 { &hf_swils_ess_cap_type,
2263 {"Type", "swils.ess.capability.type",
2264 FT_UINT8, BASE_DEC, VALS(fc_ct_gstype_vals), 0x0,
2265 NULL, HFILL}},
2267 { &hf_swils_ess_cap_subtype,
2268 {"Subtype", "swils.ess.capability.subtype",
2269 FT_UINT8, BASE_DEC, NULL, 0x0,
2270 NULL, HFILL}},
2272 { &hf_swils_ess_cap_numentries,
2273 {"Number of Entries", "swils.ess.capability.numentries",
2274 FT_UINT8, BASE_DEC, NULL, 0x0,
2275 NULL, HFILL}},
2277 { &hf_swils_ess_cap_svc,
2278 {"Service Name", "swils.ess.capability.service",
2279 FT_UINT8, BASE_DEC, VALS(fc_ct_gsserver_vals), 0x0,
2280 NULL, HFILL}},
2282 { &hf_swils_ess_dns_obj0h,
2283 {"Name Server Entry Object 00h Support", "swils.ess.capability.dns.obj0h",
2284 FT_BOOLEAN, 8, NULL, 0x1,
2285 NULL, HFILL}},
2287 { &hf_swils_ess_dns_obj1h,
2288 {"Name Server Entry Object 01h Support", "swils.ess.capability.dns.obj1h",
2289 FT_BOOLEAN, 8, NULL, 0x2,
2290 NULL, HFILL}},
2292 { &hf_swils_ess_dns_obj2h,
2293 {"Name Server Entry Object 02h Support", "swils.ess.capability.dns.obj2h",
2294 FT_BOOLEAN, 8, NULL, 0x4,
2295 NULL, HFILL}},
2297 { &hf_swils_ess_dns_obj3h,
2298 {"Name Server Entry Object 03h Support", "swils.ess.capability.dns.obj3h",
2299 FT_BOOLEAN, 8, NULL, 0x8,
2300 NULL, HFILL}},
2302 { &hf_swils_ess_dns_zlacc,
2303 {"GE_PT Zero Length Accepted", "swils.ess.capability.dns.zlacc",
2304 FT_BOOLEAN, 8, NULL, 0x10,
2305 NULL, HFILL}},
2307 { &hf_swils_ess_dns_vendor,
2308 {"Vendor Specific Flags", "swils.ess.capability.dns.vendor",
2309 FT_UINT32, BASE_HEX, NULL, 0x0,
2310 NULL, HFILL}},
2312 { &hf_swils_ess_fctlr_rscn,
2313 {"SW_RSCN Supported", "swils.ess.capability.fctlr.rscn",
2314 FT_BOOLEAN, 8, NULL, 0x1,
2315 NULL, HFILL}},
2317 { &hf_swils_ess_fctlr_vendor,
2318 {"Vendor Specific Flags", "swils.ess.capability.fctlr.vendor",
2319 FT_UINT32, BASE_HEX, NULL, 0x0,
2320 NULL, HFILL}},
2322 { &hf_swils_ess_fcs_basic,
2323 {"Basic Configuration Services", "swils.ess.capability.fcs.basic",
2324 FT_BOOLEAN, 8, NULL, 0x1,
2325 NULL, HFILL}},
2327 { &hf_swils_ess_fcs_platform,
2328 {"Platform Configuration Services", "swils.ess.capability.fcs.platform",
2329 FT_BOOLEAN, 8, NULL, 0x2,
2330 NULL, HFILL}},
2332 { &hf_swils_ess_fcs_topology,
2333 {"Topology Discovery Services", "swils.ess.capability.fcs.topology",
2334 FT_BOOLEAN, 8, NULL, 0x4,
2335 NULL, HFILL}},
2337 { &hf_swils_ess_fcs_enhanced,
2338 {"Enhanced Configuration Services", "swils.ess.capability.fcs.enhanced",
2339 FT_BOOLEAN, 8, NULL, 0x8,
2340 NULL, HFILL}},
2342 { &hf_swils_ess_fzs_enh_supp,
2343 {"Enhanced Zoning Supported", "swils.ess.capability.fzs.ezonesupp",
2344 FT_BOOLEAN, 8, NULL, 0x1,
2345 NULL, HFILL}},
2347 { &hf_swils_ess_fzs_enh_ena,
2348 {"Enhanced Zoning Enabled", "swils.ess.capability.fzs.ezoneena",
2349 FT_BOOLEAN, 8, NULL, 0x2,
2350 NULL, HFILL}},
2352 { &hf_swils_ess_fzs_mr,
2353 {"Merge Control Setting", "swils.ess.capability.fzs.mr",
2354 FT_BOOLEAN, 8, NULL, 0x4,
2355 NULL, HFILL}},
2357 { &hf_swils_ess_fzs_defzone,
2358 {"Default Zone Setting", "swils.ess.capability.fzs.defzone",
2359 FT_BOOLEAN, 8, NULL, 0x8,
2360 NULL, HFILL}},
2362 { &hf_swils_ess_fzs_zsdb_supp,
2363 {"Zoneset Database Supported", "swils.ess.capability.fzs.zsdbsupp",
2364 FT_BOOLEAN, 8, NULL, 0x10,
2365 NULL, HFILL}},
2367 { &hf_swils_ess_fzs_zsdb_ena,
2368 {"Zoneset Database Enabled", "swils.ess.capability.fzs.zsdbena",
2369 FT_BOOLEAN, 8, NULL, 0x20,
2370 NULL, HFILL}},
2372 { &hf_swils_ess_fzs_adc_supp,
2373 {"Active Direct Command Supported", "swils.ess.capability.fzs.adcsupp",
2374 FT_BOOLEAN, 8, NULL, 0x40,
2375 NULL, HFILL}},
2377 { &hf_swils_ess_fzs_hardzone,
2378 {"Hard Zoning Supported", "swils.ess.capability.fzs.hardzone",
2379 FT_BOOLEAN, 8, NULL, 0x80,
2380 NULL, HFILL}},
2382 { &hf_swils_ess_cap_len,
2383 {"Length", "swils.ess.capability.length",
2384 FT_UINT8, BASE_DEC, NULL, 0x0,
2385 NULL, HFILL}},
2387 { &hf_swils_ess_cap_t10,
2388 {"T10 Vendor ID", "swils.ess.capability.t10id",
2389 FT_STRING, BASE_NONE, NULL, 0x0,
2390 NULL, HFILL}},
2392 { &hf_swils_ess_cap_vendorobj,
2393 {"Vendor-Specific Info", "swils.ess.capability.vendorobj",
2394 FT_BYTES, BASE_NONE, NULL, 0x0,
2395 NULL, HFILL}},
2397 { &hf_swils_mrra_rev,
2398 {"Revision", "swils.mrra.revision",
2399 FT_UINT32, BASE_DEC, NULL, 0x0,
2400 NULL, HFILL}},
2402 { &hf_swils_mrra_size,
2403 {"Merge Request Size", "swils.mrra.size",
2404 FT_UINT32, BASE_DEC, NULL, 0x0,
2405 NULL, HFILL}},
2407 { &hf_swils_mrra_vendorid,
2408 {"Vendor ID", "swils.mrra.vendorid",
2409 FT_STRING, BASE_NONE, NULL, 0x0,
2410 NULL, HFILL}},
2412 { &hf_swils_mrra_vendorinfo,
2413 {"Vendor-Specific Info", "swils.mrra.vendorinfo",
2414 FT_BYTES, BASE_NONE, NULL, 0x0,
2415 NULL, HFILL}},
2417 { &hf_swils_mrra_reply,
2418 {"MRRA Response", "swils.mrra.reply",
2419 FT_UINT32, BASE_DEC, NULL, 0x0,
2420 NULL, HFILL}},
2422 { &hf_swils_mrra_reply_size,
2423 {"Maximum Resources Available", "swils.mrra.replysize",
2424 FT_UINT32, BASE_DEC, NULL, 0x0,
2425 NULL, HFILL}},
2427 { &hf_swils_mrra_waittime,
2428 {"Waiting Period (secs)", "swils.mrra.waittime",
2429 FT_UINT32, BASE_DEC, NULL, 0x0,
2430 NULL, HFILL}},
2432 /* Generated from convert_proto_tree_add_text.pl */
2433 { &hf_swils_requested_domain_id, { "Requested Domain ID", "swils.requested_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2434 { &hf_swils_granted_domain_id, { "Granted Domain ID", "swils.granted_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2435 { &hf_swils_lsrh_lsr_age, { "LSR Age", "swils.lsr.age", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_seconds), 0x0, NULL, HFILL }},
2436 { &hf_swils_lsrh_options, { "Options", "swils.lsr.options", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2437 { &hf_swils_lsrh_checksum, { "Checksum", "swils.lsr.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2438 { &hf_swils_lsrh_lsr_length, { "LSR Length", "swils.lsr.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2439 { &hf_swils_lsrec_number_of_links, { "Number of Links", "swils.lsr.number_of_links", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2440 { &hf_swils_lsupdate_flags, { "Flags", "swils.lsupdate.flags", FT_UINT8, BASE_HEX, VALS(fc_swils_fspf_lsrflags_val), 0x0, NULL, HFILL }},
2441 { &hf_swils_lsupdate_num_of_lsrs, { "Num of LSRs", "swils.lsupdate.num_of_lsrs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2442 { &hf_swils_lsack_flags, { "Flags", "swils.lsack.flags", FT_UINT8, BASE_HEX, VALS(fc_swils_fspf_lsrflags_val), 0x0, NULL, HFILL }},
2443 { &hf_swils_lsack_num_of_lsr_headers, { "Num of LSR Headers", "swils.lsack.num_of_lsr_headers", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2444 { &hf_swils_rscn_num_entries, { "Num Entries", "swils.rscn.num_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2445 { &hf_swils_zone_mbrflags, { "Flags", "swils.zone.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2446 { &hf_swils_zone_mbr_identifier_length, { "Identifier Length", "swils.zone.identifier_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2447 { &hf_swils_zone_num_members, { "4", "swils.zone.num_members", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2448 { &hf_swils_zone_active_zoneset_length, { "Active ZoneSet Length", "swils.zone.active_zoneset_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2449 { &hf_swils_zone_num_zoning_objects, { "Number of zoning objects", "swils.zone.num_zoning_objects", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2450 { &hf_swils_zone_full_zone_set_length, { "Full Zone Set Length", "swils.zone.full_zone_set_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2451 { &hf_swils_zone_vendor_unique, { "Vendor Unique", "swils.zone.vendor_unique", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2452 { &hf_swils_domain_id_list_length, { "Domain ID List Length", "swils.aca.domain_id_list_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2453 { &hf_swils_sfc_zoneset_length, { "ZoneSet Length", "swils.sfc.zoneset_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2454 { &hf_swils_esc_payload_length, { "Payload Length", "swils.esc.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2457 static int *ett[] = {
2458 &ett_fcswils,
2459 &ett_fcswils_swacc,
2460 &ett_fcswils_swrjt,
2461 &ett_fcswils_elp,
2462 &ett_fcswils_efp,
2463 &ett_fcswils_efplist,
2464 &ett_fcswils_dia,
2465 &ett_fcswils_rdi,
2466 &ett_fcswils_fspfhdr,
2467 &ett_fcswils_hlo,
2468 &ett_fcswils_lsrec,
2469 &ett_fcswils_lsrechdr,
2470 &ett_fcswils_ldrec,
2471 &ett_fcswils_lsu,
2472 &ett_fcswils_lsa,
2473 &ett_fcswils_bf,
2474 &ett_fcswils_rcf,
2475 &ett_fcswils_rscn,
2476 &ett_fcswils_rscn_dev,
2477 &ett_fcswils_drlir,
2478 &ett_fcswils_mr,
2479 &ett_fcswils_zoneobjlist,
2480 &ett_fcswils_zoneobj,
2481 &ett_fcswils_zonembr,
2482 &ett_fcswils_aca,
2483 &ett_fcswils_rca,
2484 &ett_fcswils_sfc,
2485 &ett_fcswils_ufc,
2486 &ett_fcswils_esc,
2487 &ett_fcswils_esc_pdesc,
2488 &ett_fcswils_ieinfo,
2489 &ett_fcswils_capinfo
2492 static ei_register_info ei[] = {
2493 { &ei_swils_efp_record_len, { "swils.efp.recordlen.zero", PI_UNDECODED, PI_NOTE, "Record length is zero", EXPFILL }},
2494 { &ei_swils_no_exchange, { "swils.no_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode", EXPFILL }},
2495 { &ei_swils_zone_mbrid, { "swils.zone.mbrid.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown member type format", EXPFILL }},
2498 expert_module_t* expert_fcswils;
2500 proto_fcswils = proto_register_protocol("Fibre Channel SW_ILS", "FC-SWILS", "swils");
2502 proto_register_field_array(proto_fcswils, hf, array_length(hf));
2503 proto_register_subtree_array(ett, array_length(ett));
2504 expert_fcswils = expert_register_protocol(proto_fcswils);
2505 expert_register_field_array(expert_fcswils, ei, array_length(ei));
2507 fcswils_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcswils_hash, fcswils_equal);
2509 swils_handle = register_dissector("swils", dissect_fcswils, proto_fcswils);
2512 void
2513 proto_reg_handoff_fcswils(void)
2515 dissector_add_uint("fc.ftype", FC_FTYPE_SWILS, swils_handle);
2517 fcsp_handle = find_dissector_add_dependency("fcsp", proto_fcswils);
2521 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2523 * Local variables:
2524 * c-basic-offset: 4
2525 * tab-width: 8
2526 * indent-tabs-mode: nil
2527 * End:
2529 * vi: set shiftwidth=4 tabstop=8 expandtab:
2530 * :indentSize=4:tabSize=8:noTabs=true: