2 * Routines for FC distributed Name Server (dNS)
3 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #define NEW_PROTO_TREE_API
30 #ifdef HAVE_NETINET_IN_H
31 # include <netinet/in.h>
36 #include <epan/packet.h>
37 #include <epan/to_str.h>
38 #include <epan/wmem/wmem.h>
39 #include <epan/conversation.h>
40 #include <epan/etypes.h>
41 #include "packet-scsi.h"
42 #include "packet-fc.h"
43 #include "packet-fcct.h"
44 #include "packet-fcdns.h"
45 #include "packet-fcswils.h"
51 static dissector_handle_t dns_handle
;
53 /* protocol and registered fields */
55 static header_field_info
*hfi_fcdns
= NULL
;
57 #define FCDNS_HFI_INIT HFI_INIT(proto_fcdns)
60 static header_field_info hfi_fcdns_gssubtype FCDNS_HFI_INIT
=
61 {"GS_Subtype", "fcdns.gssubtype", FT_UINT8
, BASE_HEX
,
62 VALS(fc_dns_subtype_val
), 0x0, NULL
, HFILL
};
65 static header_field_info hfi_fcdns_opcode FCDNS_HFI_INIT
=
66 {"Opcode", "fcdns.opcode", FT_UINT16
, BASE_HEX
, VALS (fc_dns_opcode_val
),
69 static header_field_info hfi_fcdns_reason FCDNS_HFI_INIT
=
70 {"Reason Code", "fcdns.rply.reason", FT_UINT8
, BASE_HEX
,
71 VALS (fc_ct_rjt_code_vals
), 0x0, NULL
, HFILL
};
73 static header_field_info hfi_fcdns_vendor FCDNS_HFI_INIT
=
74 {"Vendor Unique Reject Code", "fcdns.rply.vendor", FT_UINT8
,
75 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
};
77 static header_field_info hfi_fcdns_req_portid FCDNS_HFI_INIT
=
78 {"Port Identifier", "fcdns.req.portid", FT_STRING
, BASE_NONE
, NULL
, 0x0,
81 static header_field_info hfi_fcdns_rply_pname FCDNS_HFI_INIT
=
82 {"Port Name", "fcdns.rply.pname", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
,
85 static header_field_info hfi_fcdns_rply_nname FCDNS_HFI_INIT
=
86 {"Node Name", "fcdns.rply.nname", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
,
89 static header_field_info hfi_fcdns_rply_gft FCDNS_HFI_INIT
=
90 {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_NONE
, BASE_NONE
,
91 NULL
, 0x0, NULL
, HFILL
};
93 static header_field_info hfi_fcdns_rply_snamelen FCDNS_HFI_INIT
=
94 {"Symbolic Node Name Length", "fcdns.rply.snamelen", FT_UINT8
, BASE_DEC
,
95 NULL
, 0x0, NULL
, HFILL
};
97 static header_field_info hfi_fcdns_rply_sname FCDNS_HFI_INIT
=
98 {"Symbolic Node Name", "fcdns.rply.sname", FT_STRING
, BASE_NONE
, NULL
,
101 static header_field_info hfi_fcdns_rply_ptype FCDNS_HFI_INIT
=
102 {"Port Type", "fcdns.rply.porttype", FT_UINT8
, BASE_HEX
,
103 VALS (fc_dns_port_type_val
), 0x0, NULL
, HFILL
};
105 static header_field_info hfi_fcdns_rply_fpname FCDNS_HFI_INIT
=
106 {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING
, BASE_NONE
, NULL
,
109 static header_field_info hfi_fcdns_fc4type FCDNS_HFI_INIT
=
110 {"FC-4 Types", "fcdns.req.fc4type", FT_NONE
, BASE_NONE
,
111 NULL
, 0x0, NULL
, HFILL
};
113 static header_field_info hfi_fcdns_rply_fc4type FCDNS_HFI_INIT
=
114 {"FC-4 Descriptor Type", "fcdns.rply.fc4type", FT_UINT8
, BASE_HEX
,
115 VALS (fc_fc4_val
), 0x0, NULL
, HFILL
};
117 static header_field_info hfi_fcdns_rply_fc4desc FCDNS_HFI_INIT
=
118 {"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_BYTES
, BASE_NONE
, NULL
,
121 static header_field_info hfi_fcdns_req_pname FCDNS_HFI_INIT
=
122 {"Port Name", "fcdns.req.portname", FT_STRING
, BASE_NONE
, NULL
, 0x0,
125 static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT
=
126 {"Port Identifier", "fcdns.rply.portid", FT_STRING
, BASE_NONE
, NULL
,
129 static header_field_info hfi_fcdns_req_nname FCDNS_HFI_INIT
=
130 {"Node Name", "fcdns.req.nname", FT_STRING
, BASE_NONE
, NULL
, 0x0,
133 static header_field_info hfi_fcdns_req_domainscope FCDNS_HFI_INIT
=
134 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8
, BASE_HEX
, NULL
,
137 static header_field_info hfi_fcdns_req_areascope FCDNS_HFI_INIT
=
138 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8
, BASE_HEX
, NULL
,
141 static header_field_info hfi_fcdns_req_ptype FCDNS_HFI_INIT
=
142 {"Port Type", "fcdns.req.porttype", FT_UINT8
, BASE_HEX
,
143 VALS (fc_dns_port_type_val
), 0x0, NULL
, HFILL
};
145 static header_field_info hfi_fcdns_req_cos FCDNS_HFI_INIT
=
146 {"Requested Class of Service", "fcdns.req.class", FT_UINT32
, BASE_HEX
,
147 NULL
, 0x0, NULL
, HFILL
};
149 static header_field_info hfi_fcdns_req_fc4types FCDNS_HFI_INIT
=
150 {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE
, BASE_NONE
,
151 NULL
, 0x0, NULL
, HFILL
};
153 static header_field_info hfi_fcdns_req_snamelen FCDNS_HFI_INIT
=
154 {"Symbolic Name Length", "fcdns.req.snamelen", FT_UINT8
, BASE_DEC
,
155 NULL
, 0x0, NULL
, HFILL
};
157 static header_field_info hfi_fcdns_req_sname FCDNS_HFI_INIT
=
158 {"Symbolic Port Name", "fcdns.req.sname", FT_STRING
, BASE_NONE
, NULL
,
161 static header_field_info hfi_fcdns_rply_spnamelen FCDNS_HFI_INIT
=
162 {"Symbolic Port Name Length", "fcdns.rply.spnamelen", FT_UINT8
,
163 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
};
165 static header_field_info hfi_fcdns_rply_spname FCDNS_HFI_INIT
=
166 {"Symbolic Port Name", "fcdns.rply.spname", FT_STRING
, BASE_NONE
, NULL
,
169 static header_field_info hfi_fcdns_req_spnamelen FCDNS_HFI_INIT
=
170 {"Symbolic Port Name Length", "fcdns.req.spnamelen", FT_UINT8
,
171 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
};
173 static header_field_info hfi_fcdns_req_spname FCDNS_HFI_INIT
=
174 {"Symbolic Port Name", "fcdns.req.spname", FT_STRING
, BASE_NONE
, NULL
,
177 static header_field_info hfi_fcdns_rply_ipa FCDNS_HFI_INIT
=
178 {"Initial Process Associator", "fcdns.rply.ipa", FT_BYTES
, BASE_NONE
,
179 NULL
, 0x0, NULL
, HFILL
};
181 static header_field_info hfi_fcdns_rply_ipnode FCDNS_HFI_INIT
=
182 {"Node IP Address", "fcdns.rply.ipnode", FT_IPv6
, BASE_NONE
, NULL
,
185 static header_field_info hfi_fcdns_rply_ipport FCDNS_HFI_INIT
=
186 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6
, BASE_NONE
, NULL
,
189 static header_field_info hfi_fcdns_rply_fc4desclen FCDNS_HFI_INIT
=
190 {"FC-4 Descriptor Length", "fcdns.rply.fc4desclen", FT_UINT8
,
191 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
};
193 static header_field_info hfi_fcdns_rply_hrdaddr FCDNS_HFI_INIT
=
194 {"Hard Address", "fcdns.rply.hrdaddr", FT_STRING
, BASE_NONE
, NULL
,
197 static header_field_info hfi_fcdns_req_fdesclen FCDNS_HFI_INIT
=
198 {"FC-4 Descriptor Length", "fcdns.req.fc4desclen", FT_UINT8
, BASE_DEC
,
199 NULL
, 0x0, NULL
, HFILL
};
201 static header_field_info hfi_fcdns_req_fdesc FCDNS_HFI_INIT
=
202 {"FC-4 Descriptor", "fcdns.req.fc4desc", FT_STRING
, BASE_NONE
, NULL
,
205 static header_field_info hfi_fcdns_req_ip FCDNS_HFI_INIT
=
206 {"IP Address", "fcdns.req.ip", FT_IPv6
, BASE_NONE
, NULL
, 0x0,
209 static header_field_info hfi_fcdns_rjtdetail FCDNS_HFI_INIT
=
210 {"Reason Code Explanantion", "fcdns.rply.reasondet", FT_UINT8
,
211 BASE_HEX
, VALS (fc_dns_rjt_det_code_val
), 0x0, NULL
, HFILL
};
213 static header_field_info hfi_fcdns_zone_mbrtype FCDNS_HFI_INIT
=
214 {"Zone Member Type", "fcdns.zone.mbrtype", FT_UINT8
, BASE_HEX
,
215 VALS (fc_swils_zonembr_type_val
), 0x0, NULL
, HFILL
};
217 static header_field_info hfi_fcdns_zone_mbrid FCDNS_HFI_INIT
=
218 {"Member Identifier", "fcdns.zone.mbrid", FT_STRING
, BASE_NONE
, NULL
,
221 static header_field_info hfi_fcdns_zonenm FCDNS_HFI_INIT
=
222 {"Zone Name", "fcdns.zonename", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
,
225 static header_field_info hfi_fcdns_portip FCDNS_HFI_INIT
=
226 {"Port IP Address", "fcdns.portip", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
229 static header_field_info hfi_fcdns_sw2_objfmt FCDNS_HFI_INIT
=
230 {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8
, BASE_HEX
,
231 NULL
, 0x0, NULL
, HFILL
};
233 static header_field_info hfi_fcdns_num_fc4desc FCDNS_HFI_INIT
=
234 {"Number of FC4 Descriptors Registered", "fcdns.entry.numfc4desc",
235 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
};
237 static header_field_info hfi_fcdns_rply_ownerid FCDNS_HFI_INIT
=
238 {"Owner Id", "fcdns.rply.ownerid", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
,
241 static header_field_info hfi_fcdns_maxres_size FCDNS_HFI_INIT
=
242 {"Maximum/Residual Size", "fcdns.maxres_size", FT_UINT16
, BASE_DEC
,
243 NULL
, 0x0, NULL
, HFILL
};
245 static header_field_info hfi_fcdns_reply_cos FCDNS_HFI_INIT
=
246 {"Class of Service Supported", "fcdns.reply.cos", FT_UINT32
, BASE_HEX
,
247 NULL
, 0x0, NULL
, HFILL
};
249 static header_field_info hfi_fcdns_cos_f FCDNS_HFI_INIT
=
250 {"F", "fcdns.cos.f", FT_BOOLEAN
, 32,
251 TFS(&tfs_set_notset
), 0x01, NULL
, HFILL
};
253 static header_field_info hfi_fcdns_cos_1 FCDNS_HFI_INIT
=
254 {"1", "fcdns.cos.1", FT_BOOLEAN
, 32,
255 TFS(&tfs_set_notset
), 0x02, NULL
, HFILL
};
257 static header_field_info hfi_fcdns_cos_2 FCDNS_HFI_INIT
=
258 {"2", "fcdns.cos.2", FT_BOOLEAN
, 32,
259 TFS(&tfs_set_notset
), 0x04, NULL
, HFILL
};
261 static header_field_info hfi_fcdns_cos_3 FCDNS_HFI_INIT
=
262 {"3", "fcdns.cos.3", FT_BOOLEAN
, 32,
263 TFS(&tfs_set_notset
), 0x08, NULL
, HFILL
};
265 static header_field_info hfi_fcdns_cos_4 FCDNS_HFI_INIT
=
266 {"4", "fcdns.cos.4", FT_BOOLEAN
, 32,
267 TFS(&tfs_set_notset
), 0x10, NULL
, HFILL
};
269 static header_field_info hfi_fcdns_cos_6 FCDNS_HFI_INIT
=
270 {"6", "fcdns.cos.6", FT_BOOLEAN
, 32,
271 TFS(&tfs_set_notset
), 0x40, NULL
, HFILL
};
273 static header_field_info hfi_fcdns_fc4type_llcsnap FCDNS_HFI_INIT
=
274 {"LLC/SNAP", "fcdns.fc4types.llc_snap", FT_BOOLEAN
, 32,
275 TFS(&tfs_set_notset
), 0x0010, NULL
, HFILL
};
277 static header_field_info hfi_fcdns_fc4type_ip FCDNS_HFI_INIT
=
278 {"IP", "fcdns.fc4types.ip", FT_BOOLEAN
, 32,
279 TFS(&tfs_set_notset
), 0x0020, NULL
, HFILL
};
281 static header_field_info hfi_fcdns_fc4type_fcp FCDNS_HFI_INIT
=
282 {"FCP", "fcdns.fc4types.fcp", FT_BOOLEAN
, 32,
283 TFS(&tfs_set_notset
), 0x0100, NULL
, HFILL
};
285 static header_field_info hfi_fcdns_fc4type_swils FCDNS_HFI_INIT
=
286 {"SW_ILS", "fcdns.fc4types.swils", FT_BOOLEAN
, 32,
287 TFS(&tfs_set_notset
), 0x0010, NULL
, HFILL
};
289 static header_field_info hfi_fcdns_fc4type_snmp FCDNS_HFI_INIT
=
290 {"SNMP", "fcdns.fc4types.snmp", FT_BOOLEAN
, 32,
291 TFS(&tfs_set_notset
), 0x0004, NULL
, HFILL
};
293 static header_field_info hfi_fcdns_fc4type_gs3 FCDNS_HFI_INIT
=
294 {"GS3", "fcdns.fc4types.gs3", FT_BOOLEAN
, 32,
295 TFS(&tfs_set_notset
), 0x0001, NULL
, HFILL
};
297 static header_field_info hfi_fcdns_fc4type_vi FCDNS_HFI_INIT
=
298 {"VI", "fcdns.fc4types.vi", FT_BOOLEAN
, 32,
299 TFS(&tfs_set_notset
), 0x0001, NULL
, HFILL
};
301 static header_field_info hfi_fcdns_fc4features FCDNS_HFI_INIT
=
302 {"FC-4 Feature Bits", "fcdns.fc4features", FT_UINT8
,
303 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
};
305 static header_field_info hfi_fcdns_fc4features_i FCDNS_HFI_INIT
=
306 {"I", "fcdns.fc4features.i", FT_BOOLEAN
, 8,
307 TFS(&tfs_set_notset
), 0x02, NULL
, HFILL
};
309 static header_field_info hfi_fcdns_fc4features_t FCDNS_HFI_INIT
=
310 {"T", "fcdns.fc4features.t", FT_BOOLEAN
, 8,
311 TFS(&tfs_set_notset
), 0x01, NULL
, HFILL
};
313 static header_field_info hfi_fcdns_req_fc4type FCDNS_HFI_INIT
=
314 {"FC-4 Type", "fcdns.req.fc4type", FT_UINT8
, BASE_HEX
,
315 VALS (fc_fc4_val
), 0x0, NULL
, HFILL
};
318 /* Initialize the subtree pointers */
319 static gint ett_fcdns
= -1;
320 static gint ett_cos_flags
= -1;
321 static gint ett_fc4flags
= -1;
322 static gint ett_fc4features
= -1;
324 typedef struct _fcdns_conv_key
{
328 typedef struct _fcdns_conv_data
{
332 static GHashTable
*fcdns_req_hash
= NULL
;
338 fcdns_equal(gconstpointer v
, gconstpointer w
)
340 const fcdns_conv_key_t
*v1
= (const fcdns_conv_key_t
*)v
;
341 const fcdns_conv_key_t
*v2
= (const fcdns_conv_key_t
*)w
;
343 return (v1
->conv_idx
== v2
->conv_idx
);
347 fcdns_hash (gconstpointer v
)
349 const fcdns_conv_key_t
*key
= (const fcdns_conv_key_t
*)v
;
358 * Protocol initialization
361 fcdns_init_protocol(void)
364 g_hash_table_destroy(fcdns_req_hash
);
366 fcdns_req_hash
= g_hash_table_new(fcdns_hash
, fcdns_equal
);
371 dissect_cos_flags (proto_tree
*parent_tree
, tvbuff_t
*tvb
, int offset
, const header_field_info
*hfinfo
)
373 proto_item
*item
=NULL
;
374 proto_tree
*tree
=NULL
;
377 flags
= tvb_get_ntohl (tvb
, offset
);
379 item
=proto_tree_add_uint(parent_tree
, hfinfo
,
380 tvb
, offset
, 1, flags
);
381 tree
=proto_item_add_subtree(item
, ett_cos_flags
);
385 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_f
, tvb
, offset
, 4, flags
);
387 proto_item_append_text(item
, " F");
391 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_1
, tvb
, offset
, 4, flags
);
393 proto_item_append_text(item
, " 1");
397 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_2
, tvb
, offset
, 4, flags
);
399 proto_item_append_text(item
, " 2");
403 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_3
, tvb
, offset
, 4, flags
);
405 proto_item_append_text(item
, " 3");
409 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_4
, tvb
, offset
, 4, flags
);
411 proto_item_append_text(item
, " 4");
415 proto_tree_add_boolean(tree
, &hfi_fcdns_cos_6
, tvb
, offset
, 4, flags
);
417 proto_item_append_text(item
, " 6");
419 /*flags&=(~( 0x40 ));*/
424 /* The feature routines just decode FCP's FC-4 features field
425 * based on the flahs in offset and the type in offset+1
428 dissect_fc4features_and_type (proto_tree
*parent_tree
, tvbuff_t
*tvb
, int offset
)
430 proto_item
*item
=NULL
;
431 proto_tree
*tree
=NULL
;
434 flags
= tvb_get_guint8(tvb
, offset
);
435 type
= tvb_get_guint8(tvb
, offset
+1);
437 item
=proto_tree_add_uint(parent_tree
, &hfi_fcdns_fc4features
,
438 tvb
, offset
, 1, flags
);
439 tree
=proto_item_add_subtree(item
, ett_fc4features
);
442 if(type
==FC_TYPE_SCSI
){
443 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4features_i
, tvb
, offset
, 1, flags
);
445 proto_item_append_text(item
, " I");
449 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4features_t
, tvb
, offset
, 1, flags
);
451 proto_item_append_text(item
, " T");
453 /*flags&=(~( 0x01 ));*/
456 proto_tree_add_item (tree
, &hfi_fcdns_req_fc4type
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
459 /* The feature routines just decode FCP's FC-4 features field
462 dissect_fc4features (proto_tree
*parent_tree
, tvbuff_t
*tvb
, int offset
)
464 proto_item
*item
=NULL
;
465 proto_tree
*tree
=NULL
;
468 flags
= tvb_get_guint8(tvb
, offset
);
470 item
=proto_tree_add_uint(parent_tree
, &hfi_fcdns_fc4features
,
471 tvb
, offset
, 1, flags
);
472 tree
=proto_item_add_subtree(item
, ett_fc4features
);
475 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4features_i
, tvb
, offset
, 1, flags
);
477 proto_item_append_text(item
, " I");
481 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4features_t
, tvb
, offset
, 1, flags
);
483 proto_item_append_text(item
, " T");
485 /*flags&=(~( 0x01 ));*/
490 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
492 dissect_fc4type (proto_tree
*parent_tree
, tvbuff_t
*tvb
, int offset
, header_field_info
*hfinfo
)
494 proto_item
*item
=NULL
;
495 proto_tree
*tree
=NULL
;
499 item
=proto_tree_add_item(parent_tree
, hfinfo
, tvb
, offset
,
501 tree
=proto_item_add_subtree(item
, ett_fc4flags
);
504 flags
= tvb_get_ntohl (tvb
, offset
);
506 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_fcp
, tvb
, offset
, 4, flags
);
508 proto_item_append_text(item
, " FCP");
510 flags
&=(~( 0x0100 ));
512 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_ip
, tvb
, offset
, 4, flags
);
514 proto_item_append_text(item
, " IP");
516 flags
&=(~( 0x0020 ));
518 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_llcsnap
, tvb
, offset
, 4, flags
);
520 proto_item_append_text(item
, " LLC/SNAP");
522 /*flags&=(~( 0x0010 ));*/
525 flags
= tvb_get_ntohl (tvb
, offset
+4);
527 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_swils
, tvb
, offset
+4, 4, flags
);
529 proto_item_append_text(item
, " SW_ILS");
531 flags
&=(~( 0x0010 ));
533 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_snmp
, tvb
, offset
+4, 4, flags
);
535 proto_item_append_text(item
, " SNMP");
537 flags
&=(~( 0x0004 ));
539 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_gs3
, tvb
, offset
+4, 4, flags
);
541 proto_item_append_text(item
, " GS3");
543 /*flags&=(~( 0x0001 ));*/
546 flags
= tvb_get_ntohl (tvb
, offset
+8);
548 proto_tree_add_boolean(tree
, &hfi_fcdns_fc4type_vi
, tvb
, offset
+8, 4, flags
);
550 proto_item_append_text(item
, " VI");
552 /*flags&=(~( 0x0001 ));*/
555 /* Code to actually dissect the packets */
557 /* A bunch of get routines have a similar req packet format. The first few
558 * routines deal with this decoding. All assume that tree is valid */
560 dissect_fcdns_req_portid (tvbuff_t
*tvb
, proto_tree
*tree
, int offset
)
563 proto_tree_add_string (tree
, &hfi_fcdns_req_portid
, tvb
, offset
, 3,
564 tvb_fc_to_str (tvb
, offset
));
569 dissect_fcdns_ganxt (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
571 int offset
= 16; /* past the fc_ct header */
576 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
579 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ptype
, tvb
, offset
,
581 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
, tvb
,
583 tvb_fc_to_str (tvb
, offset
+1));
584 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_pname
, tvb
,
586 tvb_fcwwn_to_str (tvb
, offset
+4));
587 len
= tvb_get_guint8 (tvb
, offset
+12);
588 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_spnamelen
, tvb
,
589 offset
+12, 1, ENC_BIG_ENDIAN
);
590 if (!tvb_offset_exists (tvb
, 29+len
))
594 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_spname
, tvb
,
595 offset
+13, len
, ENC_ASCII
|ENC_NA
);
598 if (tvb_offset_exists (tvb
, 292)) {
599 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_nname
, tvb
,
601 tvb_fcwwn_to_str (tvb
, offset
+268));
603 if (tvb_offset_exists (tvb
, 548)) {
604 len
= tvb_get_guint8 (tvb
, offset
+276);
605 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_snamelen
, tvb
,
606 offset
+276, 1, ENC_BIG_ENDIAN
);
608 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_sname
, tvb
,
609 offset
+277, len
, ENC_ASCII
|ENC_NA
);
612 if (tvb_offset_exists (tvb
, 556)) {
613 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ipa
, tvb
,
614 offset
+532, 8, ENC_NA
);
616 if (tvb_offset_exists (tvb
, 572)) {
617 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ipnode
, tvb
,
618 offset
+540, 16, ENC_NA
);
620 if (tvb_offset_exists (tvb
, 576)) {
621 dissect_cos_flags(req_tree
, tvb
, offset
+556, &hfi_fcdns_reply_cos
);
623 if (tvb_offset_exists (tvb
, 608)) {
624 dissect_fc4type(req_tree
, tvb
, offset
+560, &hfi_fcdns_rply_gft
);
626 if (tvb_offset_exists (tvb
, 624)) {
627 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ipport
, tvb
,
628 offset
+592, 16, ENC_NA
);
630 if (tvb_offset_exists (tvb
, 632)) {
631 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_fpname
, tvb
,
633 tvb_fcwwn_to_str (tvb
, offset
+608));
635 if (tvb_offset_exists (tvb
, 635)) {
636 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_hrdaddr
, tvb
,
638 tvb_fc_to_str (tvb
, offset
+617));
645 dissect_fcdns_gpnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
647 int offset
= 16; /* past the fc_ct header */
651 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
654 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_pname
, tvb
, offset
,
655 8, tvb_fcwwn_to_str (tvb
, offset
));
661 dissect_fcdns_gnnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
663 int offset
= 16; /* past the fc_ct header */
667 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
670 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_nname
, tvb
,
672 tvb_fcwwn_to_str (tvb
, offset
));
678 dissect_fcdns_gcsid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
680 int offset
= 16; /* past the fc_ct header */
684 dissect_fcdns_req_portid (tvb
, req_tree
, offset
);
687 dissect_cos_flags(req_tree
, tvb
, offset
, &hfi_fcdns_reply_cos
);
693 dissect_fcdns_gftid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
695 int offset
= 16; /* past the fc_ct header */
699 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
702 dissect_fc4type(req_tree
, tvb
, offset
, &hfi_fcdns_rply_gft
);
708 dissect_fcdns_gspnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
710 int offset
= 16; /* past the fc_ct header */
715 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
718 len
= tvb_get_guint8 (tvb
, offset
);
719 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_spnamelen
,
720 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
721 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_spname
, tvb
,
722 offset
+1, len
, ENC_ASCII
|ENC_NA
);
728 dissect_fcdns_gptid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
730 int offset
= 16; /* past the fc_ct header */
734 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
737 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ptype
, tvb
,
738 offset
, 1, ENC_BIG_ENDIAN
);
744 dissect_fcdns_gfpnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
746 int offset
= 16; /* past the fc_ct header */
750 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
753 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_fpname
, tvb
,
755 tvb_fcwwn_to_str (tvb
, offset
));
762 dissect_fcdns_gfdid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
764 int offset
= 16; /* past the fc_ct header */
765 int tot_len
, desclen
;
769 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
770 dissect_fc4type(req_tree
, tvb
, offset
+4, &hfi_fcdns_fc4type
);
773 tot_len
= tvb_reported_length_remaining (tvb
, offset
); /* excluding CT header */
774 while (tot_len
> 0) {
775 /* The count of the descriptors is not returned and so we have
776 * to track the display by the length field */
777 desclen
= tvb_get_guint8 (tvb
, offset
);
778 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_fc4desc
, tvb
,
779 offset
, desclen
, ENC_NA
);
780 tot_len
-= 255; /* descriptors are aligned to 255 bytes */
788 dissect_fcdns_gffid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
790 int offset
= 16; /* past the fc_ct header */
794 dissect_fcdns_req_portid (tvb
, req_tree
, offset
+1);
797 dissect_fc4features(req_tree
, tvb
, offset
);
803 dissect_fcdns_gidpn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
805 int offset
= 16; /* past the fc_ct header */
809 proto_tree_add_string (req_tree
, &hfi_fcdns_req_pname
, tvb
,
811 tvb_fcwwn_to_str (tvb
, offset
));
814 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
, tvb
,
816 tvb_fc_to_str (tvb
, offset
+1));
822 dissect_fcdns_gipppn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
824 int offset
= 16; /* past the fc_ct header */
828 proto_tree_add_string (req_tree
, &hfi_fcdns_req_pname
, tvb
,
830 tvb_fcwwn_to_str (tvb
, offset
));
833 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ipport
, tvb
, offset
,
840 dissect_fcdns_gidnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
842 int offset
= 16; /* past the fc_ct header */
847 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
,
849 tvb_fcwwn_to_str (tvb
, offset
));
853 islast
= tvb_get_guint8 (tvb
, offset
);
854 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
856 tvb_fc_to_str (tvb
, offset
+1));
858 } while (!(islast
& 0x80));
864 dissect_fcdns_gipnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
866 int offset
= 16; /* past the fc_ct header */
870 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
,
872 tvb_fcwwn_to_str (tvb
, offset
));
875 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_ipnode
, tvb
, offset
,
882 dissect_fcdns_gpnnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
884 int offset
= 16; /* past the fc_ct header */
889 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
,
891 tvb_fcwwn_to_str (tvb
, offset
));
895 islast
= tvb_get_guint8 (tvb
, offset
);
896 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
898 tvb_fc_to_str (tvb
, offset
+1));
899 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_pname
,
901 tvb_fcwwn_to_str (tvb
, offset
+8));
903 } while (!(islast
& 0x80));
909 dissect_fcdns_gsnnnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
911 int offset
= 16; /* past the fc_ct header */
916 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
,
918 tvb_fcwwn_to_str (tvb
, offset
));
921 len
= tvb_get_guint8 (tvb
, offset
);
922 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_snamelen
, tvb
,
923 offset
, 1, ENC_BIG_ENDIAN
);
924 proto_tree_add_item (req_tree
, &hfi_fcdns_rply_sname
, tvb
,
925 offset
+1, len
, ENC_ASCII
|ENC_NA
);
931 dissect_fcdns_gidft (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
933 int offset
= 16; /* past the fc_ct header */
938 proto_tree_add_item (req_tree
, &hfi_fcdns_req_domainscope
,
939 tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
940 proto_tree_add_item (req_tree
, &hfi_fcdns_req_areascope
,
941 tvb
, offset
+2, 1, ENC_BIG_ENDIAN
);
942 proto_tree_add_item (req_tree
, &hfi_fcdns_req_fc4type
,
943 tvb
, offset
+3, 1, ENC_BIG_ENDIAN
);
947 islast
= tvb_get_guint8 (tvb
, offset
);
948 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
950 tvb_fc_to_str (tvb
, offset
+1));
952 } while (!(islast
& 0x80));
958 dissect_fcdns_gpnft (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
960 int offset
= 16; /* past the fc_ct header */
965 proto_tree_add_item (req_tree
, &hfi_fcdns_req_domainscope
,
966 tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
967 proto_tree_add_item (req_tree
, &hfi_fcdns_req_areascope
,
968 tvb
, offset
+2, 1, ENC_BIG_ENDIAN
);
969 proto_tree_add_item (req_tree
, &hfi_fcdns_req_fc4type
,
970 tvb
, offset
+3, 1, ENC_BIG_ENDIAN
);
974 islast
= tvb_get_guint8 (tvb
, offset
);
975 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
977 tvb_fc_to_str (tvb
, offset
+1));
978 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_pname
,
980 tvb_fcwwn_to_str (tvb
, offset
+8));
982 } while (!(islast
& 0x80));
988 dissect_fcdns_gnnft (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
990 int offset
= 16; /* past the fc_ct header */
995 proto_tree_add_item (req_tree
, &hfi_fcdns_req_domainscope
,
996 tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
997 proto_tree_add_item (req_tree
, &hfi_fcdns_req_areascope
,
998 tvb
, offset
+2, 1, ENC_BIG_ENDIAN
);
999 proto_tree_add_item (req_tree
, &hfi_fcdns_req_fc4type
,
1000 tvb
, offset
+3, 1, ENC_BIG_ENDIAN
);
1004 islast
= tvb_get_guint8 (tvb
, offset
);
1005 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
1007 tvb_fc_to_str (tvb
, offset
+1));
1008 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_nname
,
1010 tvb_fcwwn_to_str (tvb
, offset
+8));
1012 } while (!(islast
& 0x80));
1018 dissect_fcdns_gidpt (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1020 int offset
= 16; /* past the fc_ct header */
1025 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ptype
,
1026 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1027 proto_tree_add_item (req_tree
, &hfi_fcdns_req_domainscope
,
1028 tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
1029 proto_tree_add_item (req_tree
, &hfi_fcdns_req_areascope
,
1030 tvb
, offset
+2, 1, ENC_BIG_ENDIAN
);
1034 islast
= tvb_get_guint8 (tvb
, offset
);
1035 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
1037 tvb_fc_to_str (tvb
, offset
+1));
1039 } while (!(islast
& 0x80));
1045 dissect_fcdns_gidipp (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1047 int offset
= 16; /* past the fc_ct header */
1052 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ip
, tvb
, offset
,
1057 islast
= tvb_get_guint8 (tvb
, offset
);
1058 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
1060 tvb_fc_to_str (tvb
, offset
+1));
1062 } while (!(islast
& 0x80));
1068 dissect_fcdns_gidff (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1070 int offset
= 16; /* past the fc_ct header */
1075 proto_tree_add_item (req_tree
, &hfi_fcdns_req_domainscope
, tvb
,
1076 offset
+1, 1, ENC_BIG_ENDIAN
);
1077 proto_tree_add_item (req_tree
, &hfi_fcdns_req_areascope
, tvb
,
1078 offset
+2, 1, ENC_BIG_ENDIAN
);
1079 dissect_fc4features_and_type(req_tree
, tvb
, offset
+6);
1083 islast
= tvb_get_guint8 (tvb
, offset
);
1084 proto_tree_add_string (req_tree
, &hfi_fcdns_rply_portid
,
1086 tvb_fc_to_str (tvb
, offset
+1));
1088 } while (!(islast
& 0x80));
1094 dissect_fcdns_rpnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1096 int offset
= 16; /* past the fc_ct header */
1100 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
,
1102 tvb_fc_to_str (tvb
, offset
+1));
1103 proto_tree_add_string (req_tree
, &hfi_fcdns_req_pname
, tvb
,
1105 tvb_fcwwn_to_str (tvb
, offset
+4));
1111 dissect_fcdns_rnnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1113 int offset
= 16; /* past the fc_ct header */
1117 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
,
1119 tvb_fc_to_str (tvb
, offset
+1));
1120 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
,
1122 tvb_fcwwn_to_str (tvb
, offset
+4));
1128 dissect_fcdns_rcsid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1130 int offset
= 16; /* past the fc_ct header */
1132 if (req_tree
&& isreq
) {
1133 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1135 tvb_fc_to_str (tvb
, offset
+1));
1136 dissect_cos_flags(req_tree
, tvb
, offset
+4, &hfi_fcdns_req_cos
);
1141 dissect_fcdns_rptid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1143 int offset
= 16; /* past the fc_ct header */
1145 if (req_tree
&& isreq
) {
1146 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1148 tvb_fc_to_str (tvb
, offset
+1));
1149 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ptype
, tvb
,
1150 offset
+4, 1, ENC_BIG_ENDIAN
);
1155 dissect_fcdns_rftid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1157 int offset
= 16; /* past the fc_ct header */
1159 if (req_tree
&& isreq
) {
1160 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1162 tvb_fc_to_str (tvb
, offset
+1));
1163 dissect_fc4type(req_tree
, tvb
, offset
+4, &hfi_fcdns_req_fc4types
);
1168 dissect_fcdns_rspnid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1170 int offset
= 16; /* past the fc_ct header */
1173 if (req_tree
&& isreq
) {
1174 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1176 tvb_fc_to_str (tvb
, offset
+1));
1177 proto_tree_add_item (req_tree
, &hfi_fcdns_req_spnamelen
, tvb
,
1178 offset
+4, 1, ENC_BIG_ENDIAN
);
1179 len
= tvb_get_guint8 (tvb
, offset
+4);
1181 proto_tree_add_item (req_tree
, &hfi_fcdns_req_spname
, tvb
, offset
+5,
1182 len
, ENC_ASCII
|ENC_NA
);
1187 dissect_fcdns_rippid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1189 int offset
= 16; /* past the fc_ct header */
1191 if (req_tree
&& isreq
) {
1192 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1194 tvb_fc_to_str (tvb
, offset
+1));
1195 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ip
, tvb
,
1196 offset
+4, 16, ENC_NA
);
1201 dissect_fcdns_rfdid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1203 int offset
= 16; /* past the fc_ct header */
1206 if (req_tree
&& isreq
) {
1207 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
,
1209 tvb_fc_to_str (tvb
, offset
+1));
1210 dissect_fc4type(req_tree
, tvb
, offset
+4, &hfi_fcdns_req_fc4types
);
1213 len
= tvb_reported_length_remaining (tvb
, offset
);
1216 proto_tree_add_item (req_tree
, &hfi_fcdns_req_fdesclen
, tvb
, offset
,
1218 proto_tree_add_item (req_tree
, &hfi_fcdns_req_fdesc
, tvb
, offset
+1,
1219 len
, ENC_ASCII
|ENC_NA
);
1227 dissect_fcdns_rffid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1229 int offset
= 16; /* past the fc_ct header */
1231 if (req_tree
&& isreq
) {
1232 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
, offset
+1, 3,
1233 tvb_fc_to_str (tvb
, offset
+1));
1234 dissect_fc4features_and_type(req_tree
, tvb
, offset
+6);
1239 dissect_fcdns_ripnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1241 int offset
= 16; /* past the fc_ct header */
1243 if (req_tree
&& isreq
) {
1244 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
, offset
, 8,
1245 tvb_fcwwn_to_str (tvb
, offset
));
1246 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ip
, tvb
, offset
+8, 16, ENC_NA
);
1251 dissect_fcdns_rsnnnn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1253 int offset
= 16; /* past the fc_ct header */
1256 if (req_tree
&& isreq
) {
1257 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
, offset
, 8,
1258 tvb_fcwwn_to_str (tvb
, offset
));
1259 len
= tvb_get_guint8 (tvb
, offset
+8);
1261 proto_tree_add_item (req_tree
, &hfi_fcdns_req_snamelen
, tvb
, offset
+8,
1263 proto_tree_add_item (req_tree
, &hfi_fcdns_req_sname
, tvb
, offset
+9,
1264 len
, ENC_ASCII
|ENC_NA
);
1269 dissect_fcdns_daid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1271 int offset
= 16; /* past the fc_ct header */
1273 if (req_tree
&& isreq
) {
1274 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
, offset
+1, 3,
1275 tvb_fc_to_str (tvb
, offset
+1));
1280 zonenm_to_str (tvbuff_t
*tvb
, gint offset
)
1282 int len
= tvb_get_guint8 (tvb
, offset
);
1283 return tvb_get_string (wmem_packet_scope(), tvb
, offset
+4, len
);
1287 dissect_fcdns_zone_mbr (tvbuff_t
*tvb
, proto_tree
*zmbr_tree
, int offset
)
1294 mbrtype
= tvb_get_guint8 (tvb
, offset
);
1295 proto_tree_add_uint (zmbr_tree
, &hfi_fcdns_zone_mbrtype
, tvb
,
1296 offset
, 1, mbrtype
);
1297 proto_tree_add_text (zmbr_tree
, tvb
, offset
+2, 1, "Flags: 0x%x",
1298 tvb_get_guint8 (tvb
, offset
+2));
1299 idlen
= tvb_get_guint8 (tvb
, offset
+3);
1300 proto_tree_add_text (zmbr_tree
, tvb
, offset
+3, 1,
1301 "Identifier Length: %d", idlen
);
1303 case FC_SWILS_ZONEMBR_WWN
:
1304 proto_tree_add_string (zmbr_tree
, &hfi_fcdns_zone_mbrid
, tvb
,
1306 tvb_fcwwn_to_str (tvb
, offset
+4));
1308 case FC_SWILS_ZONEMBR_DP
:
1309 g_snprintf(dpbuf
, sizeof(dpbuf
), "0x%08x", tvb_get_ntohl (tvb
, offset
+4));
1310 proto_tree_add_string (zmbr_tree
, &hfi_fcdns_zone_mbrid
, tvb
,
1311 offset
+4, 4, dpbuf
);
1313 case FC_SWILS_ZONEMBR_FCID
:
1314 proto_tree_add_string (zmbr_tree
, &hfi_fcdns_zone_mbrid
, tvb
,
1316 tvb_fc_to_str (tvb
, offset
+5));
1318 case FC_SWILS_ZONEMBR_ALIAS
:
1319 str
= zonenm_to_str (tvb
, offset
+4);
1320 proto_tree_add_string (zmbr_tree
, &hfi_fcdns_zone_mbrid
, tvb
,
1321 offset
+4, idlen
, str
);
1324 proto_tree_add_string (zmbr_tree
, &hfi_fcdns_zone_mbrid
, tvb
,
1326 "Unknown member type format");
1332 dissect_fcdns_swils_entries (tvbuff_t
*tvb
, proto_tree
*tree
, int offset
)
1337 numrec
= tvb_get_ntohl (tvb
, offset
);
1340 proto_tree_add_text (tree
, tvb
, offset
, 4, "Number of Entries: %d",
1344 for (i
= 0; i
< numrec
; i
++) {
1345 objfmt
= tvb_get_guint8 (tvb
, offset
);
1347 proto_tree_add_item (tree
, &hfi_fcdns_sw2_objfmt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1348 proto_tree_add_string (tree
, &hfi_fcdns_rply_ownerid
, tvb
, offset
+1,
1349 3, fc_to_str (tvb_get_string (wmem_packet_scope(), tvb
, offset
+1,
1351 proto_tree_add_item (tree
, &hfi_fcdns_rply_ptype
, tvb
, offset
+4,
1353 proto_tree_add_string (tree
, &hfi_fcdns_rply_portid
, tvb
, offset
+5, 3,
1354 tvb_fc_to_str (tvb
, offset
+5));
1355 proto_tree_add_string (tree
, &hfi_fcdns_rply_pname
, tvb
, offset
+8, 8,
1356 tvb_fcwwn_to_str (tvb
, offset
+8));
1358 if (!(objfmt
& 0x1)) {
1359 len
= tvb_get_guint8 (tvb
, offset
);
1360 proto_tree_add_item (tree
, &hfi_fcdns_rply_spnamelen
, tvb
,
1361 offset
, 1, ENC_BIG_ENDIAN
);
1362 proto_tree_add_item (tree
, &hfi_fcdns_rply_spname
, tvb
,
1363 offset
+1, len
, ENC_ASCII
|ENC_NA
);
1366 proto_tree_add_string (tree
, &hfi_fcdns_rply_nname
, tvb
, offset
, 8,
1367 tvb_fcwwn_to_str (tvb
, offset
));
1369 if (!(objfmt
& 0x1)) {
1370 len
= tvb_get_guint8 (tvb
, offset
);
1371 proto_tree_add_item (tree
, &hfi_fcdns_rply_snamelen
, tvb
,
1372 offset
, 1, ENC_BIG_ENDIAN
);
1373 proto_tree_add_item (tree
, &hfi_fcdns_rply_sname
, tvb
,
1374 offset
+1, len
, ENC_ASCII
|ENC_NA
);
1377 proto_tree_add_item (tree
, &hfi_fcdns_rply_ipa
, tvb
, offset
, 8, ENC_NA
);
1378 proto_tree_add_item (tree
, &hfi_fcdns_rply_ipnode
, tvb
, offset
+8, 16,
1380 dissect_cos_flags(tree
, tvb
, offset
+24, &hfi_fcdns_reply_cos
);
1381 dissect_fc4type(tree
, tvb
, offset
+28, &hfi_fcdns_rply_gft
);
1382 proto_tree_add_item (tree
, &hfi_fcdns_rply_ipport
, tvb
, offset
+60,
1384 proto_tree_add_string (tree
, &hfi_fcdns_rply_fpname
, tvb
, offset
+76,
1385 8, tvb_fcwwn_to_str (tvb
, offset
+76));
1386 proto_tree_add_string (tree
, &hfi_fcdns_rply_hrdaddr
, tvb
, offset
+85,
1387 3, tvb_fc_to_str (tvb
, offset
+85));
1390 dissect_fc4features(tree
, tvb
, offset
);
1391 if (tvb_get_guint8 (tvb
, offset
+129)) {
1392 proto_tree_add_item (tree
, &hfi_fcdns_rply_fc4type
, tvb
,
1393 offset
+128, 1, ENC_BIG_ENDIAN
);
1394 proto_tree_add_item (tree
, &hfi_fcdns_num_fc4desc
, tvb
,
1395 offset
+129, 1, ENC_BIG_ENDIAN
);
1396 len
= tvb_get_guint8 (tvb
, offset
+132);
1397 proto_tree_add_item (tree
, &hfi_fcdns_rply_fc4desclen
, tvb
,
1398 offset
+132, 1, ENC_BIG_ENDIAN
);
1399 proto_tree_add_item (tree
, &hfi_fcdns_rply_fc4desc
, tvb
,
1400 offset
+133, len
, ENC_NA
);
1403 proto_tree_add_item (tree
, &hfi_fcdns_num_fc4desc
, tvb
,
1404 offset
+129, 1, ENC_BIG_ENDIAN
);
1406 offset
+= 388; /* FC4 desc is 260 bytes, maybe padded */
1413 dissect_fcdns_geid (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1415 int offset
= 16; /* past the fc_ct header */
1419 proto_tree_add_string (req_tree
, &hfi_fcdns_req_portid
, tvb
, offset
+1,
1420 3, tvb_fc_to_str (tvb
, offset
+1));
1424 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1429 dissect_fcdns_gepn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1431 int offset
= 16; /* past the fc_ct header */
1434 proto_tree_add_string (req_tree
, &hfi_fcdns_req_pname
, tvb
, offset
, 8,
1435 tvb_fcwwn_to_str (tvb
, offset
));
1439 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1444 dissect_fcdns_genn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1446 int offset
= 16; /* past the fc_ct header */
1450 proto_tree_add_string (req_tree
, &hfi_fcdns_req_nname
, tvb
, offset
, 8,
1451 tvb_fcwwn_to_str (tvb
, offset
));
1455 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1460 dissect_fcdns_geip (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1462 int offset
= 16; /* past the fc_ct header */
1466 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ip
, tvb
, offset
, 16, ENC_NA
);
1470 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1475 dissect_fcdns_geft (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1477 int offset
= 16; /* past the fc_ct header */
1481 dissect_fc4type(req_tree
, tvb
, offset
, &hfi_fcdns_fc4type
);
1485 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1490 dissect_fcdns_gept (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1492 int offset
= 16; /* past the fc_ct header */
1496 proto_tree_add_item (req_tree
, &hfi_fcdns_req_ptype
, tvb
, offset
+3,
1501 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1506 dissect_fcdns_gezm (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1508 int offset
= 16; /* past the fc_ct header */
1512 dissect_fcdns_zone_mbr (tvb
, req_tree
, offset
);
1516 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1521 dissect_fcdns_gezn (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1523 int offset
= 16; /* past the fc_ct header */
1528 str_len
= tvb_get_guint8 (tvb
, offset
);
1529 proto_tree_add_text (req_tree
, tvb
, offset
, 1, "Name Length: %d",
1531 proto_tree_add_item (req_tree
, &hfi_fcdns_zonenm
, tvb
, offset
+3,
1532 str_len
, ENC_ASCII
|ENC_NA
);
1536 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1541 dissect_fcdns_geipp (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1543 int offset
= 16; /* past the fc_ct header */
1547 proto_tree_add_item (req_tree
, &hfi_fcdns_portip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1551 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1556 dissect_fcdns_geff (tvbuff_t
*tvb
, proto_tree
*req_tree
, gboolean isreq
)
1558 int offset
= 16; /* past the fc_ct header */
1562 dissect_fc4features(req_tree
, tvb
, offset
);
1566 dissect_fcdns_swils_entries (tvb
, req_tree
, offset
);
1571 dissect_fcdns_rjt (tvbuff_t
*tvb
, proto_tree
*req_tree
)
1576 proto_tree_add_item (req_tree
, &hfi_fcdns_reason
, tvb
, offset
+13, 1, ENC_BIG_ENDIAN
);
1577 proto_tree_add_item (req_tree
, &hfi_fcdns_rjtdetail
, tvb
, offset
+14, 1,
1579 proto_tree_add_item (req_tree
, &hfi_fcdns_vendor
, tvb
, offset
+15, 1, ENC_BIG_ENDIAN
);
1584 dissect_fcdns (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1586 /* Set up structures needed to add the protocol subtree and manage it */
1587 proto_item
*ti
= NULL
;
1588 proto_tree
*fcdns_tree
= NULL
;
1593 fc_ct_preamble cthdr
;
1594 conversation_t
*conversation
;
1595 fcdns_conv_data_t
*cdata
;
1596 fcdns_conv_key_t ckey
, *req_key
;
1598 tvb_memcpy (tvb
, (guint8
*)&cthdr
, offset
, FCCT_PRMBL_SIZE
);
1599 cthdr
.revision
= tvb_get_guint8 (tvb
, offset
);
1600 cthdr
.in_id
= tvb_get_ntoh24 (tvb
, offset
+1);
1601 cthdr
.opcode
= g_ntohs (cthdr
.opcode
);
1602 opcode
= cthdr
.opcode
;
1603 cthdr
.maxres_size
= g_ntohs (cthdr
.maxres_size
);
1605 /* Determine the type of server the request/response is for */
1606 if (cthdr
.gstype
== FCCT_GSTYPE_DIRSVC
)
1607 col_set_str (pinfo
->cinfo
, COL_PROTOCOL
, "dNS");
1609 col_set_str (pinfo
->cinfo
, COL_PROTOCOL
, "Unzoned NS");
1612 if (cthdr
.gstype
== FCCT_GSTYPE_DIRSVC
) {
1613 ti
= proto_tree_add_protocol_format (tree
, hfi_fcdns
->id
, tvb
, 0,
1616 fcdns_tree
= proto_item_add_subtree (ti
, ett_fcdns
);
1619 ti
= proto_tree_add_protocol_format (tree
, hfi_fcdns
->id
, tvb
, 0,
1622 fcdns_tree
= proto_item_add_subtree (ti
, ett_fcdns
);
1626 if ((opcode
!= FCCT_MSG_ACC
) && (opcode
!= FCCT_MSG_RJT
)) {
1627 conversation
= find_conversation (pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
,
1628 pinfo
->ptype
, pinfo
->oxid
,
1629 pinfo
->rxid
, NO_PORT2
);
1630 if (!conversation
) {
1631 conversation
= conversation_new (pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
,
1632 pinfo
->ptype
, pinfo
->oxid
,
1633 pinfo
->rxid
, NO_PORT2
);
1636 ckey
.conv_idx
= conversation
->index
;
1638 cdata
= (fcdns_conv_data_t
*)g_hash_table_lookup (fcdns_req_hash
,
1641 /* Since we never free the memory used by an exchange, this maybe a
1642 * case of another request using the same exchange as a previous
1645 cdata
->opcode
= opcode
;
1648 req_key
= wmem_new(wmem_file_scope(), fcdns_conv_key_t
);
1649 req_key
->conv_idx
= conversation
->index
;
1651 cdata
= wmem_new(wmem_file_scope(), fcdns_conv_data_t
);
1652 cdata
->opcode
= opcode
;
1654 g_hash_table_insert (fcdns_req_hash
, req_key
, cdata
);
1656 col_add_str (pinfo
->cinfo
, COL_INFO
, val_to_str (opcode
, fc_dns_opcode_val
,
1660 /* Opcode is ACC or RJT */
1661 conversation
= find_conversation (pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
,
1662 pinfo
->ptype
, pinfo
->oxid
,
1663 pinfo
->rxid
, NO_PORT2
);
1665 if (!conversation
) {
1666 if (opcode
== FCCT_MSG_ACC
) {
1667 col_add_str (pinfo
->cinfo
, COL_INFO
,
1668 val_to_str (opcode
, fc_dns_opcode_val
,
1670 /* No record of what this accept is for. Can't decode */
1671 proto_tree_add_text (fcdns_tree
, tvb
, 0, -1,
1672 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1677 ckey
.conv_idx
= conversation
->index
;
1679 cdata
= (fcdns_conv_data_t
*)g_hash_table_lookup (fcdns_req_hash
, &ckey
);
1681 if (cdata
!= NULL
) {
1682 if (opcode
== FCCT_MSG_ACC
) {
1683 opcode
= cdata
->opcode
;
1686 failed_opcode
= cdata
->opcode
;
1689 if (opcode
!= FCCT_MSG_RJT
) {
1690 col_add_fstr (pinfo
->cinfo
, COL_INFO
, "ACC (%s)",
1691 val_to_str (opcode
, fc_dns_opcode_val
,
1695 col_add_fstr (pinfo
->cinfo
, COL_INFO
, "RJT (%s)",
1696 val_to_str (failed_opcode
,
1702 if ((cdata
== NULL
) && (opcode
!= FCCT_MSG_RJT
)) {
1703 /* No record of what this accept is for. Can't decode */
1704 proto_tree_add_text (fcdns_tree
, tvb
, 0, -1,
1705 "No record of Exchg. Unable to decode MSG_ACC/RJT");
1713 proto_tree_add_item (fcdns_tree
, &hfi_fcdns_opcode
, tvb
, offset
+8, 2, ENC_BIG_ENDIAN
);
1714 proto_tree_add_item (fcdns_tree
, &hfi_fcdns_maxres_size
, tvb
, offset
+10,
1720 dissect_fcdns_rjt (tvb
, fcdns_tree
);
1723 dissect_fcdns_ganxt (tvb
, fcdns_tree
, isreq
);
1726 dissect_fcdns_gpnid (tvb
, fcdns_tree
, isreq
);
1729 dissect_fcdns_gnnid (tvb
, fcdns_tree
, isreq
);
1732 dissect_fcdns_gcsid (tvb
, fcdns_tree
, isreq
);
1735 dissect_fcdns_gftid (tvb
, fcdns_tree
, isreq
);
1738 dissect_fcdns_gspnid (tvb
, fcdns_tree
, isreq
);
1741 dissect_fcdns_gptid (tvb
, fcdns_tree
, isreq
);
1744 dissect_fcdns_gfpnid (tvb
, fcdns_tree
, isreq
);
1747 dissect_fcdns_gfdid (tvb
, fcdns_tree
, isreq
);
1750 dissect_fcdns_gffid (tvb
, fcdns_tree
, isreq
);
1753 dissect_fcdns_gidpn (tvb
, fcdns_tree
, isreq
);
1756 dissect_fcdns_gipppn (tvb
, fcdns_tree
, isreq
);
1759 dissect_fcdns_gidnn (tvb
, fcdns_tree
, isreq
);
1762 dissect_fcdns_gpnnn (tvb
, fcdns_tree
, isreq
);
1765 dissect_fcdns_gipnn (tvb
, fcdns_tree
, isreq
);
1768 dissect_fcdns_gsnnnn (tvb
, fcdns_tree
, isreq
);
1771 dissect_fcdns_gidft (tvb
, fcdns_tree
, isreq
);
1774 dissect_fcdns_gpnft (tvb
, fcdns_tree
, isreq
);
1777 dissect_fcdns_gnnft (tvb
, fcdns_tree
, isreq
);
1780 dissect_fcdns_gidpt (tvb
, fcdns_tree
, isreq
);
1783 dissect_fcdns_gidipp (tvb
, fcdns_tree
, isreq
);
1786 dissect_fcdns_gidff (tvb
, fcdns_tree
, isreq
);
1789 dissect_fcdns_rpnid (tvb
, fcdns_tree
, isreq
);
1792 dissect_fcdns_rnnid (tvb
, fcdns_tree
, isreq
);
1795 dissect_fcdns_rcsid (tvb
, fcdns_tree
, isreq
);
1798 dissect_fcdns_rptid (tvb
, fcdns_tree
, isreq
);
1801 dissect_fcdns_rftid (tvb
, fcdns_tree
, isreq
);
1804 dissect_fcdns_rspnid (tvb
, fcdns_tree
, isreq
);
1807 dissect_fcdns_rippid (tvb
, fcdns_tree
, isreq
);
1810 dissect_fcdns_rfdid (tvb
, fcdns_tree
, isreq
);
1813 dissect_fcdns_rffid (tvb
, fcdns_tree
, isreq
);
1816 dissect_fcdns_ripnn (tvb
, fcdns_tree
, isreq
);
1819 dissect_fcdns_rsnnnn (tvb
, fcdns_tree
, isreq
);
1822 dissect_fcdns_daid (tvb
, fcdns_tree
, isreq
);
1825 dissect_fcdns_geid (tvb
, fcdns_tree
, isreq
);
1828 dissect_fcdns_gepn (tvb
, fcdns_tree
, isreq
);
1831 dissect_fcdns_genn (tvb
, fcdns_tree
, isreq
);
1834 dissect_fcdns_geip (tvb
, fcdns_tree
, isreq
);
1837 dissect_fcdns_geft (tvb
, fcdns_tree
, isreq
);
1840 dissect_fcdns_gept (tvb
, fcdns_tree
, isreq
);
1843 dissect_fcdns_gezm (tvb
, fcdns_tree
, isreq
);
1846 dissect_fcdns_gezn (tvb
, fcdns_tree
, isreq
);
1849 dissect_fcdns_geipp (tvb
, fcdns_tree
, isreq
);
1852 dissect_fcdns_geff (tvb
, fcdns_tree
, isreq
);
1859 /* Register the protocol with Wireshark */
1862 proto_register_fcdns (void)
1864 #ifndef HAVE_HFI_SECTION_INIT
1865 static header_field_info
*hfi
[] = {
1866 /* &hfi_fcdns_gssubtype */
1868 &hfi_fcdns_req_portid
,
1869 &hfi_fcdns_rply_pname
,
1870 &hfi_fcdns_rply_nname
,
1871 &hfi_fcdns_rply_snamelen
,
1872 &hfi_fcdns_rply_sname
,
1873 &hfi_fcdns_rply_ptype
,
1874 &hfi_fcdns_rply_fpname
,
1875 &hfi_fcdns_req_pname
,
1876 &hfi_fcdns_rply_portid
,
1877 &hfi_fcdns_req_nname
,
1878 &hfi_fcdns_req_domainscope
,
1879 &hfi_fcdns_req_areascope
,
1880 &hfi_fcdns_req_fc4type
,
1881 &hfi_fcdns_req_ptype
,
1883 &hfi_fcdns_rply_fc4type
,
1884 &hfi_fcdns_req_snamelen
,
1885 &hfi_fcdns_req_sname
,
1886 &hfi_fcdns_rply_spnamelen
,
1887 &hfi_fcdns_rply_spname
,
1888 &hfi_fcdns_rply_ipa
,
1889 &hfi_fcdns_rply_ipnode
,
1890 &hfi_fcdns_rply_ipport
,
1891 &hfi_fcdns_rply_fc4desclen
,
1892 &hfi_fcdns_rply_fc4desc
,
1893 &hfi_fcdns_rply_hrdaddr
,
1894 &hfi_fcdns_req_fdesclen
,
1895 &hfi_fcdns_req_fdesc
,
1896 &hfi_fcdns_req_spnamelen
,
1897 &hfi_fcdns_req_spname
,
1899 &hfi_fcdns_rjtdetail
,
1901 &hfi_fcdns_zone_mbrtype
,
1902 &hfi_fcdns_zone_mbrid
,
1905 &hfi_fcdns_sw2_objfmt
,
1906 &hfi_fcdns_num_fc4desc
,
1907 &hfi_fcdns_rply_ownerid
,
1908 &hfi_fcdns_maxres_size
,
1909 &hfi_fcdns_reply_cos
,
1917 &hfi_fcdns_fc4type_llcsnap
,
1918 &hfi_fcdns_fc4type_ip
,
1919 &hfi_fcdns_fc4type_fcp
,
1920 &hfi_fcdns_fc4type_swils
,
1921 &hfi_fcdns_fc4type_snmp
,
1922 &hfi_fcdns_fc4type_gs3
,
1923 &hfi_fcdns_fc4type_vi
,
1924 &hfi_fcdns_rply_gft
,
1925 &hfi_fcdns_req_fc4types
,
1927 &hfi_fcdns_fc4features
,
1928 &hfi_fcdns_fc4features_i
,
1929 &hfi_fcdns_fc4features_t
,
1933 static gint
*ett
[] = {
1942 proto_fcdns
= proto_register_protocol("Fibre Channel Name Server",
1944 hfi_fcdns
= proto_registrar_get_nth(proto_fcdns
);
1946 proto_register_fields(proto_fcdns
, hfi
, array_length(hfi
));
1947 proto_register_subtree_array(ett
, array_length(ett
));
1948 register_init_routine (&fcdns_init_protocol
);
1950 dns_handle
= create_dissector_handle (dissect_fcdns
, proto_fcdns
);
1954 proto_reg_handoff_fcdns (void)
1956 dissector_add_uint("fcct.server", FCCT_GSRVR_DNS
, dns_handle
);
1957 dissector_add_uint("fcct.server", FCCT_GSRVR_UNS
, dns_handle
);