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