Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-isns.c
blob3e75b8187954c80f27f3746f9f0746bd00c33c65
1 /* XXX fixme can not reassemble multiple isns PDU fragments into one
2 isns PDU
3 */
5 /* packet-isns.c
6 * Routines for iSNS dissection
7 * Copyright 2003, Elipsan, Gareth Bushell <gbushell@elipsan.com>
8 * (c) 2004 Ronnie Sahlberg updates
9 * (c) 2004 Ming Zhang updates
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * SPDX-License-Identifier: GPL-2.0-or-later
18 #include "config.h"
20 #include <epan/packet.h>
21 #include <epan/expert.h>
22 #include <epan/prefs.h>
23 #include <epan/tfs.h>
24 #include <wsutil/array.h>
25 #include "packet-tcp.h"
27 void proto_register_isns(void);
28 void proto_reg_handoff_isns(void);
30 #define ISNS_PROTO_VER 0x1
31 #define ISNS_HEADER_SIZE 12
33 #define ISNS_TCP_PORT 3205
34 #define ISNS_UDP_PORT 3205
36 #define ISNS_OTHER_PORT 0
37 #define ISNS_ESI_PORT 1
38 #define ISNS_SCN_PORT 2
41 static dissector_handle_t isns_tcp_handle;
42 static dissector_handle_t isns_udp_handle;
44 static int ett_isns_flags;
45 static int ett_isns_payload;
46 static int ett_isns_attribute;
47 static int ett_isns_port;
48 static int ett_isns_isnt;
50 static unsigned AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree,
51 unsigned offset, uint16_t function_id);
53 /* Initialize the protocol and registered fields */
54 static int proto_isns;
57 /* Header Stuff */
58 static int hf_isns_version;
59 static int hf_isns_function_id;
60 static int hf_isns_pdu_length;
61 static int hf_isns_flags;
62 static int hf_isns_transaction_id;
63 static int hf_isns_sequence_id;
64 static int hf_isns_payload;
65 static int hf_isns_first_pdu;
66 static int hf_isns_last_pdu;
67 static int hf_isns_replace;
68 static int hf_isns_auth;
69 static int hf_isns_server;
70 static int hf_isns_client;
72 /* Payload stuff */
73 static int hf_isns_scn_bitmap;
74 static int hf_isns_scn_bitmap_initiator_and_self_information_only;
75 static int hf_isns_scn_bitmap_target_and_self_information_only;
76 static int hf_isns_scn_bitmap_management_registration_scn;
77 static int hf_isns_scn_bitmap_object_removed;
78 static int hf_isns_scn_bitmap_object_added;
79 static int hf_isns_scn_bitmap_object_updated;
80 static int hf_isns_scn_bitmap_dd_dds_member_removed;
81 static int hf_isns_scn_bitmap_dd_dds_member_added;
82 static int hf_isns_isnt_control;
83 static int hf_isns_isnt_initiator;
84 static int hf_isns_isnt_target;
86 static int hf_isns_psb;
87 static int hf_isns_psb_tunnel_mode;
88 static int hf_isns_psb_transport_mode;
89 static int hf_isns_psb_pfs;
90 static int hf_isns_psb_aggressive_mode;
91 static int hf_isns_psb_main_mode;
92 static int hf_isns_psb_ike_ipsec;
93 static int hf_isns_psb_bitmap;
95 static int hf_isns_dd_member_portal_port;
96 static int hf_isns_portal_port;
97 static int hf_isns_esi_port;
98 static int hf_isns_scn_port;
99 static int hf_isns_port_type;
101 static int hf_isns_entity_protocol;
102 static int hf_isns_iscsi_node_type;
103 static int hf_isns_resp_errorcode;
104 static int hf_isns_attr_tag;
105 static int hf_isns_attr_len;
106 static int hf_isns_heartbeat_ipv6_addr;
107 static int hf_isns_heartbeat_udp_port;
108 static int hf_isns_heartbeat_tcp_port;
109 static int hf_isns_heartbeat_interval;
110 static int hf_isns_heartbeat_counter;
112 static int hf_isns_mgmt_ip_addr;
113 static int hf_isns_node_ip_addr;
114 static int hf_isns_port_ip_addr;
115 static int hf_isns_portal_ip_addr;
116 static int hf_isns_dd_member_portal_ip_addr;
117 static int hf_isns_iscsi_name;
118 static int hf_isns_switch_name;
119 static int hf_isns_dd_member_iscsi_name;
120 static int hf_isns_virtual_fabric_id;
121 static int hf_isns_proxy_iscsi_name;
122 static int hf_isns_fc4_descriptor;
123 static int hf_isns_iscsi_auth_method;
124 static int hf_isns_iscsi_alias;
125 static int hf_isns_portal_symbolic_name;
126 static int hf_isns_dd_set_symbolic_name;
127 static int hf_isns_dd_symbolic_name;
128 static int hf_isns_symbolic_port_name;
129 static int hf_isns_symbolic_node_name;
130 static int hf_isns_entity_identifier;
131 static int hf_isns_dd_id_next_id;
132 static int hf_isns_member_iscsi_index;
133 static int hf_isns_member_portal_index;
134 static int hf_isns_member_fc_port_name;
135 static int hf_isns_vendor_oui;
136 static int hf_isns_preferred_id;
137 static int hf_isns_assigned_id;
138 static int hf_isns_dd_id;
139 static int hf_isns_dd_set_id;
140 static int hf_isns_dd_set_next_id;
141 static int hf_isns_node_index;
142 static int hf_isns_node_next_index;
143 static int hf_isns_entity_index;
144 static int hf_isns_portal_index;
145 static int hf_isns_portal_next_index;
146 static int hf_isns_entity_next_index;
147 static int hf_isns_timestamp;
148 static int hf_isns_esi_interval;
149 static int hf_isns_registration_period;
150 static int hf_isns_port_id;
151 static int hf_isns_hard_address;
152 static int hf_isns_wwnn_token;
153 static int hf_isns_node_ipa;
154 static int hf_isns_fc_port_name_wwpn;
155 static int hf_isns_fc_node_name_wwnn;
156 static int hf_isns_fabric_port_name;
157 static int hf_isns_permanent_port_name;
158 static int hf_isns_not_decoded_yet;
159 static int hf_isns_portal_group_tag;
160 static int hf_isns_pg_iscsi_name;
161 static int hf_isns_pg_portal_ip_addr;
162 static int hf_isns_pg_portal_port;
163 static int hf_isns_pg_index;
164 static int hf_isns_pg_next_index;
166 static expert_field ei_isns_not_first_pdu;
167 static expert_field ei_isns_invalid_attr_len;
169 /* Desegment iSNS over TCP messages */
170 static bool isns_desegment = true;
172 /* Function Id's */
173 #define ISNS_FUNC_DEVATTRREG 0x0001
174 #define ISNS_FUNC_DEVATTRQRY 0x0002
175 #define ISNS_FUNC_DEVGETNEXT 0x0003
176 #define ISNS_FUNC_DEREGDEV 0x0004
177 #define ISNS_FUNC_SCNREG 0x0005
178 #define ISNS_FUNC_SCNDEREG 0x0006
179 #define ISNS_FUNC_SCNEVENT 0x0007
180 #define ISNS_FUNC_SCN 0x0008
181 #define ISNS_FUNC_DDREG 0x0009
182 #define ISNS_FUNC_DDDEREG 0x000a
183 #define ISNS_FUNC_DDSREG 0x000b
184 #define ISNS_FUNC_DDSDEREG 0x000c
185 #define ISNS_FUNC_ESI 0x000d
186 #define ISNS_FUNC_HEARTBEAT 0x000e
187 #define ISNS_FUNC_RQSTDOMID 0x0011
188 #define ISNS_FUNC_RLSEDOMID 0x0012
189 #define ISNS_FUNC_GETDOMID 0x0013
191 #define ISNS_FUNC_RSP_DEVATTRREG 0x8001
192 #define ISNS_FUNC_RSP_DEVATTRQRY 0x8002
193 #define ISNS_FUNC_RSP_DEVGETNEXT 0x8003
194 #define ISNS_FUNC_RSP_DEREGDEV 0x8004
195 #define ISNS_FUNC_RSP_SCNREG 0x8005
196 #define ISNS_FUNC_RSP_SCNDEREG 0x8006
197 #define ISNS_FUNC_RSP_SCNEVENT 0x8007
198 #define ISNS_FUNC_RSP_SCN 0x8008
199 #define ISNS_FUNC_RSP_DDREG 0x8009
200 #define ISNS_FUNC_RSP_DDDEREG 0x800a
201 #define ISNS_FUNC_RSP_DDSREG 0x800b
202 #define ISNS_FUNC_RSP_DDSDEREG 0x800c
203 #define ISNS_FUNC_RSP_ESI 0x800d
204 #define ISNS_FUNC_RSP_RQSTDOMID 0x8011
205 #define ISNS_FUNC_RSP_RLSEDOMID 0x8012
206 #define ISNS_FUNC_RSP_GETDOMID 0x8013
208 static const value_string isns_function_ids[] = {
209 /* Requests*/
210 {ISNS_FUNC_DEVATTRREG, "DevAttrReg"},
211 {ISNS_FUNC_DEVATTRQRY, "DevAttrQry"},
212 {ISNS_FUNC_DEVGETNEXT, "DevGetNext"},
213 {ISNS_FUNC_DEREGDEV, "DeregDev"},
214 {ISNS_FUNC_SCNREG, "SCNReg"},
215 {ISNS_FUNC_SCNDEREG, "SCNDereg"},
216 {ISNS_FUNC_SCNEVENT, "SCNEvent"},
217 {ISNS_FUNC_SCN, "SCN"},
218 {ISNS_FUNC_DDREG, "DDReg"},
219 {ISNS_FUNC_DDDEREG, "DDDereg"},
220 {ISNS_FUNC_DDSREG, "DDSReg"},
221 {ISNS_FUNC_DDSDEREG, "DDSDereg"},
222 {ISNS_FUNC_ESI, "ESI"},
223 {ISNS_FUNC_HEARTBEAT, "Heartbeat"},
224 {ISNS_FUNC_RQSTDOMID, "RqstDomId"},
225 {ISNS_FUNC_RLSEDOMID, "RlseDomId"},
226 {ISNS_FUNC_GETDOMID, "GetDomId"},
228 /* Responses */
229 {ISNS_FUNC_RSP_DEVATTRREG, "DevAttrRegRsp"},
230 {ISNS_FUNC_RSP_DEVATTRQRY, "DevAttrQryRsp"},
231 {ISNS_FUNC_RSP_DEVGETNEXT, "DevGetNextRsp"},
232 {ISNS_FUNC_RSP_DEREGDEV, "DeregDevRsp"},
233 {ISNS_FUNC_RSP_SCNREG, "SCNRegRsp"},
234 {ISNS_FUNC_RSP_SCNDEREG, "SCNDeregRsp"},
235 {ISNS_FUNC_RSP_SCNEVENT, "SCNEventRsp"},
236 {ISNS_FUNC_RSP_SCN, "SCNRsp"},
237 {ISNS_FUNC_RSP_DDREG, "DDRegRsp"},
238 {ISNS_FUNC_RSP_DDDEREG, "DDDeregRsp"},
239 {ISNS_FUNC_RSP_DDSREG, "DDSRegRsp"},
240 {ISNS_FUNC_RSP_DDSDEREG, "DDSDeregRsp"},
241 {ISNS_FUNC_RSP_ESI, "ESIRsp"},
242 {ISNS_FUNC_RSP_RQSTDOMID, "RqstDomIdRsp"},
243 {ISNS_FUNC_RSP_RLSEDOMID, "RlseDomIdRsp"},
244 {ISNS_FUNC_RSP_GETDOMID, "GetDomIdRsp"},
246 {0x0,NULL},
248 static value_string_ext isns_function_ids_ext = VALUE_STRING_EXT_INIT(isns_function_ids);
250 #define ISNS_ENTITY_PROTOCOL_NO_PROTOCOL 1
251 #define ISNS_ENTITY_PROTOCOL_ISCSI 2
252 #define ISNS_ENTITY_PROTOCOL_IFCP 3
255 static const value_string isns_entity_protocol[] = {
256 {ISNS_ENTITY_PROTOCOL_NO_PROTOCOL, "No Protocol"},
257 {ISNS_ENTITY_PROTOCOL_ISCSI, "iSCSI"},
258 {ISNS_ENTITY_PROTOCOL_IFCP, "iFCP"},
260 {0x0,NULL},
263 static const value_string isns_errorcode[] = {
264 { 0,"No Error"},
265 { 1,"Unknown Error"},
266 { 2,"Message Format Error"},
267 { 3,"Invalid Registration"},
268 { 4,"RESERVED"},
269 { 5,"Invalid Query"},
270 { 6,"Source Unknown"},
271 { 7,"Source Absent"},
272 { 8,"Source Unauthorized"},
273 { 9,"No such Entry"},
274 {10,"Version Not Supported"},
275 {11,"Internal Error"},
276 {12,"Busy"},
277 {13,"Option Not Understood"},
278 {14,"Invalid Update"},
279 {15,"Message (FUNCTION_ID) Not supported"},
280 {16,"SCN Event Rejected"},
281 {17,"SCN Registration Rejected"},
282 {18,"Attribute Not Implemented"},
283 {19,"FC_DOMAIN_ID Not available"},
284 {20,"FC_DOMAIN_ID not allocated"},
285 {21,"ESI Not Available"},
286 {22,"Invalid Deregistration"},
287 {23,"Registration Feature Not Supported"},
289 {0x0,NULL}
291 static value_string_ext isns_errorcode_ext = VALUE_STRING_EXT_INIT(isns_errorcode);
294 #define ISNS_ATTR_TAG_DELIMITER 0
295 #define ISNS_ATTR_TAG_ENTITY_IDENTIFIER 1
296 #define ISNS_ATTR_TAG_ENTITY_PROTOCOL 2
297 #define ISNS_ATTR_TAG_MGMT_IP_ADDRESS 3
298 #define ISNS_ATTR_TAG_TIMESTAMP 4
299 #define ISNS_ATTR_TAG_PROTOCOL_VERSION_RANGE 5
300 #define ISNS_ATTR_TAG_REGISTRATION_PERIOD 6
301 #define ISNS_ATTR_TAG_ENTITY_INDEX 7
302 #define ISNS_ATTR_TAG_ENTITY_NEXT_INDEX 8
303 #define ISNS_ATTR_TAG_ENTITY_ISAKMP_PHASE_1 11
304 #define ISNS_ATTR_TAG_ENTITY_CERTIFICATE 12
305 #define ISNS_ATTR_TAG_PORTAL_IP_ADDRESS 16
306 #define ISNS_ATTR_TAG_PORTAL_PORT 17
307 #define ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME 18
308 #define ISNS_ATTR_TAG_ESI_INTERVAL 19
309 #define ISNS_ATTR_TAG_ESI_PORT 20
310 #define ISNS_ATTR_TAG_PORTAL_INDEX 22
311 #define ISNS_ATTR_TAG_SCN_PORT 23
312 #define ISNS_ATTR_TAG_PORTAL_NEXT_INDEX 24
313 #define ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP 27
314 #define ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_1 28
315 #define ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_2 29
316 #define ISNS_ATTR_TAG_PORTAL_CERTIFICATE 31
317 #define ISNS_ATTR_TAG_ISCSI_NAME 32
318 #define ISNS_ATTR_TAG_ISCSI_NODE_TYPE 33
319 #define ISNS_ATTR_TAG_ISCSI_ALIAS 34
320 #define ISNS_ATTR_TAG_ISCSI_SCN_BITMAP 35
321 #define ISNS_ATTR_TAG_ISCSI_NODE_INDEX 36
322 #define ISNS_ATTR_TAG_WWNN_TOKEN 37
323 #define ISNS_ATTR_TAG_ISCSI_NODE_NEXT_INDEX 38
324 #define ISNS_ATTR_TAG_ISCSI_AUTH_METHOD 42
325 #define ISNS_ATTR_TAG_PG_ISCSI_NAME 48
326 #define ISNS_ATTR_TAG_PG_PORTAL_IP_ADDR 49
327 #define ISNS_ATTR_TAG_PG_PORTAL_PORT 50
328 #define ISNS_ATTR_TAG_PORTAL_GROUP_TAG 51
329 #define ISNS_ATTR_TAG_PORTAL_GROUP_INDEX 52
330 #define ISNS_ATTR_TAG_PORTAL_GROUP_NEXT_INDEX 53
331 #define ISNS_ATTR_TAG_FC_PORT_NAME_WWPN 64
332 #define ISNS_ATTR_TAG_PORT_ID 65
333 #define ISNS_ATTR_TAG_FC_PORT_TYPE 66
334 #define ISNS_ATTR_TAG_SYMBOLIC_PORT_NAME 67
335 #define ISNS_ATTR_TAG_FABRIC_PORT_NAME 68
336 #define ISNS_ATTR_TAG_HARD_ADDRESS 69
337 #define ISNS_ATTR_TAG_PORT_IP_ADDRESS 70
338 #define ISNS_ATTR_TAG_CLASS_OF_SERVICE 71
339 #define ISNS_ATTR_TAG_FC4_TYPES 72
340 #define ISNS_ATTR_TAG_FC4_DESCRIPTOR 73
341 #define ISNS_ATTR_TAG_FC4_FEATURES 74
342 #define ISNS_ATTR_TAG_IFCP_SCN_BITMAP 75
343 #define ISNS_ATTR_TAG_PORT_ROLE 76
344 #define ISNS_ATTR_TAG_PERMANENT_PORT_NAME 77
345 #define ISNS_ATTR_TAG_FC4_TYPE_CODE 95
346 #define ISNS_ATTR_TAG_FC_NODE_NAME_WWNN 96
347 #define ISNS_ATTR_TAG_SYMBOLIC_NODE_NAME 97
348 #define ISNS_ATTR_TAG_NODE_IP_ADDRESS 98
349 #define ISNS_ATTR_TAG_NODE_IPA 99
350 #define ISNS_ATTR_TAG_PROXY_ISCSI_NAME 101
351 #define ISNS_ATTR_TAG_SWITCH_NAME 128
352 #define ISNS_ATTR_TAG_PREFERRED_ID 129
353 #define ISNS_ATTR_TAG_ASSIGNED_ID 130
354 #define ISNS_ATTR_TAG_VIRTUAL_FABRIC_ID 131
355 #define ISNS_ATTR_TAG_VENDOR_OUI 256
356 #define ISNS_ATTR_TAG_DD_SET_ID 2049
357 #define ISNS_ATTR_TAG_DD_SET_SYMBOLIC_NAME 2050
358 #define ISNS_ATTR_TAG_DD_SET_STATUS 2051
359 #define ISNS_ATTR_TAG_DD_SET_NEXT_ID 2052
360 #define ISNS_ATTR_TAG_DD_ID 2065
361 #define ISNS_ATTR_TAG_DD_SYMBOLIC_NAME 2066
362 #define ISNS_ATTR_TAG_DD_MEMBER_ISCSI_INDEX 2067
363 #define ISNS_ATTR_TAG_DD_MEMBER_ISCSI_NAME 2068
364 #define ISNS_ATTR_TAG_DD_MEMBER_FC_PORT_NAME 2069
365 #define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_INDEX 2070
366 #define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_IP_ADDRESS 2071
367 #define ISNS_ATTR_TAG_DD_MEMBER_PORTAL_PORT 2072
368 #define ISNS_ATTR_TAG_DD_FEATURES 2078
369 #define ISNS_ATTR_TAG_DD_ID_NEXT_ID 2079
372 static const value_string isns_attribute_tags[] = {
373 {ISNS_ATTR_TAG_DELIMITER, "Delimiter"},
374 {ISNS_ATTR_TAG_ENTITY_IDENTIFIER, "Entity Identifier (EID)"},
375 {ISNS_ATTR_TAG_ENTITY_PROTOCOL, "Entity Protocol"},
376 {ISNS_ATTR_TAG_MGMT_IP_ADDRESS, "Management IP Address"},
377 {ISNS_ATTR_TAG_TIMESTAMP, "Timestamp"},
378 {ISNS_ATTR_TAG_PROTOCOL_VERSION_RANGE, "Protocol Version Range"},
379 {ISNS_ATTR_TAG_REGISTRATION_PERIOD, "Registration Period"},
380 {ISNS_ATTR_TAG_ENTITY_INDEX, "Entity Index"},
381 {ISNS_ATTR_TAG_ENTITY_NEXT_INDEX, "Entity Next Index"},
382 {ISNS_ATTR_TAG_ENTITY_ISAKMP_PHASE_1, "Entity ISAKMP Phase-1"},
383 {ISNS_ATTR_TAG_ENTITY_CERTIFICATE, "Entity Certificate"},
384 {ISNS_ATTR_TAG_PORTAL_IP_ADDRESS, "Portal IP Address"},
385 {ISNS_ATTR_TAG_PORTAL_PORT, "Portal TCP/UDP Port"},
386 {ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME, "Portal Symbolic Name"},
387 {ISNS_ATTR_TAG_ESI_INTERVAL, "ESI Interval"},
388 {ISNS_ATTR_TAG_ESI_PORT, "ESI Port"},
389 {ISNS_ATTR_TAG_PORTAL_INDEX, "Portal Index"},
390 {ISNS_ATTR_TAG_SCN_PORT, "SCN Port"},
391 {ISNS_ATTR_TAG_PORTAL_NEXT_INDEX, "Portal Next Index"},
392 {ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP, "Portal Security Bitmap"},
393 {ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_1, "Portal ISAKMP Phase-1"},
394 {ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_2, "Portal ISAKMP Phase-2"},
395 {ISNS_ATTR_TAG_PORTAL_CERTIFICATE, "Portal Certificate"},
396 {ISNS_ATTR_TAG_ISCSI_NAME, "iSCSI Name"},
397 {ISNS_ATTR_TAG_ISCSI_NODE_TYPE, "iSCSI Node Type"},
398 {ISNS_ATTR_TAG_ISCSI_ALIAS, "iSCSI Alias"},
399 {ISNS_ATTR_TAG_ISCSI_SCN_BITMAP, "iSCSI SCN Bitmap"},
400 {ISNS_ATTR_TAG_ISCSI_NODE_INDEX, "iSCSI Node Index"},
401 {ISNS_ATTR_TAG_WWNN_TOKEN, "WWNN Token"},
402 {ISNS_ATTR_TAG_ISCSI_NODE_NEXT_INDEX, "iSCSI Node Next Index"},
403 {ISNS_ATTR_TAG_ISCSI_AUTH_METHOD, "iSCSI AuthMethod"},
404 {ISNS_ATTR_TAG_PG_ISCSI_NAME, "PG iSCSI Name"},
405 {ISNS_ATTR_TAG_PG_PORTAL_IP_ADDR, "PG Portal IP Addr"},
406 {ISNS_ATTR_TAG_PG_PORTAL_PORT, "PG Portal Port"},
407 {ISNS_ATTR_TAG_PORTAL_GROUP_TAG, "Portal Group Tag"},
408 {ISNS_ATTR_TAG_PORTAL_GROUP_INDEX, "PG Index"},
409 {ISNS_ATTR_TAG_PORTAL_GROUP_NEXT_INDEX, "PG Next Index"},
410 {ISNS_ATTR_TAG_FC_PORT_NAME_WWPN, "FC Port Name WWPN"},
411 {ISNS_ATTR_TAG_PORT_ID, "Port ID"},
412 {ISNS_ATTR_TAG_FC_PORT_TYPE, "FC Port Type"},
413 {ISNS_ATTR_TAG_SYMBOLIC_PORT_NAME, "Symbolic Port Name"},
414 {ISNS_ATTR_TAG_FABRIC_PORT_NAME, "Fabric Port Name"},
415 {ISNS_ATTR_TAG_HARD_ADDRESS, "Hard Address"},
416 {ISNS_ATTR_TAG_PORT_IP_ADDRESS, "Port IP-Address"},
417 {ISNS_ATTR_TAG_CLASS_OF_SERVICE, "Class of Service"},
418 {ISNS_ATTR_TAG_FC4_TYPES, "FC-4 Types"},
419 {ISNS_ATTR_TAG_FC4_DESCRIPTOR, "FC-4 Descriptor"},
420 {ISNS_ATTR_TAG_FC4_FEATURES, "FC-4 Features"},
421 {ISNS_ATTR_TAG_IFCP_SCN_BITMAP, "iFCP SCN bitmap"},
422 {ISNS_ATTR_TAG_PORT_ROLE, "Port Role"},
423 {ISNS_ATTR_TAG_PERMANENT_PORT_NAME, "Permanent Port Name"},
424 {ISNS_ATTR_TAG_FC4_TYPE_CODE, "FC-4 Type Code"},
425 {ISNS_ATTR_TAG_FC_NODE_NAME_WWNN, "FC Node Name WWNN"},
426 {ISNS_ATTR_TAG_SYMBOLIC_NODE_NAME, "Symbolic Node Name"},
427 {ISNS_ATTR_TAG_NODE_IP_ADDRESS, "Node IP-Address"},
428 {ISNS_ATTR_TAG_NODE_IPA, "Node IPA"},
429 {ISNS_ATTR_TAG_PROXY_ISCSI_NAME, "Proxy iSCSI Name"},
430 {ISNS_ATTR_TAG_SWITCH_NAME, "Switch Name"},
431 {ISNS_ATTR_TAG_PREFERRED_ID, "Preferred ID"},
432 {ISNS_ATTR_TAG_ASSIGNED_ID, "Assigned ID"},
433 {ISNS_ATTR_TAG_VIRTUAL_FABRIC_ID, "Virtual_Fabric_ID"},
434 {ISNS_ATTR_TAG_VENDOR_OUI, "iSNS Server Vendor OUI"},
435 {ISNS_ATTR_TAG_DD_SET_ID, "DD_Set ID"},
436 {ISNS_ATTR_TAG_DD_SET_SYMBOLIC_NAME, "DD_Set Sym Name"},
437 {ISNS_ATTR_TAG_DD_SET_STATUS, "DD_Set Status"},
438 {ISNS_ATTR_TAG_DD_SET_NEXT_ID, "DD_Set_Next_ID"},
439 {ISNS_ATTR_TAG_DD_ID, "DD_ID"},
440 {ISNS_ATTR_TAG_DD_SYMBOLIC_NAME, "DD_Symbolic Name"},
441 {ISNS_ATTR_TAG_DD_MEMBER_ISCSI_INDEX, "DD_Member iSCSI Index"},
442 {ISNS_ATTR_TAG_DD_MEMBER_ISCSI_NAME, "DD_Member iSCSI Name"},
443 {ISNS_ATTR_TAG_DD_MEMBER_FC_PORT_NAME, "DD_Member FC Port Name"},
444 {ISNS_ATTR_TAG_DD_MEMBER_PORTAL_INDEX, "DD Member Portal Index"},
445 {ISNS_ATTR_TAG_DD_MEMBER_PORTAL_IP_ADDRESS, "DD_Member Portal IP Addr"},
446 {ISNS_ATTR_TAG_DD_MEMBER_PORTAL_PORT, "DD Member Portal TCP/UDP"},
447 {ISNS_ATTR_TAG_DD_FEATURES, "DD_Features"},
448 {ISNS_ATTR_TAG_DD_ID_NEXT_ID, "DD_ID Next ID"},
450 {0,NULL}
452 static value_string_ext isns_attribute_tags_ext = VALUE_STRING_EXT_INIT(isns_attribute_tags);
454 #define ISNS_REQUIRE_ATTR_LEN(x) \
456 if(len != x) { \
457 expert_add_info_format(pinfo, len_item, &ei_isns_invalid_attr_len, \
458 "Invalid attribute length (should be %d)", x); \
459 break; \
463 /* iSNS flags */
464 #define ISNS_FLAGS_CLIENT 0x8000
465 #define ISNS_FLAGS_SERVER 0x4000
466 #define ISNS_FLAGS_AUTH 0x2000
467 #define ISNS_FLAGS_REPLACE 0x1000
468 #define ISNS_FLAGS_LAST_PDU 0x0800
469 #define ISNS_FLAGS_FIRST_PDU 0x0400
472 #define tfs_isns_psb_tunnel_mode tfs_preferred_no_preference
473 #define tfs_isns_psb_transport_mode tfs_preferred_no_preference
475 #define tfs_isns_psb_pfs tfs_enabled_disabled
476 #define tfs_isns_psb_aggressive_mode tfs_enabled_disabled
477 #define tfs_isns_psb_main_mode tfs_enabled_disabled
478 #define tfs_isns_psb_ike_ipsec tfs_enabled_disabled
481 #define tfs_isns_isnt_control tfs_yes_no
482 #define tfs_isns_isnt_initiator tfs_yes_no
483 #define tfs_isns_isnt_target tfs_yes_no
485 static const true_false_string tfs_isns_port_type = {
486 "UDP",
487 "TCP"
490 static const true_false_string tfs_isns_flag_first_pdu = {
491 "First PDU of iSNS Message",
492 "Not the first PDU of iSNS Message"
495 static const true_false_string tfs_isns_flag_last_pdu = {
496 "Last PDU of iSNS Message",
497 "Not the Last PDU of iSNS Message"
500 static const true_false_string tfs_isns_flag_replace = {
501 "Replace",
502 "Don't replace"
505 static const true_false_string tfs_isns_flag_auth = {
506 "Authentication Block is PRESENT",
507 "No authentication block"
510 static const true_false_string tfs_isns_flag_server = {
511 "Sender is iSNS server",
512 "Sender is not iSNS server"
515 static const true_false_string tfs_isns_flag_client = {
516 "Sender is iSNS client",
517 "Sender is not iSNS client"
521 /* Initialize the subtree pointers */
522 static int ett_isns;
525 /* Code to actually dissect the packets */
526 static int
527 dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
529 unsigned offset = 0;
530 uint16_t function_id;
531 unsigned packet_len;
532 proto_item *ti;
533 proto_tree *isns_tree;
534 uint16_t flags;
535 proto_tree *tt = NULL;
536 proto_item *tpayload;
537 static int * const isns_flags[] = {
538 &hf_isns_client,
539 &hf_isns_server,
540 &hf_isns_auth,
541 &hf_isns_replace,
542 &hf_isns_last_pdu,
543 &hf_isns_first_pdu,
544 NULL
547 /* Make entries in Protocol column and Info column on summary display */
548 col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSNS");
549 col_clear(pinfo->cinfo, COL_INFO);
551 /* Get the function id from the packet */
552 function_id = tvb_get_ntohs(tvb, offset + 2);
554 /* Add the function name in the info col */
555 col_add_str(pinfo->cinfo, COL_INFO,
556 val_to_str_ext(function_id, &isns_function_ids_ext,
557 "Unknown function ID 0x%04x"));
559 /* create display subtree for the protocol */
560 ti = proto_tree_add_item(tree, proto_isns, tvb, 0, -1, ENC_NA);
561 isns_tree = proto_item_add_subtree(ti, ett_isns);
563 /* OK... Sort out the header */
564 proto_tree_add_item(isns_tree, hf_isns_version, tvb, offset, 2, ENC_BIG_ENDIAN);
565 proto_tree_add_item(isns_tree, hf_isns_function_id, tvb, offset+2, 2, ENC_BIG_ENDIAN);
566 proto_tree_add_item(isns_tree, hf_isns_pdu_length, tvb, offset+4, 2, ENC_BIG_ENDIAN);
568 flags = tvb_get_ntohs(tvb, offset + 6);
569 proto_tree_add_bitmask(isns_tree, tvb, offset+6, hf_isns_flags, ett_isns_flags, isns_flags, ENC_BIG_ENDIAN);
570 proto_tree_add_item(isns_tree, hf_isns_transaction_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
571 proto_tree_add_item(isns_tree, hf_isns_sequence_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
573 tpayload = proto_tree_add_item(isns_tree, hf_isns_payload, tvb, offset+12, -1, ENC_NA);
574 tt = proto_item_add_subtree(tpayload, ett_isns_payload);
576 /* Now set the offset to the start of the payload */
577 offset += ISNS_HEADER_SIZE;
579 /* Decode those attributes baby - Yeah!*/
580 switch (function_id)
582 case ISNS_FUNC_HEARTBEAT:
583 proto_tree_add_item(tt,hf_isns_heartbeat_ipv6_addr, tvb, offset, 16, ENC_NA);
584 offset += 16;
586 proto_tree_add_item(tt,hf_isns_heartbeat_tcp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
587 offset += 2;
589 proto_tree_add_item(tt,hf_isns_heartbeat_udp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
590 offset += 2;
592 proto_tree_add_item(tt,hf_isns_heartbeat_interval, tvb, offset, 4, ENC_BIG_ENDIAN);
593 offset += 4;
595 proto_tree_add_item(tt,hf_isns_heartbeat_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
596 /*offset += 4;*/
597 break;
599 /* Responses */
600 case ISNS_FUNC_RSP_DEVATTRREG:
601 case ISNS_FUNC_RSP_DEVATTRQRY:
602 case ISNS_FUNC_RSP_DEVGETNEXT:
603 case ISNS_FUNC_RSP_DEREGDEV:
604 case ISNS_FUNC_RSP_SCNREG:
605 case ISNS_FUNC_RSP_SCNDEREG:
606 case ISNS_FUNC_RSP_SCNEVENT:
607 case ISNS_FUNC_RSP_SCN:
608 case ISNS_FUNC_RSP_DDREG:
609 case ISNS_FUNC_RSP_DDDEREG:
610 case ISNS_FUNC_RSP_DDSREG:
611 case ISNS_FUNC_RSP_DDSDEREG:
612 case ISNS_FUNC_RSP_ESI:
613 case ISNS_FUNC_RSP_RQSTDOMID:
614 case ISNS_FUNC_RSP_RLSEDOMID:
615 case ISNS_FUNC_RSP_GETDOMID:
617 /* Get the Error message of the response */
618 /* The Error field exists only at the beginning of a message (i.e., in the first PDU */
619 if(flags&ISNS_FLAGS_FIRST_PDU){
620 proto_tree_add_item(tt,hf_isns_resp_errorcode, tvb, offset, 4, ENC_BIG_ENDIAN);
621 offset += 4;
624 /* Fall Thru if there are attributes */
625 if (tvb_reported_length_remaining(tvb, offset) == 0)
626 return tvb_captured_length(tvb);
627 /* FALL THROUGH */
628 /* Messages */
629 case ISNS_FUNC_DEVATTRREG:
630 case ISNS_FUNC_DEVATTRQRY:
631 case ISNS_FUNC_DEVGETNEXT:
632 case ISNS_FUNC_DEREGDEV:
633 case ISNS_FUNC_SCNREG:
634 case ISNS_FUNC_SCNDEREG:
635 case ISNS_FUNC_SCNEVENT:
636 case ISNS_FUNC_SCN:
637 case ISNS_FUNC_DDREG:
638 case ISNS_FUNC_DDDEREG:
639 case ISNS_FUNC_DDSREG:
640 case ISNS_FUNC_DDSDEREG:
641 case ISNS_FUNC_ESI:
642 case ISNS_FUNC_RQSTDOMID:
643 case ISNS_FUNC_RLSEDOMID:
644 case ISNS_FUNC_GETDOMID:
645 default:
646 /* we can only look at the attributes for the first PDU */
647 if(!(flags&ISNS_FLAGS_FIRST_PDU)){
648 proto_tree_add_expert(tt, pinfo, &ei_isns_not_first_pdu, tvb, offset, -1);
649 return tvb_captured_length(tvb);
652 packet_len = tvb_reported_length(tvb);
653 while( offset < packet_len )
655 offset = AddAttribute(pinfo, tvb, tt, offset, function_id);
659 return tvb_captured_length(tvb);
662 static unsigned
663 get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
665 uint16_t isns_len;
667 isns_len = tvb_get_ntohs(tvb, offset+4);
668 return (isns_len+ISNS_HEADER_SIZE);
671 static int
672 dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
674 int length = tvb_captured_length(tvb);
675 uint16_t isns_protocol_version;
676 uint16_t function_id;
678 if (length < ISNS_HEADER_SIZE) {
680 * Not enough room to see if this is valid iSNS.
682 return 0;
685 /* Get the protocol version - only version one at the moment*/
686 isns_protocol_version = tvb_get_ntohs(tvb, 0);
687 if (isns_protocol_version != ISNS_PROTO_VER)
688 return 0;
690 /* Get the function id from the packet */
691 function_id = tvb_get_ntohs(tvb, 2);
692 if (try_val_to_str_ext(function_id, &isns_function_ids_ext) == NULL) {
693 /* Unknown function ID */
694 return 0;
697 tcp_dissect_pdus(tvb, pinfo, tree, isns_desegment, ISNS_HEADER_SIZE, get_isns_pdu_len,
698 dissect_isns_pdu, data);
699 return length;
702 static int
703 dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
705 int length = tvb_captured_length(tvb);
706 uint16_t isns_protocol_version;
707 uint16_t function_id;
709 if (length < ISNS_HEADER_SIZE) {
711 * Not enough room to see if this is valid iSNS.
713 return 0;
716 /* Get the protocol version - only version one at the moment*/
717 isns_protocol_version = tvb_get_ntohs(tvb, 0);
718 if (isns_protocol_version != ISNS_PROTO_VER)
719 return 0;
721 /* Get the function id from the packet */
722 function_id = tvb_get_ntohs(tvb, 2);
723 if (try_val_to_str_ext(function_id, &isns_function_ids_ext) == NULL) {
724 /* Unknown function ID */
725 return 0;
728 dissect_isns_pdu(tvb, pinfo, tree, data);
729 return length;
733 static void
734 dissect_isns_attr_port(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf_index,
735 uint16_t isns_port_type, packet_info *pinfo)
737 uint16_t port = tvb_get_ntohs(tvb, offset+2);
738 bool is_udp = ((tvb_get_ntohs(tvb, offset) & 0x01) == 0x01);
739 conversation_t *conversation;
740 conversation_type ckt;
741 dissector_handle_t handle;
743 proto_tree_add_uint(tree, hf_index, tvb, offset, 4, port);
744 proto_tree_add_boolean(tree, hf_isns_port_type, tvb, offset, 2, is_udp);
746 if ((isns_port_type == ISNS_ESI_PORT) || (isns_port_type == ISNS_SCN_PORT)) {
747 if (is_udp) {
748 ckt = CONVERSATION_UDP;
749 handle = isns_udp_handle;
751 else {
752 ckt = CONVERSATION_TCP;
753 handle = isns_tcp_handle;
756 conversation = find_conversation(pinfo->num,
757 &pinfo->src, &pinfo->dst, ckt, port, 0, NO_PORT_B);
758 if (conversation == NULL) {
759 conversation = conversation_new(pinfo->num,
760 &pinfo->src, &pinfo->dst, ckt, port, 0, NO_PORT2_FORCE);
761 conversation_set_dissector(conversation, handle);
767 static void
768 dissect_isns_attr_iscsi_node_type(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
770 static int * const flags[] = {
771 &hf_isns_isnt_control,
772 &hf_isns_isnt_initiator,
773 &hf_isns_isnt_target,
774 NULL
777 proto_tree_add_bitmask(tree, tvb, offset,
778 hf_isns_iscsi_node_type, ett_isns_attribute, flags, ENC_BIG_ENDIAN);
783 static void
784 dissect_isns_attr_portal_security_bitmap(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
786 static int * const flags[] = {
787 &hf_isns_psb_tunnel_mode,
788 &hf_isns_psb_transport_mode,
789 &hf_isns_psb_pfs,
790 &hf_isns_psb_aggressive_mode,
791 &hf_isns_psb_main_mode,
792 &hf_isns_psb_ike_ipsec,
793 &hf_isns_psb_bitmap,
794 NULL
797 proto_tree_add_bitmask(tree, tvb, offset, hf_isns_psb, ett_isns_attribute, flags, ENC_BIG_ENDIAN);
802 static void
803 dissect_isns_attr_scn_bitmap(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
806 24 INITIATOR AND SELF INFORMATION ONLY
807 25 TARGET AND SELF INFORMATION ONLY
808 26 MANAGEMENT REGISTRATION/SCN
809 27 OBJECT REMOVED
810 28 OBJECT ADDED
811 29 OBJECT UPDATED
812 30 DD/DDS MEMBER REMOVED (Mgmt Reg/SCN only)
813 31 (Lsb) DD/DDS MEMBER ADDED (Mgmt Reg/SCN only)
815 static int * const flags[] = {
816 &hf_isns_scn_bitmap_initiator_and_self_information_only,
817 &hf_isns_scn_bitmap_target_and_self_information_only,
818 &hf_isns_scn_bitmap_management_registration_scn,
819 &hf_isns_scn_bitmap_object_removed,
820 &hf_isns_scn_bitmap_object_added,
821 &hf_isns_scn_bitmap_object_updated,
822 &hf_isns_scn_bitmap_dd_dds_member_removed,
823 &hf_isns_scn_bitmap_dd_dds_member_added,
824 NULL
827 proto_tree_add_bitmask(tree, tvb, offset, hf_isns_scn_bitmap, ett_isns_attribute, flags, ENC_BIG_ENDIAN);
831 static unsigned
832 AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, unsigned offset,
833 uint16_t function_id)
835 proto_tree *attr_tree;
836 proto_item *attr_item;
837 uint32_t tag,len;
838 proto_item *len_item;
840 attr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
841 ett_isns_attribute, &attr_item, "Attribute");
843 tag = tvb_get_ntohl(tvb, offset);
844 proto_tree_add_item(attr_tree, hf_isns_attr_tag,
845 tvb, offset, 4, ENC_BIG_ENDIAN);
846 offset +=4;
848 len = tvb_get_ntohl(tvb, offset);
849 len_item = proto_tree_add_item(attr_tree, hf_isns_attr_len,
850 tvb, offset, 4, ENC_BIG_ENDIAN);
851 offset +=4;
853 proto_item_append_text(attr_item, ": %s", val_to_str_ext_const(tag, &isns_attribute_tags_ext, "Unknown"));
855 /* it seems that an empty attribute is always valid, the original code had a similar statement */
856 if (len==0) {
857 if ((tag==ISNS_ATTR_TAG_PORTAL_GROUP_TAG) &&
858 ((function_id==ISNS_FUNC_DEVATTRREG) || (function_id==ISNS_FUNC_RSP_DEVATTRREG))) {
859 /* 5.6.5.1 */
860 proto_tree_add_uint_format_value(tree, hf_isns_portal_group_tag, tvb, offset, 8, 0, "<NULL>");
862 proto_item_set_len(attr_item, 8+len);
863 return offset;
866 switch( tag )
868 case ISNS_ATTR_TAG_DELIMITER:
869 /* delimiter has no data */
870 break;
871 case ISNS_ATTR_TAG_ENTITY_IDENTIFIER:
872 proto_tree_add_item(attr_tree, hf_isns_entity_identifier, tvb, offset, len, ENC_ASCII);
873 break;
874 case ISNS_ATTR_TAG_ENTITY_PROTOCOL:
875 ISNS_REQUIRE_ATTR_LEN(4);
876 proto_tree_add_item(attr_tree, hf_isns_entity_protocol, tvb, offset, len, ENC_BIG_ENDIAN);
877 break;
878 case ISNS_ATTR_TAG_MGMT_IP_ADDRESS:
879 ISNS_REQUIRE_ATTR_LEN(16);
880 proto_tree_add_item(attr_tree, hf_isns_mgmt_ip_addr, tvb, offset, len, ENC_NA);
881 break;
882 case ISNS_ATTR_TAG_TIMESTAMP:
883 ISNS_REQUIRE_ATTR_LEN(8);
884 proto_tree_add_item(attr_tree, hf_isns_timestamp, tvb, offset, len, ENC_BIG_ENDIAN);
885 break;
886 case ISNS_ATTR_TAG_REGISTRATION_PERIOD:
887 ISNS_REQUIRE_ATTR_LEN(4);
888 proto_tree_add_item(attr_tree, hf_isns_registration_period, tvb, offset, len, ENC_BIG_ENDIAN);
889 break;
890 case ISNS_ATTR_TAG_ENTITY_INDEX:
891 ISNS_REQUIRE_ATTR_LEN(4);
892 proto_tree_add_item(attr_tree, hf_isns_entity_index, tvb, offset, len, ENC_BIG_ENDIAN);
893 break;
894 case ISNS_ATTR_TAG_ENTITY_NEXT_INDEX:
895 ISNS_REQUIRE_ATTR_LEN(4);
896 proto_tree_add_item(attr_tree, hf_isns_entity_next_index, tvb, offset, len, ENC_BIG_ENDIAN);
897 break;
898 case ISNS_ATTR_TAG_PORTAL_IP_ADDRESS:
899 proto_tree_add_item(attr_tree, hf_isns_portal_ip_addr, tvb, offset, len, ENC_NA);
900 break;
901 case ISNS_ATTR_TAG_PORTAL_PORT:
902 dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_portal_port, ISNS_OTHER_PORT, pinfo);
903 break;
904 case ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME:
905 proto_tree_add_item(attr_tree, hf_isns_portal_symbolic_name, tvb, offset, len, ENC_ASCII);
906 break;
907 case ISNS_ATTR_TAG_ESI_INTERVAL:
908 proto_tree_add_item(attr_tree, hf_isns_esi_interval, tvb, offset, len, ENC_BIG_ENDIAN);
909 break;
910 case ISNS_ATTR_TAG_ESI_PORT:
911 dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_esi_port, ISNS_ESI_PORT, pinfo);
912 break;
913 case ISNS_ATTR_TAG_PORTAL_INDEX:
914 proto_tree_add_item(attr_tree, hf_isns_portal_index, tvb, offset, len, ENC_BIG_ENDIAN);
915 break;
916 case ISNS_ATTR_TAG_SCN_PORT:
917 dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_scn_port, ISNS_SCN_PORT, pinfo);
918 break;
919 case ISNS_ATTR_TAG_PORTAL_NEXT_INDEX:
920 proto_tree_add_item(attr_tree, hf_isns_portal_next_index, tvb, offset, len, ENC_BIG_ENDIAN);
921 break;
922 case ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP:
923 dissect_isns_attr_portal_security_bitmap(tvb, offset, attr_tree);
924 break;
925 case ISNS_ATTR_TAG_ISCSI_NAME:
926 proto_tree_add_item(attr_tree, hf_isns_iscsi_name, tvb, offset, len, ENC_ASCII);
927 break;
928 case ISNS_ATTR_TAG_ISCSI_NODE_TYPE:
929 ISNS_REQUIRE_ATTR_LEN(4);
930 dissect_isns_attr_iscsi_node_type(tvb, offset, attr_tree);
931 break;
932 case ISNS_ATTR_TAG_ISCSI_ALIAS:
933 proto_tree_add_item(attr_tree, hf_isns_iscsi_alias, tvb, offset, len, ENC_ASCII);
934 break;
935 case ISNS_ATTR_TAG_ISCSI_SCN_BITMAP:
936 ISNS_REQUIRE_ATTR_LEN(4);
937 dissect_isns_attr_scn_bitmap(tvb, offset, attr_tree);
938 break;
939 case ISNS_ATTR_TAG_ISCSI_NODE_INDEX:
940 ISNS_REQUIRE_ATTR_LEN(4);
941 proto_tree_add_item(attr_tree, hf_isns_node_index, tvb, offset, len, ENC_BIG_ENDIAN);
942 break;
943 case ISNS_ATTR_TAG_WWNN_TOKEN:
944 ISNS_REQUIRE_ATTR_LEN(8);
945 proto_tree_add_item(attr_tree, hf_isns_wwnn_token, tvb, offset, len, ENC_BIG_ENDIAN);
946 break;
947 case ISNS_ATTR_TAG_ISCSI_NODE_NEXT_INDEX:
948 ISNS_REQUIRE_ATTR_LEN(4);
949 proto_tree_add_item(attr_tree, hf_isns_node_next_index, tvb, offset, len, ENC_BIG_ENDIAN);
950 break;
951 case ISNS_ATTR_TAG_ISCSI_AUTH_METHOD:
952 proto_tree_add_item(attr_tree, hf_isns_iscsi_auth_method, tvb, offset, len, ENC_ASCII);
953 break;
954 case ISNS_ATTR_TAG_PG_ISCSI_NAME:
955 proto_tree_add_item(attr_tree, hf_isns_pg_iscsi_name, tvb, offset, len, ENC_ASCII);
956 break;
957 case ISNS_ATTR_TAG_PG_PORTAL_IP_ADDR:
958 proto_tree_add_item(attr_tree, hf_isns_pg_portal_ip_addr, tvb, offset, len, ENC_NA);
959 break;
960 case ISNS_ATTR_TAG_PG_PORTAL_PORT:
961 ISNS_REQUIRE_ATTR_LEN(4);
962 dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_pg_portal_port, ISNS_OTHER_PORT, pinfo);
963 break;
964 case ISNS_ATTR_TAG_PORTAL_GROUP_TAG:
965 ISNS_REQUIRE_ATTR_LEN(4);
966 proto_tree_add_item(attr_tree, hf_isns_portal_group_tag, tvb, offset, len, ENC_BIG_ENDIAN);
967 break;
968 case ISNS_ATTR_TAG_PORTAL_GROUP_INDEX:
969 ISNS_REQUIRE_ATTR_LEN(4);
970 proto_tree_add_item(attr_tree, hf_isns_pg_index, tvb, offset, len, ENC_BIG_ENDIAN);
971 break;
972 case ISNS_ATTR_TAG_PORTAL_GROUP_NEXT_INDEX:
973 ISNS_REQUIRE_ATTR_LEN(4);
974 proto_tree_add_item(attr_tree, hf_isns_pg_next_index, tvb, offset, len, ENC_BIG_ENDIAN);
975 break;
976 case ISNS_ATTR_TAG_FC_PORT_NAME_WWPN:
977 ISNS_REQUIRE_ATTR_LEN(8);
978 proto_tree_add_item(attr_tree, hf_isns_fc_port_name_wwpn, tvb, offset, len, ENC_BIG_ENDIAN);
979 break;
980 case ISNS_ATTR_TAG_PORT_ID:
981 ISNS_REQUIRE_ATTR_LEN(3);
982 proto_tree_add_item(attr_tree, hf_isns_port_id, tvb, offset, len, ENC_BIG_ENDIAN);
983 break;
985 0x0000 Unidentified/Null Entry
986 0x0001 Fibre Channel N_Port
987 0x0002 Fibre Channel NL_Port
988 0x0003 Fibre Channel F/NL_Port
989 0x0081 Fibre Channel F_Port
990 0x0082 Fibre Channel FL_Port
991 0x0084 Fibre Channel E_Port
992 0xFF12 iFCP Port
994 case ISNS_ATTR_TAG_SYMBOLIC_PORT_NAME:
995 proto_tree_add_item(attr_tree, hf_isns_symbolic_port_name, tvb, offset, len, ENC_ASCII);
996 break;
997 case ISNS_ATTR_TAG_FABRIC_PORT_NAME:
998 ISNS_REQUIRE_ATTR_LEN(8);
999 proto_tree_add_item(attr_tree, hf_isns_fabric_port_name, tvb, offset, len, ENC_BIG_ENDIAN);
1000 break;
1001 case ISNS_ATTR_TAG_HARD_ADDRESS:
1002 ISNS_REQUIRE_ATTR_LEN(3);
1003 proto_tree_add_item(attr_tree, hf_isns_hard_address, tvb, offset, len, ENC_BIG_ENDIAN);
1004 break;
1005 case ISNS_ATTR_TAG_PORT_IP_ADDRESS:
1006 ISNS_REQUIRE_ATTR_LEN(16);
1007 proto_tree_add_item(attr_tree, hf_isns_port_ip_addr, tvb, offset, len, ENC_NA);
1008 break;
1010 bit 29 Fibre Channel Class 2 Supported
1011 bit 28 Fibre Channel Class 3 Supported
1013 case ISNS_ATTR_TAG_FC4_DESCRIPTOR:
1014 proto_tree_add_item(attr_tree, hf_isns_fc4_descriptor, tvb, offset, len, ENC_ASCII);
1015 break;
1017 bit 29 Control
1018 bit 30 FCP Initiator
1019 bit 31 (Lsb) FCP Target
1021 case ISNS_ATTR_TAG_PERMANENT_PORT_NAME:
1022 ISNS_REQUIRE_ATTR_LEN(8);
1023 proto_tree_add_item(attr_tree, hf_isns_permanent_port_name, tvb, offset, len, ENC_BIG_ENDIAN);
1024 break;
1025 /* 8bit type code in byte0 */
1026 case ISNS_ATTR_TAG_FC_NODE_NAME_WWNN:
1027 ISNS_REQUIRE_ATTR_LEN(8);
1028 proto_tree_add_item(attr_tree, hf_isns_fc_node_name_wwnn, tvb, offset, len, ENC_BIG_ENDIAN);
1029 break;
1030 case ISNS_ATTR_TAG_SYMBOLIC_NODE_NAME:
1031 proto_tree_add_item(attr_tree, hf_isns_symbolic_node_name, tvb, offset, len, ENC_ASCII);
1032 break;
1033 case ISNS_ATTR_TAG_NODE_IP_ADDRESS:
1034 ISNS_REQUIRE_ATTR_LEN(16);
1035 proto_tree_add_item(attr_tree, hf_isns_node_ip_addr, tvb, offset, len, ENC_NA);
1036 break;
1037 case ISNS_ATTR_TAG_NODE_IPA:
1038 ISNS_REQUIRE_ATTR_LEN(8);
1039 proto_tree_add_item(attr_tree, hf_isns_node_ipa, tvb, offset, len, ENC_BIG_ENDIAN);
1040 break;
1041 case ISNS_ATTR_TAG_PROXY_ISCSI_NAME:
1042 proto_tree_add_item(attr_tree, hf_isns_proxy_iscsi_name, tvb, offset, len, ENC_ASCII);
1043 break;
1044 case ISNS_ATTR_TAG_SWITCH_NAME:
1045 ISNS_REQUIRE_ATTR_LEN(8);
1046 proto_tree_add_item(attr_tree, hf_isns_switch_name, tvb, offset, len, ENC_BIG_ENDIAN);
1047 break;
1048 case ISNS_ATTR_TAG_PREFERRED_ID:
1049 ISNS_REQUIRE_ATTR_LEN(4);
1050 proto_tree_add_item(attr_tree, hf_isns_preferred_id, tvb, offset, len, ENC_BIG_ENDIAN);
1051 break;
1052 case ISNS_ATTR_TAG_ASSIGNED_ID:
1053 ISNS_REQUIRE_ATTR_LEN(4);
1054 proto_tree_add_item(attr_tree, hf_isns_assigned_id, tvb, offset, len, ENC_BIG_ENDIAN);
1055 break;
1056 case ISNS_ATTR_TAG_VIRTUAL_FABRIC_ID:
1057 proto_tree_add_item(attr_tree, hf_isns_virtual_fabric_id, tvb, offset, len, ENC_ASCII);
1058 break;
1059 case ISNS_ATTR_TAG_VENDOR_OUI:
1060 ISNS_REQUIRE_ATTR_LEN(4);
1061 proto_tree_add_item(attr_tree, hf_isns_vendor_oui, tvb, offset, len, ENC_BIG_ENDIAN);
1062 break;
1063 case ISNS_ATTR_TAG_DD_SET_ID:
1064 ISNS_REQUIRE_ATTR_LEN(4);
1065 proto_tree_add_item(attr_tree, hf_isns_dd_set_id, tvb, offset, len, ENC_BIG_ENDIAN);
1066 break;
1067 case ISNS_ATTR_TAG_DD_SET_SYMBOLIC_NAME:
1068 proto_tree_add_item(attr_tree, hf_isns_dd_set_symbolic_name, tvb, offset, len, ENC_ASCII);
1069 break;
1070 case ISNS_ATTR_TAG_DD_SET_NEXT_ID:
1071 ISNS_REQUIRE_ATTR_LEN(4);
1072 proto_tree_add_item(attr_tree, hf_isns_dd_set_next_id, tvb, offset, len, ENC_BIG_ENDIAN);
1073 break;
1074 case ISNS_ATTR_TAG_DD_ID:
1075 ISNS_REQUIRE_ATTR_LEN(4);
1076 proto_tree_add_item(attr_tree, hf_isns_dd_id, tvb, offset, len, ENC_BIG_ENDIAN);
1077 break;
1078 case ISNS_ATTR_TAG_DD_SYMBOLIC_NAME:
1079 proto_tree_add_item(attr_tree, hf_isns_dd_symbolic_name, tvb, offset, len, ENC_ASCII);
1080 break;
1081 case ISNS_ATTR_TAG_DD_MEMBER_ISCSI_INDEX:
1082 ISNS_REQUIRE_ATTR_LEN(4);
1083 proto_tree_add_item(attr_tree, hf_isns_member_iscsi_index, tvb, offset, len, ENC_BIG_ENDIAN);
1084 break;
1085 case ISNS_ATTR_TAG_DD_MEMBER_ISCSI_NAME:
1086 proto_tree_add_item(attr_tree, hf_isns_dd_member_iscsi_name, tvb, offset, len, ENC_ASCII);
1087 break;
1088 case ISNS_ATTR_TAG_DD_MEMBER_FC_PORT_NAME:
1089 ISNS_REQUIRE_ATTR_LEN(4);
1090 proto_tree_add_item(attr_tree, hf_isns_member_fc_port_name, tvb, offset, len, ENC_BIG_ENDIAN);
1091 break;
1092 case ISNS_ATTR_TAG_DD_MEMBER_PORTAL_INDEX:
1093 ISNS_REQUIRE_ATTR_LEN(4);
1094 proto_tree_add_item(attr_tree, hf_isns_member_portal_index, tvb, offset, len, ENC_BIG_ENDIAN);
1095 break;
1096 case ISNS_ATTR_TAG_DD_MEMBER_PORTAL_IP_ADDRESS:
1097 ISNS_REQUIRE_ATTR_LEN(16);
1098 proto_tree_add_item(attr_tree, hf_isns_dd_member_portal_ip_addr, tvb, offset, len, ENC_NA);
1099 break;
1100 case ISNS_ATTR_TAG_DD_MEMBER_PORTAL_PORT:
1101 ISNS_REQUIRE_ATTR_LEN(4);
1102 dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_dd_member_portal_port, ISNS_OTHER_PORT, pinfo);
1103 break;
1104 case ISNS_ATTR_TAG_DD_ID_NEXT_ID:
1105 ISNS_REQUIRE_ATTR_LEN(4);
1106 proto_tree_add_item(attr_tree, hf_isns_dd_id_next_id, tvb, offset, len, ENC_BIG_ENDIAN);
1107 break;
1108 default:
1109 proto_tree_add_item(attr_tree, hf_isns_not_decoded_yet, tvb, offset, len, ENC_NA);
1112 /* Make sure the data is all there - and that the length won't overflow */
1113 tvb_ensure_bytes_exist(tvb, offset, len);
1114 /* Set the length of the item to cover only the actual item length */
1115 proto_item_set_len(attr_item, 8+len);
1117 offset += len;
1118 return offset;
1123 void proto_register_isns(void)
1125 /* Setup list of header fields See Section 1.6.1 for details*/
1126 static hf_register_info hf[] = {
1127 /* The Header Stuff */
1128 { &hf_isns_version,
1129 { "iSNSP Version", "isns.PVer",
1130 FT_UINT16, BASE_DEC, NULL, 0,
1131 NULL, HFILL}
1133 { &hf_isns_function_id,
1134 { "Function ID", "isns.functionid",
1135 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &isns_function_ids_ext, 0,
1136 NULL, HFILL}
1138 { &hf_isns_pdu_length,
1139 { "PDU Length", "isns.pdulength",
1140 FT_UINT16, BASE_DEC, NULL, 0,
1141 NULL, HFILL}
1144 { &hf_isns_flags,
1145 { "Flags", "isns.flags",
1146 FT_UINT16, BASE_HEX, NULL, 0,
1147 NULL, HFILL}
1149 { &hf_isns_client,
1150 { "Client", "isns.flags.client",
1151 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_client), ISNS_FLAGS_CLIENT,
1152 NULL, HFILL}
1154 { &hf_isns_server,
1155 { "Server", "isns.flags.server",
1156 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_server), ISNS_FLAGS_SERVER,
1157 NULL, HFILL}
1159 { &hf_isns_auth,
1160 { "Auth", "isns.flags.authentication_block",
1161 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_auth), ISNS_FLAGS_AUTH,
1162 "is iSNS Authentication Block present?", HFILL}
1164 { &hf_isns_replace,
1165 { "Replace", "isns.flags.replace",
1166 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_replace), ISNS_FLAGS_REPLACE,
1167 NULL, HFILL}
1169 { &hf_isns_last_pdu,
1170 { "Last PDU", "isns.flags.lastpdu",
1171 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_last_pdu), ISNS_FLAGS_LAST_PDU,
1172 NULL, HFILL}
1174 { &hf_isns_first_pdu,
1175 { "First PDU", "isns.flags.firstpdu",
1176 FT_BOOLEAN, 16, TFS(&tfs_isns_flag_first_pdu), ISNS_FLAGS_FIRST_PDU,
1177 NULL, HFILL }
1181 { &hf_isns_transaction_id,
1182 { "Transaction ID", "isns.transactionid",
1183 FT_UINT16, BASE_DEC, NULL, 0,
1184 NULL, HFILL}
1186 { &hf_isns_sequence_id,
1187 { "Sequence ID", "isns.sequenceid",
1188 FT_UINT16, BASE_DEC, NULL, 0,
1189 NULL, HFILL}
1192 { &hf_isns_entity_protocol,
1193 { "Entity Protocol", "isns.entity_protocol",
1194 FT_UINT32, BASE_DEC, VALS(isns_entity_protocol), 0,
1195 NULL, HFILL}
1197 /* The Payload stuff */
1199 { &hf_isns_dd_member_portal_port,
1200 { "DD Member Portal Port", "isns.dd_member_portal_port",
1201 FT_UINT32, BASE_DEC, NULL, 0,
1202 "TCP/UDP DD Member Portal Port", HFILL }
1205 { &hf_isns_iscsi_node_type,
1206 { "iSCSI Node Type", "isns.iscsi.node_type",
1207 FT_UINT32, BASE_HEX, NULL, 0,
1208 NULL, HFILL }
1211 { &hf_isns_esi_port,
1212 { "ESI Port", "isns.esi_port",
1213 FT_UINT32, BASE_DEC, NULL, 0,
1214 "TCP/UDP ESI Port", HFILL }
1217 { &hf_isns_scn_port,
1218 { "SCN Port", "isns.scn_port",
1219 FT_UINT32, BASE_DEC, NULL, 0,
1220 "TCP/UDP SCN Port", HFILL }
1223 { &hf_isns_portal_port,
1224 { "Portal Port", "isns.portal_port",
1225 FT_UINT32, BASE_DEC, NULL, 0,
1226 "TCP/UDP Portal Port", HFILL }
1229 { &hf_isns_pg_portal_port,
1230 { "PG Portal Port", "isns.pg.portal_port",
1231 FT_UINT32, BASE_DEC, NULL, 0,
1232 "PG Portal TCP/UDP Port", HFILL }
1235 { &hf_isns_port_type,
1236 { "Port Type", "isns.port.port_type",
1237 FT_BOOLEAN, 16, TFS(&tfs_isns_port_type), 0x0001, /* bit 15 (or bit 1 of a 16bit word) */
1238 NULL, HFILL }
1241 { &hf_isns_psb,
1242 { "Portal Security Bitmap", "isns.psb",
1243 FT_UINT32, BASE_HEX, NULL, 0,
1244 NULL, HFILL }
1246 { &hf_isns_psb_tunnel_mode,
1247 { "Tunnel Mode", "isns.psb.tunnel",
1248 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_tunnel_mode), 0x00000040, /* bit 25 */
1249 "Tunnel Mode Preferred", HFILL }
1251 { &hf_isns_psb_transport_mode,
1252 { "Transport Mode", "isns.psb.transport",
1253 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_transport_mode), 0x00000020, /* bit 26 */
1254 NULL, HFILL }
1256 { &hf_isns_psb_pfs,
1257 { "PFS", "isns.psb.pfs",
1258 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_pfs), 0x00000010, /* bit 27 */
1259 NULL, HFILL }
1261 { &hf_isns_psb_aggressive_mode,
1262 { "Aggressive Mode", "isns.psb.aggressive_mode",
1263 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_aggressive_mode), 0x00000008, /* bit 28 */
1264 NULL, HFILL }
1266 { &hf_isns_psb_main_mode,
1267 { "Main Mode", "isns.psb.main_mode",
1268 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_main_mode), 0x00000004, /* bit 29 */
1269 NULL, HFILL }
1271 { &hf_isns_psb_ike_ipsec,
1272 { "IKE/IPSec", "isns.psb.ike_ipsec",
1273 FT_BOOLEAN, 32, TFS(&tfs_isns_psb_ike_ipsec), 0x00000002, /* bit 30 */
1274 NULL, HFILL }
1276 { &hf_isns_psb_bitmap,
1277 { "Bitmap", "isns.psb.bitmap",
1278 FT_BOOLEAN, 32, TFS(&tfs_valid_invalid), 0x00000001, /* bit 31 */
1279 NULL, HFILL }
1284 { &hf_isns_scn_bitmap,
1285 { "iSCSI SCN Bitmap", "isns.scn_bitmap",
1286 FT_UINT32, BASE_HEX, NULL, 0,
1287 NULL, HFILL }
1289 { &hf_isns_scn_bitmap_initiator_and_self_information_only,
1290 { "Initiator And Self Information Only", "isns.scn_bitmap.initiator_and_self_information_only",
1291 FT_BOOLEAN, 32, NULL, 0x00000080, /* bit 24 */
1292 NULL, HFILL }
1294 { &hf_isns_scn_bitmap_target_and_self_information_only,
1295 { "Target And Self Information Only", "isns.scn_bitmap.target_and_self_information_only",
1296 FT_BOOLEAN, 32, NULL, 0x00000040, /* bit 25 */
1297 NULL, HFILL }
1299 { &hf_isns_scn_bitmap_management_registration_scn,
1300 { "Management Registration/SCN", "isns.scn_bitmap.management_registration_scn",
1301 FT_BOOLEAN, 32, NULL, 0x00000020, /* bit 26 */
1302 NULL, HFILL }
1304 { &hf_isns_scn_bitmap_object_removed,
1305 { "Object Removed", "isns.scn_bitmap.object_removed",
1306 FT_BOOLEAN, 32, NULL, 0x00000010, /* bit 27 */
1307 NULL, HFILL }
1309 { &hf_isns_scn_bitmap_object_added,
1310 { "Object Added", "isns.scn_bitmap.object_added",
1311 FT_BOOLEAN, 32, NULL, 0x00000008, /* bit 28 */
1312 NULL, HFILL }
1314 { &hf_isns_scn_bitmap_object_updated,
1315 { "Object Updated", "isns.scn_bitmap.object_updated",
1316 FT_BOOLEAN, 32, NULL, 0x00000004, /* bit 29 */
1317 NULL, HFILL }
1319 { &hf_isns_scn_bitmap_dd_dds_member_removed,
1320 { "DD/DDS Member Removed (Mgmt Reg/SCN only)", "isns.scn_bitmap.dd_dds_member_removed",
1321 FT_BOOLEAN, 32, NULL, 0x00000002, /* bit 30 */
1322 NULL, HFILL }
1324 { &hf_isns_scn_bitmap_dd_dds_member_added,
1325 { "DD/DDS Member Added (Mgmt Reg/SCN only)", "isns.scn_bitmap.dd_dds_member_added",
1326 FT_BOOLEAN, 32, NULL, 0x00000001, /* bit 31 */
1327 NULL, HFILL }
1331 { &hf_isns_isnt_control,
1332 { "Control", "isns.isnt.control",
1333 FT_BOOLEAN, 32, TFS(&tfs_isns_isnt_control), 0x00000004, /* bit 29 */
1334 NULL, HFILL }
1336 { &hf_isns_isnt_initiator,
1337 { "Initiator", "isns.isnt.initiator",
1338 FT_BOOLEAN, 32, TFS(&tfs_isns_isnt_initiator), 0x00000002, /* bit 30 */
1339 NULL, HFILL }
1341 { &hf_isns_isnt_target,
1342 { "Target", "isns.isnt.target",
1343 FT_BOOLEAN, 32, TFS(&tfs_isns_isnt_target), 0x00000001, /* bit 31 */
1344 NULL, HFILL }
1348 { &hf_isns_resp_errorcode,
1349 { "ErrorCode", "isns.errorcode",
1350 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &isns_errorcode_ext, 0,
1351 "iSNS Response Error Code", HFILL}
1354 { &hf_isns_attr_tag,
1355 { "Attribute Tag", "isns.attr.tag",
1356 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &isns_attribute_tags_ext, 0,
1357 NULL, HFILL}
1360 { &hf_isns_attr_len,
1361 { "Attribute Length", "isns.attr.len",
1362 FT_UINT32, BASE_DEC, NULL, 0,
1363 NULL, HFILL}
1366 { &hf_isns_not_decoded_yet,
1367 { "Not Decoded Yet", "isns.not_decoded_yet",
1368 FT_NONE, BASE_NONE, NULL, 0,
1369 "This tag is not yet decoded by Wireshark", HFILL}
1372 { &hf_isns_heartbeat_ipv6_addr,
1373 { "Heartbeat Address (ipv6)", "isns.heartbeat.address",
1374 FT_IPv6, BASE_NONE, NULL, 0x0,
1375 "Server IPv6 Address", HFILL }},
1377 { &hf_isns_heartbeat_tcp_port,
1378 { "Heartbeat TCP Port", "isns.heartbeat.tcpport",
1379 FT_UINT16, BASE_DEC, NULL, 0x0,
1380 "Server TCP Port", HFILL }},
1382 { &hf_isns_heartbeat_udp_port,
1383 { "Heartbeat UDP Port", "isns.heartbeat.udpport",
1384 FT_UINT16, BASE_DEC, NULL, 0x0,
1385 "Server UDP Port", HFILL }},
1388 { &hf_isns_heartbeat_interval,
1389 { "Heartbeat Interval (secs)", "isns.heartbeat.interval",
1390 FT_UINT32, BASE_DEC, NULL, 0x0,
1391 "Server Heartbeat interval", HFILL }},
1393 { &hf_isns_heartbeat_counter,
1394 { "Heartbeat counter", "isns.heartbeat.counter",
1395 FT_UINT32, BASE_DEC, NULL, 0x0,
1396 "Server Heartbeat Counter", HFILL }},
1398 { &hf_isns_iscsi_name,
1399 { "iSCSI Name", "isns.iscsi_name",
1400 FT_STRING, BASE_NONE, NULL, 0x0,
1401 "iSCSI Name of device", HFILL }},
1403 { &hf_isns_dd_member_iscsi_name,
1404 { "DD Member iSCSI Name", "isns.dd_member.iscsi_name",
1405 FT_STRING, BASE_NONE, NULL, 0x0,
1406 "DD Member iSCSI Name of device", HFILL }},
1408 { &hf_isns_virtual_fabric_id,
1409 { "Virtual Fabric ID", "isns.virtual_fabric_id",
1410 FT_STRING, BASE_NONE, NULL, 0x0,
1411 NULL, HFILL }},
1413 { &hf_isns_proxy_iscsi_name,
1414 { "Proxy iSCSI Name", "isns.proxy_iscsi_name",
1415 FT_STRING, BASE_NONE, NULL, 0x0,
1416 NULL, HFILL }},
1418 { &hf_isns_fc4_descriptor,
1419 { "FC4 Descriptor", "isns.fc4_descriptor",
1420 FT_STRING, BASE_NONE, NULL, 0x0,
1421 "FC4 Descriptor of this device", HFILL }},
1423 { &hf_isns_iscsi_auth_method,
1424 { "iSCSI Auth Method", "isns.iscsi_auth_method",
1425 FT_STRING, BASE_NONE, NULL, 0x0,
1426 "Authentication Method required by this device", HFILL }},
1428 { &hf_isns_iscsi_alias,
1429 { "iSCSI Alias", "isns.iscsi_alias",
1430 FT_STRING, BASE_NONE, NULL, 0x0,
1431 "iSCSI Alias of device", HFILL }},
1433 { &hf_isns_portal_symbolic_name,
1434 { "Portal Symbolic Name", "isns.portal.symbolic_name",
1435 FT_STRING, BASE_NONE, NULL, 0x0,
1436 "Symbolic name of this portal", HFILL }},
1438 { &hf_isns_dd_set_symbolic_name,
1439 { "DD Set Symbolic Name", "isns.dd_set.symbolic_name",
1440 FT_STRING, BASE_NONE, NULL, 0x0,
1441 "Symbolic name of this DD Set", HFILL }},
1443 { &hf_isns_dd_symbolic_name,
1444 { "DD Symbolic Name", "isns.dd.symbolic_name",
1445 FT_STRING, BASE_NONE, NULL, 0x0,
1446 "Symbolic name of this DD", HFILL }},
1448 { &hf_isns_symbolic_port_name,
1449 { "Symbolic Port Name", "isns.port.symbolic_name",
1450 FT_STRING, BASE_NONE, NULL, 0x0,
1451 "Symbolic name of this port", HFILL }},
1453 { &hf_isns_symbolic_node_name,
1454 { "Symbolic Node Name", "isns.node.symbolic_name",
1455 FT_STRING, BASE_NONE, NULL, 0x0,
1456 "Symbolic name of this node", HFILL }},
1458 { &hf_isns_entity_identifier,
1459 { "Entity Identifier", "isns.entity_identifier",
1460 FT_STRING, BASE_NONE, NULL, 0x0,
1461 "Entity Identifier of this object", HFILL }},
1463 { &hf_isns_mgmt_ip_addr,
1464 { "Management IP Address", "isns.mgmt.ip_address",
1465 FT_IPv6, BASE_NONE, NULL, 0x0,
1466 "Management IPv4/IPv6 Address", HFILL }},
1468 { &hf_isns_node_ip_addr,
1469 { "Node IP Address", "isns.node.ip_address",
1470 FT_IPv6, BASE_NONE, NULL, 0x0,
1471 "Node IPv4/IPv6 Address", HFILL }},
1473 { &hf_isns_port_ip_addr,
1474 { "Port IP Address", "isns.port.ip_address",
1475 FT_IPv6, BASE_NONE, NULL, 0x0,
1476 "Port IPv4/IPv6 Address", HFILL }},
1478 { &hf_isns_portal_ip_addr,
1479 { "Portal IP Address", "isns.portal.ip_address",
1480 FT_IPv6, BASE_NONE, NULL, 0x0,
1481 "Portal IPv4/IPv6 Address", HFILL }},
1483 { &hf_isns_dd_member_portal_ip_addr,
1484 { "DD Member Portal IP Address", "isns.dd.member_portal.ip_address",
1485 FT_IPv6, BASE_NONE, NULL, 0x0,
1486 "DD Member Portal IPv4/IPv6 Address", HFILL }},
1488 { &hf_isns_pg_iscsi_name,
1489 { "PG iSCSI Name", "isns.pg_iscsi_name",
1490 FT_STRING, BASE_NONE, NULL, 0x0,
1491 NULL, HFILL }},
1493 { &hf_isns_pg_portal_ip_addr,
1494 { "PG Portal IP Address", "isns.pg_portal.ip_address",
1495 FT_IPv6, BASE_NONE, NULL, 0x0,
1496 "PG Portal IPv4/IPv6 Address", HFILL }},
1498 { &hf_isns_pg_index,
1499 { "PG Index", "isns.pg_index",
1500 FT_UINT32, BASE_DEC, NULL, 0x0,
1501 NULL, HFILL }},
1503 { &hf_isns_pg_next_index,
1504 { "PG Next Index", "isns.pg_next_index",
1505 FT_UINT32, BASE_DEC, NULL, 0x0,
1506 NULL, HFILL }},
1508 { &hf_isns_dd_id_next_id,
1509 { "DD ID Next ID", "isns.dd_id_next_id",
1510 FT_UINT32, BASE_DEC, NULL, 0x0,
1511 NULL, HFILL }},
1513 { &hf_isns_member_iscsi_index,
1514 { "Member iSCSI Index", "isns.member_iscsi_index",
1515 FT_UINT32, BASE_DEC, NULL, 0x0,
1516 NULL, HFILL }},
1518 { &hf_isns_member_portal_index,
1519 { "Member Portal Index", "isns.member_portal_index",
1520 FT_UINT32, BASE_DEC, NULL, 0x0,
1521 NULL, HFILL }},
1523 { &hf_isns_member_fc_port_name,
1524 { "Member FC Port Name", "isns.member_fc_port_name",
1525 FT_UINT32, BASE_DEC, NULL, 0x0,
1526 NULL, HFILL }},
1528 { &hf_isns_vendor_oui,
1529 { "Vendor OUI", "isns.vendor_oui",
1530 FT_UINT32, BASE_DEC, NULL, 0x0,
1531 NULL, HFILL }},
1533 { &hf_isns_preferred_id,
1534 { "Preferred ID", "isns.preferred_id",
1535 FT_UINT32, BASE_DEC, NULL, 0x0,
1536 NULL, HFILL }},
1538 { &hf_isns_dd_set_id,
1539 { "DD Set ID", "isns.dd_set_id",
1540 FT_UINT32, BASE_DEC, NULL, 0x0,
1541 NULL, HFILL }},
1543 { &hf_isns_dd_id,
1544 { "DD ID", "isns.dd_id",
1545 FT_UINT32, BASE_DEC, NULL, 0x0,
1546 NULL, HFILL }},
1548 { &hf_isns_port_id,
1549 { "Port ID", "isns.port_id",
1550 FT_UINT24, BASE_HEX, NULL, 0x0,
1551 NULL, HFILL }},
1553 { &hf_isns_hard_address,
1554 { "Hard Address", "isns.hard_address",
1555 FT_UINT24, BASE_HEX, NULL, 0x0,
1556 NULL, HFILL }},
1558 { &hf_isns_wwnn_token,
1559 { "WWNN Token", "isns.wwnn_token",
1560 FT_UINT64, BASE_HEX, NULL, 0x0,
1561 NULL, HFILL }},
1563 { &hf_isns_fc_port_name_wwpn,
1564 { "FC Port Name WWPN", "isns.fc_port_name_wwpn",
1565 FT_UINT64, BASE_HEX, NULL, 0x0,
1566 NULL, HFILL }},
1568 { &hf_isns_fc_node_name_wwnn,
1569 { "FC Node Name WWNN", "isns.fc_node_name_wwnn",
1570 FT_UINT64, BASE_HEX, NULL, 0x0,
1571 NULL, HFILL }},
1573 { &hf_isns_node_ipa,
1574 { "Node IPA", "isns.node_ipa",
1575 FT_UINT64, BASE_HEX, NULL, 0x0,
1576 NULL, HFILL }},
1578 { &hf_isns_fabric_port_name,
1579 { "Fabric Port Name", "isns.fabric_port_name",
1580 FT_UINT64, BASE_HEX, NULL, 0x0,
1581 NULL, HFILL }},
1583 { &hf_isns_permanent_port_name,
1584 { "Permanent Port Name", "isns.permanent_port_name",
1585 FT_UINT64, BASE_HEX, NULL, 0x0,
1586 NULL, HFILL }},
1588 { &hf_isns_switch_name,
1589 { "Switch Name", "isns.switch_name",
1590 FT_UINT64, BASE_HEX, NULL, 0x0,
1591 NULL, HFILL }},
1593 { &hf_isns_dd_set_next_id,
1594 { "DD Set Next ID", "isns.dd_set_next_id",
1595 FT_UINT32, BASE_DEC, NULL, 0x0,
1596 NULL, HFILL }},
1598 { &hf_isns_assigned_id,
1599 { "Assigned ID", "isns.assigned_id",
1600 FT_UINT32, BASE_DEC, NULL, 0x0,
1601 NULL, HFILL }},
1603 { &hf_isns_node_index,
1604 { "Node Index", "isns.node.index",
1605 FT_UINT32, BASE_DEC, NULL, 0x0,
1606 NULL, HFILL }},
1608 { &hf_isns_node_next_index,
1609 { "Node Next Index", "isns.node.next_index",
1610 FT_UINT32, BASE_DEC, NULL, 0x0,
1611 "Node INext index", HFILL }},
1613 { &hf_isns_portal_index,
1614 { "Portal Index", "isns.portal.index",
1615 FT_UINT32, BASE_DEC, NULL, 0x0,
1616 NULL, HFILL }},
1618 { &hf_isns_portal_next_index,
1619 { "Portal Next Index", "isns.portal.next_index",
1620 FT_UINT32, BASE_DEC, NULL, 0x0,
1621 NULL, HFILL }},
1623 { &hf_isns_entity_index,
1624 { "Entity Index", "isns.entity.index",
1625 FT_UINT32, BASE_DEC, NULL, 0x0,
1626 NULL, HFILL }},
1628 { &hf_isns_entity_next_index,
1629 { "Entity Next Index", "isns.entity.next_index",
1630 FT_UINT32, BASE_DEC, NULL, 0x0,
1631 NULL, HFILL }},
1633 { &hf_isns_timestamp,
1634 { "Timestamp", "isns.timestamp",
1635 FT_UINT64, BASE_DEC, NULL, 0x0,
1636 "Timestamp in Seconds", HFILL }},
1638 { &hf_isns_esi_interval,
1639 { "ESI Interval", "isns.esi_interval",
1640 FT_UINT32, BASE_DEC, NULL, 0x0,
1641 "ESI Interval in Seconds", HFILL }},
1643 { &hf_isns_registration_period,
1644 { "Registration Period", "isns.registration_period",
1645 FT_UINT32, BASE_DEC, NULL, 0x0,
1646 "Registration Period in Seconds", HFILL }},
1648 { &hf_isns_portal_group_tag,
1649 { "PG Tag", "isns.portal_group_tag",
1650 FT_UINT32, BASE_DEC, NULL, 0x0,
1651 "Portal Group Tag", HFILL }},
1653 { &hf_isns_payload,
1654 { "Payload", "isns.payload",
1655 FT_BYTES, BASE_NONE, NULL, 0,
1656 NULL, HFILL}
1660 /* Setup protocol subtree array */
1661 static int *ett[] = {
1662 &ett_isns,
1663 &ett_isns_flags,
1664 &ett_isns_payload,
1665 &ett_isns_attribute,
1666 &ett_isns_port,
1667 &ett_isns_isnt
1670 static ei_register_info ei[] = {
1671 { &ei_isns_not_first_pdu,
1672 { "isns.not_first_pdu", PI_PROTOCOL, PI_WARN,
1673 "This is not the first PDU. The attributes are not decoded", EXPFILL }},
1674 { &ei_isns_invalid_attr_len,
1675 { "isns.invalid_attribute_length", PI_PROTOCOL, PI_WARN,
1676 "Invalid attribute length", EXPFILL }}
1679 module_t *isns_module;
1680 expert_module_t* expert_isns;
1682 /* Register the protocol name and description */
1683 proto_isns = proto_register_protocol("iSNS", "iSNS", "isns");
1684 proto_register_field_array(proto_isns, hf, array_length(hf));
1685 proto_register_subtree_array(ett, array_length(ett));
1686 expert_isns = expert_register_protocol(proto_isns);
1687 expert_register_field_array(expert_isns, ei, array_length(ei));
1689 /* Register the dissectors */
1690 isns_tcp_handle = register_dissector("isns.tcp", dissect_isns_tcp,proto_isns);
1691 isns_udp_handle = register_dissector("isns.udp", dissect_isns_udp,proto_isns);
1693 /* Register preferences */
1694 isns_module = prefs_register_protocol(proto_isns, NULL);
1695 prefs_register_bool_preference(
1696 isns_module, "desegment",
1697 "Reassemble iSNS messages spanning multiple TCP segments",
1698 "Whether the iSNS dissector should reassemble messages spanning multiple TCP segments."
1699 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
1700 &isns_desegment);
1703 void
1704 proto_reg_handoff_isns(void)
1706 dissector_add_uint_with_preference("tcp.port",ISNS_TCP_PORT,isns_tcp_handle);
1707 dissector_add_uint_with_preference("udp.port",ISNS_UDP_PORT,isns_udp_handle);
1711 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1713 * Local variables:
1714 * c-basic-offset: 4
1715 * tab-width: 8
1716 * indent-tabs-mode: nil
1717 * End:
1719 * vi: set shiftwidth=4 tabstop=8 expandtab:
1720 * :indentSize=4:tabSize=8:noTabs=true: