epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-fcels.c
blob59d7eb33580edd6831a8f841d513347fd119f147
1 /* packet-fcels.c
2 * Routines for FC Extended 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
13 * TODO Still (Complete compliance with FC-MI):
14 * - Decode RNID, RLIR
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <epan/tfs.h>
21 #include <epan/expert.h>
22 #include "packet-fc.h"
23 #include "packet-fcels.h"
25 void proto_register_fcels(void);
26 void proto_reg_handoff_fcels(void);
28 static dissector_handle_t els_handle;
30 #define FC_ELS_RPLY 0
31 #define FC_ELS_REQ 1
33 /* Initialize the protocol and registered fields */
34 static int proto_fcels;
35 static int hf_fcels_opcode;
36 static int hf_fcels_rjtcode;
37 static int hf_fcels_rjtdetcode;
38 static int hf_fcels_vnduniq;
39 static int hf_fcels_b2b;
40 static int hf_fcels_cmnfeatures;
41 static int hf_fcels_bbscnum;
42 static int hf_fcels_rcvsize;
43 static int hf_fcels_maxconseq;
44 static int hf_fcels_reloffset;
45 static int hf_fcels_edtov;
46 static int hf_fcels_npname;
47 static int hf_fcels_fnname;
48 #if 0
49 static int hf_fcels_cls1param;
50 static int hf_fcels_cls2param;
51 static int hf_fcels_cls3param;
52 static int hf_fcels_cls4param;
53 #endif
54 static int hf_fcels_vendorvers;
55 static int hf_fcels_svcavail;
56 static int hf_fcels_clsflags;
57 static int hf_fcels_clsrcvsize;
58 static int hf_fcels_conseq;
59 static int hf_fcels_e2e;
60 static int hf_fcels_openseq;
61 static int hf_fcels_nportid;
62 static int hf_fcels_oxid;
63 static int hf_fcels_rxid;
64 static int hf_fcels_recovqual;
65 static int hf_fcels_fabricaddr;
66 static int hf_fcels_fabricpname;
67 static int hf_fcels_failedrcvr;
68 static int hf_fcels_flacompliance;
69 static int hf_fcels_loopstate;
70 static int hf_fcels_publicloop_bmap;
71 static int hf_fcels_pvtloop_bmap;
72 static int hf_fcels_alpa_map;
73 static int hf_fcels_scrregn;
74 static int hf_fcels_farp_matchcodept;
75 static int hf_fcels_farp_respaction;
76 static int hf_fcels_resportid;
77 static int hf_fcels_respname;
78 static int hf_fcels_respnname;
79 static int hf_fcels_reqipaddr;
80 static int hf_fcels_respipaddr;
81 static int hf_fcels_hardaddr;
82 static int hf_fcels_rps_flag;
83 static int hf_fcels_rps_portnum;
84 static int hf_fcels_rps_portstatus;
85 static int hf_fcels_rnft_fc4type;
86 static int hf_fcels_rscn_evqual;
87 static int hf_fcels_rscn_addrfmt;
88 static int hf_fcels_rscn_domain;
89 static int hf_fcels_rscn_area;
90 static int hf_fcels_rscn_port;
91 static int hf_fcels_rec_fc4;
92 static int hf_fcels_estat;
93 static int hf_fcels_estat_resp;
94 static int hf_fcels_estat_seq_init;
95 static int hf_fcels_estat_compl;
96 static int hf_fcels_nodeidfmt;
97 static int hf_fcels_spidlen;
98 static int hf_fcels_vendoruniq;
99 static int hf_fcels_vendorsp;
100 static int hf_fcels_asstype;
101 static int hf_fcels_physport;
102 static int hf_fcels_attnodes;
103 static int hf_fcels_nodemgmt;
104 static int hf_fcels_ipvers;
105 static int hf_fcels_tcpport;
106 static int hf_fcels_ip;
107 static int hf_fcels_cbind_liveness;
108 static int hf_fcels_cbind_addr_mode;
109 static int hf_fcels_cbind_ifcp_version;
110 static int hf_fcels_cbind_userinfo;
111 static int hf_fcels_cbind_snpname;
112 static int hf_fcels_cbind_dnpname;
113 static int hf_fcels_cbind_status;
114 static int hf_fcels_chandle;
115 static int hf_fcels_unbind_status;
116 static int hf_fcels_cmn_cios;
117 static int hf_fcels_cmn_rro;
118 static int hf_fcels_cmn_vvv;
119 static int hf_fcels_cmn_b2b;
120 static int hf_fcels_cmn_e_d_tov;
121 static int hf_fcels_cmn_simplex;
122 static int hf_fcels_cmn_multicast;
123 static int hf_fcels_cmn_broadcast;
124 static int hf_fcels_cmn_security;
125 static int hf_fcels_cmn_clk;
126 static int hf_fcels_cmn_dhd;
127 static int hf_fcels_cmn_seqcnt;
128 static int hf_fcels_cmn_payload;
129 static int hf_fcels_cls_cns;
130 static int hf_fcels_cls_sdr;
131 static int hf_fcels_cls_prio;
132 static int hf_fcels_cls_nzctl;
133 static int hf_fcels_initctl;
134 static int hf_fcels_initctl_initial_pa;
135 static int hf_fcels_initctl_ack0;
136 static int hf_fcels_initctl_ackgaa;
137 static int hf_fcels_initctl_sync;
138 static int hf_fcels_rcptctl;
139 static int hf_fcels_rcptctl_ack0;
140 static int hf_fcels_rcptctl_interlock;
141 static int hf_fcels_rcptctl_policy;
142 static int hf_fcels_rcptctl_category;
143 static int hf_fcels_rcptctl_sync;
144 static int hf_fcels_fcpflags;
145 static int hf_fcels_fcpflags_trireq;
146 static int hf_fcels_fcpflags_trirep;
147 static int hf_fcels_fcpflags_retry;
148 static int hf_fcels_fcpflags_ccomp;
149 static int hf_fcels_fcpflags_datao;
150 static int hf_fcels_fcpflags_initiator;
151 static int hf_fcels_fcpflags_target;
152 static int hf_fcels_fcpflags_rdxr;
153 static int hf_fcels_fcpflags_wrxr;
154 static int hf_fcels_prliloflags;
155 static int hf_fcels_tprloflags_opav;
156 static int hf_fcels_tprloflags_rpav;
157 static int hf_fcels_tprloflags_npv;
158 static int hf_fcels_tprloflags_gprlo;
159 static int hf_fcels_speedflags;
160 static int hf_fcels_speedflags_1gb;
161 static int hf_fcels_speedflags_2gb;
162 static int hf_fcels_speedflags_4gb;
163 static int hf_fcels_speedflags_10gb;
164 static int hf_fcels_prliloflags_opav;
165 static int hf_fcels_prliloflags_ipe;
166 static int hf_fcels_prliloflags_eip;
167 /* Generated from convert_proto_tree_add_text.pl */
168 static int hf_fcels_rnft_index_of_first_rec_in_list;
169 static int hf_fcels_lip_f7_received_count;
170 static int hf_fcels_recovery_qualifier_status;
171 static int hf_fcels_rpl_port_identifier;
172 static int hf_fcels_rpl_index_of_i_port_block;
173 static int hf_fcels_lip_f7_initiated_count;
174 static int hf_fcels_srl_fl_port_addr;
175 static int hf_fcels_loss_of_signal_count;
176 static int hf_fcels_lirr_regn_function;
177 static int hf_fcels_rscn_page_len;
178 static int hf_fcels_prlilo_service_parameter_response;
179 static int hf_fcels_prlilo_type_code_extension;
180 static int hf_fcels_rnft_list_length;
181 static int hf_fcels_rpl_index;
182 static int hf_fcels_rpl_physical_port;
183 static int hf_fcels_prlilo_originator_pa;
184 static int hf_fcels_rpl_list_length;
185 static int hf_fcels_common_identification_data_length;
186 static int hf_fcels_loss_of_sync_count;
187 static int hf_fcels_lip_reset_received_count;
188 static int hf_fcels_rpl_max_size;
189 static int hf_fcels_prlilo_response_code;
190 static int hf_fcels_invalid_crc_count;
191 static int hf_fcels_rscn_payload_len;
192 static int hf_fcels_link_failure_count;
193 static int hf_fcels_prlilo_3rd_party_n_port_id;
194 static int hf_fcels_lip_al_ps;
195 static int hf_fcels_prlilo_type;
196 static int hf_fcels_lirr_regn_format;
197 static int hf_fcels_srl_flag;
198 static int hf_fcels_prlilo_page_length;
199 static int hf_fcels_rpl_payload_length;
200 static int hf_fcels_rpsc_port_oper_speed;
201 static int hf_fcels_lip_reset_initiated_count;
202 static int hf_fcels_l_port_status;
203 static int hf_fcels_primitive_seq_protocol_err;
204 static int hf_fcels_rnft_max_size;
205 static int hf_fcels_lip_f8_received_count;
206 static int hf_fcels_rnft_index;
207 static int hf_fcels_rnft_payload_len;
208 static int hf_fcels_prlilo_payload_length;
209 static int hf_fcels_prlilo_responder_pa;
210 static int hf_fcels_rpsc_number_of_entries;
211 static int hf_fcels_prlilo_3rd_party_originator_pa;
212 static int hf_fcels_invalid_xmission_word;
213 static int hf_fcels_rnft_fc4_qualifier;
214 static int hf_fcels_lip_f8_initiated_count;
215 static int hf_fcels_rpl_port_name;
217 static int ett_fcels;
218 static int ett_fcels_lsrjt;
219 static int ett_fcels_acc;
220 static int ett_fcels_logi;
221 static int ett_fcels_logi_cmnsvc;
222 static int ett_fcels_logi_clssvc;
223 static int ett_fcels_logo;
224 static int ett_fcels_abtx;
225 static int ett_fcels_rsi;
226 static int ett_fcels_rrq;
227 static int ett_fcels_rec;
228 static int ett_fcels_prli;
229 static int ett_fcels_prli_svcpg;
230 static int ett_fcels_adisc;
231 static int ett_fcels_farp;
232 static int ett_fcels_rps;
233 static int ett_fcels_rpl;
234 static int ett_fcels_rplpb;
235 static int ett_fcels_fan;
236 static int ett_fcels_rscn;
237 static int ett_fcels_rscn_rec;
238 static int ett_fcels_estat;
239 static int ett_fcels_scr;
240 static int ett_fcels_rnft;
241 static int ett_fcels_rnft_fc4;
242 static int ett_fcels_lsts;
243 static int ett_fcels_rnid;
244 static int ett_fcels_rlir;
245 static int ett_fcels_lirr;
246 static int ett_fcels_srl;
247 static int ett_fcels_rpsc;
248 static int ett_fcels_cbind;
249 static int ett_fcels_cmnfeatures;
250 static int ett_fcels_clsflags;
251 static int ett_fcels_initctl;
252 static int ett_fcels_rcptctl;
253 static int ett_fcels_fcpflags;
254 static int ett_fcels_prliloflags;
255 static int ett_fcels_speedflags;
257 static expert_field ei_fcels_src_unknown;
258 static expert_field ei_fcels_dst_unknown;
259 static expert_field ei_fcels_no_record_of_els_req;
260 static expert_field ei_fcels_no_record_of_exchange;
262 static int * const hf_fcels_estat_fields[] = {
263 &hf_fcels_estat_resp,
264 &hf_fcels_estat_seq_init,
265 &hf_fcels_estat_compl,
266 NULL
269 static const true_false_string tfs_fcels_estat_resp = {
270 "Responding to Exchange",
271 "Originator of Exchange"
274 static const true_false_string tfs_fcels_estat_seq_init = {
275 "Seq Initiative held by REC responder",
276 "Seq Initiative not held by REC responder"
280 #define FC_ESB_ST_RESP (1U << 31) /* responder to exchange */
281 #define FC_ESB_ST_SEQ_INIT (1U << 30) /* holds sequence initiative */
282 #define FC_ESB_ST_COMPLETE (1U << 29) /* exchange is complete */
284 static const value_string fc_els_proto_val[] = {
285 {FC_ELS_LSRJT , "LS_RJT"},
286 {FC_ELS_ACC , "ACC"},
287 {FC_ELS_PLOGI , "PLOGI"},
288 {FC_ELS_FLOGI , "FLOGI"},
289 {FC_ELS_LOGOUT , "LOGO"},
290 {FC_ELS_ABTX , "ABTX"},
291 {FC_ELS_RSI , "RSI"},
292 {FC_ELS_RTV , "RTV"},
293 {FC_ELS_RLS , "RLS"},
294 {FC_ELS_ECHO , "ECHO"},
295 {FC_ELS_TEST , "TEST"},
296 {FC_ELS_RRQ , "RRQ"},
297 {FC_ELS_REC , "REC"},
298 {FC_ELS_SRR , "SRR"},
299 {FC_ELS_PRLI , "PRLI"},
300 {FC_ELS_PRLO , "PRLO"},
301 {FC_ELS_TPRLO , "TPRLO"},
302 {FC_ELS_PDISC , "PDISC"},
303 {FC_ELS_FDISC , "FDISC"},
304 {FC_ELS_ADISC , "ADISC"},
305 {FC_ELS_FARP_REQ , "FARP-REQ"},
306 {FC_ELS_FARP_RPLY , "FARP-REPLY"},
307 {FC_ELS_RPS , "RPS"},
308 {FC_ELS_RPL , "RPL"},
309 {FC_ELS_FAN , "FAN"},
310 {FC_ELS_RSCN , "RSCN"},
311 {FC_ELS_SCR , "SCR"},
312 {FC_ELS_RNFT , "RNFT"},
313 {FC_ELS_LINIT , "LINIT"},
314 {FC_ELS_LSTS , "LSTS"},
315 {FC_ELS_RNID , "RNID"},
316 {FC_ELS_RLIR , "RLIR"},
317 {FC_ELS_LIRR , "LIRR"},
318 {FC_ELS_SRL , "SRL"},
319 {FC_ELS_RPSC , "RPSC"},
320 {FC_ELS_LKA , "LKA"},
321 {FC_ELS_AUTH , "AUTH"},
322 {FC_ELS_CBIND , "CBIND"},
323 {FC_ELS_UNBIND , "UNBIND"},
324 {0, NULL}
326 value_string_ext fc_els_proto_val_ext = VALUE_STRING_EXT_INIT(fc_els_proto_val);
328 /* Reject Reason Codes */
329 #define FC_ELS_RJT_INVCMDCODE 0x01
330 #define FC_ELS_RJT_LOGERR 0x03
331 #define FC_ELS_RJT_LOGBSY 0x05
332 #define FC_ELS_RJT_PROTERR 0x07
333 #define FC_ELS_RJT_GENFAIL 0x09
334 #define FC_ELS_RJT_CMDNOTSUPP 0x0B
335 #define FC_ELS_RJT_GENFAIL2 0x0D
336 #define FC_ELS_RJT_CMDINPROG 0x0E
337 #define FC_ELS_RJT_FIP 0x20
338 #define FC_ELS_RJT_VENDOR 0xFF
340 static const value_string fc_els_rjt_val[] = {
341 {FC_ELS_RJT_INVCMDCODE, "Invalid Cmd Code"},
342 {FC_ELS_RJT_LOGERR , "Logical Error"},
343 {FC_ELS_RJT_LOGBSY , "Logical Busy"},
344 {FC_ELS_RJT_PROTERR , "Protocol Error"},
345 {FC_ELS_RJT_GENFAIL , "Unable to Perform Cmd"},
346 {FC_ELS_RJT_CMDNOTSUPP, "Command Not Supported"},
347 {FC_ELS_RJT_GENFAIL2 , "Unable to Perform Cmd"},
348 {FC_ELS_RJT_CMDINPROG , "Command in Progress Already"},
349 {FC_ELS_RJT_FIP , "FIP Error"},
350 {FC_ELS_RJT_VENDOR , "Vendor Unique Error"},
351 {0, NULL}
353 static value_string_ext fc_els_rjt_val_ext = VALUE_STRING_EXT_INIT(fc_els_rjt_val);
355 #define FC_ELS_RJT_DET_NODET 0x00
356 #define FC_ELS_RJT_DET_SVCPARM_OPT 0x01
357 #define FC_ELS_RJT_DET_SVCPARM_INITCTL 0x03
358 #define FC_ELS_RJT_DET_SVCPARM_RCPTCTL 0x05
359 #define FC_ELS_RJT_DET_SVCPARM_RCVSZE 0x07
360 #define FC_ELS_RJT_DET_SVCPARM_CSEQ 0x09
361 #define FC_ELS_RJT_DET_SVCPARM_CREDIT 0x0B
362 #define FC_ELS_RJT_DET_INV_PFNAME 0x0D
363 #define FC_ELS_RJT_DET_INV_NFNAME 0x0E
364 #define FC_ELS_RJT_DET_INV_CMNSVCPARM 0x0F
365 #define FC_ELS_RJT_DET_INV_ASSOCHDR 0x11
366 #define FC_ELS_RJT_DET_ASSOCHDR_REQD 0x13
367 #define FC_ELS_RJT_DET_INV_OSID 0x15
368 #define FC_ELS_RJT_DET_EXCHG_COMBO 0x17
369 #define FC_ELS_RJT_DET_CMDINPROG 0x19
370 #define FC_ELS_RJT_DET_PLOGI_REQ 0x1E
371 #define FC_ELS_RJT_DET_INV_NPID 0x1F
372 #define FC_ELS_RJT_DET_INV_SEQID 0x21
373 #define FC_ELS_RJT_DET_INV_EXCHG 0x23
374 #define FC_ELS_RJT_DET_INACTIVE_EXCHG 0x25
375 #define FC_ELS_RJT_DET_RQUAL_REQD 0x27
376 #define FC_ELS_RJT_DET_OORSRC 0x29
377 #define FC_ELS_RJT_DET_SUPPLYFAIL 0x2A
378 #define FC_ELS_RJT_DET_REQNOTSUPP 0x2C
379 #define FC_ELS_RJT_DET_INV_PLEN 0x2D
380 #define FC_ELS_RJT_DET_INV_ALIASID 0x30
381 #define FC_ELS_RJT_DET_OORSRC_ALIASID 0x31
382 #define FC_ELS_RJT_DET_INACTIVE_ALIASID 0x32
383 #define FC_ELS_RJT_DET_DEACT_ALIAS_FAIL1 0x33
384 #define FC_ELS_RJT_DET_DEACT_ALIAS_FAIL2 0x34
385 #define FC_ELS_RJT_DET_SVCPARM_CONFLICT 0x35
386 #define FC_ELS_RJT_DET_INV_ALIASTOK 0x36
387 #define FC_ELS_RJT_DET_UNSUPP_ALIASTOK 0x37
388 #define FC_ELS_RJT_DET_GRPFORM_FAIL 0x38
389 #define FC_ELS_RJT_DET_QOSPARM_ERR 0x40
390 #define FC_ELS_RJT_DET_INV_VCID 0x41
391 #define FC_ELS_RJT_DET_OORSRC_C4 0x42
392 #define FC_ELS_RJT_DET_INV_PNNAME 0x44
393 #define FC_ELS_RJT_DET_AUTH_REQD 0x48
394 #define FC_ELS_RJT_DET_NOT_NEIGHBOR 0x62
396 static const value_string fc_els_rjt_det_val[] = {
397 {FC_ELS_RJT_DET_NODET , "No further details"},
398 {FC_ELS_RJT_DET_SVCPARM_OPT , "Svc Param - Options Error"},
399 {FC_ELS_RJT_DET_SVCPARM_INITCTL , "Svc Param - Initiator Ctl Error"},
400 {FC_ELS_RJT_DET_SVCPARM_RCPTCTL , "Svc Param - Recipient Ctl Error"},
401 {FC_ELS_RJT_DET_SVCPARM_RCVSZE , "Svc Param - Recv Size Error"},
402 {FC_ELS_RJT_DET_SVCPARM_CSEQ , "Svc Param - Concurrent Seq Error"},
403 {FC_ELS_RJT_DET_SVCPARM_CREDIT , "Svc Param - Credit Error"},
404 {FC_ELS_RJT_DET_INV_PFNAME , "Invalid N_/F_Port Name"},
405 {FC_ELS_RJT_DET_INV_NFNAME , "Invalid Node/Fabric Name"},
406 {FC_ELS_RJT_DET_INV_CMNSVCPARM , "Invalid Common Svc Param"},
407 {FC_ELS_RJT_DET_INV_ASSOCHDR , "Invalid Association Header"},
408 {FC_ELS_RJT_DET_ASSOCHDR_REQD , "Association Header Reqd"},
409 {FC_ELS_RJT_DET_INV_OSID , "Invalid Orig S_ID"},
410 {FC_ELS_RJT_DET_EXCHG_COMBO , "Invalid OXID-RXID Combo"},
411 {FC_ELS_RJT_DET_CMDINPROG , "Cmd Already in Progress"},
412 {FC_ELS_RJT_DET_PLOGI_REQ , "N_Port Login Required"},
413 {FC_ELS_RJT_DET_INV_NPID , "Invalid N_Port Id"},
414 {FC_ELS_RJT_DET_INV_SEQID , "Invalid SeqID"},
415 {FC_ELS_RJT_DET_INV_EXCHG , "Attempt to Abort Invalid Exchg"},
416 {FC_ELS_RJT_DET_INACTIVE_EXCHG , "Attempt to Abort Inactive Exchg"},
417 {FC_ELS_RJT_DET_RQUAL_REQD , "Resource Qualifier Required"},
418 {FC_ELS_RJT_DET_OORSRC , "Insufficient Resources for Login"},
419 {FC_ELS_RJT_DET_SUPPLYFAIL , "Unable to Supply Req Data"},
420 {FC_ELS_RJT_DET_REQNOTSUPP , "Command Not Supported"},
421 {FC_ELS_RJT_DET_INV_PLEN , "Invalid Payload Length"},
422 {FC_ELS_RJT_DET_INV_ALIASID , "No Alias IDs available"},
423 {FC_ELS_RJT_DET_OORSRC_ALIASID , "Alias_ID Cannot be Activated (Out of Rsrc)"},
424 {FC_ELS_RJT_DET_INACTIVE_ALIASID , "Alias_ID Cannot be Activated (Inv AID)"},
425 {FC_ELS_RJT_DET_DEACT_ALIAS_FAIL1, "Alias_ID Cannot be Deactivated"},
426 {FC_ELS_RJT_DET_DEACT_ALIAS_FAIL2, "Alias_ID Cannot be Deactivated"},
427 {FC_ELS_RJT_DET_SVCPARM_CONFLICT , "Svc Parameter Conflict"},
428 {FC_ELS_RJT_DET_INV_ALIASTOK , "Invalid Alias Token"},
429 {FC_ELS_RJT_DET_UNSUPP_ALIASTOK , "Unsupported Alias Token"},
430 {FC_ELS_RJT_DET_GRPFORM_FAIL , "Alias Grp Cannot be Formed"},
431 {FC_ELS_RJT_DET_QOSPARM_ERR , "QoS Param Error"},
432 {FC_ELS_RJT_DET_INV_VCID , "VC_ID Not Found"},
433 {FC_ELS_RJT_DET_OORSRC_C4 , "No Resources to Support Class 4 Conn"},
434 {FC_ELS_RJT_DET_INV_PNNAME , "Invalid Port/Node Name"},
435 {FC_ELS_RJT_DET_AUTH_REQD , "Authentication Required"},
436 {FC_ELS_RJT_DET_NOT_NEIGHBOR , "VN2VN_Port not in Neighbor Set"},
437 {0, NULL}
439 static value_string_ext fc_els_rjt_det_val_ext = VALUE_STRING_EXT_INIT(fc_els_rjt_det_val);
441 static const value_string fc_els_flacompliance_val[] = {
442 {1, "FC-FLA Level 1"},
443 {2, "FC-FLA Level 2"},
444 {0, NULL}
447 static const value_string fc_els_loopstate_val[] = {
448 {1, "Online"},
449 {2, "Loop Failure"},
450 {3, "Initialization Failure"},
451 {4, "Initializing"},
452 {0, NULL}
455 static const value_string fc_els_scr_reg_val[] = {
456 {1, "Fabric Detected Regn"},
457 {2, "N_Port Detected Regn"},
458 {3, "Full Regn"},
459 {255, "Clear All Regn"},
460 {0, NULL}
463 static const value_string fc_els_farp_respaction_val[] = {
464 {0, "No Action"},
465 {1, "Login Using Requesting Port ID"},
466 {2, "Respond with FARP-REPLY"},
467 {3, "Login & send FARP-REPLY"},
468 {0, NULL}
471 static const value_string fc_els_portstatus_val[] = {
472 {0x01, "Link Reset Protocol in Progress"},
473 {0x02, "Loss of Synchronization"},
474 {0x04, "Loss of Signal"},
475 {0x10, "AL Connection | No Fabric"},
476 {0x14, "AL Connection | Loss of Signal"},
477 {0x18, "AL Connection | Fabric Detected"},
478 {0x1C, "AL Connection | Fabric Detected | Loss of Signal"},
479 {0x20, "Point-to-Point Connection | No Fabric"},
480 {0x24, "Point-to-Point Connection | Loss of Signal"},
481 {0x28, "Point-to-Point Connection | Fabric Detected"},
482 {0x2C, "Point-to-Point Connection | Fabric Detected | Loss of Signal"},
483 {0, NULL}
485 static value_string_ext fc_els_portstatus_val_ext = VALUE_STRING_EXT_INIT(fc_els_portstatus_val);
487 static const value_string fc_els_portspeed_val[] = {
488 {0x8000, "1 Gb"},
489 {0x4000, "2 Gb"},
490 {0x2000, "4 Gb"},
491 {0x1000, "10 Gb"},
492 {0x0002, "Unknown"},
493 {0x0001, "Speed Not Estd."},
494 {0, NULL}
497 static const value_string fc_els_lirr_regfunc_val[] = {
498 {0x1, "Set Reg: Conditionally Receive"},
499 {0x2, "Set Reg: Always Receive"},
500 {0xFF, "Clear Reg"},
501 {0, NULL}
504 static const value_string fc_els_rscn_evqual_val[] = {
505 {0x00, "Event is not specified"},
506 {0x01, "Changed Name Server Object"},
507 {0x02, "Changed Port Attribute"},
508 {0x03, "Changed Service Object"},
509 {0x04, "Changed Switch Config"},
510 {0, NULL}
513 static const value_string fc_els_rscn_addrfmt_val[] = {
514 {0, "Port Addr (single N/L Port or service)"},
515 {1, "Area Addr Group (area of E/L/N Port addresses)"},
516 {2, "Domain Addr Group"},
517 {3, "Fabric Addr Group"},
518 {0, NULL}
521 static const value_string fc_els_nodeid_val[] = {
522 {0x00, "Common Identification Data Only"},
523 {0x05, "IP Specific Data"},
524 {0x08, "FCP-Specific Data"},
525 {0x20, "FC_CT Specific Data"},
526 {0x22, "SW_ILS Specific Data"},
527 {0x23, "AL Specific Data"},
528 {0x24, "SNMP Specific Data"},
529 {0xDF, "Common ID Data + General Topology Discovery Format"},
530 {0, NULL}
533 static const value_string fc_els_rnid_asstype_val[] = {
534 {0x0, "Reserved"},
535 {0x1, "Unknown"},
536 {0x2, "Other"},
537 {0x3, "Hub"},
538 {0x4, "Switch"},
539 {0x5, "Gateway"},
540 {0x6, "Converter"},
541 {0x7, "HBA"},
542 {0x9, "Storage Device"},
543 {0xA, "Host"},
544 {0xB, "Storage Subsystem"},
545 {0xE, "Storage Access Device"},
546 {0x11, "NAS Device"},
547 {0, NULL}
549 static value_string_ext fc_els_rnid_asstype_val_ext = VALUE_STRING_EXT_INIT(fc_els_rnid_asstype_val);
551 static const value_string fc_els_rnid_mgmt_val[] = {
552 {0, "IP/UDP/SNMP"},
553 {1, "IP/TCP/Telnet"},
554 {2, "IP/TCP/HTTP"},
555 {3, "IP/TCP/HTTPS"},
556 {0, NULL}
559 static const value_string fc_els_rnid_ipvers_val[] = {
560 {0, "None"},
561 {1, "IPv4"},
562 {2, "IPv6"},
563 {0, NULL}
566 static const value_string fc_prli_fc4_val[] = {
567 {FC_TYPE_SCSI , "FCP"},
568 {FC_TYPE_IP , "IP/FC"},
569 {FC_TYPE_LLCSNAP , "LLC_SNAP"},
570 {FC_TYPE_ELS , "Ext Link Svc"},
571 {FC_TYPE_FCCT , "FC_CT"},
572 {FC_TYPE_SWILS , "SW_ILS"},
573 {FC_TYPE_AL , "AL"},
574 {FC_TYPE_SNMP , "SNMP"},
575 {FC_TYPE_CMNSVC , "Common to all FC-4 Types"},
576 {0, NULL},
579 static const value_string cbind_addr_mode_vals[] = {
580 {0, "Address Translation mode"},
581 {1, "Address Transparent Mode"},
582 {0, NULL},
585 static const value_string cbind_status_vals[] = {
586 {0, "Success"},
587 {16, "Failed - Unspecified Reason"},
588 {18, "Failed - Connection ID invalid"},
589 {0, NULL},
592 static const value_string unbind_status_vals[] = {
593 {0, "Success"},
594 {16, "Failed - Unspecified Reason"},
595 {17, "Failed - No such device"},
596 {18, "Failed - iFCP session already exists"},
597 {19, "Failed - Lack of resources"},
598 {20, "Failed - Incompatible address translation mode"},
599 {21, "Failed - Incorrect protocol version"},
600 {22, "Failed - Gateway not synchronized"},
601 {0, NULL},
604 typedef struct _fcels_conv_key {
605 uint32_t conv_idx;
606 } fcels_conv_key_t;
608 typedef struct _fcels_conv_data {
609 uint32_t opcode;
610 } fcels_conv_data_t;
612 static wmem_map_t *fcels_req_hash;
614 static dissector_handle_t fcsp_handle;
617 * Hash Functions
619 static int
620 fcels_equal(const void *v, const void *w)
622 const fcels_conv_key_t *v1 = (const fcels_conv_key_t *)v;
623 const fcels_conv_key_t *v2 = (const fcels_conv_key_t *)w;
625 return (v1->conv_idx == v2->conv_idx);
628 static unsigned
629 fcels_hash (const void *v)
631 const fcels_conv_key_t *key = (const fcels_conv_key_t *)v;
632 unsigned val;
634 val = key->conv_idx;
636 return val;
639 static const true_false_string tfs_fc_fcels_cmn_b2b = {
640 "Alt B2B Credit Mgmt",
641 "Normal B2B Credit Mgmt"
643 static const true_false_string tfs_fc_fcels_cmn_e_d_tov = {
644 "E_D_TOV Resolution in ns",
645 "E_D_TOV Resolution in ms"
647 static const true_false_string tfs_fc_fcels_cmn_seqcnt = {
648 "Cont. Incr SEQCNT rules",
649 "Normal SEQCNT rules"
651 static const true_false_string tfs_fc_fcels_cmn_payload = {
652 "Payload Len=256 bytes",
653 "Payload Len=116 bytes"
656 static void
657 dissect_cmnsvc (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint16_t flags, uint8_t opcode)
659 static int * const common_flags[] = {
660 &hf_fcels_cmn_cios,
661 &hf_fcels_cmn_rro,
662 &hf_fcels_cmn_vvv,
663 &hf_fcels_cmn_b2b,
664 &hf_fcels_cmn_multicast,
665 &hf_fcels_cmn_broadcast,
666 &hf_fcels_cmn_security,
667 &hf_fcels_cmn_clk,
668 &hf_fcels_cmn_dhd,
669 &hf_fcels_cmn_payload,
670 NULL
673 static int * const pflags[] = {
674 &hf_fcels_cmn_cios,
675 &hf_fcels_cmn_rro,
676 &hf_fcels_cmn_vvv,
677 &hf_fcels_cmn_b2b,
678 &hf_fcels_cmn_e_d_tov,
679 &hf_fcels_cmn_simplex,
680 &hf_fcels_cmn_multicast,
681 &hf_fcels_cmn_broadcast,
682 &hf_fcels_cmn_security,
683 &hf_fcels_cmn_clk,
684 &hf_fcels_cmn_dhd,
685 &hf_fcels_cmn_seqcnt,
686 &hf_fcels_cmn_payload,
687 NULL
691 if ((opcode == FC_ELS_PLOGI) || (opcode == FC_ELS_PDISC)) {
692 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_cmnfeatures,
693 ett_fcels_cmnfeatures, pflags, flags, BMT_NO_FLAGS);
694 } else {
695 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_cmnfeatures,
696 ett_fcels_cmnfeatures, common_flags, flags, BMT_NO_FLAGS);
701 static const true_false_string tfs_fc_fcels_cls_sdr = {
702 "Seq Delivery Requested",
703 "Out of Order Delivery Requested"
705 static const true_false_string tfs_fc_fcels_cls_nzctl = {
706 "Non-zero CS_CTL Tolerated",
707 "Non-zero CS_CTL Maybe Tolerated"
710 /* The next 3 routines decode only Class 2 & Class 3 relevant bits */
711 static void
712 dissect_clssvc_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint16_t flags, uint8_t opcode)
714 static int * const common_flags[] = {
715 &hf_fcels_cls_cns,
716 &hf_fcels_cls_prio,
717 NULL
720 static int * const pflags[] = {
721 &hf_fcels_cls_cns,
722 &hf_fcels_cls_sdr,
723 &hf_fcels_cls_prio,
724 &hf_fcels_cls_nzctl,
725 NULL
728 if ((opcode == FC_ELS_FLOGI) || (opcode == FC_ELS_FDISC)) {
729 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_clsflags,
730 ett_fcels_clsflags, pflags, flags, BMT_NO_FLAGS);
731 } else {
732 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_clsflags,
733 ett_fcels_clsflags, common_flags, flags, BMT_NO_FLAGS);
737 static const true_false_string tfs_fc_fcels_fcpflags_retry = {
738 "Retry Possible",
739 "Retry NOT possible"
741 static const true_false_string tfs_fc_fcels_fcpflags_ccomp = {
742 "Confirmed Comp",
743 "Comp NOT confirmed"
745 static const true_false_string tfs_fc_fcels_fcpflags_datao = {
746 "Data Overlay",
747 "NO data overlay"
749 static const true_false_string tfs_fc_fcels_fcpflags_initiator = {
750 "Initiator",
751 "NOT an initiator"
753 static const true_false_string tfs_fc_fcels_fcpflags_target = {
754 "Target",
755 "NOT a target"
757 static const true_false_string tfs_fc_fcels_fcpflags_rdxr = {
758 "Rd Xfer_Rdy Dis",
759 "NO rd xfer_rdy dis"
761 static const true_false_string tfs_fc_fcels_fcpflags_wrxr = {
762 "Wr Xfer_Rdy Dis",
763 "NO wr xfer_rdy dis"
766 static void
767 dissect_fcp_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint32_t flags, uint8_t isreq)
769 static int * const req_flags[] = {
770 &hf_fcels_fcpflags_trireq,
771 &hf_fcels_fcpflags_retry,
772 &hf_fcels_fcpflags_ccomp,
773 &hf_fcels_fcpflags_datao,
774 &hf_fcels_fcpflags_initiator,
775 &hf_fcels_fcpflags_target,
776 &hf_fcels_fcpflags_rdxr,
777 &hf_fcels_fcpflags_wrxr,
778 NULL
781 static int * const rep_flags[] = {
782 &hf_fcels_fcpflags_trirep,
783 &hf_fcels_fcpflags_retry,
784 &hf_fcels_fcpflags_ccomp,
785 &hf_fcels_fcpflags_datao,
786 &hf_fcels_fcpflags_initiator,
787 &hf_fcels_fcpflags_target,
788 &hf_fcels_fcpflags_rdxr,
789 &hf_fcels_fcpflags_wrxr,
790 NULL
793 if (isreq) {
794 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_fcpflags,
795 ett_fcels_fcpflags, req_flags, flags, BMT_NO_FALSE);
796 } else {
797 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_fcpflags,
798 ett_fcels_fcpflags, rep_flags, flags, BMT_NO_FALSE);
803 static void
804 dissect_speed_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint32_t flags, int port)
806 proto_item *item;
807 static int * const speed_flags[] = {
808 &hf_fcels_speedflags_1gb,
809 &hf_fcels_speedflags_2gb,
810 &hf_fcels_speedflags_4gb,
811 &hf_fcels_speedflags_10gb,
812 NULL
815 item = proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_speedflags,
816 ett_fcels_speedflags, speed_flags, flags, BMT_NO_FALSE|BMT_NO_TFS);
817 proto_item_set_text(item, "Port Speed Capabilities (Port %u): 0x%04x", port, flags);
820 static const true_false_string tfs_fc_fcels_tprloflags_gprlo = {
821 "Global PRLO",
822 "NO global prlo"
824 static const true_false_string tfs_fc_fcels_prliloflags_ipe = {
825 "Image Pair Estd",
826 "Image pair NOT estd"
828 static const true_false_string tfs_fc_fcels_prliloflags_eip = {
829 "Est Image Pair & Exchg Svc Param",
830 "Exchange Svc Param Only"
833 static void
834 dissect_prlilo_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int flags, uint8_t opcode)
836 static int * const tprlo_flags[] = {
837 &hf_fcels_tprloflags_opav,
838 &hf_fcels_tprloflags_rpav,
839 &hf_fcels_tprloflags_npv,
840 &hf_fcels_tprloflags_gprlo,
841 NULL
844 static int * const prli_flags[] = {
845 &hf_fcels_prliloflags_opav,
846 &hf_fcels_tprloflags_rpav,
847 &hf_fcels_prliloflags_ipe,
848 NULL
851 static int * const not_prli_flags[] = {
852 &hf_fcels_prliloflags_opav,
853 &hf_fcels_tprloflags_rpav,
854 &hf_fcels_prliloflags_eip,
855 NULL
858 if (opcode == FC_ELS_TPRLO) {
859 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_prliloflags,
860 ett_fcels_prliloflags, tprlo_flags, flags, BMT_NO_FALSE|BMT_NO_TFS);
862 } else { /* opcode != TPRLO */
863 if (opcode == FC_ELS_PRLI) {
864 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_prliloflags,
865 ett_fcels_prliloflags, prli_flags, flags, BMT_NO_FALSE);
866 } else {
867 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_prliloflags,
868 ett_fcels_prliloflags, not_prli_flags, flags, BMT_NO_FALSE);
873 static const value_string initial_pa_vals[] = {
874 { 0, "Initial P_A Not Supported" },
875 { 1, "Initial P_A Supported" },
876 { 3, "Initial P_A Required & Supported" },
877 { 0, NULL }
879 static const true_false_string tfs_fc_fcels_initctl_ackgaa = {
880 "ACK Generation Assistance Avail",
881 "NO ack generation assistance"
884 static void
885 dissect_initctl_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint16_t flags, uint8_t opcode)
887 static int * const plogi_flags[] = {
888 &hf_fcels_initctl_initial_pa,
889 &hf_fcels_initctl_ack0,
890 &hf_fcels_initctl_ackgaa,
891 &hf_fcels_initctl_sync,
892 NULL
895 static int * const not_plogi_flags[] = {
896 &hf_fcels_initctl_sync,
897 NULL
900 if ((opcode == FC_ELS_PLOGI) || (opcode == FC_ELS_PDISC)) {
901 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_initctl,
902 ett_fcels_initctl, plogi_flags, flags, BMT_NO_FALSE);
903 } else {
904 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_initctl,
905 ett_fcels_initctl, not_plogi_flags, flags, BMT_NO_FALSE);
910 static const value_string rcptctl_policy_vals[] = {
911 { 0, "Error Policy: Discard Policy only" },
912 { 1, "Error Policy: Reserved" },
913 { 2, "Error Policy: Both discard and process policies supported" },
914 { 3, "Error Policy: Reserved" },
915 { 0, NULL }
917 static const value_string rcptctl_category_vals[] = {
918 { 0, "1 Category/Seq" },
919 { 1, "2 Categories/Seq" },
920 { 3, "More than 2 Categories/Seq" },
921 { 0, NULL }
924 static void
925 dissect_rcptctl_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint16_t flags, uint8_t opcode)
927 static int * const plogi_flags[] = {
928 &hf_fcels_rcptctl_ack0,
929 &hf_fcels_rcptctl_interlock,
930 &hf_fcels_rcptctl_policy,
931 &hf_fcels_rcptctl_category,
932 &hf_fcels_rcptctl_sync,
933 NULL
936 static int * const not_plogi_flags[] = {
937 &hf_fcels_rcptctl_sync,
938 NULL
941 if ((opcode == FC_ELS_PLOGI) || (opcode == FC_ELS_PDISC)) {
942 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_rcptctl,
943 ett_fcels_rcptctl, plogi_flags, flags, BMT_NO_FALSE);
944 } else {
945 proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_fcels_rcptctl,
946 ett_fcels_rcptctl, not_plogi_flags, flags, BMT_NO_FALSE);
950 /* Maximum length of possible string from, construct_*_string
951 * 296 bytes, FIX possible buffer overflow */
952 #define FCELS_LOGI_MAXSTRINGLEN 512
954 static void
955 dissect_fcels_logi (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
956 proto_item *ti, uint8_t opcode)
958 /* Set up structures needed to add the protocol subtree and manage it */
959 int offset = 0,
960 svcvld = 0,
961 svcclass;
962 proto_tree *logi_tree, *cmnsvc_tree;
963 uint16_t flag;
965 if (tree) {
966 logi_tree = proto_item_add_subtree (ti, ett_fcels_logi);
967 proto_tree_add_item (logi_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
969 cmnsvc_tree = proto_tree_add_subtree(logi_tree, tvb, offset+4, 16, ett_fcels_logi_cmnsvc, NULL, "Common Svc Parameters");
970 proto_tree_add_item (cmnsvc_tree, hf_fcels_b2b, tvb, offset+6, 2, ENC_BIG_ENDIAN);
971 flag = tvb_get_ntohs (tvb, offset+8);
973 if (flag & 0x0001) {
974 svcvld = 1;
977 dissect_cmnsvc (cmnsvc_tree, tvb, offset+8, flag, opcode);
979 proto_tree_add_item (cmnsvc_tree, hf_fcels_bbscnum, tvb, offset+10, 1, ENC_BIG_ENDIAN);
980 proto_tree_add_item (cmnsvc_tree, hf_fcels_rcvsize, tvb, offset+10, 2, ENC_BIG_ENDIAN);
981 proto_tree_add_item (cmnsvc_tree, hf_fcels_maxconseq, tvb, offset+12, 2, ENC_BIG_ENDIAN);
982 proto_tree_add_item (cmnsvc_tree, hf_fcels_reloffset, tvb, offset+14, 2, ENC_BIG_ENDIAN);
983 proto_tree_add_item (cmnsvc_tree, hf_fcels_edtov, tvb, offset+16, 4, ENC_BIG_ENDIAN);
984 proto_tree_add_item (cmnsvc_tree, hf_fcels_npname, tvb, offset+20, 8, ENC_NA);
985 proto_tree_add_item (cmnsvc_tree, hf_fcels_fnname, tvb, offset+28, 8, ENC_NA);
987 /* Add subtree for class paramters */
988 offset = 36;
989 for (svcclass = 1; svcclass < 5; svcclass++) {
990 cmnsvc_tree = proto_tree_add_subtree_format(logi_tree, tvb, offset, 16,
991 ett_fcels_logi_cmnsvc, NULL, "Class %d Svc Parameters", svcclass);
993 flag = tvb_get_ntohs (tvb, offset);
994 dissect_clssvc_flags (cmnsvc_tree, tvb, offset, flag, opcode);
995 if (flag & 0x8000) {
996 flag = tvb_get_ntohs (tvb, offset+2);
997 dissect_initctl_flags (cmnsvc_tree, tvb, offset+2, flag, opcode);
999 flag = tvb_get_ntohs (tvb, offset+4);
1000 dissect_rcptctl_flags (cmnsvc_tree, tvb, offset+4, flag, opcode);
1002 proto_tree_add_item (cmnsvc_tree, hf_fcels_clsrcvsize, tvb,
1003 offset+6, 2, ENC_BIG_ENDIAN);
1004 proto_tree_add_item (cmnsvc_tree, hf_fcels_conseq, tvb,
1005 offset+8, 2, ENC_BIG_ENDIAN);
1006 proto_tree_add_item (cmnsvc_tree, hf_fcels_e2e, tvb,
1007 offset+10, 2, ENC_BIG_ENDIAN);
1008 proto_tree_add_item (cmnsvc_tree, hf_fcels_openseq, tvb,
1009 offset+12, 2, ENC_BIG_ENDIAN);
1011 offset += 16;
1013 proto_tree_add_item (logi_tree, hf_fcels_vendorvers, tvb, offset, 16, ENC_NA);
1014 if (svcvld) {
1015 proto_tree_add_item (logi_tree, hf_fcels_svcavail, tvb, offset+32, 8, ENC_NA);
1020 static void
1021 dissect_fcels_plogi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1022 uint8_t isreq _U_, proto_item *ti)
1024 dissect_fcels_logi (tvb, pinfo, tree, ti, FC_ELS_PLOGI);
1027 static void
1028 dissect_fcels_flogi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1029 uint8_t isreq _U_, proto_item *ti)
1031 dissect_fcels_logi (tvb, pinfo, tree, ti, FC_ELS_FLOGI);
1034 static void
1035 dissect_fcels_logout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1036 uint8_t isreq, proto_item *ti)
1038 /* Set up structures needed to add the protocol subtree and manage it */
1039 int offset = 5; /* bypass opcode+rsvd field */
1040 proto_tree *logo_tree;
1042 if (tree) {
1043 logo_tree = proto_item_add_subtree (ti, ett_fcels_logo);
1045 proto_tree_add_item (logo_tree, hf_fcels_opcode, tvb, offset-5, 1, ENC_BIG_ENDIAN);
1047 if (!isreq) {
1048 /* Accept has no payload */
1049 return;
1052 proto_tree_add_item (logo_tree, hf_fcels_nportid, tvb, offset, 3, ENC_NA);
1053 proto_tree_add_item (logo_tree, hf_fcels_npname, tvb, offset+3, 8, ENC_NA);
1057 static void
1058 dissect_fcels_abtx (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1059 uint8_t isreq, proto_item *ti)
1061 /* Set up structures needed to add the protocol subtree and manage it */
1062 int offset = 0;
1063 proto_tree *abtx_tree;
1065 if (tree) {
1066 abtx_tree = proto_item_add_subtree (ti, ett_fcels_abtx);
1068 proto_tree_add_item (abtx_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1070 if (!isreq) {
1071 return;
1074 proto_tree_add_item(abtx_tree, hf_fcels_recovery_qualifier_status, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1075 proto_tree_add_item (abtx_tree, hf_fcels_nportid, tvb, offset+5, 3, ENC_NA);
1076 proto_tree_add_item (abtx_tree, hf_fcels_oxid, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1077 proto_tree_add_item (abtx_tree, hf_fcels_rxid, tvb, offset+10, 2, ENC_BIG_ENDIAN);
1081 static void
1082 dissect_fcels_rsi (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1083 uint8_t isreq, proto_item *ti)
1085 /* Set up structures needed to add the protocol subtree and manage it */
1086 int offset = 4;
1087 proto_tree *rsi_tree;
1089 if (tree) {
1090 rsi_tree = proto_item_add_subtree (ti, ett_fcels_rsi);
1092 proto_tree_add_item (rsi_tree, hf_fcels_opcode, tvb, offset-4, 1, ENC_BIG_ENDIAN);
1093 if (!isreq)
1094 return;
1096 proto_tree_add_item (rsi_tree, hf_fcels_recovqual, tvb, offset, 1, ENC_BIG_ENDIAN);
1097 proto_tree_add_item (rsi_tree, hf_fcels_nportid, tvb, offset+1, 3, ENC_NA);
1098 proto_tree_add_item (rsi_tree, hf_fcels_rxid, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1099 proto_tree_add_item (rsi_tree, hf_fcels_oxid, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1103 static void
1104 dissect_fcels_rrq (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1105 uint8_t isreq, proto_item *ti)
1107 /* Set up structures needed to add the protocol subtree and manage it */
1108 int offset = 0;
1109 proto_tree *rrq_tree;
1111 if (tree) {
1112 rrq_tree = proto_item_add_subtree (ti, ett_fcels_rrq);
1114 proto_tree_add_item (rrq_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1115 if (!isreq)
1116 return;
1118 proto_tree_add_item (rrq_tree, hf_fcels_nportid, tvb, offset+5, 3, ENC_NA);
1119 proto_tree_add_item (rrq_tree, hf_fcels_oxid, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1120 proto_tree_add_item (rrq_tree, hf_fcels_rxid, tvb, offset+10, 2, ENC_BIG_ENDIAN);
1124 static void
1125 dissect_fcels_rec (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1126 uint8_t isreq, proto_item *ti)
1128 /* Set up structures needed to add the protocol subtree and manage it */
1129 int offset = 0;
1130 proto_tree *rec_tree;
1132 if (tree) {
1133 rec_tree = proto_item_add_subtree (ti, ett_fcels_rec);
1135 proto_tree_add_item (rec_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1137 if (isreq) {
1138 proto_tree_add_item (rec_tree, hf_fcels_nportid, tvb,
1139 offset+5, 3, ENC_NA);
1140 proto_tree_add_item (rec_tree, hf_fcels_oxid, tvb,
1141 offset+8, 2, ENC_BIG_ENDIAN);
1142 proto_tree_add_item (rec_tree, hf_fcels_rxid, tvb,
1143 offset+10, 2, ENC_BIG_ENDIAN);
1144 } else {
1145 proto_tree_add_item (rec_tree, hf_fcels_oxid, tvb,
1146 offset+4, 2, ENC_BIG_ENDIAN);
1147 proto_tree_add_item (rec_tree, hf_fcels_rxid, tvb,
1148 offset+6, 2, ENC_BIG_ENDIAN);
1149 proto_tree_add_item (rec_tree, hf_fcels_nportid, tvb,
1150 offset+9, 3, ENC_NA);
1151 proto_tree_add_item (rec_tree, hf_fcels_resportid, tvb,
1152 offset+13, 3, ENC_NA);
1153 proto_tree_add_item (rec_tree, hf_fcels_rec_fc4, tvb,
1154 offset+16, 4, ENC_BIG_ENDIAN);
1155 proto_tree_add_bitmask (rec_tree, tvb, offset+20, hf_fcels_estat,
1156 ett_fcels_estat, hf_fcels_estat_fields,
1157 ENC_BIG_ENDIAN);
1162 static void
1163 dissect_fcels_pdisc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1164 uint8_t isreq _U_, proto_item *ti)
1166 dissect_fcels_logi (tvb, pinfo, tree, ti, FC_ELS_PDISC);
1169 static void
1170 dissect_fcels_fdisc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1171 uint8_t isreq _U_, proto_item *ti)
1173 dissect_fcels_logi (tvb, pinfo, tree, ti, FC_ELS_FDISC);
1176 static void
1177 dissect_fcels_adisc (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1178 uint8_t isreq _U_, proto_item *ti)
1180 /* Set up structures needed to add the protocol subtree and manage it */
1181 int offset = 5;
1182 proto_tree *adisc_tree;
1184 if (tree) {
1185 adisc_tree = proto_item_add_subtree (ti, ett_fcels_adisc);
1187 proto_tree_add_item (adisc_tree, hf_fcels_opcode, tvb, offset-5, 1, ENC_BIG_ENDIAN);
1189 proto_tree_add_item (adisc_tree, hf_fcels_hardaddr, tvb, offset, 3, ENC_NA);
1190 proto_tree_add_item (adisc_tree, hf_fcels_npname, tvb, offset+3, 8, ENC_NA);
1191 proto_tree_add_item (adisc_tree, hf_fcels_fnname, tvb, offset+11, 8, ENC_NA);
1192 proto_tree_add_item (adisc_tree, hf_fcels_nportid, tvb, offset+20, 3, ENC_NA);
1197 static void
1198 dissect_fcels_farp (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1199 proto_item *ti)
1201 int offset = 4;
1202 proto_tree *farp_tree;
1204 if (tree) {
1205 farp_tree = proto_item_add_subtree (ti, ett_fcels_farp);
1207 proto_tree_add_item (farp_tree, hf_fcels_opcode, tvb, offset-4, 1, ENC_BIG_ENDIAN);
1209 proto_tree_add_item (farp_tree, hf_fcels_farp_matchcodept,
1210 tvb, offset, 1, ENC_BIG_ENDIAN);
1211 proto_tree_add_item (farp_tree, hf_fcels_nportid, tvb, offset+1,
1212 3, ENC_NA);
1213 proto_tree_add_item (farp_tree, hf_fcels_farp_respaction, tvb,
1214 offset+4, 1, ENC_BIG_ENDIAN);
1215 proto_tree_add_item (farp_tree, hf_fcels_resportid, tvb, offset+5,
1216 3, ENC_NA);
1217 proto_tree_add_item (farp_tree, hf_fcels_npname, tvb, offset+8, 8, ENC_NA);
1218 proto_tree_add_item (farp_tree, hf_fcels_fnname, tvb, offset+16, 8, ENC_NA);
1219 proto_tree_add_item (farp_tree, hf_fcels_respname, tvb, offset+24,
1220 8, ENC_NA);
1221 proto_tree_add_item (farp_tree, hf_fcels_respnname, tvb, offset+32,
1222 8, ENC_NA);
1223 proto_tree_add_item (farp_tree, hf_fcels_reqipaddr, tvb, offset+40,
1224 16, ENC_NA);
1225 proto_tree_add_item (farp_tree, hf_fcels_respipaddr, tvb, offset+56,
1226 16, ENC_NA);
1230 static void
1231 dissect_fcels_farp_req (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1232 uint8_t isreq _U_, proto_item *ti)
1234 dissect_fcels_farp (tvb, pinfo, tree, ti);
1237 static void
1238 dissect_fcels_farp_rply (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1239 uint8_t isreq _U_, proto_item *ti)
1241 dissect_fcels_farp (tvb, pinfo, tree, ti);
1244 static void
1245 dissect_fcels_rps (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1246 uint8_t isreq, proto_item *ti)
1248 /* Set up structures needed to add the protocol subtree and manage it */
1249 int offset = 3;
1250 uint8_t flag;
1251 proto_tree *rps_tree;
1253 flag = tvb_get_uint8 (tvb, offset);
1255 if (tree) {
1256 rps_tree = proto_item_add_subtree (ti, ett_fcels_rps);
1258 if (isreq) {
1259 proto_tree_add_item (rps_tree, hf_fcels_rps_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1261 proto_tree_add_item (rps_tree, hf_fcels_opcode, tvb, offset-3, 1, ENC_BIG_ENDIAN);
1263 if (flag & 0x2) {
1264 proto_tree_add_item (rps_tree, hf_fcels_npname, tvb, offset+1, 8, ENC_NA);
1266 else if (flag & 0x1) {
1267 proto_tree_add_item (rps_tree, hf_fcels_rps_portnum, tvb,
1268 offset+5, 3, ENC_BIG_ENDIAN);
1271 else {
1272 proto_tree_add_item (rps_tree, hf_fcels_rps_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1273 proto_tree_add_item (rps_tree, hf_fcels_rps_portstatus, tvb,
1274 offset+3, 2, ENC_BIG_ENDIAN);
1275 /* Next 6 fields are from Link Error Status Block (LESB) */
1276 proto_tree_add_item(rps_tree, hf_fcels_link_failure_count, tvb, offset+5, 4, ENC_BIG_ENDIAN);
1277 proto_tree_add_item(rps_tree, hf_fcels_loss_of_sync_count, tvb, offset+9, 4, ENC_BIG_ENDIAN);
1278 proto_tree_add_item(rps_tree, hf_fcels_loss_of_signal_count, tvb, offset+13, 4, ENC_BIG_ENDIAN);
1279 proto_tree_add_item(rps_tree, hf_fcels_primitive_seq_protocol_err, tvb, offset+17, 4, ENC_BIG_ENDIAN);
1280 proto_tree_add_item(rps_tree, hf_fcels_invalid_xmission_word, tvb, offset+21, 4, ENC_BIG_ENDIAN);
1281 proto_tree_add_item(rps_tree, hf_fcels_invalid_crc_count, tvb, offset+25, 4, ENC_BIG_ENDIAN);
1282 if (flag & 0x01) {
1283 /* Next 6 fields are from L_Port Extension field */
1284 proto_tree_add_item(rps_tree, hf_fcels_l_port_status, tvb, offset+31, 2, ENC_BIG_ENDIAN);
1285 proto_tree_add_item(rps_tree, hf_fcels_lip_al_ps, tvb, offset+36, 1, ENC_BIG_ENDIAN);
1286 proto_tree_add_item(rps_tree, hf_fcels_lip_f7_initiated_count, tvb, offset+37, 4, ENC_BIG_ENDIAN);
1287 proto_tree_add_item(rps_tree, hf_fcels_lip_f7_received_count, tvb, offset+41, 4, ENC_BIG_ENDIAN);
1288 proto_tree_add_item(rps_tree, hf_fcels_lip_f8_initiated_count, tvb, offset+45, 4, ENC_BIG_ENDIAN);
1289 proto_tree_add_item(rps_tree, hf_fcels_lip_f8_received_count, tvb, offset+49, 4, ENC_BIG_ENDIAN);
1290 proto_tree_add_item(rps_tree, hf_fcels_lip_reset_initiated_count, tvb, offset+53, 4, ENC_BIG_ENDIAN);
1291 proto_tree_add_item(rps_tree, hf_fcels_lip_reset_received_count, tvb, offset+57, 4, ENC_BIG_ENDIAN);
1297 static void
1298 dissect_fcels_rpl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1299 uint8_t isreq, proto_item *ti)
1301 /* Set up structures needed to add the protocol subtree and manage it */
1302 int offset = 0;
1303 proto_tree *rpl_tree, *pb_tree;
1304 int loop;
1306 if (tree) {
1307 rpl_tree = proto_item_add_subtree (ti, ett_fcels_rpl);
1309 proto_tree_add_item (rpl_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1311 if (isreq) {
1312 proto_tree_add_item(rpl_tree, hf_fcels_rpl_max_size, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1313 proto_tree_add_item(rpl_tree, hf_fcels_rpl_index, tvb, offset+9, 3, ENC_BIG_ENDIAN);
1315 else {
1316 /* Reply consists of a header and a number of port blocks */
1317 proto_tree_add_item(rpl_tree, hf_fcels_rpl_payload_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1318 proto_tree_add_item(rpl_tree, hf_fcels_rpl_list_length, tvb, offset+5, 3, ENC_BIG_ENDIAN);
1319 proto_tree_add_item(rpl_tree, hf_fcels_rpl_index_of_i_port_block, tvb, offset+9, 3, ENC_BIG_ENDIAN);
1320 offset = 12;
1321 /* The following loop is for dissecting the port blocks */
1322 for (loop = tvb_get_ntoh24 (tvb, 5); loop > 0; loop--) {
1323 pb_tree = proto_tree_add_subtree_format(rpl_tree, tvb, offset+12, 16,
1324 ett_fcels_rplpb, NULL, "Port Block %u", loop);
1326 proto_tree_add_item(pb_tree, hf_fcels_rpl_physical_port, tvb, offset, 4, ENC_BIG_ENDIAN);
1327 proto_tree_add_item(pb_tree, hf_fcels_rpl_port_identifier, tvb, offset+5, 3, ENC_NA);
1328 proto_tree_add_item(pb_tree, hf_fcels_rpl_port_name, tvb, offset+8, 8, ENC_NA);
1329 offset += 16;
1335 static void
1336 dissect_fcels_fan (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1337 uint8_t isreq _U_, proto_item *ti)
1339 /* Set up structures needed to add the protocol subtree and manage it */
1340 int offset = 5;
1341 proto_tree *fan_tree;
1343 if (tree) {
1344 fan_tree = proto_item_add_subtree (ti, ett_fcels_fan);
1346 proto_tree_add_item (fan_tree, hf_fcels_opcode, tvb, offset-5, 1, ENC_BIG_ENDIAN);
1348 proto_tree_add_item (fan_tree, hf_fcels_fabricaddr, tvb, offset, 3, ENC_NA);
1349 proto_tree_add_item (fan_tree, hf_fcels_fabricpname, tvb, offset+3,
1350 8, ENC_NA);
1351 proto_tree_add_item (fan_tree, hf_fcels_fnname, tvb, offset+11, 8, ENC_NA);
1355 static void
1356 dissect_fcels_rscn (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1357 uint8_t isreq, proto_item *ti)
1359 /* Set up structures needed to add the protocol subtree and manage it */
1360 int offset = 1;
1361 proto_tree *rscn_tree, *rectree;
1362 int numrec, plen, i;
1364 if (tree) {
1365 rscn_tree = proto_item_add_subtree (ti, ett_fcels_rscn);
1367 proto_tree_add_item (rscn_tree, hf_fcels_opcode, tvb, offset-1, 1, ENC_BIG_ENDIAN);
1368 if (!isreq)
1369 return;
1371 proto_tree_add_item(rscn_tree, hf_fcels_rscn_page_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1372 plen = tvb_get_ntohs (tvb, offset+1);
1373 proto_tree_add_item(rscn_tree, hf_fcels_rscn_payload_len, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1374 numrec = (plen - 4)/4;
1376 offset = 4;
1377 for (i = 0; i < numrec; i++) {
1378 rectree = proto_tree_add_subtree_format(rscn_tree, tvb, offset, 4,
1379 ett_fcels_rscn_rec, NULL, "Affected N_Port Page %u", i);
1381 proto_tree_add_item (rectree, hf_fcels_rscn_evqual, tvb, offset,
1382 1, ENC_BIG_ENDIAN);
1383 proto_tree_add_item (rectree, hf_fcels_rscn_addrfmt, tvb, offset,
1384 1, ENC_BIG_ENDIAN);
1385 proto_tree_add_item (rectree, hf_fcels_rscn_domain, tvb, offset+1,
1386 1, ENC_BIG_ENDIAN);
1387 proto_tree_add_item (rectree, hf_fcels_rscn_area, tvb, offset+2,
1388 1, ENC_BIG_ENDIAN);
1389 proto_tree_add_item (rectree, hf_fcels_rscn_port, tvb, offset+3,
1390 1, ENC_BIG_ENDIAN);
1391 offset += 4;
1396 static void
1397 dissect_fcels_scr (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1398 uint8_t isreq, proto_item *ti)
1400 /* Set up structures needed to add the protocol subtree and manage it */
1401 int offset = 7;
1402 proto_tree *scr_tree;
1404 if (tree) {
1405 scr_tree = proto_item_add_subtree (ti, ett_fcels_scr);
1406 proto_tree_add_item (scr_tree, hf_fcels_opcode, tvb, offset-7, 1, ENC_BIG_ENDIAN);
1407 if (isreq)
1408 proto_tree_add_item (scr_tree, hf_fcels_scrregn, tvb, offset, 1, ENC_BIG_ENDIAN);
1412 static void
1413 dissect_fcels_rnft (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1414 uint8_t isreq, proto_item *ti)
1416 int offset = 0;
1417 uint16_t numrec, i;
1418 proto_tree *rnft_tree, *fc4_tree;
1420 if (tree) {
1421 rnft_tree = proto_item_add_subtree (ti, ett_fcels_rnft);
1423 proto_tree_add_item (rnft_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1425 if (isreq) {
1426 proto_tree_add_item(rnft_tree, hf_fcels_rnft_max_size, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1427 proto_tree_add_item(rnft_tree, hf_fcels_rnft_index, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1429 else {
1430 proto_tree_add_item(rnft_tree, hf_fcels_rnft_payload_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1431 numrec = tvb_get_uint8 (tvb, offset+5);
1432 proto_tree_add_item(rnft_tree, hf_fcels_rnft_list_length, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1433 proto_tree_add_item(rnft_tree, hf_fcels_rnft_index_of_first_rec_in_list, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1434 offset = 8;
1435 for (i = 0; i < numrec; i++) {
1436 fc4_tree = proto_tree_add_subtree_format(rnft_tree, tvb, offset, 4,
1437 ett_fcels_rnft_fc4, NULL, "FC-4 Entry #%u", i);
1439 proto_tree_add_item (fc4_tree, hf_fcels_rnft_fc4type, tvb,
1440 offset, 1, ENC_BIG_ENDIAN);
1441 proto_tree_add_item(fc4_tree, hf_fcels_rnft_fc4_qualifier, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1442 offset += 4;
1448 static void
1449 dissect_fcels_lsts (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1450 uint8_t isreq, proto_item *ti)
1452 /* Set up structures needed to add the protocol subtree and manage it */
1453 int offset = 5;
1454 proto_tree *lsts_tree;
1456 if (tree) {
1457 lsts_tree = proto_item_add_subtree (ti, ett_fcels_lsts);
1459 proto_tree_add_item (lsts_tree, hf_fcels_opcode, tvb, offset-5, 1, ENC_BIG_ENDIAN);
1460 if (isreq) {
1461 /* In case of LSTS, the reply has the meat */
1462 return;
1464 proto_tree_add_item (lsts_tree, hf_fcels_failedrcvr, tvb, offset, 1, ENC_BIG_ENDIAN);
1465 proto_tree_add_item (lsts_tree, hf_fcels_flacompliance, tvb, offset+1,
1466 1, ENC_BIG_ENDIAN);
1467 proto_tree_add_item (lsts_tree, hf_fcels_loopstate, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1468 proto_tree_add_item (lsts_tree, hf_fcels_publicloop_bmap, tvb, offset+3,
1469 16, ENC_NA);
1470 proto_tree_add_item (lsts_tree, hf_fcels_pvtloop_bmap, tvb, offset+19,
1471 16, ENC_NA);
1472 proto_tree_add_item (lsts_tree, hf_fcels_alpa_map, tvb, offset+35,
1473 128, ENC_NA);
1477 /* Maximum length of possible string from, dissect_fcels_prlilo_payload
1478 * 119 bytes, FIX possible buffer overflow */
1479 #define FCELS_PRLILO_MAXSTRINGLEN 256
1481 static void
1482 dissect_fcels_prlilo_payload (tvbuff_t *tvb, packet_info *pinfo _U_,
1483 uint8_t isreq, proto_item *ti, uint8_t opcode)
1485 int offset = 0;
1486 uint8_t type;
1487 proto_tree *prli_tree, *svcpg_tree;
1488 int num_svcpg, payload_len, i, flag;
1490 /* We're assuming that we're invoked only if tree is not NULL i.e.
1491 * we don't do the usual "if (tree)" check here, the caller must.
1493 prli_tree = proto_item_add_subtree (ti, ett_fcels_prli);
1495 proto_tree_add_item (prli_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1497 proto_tree_add_item(prli_tree, hf_fcels_prlilo_page_length, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1498 payload_len = tvb_get_ntohs (tvb, offset+2);
1499 proto_tree_add_item(prli_tree, hf_fcels_prlilo_payload_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1500 num_svcpg = payload_len/16;
1502 offset = 4;
1503 for (i = 0; i < num_svcpg; i++) {
1504 svcpg_tree = proto_tree_add_subtree_format(prli_tree, tvb, offset, 16,
1505 ett_fcels_prli_svcpg, NULL, "Service Parameter Page %u", i);
1507 type = tvb_get_uint8 (tvb, offset);
1508 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1509 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_type_code_extension, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1511 flag = tvb_get_uint8 (tvb, offset+2);
1512 dissect_prlilo_flags (svcpg_tree, tvb, offset+2, flag, opcode);
1514 if (!isreq && (opcode != FC_ELS_TPRLO)) {
1515 /* This is valid only for ACC */
1516 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_response_code, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1518 if (opcode != FC_ELS_TPRLO) {
1519 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_originator_pa, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1521 else {
1522 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_3rd_party_originator_pa, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1524 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_responder_pa, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1526 if (type == FC_TYPE_SCSI) {
1527 flag = tvb_get_ntohs (tvb, offset+14);
1528 dissect_fcp_flags (svcpg_tree, tvb, offset+12, flag, isreq);
1530 else if ((opcode == FC_ELS_PRLI) && !isreq) {
1531 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_service_parameter_response, tvb, offset+12, 4, ENC_BIG_ENDIAN);
1533 else if (opcode == FC_ELS_TPRLO) {
1534 proto_tree_add_item(svcpg_tree, hf_fcels_prlilo_3rd_party_n_port_id, tvb, offset+13, 3, ENC_NA);
1539 static void
1540 dissect_fcels_prli (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1541 uint8_t isreq, proto_item *ti)
1543 if (tree) {
1544 dissect_fcels_prlilo_payload (tvb, pinfo, isreq, ti, FC_ELS_PRLI);
1548 static void
1549 dissect_fcels_prlo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1550 uint8_t isreq, proto_item *ti)
1552 /* Set up structures needed to add the protocol subtree and manage it */
1553 if (tree) {
1554 dissect_fcels_prlilo_payload (tvb, pinfo, isreq, ti, FC_ELS_PRLO);
1558 static void
1559 dissect_fcels_tprlo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1560 uint8_t isreq, proto_item *ti)
1562 /* Set up structures needed to add the protocol subtree and manage it */
1564 if (tree) {
1565 dissect_fcels_prlilo_payload (tvb, pinfo, isreq, ti, FC_ELS_TPRLO);
1569 static void
1570 dissect_fcels_lirr (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1571 uint8_t isreq _U_, proto_item *ti)
1573 /* Set up structures needed to add the protocol subtree and manage it */
1574 int offset = 4;
1575 proto_tree *lirr_tree;
1576 uint8_t lirr_fmt;
1578 if (tree) {
1579 lirr_tree = proto_item_add_subtree (ti, ett_fcels_lirr);
1581 proto_tree_add_item (lirr_tree, hf_fcels_opcode, tvb, offset-4, 1, ENC_BIG_ENDIAN);
1583 proto_tree_add_item(lirr_tree, hf_fcels_lirr_regn_function, tvb, offset, 1, ENC_BIG_ENDIAN);
1584 lirr_fmt = tvb_get_uint8 (tvb, offset+1);
1585 if (!lirr_fmt) {
1586 /* This scheme is resorted to because the value 0 has a string in
1587 * the value_string that is not what we want displayed here.
1589 proto_tree_add_uint_format_value(lirr_tree, hf_fcels_lirr_regn_format, tvb, offset, 1, 0, "Common Format");
1591 else {
1592 proto_tree_add_item(lirr_tree, hf_fcels_lirr_regn_format, tvb, offset, 1, ENC_BIG_ENDIAN);
1597 static const true_false_string tfs_srl_flag = { "Scan only specified FL Port", "Scan all loops in domain" };
1599 static void
1600 dissect_fcels_srl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1601 uint8_t isreq, proto_item *ti)
1603 /* Set up structures needed to add the protocol subtree and manage it */
1604 int offset = 4;
1605 proto_tree *srl_tree;
1607 if (tree) {
1608 srl_tree = proto_item_add_subtree (ti, ett_fcels_srl);
1610 proto_tree_add_item (srl_tree, hf_fcels_opcode, tvb, offset-4, 1, ENC_BIG_ENDIAN);
1611 if (!isreq)
1612 return;
1614 proto_tree_add_item(srl_tree, hf_fcels_srl_flag, tvb, offset, 1, ENC_NA);
1615 proto_tree_add_item(srl_tree, hf_fcels_srl_fl_port_addr, tvb, offset+1, 3, ENC_NA);
1619 static void
1620 dissect_fcels_rpsc (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1621 uint8_t isreq, proto_item *ti)
1623 /* Set up structures needed to add the protocol subtree and manage it */
1624 int offset = 2;
1625 int num_entries, i, cap;
1626 proto_tree *rpsc_tree;
1628 if (tree) {
1629 rpsc_tree = proto_item_add_subtree (ti, ett_fcels_rpsc);
1631 proto_tree_add_item (rpsc_tree, hf_fcels_opcode, tvb, offset-2, 1, ENC_BIG_ENDIAN);
1632 if (isreq)
1633 return;
1635 num_entries = tvb_get_ntohs (tvb, offset);
1636 proto_tree_add_item(rpsc_tree, hf_fcels_rpsc_number_of_entries, tvb, offset, 2, ENC_BIG_ENDIAN);
1637 offset = 4;
1638 for (i = 0; i < num_entries; i++, offset+=4) {
1639 cap = tvb_get_ntohs (tvb, offset);
1640 dissect_speed_flags (rpsc_tree, tvb, offset, cap, i);
1642 proto_tree_add_item(rpsc_tree, hf_fcels_rpsc_port_oper_speed, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1648 static void
1649 dissect_fcels_cbind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1650 proto_item *ti)
1652 int offset = 0;
1653 proto_tree *cbind_tree=NULL;
1655 if (tree) {
1656 cbind_tree = proto_item_add_subtree (ti, ett_fcels_cbind);
1658 proto_tree_add_item (cbind_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1660 col_set_str(pinfo->cinfo, COL_INFO, "CBIND ");
1662 proto_tree_add_item (cbind_tree, hf_fcels_cbind_liveness, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1663 proto_tree_add_item (cbind_tree, hf_fcels_cbind_addr_mode, tvb, offset+6, 1, ENC_BIG_ENDIAN);
1664 proto_tree_add_item (cbind_tree, hf_fcels_cbind_ifcp_version, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1665 proto_tree_add_item (cbind_tree, hf_fcels_cbind_userinfo, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1667 proto_tree_add_item (cbind_tree, hf_fcels_cbind_snpname, tvb, offset+12, 8, ENC_NA);
1668 proto_tree_add_item (cbind_tree, hf_fcels_cbind_dnpname, tvb, offset+20, 8, ENC_NA);
1670 switch(tvb_reported_length(tvb)){
1671 case 32: /* 28 byte Request + 4 bytes FC CRC */
1672 col_append_str (pinfo->cinfo, COL_INFO, "Request");
1673 break;
1674 case 40: /* 36 byte Response + 4 bytes FC CRC */
1675 col_append_str (pinfo->cinfo, COL_INFO, "Response");
1676 proto_tree_add_item (cbind_tree, hf_fcels_cbind_status, tvb, offset+30, 2, ENC_BIG_ENDIAN);
1677 proto_tree_add_item (cbind_tree, hf_fcels_chandle, tvb, offset+34, 2, ENC_BIG_ENDIAN);
1678 break;
1683 static void
1684 dissect_fcels_unbind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1685 proto_item *ti)
1687 int offset = 0;
1688 proto_tree *cbind_tree=NULL;
1690 if (tree) {
1691 cbind_tree = proto_item_add_subtree (ti, ett_fcels_cbind);
1693 proto_tree_add_item (cbind_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1695 col_set_str(pinfo->cinfo, COL_INFO, "UNBIND ");
1697 proto_tree_add_item (cbind_tree, hf_fcels_cbind_userinfo, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1698 proto_tree_add_item (cbind_tree, hf_fcels_chandle, tvb, offset+10, 2, ENC_BIG_ENDIAN);
1701 switch(tvb_reported_length(tvb)){
1702 case 24: /* 20 byte Request + 4 bytes FC CRC */
1703 col_append_str (pinfo->cinfo, COL_INFO, "Request");
1704 break;
1705 case 28: /* 24 byte Response + 4 bytes FC CRC */
1706 col_append_str (pinfo->cinfo, COL_INFO, "Response");
1707 proto_tree_add_item (cbind_tree, hf_fcels_unbind_status, tvb, offset+22, 2, ENC_BIG_ENDIAN);
1708 break;
1713 static void
1714 dissect_fcels_rnid (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1715 uint8_t isreq, proto_item *ti)
1717 /* Set up structures needed to add the protocol subtree and manage it */
1718 int offset = 0;
1719 int clen;
1720 proto_tree *rnid_tree;
1722 if (tree) {
1723 rnid_tree = proto_item_add_subtree (ti, ett_fcels_rnid);
1725 proto_tree_add_item (rnid_tree, hf_fcels_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1726 if (isreq) {
1727 proto_tree_add_item (rnid_tree, hf_fcels_nodeidfmt, tvb, offset+4,
1728 1, ENC_BIG_ENDIAN);
1730 else {
1731 /* We only decode responses to nodeid fmt DF */
1732 proto_tree_add_item (rnid_tree, hf_fcels_nodeidfmt, tvb, offset+4,
1733 1, ENC_BIG_ENDIAN);
1734 clen = tvb_get_uint8 (tvb, offset+5);
1735 proto_tree_add_item(rnid_tree, hf_fcels_common_identification_data_length, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1736 proto_tree_add_item (rnid_tree, hf_fcels_spidlen, tvb, offset+7,
1737 1, ENC_BIG_ENDIAN);
1738 if (clen) {
1739 proto_tree_add_item (rnid_tree, hf_fcels_npname, tvb,
1740 offset+8, 8, ENC_NA);
1741 proto_tree_add_item (rnid_tree, hf_fcels_fnname, tvb,
1742 offset+16, 8, ENC_NA);
1744 if (tvb_get_uint8 (tvb, offset+4) == 0xDF) {
1745 /* Decode the Specific Node ID Format as this is known */
1746 proto_tree_add_item (rnid_tree, hf_fcels_vendoruniq, tvb,
1747 offset+24, 16, ENC_NA);
1748 proto_tree_add_item (rnid_tree, hf_fcels_asstype, tvb,
1749 offset+40, 4, ENC_BIG_ENDIAN);
1750 proto_tree_add_item (rnid_tree, hf_fcels_physport, tvb,
1751 offset+44, 4, ENC_BIG_ENDIAN);
1752 proto_tree_add_item (rnid_tree, hf_fcels_attnodes, tvb,
1753 offset+48, 4, ENC_BIG_ENDIAN);
1754 proto_tree_add_item (rnid_tree, hf_fcels_nodemgmt, tvb,
1755 offset+52, 1, ENC_BIG_ENDIAN);
1756 proto_tree_add_item (rnid_tree, hf_fcels_ipvers, tvb,
1757 offset+53, 1, ENC_BIG_ENDIAN);
1758 proto_tree_add_item (rnid_tree, hf_fcels_tcpport, tvb,
1759 offset+54, 2, ENC_BIG_ENDIAN);
1760 proto_tree_add_item (rnid_tree, hf_fcels_ip, tvb, offset+56,
1761 16, ENC_NA);
1762 proto_tree_add_item (rnid_tree, hf_fcels_vendorsp, tvb,
1763 offset+74, 2, ENC_BIG_ENDIAN);
1769 static void
1770 dissect_fcels_rlir (tvbuff_t *tvb _U_, packet_info *pinfo _U_,
1771 proto_tree *tree, uint8_t isreq _U_,
1772 proto_item *ti _U_)
1774 /* Set up structures needed to add the protocol subtree and manage it */
1776 if (tree) {
1780 static void
1781 dissect_fcels_lsrjt (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1782 uint8_t isreq _U_, proto_item *ti)
1784 /* Set up structures needed to add the protocol subtree and manage it */
1785 int offset = 5;
1786 proto_tree *lsrjt_tree;
1788 if (tree) {
1789 lsrjt_tree = proto_item_add_subtree (ti, ett_fcels_lsrjt);
1791 proto_tree_add_item (lsrjt_tree, hf_fcels_opcode, tvb, offset-5, 1, ENC_BIG_ENDIAN);
1793 proto_tree_add_item (lsrjt_tree, hf_fcels_rjtcode, tvb, offset++, 1, ENC_BIG_ENDIAN);
1794 proto_tree_add_item (lsrjt_tree, hf_fcels_rjtdetcode, tvb, offset++, 1, ENC_BIG_ENDIAN);
1795 proto_tree_add_item (lsrjt_tree, hf_fcels_vnduniq, tvb, offset, 1, ENC_BIG_ENDIAN);
1799 static int
1800 dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1803 /* Set up structures needed to add the protocol subtree and manage it */
1804 proto_item *ti = NULL;
1805 proto_tree *acc_tree;
1806 uint8_t isreq = FC_ELS_REQ;
1807 int offset = 0;
1808 uint8_t opcode,
1809 failed_opcode = 0;
1810 conversation_t *conversation;
1811 fcels_conv_data_t *cdata;
1812 fcels_conv_key_t ckey, *req_key;
1813 unsigned find_options, new_options;
1814 address dstaddr;
1815 uint8_t addrdata[3];
1816 fc_hdr *fchdr;
1818 /* Reject the packet if data is NULL */
1819 if (data == NULL)
1820 return 0;
1821 fchdr = (fc_hdr *)data;
1823 /* Make entries in Protocol column and Info column on summary display */
1824 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC ELS");
1825 /* col_clear(pinfo->cinfo, COL_INFO); XXX: It seems to me that COL_INFO should be cleared here ?? */
1827 /* decoding of this is done by each individual opcode handler */
1828 opcode = tvb_get_uint8 (tvb, 0);
1830 if (tree) {
1831 ti = proto_tree_add_protocol_format (tree, proto_fcels, tvb, 0,
1832 -1, "FC ELS");
1835 /* Register conversation in case this is not a response */
1836 if ((opcode != FC_ELS_LSRJT) && (opcode != FC_ELS_ACC)) {
1837 if (opcode == FC_ELS_FLOGI) {
1838 const uint8_t *srcfc;
1840 /* Check that the source address is, in fact, an FC address */
1841 if (pinfo->src.type != AT_FC) {
1842 expert_add_info_format(pinfo, ti, &ei_fcels_src_unknown,
1843 "Unknown source address type: %u",
1844 pinfo->src.type);
1845 return 0;
1848 srcfc = (const uint8_t *)pinfo->src.data;
1849 if (srcfc[2]) {
1850 /* If it is a loop port, we'll need to remember the ALPA */
1851 find_options = NO_PORT_B;
1852 new_options = NO_PORT2;
1854 else {
1855 find_options = NO_PORT_B | NO_ADDR_B;
1856 new_options = NO_PORT2 | NO_ADDR2;
1859 else {
1860 find_options = NO_PORT_B;
1861 new_options = NO_PORT2;
1863 conversation = find_conversation (pinfo->num, &pinfo->dst, &pinfo->src,
1864 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1865 fchdr->rxid, find_options);
1867 if (!conversation) {
1868 conversation = conversation_new (pinfo->num, &pinfo->dst, &pinfo->src,
1869 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1870 fchdr->rxid, new_options);
1873 ckey.conv_idx = conversation->conv_index;
1875 cdata = (fcels_conv_data_t *)wmem_map_lookup (fcels_req_hash,
1876 &ckey);
1877 if (cdata) {
1878 /* Since we never free the memory used by an exchange, this maybe a
1879 * case of another request using the same exchange as a previous
1880 * req.
1882 cdata->opcode = opcode;
1884 else {
1885 req_key = wmem_new(wmem_file_scope(), fcels_conv_key_t);
1886 req_key->conv_idx = conversation->conv_index;
1888 cdata = wmem_new(wmem_file_scope(), fcels_conv_data_t);
1889 cdata->opcode = opcode;
1891 wmem_map_insert (fcels_req_hash, req_key, cdata);
1894 else {
1895 isreq = FC_ELS_RPLY;
1897 find_options = NO_PORT_B;
1898 conversation = find_conversation (pinfo->num, &pinfo->dst, &pinfo->src,
1899 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1900 fchdr->rxid, find_options);
1901 if (!conversation) {
1902 /* FLOGI has two ways to save state: without the src and using just
1903 * the port (ALPA) part of the address. Try both.
1905 const uint8_t *dstfc;
1907 /* Check that the source address is, in fact, an FC address */
1908 if (pinfo->dst.type != AT_FC) {
1909 expert_add_info_format(pinfo, ti, &ei_fcels_dst_unknown,
1910 "Unknown destination address type: %u",
1911 pinfo->dst.type);
1912 return 0;
1915 dstfc = (const uint8_t *)pinfo->dst.data;
1917 addrdata[0] = addrdata[1] = 0;
1918 addrdata[2] = dstfc[2];
1919 set_address (&dstaddr, AT_FC, 3, addrdata);
1920 conversation = find_conversation (pinfo->num, &dstaddr, &pinfo->src,
1921 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1922 fchdr->rxid, find_options);
1925 if (!conversation) {
1926 /* Finally check for FLOGI with both NO_PORT2 and NO_ADDR2 set */
1927 find_options = NO_ADDR_B | NO_PORT_B;
1928 conversation = find_conversation (pinfo->num, &pinfo->src, &pinfo->dst,
1929 conversation_pt_to_conversation_type(pinfo->ptype), fchdr->oxid,
1930 fchdr->rxid, find_options);
1931 if (!conversation) {
1932 if (tree && (opcode == FC_ELS_ACC)) {
1933 /* No record of what this accept is for. Can't decode */
1934 acc_tree = proto_item_add_subtree (ti, ett_fcels_acc);
1935 proto_tree_add_expert(acc_tree, pinfo, &ei_fcels_no_record_of_exchange, tvb, offset, -1);
1936 return 0;
1938 failed_opcode = 0;
1942 if (conversation) {
1943 ckey.conv_idx = conversation->conv_index;
1945 cdata = (fcels_conv_data_t *)wmem_map_lookup (fcels_req_hash, &ckey);
1947 if (cdata != NULL) {
1948 if ((find_options & NO_ADDR_B) && (cdata->opcode != FC_ELS_FLOGI)) {
1949 /* only FLOGI can have this special check */
1950 if (tree && (opcode == FC_ELS_ACC)) {
1951 /* No record of what this accept is for. Can't decode */
1952 acc_tree = proto_item_add_subtree (ti,
1953 ett_fcels_acc);
1954 proto_tree_add_expert(acc_tree, pinfo, &ei_fcels_no_record_of_exchange, tvb, offset, -1);
1955 return 0;
1958 if (opcode == FC_ELS_ACC)
1959 opcode = cdata->opcode;
1960 else
1961 failed_opcode = cdata->opcode;
1964 if (tree) {
1965 if ((cdata == NULL) && (opcode != FC_ELS_LSRJT)) {
1966 /* No record of what this accept is for. Can't decode */
1967 acc_tree = proto_item_add_subtree (ti, ett_fcels_acc);
1968 proto_tree_add_expert(acc_tree, pinfo, &ei_fcels_no_record_of_els_req, tvb, offset, -1);
1969 return 0;
1975 if (isreq == FC_ELS_REQ) {
1976 col_add_str (pinfo->cinfo, COL_INFO,
1977 val_to_str_ext (opcode, &fc_els_proto_val_ext, "0x%x"));
1979 else if (opcode == FC_ELS_LSRJT) {
1980 col_add_fstr (pinfo->cinfo, COL_INFO, "LS_RJT (%s)",
1981 val_to_str_ext (failed_opcode, &fc_els_proto_val_ext, "0x%x"));
1983 else {
1984 col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)",
1985 val_to_str_ext (opcode, &fc_els_proto_val_ext, "0x%x"));
1988 switch (opcode) {
1989 case FC_ELS_LSRJT:
1990 dissect_fcels_lsrjt (tvb, pinfo, tree, isreq, ti);
1991 break;
1992 case FC_ELS_PLOGI:
1993 dissect_fcels_plogi (tvb, pinfo, tree, isreq, ti);
1994 break;
1995 case FC_ELS_FLOGI:
1996 dissect_fcels_flogi (tvb, pinfo, tree, isreq, ti);
1997 break;
1998 case FC_ELS_LOGOUT:
1999 dissect_fcels_logout (tvb, pinfo, tree, isreq, ti);
2000 break;
2001 case FC_ELS_ABTX:
2002 dissect_fcels_abtx (tvb, pinfo, tree, isreq, ti);
2003 break;
2004 case FC_ELS_RSI:
2005 dissect_fcels_rsi (tvb, pinfo, tree, isreq, ti);
2006 break;
2007 case FC_ELS_RRQ:
2008 dissect_fcels_rrq (tvb, pinfo, tree, isreq, ti);
2009 break;
2010 case FC_ELS_REC:
2011 dissect_fcels_rec (tvb, pinfo, tree, isreq, ti);
2012 break;
2013 case FC_ELS_PRLI:
2014 dissect_fcels_prli (tvb, pinfo, tree, isreq, ti);
2015 break;
2016 case FC_ELS_PRLO:
2017 dissect_fcels_prlo (tvb, pinfo, tree, isreq, ti);
2018 break;
2019 case FC_ELS_TPRLO:
2020 dissect_fcels_tprlo (tvb, pinfo, tree, isreq, ti);
2021 break;
2022 case FC_ELS_PDISC:
2023 dissect_fcels_pdisc (tvb, pinfo, tree, isreq, ti);
2024 break;
2025 case FC_ELS_FDISC:
2026 dissect_fcels_fdisc (tvb, pinfo, tree, isreq, ti);
2027 break;
2028 case FC_ELS_ADISC:
2029 dissect_fcels_adisc (tvb, pinfo, tree, isreq, ti);
2030 break;
2031 case FC_ELS_FARP_REQ:
2032 dissect_fcels_farp_req (tvb, pinfo, tree, isreq, ti);
2033 break;
2034 case FC_ELS_FARP_RPLY:
2035 dissect_fcels_farp_rply (tvb, pinfo, tree, isreq, ti);
2036 break;
2037 case FC_ELS_RPS:
2038 dissect_fcels_rps (tvb, pinfo, tree, isreq, ti);
2039 break;
2040 case FC_ELS_RPL:
2041 dissect_fcels_rpl (tvb, pinfo, tree, isreq, ti);
2042 break;
2043 case FC_ELS_FAN:
2044 dissect_fcels_fan (tvb, pinfo, tree, isreq, ti);
2045 break;
2046 case FC_ELS_RSCN:
2047 dissect_fcels_rscn (tvb, pinfo, tree, isreq, ti);
2048 break;
2049 case FC_ELS_SCR:
2050 dissect_fcels_scr (tvb, pinfo, tree, isreq, ti);
2051 break;
2052 case FC_ELS_RNFT:
2053 dissect_fcels_rnft (tvb, pinfo, tree, isreq, ti);
2054 break;
2055 case FC_ELS_LSTS:
2056 dissect_fcels_lsts (tvb, pinfo, tree, isreq, ti);
2057 break;
2058 case FC_ELS_RNID:
2059 dissect_fcels_rnid (tvb, pinfo, tree, isreq, ti);
2060 break;
2061 case FC_ELS_RLIR:
2062 dissect_fcels_rlir (tvb, pinfo, tree, isreq, ti);
2063 break;
2064 case FC_ELS_LIRR:
2065 dissect_fcels_lirr (tvb, pinfo, tree, isreq, ti);
2066 break;
2067 case FC_ELS_SRL:
2068 dissect_fcels_srl (tvb, pinfo, tree, isreq, ti);
2069 break;
2070 case FC_ELS_RPSC:
2071 dissect_fcels_rpsc (tvb, pinfo, tree, isreq, ti);
2072 break;
2073 case FC_ELS_AUTH:
2074 if (isreq && fcsp_handle)
2075 call_dissector (fcsp_handle, tvb, pinfo, tree);
2076 break;
2077 case FC_ELS_CBIND:
2078 dissect_fcels_cbind (tvb, pinfo, tree, ti);
2079 break;
2080 case FC_ELS_UNBIND:
2081 dissect_fcels_unbind (tvb, pinfo, tree, ti);
2082 break;
2083 default:
2084 call_data_dissector(tvb, pinfo, tree);
2085 break;
2088 return tvb_reported_length(tvb);
2091 void
2092 proto_register_fcels (void)
2094 static hf_register_info hf[] = {
2095 { &hf_fcels_opcode,
2096 {"Cmd Code", "fcels.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
2097 &fc_els_proto_val_ext, 0x0, NULL, HFILL}},
2098 { &hf_fcels_rjtcode,
2099 {"Reason Code", "fcels.rjt.reason", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
2100 &fc_els_rjt_val_ext, 0x0, NULL, HFILL}},
2101 { &hf_fcels_rjtdetcode,
2102 {"Reason Explanation", "fcels.rjt.detail", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
2103 &fc_els_rjt_det_val_ext, 0x0, NULL, HFILL}},
2104 { &hf_fcels_vnduniq,
2105 {"Vendor Unique", "fcels.rjt.vnduniq", FT_UINT8, BASE_HEX, NULL,
2106 0x0, NULL, HFILL}},
2107 { &hf_fcels_b2b,
2108 {"B2B Credit", "fcels.logi.b2b", FT_UINT16, BASE_DEC, NULL, 0x0, NULL,
2109 HFILL}},
2110 { &hf_fcels_cmnfeatures,
2111 {"Common Svc Parameters", "fcels.logi.cmnfeatures", FT_UINT16, BASE_HEX, NULL,
2112 0x0, NULL, HFILL}},
2113 { &hf_fcels_bbscnum,
2114 {"BB_SC Number", "fcels.logi.bbscnum", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL,
2115 HFILL}},
2116 { &hf_fcels_rcvsize,
2117 {"Receive Size", "fcels.logi.rcvsize", FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL,
2118 HFILL}},
2119 { &hf_fcels_maxconseq,
2120 {"Max Concurrent Seq", "fcels.logi.maxconseq", FT_UINT16, BASE_DEC, NULL,
2121 0x0, NULL, HFILL}},
2122 { &hf_fcels_reloffset,
2123 {"Relative Offset By Info Cat", "fcels.logi.reloff", FT_UINT16, BASE_DEC,
2124 NULL, 0x0, NULL, HFILL}},
2125 { &hf_fcels_edtov,
2126 {"E_D_TOV", "fcels.edtov", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
2127 { &hf_fcels_npname,
2128 {"N_Port Port_Name", "fcels.npname", FT_FCWWN, BASE_NONE, NULL, 0x0,
2129 NULL, HFILL}},
2130 { &hf_fcels_fnname,
2131 {"Fabric/Node Name", "fcels.fnname", FT_FCWWN, BASE_NONE, NULL, 0x0,
2132 NULL, HFILL}},
2133 #if 0
2134 { &hf_fcels_cls1param,
2135 {"Class 1 Svc Param", "fcels.logi.cls1param", FT_BYTES, BASE_NONE, NULL, 0x0,
2136 NULL, HFILL}},
2137 { &hf_fcels_cls2param,
2138 {"Class 2 Svc Param", "fcels.logi.cls2param", FT_BYTES, BASE_NONE, NULL, 0x0,
2139 NULL, HFILL}},
2140 { &hf_fcels_cls3param,
2141 {"Class 3 Svc Param", "fcels.logi.cls3param", FT_BYTES, BASE_NONE, NULL, 0x0,
2142 NULL, HFILL}},
2143 { &hf_fcels_cls4param,
2144 {"Class 4 Svc Param", "fcels.logi.cls4param", FT_BYTES, BASE_NONE, NULL, 0x0,
2145 NULL, HFILL}},
2146 #endif
2147 { &hf_fcels_vendorvers,
2148 {"Vendor Version", "fcels.logi.vendvers", FT_BYTES, BASE_NONE, NULL, 0x0, NULL,
2149 HFILL}},
2150 { &hf_fcels_svcavail,
2151 {"Services Availability", "fcels.logi.svcavail", FT_BYTES, BASE_NONE, NULL,
2152 0x0, NULL, HFILL}},
2153 { &hf_fcels_clsflags,
2154 {"Service Options", "fcels.logi.clsflags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL,
2155 HFILL}},
2156 { &hf_fcels_clsrcvsize,
2157 {"Class Recv Size", "fcels.logi.clsrcvsize", FT_UINT16, BASE_DEC, NULL,
2158 0x0, NULL, HFILL}},
2159 { &hf_fcels_conseq,
2160 {"Total Concurrent Seq", "fcels.logi.totconseq", FT_UINT16, BASE_DEC, NULL,
2161 0x0, NULL, HFILL}},
2162 { &hf_fcels_e2e,
2163 {"End2End Credit", "fcels.logi.e2e", FT_UINT16, BASE_DEC, NULL, 0x0, NULL,
2164 HFILL}},
2165 { &hf_fcels_openseq,
2166 {"Open Seq Per Exchg", "fcels.logi.openseq", FT_UINT16, BASE_DEC, NULL, 0x0,
2167 NULL, HFILL}},
2168 { &hf_fcels_nportid,
2169 {"Originator S_ID", "fcels.portid", FT_BYTES, SEP_DOT, NULL, 0x0,
2170 NULL, HFILL}},
2171 { &hf_fcels_oxid,
2172 {"OXID", "fcels.oxid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2173 { &hf_fcels_rxid,
2174 {"RXID", "fcels.rxid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2175 { &hf_fcels_recovqual,
2176 {"Recovery Qualifier", "fcels.rcovqual", FT_UINT8, BASE_HEX, NULL,
2177 0x0, NULL, HFILL}},
2178 { &hf_fcels_fabricaddr,
2179 {"Fabric Address", "fcels.faddr", FT_BYTES, SEP_DOT, NULL, 0x0, NULL,
2180 HFILL}},
2181 { &hf_fcels_fabricpname,
2182 {"Fabric Port Name", "fcels.fpname", FT_FCWWN, BASE_NONE, NULL, 0x0,
2183 NULL, HFILL}},
2184 { &hf_fcels_failedrcvr,
2185 {"Failed Receiver AL_PA", "fcels.faildrcvr", FT_UINT8, BASE_HEX, NULL,
2186 0x0, NULL, HFILL}},
2187 { &hf_fcels_flacompliance,
2188 {"FC-FLA Compliance", "fcels.flacompliance", FT_UINT8, BASE_HEX,
2189 VALS (fc_els_flacompliance_val), 0x0, NULL, HFILL}},
2190 { &hf_fcels_loopstate,
2191 {"Loop State", "fcels.loopstate", FT_UINT8, BASE_HEX,
2192 VALS (fc_els_loopstate_val), 0x0, NULL, HFILL}},
2193 { &hf_fcels_publicloop_bmap,
2194 {"Public Loop Device Bitmap", "fcels.pubdev_bmap", FT_BYTES, BASE_NONE,
2195 NULL, 0x0, NULL, HFILL}},
2196 { &hf_fcels_pvtloop_bmap,
2197 {"Private Loop Device Bitmap", "fcels.pvtdev_bmap", FT_BYTES,
2198 BASE_NONE, NULL, 0x0, NULL, HFILL}},
2199 { &hf_fcels_alpa_map,
2200 {"AL_PA Map", "fcels.alpa", FT_BYTES, BASE_NONE, NULL, 0x0, NULL,
2201 HFILL}},
2202 { &hf_fcels_scrregn,
2203 {"Registration Function", "fcels.scr.regn", FT_UINT8, BASE_HEX,
2204 VALS (fc_els_scr_reg_val), 0x0, NULL, HFILL}},
2205 { &hf_fcels_farp_matchcodept,
2206 {"Match Address Code Points", "fcels.matchcp", FT_UINT8, BASE_DEC,
2207 NULL, 0x0, NULL, HFILL}},
2208 { &hf_fcels_farp_respaction,
2209 {"Responder Action", "fcels.respaction", FT_UINT8, BASE_HEX,
2210 VALS (fc_els_farp_respaction_val), 0x0, NULL, HFILL}},
2211 { &hf_fcels_resportid,
2212 {"Responding Port ID", "fcels.resportid", FT_BYTES, SEP_DOT,
2213 NULL, 0x0, NULL, HFILL}},
2214 { &hf_fcels_respname,
2215 {"Responding Port Name", "fcels.respname", FT_FCWWN, BASE_NONE,
2216 NULL, 0x0, NULL, HFILL}},
2217 { &hf_fcels_respnname,
2218 {"Responding Node Name", "fcels.respnname", FT_FCWWN, BASE_NONE,
2219 NULL, 0x0, NULL, HFILL}},
2220 { &hf_fcels_reqipaddr,
2221 {"Requesting IP Address", "fcels.reqipaddr", FT_IPv6, BASE_NONE,
2222 NULL, 0x0, NULL, HFILL}},
2223 { &hf_fcels_respipaddr,
2224 {"Responding IP Address", "fcels.respipaddr", FT_IPv6, BASE_NONE,
2225 NULL, 0x0, NULL, HFILL}},
2226 { &hf_fcels_hardaddr,
2227 {"Hard Address of Originator", "fcels.hrdaddr", FT_BYTES, SEP_DOT,
2228 NULL, 0x0, NULL, HFILL}},
2229 { &hf_fcels_rps_flag,
2230 {"Flag", "fcels.flag", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2231 { &hf_fcels_rps_portnum,
2232 {"Physical Port Number", "fcels.portnum", FT_UINT32, BASE_HEX, NULL,
2233 0x0, NULL, HFILL}},
2234 { &hf_fcels_rps_portstatus,
2235 {"Port Status", "fcels.portstatus", FT_UINT16, BASE_HEX | BASE_EXT_STRING,
2236 &fc_els_portstatus_val_ext, 0x0, NULL, HFILL}},
2237 { &hf_fcels_rnft_fc4type,
2238 {"FC-4 Type", "fcels.rnft.fc4type", FT_UINT8, BASE_HEX,
2239 VALS (fc_fc4_val), 0x0, NULL, HFILL}},
2240 { &hf_fcels_rscn_evqual,
2241 {"Event Qualifier", "fcels.rscn.evqual", FT_UINT8, BASE_HEX,
2242 VALS (fc_els_rscn_evqual_val), 0x3C, NULL, HFILL}},
2243 { &hf_fcels_rscn_addrfmt,
2244 {"Address Format", "fcels.rscn.addrfmt", FT_UINT8, BASE_HEX,
2245 VALS (fc_els_rscn_addrfmt_val), 0x03, NULL, HFILL}},
2246 { &hf_fcels_rscn_domain,
2247 {"Affected Domain", "fcels.rscn.domain", FT_UINT8, BASE_HEX,
2248 NULL, 0x0, NULL, HFILL}},
2249 { &hf_fcels_rscn_area,
2250 {"Affected Area", "fcels.rscn.area", FT_UINT8, BASE_HEX,
2251 NULL, 0x0, NULL, HFILL}},
2252 { &hf_fcels_rscn_port,
2253 {"Affected Port", "fcels.rscn.port", FT_UINT8, BASE_HEX,
2254 NULL, 0x0, NULL, HFILL}},
2255 { &hf_fcels_rec_fc4,
2256 {"FC4 value", "fcels.rec.fc4value", FT_UINT32, BASE_HEX,
2257 NULL, 0x0, NULL, HFILL}},
2258 { &hf_fcels_estat,
2259 {"Exchange Status", "fcels.estat", FT_UINT32, BASE_HEX,
2260 NULL, 0x0, NULL, HFILL}},
2261 { &hf_fcels_estat_resp,
2262 {"Sequence Responder", "fcels.estat.resp", FT_BOOLEAN, 32,
2263 TFS(&tfs_fcels_estat_resp),
2264 FC_ESB_ST_RESP, "Seq responder?", HFILL}},
2265 { &hf_fcels_estat_seq_init,
2266 {"Sequence Initiative", "fcels.estat.seq_init", FT_BOOLEAN, 32,
2267 TFS(&tfs_fcels_estat_seq_init),
2268 FC_ESB_ST_SEQ_INIT, "Responder has Sequence Initiative?", HFILL}},
2269 { &hf_fcels_estat_compl,
2270 {"Exchange Complete", "fcels.estat.complete", FT_BOOLEAN, 32,
2271 TFS(&tfs_complete_incomplete),
2272 FC_ESB_ST_COMPLETE, "Exchange complete?", HFILL}},
2273 { &hf_fcels_nodeidfmt,
2274 {"Node Identification Format", "fcels.rnid.nodeidfmt", FT_UINT8,
2275 BASE_HEX, VALS (fc_els_nodeid_val), 0x0, NULL, HFILL}},
2276 { &hf_fcels_spidlen,
2277 {"Specific Id Length", "fcels.rnid.spidlen", FT_UINT8, BASE_DEC, NULL,
2278 0x0, NULL, HFILL}},
2279 { &hf_fcels_vendoruniq,
2280 {"Vendor Unique", "fcels.rnid.vendoruniq", FT_BYTES, BASE_NONE, NULL,
2281 0x0, NULL, HFILL}},
2282 { &hf_fcels_vendorsp,
2283 {"Vendor Specific", "fcels.rnid.vendorsp", FT_UINT16, BASE_HEX, NULL,
2284 0x0, NULL, HFILL}},
2285 { &hf_fcels_asstype,
2286 {"Associated Type", "fcels.rnid.asstype", FT_UINT32, BASE_HEX | BASE_EXT_STRING,
2287 &fc_els_rnid_asstype_val_ext, 0x0, NULL, HFILL}},
2288 { &hf_fcels_physport,
2289 {"Physical Port Number", "fcels.rnid.physport", FT_UINT32, BASE_HEX,
2290 NULL, 0x0, NULL, HFILL}},
2291 { &hf_fcels_attnodes,
2292 {"Number of Attached Nodes", "fcels.rnid.attnodes", FT_UINT32,
2293 BASE_HEX, NULL, 0x0, NULL, HFILL}},
2294 { &hf_fcels_nodemgmt,
2295 {"Node Management", "fcels.rnid.nodemgmt", FT_UINT8, BASE_HEX,
2296 VALS (fc_els_rnid_mgmt_val), 0x0, NULL, HFILL}},
2297 { &hf_fcels_ipvers,
2298 {"IP Version", "fcels.rnid.ipvers", FT_UINT8, BASE_HEX,
2299 VALS (fc_els_rnid_ipvers_val), 0x0, NULL, HFILL}},
2300 { &hf_fcels_tcpport,
2301 {"TCP/UDP Port Number", "fcels.rnid.tcpport", FT_UINT16, BASE_DEC,
2302 NULL, 0x0, NULL, HFILL}},
2303 { &hf_fcels_ip,
2304 {"IP Address", "fcels.rnid.ip", FT_IPv6, BASE_NONE, NULL, 0x0, NULL,
2305 HFILL}},
2306 { &hf_fcels_cbind_liveness,
2307 {"Liveness Test Interval", "fcels.cbind.liveness", FT_UINT16, BASE_DEC,
2308 NULL, 0x0, "Liveness Test Interval in seconds", HFILL}},
2309 { &hf_fcels_cbind_addr_mode,
2310 {"Addressing Mode", "fcels.cbind.addr_mode", FT_UINT8, BASE_HEX,
2311 VALS (cbind_addr_mode_vals), 0x0, NULL, HFILL}},
2312 { &hf_fcels_cbind_ifcp_version,
2313 {"iFCP version", "fcels.cbind.ifcp_version", FT_UINT8, BASE_DEC,
2314 NULL, 0x0, "Version of iFCP protocol", HFILL}},
2315 { &hf_fcels_cbind_userinfo,
2316 {"UserInfo", "fcels.cbind.userinfo", FT_UINT32, BASE_HEX,
2317 NULL, 0x0, "Userinfo token", HFILL}},
2318 { &hf_fcels_cbind_snpname,
2319 {"Source N_Port Port_Name", "fcels.cbind.snpname", FT_FCWWN, BASE_NONE, NULL, 0x0,
2320 NULL, HFILL}},
2321 { &hf_fcels_cbind_dnpname,
2322 {"Destination N_Port Port_Name", "fcels.cbind.dnpname", FT_FCWWN, BASE_NONE, NULL, 0x0,
2323 NULL, HFILL}},
2324 { &hf_fcels_cbind_status,
2325 {"Status", "fcels.cbind.status", FT_UINT16, BASE_DEC,
2326 VALS (cbind_status_vals), 0x0, "Cbind status", HFILL}},
2327 { &hf_fcels_chandle,
2328 {"Connection Handle", "fcels.cbind.handle", FT_UINT16, BASE_HEX,
2329 NULL, 0x0, "Cbind/Unbind connection handle", HFILL}},
2330 { &hf_fcels_unbind_status,
2331 {"Status", "fcels.unbind.status", FT_UINT16, BASE_DEC,
2332 VALS (unbind_status_vals), 0x0, "Unbind status", HFILL}},
2333 { &hf_fcels_cmn_cios,
2334 {"Cont. Incr. Offset Supported", "fcels.cmn.cios", FT_BOOLEAN, 16,
2335 TFS(&tfs_supported_not_supported), 0x8000, NULL, HFILL}},
2336 { &hf_fcels_cmn_rro,
2337 {"RRO Supported", "fcels.cmn.rro", FT_BOOLEAN, 16,
2338 TFS(&tfs_supported_not_supported), 0x4000, NULL, HFILL}},
2339 { &hf_fcels_cmn_vvv,
2340 {"Valid Vendor Version", "fcels.cmn.vvv", FT_BOOLEAN, 16,
2341 TFS(&tfs_valid_invalid), 0x2000, NULL, HFILL}},
2342 { &hf_fcels_cmn_b2b,
2343 {"B2B Credit Mgmt", "fcels.cmn.bbb", FT_BOOLEAN, 16,
2344 TFS(&tfs_fc_fcels_cmn_b2b), 0x0800, NULL, HFILL}},
2345 { &hf_fcels_cmn_e_d_tov,
2346 {"E_D_TOV", "fcels.cmn.e_d_tov", FT_BOOLEAN, 16,
2347 TFS(&tfs_fc_fcels_cmn_e_d_tov), 0x0400, NULL, HFILL}},
2348 { &hf_fcels_cmn_simplex,
2349 {"Simplex", "fcels.cmn.simplex", FT_BOOLEAN, 16,
2350 TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL}},
2351 { &hf_fcels_cmn_multicast,
2352 {"Multicast", "fcels.cmn.multicast", FT_BOOLEAN, 16,
2353 TFS(&tfs_supported_not_supported), 0x0200, NULL, HFILL}},
2354 { &hf_fcels_cmn_broadcast,
2355 {"Broadcast", "fcels.cmn.broadcast", FT_BOOLEAN, 16,
2356 TFS(&tfs_supported_not_supported), 0x0100, NULL, HFILL}},
2357 { &hf_fcels_cmn_security,
2358 {"Security", "fcels.cmn.security", FT_BOOLEAN, 16,
2359 TFS(&tfs_set_notset), 0x0020, NULL, HFILL}},
2360 { &hf_fcels_cmn_clk,
2361 {"Clk Sync", "fcels.cmn.clk", FT_BOOLEAN, 16,
2362 TFS(&tfs_capable_not_capable), 0x0010, NULL, HFILL}},
2363 { &hf_fcels_cmn_dhd,
2364 {"DHD Capable", "fcels.cmn.dhd", FT_BOOLEAN, 16,
2365 TFS(&tfs_capable_not_capable), 0x0004, NULL, HFILL}},
2366 { &hf_fcels_cmn_seqcnt,
2367 {"SEQCNT", "fcels.cmn.seqcnt", FT_BOOLEAN, 16,
2368 TFS(&tfs_fc_fcels_cmn_seqcnt), 0x0002, NULL, HFILL}},
2369 { &hf_fcels_cmn_payload,
2370 {"Payload Len", "fcels.cmn.payload", FT_BOOLEAN, 16,
2371 TFS(&tfs_fc_fcels_cmn_payload), 0x0001, NULL, HFILL}},
2372 { &hf_fcels_cls_cns,
2373 {"Class Supported", "fcels.cls.cns", FT_BOOLEAN, 16,
2374 TFS(&tfs_supported_not_supported), 0x8000, NULL, HFILL}},
2375 { &hf_fcels_cls_sdr,
2376 {"Delivery Mode", "fcels.cls.sdr", FT_BOOLEAN, 16,
2377 TFS(&tfs_fc_fcels_cls_sdr), 0x0800, NULL, HFILL}},
2378 { &hf_fcels_cls_prio,
2379 {"Priority", "fcels.cls.prio", FT_BOOLEAN, 16,
2380 TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL}},
2381 { &hf_fcels_cls_nzctl,
2382 {"Non-zero CS_CTL", "fcels.cls.nzctl", FT_BOOLEAN, 16,
2383 TFS(&tfs_fc_fcels_cls_nzctl), 0x0040, NULL, HFILL}},
2384 { &hf_fcels_initctl,
2385 {"Initiator Ctl", "fcels.logi.initctl", FT_UINT16, BASE_HEX,
2386 NULL, 0x0, NULL, HFILL}},
2387 { &hf_fcels_initctl_initial_pa,
2388 {"Initial P_A", "fcels.logi.initctl.initial_pa", FT_UINT16, BASE_HEX,
2389 VALS (initial_pa_vals), 0x3000, NULL, HFILL}},
2390 { &hf_fcels_initctl_ack0,
2391 {"ACK0 Capable", "fcels.logi.initctl.ack0", FT_BOOLEAN, 16,
2392 TFS(&tfs_capable_not_capable), 0x0800, NULL, HFILL}},
2393 { &hf_fcels_initctl_ackgaa,
2394 {"ACK GAA", "fcels.logi.initctl.ackgaa", FT_BOOLEAN, 16,
2395 TFS(&tfs_fc_fcels_initctl_ackgaa), 0x0200, NULL, HFILL}},
2396 { &hf_fcels_initctl_sync,
2397 {"Clock Sync", "fcels.logi.initctl.sync", FT_BOOLEAN, 16,
2398 TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL}},
2399 { &hf_fcels_rcptctl,
2400 {"Recipient Ctl", "fcels.logi.rcptctl", FT_UINT16, BASE_HEX,
2401 NULL, 0x0, NULL, HFILL}},
2402 { &hf_fcels_rcptctl_ack0,
2403 {"ACK0", "fcels.logi.rcptctl.ack", FT_BOOLEAN, 16,
2404 TFS(&tfs_supported_not_supported), 0x8000, NULL, HFILL}},
2405 { &hf_fcels_rcptctl_interlock,
2406 {"X_ID Interlock", "fcels.logi.rcptctl.interlock", FT_BOOLEAN, 16,
2407 TFS(&tfs_requested_not_requested), 0x2000, NULL, HFILL}},
2408 { &hf_fcels_rcptctl_policy,
2409 {"Policy", "fcels.logi.rcptctl.policy", FT_UINT16, BASE_HEX,
2410 VALS (rcptctl_policy_vals), 0x1800, NULL, HFILL}},
2411 { &hf_fcels_rcptctl_category,
2412 {"Category", "fcels.logi.rcptctl.category", FT_UINT16, BASE_HEX,
2413 VALS (rcptctl_category_vals), 0x0030, NULL, HFILL}},
2414 { &hf_fcels_rcptctl_sync,
2415 {"Clock Sync", "fcels.logi.rcptctl.sync", FT_BOOLEAN, 16,
2416 TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL}},
2417 { &hf_fcels_fcpflags,
2418 {"FCP Flags", "fcels.fcpflags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL,
2419 HFILL}},
2420 { &hf_fcels_fcpflags_trireq,
2421 {"Task Retry Ident", "fcels.fcpflags.trireq", FT_BOOLEAN, 32,
2422 TFS(&tfs_requested_not_requested), 1 << 9, NULL, HFILL}},
2423 { &hf_fcels_fcpflags_trirep,
2424 {"Task Retry Ident", "fcels.fcpflags.trirep", FT_BOOLEAN, 32,
2425 TFS(&tfs_accepted_not_accepted), 1 << 9, NULL, HFILL}},
2426 { &hf_fcels_fcpflags_retry,
2427 {"Retry", "fcels.fcpflags.retry", FT_BOOLEAN, 32,
2428 TFS(&tfs_fc_fcels_fcpflags_retry), 1 << 8, NULL, HFILL}},
2429 { &hf_fcels_fcpflags_ccomp,
2430 {"Comp", "fcels.fcpflags.ccomp", FT_BOOLEAN, 32,
2431 TFS(&tfs_fc_fcels_fcpflags_ccomp), 0x00000080, NULL, HFILL}},
2432 { &hf_fcels_fcpflags_datao,
2433 {"Data Overlay", "fcels.fcpflags.datao", FT_BOOLEAN, 32,
2434 TFS(&tfs_fc_fcels_fcpflags_datao), 0x00000040, NULL, HFILL}},
2435 { &hf_fcels_fcpflags_initiator,
2436 {"Initiator", "fcels.fcpflags.initiator", FT_BOOLEAN, 32,
2437 TFS(&tfs_fc_fcels_fcpflags_initiator), 0x00000020, NULL, HFILL}},
2438 { &hf_fcels_fcpflags_target,
2439 {"Target", "fcels.fcpflags.target", FT_BOOLEAN, 32,
2440 TFS(&tfs_fc_fcels_fcpflags_target), 0x00000010, NULL, HFILL}},
2441 { &hf_fcels_fcpflags_rdxr,
2442 {"Rd Xfer_Rdy Dis", "fcels.fcpflags.rdxr", FT_BOOLEAN, 32,
2443 TFS(&tfs_fc_fcels_fcpflags_rdxr), 0x00000002, NULL, HFILL}},
2444 { &hf_fcels_fcpflags_wrxr,
2445 {"Wr Xfer_Rdy Dis", "fcels.fcpflags.wrxr", FT_BOOLEAN, 32,
2446 TFS(&tfs_fc_fcels_fcpflags_wrxr), 0x00000001, NULL, HFILL}},
2447 { &hf_fcels_prliloflags,
2448 {"PRLILO Flags", "fcels.prliloflags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2449 HFILL}},
2450 { &hf_fcels_tprloflags_opav,
2451 {"3rd Party Orig PA Valid", "fcels.tprloflags.opav", FT_BOOLEAN, 8,
2452 TFS(&tfs_valid_not_valid), 0x80, NULL, HFILL}},
2453 { &hf_fcels_tprloflags_rpav,
2454 {"Resp PA Valid", "fcels.tprloflags.rpav", FT_BOOLEAN, 8,
2455 TFS(&tfs_valid_not_valid), 0x40, NULL, HFILL}},
2456 { &hf_fcels_tprloflags_npv,
2457 {"3rd Party N_Port Valid", "fcels.tprloflags.npv", FT_BOOLEAN, 8,
2458 TFS(&tfs_valid_not_valid), 0x20, NULL, HFILL}},
2459 { &hf_fcels_tprloflags_gprlo,
2460 {"Global PRLO", "fcels.tprloflags.gprlo", FT_BOOLEAN, 8,
2461 TFS(&tfs_fc_fcels_tprloflags_gprlo), 0x10, NULL, HFILL}},
2462 { &hf_fcels_speedflags,
2463 {"Port Speed Capabilities", "fcels.speedflags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL,
2464 HFILL}},
2465 { &hf_fcels_speedflags_1gb,
2466 {"1Gb Support", "fcels.speedflags.1gb", FT_BOOLEAN, 16,
2467 TFS(&tfs_supported_not_supported), 0x8000, NULL, HFILL}},
2468 { &hf_fcels_speedflags_2gb,
2469 {"2Gb Support", "fcels.speedflags.2gb", FT_BOOLEAN, 16,
2470 TFS(&tfs_supported_not_supported), 0x4000, NULL, HFILL}},
2471 { &hf_fcels_speedflags_4gb,
2472 {"4Gb Support", "fcels.speedflags.4gb", FT_BOOLEAN, 16,
2473 TFS(&tfs_supported_not_supported), 0x2000, NULL, HFILL}},
2474 { &hf_fcels_speedflags_10gb,
2475 {"10Gb Support", "fcels.speedflags.10gb", FT_BOOLEAN, 16,
2476 TFS(&tfs_supported_not_supported), 0x1000, NULL, HFILL}},
2477 { &hf_fcels_prliloflags_opav,
2478 {"Orig PA Valid", "fcels.prliloflags.opav", FT_BOOLEAN, 8,
2479 TFS(&tfs_valid_not_valid), 0x80, NULL, HFILL}},
2480 { &hf_fcels_prliloflags_ipe,
2481 {"Image Pair Estd", "fcels.prliloflags.ipe", FT_BOOLEAN, 8,
2482 TFS(&tfs_fc_fcels_prliloflags_ipe), 0x20, NULL, HFILL}},
2483 { &hf_fcels_prliloflags_eip,
2484 {"Est Image Pair", "fcels.prliloflags.eip", FT_BOOLEAN, 8,
2485 TFS(&tfs_fc_fcels_prliloflags_eip), 0x20, NULL, HFILL}},
2487 /* Generated from convert_proto_tree_add_text.pl */
2488 { &hf_fcels_recovery_qualifier_status, { "Recovery Qualifier Status", "fcels.recovery_qualifier_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2489 { &hf_fcels_link_failure_count, { "Link Failure Count", "fcels.link_failure_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2490 { &hf_fcels_loss_of_sync_count, { "Loss of Sync Count", "fcels.loss_of_sync_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2491 { &hf_fcels_loss_of_signal_count, { "Loss of Signal Count", "fcels.loss_of_signal_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2492 { &hf_fcels_primitive_seq_protocol_err, { "Primitive Seq Protocol Err", "fcels.primitive_seq_protocol_err", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2493 { &hf_fcels_invalid_xmission_word, { "Invalid Xmission Word", "fcels.invalid_xmission_word", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2494 { &hf_fcels_invalid_crc_count, { "Invalid CRC Count", "fcels.invalid_crc_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2495 { &hf_fcels_l_port_status, { "L_Port Status", "fcels.l_port_status", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2496 { &hf_fcels_lip_al_ps, { "LIP AL_PS", "fcels.lip.al_ps", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2497 { &hf_fcels_lip_f7_initiated_count, { "LIP F7 Initiated Count", "fcels.lip.f7_initiated_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2498 { &hf_fcels_lip_f7_received_count, { "LIP F7 Received Count", "fcels.lip.f7_received_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2499 { &hf_fcels_lip_f8_initiated_count, { "LIP F8 Initiated Count", "fcels.lip.f8_initiated_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2500 { &hf_fcels_lip_f8_received_count, { "LIP F8 Received Count", "fcels.lip.f8_received_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2501 { &hf_fcels_lip_reset_initiated_count, { "LIP Reset Initiated Count", "fcels.lip.reset_initiated_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2502 { &hf_fcels_lip_reset_received_count, { "LIP Reset Received Count", "fcels.lip.reset_received_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2503 { &hf_fcels_rpl_max_size, { "Max Size", "fcels.rpl.max_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2504 { &hf_fcels_rpl_index, { "Index", "fcels.rpl.index", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2505 { &hf_fcels_rpl_payload_length, { "Payload Length", "fcels.rpl.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2506 { &hf_fcels_rpl_list_length, { "List Length", "fcels.rpl.list_length", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2507 { &hf_fcels_rpl_index_of_i_port_block, { "Index of I Port Block", "fcels.rpl.index_of_i_port_block", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2508 { &hf_fcels_rpl_physical_port, { "Physical Port #", "fcels.rpl.physical_port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2509 { &hf_fcels_rpl_port_identifier, { "Port Identifier", "fcels.rpl.port_identifier", FT_BYTES, SEP_DOT, NULL, 0x0, NULL, HFILL }},
2510 { &hf_fcels_rpl_port_name, { "Port Name", "fcels.rpl.port_name", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2511 { &hf_fcels_rscn_page_len, { "Page Len", "fcels.rscn.page_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2512 { &hf_fcels_rscn_payload_len, { "Payload Len", "fcels.rscn.payload_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2513 { &hf_fcels_rnft_max_size, { "Max Size", "fcels.rnft.max_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2514 { &hf_fcels_rnft_index, { "Index", "fcels.rnft.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2515 { &hf_fcels_rnft_payload_len, { "Payload Len", "fcels.rnft.payload_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2516 { &hf_fcels_rnft_list_length, { "List Length", "fcels.rnft.list_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2517 { &hf_fcels_rnft_index_of_first_rec_in_list, { "Index of First Rec in List", "fcels.rnft.index_of_first_rec_in_list", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2518 { &hf_fcels_rnft_fc4_qualifier, { "FC-4 Qualifier", "fcels.rnft.fc_4_qualifier", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2519 { &hf_fcels_prlilo_page_length, { "Page Length", "fcels.prlilo.page_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2520 { &hf_fcels_prlilo_payload_length, { "Payload Length", "fcels.prlilo.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2521 { &hf_fcels_prlilo_type, { "TYPE", "fcels.prlilo.type", FT_UINT8, BASE_DEC, VALS(fc_prli_fc4_val), 0x0, NULL, HFILL }},
2522 { &hf_fcels_prlilo_type_code_extension, { "TYPE Code Extension", "fcels.prlilo.type_code_extension", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2523 { &hf_fcels_prlilo_response_code, { "Response Code", "fcels.prlilo.response_code", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2524 { &hf_fcels_prlilo_originator_pa, { "Originator PA", "fcels.prlilo.originator_pa", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2525 { &hf_fcels_prlilo_3rd_party_originator_pa, { "3rd Party Originator PA", "fcels.prlilo.3rd_party_originator_pa", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2526 { &hf_fcels_prlilo_responder_pa, { "Responder PA", "fcels.prlilo.responder_pa", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2527 { &hf_fcels_prlilo_service_parameter_response, { "Service Parameter Response", "fcels.prlilo.service_parameter_response", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2528 { &hf_fcels_prlilo_3rd_party_n_port_id, { "3rd Party N_Port Id", "fcels.prlilo.3rd_party_n_port_id", FT_BYTES, SEP_DOT, NULL, 0x0, NULL, HFILL }},
2529 { &hf_fcels_lirr_regn_function, { "Regn. Function", "fcels.lirr.regn_function", FT_UINT8, BASE_HEX, VALS(fc_els_lirr_regfunc_val), 0x0, NULL, HFILL }},
2530 { &hf_fcels_lirr_regn_format, { "Regn. Format", "fcels.lirr.regn_format", FT_UINT8, BASE_HEX, VALS(fc_fc4_val), 0x0, NULL, HFILL }},
2531 { &hf_fcels_srl_flag, { "Flag", "fcels.srl.flag", FT_BOOLEAN, 8, TFS(&tfs_srl_flag), 0x01, NULL, HFILL }},
2532 { &hf_fcels_srl_fl_port_addr, { "FL_Port Addr", "fcels.srl.fl_port_addr", FT_BYTES, SEP_DOT, NULL, 0x0, NULL, HFILL }},
2533 { &hf_fcels_rpsc_number_of_entries, { "Number of Entries", "fcels.rpsc.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2534 { &hf_fcels_rpsc_port_oper_speed, { "Port Oper Speed", "fcels.rpsc.port_oper_speed", FT_UINT16, BASE_HEX, VALS(fc_els_portspeed_val), 0x0, NULL, HFILL }},
2535 { &hf_fcels_common_identification_data_length, { "Common Identification Data Length", "fcels.common_identification_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2538 static int *ett[] = {
2539 &ett_fcels,
2540 &ett_fcels_lsrjt,
2541 &ett_fcels_acc,
2542 &ett_fcels_logi,
2543 &ett_fcels_logi_cmnsvc,
2544 &ett_fcels_logi_clssvc,
2545 &ett_fcels_logo,
2546 &ett_fcels_abtx,
2547 &ett_fcels_rsi,
2548 &ett_fcels_rrq,
2549 &ett_fcels_rec,
2550 &ett_fcels_prli,
2551 &ett_fcels_prli_svcpg,
2552 &ett_fcels_adisc,
2553 &ett_fcels_farp,
2554 &ett_fcels_rps,
2555 &ett_fcels_rpl,
2556 &ett_fcels_rplpb,
2557 &ett_fcels_fan,
2558 &ett_fcels_rscn,
2559 &ett_fcels_rscn_rec,
2560 &ett_fcels_estat,
2561 &ett_fcels_scr,
2562 &ett_fcels_rnft,
2563 &ett_fcels_rnft_fc4,
2564 &ett_fcels_lsts,
2565 &ett_fcels_rnid,
2566 &ett_fcels_rlir,
2567 &ett_fcels_lirr,
2568 &ett_fcels_srl,
2569 &ett_fcels_rpsc,
2570 &ett_fcels_cbind,
2571 &ett_fcels_cmnfeatures,
2572 &ett_fcels_clsflags,
2573 &ett_fcels_initctl,
2574 &ett_fcels_rcptctl,
2575 &ett_fcels_fcpflags,
2576 &ett_fcels_prliloflags,
2577 &ett_fcels_speedflags,
2581 static ei_register_info ei[] = {
2582 { &ei_fcels_src_unknown, { "fcels.src.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown source address type", EXPFILL }},
2583 { &ei_fcels_dst_unknown, { "fcels.dst.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown destination address type", EXPFILL }},
2584 { &ei_fcels_no_record_of_exchange, { "fcels.no_record_of_exchange", PI_UNDECODED, PI_WARN, "No record of Exchange. Unable to decode ACC", EXPFILL }},
2585 { &ei_fcels_no_record_of_els_req, { "fcels.no_record_of_els_req", PI_UNDECODED, PI_WARN, "No record of ELS Req. Unable to decode ACC", EXPFILL }},
2588 expert_module_t* expert_fcels;
2590 proto_fcels = proto_register_protocol("FC Extended Link Svc", "FC ELS", "fcels");
2592 proto_register_field_array(proto_fcels, hf, array_length(hf));
2593 proto_register_subtree_array(ett, array_length(ett));
2594 expert_fcels = expert_register_protocol(proto_fcels);
2595 expert_register_field_array(expert_fcels, ei, array_length(ei));
2596 fcels_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcels_hash, fcels_equal);
2598 els_handle = register_dissector("fcels", dissect_fcels, proto_fcels);
2601 void
2602 proto_reg_handoff_fcels (void)
2604 dissector_add_uint("fc.ftype", FC_FTYPE_ELS, els_handle);
2606 fcsp_handle = find_dissector_add_dependency ("fcsp", proto_fcels);
2611 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2613 * Local variables:
2614 * c-basic-offset: 4
2615 * tab-width: 8
2616 * indent-tabs-mode: nil
2617 * End:
2619 * vi: set shiftwidth=4 tabstop=8 expandtab:
2620 * :indentSize=4:tabSize=8:noTabs=true: