HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-fcdns.c
bloba3988e7f12cb02677753a6bb389e6245dc996fd2
1 /* packet-fc-dns.c
2 * Routines for FC distributed Name Server (dNS)
3 * Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
5 * $Id$
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
28 #include "config.h"
30 #ifdef HAVE_NETINET_IN_H
31 # include <netinet/in.h>
32 #endif
34 #include <glib.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"
48 * See FC-GS-2.
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)
59 #if 0
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};
63 #endif
65 static header_field_info hfi_fcdns_opcode FCDNS_HFI_INIT =
66 {"Opcode", "fcdns.opcode", FT_UINT16, BASE_HEX, VALS (fc_dns_opcode_val),
67 0x0, NULL, HFILL};
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,
79 NULL, HFILL};
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,
83 HFILL};
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,
87 HFILL};
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,
99 0x0, NULL, HFILL};
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,
107 0x0, NULL, HFILL};
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,
119 0x0, NULL, HFILL};
121 static header_field_info hfi_fcdns_req_pname FCDNS_HFI_INIT =
122 {"Port Name", "fcdns.req.portname", FT_STRING, BASE_NONE, NULL, 0x0,
123 NULL, HFILL};
125 static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT =
126 {"Port Identifier", "fcdns.rply.portid", FT_STRING, BASE_NONE, NULL,
127 0x0, NULL, HFILL};
129 static header_field_info hfi_fcdns_req_nname FCDNS_HFI_INIT =
130 {"Node Name", "fcdns.req.nname", FT_STRING, BASE_NONE, NULL, 0x0,
131 NULL, HFILL};
133 static header_field_info hfi_fcdns_req_domainscope FCDNS_HFI_INIT =
134 {"Domain ID Scope", "fcdns.req.domainid", FT_UINT8, BASE_HEX, NULL,
135 0x0, NULL, HFILL};
137 static header_field_info hfi_fcdns_req_areascope FCDNS_HFI_INIT =
138 {"Area ID Scope", "fcdns.req.areaid", FT_UINT8, BASE_HEX, NULL,
139 0x0, NULL, HFILL};
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,
159 0x0, NULL, HFILL};
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,
167 0x0, NULL, HFILL};
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,
175 0x0, NULL, HFILL};
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,
183 0x0, NULL, HFILL};
185 static header_field_info hfi_fcdns_rply_ipport FCDNS_HFI_INIT =
186 {"Port IP Address", "fcdns.rply.ipport", FT_IPv6, BASE_NONE, NULL,
187 0x0, NULL, HFILL};
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,
195 0x0, NULL, HFILL};
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,
203 0x0, NULL, HFILL};
205 static header_field_info hfi_fcdns_req_ip FCDNS_HFI_INIT =
206 {"IP Address", "fcdns.req.ip", FT_IPv6, BASE_NONE, NULL, 0x0,
207 NULL, HFILL};
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,
219 0x0, NULL, HFILL};
221 static header_field_info hfi_fcdns_zonenm FCDNS_HFI_INIT =
222 {"Zone Name", "fcdns.zonename", FT_STRING, BASE_NONE, NULL, 0x0, NULL,
223 HFILL};
225 static header_field_info hfi_fcdns_portip FCDNS_HFI_INIT =
226 {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_NONE, NULL, 0x0,
227 NULL, HFILL};
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,
239 HFILL};
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 {
325 guint32 conv_idx;
326 } fcdns_conv_key_t;
328 typedef struct _fcdns_conv_data {
329 guint32 opcode;
330 } fcdns_conv_data_t;
332 static GHashTable *fcdns_req_hash = NULL;
335 * Hash Functions
337 static gint
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);
346 static guint
347 fcdns_hash (gconstpointer v)
349 const fcdns_conv_key_t *key = (const fcdns_conv_key_t *)v;
350 guint val;
352 val = key->conv_idx;
354 return val;
358 * Protocol initialization
360 static void
361 fcdns_init_protocol(void)
363 if (fcdns_req_hash)
364 g_hash_table_destroy(fcdns_req_hash);
366 fcdns_req_hash = g_hash_table_new(fcdns_hash, fcdns_equal);
370 static void
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;
375 guint32 flags;
377 flags = tvb_get_ntohl (tvb, offset);
378 if(parent_tree){
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);
386 if (flags&0x01){
387 proto_item_append_text(item, " F");
389 flags&=(~( 0x01 ));
391 proto_tree_add_boolean(tree, &hfi_fcdns_cos_1, tvb, offset, 4, flags);
392 if (flags&0x02){
393 proto_item_append_text(item, " 1");
395 flags&=(~( 0x02 ));
397 proto_tree_add_boolean(tree, &hfi_fcdns_cos_2, tvb, offset, 4, flags);
398 if (flags&0x04){
399 proto_item_append_text(item, " 2");
401 flags&=(~( 0x04 ));
403 proto_tree_add_boolean(tree, &hfi_fcdns_cos_3, tvb, offset, 4, flags);
404 if (flags&0x08){
405 proto_item_append_text(item, " 3");
407 flags&=(~( 0x08 ));
409 proto_tree_add_boolean(tree, &hfi_fcdns_cos_4, tvb, offset, 4, flags);
410 if (flags&0x10){
411 proto_item_append_text(item, " 4");
413 flags&=(~( 0x10 ));
415 proto_tree_add_boolean(tree, &hfi_fcdns_cos_6, tvb, offset, 4, flags);
416 if (flags&0x40){
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
427 static void
428 dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
430 proto_item *item=NULL;
431 proto_tree *tree=NULL;
432 guint8 flags, type;
434 flags = tvb_get_guint8(tvb, offset);
435 type = tvb_get_guint8(tvb, offset+1);
436 if(parent_tree){
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);
444 if (flags&0x02){
445 proto_item_append_text(item, " I");
447 flags&=(~( 0x02 ));
449 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
450 if (flags&0x01){
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
461 static void
462 dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
464 proto_item *item=NULL;
465 proto_tree *tree=NULL;
466 guint8 flags;
468 flags = tvb_get_guint8(tvb, offset);
469 if(parent_tree){
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);
476 if (flags&0x02){
477 proto_item_append_text(item, " I");
479 flags&=(~( 0x02 ));
481 proto_tree_add_boolean(tree, &hfi_fcdns_fc4features_t, tvb, offset, 1, flags);
482 if (flags&0x01){
483 proto_item_append_text(item, " T");
485 /*flags&=(~( 0x01 ));*/
490 /* Decodes LLC/SNAP, IP, FCP, VI, GS, SW_ILS types only */
491 static void
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;
496 guint32 flags;
498 if(parent_tree){
499 item=proto_tree_add_item(parent_tree, hfinfo, tvb, offset,
500 32, ENC_NA);
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);
507 if (flags&0x0100){
508 proto_item_append_text(item, " FCP");
510 flags&=(~( 0x0100 ));
512 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_ip, tvb, offset, 4, flags);
513 if (flags&0x0020){
514 proto_item_append_text(item, " IP");
516 flags&=(~( 0x0020 ));
518 proto_tree_add_boolean(tree, &hfi_fcdns_fc4type_llcsnap, tvb, offset, 4, flags);
519 if (flags&0x0010){
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);
528 if (flags&0x0010){
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);
534 if (flags&0x0004){
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);
540 if (flags&0x0001){
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);
549 if (flags&0x0001){
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 */
559 static void
560 dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset)
562 if (tree) {
563 proto_tree_add_string (tree, &hfi_fcdns_req_portid, tvb, offset, 3,
564 tvb_fc_to_str (tvb, offset));
568 static void
569 dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
571 int offset = 16; /* past the fc_ct header */
572 guint8 len;
574 if (req_tree) {
575 if (isreq) {
576 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
578 else {
579 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb, offset,
580 1, ENC_BIG_ENDIAN);
581 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
582 offset+1, 3,
583 tvb_fc_to_str (tvb, offset+1));
584 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb,
585 offset+4, 8,
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))
591 return;
593 if (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,
600 offset+268, 8,
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);
607 if (len) {
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,
632 offset+608, 8,
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,
637 offset+617, 3,
638 tvb_fc_to_str (tvb, offset+617));
644 static void
645 dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
647 int offset = 16; /* past the fc_ct header */
649 if (req_tree) {
650 if (isreq) {
651 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
653 else {
654 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb, offset,
655 8, tvb_fcwwn_to_str (tvb, offset));
660 static void
661 dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
663 int offset = 16; /* past the fc_ct header */
665 if (req_tree) {
666 if (isreq) {
667 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
669 else {
670 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb,
671 offset, 8,
672 tvb_fcwwn_to_str (tvb, offset));
677 static void
678 dissect_fcdns_gcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
680 int offset = 16; /* past the fc_ct header */
682 if (req_tree) {
683 if (isreq) {
684 dissect_fcdns_req_portid (tvb, req_tree, offset);
686 else {
687 dissect_cos_flags(req_tree, tvb, offset, &hfi_fcdns_reply_cos);
692 static void
693 dissect_fcdns_gftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
695 int offset = 16; /* past the fc_ct header */
697 if (req_tree) {
698 if (isreq) {
699 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
701 else {
702 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_rply_gft);
707 static void
708 dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
710 int offset = 16; /* past the fc_ct header */
711 guint8 len;
713 if (req_tree) {
714 if (isreq) {
715 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
717 else {
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);
727 static void
728 dissect_fcdns_gptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
730 int offset = 16; /* past the fc_ct header */
732 if (req_tree) {
733 if (isreq) {
734 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
736 else {
737 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ptype, tvb,
738 offset, 1, ENC_BIG_ENDIAN);
743 static void
744 dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
746 int offset = 16; /* past the fc_ct header */
748 if (req_tree) {
749 if (isreq) {
750 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
752 else {
753 proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb,
754 offset, 8,
755 tvb_fcwwn_to_str (tvb, offset));
761 static void
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;
767 if (req_tree) {
768 if (isreq) {
769 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
770 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_fc4type);
772 else {
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 */
781 offset += 256;
787 static void
788 dissect_fcdns_gffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
790 int offset = 16; /* past the fc_ct header */
792 if (req_tree) {
793 if (isreq) {
794 dissect_fcdns_req_portid (tvb, req_tree, offset+1);
796 else {
797 dissect_fc4features(req_tree, tvb, offset);
802 static void
803 dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
805 int offset = 16; /* past the fc_ct header */
807 if (req_tree) {
808 if (isreq) {
809 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
810 offset, 8,
811 tvb_fcwwn_to_str (tvb, offset));
813 else {
814 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb,
815 offset+1, 3,
816 tvb_fc_to_str (tvb, offset+1));
821 static void
822 dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
824 int offset = 16; /* past the fc_ct header */
826 if (req_tree) {
827 if (isreq) {
828 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
829 offset, 8,
830 tvb_fcwwn_to_str (tvb, offset));
832 else {
833 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb, offset,
834 16, ENC_NA);
839 static void
840 dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
842 int offset = 16; /* past the fc_ct header */
843 guint8 islast;
845 if (req_tree) {
846 if (isreq) {
847 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
848 offset, 8,
849 tvb_fcwwn_to_str (tvb, offset));
851 else {
852 do {
853 islast = tvb_get_guint8 (tvb, offset);
854 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
855 tvb, offset+1, 3,
856 tvb_fc_to_str (tvb, offset+1));
857 offset += 4;
858 } while (!(islast & 0x80));
863 static void
864 dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
866 int offset = 16; /* past the fc_ct header */
868 if (req_tree) {
869 if (isreq) {
870 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
871 offset, 8,
872 tvb_fcwwn_to_str (tvb, offset));
874 else {
875 proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb, offset,
876 16, ENC_NA);
881 static void
882 dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
884 int offset = 16; /* past the fc_ct header */
885 guint8 islast;
887 if (req_tree) {
888 if (isreq) {
889 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
890 offset, 8,
891 tvb_fcwwn_to_str (tvb, offset));
893 else {
894 do {
895 islast = tvb_get_guint8 (tvb, offset);
896 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
897 tvb, offset+1, 3,
898 tvb_fc_to_str (tvb, offset+1));
899 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
900 tvb, offset+8, 8,
901 tvb_fcwwn_to_str (tvb, offset+8));
902 offset += 16;
903 } while (!(islast & 0x80));
908 static void
909 dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
911 int offset = 16; /* past the fc_ct header */
912 guint8 len;
914 if (req_tree) {
915 if (isreq) {
916 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
917 offset, 8,
918 tvb_fcwwn_to_str (tvb, offset));
920 else {
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);
930 static void
931 dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
933 int offset = 16; /* past the fc_ct header */
934 guint8 islast;
936 if (req_tree) {
937 if (isreq) {
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);
945 else {
946 do {
947 islast = tvb_get_guint8 (tvb, offset);
948 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
949 tvb, offset+1, 3,
950 tvb_fc_to_str (tvb, offset+1));
951 offset += 4;
952 } while (!(islast & 0x80));
957 static void
958 dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
960 int offset = 16; /* past the fc_ct header */
961 guint8 islast;
963 if (req_tree) {
964 if (isreq) {
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);
972 else {
973 do {
974 islast = tvb_get_guint8 (tvb, offset);
975 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
976 tvb, offset+1, 3,
977 tvb_fc_to_str (tvb, offset+1));
978 proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname,
979 tvb, offset+4, 8,
980 tvb_fcwwn_to_str (tvb, offset+8));
981 offset += 16;
982 } while (!(islast & 0x80));
987 static void
988 dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
990 int offset = 16; /* past the fc_ct header */
991 guint8 islast;
993 if (req_tree) {
994 if (isreq) {
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);
1002 else {
1003 do {
1004 islast = tvb_get_guint8 (tvb, offset);
1005 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1006 tvb, offset+1, 3,
1007 tvb_fc_to_str (tvb, offset+1));
1008 proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname,
1009 tvb, offset+4, 8,
1010 tvb_fcwwn_to_str (tvb, offset+8));
1011 offset += 16;
1012 } while (!(islast & 0x80));
1017 static void
1018 dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1020 int offset = 16; /* past the fc_ct header */
1021 guint8 islast = 0;
1023 if (req_tree) {
1024 if (isreq) {
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);
1032 else {
1033 do {
1034 islast = tvb_get_guint8 (tvb, offset);
1035 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1036 tvb, offset+1, 3,
1037 tvb_fc_to_str (tvb, offset+1));
1038 offset += 4;
1039 } while (!(islast & 0x80));
1044 static void
1045 dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1047 int offset = 16; /* past the fc_ct header */
1048 guint8 islast;
1050 if (req_tree) {
1051 if (isreq) {
1052 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset,
1053 16, ENC_NA);
1055 else {
1056 do {
1057 islast = tvb_get_guint8 (tvb, offset);
1058 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1059 tvb, offset+1, 3,
1060 tvb_fc_to_str (tvb, offset+1));
1061 offset += 4;
1062 } while (!(islast & 0x80));
1067 static void
1068 dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1070 int offset = 16; /* past the fc_ct header */
1071 guint8 islast;
1073 if (req_tree) {
1074 if (isreq) {
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);
1081 else {
1082 do {
1083 islast = tvb_get_guint8 (tvb, offset);
1084 proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid,
1085 tvb, offset+1, 3,
1086 tvb_fc_to_str (tvb, offset+1));
1087 offset += 4;
1088 } while (!(islast & 0x80));
1093 static void
1094 dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1096 int offset = 16; /* past the fc_ct header */
1098 if (req_tree) {
1099 if (isreq) {
1100 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1101 tvb, offset+1, 3,
1102 tvb_fc_to_str (tvb, offset+1));
1103 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb,
1104 offset+4, 8,
1105 tvb_fcwwn_to_str (tvb, offset+4));
1110 static void
1111 dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1113 int offset = 16; /* past the fc_ct header */
1115 if (req_tree) {
1116 if (isreq) {
1117 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid,
1118 tvb, offset+1, 3,
1119 tvb_fc_to_str (tvb, offset+1));
1120 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb,
1121 offset+4, 8,
1122 tvb_fcwwn_to_str (tvb, offset+4));
1127 static void
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,
1134 offset+1, 3,
1135 tvb_fc_to_str (tvb, offset+1));
1136 dissect_cos_flags(req_tree, tvb, offset+4, &hfi_fcdns_req_cos);
1140 static void
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,
1147 offset+1, 3,
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);
1154 static void
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,
1161 offset+1, 3,
1162 tvb_fc_to_str (tvb, offset+1));
1163 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1167 static void
1168 dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1170 int offset = 16; /* past the fc_ct header */
1171 guint8 len;
1173 if (req_tree && isreq) {
1174 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1175 offset+1, 3,
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);
1186 static void
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,
1193 offset+1, 3,
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);
1200 static void
1201 dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1203 int offset = 16; /* past the fc_ct header */
1204 int len;
1206 if (req_tree && isreq) {
1207 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb,
1208 offset+1, 3,
1209 tvb_fc_to_str (tvb, offset+1));
1210 dissect_fc4type(req_tree, tvb, offset+4, &hfi_fcdns_req_fc4types);
1212 offset += 36;
1213 len = tvb_reported_length_remaining (tvb, offset);
1215 while (len > 0) {
1216 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesclen, tvb, offset,
1217 1, ENC_BIG_ENDIAN);
1218 proto_tree_add_item (req_tree, &hfi_fcdns_req_fdesc, tvb, offset+1,
1219 len, ENC_ASCII|ENC_NA);
1220 offset += 256;
1221 len -= 256;
1226 static void
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);
1238 static void
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);
1250 static void
1251 dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1253 int offset = 16; /* past the fc_ct header */
1254 guint8 len;
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,
1262 1, ENC_BIG_ENDIAN);
1263 proto_tree_add_item (req_tree, &hfi_fcdns_req_sname, tvb, offset+9,
1264 len, ENC_ASCII|ENC_NA);
1268 static void
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));
1279 static guint8 *
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);
1286 static void
1287 dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
1289 guint8 mbrtype;
1290 int idlen;
1291 char dpbuf[2+8+1];
1292 char *str;
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);
1302 switch (mbrtype) {
1303 case FC_SWILS_ZONEMBR_WWN:
1304 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1305 offset+4, 8,
1306 tvb_fcwwn_to_str (tvb, offset+4));
1307 break;
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);
1312 break;
1313 case FC_SWILS_ZONEMBR_FCID:
1314 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1315 offset+4, 4,
1316 tvb_fc_to_str (tvb, offset+5));
1317 break;
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);
1322 break;
1323 default:
1324 proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb,
1325 offset+4, idlen,
1326 "Unknown member type format");
1331 static void
1332 dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset)
1334 int numrec, i, len;
1335 guint8 objfmt;
1337 numrec = tvb_get_ntohl (tvb, offset);
1339 if (tree) {
1340 proto_tree_add_text (tree, tvb, offset, 4, "Number of Entries: %d",
1341 numrec);
1342 offset += 4;
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,
1350 3)));
1351 proto_tree_add_item (tree, &hfi_fcdns_rply_ptype, tvb, offset+4,
1352 1, ENC_BIG_ENDIAN);
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));
1357 offset += 16;
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);
1364 offset += 256;
1366 proto_tree_add_string (tree, &hfi_fcdns_rply_nname, tvb, offset, 8,
1367 tvb_fcwwn_to_str (tvb, offset));
1368 offset += 8;
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);
1375 offset += 256;
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,
1379 ENC_NA);
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,
1383 16, ENC_NA);
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));
1388 offset += 88;
1389 if (objfmt & 0x2) {
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);
1402 else {
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 */
1412 static void
1413 dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1415 int offset = 16; /* past the fc_ct header */
1417 if (isreq) {
1418 if (req_tree) {
1419 proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1,
1420 3, tvb_fc_to_str (tvb, offset+1));
1423 else {
1424 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1428 static void
1429 dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1431 int offset = 16; /* past the fc_ct header */
1432 if (isreq) {
1433 if (req_tree) {
1434 proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, offset, 8,
1435 tvb_fcwwn_to_str (tvb, offset));
1438 else {
1439 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1443 static void
1444 dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1446 int offset = 16; /* past the fc_ct header */
1448 if (isreq) {
1449 if (req_tree) {
1450 proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8,
1451 tvb_fcwwn_to_str (tvb, offset));
1454 else {
1455 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1459 static void
1460 dissect_fcdns_geip (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1462 int offset = 16; /* past the fc_ct header */
1464 if (isreq) {
1465 if (req_tree) {
1466 proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset, 16, ENC_NA);
1469 else {
1470 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1474 static void
1475 dissect_fcdns_geft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1477 int offset = 16; /* past the fc_ct header */
1479 if (isreq) {
1480 if (req_tree) {
1481 dissect_fc4type(req_tree, tvb, offset, &hfi_fcdns_fc4type);
1484 else {
1485 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1489 static void
1490 dissect_fcdns_gept (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1492 int offset = 16; /* past the fc_ct header */
1494 if (isreq) {
1495 if (req_tree) {
1496 proto_tree_add_item (req_tree, &hfi_fcdns_req_ptype, tvb, offset+3,
1497 1, ENC_BIG_ENDIAN);
1500 else {
1501 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1505 static void
1506 dissect_fcdns_gezm (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1508 int offset = 16; /* past the fc_ct header */
1510 if (isreq) {
1511 if (req_tree) {
1512 dissect_fcdns_zone_mbr (tvb, req_tree, offset);
1515 else {
1516 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1520 static void
1521 dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1523 int offset = 16; /* past the fc_ct header */
1524 int str_len;
1526 if (isreq) {
1527 if (req_tree) {
1528 str_len = tvb_get_guint8 (tvb, offset);
1529 proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d",
1530 str_len);
1531 proto_tree_add_item (req_tree, &hfi_fcdns_zonenm, tvb, offset+3,
1532 str_len, ENC_ASCII|ENC_NA);
1535 else {
1536 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1540 static void
1541 dissect_fcdns_geipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1543 int offset = 16; /* past the fc_ct header */
1545 if (isreq) {
1546 if (req_tree) {
1547 proto_tree_add_item (req_tree, &hfi_fcdns_portip, tvb, offset, 4, ENC_BIG_ENDIAN);
1550 else {
1551 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1555 static void
1556 dissect_fcdns_geff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
1558 int offset = 16; /* past the fc_ct header */
1560 if (isreq) {
1561 if (req_tree) {
1562 dissect_fc4features(req_tree, tvb, offset);
1565 else {
1566 dissect_fcdns_swils_entries (tvb, req_tree, offset);
1570 static void
1571 dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
1573 int offset = 0;
1575 if (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,
1578 ENC_BIG_ENDIAN);
1579 proto_tree_add_item (req_tree, &hfi_fcdns_vendor, tvb, offset+15, 1, ENC_BIG_ENDIAN);
1583 static void
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;
1589 int offset = 0;
1590 int opcode,
1591 failed_opcode = 0;
1592 int isreq = 1;
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");
1608 else
1609 col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS");
1611 if (tree) {
1612 if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) {
1613 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1615 "dNS");
1616 fcdns_tree = proto_item_add_subtree (ti, ett_fcdns);
1618 else {
1619 ti = proto_tree_add_protocol_format (tree, hfi_fcdns->id, tvb, 0,
1621 "Unzoned NS");
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,
1639 &ckey);
1640 if (cdata) {
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
1643 * req.
1645 cdata->opcode = opcode;
1647 else {
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,
1657 "0x%x"));
1659 else {
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);
1664 isreq = 0;
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,
1669 "0x%x"));
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");
1673 return;
1676 else {
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;
1685 else
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,
1692 "0x%x"));
1694 else {
1695 col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)",
1696 val_to_str (failed_opcode,
1697 fc_dns_opcode_val,
1698 "0x%x"));
1701 if (tree) {
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");
1706 return;
1712 if (tree) {
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,
1715 2, ENC_BIG_ENDIAN);
1718 switch (opcode) {
1719 case FCCT_MSG_RJT:
1720 dissect_fcdns_rjt (tvb, fcdns_tree);
1721 break;
1722 case FCDNS_GA_NXT:
1723 dissect_fcdns_ganxt (tvb, fcdns_tree, isreq);
1724 break;
1725 case FCDNS_GPN_ID:
1726 dissect_fcdns_gpnid (tvb, fcdns_tree, isreq);
1727 break;
1728 case FCDNS_GNN_ID:
1729 dissect_fcdns_gnnid (tvb, fcdns_tree, isreq);
1730 break;
1731 case FCDNS_GCS_ID:
1732 dissect_fcdns_gcsid (tvb, fcdns_tree, isreq);
1733 break;
1734 case FCDNS_GFT_ID:
1735 dissect_fcdns_gftid (tvb, fcdns_tree, isreq);
1736 break;
1737 case FCDNS_GSPN_ID:
1738 dissect_fcdns_gspnid (tvb, fcdns_tree, isreq);
1739 break;
1740 case FCDNS_GPT_ID:
1741 dissect_fcdns_gptid (tvb, fcdns_tree, isreq);
1742 break;
1743 case FCDNS_GFPN_ID:
1744 dissect_fcdns_gfpnid (tvb, fcdns_tree, isreq);
1745 break;
1746 case FCDNS_GFD_ID:
1747 dissect_fcdns_gfdid (tvb, fcdns_tree, isreq);
1748 break;
1749 case FCDNS_GFF_ID:
1750 dissect_fcdns_gffid (tvb, fcdns_tree, isreq);
1751 break;
1752 case FCDNS_GID_PN:
1753 dissect_fcdns_gidpn (tvb, fcdns_tree, isreq);
1754 break;
1755 case FCDNS_GIPP_PN:
1756 dissect_fcdns_gipppn (tvb, fcdns_tree, isreq);
1757 break;
1758 case FCDNS_GID_NN:
1759 dissect_fcdns_gidnn (tvb, fcdns_tree, isreq);
1760 break;
1761 case FCDNS_GPN_NN:
1762 dissect_fcdns_gpnnn (tvb, fcdns_tree, isreq);
1763 break;
1764 case FCDNS_GIP_NN:
1765 dissect_fcdns_gipnn (tvb, fcdns_tree, isreq);
1766 break;
1767 case FCDNS_GSNN_NN:
1768 dissect_fcdns_gsnnnn (tvb, fcdns_tree, isreq);
1769 break;
1770 case FCDNS_GID_FT:
1771 dissect_fcdns_gidft (tvb, fcdns_tree, isreq);
1772 break;
1773 case FCDNS_GPN_FT:
1774 dissect_fcdns_gpnft (tvb, fcdns_tree, isreq);
1775 break;
1776 case FCDNS_GNN_FT:
1777 dissect_fcdns_gnnft (tvb, fcdns_tree, isreq);
1778 break;
1779 case FCDNS_GID_PT:
1780 dissect_fcdns_gidpt (tvb, fcdns_tree, isreq);
1781 break;
1782 case FCDNS_GID_IPP:
1783 dissect_fcdns_gidipp (tvb, fcdns_tree, isreq);
1784 break;
1785 case FCDNS_GID_FF:
1786 dissect_fcdns_gidff (tvb, fcdns_tree, isreq);
1787 break;
1788 case FCDNS_RPN_ID:
1789 dissect_fcdns_rpnid (tvb, fcdns_tree, isreq);
1790 break;
1791 case FCDNS_RNN_ID:
1792 dissect_fcdns_rnnid (tvb, fcdns_tree, isreq);
1793 break;
1794 case FCDNS_RCS_ID:
1795 dissect_fcdns_rcsid (tvb, fcdns_tree, isreq);
1796 break;
1797 case FCDNS_RPT_ID:
1798 dissect_fcdns_rptid (tvb, fcdns_tree, isreq);
1799 break;
1800 case FCDNS_RFT_ID:
1801 dissect_fcdns_rftid (tvb, fcdns_tree, isreq);
1802 break;
1803 case FCDNS_RSPN_ID:
1804 dissect_fcdns_rspnid (tvb, fcdns_tree, isreq);
1805 break;
1806 case FCDNS_RIPP_ID:
1807 dissect_fcdns_rippid (tvb, fcdns_tree, isreq);
1808 break;
1809 case FCDNS_RFD_ID:
1810 dissect_fcdns_rfdid (tvb, fcdns_tree, isreq);
1811 break;
1812 case FCDNS_RFF_ID:
1813 dissect_fcdns_rffid (tvb, fcdns_tree, isreq);
1814 break;
1815 case FCDNS_RIP_NN:
1816 dissect_fcdns_ripnn (tvb, fcdns_tree, isreq);
1817 break;
1818 case FCDNS_RSNN_NN:
1819 dissect_fcdns_rsnnnn (tvb, fcdns_tree, isreq);
1820 break;
1821 case FCDNS_DA_ID:
1822 dissect_fcdns_daid (tvb, fcdns_tree, isreq);
1823 break;
1824 case FCDNS_GE_ID:
1825 dissect_fcdns_geid (tvb, fcdns_tree, isreq);
1826 break;
1827 case FCDNS_GE_PN:
1828 dissect_fcdns_gepn (tvb, fcdns_tree, isreq);
1829 break;
1830 case FCDNS_GE_NN:
1831 dissect_fcdns_genn (tvb, fcdns_tree, isreq);
1832 break;
1833 case FCDNS_GE_IP:
1834 dissect_fcdns_geip (tvb, fcdns_tree, isreq);
1835 break;
1836 case FCDNS_GE_FT:
1837 dissect_fcdns_geft (tvb, fcdns_tree, isreq);
1838 break;
1839 case FCDNS_GE_PT:
1840 dissect_fcdns_gept (tvb, fcdns_tree, isreq);
1841 break;
1842 case FCDNS_GE_ZM:
1843 dissect_fcdns_gezm (tvb, fcdns_tree, isreq);
1844 break;
1845 case FCDNS_GE_ZN:
1846 dissect_fcdns_gezn (tvb, fcdns_tree, isreq);
1847 break;
1848 case FCDNS_GE_IPP:
1849 dissect_fcdns_geipp (tvb, fcdns_tree, isreq);
1850 break;
1851 case FCDNS_GE_FF:
1852 dissect_fcdns_geff (tvb, fcdns_tree, isreq);
1853 break;
1854 default:
1855 break;
1859 /* Register the protocol with Wireshark */
1861 void
1862 proto_register_fcdns (void)
1864 #ifndef HAVE_HFI_SECTION_INIT
1865 static header_field_info *hfi[] = {
1866 /* &hfi_fcdns_gssubtype */
1867 &hfi_fcdns_opcode,
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,
1882 &hfi_fcdns_req_ip,
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,
1898 &hfi_fcdns_reason,
1899 &hfi_fcdns_rjtdetail,
1900 &hfi_fcdns_vendor,
1901 &hfi_fcdns_zone_mbrtype,
1902 &hfi_fcdns_zone_mbrid,
1903 &hfi_fcdns_zonenm,
1904 &hfi_fcdns_portip,
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,
1910 &hfi_fcdns_req_cos,
1911 &hfi_fcdns_cos_f,
1912 &hfi_fcdns_cos_1,
1913 &hfi_fcdns_cos_2,
1914 &hfi_fcdns_cos_3,
1915 &hfi_fcdns_cos_4,
1916 &hfi_fcdns_cos_6,
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,
1926 &hfi_fcdns_fc4type,
1927 &hfi_fcdns_fc4features,
1928 &hfi_fcdns_fc4features_i,
1929 &hfi_fcdns_fc4features_t,
1931 #endif
1933 static gint *ett[] = {
1934 &ett_fcdns,
1935 &ett_cos_flags,
1936 &ett_fc4flags,
1937 &ett_fc4features,
1940 int proto_fcdns;
1942 proto_fcdns = proto_register_protocol("Fibre Channel Name Server",
1943 "FC-dNS", "fcdns");
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);
1953 void
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);