Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-aruba-ubt.c
blob62c1ddd5819e747ac16a482afaac541712e77dd3
1 /* packet-aruba-ubt.c
2 * Routines for Aruba UBT dissection
4 * Real name of UBT : User Based Tunneling
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 /* header files */
13 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/expert.h>
16 #include <epan/addr_resolv.h>
17 #include "packet-ipv6.h"
18 #include <epan/tfs.h>
20 /* This is not IANA assigned nor registered */
21 #define PORT_UBT 15560
23 void proto_register_ubt(void);
24 void proto_reg_handoff_ubt(void);
26 /* declaring dissector handle */
27 static dissector_handle_t ubt_handle;
29 /* Initialize the protocol and registered fields */
30 static int proto_ubt;
31 static int hf_ubt_packet_len;
32 static int hf_ubt_msg_type;
33 static int hf_ubt_tlv_header;
34 static int hf_ubt_tlv;
35 static int hf_ubt_type;
36 static int hf_ubt_length;
37 static int hf_ubt_switch_seqno;
38 static int hf_ubt_switch_macaddr;
40 /* for data attributes */
41 static int hf_ubt_dt_unknown;
42 static int hf_ubt_dt_grekey;
43 static int hf_ubt_dt_firmwareversion;
44 static int hf_ubt_dt_userkey;
45 static int hf_ubt_dt_sacmode;
46 static int hf_ubt_dt_sacipv4;
47 static int hf_ubt_dt_sacipv6;
48 static int hf_ubt_dt_heartbeattimeout;
49 static int hf_ubt_dt_usermac;
50 static int hf_ubt_dt_uservlan;
51 static int hf_ubt_dt_flags;
53 /* for ip attributes */
54 static int hf_ubt_ip_type;
55 static int hf_ubt_ip_padding;
56 static int hf_ubt_ip_unassigned;
58 /* for switch & user flags */
59 static int hf_ubt_switch_flags_bcmctoucast;
60 static int hf_ubt_user_flags_tag;
61 static int hf_ubt_user_flags_auth;
62 static int hf_ubt_user_flags_bcmctoucast;
63 static int hf_ubt_user_flags_dormant;
64 static int hf_ubt_user_flags_uback;
66 static int hf_ubt_dt_tunnelmtu;
67 static int hf_ubt_dt_userrole;
68 static int hf_ubt_dt_reasoncode;
69 static int hf_ubt_dt_nodelist;
70 static int hf_ubt_dt_clustername;
71 static int hf_ubt_dt_clusterenabled;
72 static int hf_ubt_dt_ssacindex;
73 static int hf_ubt_dt_reserved;
74 static int hf_ubt_dt_uaccount;
75 static int hf_ubt_dt_uaciplist;
76 static int hf_ubt_dt_uacipv4;
77 static int hf_ubt_dt_uacipv6;
78 static int hf_ubt_dt_bucketmap;
79 static int hf_ubt_dt_timestamp;
80 static int hf_ubt_dt_identifier;
82 /* for active map arrays */
83 static int hf_ubt_dt_activemap1;
84 static int hf_ubt_dt_activemap2;
85 static int hf_ubt_dt_activemap3;
86 static int hf_ubt_dt_activemap4;
87 static int hf_ubt_dt_activemap5;
88 static int hf_ubt_dt_activemap6;
89 static int hf_ubt_dt_activemap7;
90 static int hf_ubt_dt_activemap8;
92 /* for standby map arrays */
93 static int hf_ubt_dt_standbymap1;
94 static int hf_ubt_dt_standbymap2;
95 static int hf_ubt_dt_standbymap3;
96 static int hf_ubt_dt_standbymap4;
97 static int hf_ubt_dt_standbymap5;
98 static int hf_ubt_dt_standbymap6;
99 static int hf_ubt_dt_standbymap7;
100 static int hf_ubt_dt_standbymap8;
102 /* for l2conn arrays */
103 static int hf_ubt_dt_l2conn1;
104 static int hf_ubt_dt_l2conn2;
105 static int hf_ubt_dt_l2conn3;
106 static int hf_ubt_dt_l2conn4;
107 static int hf_ubt_dt_l2conn5;
108 static int hf_ubt_dt_l2conn6;
109 static int hf_ubt_dt_l2conn7;
110 static int hf_ubt_dt_l2conn8;
112 static int hf_ubt_dt_status;
113 static int hf_ubt_dt_mcastkey;
114 static int hf_ubt_dt_serveripv4;
115 static int hf_ubt_dt_serveripv6;
116 static int hf_ubt_dt_userauthmethod;
117 static int hf_ubt_dt_username;
118 static int hf_ubt_dt_userportname;
119 static int hf_ubt_dt_switchname;
120 static int hf_ubt_dt_silentclientvlans;
121 static int hf_ubt_dt_silentclientvlan;
122 static int hf_ubt_dt_maxmsgs;
124 static expert_field ei_ubt_unknown;
126 /* Initialize the subtree pointers */
127 static int ett_ubt;
128 static int ett_ubt_tlv;
129 static int ett_ubt_flags;
131 /* Definition of different sizes and counts used throughout the program */
132 #define PAPI_PACKET_SIZE 76
133 #define SIZE_AT_DEST_PORT 16
134 #define SIZE_AT_SRC_PORT 18
135 #define PACKET_LENGTH_SIZE 4
136 #define MESSAGE_TYPE_SIZE 4
137 #define MAC_ADDR_SIZE 6
138 #define SEQ_NO_SIZE 4
139 #define TYPE_SIZE 1
140 #define LENGTH_SIZE 2
141 #define CLUSTER_NAME_SIZE 32
142 #define CLUSTER_ENABLED 1
143 #define SSAC_INDEX 1
144 #define RESERVED_COUNT 1
145 #define UAC_COUNT_SIZE 1
146 #define UAC_MAX_COUNT 12
147 #define IP_SIZE 20
148 #define TIMESTAMP_SIZE 8
149 #define IDENTIFIER_SIZE 33
150 #define MAP_SIZE 256
151 #define MAP_SUBSET_SIZE 32
152 #define MAP_ARRAY_SIZE 8
153 #define INCREMENT_SIZE 2
154 #define TYPE_IPV4 0x02
155 #define TYPE_IPV6 0x0a
156 #define TYPE_NOT_ASSIGNED 0x0
157 #define AUTH_METHOD_8021X 2
158 #define AUTH_METHOD_WEB 3
159 #define AUTH_METHOD_MAC 4
160 #define AUTH_METHOD_LMA 6
162 static const value_string ubt_authmethod_vals[] = {
163 { AUTH_METHOD_8021X, "UB_AUTH_METHOD_8021X" },
164 { AUTH_METHOD_WEB, "UB_AUTH_METHOD_WEB" },
165 { AUTH_METHOD_MAC, "UB_AUTH_METHOD_MAC" },
166 { AUTH_METHOD_LMA, "UB_AUTH_METHOD_LMA" },
167 { 0, NULL }
170 static const value_string ubt_iptype_vals[] = {
171 { TYPE_IPV4, "IPv4" },
172 { TYPE_IPV6, "IPv6" },
173 { TYPE_NOT_ASSIGNED, "Not Assigned" },
174 { 0, NULL }
177 /* to enumerate different UBT message types */
178 enum messagetype {
179 NotKnown, //Type 0, undefined
180 SwitchBootstrapMessage, //Type 1
181 SwitchBootstrapACK, //Type 2
182 ControllerNodelistMessage, //Type 3
183 ControllerNodelistACK, //Type 4
184 ControllerBucketmapMessage, //Type 5
185 ControllerBucketmapACK, //Type 6
186 SwitchFailoverMessage, //Type 7
187 SwitchFailoverACK, //Type 8
188 SwitchUnbootstrapMessage, //Type 9
189 SwitchUnbootstrapACK, //Type 10
190 UserBootstrapMessage, //Type 11
191 UserBootstrapACK, //Type 12
192 UserUnbootstrapMessage, //Type 13
193 UserUnbootstrapACK, //Type 14
194 SwitchKeepaliveMessage, //Type 15
195 SwitchKeepaliveACK, //Type 16
196 SwitchHeartbeatRequest, //Type 17
197 SwitchHeartbeatACK, //Type 18
198 SwitchSilentVLANMessage, //Type 19
199 SwitchSilentVLANACK //Type 20
202 static const value_string ubt_msgtype_vals[] = {
203 { SwitchBootstrapMessage, "Switch Bootstrap Message" },
204 { SwitchBootstrapACK, "Switch Bootstrap ACK" },
205 { ControllerNodelistMessage, "Controller Nodelist Message" },
206 { ControllerNodelistACK, "Controller Nodelist ACK" },
207 { ControllerBucketmapMessage, "Controller Bucketmap Message" },
208 { ControllerBucketmapACK, "Controller Bucketmap ACK" },
209 { SwitchFailoverMessage, "Switch Failover Message" },
210 { SwitchFailoverACK, "Switch Failover ACK" },
211 { SwitchUnbootstrapMessage, "Switch Unbootstrap Message" },
212 { SwitchUnbootstrapACK, "Switch Unbootstrap ACK" },
213 { UserBootstrapMessage, "User Bootstrap Message" },
214 { UserBootstrapACK, "User Bootstrap ACK" },
215 { UserUnbootstrapMessage, "User Unbootstrap Message" },
216 { UserUnbootstrapACK, "User Unbootstrap ACK" },
217 { SwitchKeepaliveMessage, "Switch Keepalive Message" },
218 { SwitchKeepaliveACK, "Switch Keepalive ACK" },
219 { SwitchHeartbeatRequest, "Switch Heartbeat Request" },
220 { SwitchHeartbeatACK, "Switch Heartbeat ACK" },
221 { SwitchSilentVLANMessage, "Switch Silent VLAN Message" },
222 { SwitchSilentVLANACK, "Switch Silent VLAN ACK" },
223 { 0, NULL }
226 /* to enumerate different data attributes */
227 enum datatypes {
228 Unknown, //Type 0, undefined
229 GREKey, //Type 1
230 FirmwareVersion, //Type 2
231 UserKey, //Type 3
232 SACMode, //Type 4
233 SACIPAddress, //Type 5
234 HeartbeatTimeout, //Type 6
235 UserMAC, //Type 7
236 UserVLAN, //Type 8
237 Flags, //Type 9
238 TunnelMTU, //Type 10
239 UserRole, //Type 11
240 ReasonCode, //Type 12
241 Nodelist, //Type 13
242 Bucketmap, //Type 14
243 Status, //Type 15
244 MCASTKey, //Type 16
245 ServerIP, //Type 17
246 UserAuthMethod, //Type 18
247 Username, //Type 19
248 UserPortName, //Type 20
249 SwitchName, //Type 21
250 SilentClientVLANs, //Type 22
251 MaxMsgs //Type 23
254 static const value_string ubt_dttype_vals[] = {
255 { GREKey, "GRE Key" },
256 { FirmwareVersion, "Firmware Version" },
257 { UserKey, "User Key" },
258 { SACMode, "SAC Mode" },
259 { SACIPAddress, "SAC IP Address" },
260 { HeartbeatTimeout, "Heartbeat Timeout" },
261 { UserMAC, "User MAC Address" },
262 { UserVLAN, "User VLAN" },
263 { Flags, "Flags" },
264 { TunnelMTU, "Tunnel MTU" },
265 { UserRole, "User Role" },
266 { ReasonCode, "Reason Code" },
267 { Nodelist, "Node List" },
268 { Bucketmap, "Bucket Map" },
269 { Status, "Status" },
270 { MCASTKey, "MCast Key" },
271 { ServerIP, "Server IP Address" },
272 { UserAuthMethod, "User Auth Method" },
273 { Username, "Username" },
274 { UserPortName, "User Port Name" },
275 { SwitchName, "Switch Name" },
276 { SilentClientVLANs, "Silent Client VLANs" },
277 { MaxMsgs, "Max Messages" },
278 { 0, NULL }
281 /* main dissector function */
282 static int
283 dissect_ubt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
285 /* declaration of variables used */
286 proto_item* ti, * ubt_msg_type;
287 proto_tree* message_tree, * message_subtree, * message_subtree2, * message_subtree3, * message_subtree4;
288 unsigned offset_end = 0, msgtype = 0, offset = 0;
289 tvbuff_t* next_tvb;
291 /* Setting protocol column to UBT */
292 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UBT");
294 /* clearing info column */
295 col_clear(pinfo->cinfo, COL_INFO);
297 /* setting proto_item & tree to the current offset */
298 ti = proto_tree_add_item(tree, proto_ubt, tvb, offset, -1, ENC_NA);
300 /* adding it as a subtree to Wireshark tree */
301 message_tree = proto_item_add_subtree(ti, ett_ubt);
303 /* determining packet length & message type */
304 proto_tree_add_item(message_tree, hf_ubt_packet_len, tvb, offset, PACKET_LENGTH_SIZE, ENC_BIG_ENDIAN);
305 offset += PACKET_LENGTH_SIZE;
306 ubt_msg_type = proto_tree_add_item_ret_uint(message_tree, hf_ubt_msg_type, tvb, offset, MESSAGE_TYPE_SIZE, ENC_BIG_ENDIAN, &msgtype);
308 proto_item_append_text(ubt_msg_type, "(%s)", val_to_str(msgtype, ubt_msgtype_vals, "Unknown Type (%02d)"));
309 col_append_str(pinfo->cinfo, COL_INFO, val_to_str(msgtype, ubt_msgtype_vals, "Unknown Type (%02d)"));
311 offset += MESSAGE_TYPE_SIZE;
313 /* Condition to check if Switch MAC address to be added or not */
314 if (msgtype != UserBootstrapACK && msgtype != SwitchKeepaliveACK) {
315 proto_tree_add_item(message_tree, hf_ubt_switch_macaddr, tvb, offset, MAC_ADDR_SIZE, ENC_NA);
317 /* appending to info column */
318 col_append_fstr(pinfo->cinfo, COL_INFO, " switchmac:%s", tvb_get_ether_name(tvb, offset));
319 offset += MAC_ADDR_SIZE;
322 /* adding Switch Sequence Number to tree */
323 proto_tree_add_item(message_tree, hf_ubt_switch_seqno, tvb, offset, SEQ_NO_SIZE, ENC_NA);
325 /* appending to info column */
326 col_append_fstr(pinfo->cinfo, COL_INFO, " seq:%d", tvb_get_uint32(tvb, offset, ENC_NA));
327 offset += SEQ_NO_SIZE;
329 /* if Switch Keepalive Message type, terminate dissection */
330 if (msgtype == SwitchKeepaliveMessage) {
331 return offset;
334 /* storing length of buffer */
335 offset_end = tvb_reported_length(tvb);
337 /* dealing with TLVs */
338 proto_item* tlv_header;
339 tlv_header = proto_tree_add_item(message_tree, hf_ubt_tlv_header, tvb, offset, -1, ENC_NA);
340 message_subtree = proto_item_add_subtree(tlv_header, ett_ubt);
342 while (offset < offset_end) {
344 /* variable to store T, L, V of TLVs & other data */
345 unsigned optlen = 0, type = 0, val = 0;
346 bool bool_val = false;
347 proto_item* tlv, * tlv_item, * tlv_item2;
349 /* reading type & length of TLVS from stream */
350 type = tvb_get_uint8(tvb, offset);
351 optlen = tvb_get_uint16(tvb, offset + TYPE_SIZE, ENC_BIG_ENDIAN);
353 /* Adding TLV items to the tree */
354 tlv = proto_tree_add_item(message_subtree, hf_ubt_tlv, tvb, offset, optlen + TYPE_SIZE + LENGTH_SIZE, ENC_NA);
355 proto_item_append_text(tlv, ": t=%d, l=%d, %s", type, optlen, val_to_str(type, ubt_dttype_vals, "Unknown Type (%02d)"));
356 message_subtree2 = proto_item_add_subtree(tlv, ett_ubt_tlv);
358 /* adding type & length to TLV subtree */
359 proto_tree_add_item(message_subtree2, hf_ubt_type, tvb, offset, TYPE_SIZE, ENC_NA);
360 offset += TYPE_SIZE;
361 proto_tree_add_item(message_subtree2, hf_ubt_length, tvb, offset, LENGTH_SIZE, ENC_NA);
362 offset += LENGTH_SIZE;
364 /* Different data types */
365 switch (type) {
367 case Unknown:/* Unknown, because type 0 is undefined */
368 proto_tree_add_item(message_subtree2, hf_ubt_dt_unknown, tvb, offset, optlen, ENC_NA);
369 offset += optlen;
370 break;
372 case GREKey:/* Type 1: GRE Key */
374 /* adding GRE key as proto_item to the tree */
375 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_grekey, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
376 proto_item_append_text(tlv, ": %#x(%u)", val, val);
378 /* appending to info column */
379 col_append_fstr(pinfo->cinfo, COL_INFO, " grekey:%u", val);
380 offset += optlen;
381 break;
383 case FirmwareVersion:/* Type 2: Firmware version */
385 /* adding Firmware version as proto_item to the tree */
386 proto_tree_add_item(message_subtree2, hf_ubt_dt_firmwareversion, tvb, offset, optlen, ENC_ASCII);
387 proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII));
388 offset += optlen;
389 break;
391 case UserKey:/* Type 3: User key */
393 /* adding User key as proto_item to the tree */
394 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_userkey, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
395 proto_item_append_text(tlv, ": %#x(%u)", val, val);
397 /* appending to info column */
398 col_append_fstr(pinfo->cinfo, COL_INFO, " userkey:%u", val);
399 offset += optlen;
400 break;
402 case SACMode:/* Type 4: SAC Mode */
404 /* adding SAC mode as proto_item to the tree */
405 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_sacmode, tvb, offset, optlen, ENC_NA, &val);
406 proto_item_append_text(tlv, ": %u", val);
408 /* appending to info column */
409 col_append_fstr(pinfo->cinfo, COL_INFO, " sacMode:%u", val);
410 offset += optlen;
411 break;
413 case SACIPAddress:/* Type 5: SAC IP Address */
415 /* adding SAC IP Address as proto_item to the tree */
417 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN, &val);
418 offset += 2;
420 switch (val) {
422 case TYPE_IPV6:
423 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
424 offset += 2;
425 proto_tree_add_item(message_subtree2, hf_ubt_dt_sacipv6, tvb, offset, IPv6_ADDR_SIZE, ENC_NA);
426 offset += IPv6_ADDR_SIZE;
427 break;
429 case TYPE_IPV4:
430 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
431 offset += 2;
432 proto_tree_add_item(message_subtree2, hf_ubt_dt_sacipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
433 offset += 4;
434 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA);
435 offset += 12;
436 break;
438 case TYPE_NOT_ASSIGNED:
439 proto_tree_add_item(message_subtree2, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE - 2, ENC_NA);
440 offset += IP_SIZE - 2;
441 break;
443 default:
444 proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE - 2, "Invalid IP Type");
445 offset += IP_SIZE - 2;
448 break;
450 case HeartbeatTimeout:/* Type 6: Heartbeat Timeout */
452 /* adding Heartbeat timeout as proto_item to the tree */
453 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_heartbeattimeout, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
454 proto_item_append_text(tlv, ": %u", val);
455 offset += optlen;
456 break;
458 case UserMAC:/* Type 7: User MAC Address */
460 /* adding User MAC address as proto_item to the tree */
461 proto_tree_add_item(message_subtree2, hf_ubt_dt_usermac, tvb, offset, optlen, ENC_NA);
462 proto_item_append_text(tlv, ": %s", tvb_get_ether_name(tvb, offset));
464 /* appending to info column */
465 col_append_fstr(pinfo->cinfo, COL_INFO, " usermac:%s", tvb_get_ether_name(tvb, offset));
466 offset += optlen;
467 break;
469 case UserVLAN:/* Type 8: User VLAN */
471 /* adding User VLAN as proto_item to the tree */
472 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_uservlan, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
473 proto_item_append_text(tlv, ": %#x(%u)", val, val);
475 /* appending to info column */
476 col_append_fstr(pinfo->cinfo, COL_INFO, " vlan:%u", val);
477 offset += optlen;
478 break;
480 case Flags:/* Type 9: Flags */
482 /* adding flags for switch */
483 if (msgtype == SwitchBootstrapMessage) {
484 static int* const ubt_switch_flags[] = {
485 &hf_ubt_switch_flags_bcmctoucast,
486 NULL
488 proto_tree_add_bitmask_with_flags(message_subtree2, tvb, offset, hf_ubt_dt_flags, ett_ubt_flags, ubt_switch_flags, ENC_BIG_ENDIAN, BMT_NO_APPEND);
491 /* adding flags for user */
492 else if (msgtype == UserBootstrapMessage) {
493 static int* const ubt_user_flags[] = {
494 &hf_ubt_user_flags_tag,
495 &hf_ubt_user_flags_auth,
496 &hf_ubt_user_flags_bcmctoucast,
497 &hf_ubt_user_flags_dormant,
498 &hf_ubt_user_flags_uback,
499 NULL
501 proto_tree_add_bitmask_with_flags(message_subtree2, tvb, offset, hf_ubt_dt_flags, ett_ubt_flags, ubt_user_flags, ENC_BIG_ENDIAN, BMT_NO_APPEND);
504 val = tvb_get_uint8(tvb, offset);
506 /* appending to info column */
507 col_append_fstr(pinfo->cinfo, COL_INFO, " flags:%u", val);
508 offset += optlen;
509 break;
511 case TunnelMTU:/* Type 10: Tunnel MTU */
513 /* adding Tunnel MTU as proto_item to the tree */
514 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_tunnelmtu, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
515 proto_item_append_text(tlv, ": %#x(%u)", val, val);
517 /* appending to info column */
518 col_append_fstr(pinfo->cinfo, COL_INFO, " mtu:%u", val);
519 offset += optlen;
520 break;
522 case UserRole:/* Type 11: User Role */
524 /* adding User Role as proto_item to the tree */
525 proto_tree_add_item(message_subtree2, hf_ubt_dt_userrole, tvb, offset, optlen, ENC_ASCII);
526 char* userrole = tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII);
527 proto_item_append_text(tlv, ": %s", userrole);
529 /* appending to info column */
530 col_append_fstr(pinfo->cinfo, COL_INFO, " role:%s", userrole);
531 offset += optlen;
532 break;
534 case ReasonCode:/* Type 12: Reason Code */
536 /* adding Reason Code as proto_item to the tree */
537 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_reasoncode, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
538 proto_item_append_text(tlv, ": %u", val);
540 /* appending to info column */
541 col_append_fstr(pinfo->cinfo, COL_INFO, " reason:%u", val);
542 offset += optlen;
543 break;
545 case Nodelist:/* Type 13: Nodelist */
547 /* adding Nodelist as proto_item to the tree */
548 tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_nodelist, tvb, offset, optlen, ENC_NA);
549 message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv);
551 /* adding name of cluster to tree */
552 proto_tree_add_item(message_subtree3, hf_ubt_dt_clustername, tvb, offset, CLUSTER_NAME_SIZE, ENC_ASCII);
553 offset += CLUSTER_NAME_SIZE;
555 /* determining if cluster enabled or not */
556 proto_tree_add_item(message_subtree3, hf_ubt_dt_clusterenabled, tvb, offset, CLUSTER_ENABLED, ENC_NA);
557 offset += CLUSTER_ENABLED;
559 /* adding SSAC index to tree */
560 proto_tree_add_item(message_subtree3, hf_ubt_dt_ssacindex, tvb, offset, SSAC_INDEX, ENC_NA);
561 offset += SSAC_INDEX;
563 /* adding no of reserved to tree */
564 proto_tree_add_item(message_subtree3, hf_ubt_dt_reserved, tvb, offset, RESERVED_COUNT, ENC_NA);
565 offset += RESERVED_COUNT;
567 /* adding no of UACs assigned */
568 proto_tree_add_item(message_subtree3, hf_ubt_dt_uaccount, tvb, offset, UAC_COUNT_SIZE, ENC_NA);
569 offset += UAC_COUNT_SIZE;
571 /* adding list of UAC IPs assigned */
572 for (int i = 0; i < UAC_MAX_COUNT; i++) {
573 tlv_item = proto_tree_add_item(message_subtree3, hf_ubt_dt_uaciplist, tvb, offset, IP_SIZE, ENC_NA);
574 message_subtree4 = proto_item_add_subtree(tlv_item, ett_ubt_tlv);
575 proto_item_append_text(tlv_item, "(%d)", i + 1);
577 proto_tree_add_item_ret_uint(message_subtree4, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN, &val);
578 offset += 2;
580 switch (val) {
582 case TYPE_IPV6:
583 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
584 offset += 2;
585 proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv6, tvb, offset, IPv6_ADDR_SIZE, ENC_NA);
586 offset += IPv6_ADDR_SIZE;
587 break;
589 case TYPE_IPV4:
590 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
591 offset += 2;
592 proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
593 offset += 4;
594 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA);
595 offset += 12;
596 break;
598 case TYPE_NOT_ASSIGNED:
599 proto_tree_add_item(message_subtree4, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE - 2, ENC_NA);
600 offset += IP_SIZE - 2;
601 break;
603 default:
604 proto_tree_add_expert_format(message_subtree4, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE - 2, "Invalid IP Type");
605 offset += IP_SIZE - 2;
609 break;
611 case Bucketmap:/* Type 14: Bucketmap */
613 /* adding Bucketmap as proto_item to the tree */
614 tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_bucketmap, tvb, offset, optlen, ENC_NA);
615 message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv);
617 /* adding timestamp to tree */
618 proto_tree_add_item(message_subtree3, hf_ubt_dt_timestamp, tvb, offset, TIMESTAMP_SIZE, ENC_NA);
619 offset += TIMESTAMP_SIZE;
621 /* adding identifier string to tree */
622 proto_tree_add_item(message_subtree3, hf_ubt_dt_identifier, tvb, offset, IDENTIFIER_SIZE, ENC_ASCII);
623 offset += IDENTIFIER_SIZE;
625 /* array to store activemaps in size of 32 */
626 int arr[MAP_ARRAY_SIZE] = { hf_ubt_dt_activemap1 ,hf_ubt_dt_activemap2 ,hf_ubt_dt_activemap3 ,hf_ubt_dt_activemap4 ,hf_ubt_dt_activemap5 ,hf_ubt_dt_activemap6 ,hf_ubt_dt_activemap7 ,hf_ubt_dt_activemap8 };
627 /* adding activemaps of size 32 at a time */
628 for (int i = 0; i < MAP_SIZE; i += MAP_SUBSET_SIZE) {
629 if ((i / MAP_SUBSET_SIZE) == 0) {
630 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
632 else if ((i / MAP_SUBSET_SIZE) == 1 || (i / MAP_SUBSET_SIZE) == 2) {
633 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
635 else if ((i / MAP_SUBSET_SIZE) == 3) {
636 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
638 else {
639 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
641 offset += 1;
642 for (int j = 1; j < MAP_SUBSET_SIZE; j += 1) {
643 proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset));
644 offset += 1;
648 /* array to store standbymaps in size of 32 */
649 int arr2[MAP_ARRAY_SIZE] = { hf_ubt_dt_standbymap1 ,hf_ubt_dt_standbymap2 ,hf_ubt_dt_standbymap3 ,hf_ubt_dt_standbymap4 ,hf_ubt_dt_standbymap5 ,hf_ubt_dt_standbymap6 ,hf_ubt_dt_standbymap7 ,hf_ubt_dt_standbymap8 };
651 /* adding standbymaps of size 32 at a time */
652 for (int i = 0; i < MAP_SIZE; i += MAP_SUBSET_SIZE) {
653 if ((i / MAP_SUBSET_SIZE) == 0) {
654 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
656 else if ((i / MAP_SUBSET_SIZE) == 1 || (i / MAP_SUBSET_SIZE) == 2) {
657 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
659 else if ((i / MAP_SUBSET_SIZE) == 3) {
660 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
662 else {
663 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
665 offset += 1;
666 for (int j = 1; j < MAP_SUBSET_SIZE; j += 1) {
667 proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset));
668 offset += 1;
672 /* array to store l2conn in size of 32 */
673 int arr3[MAP_ARRAY_SIZE] = { hf_ubt_dt_l2conn1 ,hf_ubt_dt_l2conn2 ,hf_ubt_dt_l2conn3 ,hf_ubt_dt_l2conn4 ,hf_ubt_dt_l2conn5 ,hf_ubt_dt_l2conn6 ,hf_ubt_dt_l2conn7 ,hf_ubt_dt_l2conn8 };
675 /* adding l2conn of size 32 at a time */
676 for (int i = 0; i < MAP_SIZE; i += MAP_SUBSET_SIZE) {
677 if ((i / MAP_SUBSET_SIZE) == 0) {
678 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
680 else if ((i / MAP_SUBSET_SIZE) == 1 || (i / MAP_SUBSET_SIZE) == 2) {
681 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
683 else if ((i / MAP_SUBSET_SIZE) == 3) {
684 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
686 else {
687 tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE], tvb, offset, MAP_SUBSET_SIZE, NULL, " %02d", tvb_get_int8(tvb, offset));
689 offset += 1;
690 for (int j = 1; j < MAP_SUBSET_SIZE; j += 1) {
691 proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset));
692 offset += 1;
696 /* adding no of UACs assigned */
697 proto_tree_add_item(message_subtree3, hf_ubt_dt_uaccount, tvb, offset, UAC_COUNT_SIZE, ENC_NA);
698 offset += UAC_COUNT_SIZE;
700 /* adding list of UAC IPs assigned */
701 for (int i = 0; i < UAC_MAX_COUNT; i++) {
702 tlv_item = proto_tree_add_item(message_subtree3, hf_ubt_dt_uaciplist, tvb, offset, IP_SIZE, ENC_NA);
703 message_subtree4 = proto_item_add_subtree(tlv_item, ett_ubt_tlv);
704 proto_item_append_text(tlv_item, "(%d)", i + 1);
706 proto_tree_add_item_ret_uint(message_subtree4, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN, &val);
707 offset += 2;
709 switch (val) {
711 case TYPE_IPV6:
712 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
713 offset += 2;
714 proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv6, tvb, offset, IPv6_ADDR_SIZE, ENC_NA);
715 offset += IPv6_ADDR_SIZE;
716 break;
718 case TYPE_IPV4:
719 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
720 offset += 2;
721 proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
722 offset += 4;
723 proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA);
724 offset += 12;
725 break;
727 case TYPE_NOT_ASSIGNED:
728 proto_tree_add_item(message_subtree4, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE - 2, ENC_NA);
729 offset += IP_SIZE - 2;
730 break;
732 default:
733 proto_tree_add_expert_format(message_subtree4, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE - 2, "Invalid IP Type");
734 offset += IP_SIZE - 2;
738 break;
740 case Status:/* Type 15: Status */
742 /* adding Status as proto_item to the tree */
743 proto_tree_add_item_ret_boolean(message_subtree2, hf_ubt_dt_status, tvb, offset, optlen, ENC_BIG_ENDIAN, &bool_val);
744 proto_item_append_text(tlv, ": %u(%s)", bool_val, bool_val ? "Success" : "Failure");
745 col_append_fstr(pinfo->cinfo, COL_INFO, " status:%02d(%s)", bool_val, bool_val ? "Success" : "Failure");
746 offset += optlen;
747 break;
749 case MCASTKey:/* Type 16: MCAST Key */
751 /* adding MCAST key as proto_item to the tree */
752 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_mcastkey, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
753 proto_item_append_text(tlv, ": %#x(%u)", val, val);
755 /* appending to info column */
756 col_append_fstr(pinfo->cinfo, COL_INFO, " mcastkey:%u", val);
757 offset += optlen;
758 break;
760 case ServerIP:/* Type 17: Server IP Address */
762 /* adding Server IP Address as proto_item to the tree */
764 proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN, &val);
765 offset += 2;
767 switch (val) {
769 case TYPE_IPV6:
770 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
771 offset += 2;
772 proto_tree_add_item(message_subtree2, hf_ubt_dt_serveripv6, tvb, offset, IPv6_ADDR_SIZE, ENC_NA);
773 offset += IPv6_ADDR_SIZE;
774 break;
776 case TYPE_IPV4:
777 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA);
778 offset += 2;
779 proto_tree_add_item(message_subtree2, hf_ubt_dt_serveripv4, tvb, offset, 4, ENC_BIG_ENDIAN);
780 offset += 4;
781 proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA);
782 offset += 12;
783 break;
785 case TYPE_NOT_ASSIGNED:
786 proto_tree_add_item(message_subtree2, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE - 2, ENC_NA);
787 offset += IP_SIZE - 2;
788 break;
790 default:
791 proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE - 2, "Invalid IP Type");
792 offset += IP_SIZE - 2;
795 break;
797 case UserAuthMethod:/* Type 18: User Authentication method */
799 /* adding User Authentication method as proto_item to the tree */
800 tlv_item = proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_userauthmethod, tvb, offset, optlen, ENC_BIG_ENDIAN, &val);
801 proto_item_append_text(tlv, ": %u(%s)", val, val_to_str(val, ubt_authmethod_vals, "Unknown Type (%02d)"));
802 proto_item_append_text(tlv_item, "(%s)", val_to_str(val, ubt_authmethod_vals, "Unknown Type (%02d)"));
803 offset += optlen;
804 break;
806 case Username:/* Type 19: Username */
808 /* adding username as proto_item to the tree */
809 proto_tree_add_item(message_subtree2, hf_ubt_dt_username, tvb, offset, optlen, ENC_ASCII);
810 proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII));
811 offset += optlen;
812 break;
814 case UserPortName:/* Type 20: User Port name */
816 /* adding user port name as proto_item to the tree */
817 proto_tree_add_item(message_subtree2, hf_ubt_dt_userportname, tvb, offset, optlen, ENC_ASCII);
818 proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII));
819 offset += optlen;
820 break;
822 case SwitchName:/* Type 21: Switch Name */
824 /* adding Switch name as proto_item to the tree */
825 proto_tree_add_item(message_subtree2, hf_ubt_dt_switchname, tvb, offset, optlen, ENC_ASCII);
826 proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII));
827 offset += optlen;
828 break;
830 case SilentClientVLANs:/* Type 22: Silent Client VLANs */
832 /* adding Silent Client VLANs as proto_item to the tree */
833 tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_silentclientvlans, tvb, offset, optlen, ENC_NA);
834 message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv);
835 proto_item_append_text(tlv, ": %u", tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN));
837 /* adding each silent client VLAN assigned */
838 for (int i = 0; i < 200; i++) {
839 proto_tree_add_item(message_subtree3, hf_ubt_dt_silentclientvlan, tvb, offset, 2, ENC_NA);
840 offset += 2;
842 break;
844 case MaxMsgs:/* Type 23: Maximum Messages */
846 /* adding Max Msgs as proto_item to the tree */
847 proto_tree_add_item(message_subtree2, hf_ubt_dt_maxmsgs, tvb, offset, optlen, ENC_NA);
848 offset += optlen;
849 break;
851 default:
852 proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, optlen, "Unknown");
853 offset += optlen;
856 next_tvb = tvb_new_subset_remaining(tvb, offset);
857 call_data_dissector(next_tvb, pinfo, tree);
858 return tvb_captured_length(tvb);
861 /* function to register the protocol & hf values used */
862 void
863 proto_register_ubt(void)
866 /* hf array to store datatypes of different fields */
867 static hf_register_info hf[] = {
869 { &hf_ubt_packet_len,/* length of packet/buffer */
870 { "Packet Length", "ubt.packet_len",
871 FT_UINT32, BASE_DEC, NULL, 0x0,
872 NULL, HFILL }
875 { &hf_ubt_tlv_header,/* header for TLV */
876 { "Type-Length-Value", "ubt.tlv_header",
877 FT_NONE, BASE_NONE, NULL, 0x0,
878 NULL, HFILL }
881 { &hf_ubt_tlv,/* for each TLV */
882 { "TLV", "ubt.tlv",
883 FT_NONE, BASE_NONE, NULL, 0x0,
884 NULL, HFILL }
887 { &hf_ubt_type,/* type of each TLV */
888 { "Type", "ubt.tlv_type",
889 FT_UINT8, BASE_DEC, NULL, 0x0,
890 NULL, HFILL }
893 { &hf_ubt_length,/* length of each TLV */
894 { "Length", "ubt.tlv_length",
895 FT_UINT16, BASE_DEC, NULL, 0x0,
896 NULL, HFILL }
899 { &hf_ubt_switch_macaddr,/* MAC address of Switch */
900 { "Switch MAC Address", "ubt.switch.mac_addr",
901 FT_ETHER, BASE_NONE, NULL, 0x0,
902 NULL, HFILL }
905 { &hf_ubt_switch_seqno,/* sequence number of Switch */
906 { "Switch Sequence Number", "ubt.switch.seq_number",
907 FT_UINT32, BASE_DEC, NULL, 0x0,
908 NULL, HFILL }
911 { &hf_ubt_msg_type,/* type of UBT message */
912 { "Message Type", "ubt.msg_type",
913 FT_UINT32, BASE_DEC, NULL, 0x0,
914 NULL, HFILL }
917 { &hf_ubt_dt_unknown,/* Unknown data type */
918 { "Unknown Datatype", "ubt.unknown_datatype",
919 FT_BYTES, BASE_NONE, NULL, 0x0,
920 NULL, HFILL }
923 { &hf_ubt_dt_grekey,/* GRE key */
924 { "GRE Key", "ubt.gre_key",
925 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
926 NULL, HFILL }
929 { &hf_ubt_dt_firmwareversion,/* version of the firmware */
930 { "Firmware Version", "ubt.firmware_version",
931 FT_STRING, BASE_NONE, NULL, 0x0,
932 NULL, HFILL }
935 { &hf_ubt_dt_userkey,/* userkey */
936 { "User Key", "ubt.user_key",
937 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
938 NULL, HFILL }
941 { &hf_ubt_dt_sacmode,/* mode of SAC */
942 { "SAC Mode", "ubt.sac_mode",
943 FT_UINT8, BASE_DEC, NULL, 0x0,
944 NULL, HFILL }
947 { &hf_ubt_dt_sacipv4,/* IPv4 address of SAC */
948 { "SAC IP Address (IPv4)", "ubt.sac_ipv4",
949 FT_IPv4, BASE_NONE, NULL, 0x0,
950 NULL, HFILL }
953 { &hf_ubt_dt_sacipv6,/* IPv6 address of SAC */
954 { "SAC IP Address (IPv6)", "ubt.sac_ipv6",
955 FT_IPv6, BASE_NONE, NULL, 0x0,
956 NULL, HFILL }
959 { &hf_ubt_dt_heartbeattimeout,/* heartbeat timeout in secs */
960 { "Heartbeat Timeout", "ubt.heartbeat_timeout",
961 FT_UINT16, BASE_DEC, NULL, 0x0,
962 NULL, HFILL }
965 { &hf_ubt_dt_usermac,/* MAC address of User */
966 { "User MAC Address", "ubt.user_macaddress",
967 FT_ETHER, BASE_NONE, NULL, 0x0,
968 NULL, HFILL }
971 { &hf_ubt_dt_uservlan,/* VLAN assigned to user */
972 { "User VLAN", "ubt.user_vlan",
973 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
974 NULL, HFILL }
977 { &hf_ubt_ip_type,/* IP type */
978 { "IP Type", "ubt.ip_type",
979 FT_UINT16, BASE_HEX, VALS(ubt_iptype_vals), 0x0,
980 NULL, HFILL }
983 { &hf_ubt_ip_padding,/* IP Padding */
984 { "IP Padding", "ubt.ip_padding",
985 FT_BYTES, BASE_NONE, NULL, 0x0,
986 NULL, HFILL }
989 { &hf_ubt_ip_unassigned,/* IP Padding */
990 { "IP Unassigned", "ubt.ip_unassigned",
991 FT_BYTES, BASE_NONE, NULL, 0x0,
992 NULL, HFILL }
995 { &hf_ubt_dt_flags,/* Flags, both switch & user */
996 { "Flags", "ubt.flags",
997 FT_UINT8, BASE_HEX, NULL, 0x0,
998 NULL, HFILL }
1001 { &hf_ubt_switch_flags_bcmctoucast,/* switch flag: BCMC to UCAST? */
1002 { "SB_FLAGS_CONV_BCMC_TO_UCAST", "ubt.flags.switch.bcmctoucast",
1003 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
1004 NULL, HFILL }
1006 { &hf_ubt_user_flags_tag,/* user flag: Tagged? */
1007 { "UB_FLAGS_TAGGED", "ubt.flags.user.tag",
1008 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
1009 NULL, HFILL }
1011 { &hf_ubt_user_flags_auth,/* user flag: Authenticated? */
1012 { "UB_FLAGS_IS_AUTHENTICATED", "ubt.flags.user.auth",
1013 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
1014 NULL, HFILL }
1016 { &hf_ubt_user_flags_bcmctoucast,/* user flag: BCMC to UCAST? */
1017 { "UB_FLAGS_CONV_BCMC_TO_UCAST", "ubt.flags.user.bcmctoucast",
1018 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
1019 NULL, HFILL }
1021 { &hf_ubt_user_flags_dormant,/* user flag: Dormant? */
1022 { "UB_FLAGS_DORMANT", "ubt.flags.user.dormant",
1023 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x08,
1024 NULL, HFILL }
1026 { &hf_ubt_user_flags_uback,/* user flag: UB ACK sent? */
1027 { "UB_FLAGS_IS_UB_ACK_SENT", "ubt.flags.user.uback",
1028 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10,
1029 NULL, HFILL }
1032 { &hf_ubt_dt_tunnelmtu,/* Tunnel MTU */
1033 { "Tunnel MTU", "ubt.tunnel_mtu",
1034 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
1035 NULL, HFILL }
1038 { &hf_ubt_dt_userrole,/* role of user */
1039 { "User Role", "ubt.user_role",
1040 FT_STRING, BASE_NONE, NULL, 0x0,
1041 NULL, HFILL }
1044 { &hf_ubt_dt_reasoncode,/* reason code */
1045 { "Reason Code", "ubt.reason_code",
1046 FT_UINT8, BASE_DEC, NULL, 0x0,
1047 NULL, HFILL }
1050 { &hf_ubt_dt_nodelist,/* nodelist header */
1051 { "Node List", "ubt.node_list",
1052 FT_NONE, BASE_NONE, NULL, 0x0,
1053 NULL, HFILL }
1056 { &hf_ubt_dt_clustername,/* name of the cluster */
1057 { "Cluster Name", "ubt.node_list.cluster_name",
1058 FT_STRING, BASE_NONE, NULL, 0x0,
1059 NULL, HFILL }
1062 { &hf_ubt_dt_clusterenabled,/* if cluster enabled or not */
1063 { "Cluster Enabled", "ubt.node_list.cluster_enabled",
1064 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1065 NULL, HFILL }
1068 { &hf_ubt_dt_ssacindex,/* index of SSAC */
1069 { "SSAC Index", "ubt.node_list.ssac_index",
1070 FT_INT8, BASE_DEC, NULL, 0x0,
1071 NULL, HFILL }
1074 { &hf_ubt_dt_reserved,/* no of reserved */
1075 { "Reserved", "ubt.node_list.reserved",
1076 FT_UINT8, BASE_DEC, NULL, 0x0,
1077 NULL, HFILL }
1080 { &hf_ubt_dt_uaccount,/* no of UACs assigned */
1081 { "UAC Count", "ubt.uac_count",
1082 FT_UINT8, BASE_DEC, NULL, 0x0,
1083 NULL, HFILL }
1086 { &hf_ubt_dt_uaciplist,/* IP addresses of each UAC */
1087 { "UAC IP", "ubt.uac_ip_list",
1088 FT_NONE, BASE_NONE, NULL, 0x0,
1089 NULL, HFILL }
1092 { &hf_ubt_dt_uacipv4,/* IPv4 address of UAC */
1093 { "UAC IP Address (IPv4)", "ubt.uac_ipv4",
1094 FT_IPv4, BASE_NONE, NULL, 0x0,
1095 NULL, HFILL }
1098 { &hf_ubt_dt_uacipv6,/* IPv6 address of UAC */
1099 { "UAC IP Address (IPv6)", "ubt.uac_ipv6",
1100 FT_IPv6, BASE_NONE, NULL, 0x0,
1101 NULL, HFILL }
1104 { &hf_ubt_dt_bucketmap,/* bucketmap header */
1105 { "Bucket Map", "ubt.bucket_map",
1106 FT_NONE, BASE_NONE, NULL, 0x0,
1107 NULL, HFILL }
1110 { &hf_ubt_dt_timestamp,/* timestamp */
1111 { "Timestamp", "ubt.bucket_map.time_stamp",
1112 FT_BYTES, BASE_NONE, NULL, 0x0,
1113 NULL, HFILL }
1116 { &hf_ubt_dt_identifier,/* identifier string */
1117 { "Identifier", "ubt.bucket_map.identifier",
1118 FT_STRING, BASE_NONE, NULL, 0x0,
1119 NULL, HFILL }
1122 /* arrays to hold active maps */
1123 { &hf_ubt_dt_activemap1,/* array 1 */
1124 { "Active Map[0-31]", "ubt.bucket_map.active_map_0-031",
1125 FT_BYTES, BASE_NONE, NULL, 0x0,
1126 NULL, HFILL }
1128 { &hf_ubt_dt_activemap2,/* array 2 */
1129 { "Active Map[32-63]", "ubt.bucket_map.active_map_032-063",
1130 FT_BYTES, BASE_NONE, NULL, 0x0,
1131 NULL, HFILL }
1133 { &hf_ubt_dt_activemap3,/* array 3 */
1134 { "Active Map[64-95]", "ubt.bucket_map.active_map_064-095",
1135 FT_BYTES, BASE_NONE, NULL, 0x0,
1136 NULL, HFILL }
1138 { &hf_ubt_dt_activemap4,/* array 4 */
1139 { "Active Map[96-127]", "ubt.bucket_map.active_map_096-127",
1140 FT_BYTES, BASE_NONE, NULL, 0x0,
1141 NULL, HFILL }
1143 { &hf_ubt_dt_activemap5,/* array 5 */
1144 { "Active Map[128-159]", "ubt.bucket_map.active_map_128-159",
1145 FT_BYTES, BASE_NONE, NULL, 0x0,
1146 NULL, HFILL }
1148 { &hf_ubt_dt_activemap6,/* array 6 */
1149 { "Active Map[160-191]", "ubt.bucket_map.active_map_160-191",
1150 FT_BYTES, BASE_NONE, NULL, 0x0,
1151 NULL, HFILL }
1153 { &hf_ubt_dt_activemap7,/* array 7 */
1154 { "Active Map[192-223]", "ubt.bucket_map.active_map_192-223",
1155 FT_BYTES, BASE_NONE, NULL, 0x0,
1156 NULL, HFILL }
1158 { &hf_ubt_dt_activemap8,/* array 8 */
1159 { "Active Map[224-255]", "ubt.bucket_map.active_map_224-255",
1160 FT_BYTES, BASE_NONE, NULL, 0x0,
1161 NULL, HFILL }
1164 /* arrays to hold standby maps */
1165 { &hf_ubt_dt_standbymap1,/* array 1 */
1166 { "Standby Map[0-31]", "ubt.bucket_map.standby_map_0-031",
1167 FT_BYTES, BASE_NONE, NULL, 0x0,
1168 NULL, HFILL }
1170 { &hf_ubt_dt_standbymap2,/* array 2 */
1171 { "Standby Map[32-63]", "ubt.bucket_map.standby_map_032-063",
1172 FT_BYTES, BASE_NONE, NULL, 0x0,
1173 NULL, HFILL }
1175 { &hf_ubt_dt_standbymap3,/* array 3 */
1176 { "Standby Map[64-95]", "ubt.bucket_map.standby_map_064-095",
1177 FT_BYTES, BASE_NONE, NULL, 0x0,
1178 NULL, HFILL }
1180 { &hf_ubt_dt_standbymap4,/* array 4 */
1181 { "Standby Map[96-127]", "ubt.bucket_map.standby_map_096-127",
1182 FT_BYTES, BASE_NONE, NULL, 0x0,
1183 NULL, HFILL }
1185 { &hf_ubt_dt_standbymap5,/* array 5 */
1186 { "Standby Map[128-159]", "ubt.bucket_map.standby_map_128-159",
1187 FT_BYTES, BASE_NONE, NULL, 0x0,
1188 NULL, HFILL }
1190 { &hf_ubt_dt_standbymap6,/* array 6 */
1191 { "Standby Map[160-191]", "ubt.bucket_map.standby_map_160-191",
1192 FT_BYTES, BASE_NONE, NULL, 0x0,
1193 NULL, HFILL }
1195 { &hf_ubt_dt_standbymap7,/* array 7 */
1196 { "Standby Map[192-223]", "ubt.bucket_map.standby_map_192-223",
1197 FT_BYTES, BASE_NONE, NULL, 0x0,
1198 NULL, HFILL }
1200 { &hf_ubt_dt_standbymap8,/* array 8 */
1201 { "Standby Map[224-255]", "ubt.bucket_map.standby_map_224-255",
1202 FT_BYTES, BASE_NONE, NULL, 0x0,
1203 NULL, HFILL }
1206 /* arrays to hold l2conn */
1207 { &hf_ubt_dt_l2conn1,/* array 1 */
1208 { "L2Connect[0-31]", "ubt.bucket_map.l2conn_0-031",
1209 FT_BYTES, BASE_NONE, NULL, 0x0,
1210 NULL, HFILL }
1212 { &hf_ubt_dt_l2conn2,/* array 2 */
1213 { "L2Connect[32-63]", "ubt.bucket_map.l2conn_032-063",
1214 FT_BYTES, BASE_NONE, NULL, 0x0,
1215 NULL, HFILL }
1217 { &hf_ubt_dt_l2conn3,/* array 3 */
1218 { "L2Connect[64-95]", "ubt.bucket_map.l2conn_064-095",
1219 FT_BYTES, BASE_NONE, NULL, 0x0,
1220 NULL, HFILL }
1222 { &hf_ubt_dt_l2conn4,/* array 4 */
1223 { "L2Connect[96-127]", "ubt.bucket_map.l2conn_096-127",
1224 FT_BYTES, BASE_NONE, NULL, 0x0,
1225 NULL, HFILL }
1227 { &hf_ubt_dt_l2conn5,/* array 5 */
1228 { "L2Connect[128-159]", "ubt.bucket_map.l2conn_128-159",
1229 FT_BYTES, BASE_NONE, NULL, 0x0,
1230 NULL, HFILL }
1232 { &hf_ubt_dt_l2conn6,/* array 6 */
1233 { "L2Connect[160-191]", "ubt.bucket_map.l2conn_160-191",
1234 FT_BYTES, BASE_NONE, NULL, 0x0,
1235 NULL, HFILL }
1237 { &hf_ubt_dt_l2conn7,/* array 7 */
1238 { "L2Connect[192-223]", "ubt.bucket_map.l2conn_192-223",
1239 FT_BYTES, BASE_NONE, NULL, 0x0,
1240 NULL, HFILL }
1242 { &hf_ubt_dt_l2conn8,/* array 8 */
1243 { "L2Connect[224-255]", "ubt.bucket_map.l2conn_224-255",
1244 FT_BYTES, BASE_NONE, NULL, 0x0,
1245 NULL, HFILL }
1249 { &hf_ubt_dt_status,/* status of message */
1250 { "Status", "ubt.status",
1251 FT_BOOLEAN, BASE_NONE, TFS(&tfs_success_fail), 0x0,
1252 NULL, HFILL }
1255 { &hf_ubt_dt_mcastkey,/* MCAST key used */
1256 { "MCAST Key", "ubt.mcast_key",
1257 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
1258 NULL, HFILL }
1261 { &hf_ubt_dt_serveripv4,/* IPv4 address of server */
1262 { "Server IP Address (IPv4)", "ubt.server_ipaddressv4",
1263 FT_IPv4, BASE_NONE, NULL, 0x0,
1264 NULL, HFILL }
1267 { &hf_ubt_dt_serveripv6,/* IPv6 address of server */
1268 { "Server IP Address (IPv6)", "ubt.server_ipaddressv6",
1269 FT_IPv6, BASE_NONE, NULL, 0x0,
1270 NULL, HFILL }
1273 { &hf_ubt_dt_userauthmethod,/* user authentication method used */
1274 { "User Auth Method", "ubt.user_authmethod",
1275 FT_UINT8, BASE_DEC, NULL, 0x0,
1276 NULL, HFILL }
1279 { &hf_ubt_dt_username,/* username */
1280 { "Username", "ubt.username",
1281 FT_STRING, BASE_NONE, NULL, 0x0,
1282 NULL, HFILL }
1285 { &hf_ubt_dt_userportname,/* Port name of the user */
1286 { "User Port Name", "ubt.user_portname",
1287 FT_STRING, BASE_NONE, NULL, 0x0,
1288 NULL, HFILL }
1291 { &hf_ubt_dt_switchname,/* name of the switch */
1292 { "Switch Name", "ubt.switch_name",
1293 FT_STRING, BASE_NONE, NULL, 0x0,
1294 NULL, HFILL }
1297 { &hf_ubt_dt_silentclientvlans,/* Silent Client VLANs header */
1298 { "Silent Client VLANs", "ubt.silent_client_vlans",
1299 FT_NONE, BASE_NONE, NULL, 0x0,
1300 NULL, HFILL }
1303 { &hf_ubt_dt_silentclientvlan,/* each silent client VLAN assigned */
1304 { "Silent Client VLAN", "ubt.silent_client_vlan",
1305 FT_BYTES, BASE_NONE, NULL, 0x0,
1306 NULL, HFILL }
1309 { &hf_ubt_dt_maxmsgs,/* maximum messages allowed */
1310 { "Max Messages", "ubt.max_msgs",
1311 FT_BYTES, BASE_NONE, NULL, 0x0,
1312 NULL, HFILL }
1317 /* Setup protocol subtree array */
1318 static int* ett[] = {
1319 &ett_ubt,
1320 &ett_ubt_tlv,
1321 &ett_ubt_flags
1324 static ei_register_info ei[] = {
1325 { &ei_ubt_unknown, {"ubt.unknown", PI_PROTOCOL, PI_WARN, "Unknown", EXPFILL}},
1328 /* registering protocol with proto_register_protocol() function */
1329 proto_ubt = proto_register_protocol("Aruba UBT", "UBT", "ubt");
1331 /* registering field array */
1332 proto_register_field_array(proto_ubt, hf, array_length(hf));
1334 /* registering subtree array */
1335 proto_register_subtree_array(ett, array_length(ett));
1337 expert_module_t* expert_ubt;
1339 /* registering UBT protocol with expert info */
1340 expert_ubt = expert_register_protocol(proto_ubt);
1342 /* registering expert field array for UBT */
1343 expert_register_field_array(expert_ubt, ei, array_length(ei));
1345 /* handling proto_ubt & dissector function using handle */
1346 ubt_handle = register_dissector("ubt", dissect_ubt, proto_ubt);
1349 void
1350 proto_reg_handoff_ubt(void)
1352 /* adding port numbers to the handle */
1353 dissector_add_uint("papi.port", PORT_UBT, ubt_handle);
1356 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1358 * Local variables:
1359 * c-basic-offset: 4
1360 * tab-width: 8
1361 * indent-tabs-mode: nil
1362 * End:
1364 * vi: set shiftwidth=4 tabstop=8 expandtab:
1365 * :indentSize=4:tabSize=8:noTabs=true: