| File: | builds/wireshark/wireshark/epan/dissectors/packet-aruba-ubt.c |
| Warning: | line 372, column 13 Value stored to 'offset' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* packet-aruba-ubt.c |
| 2 | * Routines for Aruba UBT dissection |
| 3 | * |
| 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 |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
| 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> |
| 19 | |
| 20 | /* This is not IANA assigned nor registered */ |
| 21 | #define PORT_UBT15560 15560 |
| 22 | |
| 23 | void proto_register_ubt(void); |
| 24 | void proto_reg_handoff_ubt(void); |
| 25 | |
| 26 | /* declaring dissector handle */ |
| 27 | static dissector_handle_t ubt_handle; |
| 28 | |
| 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; |
| 39 | |
| 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; |
| 52 | |
| 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; |
| 57 | |
| 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; |
| 65 | |
| 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; |
| 81 | |
| 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; |
| 91 | |
| 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; |
| 101 | |
| 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; |
| 111 | |
| 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; |
| 123 | |
| 124 | static expert_field ei_ubt_unknown; |
| 125 | |
| 126 | /* Initialize the subtree pointers */ |
| 127 | static int ett_ubt; |
| 128 | static int ett_ubt_tlv; |
| 129 | static int ett_ubt_flags; |
| 130 | |
| 131 | /* Definition of different sizes and counts used throughout the program */ |
| 132 | #define PAPI_PACKET_SIZE76 76 |
| 133 | #define SIZE_AT_DEST_PORT16 16 |
| 134 | #define SIZE_AT_SRC_PORT18 18 |
| 135 | #define PACKET_LENGTH_SIZE4 4 |
| 136 | #define MESSAGE_TYPE_SIZE4 4 |
| 137 | #define MAC_ADDR_SIZE6 6 |
| 138 | #define SEQ_NO_SIZE4 4 |
| 139 | #define TYPE_SIZE1 1 |
| 140 | #define LENGTH_SIZE2 2 |
| 141 | #define CLUSTER_NAME_SIZE32 32 |
| 142 | #define CLUSTER_ENABLED1 1 |
| 143 | #define SSAC_INDEX1 1 |
| 144 | #define RESERVED_COUNT1 1 |
| 145 | #define UAC_COUNT_SIZE1 1 |
| 146 | #define UAC_MAX_COUNT12 12 |
| 147 | #define IP_SIZE20 20 |
| 148 | #define TIMESTAMP_SIZE8 8 |
| 149 | #define IDENTIFIER_SIZE33 33 |
| 150 | #define MAP_SIZE256 256 |
| 151 | #define MAP_SUBSET_SIZE32 32 |
| 152 | #define MAP_ARRAY_SIZE8 8 |
| 153 | #define INCREMENT_SIZE2 2 |
| 154 | #define TYPE_IPV40x02 0x02 |
| 155 | #define TYPE_IPV60x0a 0x0a |
| 156 | #define TYPE_NOT_ASSIGNED0x0 0x0 |
| 157 | #define AUTH_METHOD_8021X2 2 |
| 158 | #define AUTH_METHOD_WEB3 3 |
| 159 | #define AUTH_METHOD_MAC4 4 |
| 160 | #define AUTH_METHOD_LMA6 6 |
| 161 | |
| 162 | static const value_string ubt_authmethod_vals[] = { |
| 163 | { AUTH_METHOD_8021X2, "UB_AUTH_METHOD_8021X" }, |
| 164 | { AUTH_METHOD_WEB3, "UB_AUTH_METHOD_WEB" }, |
| 165 | { AUTH_METHOD_MAC4, "UB_AUTH_METHOD_MAC" }, |
| 166 | { AUTH_METHOD_LMA6, "UB_AUTH_METHOD_LMA" }, |
| 167 | { 0, NULL((void*)0) } |
| 168 | }; |
| 169 | |
| 170 | static const value_string ubt_iptype_vals[] = { |
| 171 | { TYPE_IPV40x02, "IPv4" }, |
| 172 | { TYPE_IPV60x0a, "IPv6" }, |
| 173 | { TYPE_NOT_ASSIGNED0x0, "Not Assigned" }, |
| 174 | { 0, NULL((void*)0) } |
| 175 | }; |
| 176 | |
| 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 |
| 200 | }; |
| 201 | |
| 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((void*)0) } |
| 224 | }; |
| 225 | |
| 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 |
| 252 | }; |
| 253 | |
| 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((void*)0) } |
| 279 | }; |
| 280 | |
| 281 | /* main dissector function */ |
| 282 | static int |
| 283 | dissect_ubt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U___attribute__((unused))) |
| 284 | { |
| 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; |
| 290 | char* str_msgtype; |
| 291 | |
| 292 | /* Setting protocol column to UBT */ |
| 293 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "UBT"); |
| 294 | |
| 295 | /* clearing info column */ |
| 296 | col_clear(pinfo->cinfo, COL_INFO); |
| 297 | |
| 298 | /* setting proto_item & tree to the current offset */ |
| 299 | ti = proto_tree_add_item(tree, proto_ubt, tvb, offset, -1, ENC_NA0x00000000); |
| 300 | |
| 301 | /* adding it as a subtree to Wireshark tree */ |
| 302 | message_tree = proto_item_add_subtree(ti, ett_ubt); |
| 303 | |
| 304 | /* determining packet length & message type */ |
| 305 | proto_tree_add_item(message_tree, hf_ubt_packet_len, tvb, offset, PACKET_LENGTH_SIZE4, ENC_BIG_ENDIAN0x00000000); |
| 306 | offset += PACKET_LENGTH_SIZE4; |
| 307 | ubt_msg_type = proto_tree_add_item_ret_uint(message_tree, hf_ubt_msg_type, tvb, offset, MESSAGE_TYPE_SIZE4, ENC_BIG_ENDIAN0x00000000, &msgtype); |
| 308 | |
| 309 | str_msgtype = val_to_str(pinfo->pool, msgtype, ubt_msgtype_vals, "Unknown Type (%02d)"); |
| 310 | proto_item_append_text(ubt_msg_type, "(%s)", str_msgtype); |
| 311 | col_append_str(pinfo->cinfo, COL_INFO, str_msgtype); |
| 312 | |
| 313 | offset += MESSAGE_TYPE_SIZE4; |
| 314 | |
| 315 | /* Condition to check if Switch MAC address to be added or not */ |
| 316 | if (msgtype != UserBootstrapACK && msgtype != SwitchKeepaliveACK) { |
| 317 | proto_tree_add_item(message_tree, hf_ubt_switch_macaddr, tvb, offset, MAC_ADDR_SIZE6, ENC_NA0x00000000); |
| 318 | |
| 319 | /* appending to info column */ |
| 320 | col_append_fstr(pinfo->cinfo, COL_INFO, " switchmac:%s", tvb_get_ether_name(tvb, offset)); |
| 321 | offset += MAC_ADDR_SIZE6; |
| 322 | } |
| 323 | |
| 324 | /* adding Switch Sequence Number to tree */ |
| 325 | proto_tree_add_item(message_tree, hf_ubt_switch_seqno, tvb, offset, SEQ_NO_SIZE4, ENC_BIG_ENDIAN0x00000000); |
| 326 | |
| 327 | /* appending to info column */ |
| 328 | col_append_fstr(pinfo->cinfo, COL_INFO, " seq:%d", tvb_get_uint32(tvb, offset, ENC_NA0x00000000)); |
| 329 | offset += SEQ_NO_SIZE4; |
| 330 | |
| 331 | /* if Switch Keepalive Message type, terminate dissection */ |
| 332 | if (msgtype == SwitchKeepaliveMessage) { |
| 333 | return offset; |
| 334 | } |
| 335 | |
| 336 | /* storing length of buffer */ |
| 337 | offset_end = tvb_reported_length(tvb); |
| 338 | |
| 339 | /* dealing with TLVs */ |
| 340 | proto_item* tlv_header; |
| 341 | tlv_header = proto_tree_add_item(message_tree, hf_ubt_tlv_header, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA0x00000000); |
| 342 | message_subtree = proto_item_add_subtree(tlv_header, ett_ubt); |
| 343 | |
| 344 | while (offset < offset_end) { |
| 345 | |
| 346 | /* variable to store T, L, V of TLVs & other data */ |
| 347 | unsigned optlen = 0, type = 0, val = 0, tlv_end; |
| 348 | bool_Bool bool_val = false0; |
| 349 | proto_item* tlv, * tlv_item, * tlv_item2; |
| 350 | |
| 351 | /* reading type & length of TLVS from stream */ |
| 352 | type = tvb_get_uint8(tvb, offset); |
| 353 | optlen = tvb_get_uint16(tvb, offset + TYPE_SIZE1, ENC_BIG_ENDIAN0x00000000); |
| 354 | |
| 355 | /* Adding TLV items to the tree */ |
| 356 | tlv = proto_tree_add_item(message_subtree, hf_ubt_tlv, tvb, offset, optlen + TYPE_SIZE1 + LENGTH_SIZE2, ENC_NA0x00000000); |
| 357 | proto_item_append_text(tlv, ": t=%d, l=%d, %s", type, optlen, val_to_str(pinfo->pool, type, ubt_dttype_vals, "Unknown Type (%02d)")); |
| 358 | message_subtree2 = proto_item_add_subtree(tlv, ett_ubt_tlv); |
| 359 | |
| 360 | /* adding type & length to TLV subtree */ |
| 361 | proto_tree_add_item(message_subtree2, hf_ubt_type, tvb, offset, TYPE_SIZE1, ENC_NA0x00000000); |
| 362 | offset += TYPE_SIZE1; |
| 363 | proto_tree_add_item(message_subtree2, hf_ubt_length, tvb, offset, LENGTH_SIZE2, ENC_BIG_ENDIAN0x00000000); |
| 364 | offset += LENGTH_SIZE2; |
| 365 | tlv_end = offset + optlen; |
| 366 | |
| 367 | /* Different data types */ |
| 368 | switch (type) { |
| 369 | |
| 370 | case Unknown:/* Unknown, because type 0 is undefined */ |
| 371 | proto_tree_add_item(message_subtree2, hf_ubt_dt_unknown, tvb, offset, optlen, ENC_NA0x00000000); |
| 372 | offset += optlen; |
Value stored to 'offset' is never read | |
| 373 | break; |
| 374 | |
| 375 | case GREKey:/* Type 1: GRE Key */ |
| 376 | |
| 377 | /* adding GRE key as proto_item to the tree */ |
| 378 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_grekey, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 379 | proto_item_append_text(tlv, ": %#x(%u)", val, val); |
| 380 | |
| 381 | /* appending to info column */ |
| 382 | col_append_fstr(pinfo->cinfo, COL_INFO, " grekey:%u", val); |
| 383 | offset += optlen; |
| 384 | break; |
| 385 | |
| 386 | case FirmwareVersion:/* Type 2: Firmware version */ |
| 387 | |
| 388 | /* adding Firmware version as proto_item to the tree */ |
| 389 | proto_tree_add_item(message_subtree2, hf_ubt_dt_firmwareversion, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 390 | proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII0x00000000)); |
| 391 | offset += optlen; |
| 392 | break; |
| 393 | |
| 394 | case UserKey:/* Type 3: User key */ |
| 395 | |
| 396 | /* adding User key as proto_item to the tree */ |
| 397 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_userkey, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 398 | proto_item_append_text(tlv, ": %#x(%u)", val, val); |
| 399 | |
| 400 | /* appending to info column */ |
| 401 | col_append_fstr(pinfo->cinfo, COL_INFO, " userkey:%u", val); |
| 402 | offset += optlen; |
| 403 | break; |
| 404 | |
| 405 | case SACMode:/* Type 4: SAC Mode */ |
| 406 | |
| 407 | /* adding SAC mode as proto_item to the tree */ |
| 408 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_sacmode, tvb, offset, optlen, ENC_NA0x00000000, &val); |
| 409 | proto_item_append_text(tlv, ": %u", val); |
| 410 | |
| 411 | /* appending to info column */ |
| 412 | col_append_fstr(pinfo->cinfo, COL_INFO, " sacMode:%u", val); |
| 413 | offset += optlen; |
| 414 | break; |
| 415 | |
| 416 | case SACIPAddress:/* Type 5: SAC IP Address */ |
| 417 | |
| 418 | /* adding SAC IP Address as proto_item to the tree */ |
| 419 | |
| 420 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &val); |
| 421 | offset += 2; |
| 422 | |
| 423 | switch (val) { |
| 424 | |
| 425 | case TYPE_IPV60x0a: |
| 426 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 427 | offset += 2; |
| 428 | proto_tree_add_item(message_subtree2, hf_ubt_dt_sacipv6, tvb, offset, IPv6_ADDR_SIZE16, ENC_NA0x00000000); |
| 429 | offset += IPv6_ADDR_SIZE16; |
| 430 | break; |
| 431 | |
| 432 | case TYPE_IPV40x02: |
| 433 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 434 | offset += 2; |
| 435 | proto_tree_add_item(message_subtree2, hf_ubt_dt_sacipv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 436 | offset += 4; |
| 437 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA0x00000000); |
| 438 | offset += 12; |
| 439 | break; |
| 440 | |
| 441 | case TYPE_NOT_ASSIGNED0x0: |
| 442 | proto_tree_add_item(message_subtree2, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE20 - 2, ENC_NA0x00000000); |
| 443 | offset += IP_SIZE20 - 2; |
| 444 | break; |
| 445 | |
| 446 | default: |
| 447 | proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE20 - 2, "Invalid IP Type"); |
| 448 | offset += IP_SIZE20 - 2; |
| 449 | |
| 450 | } |
| 451 | break; |
| 452 | |
| 453 | case HeartbeatTimeout:/* Type 6: Heartbeat Timeout */ |
| 454 | |
| 455 | /* adding Heartbeat timeout as proto_item to the tree */ |
| 456 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_heartbeattimeout, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 457 | proto_item_append_text(tlv, ": %u", val); |
| 458 | offset += optlen; |
| 459 | break; |
| 460 | |
| 461 | case UserMAC:/* Type 7: User MAC Address */ |
| 462 | |
| 463 | /* adding User MAC address as proto_item to the tree */ |
| 464 | proto_tree_add_item(message_subtree2, hf_ubt_dt_usermac, tvb, offset, optlen, ENC_NA0x00000000); |
| 465 | proto_item_append_text(tlv, ": %s", tvb_get_ether_name(tvb, offset)); |
| 466 | |
| 467 | /* appending to info column */ |
| 468 | col_append_fstr(pinfo->cinfo, COL_INFO, " usermac:%s", tvb_get_ether_name(tvb, offset)); |
| 469 | offset += optlen; |
| 470 | break; |
| 471 | |
| 472 | case UserVLAN:/* Type 8: User VLAN */ |
| 473 | |
| 474 | /* adding User VLAN as proto_item to the tree */ |
| 475 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_uservlan, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 476 | proto_item_append_text(tlv, ": %#x(%u)", val, val); |
| 477 | |
| 478 | /* appending to info column */ |
| 479 | col_append_fstr(pinfo->cinfo, COL_INFO, " vlan:%u", val); |
| 480 | offset += optlen; |
| 481 | break; |
| 482 | |
| 483 | case Flags:/* Type 9: Flags */ |
| 484 | |
| 485 | /* adding flags for switch */ |
| 486 | if (msgtype == SwitchBootstrapMessage) { |
| 487 | static int* const ubt_switch_flags[] = { |
| 488 | &hf_ubt_switch_flags_bcmctoucast, |
| 489 | NULL((void*)0) |
| 490 | }; |
| 491 | proto_tree_add_bitmask_with_flags(message_subtree2, tvb, offset, hf_ubt_dt_flags, ett_ubt_flags, ubt_switch_flags, ENC_BIG_ENDIAN0x00000000, BMT_NO_APPEND0x01); |
| 492 | } |
| 493 | |
| 494 | /* adding flags for user */ |
| 495 | else if (msgtype == UserBootstrapMessage) { |
| 496 | static int* const ubt_user_flags[] = { |
| 497 | &hf_ubt_user_flags_tag, |
| 498 | &hf_ubt_user_flags_auth, |
| 499 | &hf_ubt_user_flags_bcmctoucast, |
| 500 | &hf_ubt_user_flags_dormant, |
| 501 | &hf_ubt_user_flags_uback, |
| 502 | NULL((void*)0) |
| 503 | }; |
| 504 | proto_tree_add_bitmask_with_flags(message_subtree2, tvb, offset, hf_ubt_dt_flags, ett_ubt_flags, ubt_user_flags, ENC_BIG_ENDIAN0x00000000, BMT_NO_APPEND0x01); |
| 505 | } |
| 506 | |
| 507 | val = tvb_get_uint8(tvb, offset); |
| 508 | |
| 509 | /* appending to info column */ |
| 510 | col_append_fstr(pinfo->cinfo, COL_INFO, " flags:%u", val); |
| 511 | offset += optlen; |
| 512 | break; |
| 513 | |
| 514 | case TunnelMTU:/* Type 10: Tunnel MTU */ |
| 515 | |
| 516 | /* adding Tunnel MTU as proto_item to the tree */ |
| 517 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_tunnelmtu, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 518 | proto_item_append_text(tlv, ": %#x(%u)", val, val); |
| 519 | |
| 520 | /* appending to info column */ |
| 521 | col_append_fstr(pinfo->cinfo, COL_INFO, " mtu:%u", val); |
| 522 | offset += optlen; |
| 523 | break; |
| 524 | |
| 525 | case UserRole:/* Type 11: User Role */ |
| 526 | |
| 527 | /* adding User Role as proto_item to the tree */ |
| 528 | proto_tree_add_item(message_subtree2, hf_ubt_dt_userrole, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 529 | char* userrole = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 530 | proto_item_append_text(tlv, ": %s", userrole); |
| 531 | |
| 532 | /* appending to info column */ |
| 533 | col_append_fstr(pinfo->cinfo, COL_INFO, " role:%s", userrole); |
| 534 | offset += optlen; |
| 535 | break; |
| 536 | |
| 537 | case ReasonCode:/* Type 12: Reason Code */ |
| 538 | |
| 539 | /* adding Reason Code as proto_item to the tree */ |
| 540 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_reasoncode, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 541 | proto_item_append_text(tlv, ": %u", val); |
| 542 | |
| 543 | /* appending to info column */ |
| 544 | col_append_fstr(pinfo->cinfo, COL_INFO, " reason:%u", val); |
| 545 | offset += optlen; |
| 546 | break; |
| 547 | |
| 548 | case Nodelist:/* Type 13: Nodelist */ |
| 549 | |
| 550 | /* adding Nodelist as proto_item to the tree */ |
| 551 | tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_nodelist, tvb, offset, optlen, ENC_NA0x00000000); |
| 552 | message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv); |
| 553 | |
| 554 | /* adding name of cluster to tree */ |
| 555 | proto_tree_add_item(message_subtree3, hf_ubt_dt_clustername, tvb, offset, CLUSTER_NAME_SIZE32, ENC_ASCII0x00000000); |
| 556 | offset += CLUSTER_NAME_SIZE32; |
| 557 | |
| 558 | /* determining if cluster enabled or not */ |
| 559 | proto_tree_add_item(message_subtree3, hf_ubt_dt_clusterenabled, tvb, offset, CLUSTER_ENABLED1, ENC_NA0x00000000); |
| 560 | offset += CLUSTER_ENABLED1; |
| 561 | |
| 562 | /* adding SSAC index to tree */ |
| 563 | proto_tree_add_item(message_subtree3, hf_ubt_dt_ssacindex, tvb, offset, SSAC_INDEX1, ENC_NA0x00000000); |
| 564 | offset += SSAC_INDEX1; |
| 565 | |
| 566 | /* adding no of reserved to tree */ |
| 567 | proto_tree_add_item(message_subtree3, hf_ubt_dt_reserved, tvb, offset, RESERVED_COUNT1, ENC_NA0x00000000); |
| 568 | offset += RESERVED_COUNT1; |
| 569 | |
| 570 | /* adding no of UACs assigned */ |
| 571 | proto_tree_add_item(message_subtree3, hf_ubt_dt_uaccount, tvb, offset, UAC_COUNT_SIZE1, ENC_NA0x00000000); |
| 572 | offset += UAC_COUNT_SIZE1; |
| 573 | |
| 574 | /* adding list of UAC IPs assigned */ |
| 575 | for (int i = 0; i < UAC_MAX_COUNT12; i++) { |
| 576 | tlv_item = proto_tree_add_item(message_subtree3, hf_ubt_dt_uaciplist, tvb, offset, IP_SIZE20, ENC_NA0x00000000); |
| 577 | message_subtree4 = proto_item_add_subtree(tlv_item, ett_ubt_tlv); |
| 578 | proto_item_append_text(tlv_item, "(%d)", i + 1); |
| 579 | |
| 580 | proto_tree_add_item_ret_uint(message_subtree4, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &val); |
| 581 | offset += 2; |
| 582 | |
| 583 | switch (val) { |
| 584 | |
| 585 | case TYPE_IPV60x0a: |
| 586 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 587 | offset += 2; |
| 588 | proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv6, tvb, offset, IPv6_ADDR_SIZE16, ENC_NA0x00000000); |
| 589 | offset += IPv6_ADDR_SIZE16; |
| 590 | break; |
| 591 | |
| 592 | case TYPE_IPV40x02: |
| 593 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 594 | offset += 2; |
| 595 | proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 596 | offset += 4; |
| 597 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA0x00000000); |
| 598 | offset += 12; |
| 599 | break; |
| 600 | |
| 601 | case TYPE_NOT_ASSIGNED0x0: |
| 602 | proto_tree_add_item(message_subtree4, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE20 - 2, ENC_NA0x00000000); |
| 603 | offset += IP_SIZE20 - 2; |
| 604 | break; |
| 605 | |
| 606 | default: |
| 607 | proto_tree_add_expert_format(message_subtree4, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE20 - 2, "Invalid IP Type"); |
| 608 | offset += IP_SIZE20 - 2; |
| 609 | |
| 610 | } |
| 611 | } |
| 612 | break; |
| 613 | |
| 614 | case Bucketmap:/* Type 14: Bucketmap */ |
| 615 | |
| 616 | /* adding Bucketmap as proto_item to the tree */ |
| 617 | tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_bucketmap, tvb, offset, optlen, ENC_NA0x00000000); |
| 618 | message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv); |
| 619 | |
| 620 | /* adding timestamp to tree */ |
| 621 | proto_tree_add_item(message_subtree3, hf_ubt_dt_timestamp, tvb, offset, TIMESTAMP_SIZE8, ENC_NA0x00000000); |
| 622 | offset += TIMESTAMP_SIZE8; |
| 623 | |
| 624 | /* adding identifier string to tree */ |
| 625 | proto_tree_add_item(message_subtree3, hf_ubt_dt_identifier, tvb, offset, IDENTIFIER_SIZE33, ENC_ASCII0x00000000); |
| 626 | offset += IDENTIFIER_SIZE33; |
| 627 | |
| 628 | /* array to store activemaps in size of 32 */ |
| 629 | int arr[MAP_ARRAY_SIZE8] = { 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 }; |
| 630 | /* adding activemaps of size 32 at a time */ |
| 631 | for (int i = 0; i < MAP_SIZE256; i += MAP_SUBSET_SIZE32) { |
| 632 | if ((i / MAP_SUBSET_SIZE32) == 0) { |
| 633 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 634 | } |
| 635 | else if ((i / MAP_SUBSET_SIZE32) == 1 || (i / MAP_SUBSET_SIZE32) == 2) { |
| 636 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 637 | } |
| 638 | else if ((i / MAP_SUBSET_SIZE32) == 3) { |
| 639 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 640 | } |
| 641 | else { |
| 642 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 643 | } |
| 644 | offset += 1; |
| 645 | for (int j = 1; j < MAP_SUBSET_SIZE32; j += 1) { |
| 646 | proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset)); |
| 647 | offset += 1; |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /* array to store standbymaps in size of 32 */ |
| 652 | int arr2[MAP_ARRAY_SIZE8] = { 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 }; |
| 653 | |
| 654 | /* adding standbymaps of size 32 at a time */ |
| 655 | for (int i = 0; i < MAP_SIZE256; i += MAP_SUBSET_SIZE32) { |
| 656 | if ((i / MAP_SUBSET_SIZE32) == 0) { |
| 657 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 658 | } |
| 659 | else if ((i / MAP_SUBSET_SIZE32) == 1 || (i / MAP_SUBSET_SIZE32) == 2) { |
| 660 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 661 | } |
| 662 | else if ((i / MAP_SUBSET_SIZE32) == 3) { |
| 663 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 664 | } |
| 665 | else { |
| 666 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr2[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 667 | } |
| 668 | offset += 1; |
| 669 | for (int j = 1; j < MAP_SUBSET_SIZE32; j += 1) { |
| 670 | proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset)); |
| 671 | offset += 1; |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | /* array to store l2conn in size of 32 */ |
| 676 | int arr3[MAP_ARRAY_SIZE8] = { 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 }; |
| 677 | |
| 678 | /* adding l2conn of size 32 at a time */ |
| 679 | for (int i = 0; i < MAP_SIZE256; i += MAP_SUBSET_SIZE32) { |
| 680 | if ((i / MAP_SUBSET_SIZE32) == 0) { |
| 681 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 682 | } |
| 683 | else if ((i / MAP_SUBSET_SIZE32) == 1 || (i / MAP_SUBSET_SIZE32) == 2) { |
| 684 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 685 | } |
| 686 | else if ((i / MAP_SUBSET_SIZE32) == 3) { |
| 687 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 688 | } |
| 689 | else { |
| 690 | tlv_item2 = proto_tree_add_bytes_format_value(message_subtree3, arr3[i / MAP_SUBSET_SIZE32], tvb, offset, MAP_SUBSET_SIZE32, NULL((void*)0), " %02d", tvb_get_int8(tvb, offset)); |
| 691 | } |
| 692 | offset += 1; |
| 693 | for (int j = 1; j < MAP_SUBSET_SIZE32; j += 1) { |
| 694 | proto_item_append_text(tlv_item2, " %02d", tvb_get_int8(tvb, offset)); |
| 695 | offset += 1; |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | /* adding no of UACs assigned */ |
| 700 | proto_tree_add_item(message_subtree3, hf_ubt_dt_uaccount, tvb, offset, UAC_COUNT_SIZE1, ENC_NA0x00000000); |
| 701 | offset += UAC_COUNT_SIZE1; |
| 702 | |
| 703 | /* adding list of UAC IPs assigned */ |
| 704 | for (int i = 0; i < UAC_MAX_COUNT12; i++) { |
| 705 | tlv_item = proto_tree_add_item(message_subtree3, hf_ubt_dt_uaciplist, tvb, offset, IP_SIZE20, ENC_NA0x00000000); |
| 706 | message_subtree4 = proto_item_add_subtree(tlv_item, ett_ubt_tlv); |
| 707 | proto_item_append_text(tlv_item, "(%d)", i + 1); |
| 708 | |
| 709 | proto_tree_add_item_ret_uint(message_subtree4, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &val); |
| 710 | offset += 2; |
| 711 | |
| 712 | switch (val) { |
| 713 | |
| 714 | case TYPE_IPV60x0a: |
| 715 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 716 | offset += 2; |
| 717 | proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv6, tvb, offset, IPv6_ADDR_SIZE16, ENC_NA0x00000000); |
| 718 | offset += IPv6_ADDR_SIZE16; |
| 719 | break; |
| 720 | |
| 721 | case TYPE_IPV40x02: |
| 722 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 723 | offset += 2; |
| 724 | proto_tree_add_item(message_subtree4, hf_ubt_dt_uacipv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 725 | offset += 4; |
| 726 | proto_tree_add_item(message_subtree4, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA0x00000000); |
| 727 | offset += 12; |
| 728 | break; |
| 729 | |
| 730 | case TYPE_NOT_ASSIGNED0x0: |
| 731 | proto_tree_add_item(message_subtree4, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE20 - 2, ENC_NA0x00000000); |
| 732 | offset += IP_SIZE20 - 2; |
| 733 | break; |
| 734 | |
| 735 | default: |
| 736 | proto_tree_add_expert_format(message_subtree4, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE20 - 2, "Invalid IP Type"); |
| 737 | offset += IP_SIZE20 - 2; |
| 738 | |
| 739 | } |
| 740 | } |
| 741 | break; |
| 742 | |
| 743 | case Status:/* Type 15: Status */ |
| 744 | |
| 745 | /* adding Status as proto_item to the tree */ |
| 746 | proto_tree_add_item_ret_boolean(message_subtree2, hf_ubt_dt_status, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &bool_val); |
| 747 | proto_item_append_text(tlv, ": %u(%s)", bool_val, bool_val ? "Success" : "Failure"); |
| 748 | col_append_fstr(pinfo->cinfo, COL_INFO, " status:%02d(%s)", bool_val, bool_val ? "Success" : "Failure"); |
| 749 | offset += optlen; |
| 750 | break; |
| 751 | |
| 752 | case MCASTKey:/* Type 16: MCAST Key */ |
| 753 | |
| 754 | /* adding MCAST key as proto_item to the tree */ |
| 755 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_mcastkey, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 756 | proto_item_append_text(tlv, ": %#x(%u)", val, val); |
| 757 | |
| 758 | /* appending to info column */ |
| 759 | col_append_fstr(pinfo->cinfo, COL_INFO, " mcastkey:%u", val); |
| 760 | offset += optlen; |
| 761 | break; |
| 762 | |
| 763 | case ServerIP:/* Type 17: Server IP Address */ |
| 764 | |
| 765 | /* adding Server IP Address as proto_item to the tree */ |
| 766 | |
| 767 | proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_ip_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &val); |
| 768 | offset += 2; |
| 769 | |
| 770 | switch (val) { |
| 771 | |
| 772 | case TYPE_IPV60x0a: |
| 773 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 774 | offset += 2; |
| 775 | proto_tree_add_item(message_subtree2, hf_ubt_dt_serveripv6, tvb, offset, IPv6_ADDR_SIZE16, ENC_NA0x00000000); |
| 776 | offset += IPv6_ADDR_SIZE16; |
| 777 | break; |
| 778 | |
| 779 | case TYPE_IPV40x02: |
| 780 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 2, ENC_NA0x00000000); |
| 781 | offset += 2; |
| 782 | proto_tree_add_item(message_subtree2, hf_ubt_dt_serveripv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 783 | offset += 4; |
| 784 | proto_tree_add_item(message_subtree2, hf_ubt_ip_padding, tvb, offset, 12, ENC_NA0x00000000); |
| 785 | offset += 12; |
| 786 | break; |
| 787 | |
| 788 | case TYPE_NOT_ASSIGNED0x0: |
| 789 | proto_tree_add_item(message_subtree2, hf_ubt_ip_unassigned, tvb, offset, IP_SIZE20 - 2, ENC_NA0x00000000); |
| 790 | offset += IP_SIZE20 - 2; |
| 791 | break; |
| 792 | |
| 793 | default: |
| 794 | proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, IP_SIZE20 - 2, "Invalid IP Type"); |
| 795 | offset += IP_SIZE20 - 2; |
| 796 | |
| 797 | } |
| 798 | break; |
| 799 | |
| 800 | case UserAuthMethod:/* Type 18: User Authentication method */ |
| 801 | |
| 802 | /* adding User Authentication method as proto_item to the tree */ |
| 803 | tlv_item = proto_tree_add_item_ret_uint(message_subtree2, hf_ubt_dt_userauthmethod, tvb, offset, optlen, ENC_BIG_ENDIAN0x00000000, &val); |
| 804 | proto_item_append_text(tlv, ": %u(%s)", val, val_to_str(pinfo->pool, val, ubt_authmethod_vals, "Unknown Type (%02d)")); |
| 805 | proto_item_append_text(tlv_item, "(%s)", val_to_str(pinfo->pool, val, ubt_authmethod_vals, "Unknown Type (%02d)")); |
| 806 | offset += optlen; |
| 807 | break; |
| 808 | |
| 809 | case Username:/* Type 19: Username */ |
| 810 | |
| 811 | /* adding username as proto_item to the tree */ |
| 812 | proto_tree_add_item(message_subtree2, hf_ubt_dt_username, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 813 | proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII0x00000000)); |
| 814 | offset += optlen; |
| 815 | break; |
| 816 | |
| 817 | case UserPortName:/* Type 20: User Port name */ |
| 818 | |
| 819 | /* adding user port name as proto_item to the tree */ |
| 820 | proto_tree_add_item(message_subtree2, hf_ubt_dt_userportname, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 821 | proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII0x00000000)); |
| 822 | offset += optlen; |
| 823 | break; |
| 824 | |
| 825 | case SwitchName:/* Type 21: Switch Name */ |
| 826 | |
| 827 | /* adding Switch name as proto_item to the tree */ |
| 828 | proto_tree_add_item(message_subtree2, hf_ubt_dt_switchname, tvb, offset, optlen, ENC_ASCII0x00000000); |
| 829 | proto_item_append_text(tlv, ": %s", tvb_get_string_enc(pinfo->pool, tvb, offset, optlen, ENC_ASCII0x00000000)); |
| 830 | offset += optlen; |
| 831 | break; |
| 832 | |
| 833 | case SilentClientVLANs:/* Type 22: Silent Client VLANs */ |
| 834 | |
| 835 | /* adding Silent Client VLANs as proto_item to the tree */ |
| 836 | tlv_item = proto_tree_add_item(message_subtree2, hf_ubt_dt_silentclientvlans, tvb, offset, optlen, ENC_NA0x00000000); |
| 837 | message_subtree3 = proto_item_add_subtree(tlv_item, ett_ubt_tlv); |
| 838 | if (optlen >= 2) |
| 839 | proto_item_append_text(tlv, ": %u", tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN0x00000000)); |
| 840 | |
| 841 | /* adding each silent client VLAN assigned */ |
| 842 | for (unsigned i = 0; i < optlen / 2; i++) { |
| 843 | proto_tree_add_item(message_subtree3, hf_ubt_dt_silentclientvlan, tvb, offset, 2, ENC_NA0x00000000); |
| 844 | offset += 2; |
| 845 | } |
| 846 | break; |
| 847 | |
| 848 | case MaxMsgs:/* Type 23: Maximum Messages */ |
| 849 | |
| 850 | /* adding Max Msgs as proto_item to the tree */ |
| 851 | proto_tree_add_item(message_subtree2, hf_ubt_dt_maxmsgs, tvb, offset, optlen, ENC_NA0x00000000); |
| 852 | offset += optlen; |
| 853 | break; |
| 854 | |
| 855 | default: |
| 856 | proto_tree_add_expert_format(message_subtree2, pinfo, &ei_ubt_unknown, tvb, offset, optlen, "Unknown"); |
| 857 | offset += optlen; |
| 858 | } |
| 859 | /* Some values are decoded with a fixed size; go on after the TLV */ |
| 860 | offset = tlv_end; |
| 861 | } |
| 862 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
| 863 | call_data_dissector(next_tvb, pinfo, tree); |
| 864 | return tvb_captured_length(tvb); |
| 865 | } |
| 866 | |
| 867 | /* function to register the protocol & hf values used */ |
| 868 | void |
| 869 | proto_register_ubt(void) |
| 870 | { |
| 871 | |
| 872 | /* hf array to store datatypes of different fields */ |
| 873 | static hf_register_info hf[] = { |
| 874 | |
| 875 | { &hf_ubt_packet_len,/* length of packet/buffer */ |
| 876 | { "Packet Length", "ubt.packet_len", |
| 877 | FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, |
| 878 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 879 | }, |
| 880 | |
| 881 | { &hf_ubt_tlv_header,/* header for TLV */ |
| 882 | { "Type-Length-Value", "ubt.tlv_header", |
| 883 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 884 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 885 | }, |
| 886 | |
| 887 | { &hf_ubt_tlv,/* for each TLV */ |
| 888 | { "TLV", "ubt.tlv", |
| 889 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 890 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 891 | }, |
| 892 | |
| 893 | { &hf_ubt_type,/* type of each TLV */ |
| 894 | { "Type", "ubt.tlv_type", |
| 895 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 896 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 897 | }, |
| 898 | |
| 899 | { &hf_ubt_length,/* length of each TLV */ |
| 900 | { "Length", "ubt.tlv_length", |
| 901 | FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, |
| 902 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 903 | }, |
| 904 | |
| 905 | { &hf_ubt_switch_macaddr,/* MAC address of Switch */ |
| 906 | { "Switch MAC Address", "ubt.switch.mac_addr", |
| 907 | FT_ETHER, BASE_NONE, NULL((void*)0), 0x0, |
| 908 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 909 | }, |
| 910 | |
| 911 | { &hf_ubt_switch_seqno,/* sequence number of Switch */ |
| 912 | { "Switch Sequence Number", "ubt.switch.seq_number", |
| 913 | FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, |
| 914 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 915 | }, |
| 916 | |
| 917 | { &hf_ubt_msg_type,/* type of UBT message */ |
| 918 | { "Message Type", "ubt.msg_type", |
| 919 | FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, |
| 920 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 921 | }, |
| 922 | |
| 923 | { &hf_ubt_dt_unknown,/* Unknown data type */ |
| 924 | { "Unknown Datatype", "ubt.unknown_datatype", |
| 925 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 926 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 927 | }, |
| 928 | |
| 929 | { &hf_ubt_dt_grekey,/* GRE key */ |
| 930 | { "GRE Key", "ubt.gre_key", |
| 931 | FT_UINT16, BASE_HEX_DEC, NULL((void*)0), 0x0, |
| 932 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 933 | }, |
| 934 | |
| 935 | { &hf_ubt_dt_firmwareversion,/* version of the firmware */ |
| 936 | { "Firmware Version", "ubt.firmware_version", |
| 937 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 938 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 939 | }, |
| 940 | |
| 941 | { &hf_ubt_dt_userkey,/* userkey */ |
| 942 | { "User Key", "ubt.user_key", |
| 943 | FT_UINT16, BASE_HEX_DEC, NULL((void*)0), 0x0, |
| 944 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 945 | }, |
| 946 | |
| 947 | { &hf_ubt_dt_sacmode,/* mode of SAC */ |
| 948 | { "SAC Mode", "ubt.sac_mode", |
| 949 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 950 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 951 | }, |
| 952 | |
| 953 | { &hf_ubt_dt_sacipv4,/* IPv4 address of SAC */ |
| 954 | { "SAC IP Address (IPv4)", "ubt.sac_ipv4", |
| 955 | FT_IPv4, BASE_NONE, NULL((void*)0), 0x0, |
| 956 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 957 | }, |
| 958 | |
| 959 | { &hf_ubt_dt_sacipv6,/* IPv6 address of SAC */ |
| 960 | { "SAC IP Address (IPv6)", "ubt.sac_ipv6", |
| 961 | FT_IPv6, BASE_NONE, NULL((void*)0), 0x0, |
| 962 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 963 | }, |
| 964 | |
| 965 | { &hf_ubt_dt_heartbeattimeout,/* heartbeat timeout in secs */ |
| 966 | { "Heartbeat Timeout", "ubt.heartbeat_timeout", |
| 967 | FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, |
| 968 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 969 | }, |
| 970 | |
| 971 | { &hf_ubt_dt_usermac,/* MAC address of User */ |
| 972 | { "User MAC Address", "ubt.user_macaddress", |
| 973 | FT_ETHER, BASE_NONE, NULL((void*)0), 0x0, |
| 974 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 975 | }, |
| 976 | |
| 977 | { &hf_ubt_dt_uservlan,/* VLAN assigned to user */ |
| 978 | { "User VLAN", "ubt.user_vlan", |
| 979 | FT_UINT16, BASE_HEX_DEC, NULL((void*)0), 0x0, |
| 980 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 981 | }, |
| 982 | |
| 983 | { &hf_ubt_ip_type,/* IP type */ |
| 984 | { "IP Type", "ubt.ip_type", |
| 985 | FT_UINT16, BASE_HEX, VALS(ubt_iptype_vals)((0 ? (const struct _value_string*)0 : ((ubt_iptype_vals)))), 0x0, |
| 986 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 987 | }, |
| 988 | |
| 989 | { &hf_ubt_ip_padding,/* IP Padding */ |
| 990 | { "IP Padding", "ubt.ip_padding", |
| 991 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 992 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 993 | }, |
| 994 | |
| 995 | { &hf_ubt_ip_unassigned,/* IP Padding */ |
| 996 | { "IP Unassigned", "ubt.ip_unassigned", |
| 997 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 998 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 999 | }, |
| 1000 | |
| 1001 | { &hf_ubt_dt_flags,/* Flags, both switch & user */ |
| 1002 | { "Flags", "ubt.flags", |
| 1003 | FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, |
| 1004 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1005 | }, |
| 1006 | |
| 1007 | { &hf_ubt_switch_flags_bcmctoucast,/* switch flag: BCMC to UCAST? */ |
| 1008 | { "SB_FLAGS_CONV_BCMC_TO_UCAST", "ubt.flags.switch.bcmctoucast", |
| 1009 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x01, |
| 1010 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1011 | }, |
| 1012 | { &hf_ubt_user_flags_tag,/* user flag: Tagged? */ |
| 1013 | { "UB_FLAGS_TAGGED", "ubt.flags.user.tag", |
| 1014 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x01, |
| 1015 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1016 | }, |
| 1017 | { &hf_ubt_user_flags_auth,/* user flag: Authenticated? */ |
| 1018 | { "UB_FLAGS_IS_AUTHENTICATED", "ubt.flags.user.auth", |
| 1019 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x02, |
| 1020 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1021 | }, |
| 1022 | { &hf_ubt_user_flags_bcmctoucast,/* user flag: BCMC to UCAST? */ |
| 1023 | { "UB_FLAGS_CONV_BCMC_TO_UCAST", "ubt.flags.user.bcmctoucast", |
| 1024 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x04, |
| 1025 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1026 | }, |
| 1027 | { &hf_ubt_user_flags_dormant,/* user flag: Dormant? */ |
| 1028 | { "UB_FLAGS_DORMANT", "ubt.flags.user.dormant", |
| 1029 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x08, |
| 1030 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1031 | }, |
| 1032 | { &hf_ubt_user_flags_uback,/* user flag: UB ACK sent? */ |
| 1033 | { "UB_FLAGS_IS_UB_ACK_SENT", "ubt.flags.user.uback", |
| 1034 | FT_BOOLEAN, 8, TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), 0x10, |
| 1035 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1036 | }, |
| 1037 | |
| 1038 | { &hf_ubt_dt_tunnelmtu,/* Tunnel MTU */ |
| 1039 | { "Tunnel MTU", "ubt.tunnel_mtu", |
| 1040 | FT_UINT16, BASE_HEX_DEC, NULL((void*)0), 0x0, |
| 1041 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1042 | }, |
| 1043 | |
| 1044 | { &hf_ubt_dt_userrole,/* role of user */ |
| 1045 | { "User Role", "ubt.user_role", |
| 1046 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1047 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1048 | }, |
| 1049 | |
| 1050 | { &hf_ubt_dt_reasoncode,/* reason code */ |
| 1051 | { "Reason Code", "ubt.reason_code", |
| 1052 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 1053 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1054 | }, |
| 1055 | |
| 1056 | { &hf_ubt_dt_nodelist,/* nodelist header */ |
| 1057 | { "Node List", "ubt.node_list", |
| 1058 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 1059 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1060 | }, |
| 1061 | |
| 1062 | { &hf_ubt_dt_clustername,/* name of the cluster */ |
| 1063 | { "Cluster Name", "ubt.node_list.cluster_name", |
| 1064 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1065 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1066 | }, |
| 1067 | |
| 1068 | { &hf_ubt_dt_clusterenabled,/* if cluster enabled or not */ |
| 1069 | { "Cluster Enabled", "ubt.node_list.cluster_enabled", |
| 1070 | FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0, |
| 1071 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1072 | }, |
| 1073 | |
| 1074 | { &hf_ubt_dt_ssacindex,/* index of SSAC */ |
| 1075 | { "SSAC Index", "ubt.node_list.ssac_index", |
| 1076 | FT_INT8, BASE_DEC, NULL((void*)0), 0x0, |
| 1077 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1078 | }, |
| 1079 | |
| 1080 | { &hf_ubt_dt_reserved,/* no of reserved */ |
| 1081 | { "Reserved", "ubt.node_list.reserved", |
| 1082 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 1083 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1084 | }, |
| 1085 | |
| 1086 | { &hf_ubt_dt_uaccount,/* no of UACs assigned */ |
| 1087 | { "UAC Count", "ubt.uac_count", |
| 1088 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 1089 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1090 | }, |
| 1091 | |
| 1092 | { &hf_ubt_dt_uaciplist,/* IP addresses of each UAC */ |
| 1093 | { "UAC IP", "ubt.uac_ip_list", |
| 1094 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 1095 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1096 | }, |
| 1097 | |
| 1098 | { &hf_ubt_dt_uacipv4,/* IPv4 address of UAC */ |
| 1099 | { "UAC IP Address (IPv4)", "ubt.uac_ipv4", |
| 1100 | FT_IPv4, BASE_NONE, NULL((void*)0), 0x0, |
| 1101 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1102 | }, |
| 1103 | |
| 1104 | { &hf_ubt_dt_uacipv6,/* IPv6 address of UAC */ |
| 1105 | { "UAC IP Address (IPv6)", "ubt.uac_ipv6", |
| 1106 | FT_IPv6, BASE_NONE, NULL((void*)0), 0x0, |
| 1107 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1108 | }, |
| 1109 | |
| 1110 | { &hf_ubt_dt_bucketmap,/* bucketmap header */ |
| 1111 | { "Bucket Map", "ubt.bucket_map", |
| 1112 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 1113 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1114 | }, |
| 1115 | |
| 1116 | { &hf_ubt_dt_timestamp,/* timestamp */ |
| 1117 | { "Timestamp", "ubt.bucket_map.time_stamp", |
| 1118 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1119 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1120 | }, |
| 1121 | |
| 1122 | { &hf_ubt_dt_identifier,/* identifier string */ |
| 1123 | { "Identifier", "ubt.bucket_map.identifier", |
| 1124 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1125 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1126 | }, |
| 1127 | |
| 1128 | /* arrays to hold active maps */ |
| 1129 | { &hf_ubt_dt_activemap1,/* array 1 */ |
| 1130 | { "Active Map[0-31]", "ubt.bucket_map.active_map_0-031", |
| 1131 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1132 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1133 | }, |
| 1134 | { &hf_ubt_dt_activemap2,/* array 2 */ |
| 1135 | { "Active Map[32-63]", "ubt.bucket_map.active_map_032-063", |
| 1136 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1137 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1138 | }, |
| 1139 | { &hf_ubt_dt_activemap3,/* array 3 */ |
| 1140 | { "Active Map[64-95]", "ubt.bucket_map.active_map_064-095", |
| 1141 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1142 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1143 | }, |
| 1144 | { &hf_ubt_dt_activemap4,/* array 4 */ |
| 1145 | { "Active Map[96-127]", "ubt.bucket_map.active_map_096-127", |
| 1146 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1147 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1148 | }, |
| 1149 | { &hf_ubt_dt_activemap5,/* array 5 */ |
| 1150 | { "Active Map[128-159]", "ubt.bucket_map.active_map_128-159", |
| 1151 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1152 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1153 | }, |
| 1154 | { &hf_ubt_dt_activemap6,/* array 6 */ |
| 1155 | { "Active Map[160-191]", "ubt.bucket_map.active_map_160-191", |
| 1156 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1157 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1158 | }, |
| 1159 | { &hf_ubt_dt_activemap7,/* array 7 */ |
| 1160 | { "Active Map[192-223]", "ubt.bucket_map.active_map_192-223", |
| 1161 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1162 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1163 | }, |
| 1164 | { &hf_ubt_dt_activemap8,/* array 8 */ |
| 1165 | { "Active Map[224-255]", "ubt.bucket_map.active_map_224-255", |
| 1166 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1167 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1168 | }, |
| 1169 | |
| 1170 | /* arrays to hold standby maps */ |
| 1171 | { &hf_ubt_dt_standbymap1,/* array 1 */ |
| 1172 | { "Standby Map[0-31]", "ubt.bucket_map.standby_map_0-031", |
| 1173 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1174 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1175 | }, |
| 1176 | { &hf_ubt_dt_standbymap2,/* array 2 */ |
| 1177 | { "Standby Map[32-63]", "ubt.bucket_map.standby_map_032-063", |
| 1178 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1179 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1180 | }, |
| 1181 | { &hf_ubt_dt_standbymap3,/* array 3 */ |
| 1182 | { "Standby Map[64-95]", "ubt.bucket_map.standby_map_064-095", |
| 1183 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1184 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1185 | }, |
| 1186 | { &hf_ubt_dt_standbymap4,/* array 4 */ |
| 1187 | { "Standby Map[96-127]", "ubt.bucket_map.standby_map_096-127", |
| 1188 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1189 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1190 | }, |
| 1191 | { &hf_ubt_dt_standbymap5,/* array 5 */ |
| 1192 | { "Standby Map[128-159]", "ubt.bucket_map.standby_map_128-159", |
| 1193 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1194 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1195 | }, |
| 1196 | { &hf_ubt_dt_standbymap6,/* array 6 */ |
| 1197 | { "Standby Map[160-191]", "ubt.bucket_map.standby_map_160-191", |
| 1198 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1199 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1200 | }, |
| 1201 | { &hf_ubt_dt_standbymap7,/* array 7 */ |
| 1202 | { "Standby Map[192-223]", "ubt.bucket_map.standby_map_192-223", |
| 1203 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1204 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1205 | }, |
| 1206 | { &hf_ubt_dt_standbymap8,/* array 8 */ |
| 1207 | { "Standby Map[224-255]", "ubt.bucket_map.standby_map_224-255", |
| 1208 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1209 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1210 | }, |
| 1211 | |
| 1212 | /* arrays to hold l2conn */ |
| 1213 | { &hf_ubt_dt_l2conn1,/* array 1 */ |
| 1214 | { "L2Connect[0-31]", "ubt.bucket_map.l2conn_0-031", |
| 1215 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1216 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1217 | }, |
| 1218 | { &hf_ubt_dt_l2conn2,/* array 2 */ |
| 1219 | { "L2Connect[32-63]", "ubt.bucket_map.l2conn_032-063", |
| 1220 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1221 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1222 | }, |
| 1223 | { &hf_ubt_dt_l2conn3,/* array 3 */ |
| 1224 | { "L2Connect[64-95]", "ubt.bucket_map.l2conn_064-095", |
| 1225 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1226 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1227 | }, |
| 1228 | { &hf_ubt_dt_l2conn4,/* array 4 */ |
| 1229 | { "L2Connect[96-127]", "ubt.bucket_map.l2conn_096-127", |
| 1230 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1231 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1232 | }, |
| 1233 | { &hf_ubt_dt_l2conn5,/* array 5 */ |
| 1234 | { "L2Connect[128-159]", "ubt.bucket_map.l2conn_128-159", |
| 1235 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1236 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1237 | }, |
| 1238 | { &hf_ubt_dt_l2conn6,/* array 6 */ |
| 1239 | { "L2Connect[160-191]", "ubt.bucket_map.l2conn_160-191", |
| 1240 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1241 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1242 | }, |
| 1243 | { &hf_ubt_dt_l2conn7,/* array 7 */ |
| 1244 | { "L2Connect[192-223]", "ubt.bucket_map.l2conn_192-223", |
| 1245 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1246 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1247 | }, |
| 1248 | { &hf_ubt_dt_l2conn8,/* array 8 */ |
| 1249 | { "L2Connect[224-255]", "ubt.bucket_map.l2conn_224-255", |
| 1250 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1251 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1252 | }, |
| 1253 | |
| 1254 | |
| 1255 | { &hf_ubt_dt_status,/* status of message */ |
| 1256 | { "Status", "ubt.status", |
| 1257 | FT_BOOLEAN, BASE_NONE, TFS(&tfs_success_fail)((0 ? (const struct true_false_string*)0 : ((&tfs_success_fail )))), 0x0, |
| 1258 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1259 | }, |
| 1260 | |
| 1261 | { &hf_ubt_dt_mcastkey,/* MCAST key used */ |
| 1262 | { "MCAST Key", "ubt.mcast_key", |
| 1263 | FT_UINT16, BASE_HEX_DEC, NULL((void*)0), 0x0, |
| 1264 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1265 | }, |
| 1266 | |
| 1267 | { &hf_ubt_dt_serveripv4,/* IPv4 address of server */ |
| 1268 | { "Server IP Address (IPv4)", "ubt.server_ipaddressv4", |
| 1269 | FT_IPv4, BASE_NONE, NULL((void*)0), 0x0, |
| 1270 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1271 | }, |
| 1272 | |
| 1273 | { &hf_ubt_dt_serveripv6,/* IPv6 address of server */ |
| 1274 | { "Server IP Address (IPv6)", "ubt.server_ipaddressv6", |
| 1275 | FT_IPv6, BASE_NONE, NULL((void*)0), 0x0, |
| 1276 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1277 | }, |
| 1278 | |
| 1279 | { &hf_ubt_dt_userauthmethod,/* user authentication method used */ |
| 1280 | { "User Auth Method", "ubt.user_authmethod", |
| 1281 | FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 1282 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1283 | }, |
| 1284 | |
| 1285 | { &hf_ubt_dt_username,/* username */ |
| 1286 | { "Username", "ubt.username", |
| 1287 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1288 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1289 | }, |
| 1290 | |
| 1291 | { &hf_ubt_dt_userportname,/* Port name of the user */ |
| 1292 | { "User Port Name", "ubt.user_portname", |
| 1293 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1294 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1295 | }, |
| 1296 | |
| 1297 | { &hf_ubt_dt_switchname,/* name of the switch */ |
| 1298 | { "Switch Name", "ubt.switch_name", |
| 1299 | FT_STRING, BASE_NONE, NULL((void*)0), 0x0, |
| 1300 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1301 | }, |
| 1302 | |
| 1303 | { &hf_ubt_dt_silentclientvlans,/* Silent Client VLANs header */ |
| 1304 | { "Silent Client VLANs", "ubt.silent_client_vlans", |
| 1305 | FT_NONE, BASE_NONE, NULL((void*)0), 0x0, |
| 1306 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1307 | }, |
| 1308 | |
| 1309 | { &hf_ubt_dt_silentclientvlan,/* each silent client VLAN assigned */ |
| 1310 | { "Silent Client VLAN", "ubt.silent_client_vlan", |
| 1311 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1312 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1313 | }, |
| 1314 | |
| 1315 | { &hf_ubt_dt_maxmsgs,/* maximum messages allowed */ |
| 1316 | { "Max Messages", "ubt.max_msgs", |
| 1317 | FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, |
| 1318 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } |
| 1319 | } |
| 1320 | |
| 1321 | }; |
| 1322 | |
| 1323 | /* Setup protocol subtree array */ |
| 1324 | static int* ett[] = { |
| 1325 | &ett_ubt, |
| 1326 | &ett_ubt_tlv, |
| 1327 | &ett_ubt_flags |
| 1328 | }; |
| 1329 | |
| 1330 | static ei_register_info ei[] = { |
| 1331 | { &ei_ubt_unknown, {"ubt.unknown", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Unknown", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}}}}, |
| 1332 | }; |
| 1333 | |
| 1334 | /* registering protocol with proto_register_protocol() function */ |
| 1335 | proto_ubt = proto_register_protocol("Aruba UBT", "UBT", "ubt"); |
| 1336 | |
| 1337 | /* registering field array */ |
| 1338 | proto_register_field_array(proto_ubt, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0])); |
| 1339 | |
| 1340 | /* registering subtree array */ |
| 1341 | proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0])); |
| 1342 | |
| 1343 | expert_module_t* expert_ubt; |
| 1344 | |
| 1345 | /* registering UBT protocol with expert info */ |
| 1346 | expert_ubt = expert_register_protocol(proto_ubt); |
| 1347 | |
| 1348 | /* registering expert field array for UBT */ |
| 1349 | expert_register_field_array(expert_ubt, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0])); |
| 1350 | |
| 1351 | /* handling proto_ubt & dissector function using handle */ |
| 1352 | ubt_handle = register_dissector("ubt", dissect_ubt, proto_ubt); |
| 1353 | } |
| 1354 | |
| 1355 | void |
| 1356 | proto_reg_handoff_ubt(void) |
| 1357 | { |
| 1358 | /* adding port numbers to the handle */ |
| 1359 | dissector_add_uint("papi.port", PORT_UBT15560, ubt_handle); |
| 1360 | } |
| 1361 | /* |
| 1362 | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
| 1363 | * |
| 1364 | * Local variables: |
| 1365 | * c-basic-offset: 4 |
| 1366 | * tab-width: 8 |
| 1367 | * indent-tabs-mode: nil |
| 1368 | * End: |
| 1369 | * |
| 1370 | * vi: set shiftwidth=4 tabstop=8 expandtab: |
| 1371 | * :indentSize=4:tabSize=8:noTabs=true: |
| 1372 | */ |