1 /* packet-reload.c
2 * Routines for REsource LOcation And Discovery (RELOAD) Base Protocol
3 * Author: Stephane Bryant <sbryant@glycon.org>
4 * Copyright 2010 Stonyfish Inc.
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 *
12 * Please refer to the following specs for protocol detail:
13 * - RFC 6940
14 * - RFC 7904
15 * - RFC 7374
16 * - RFC 7363
17 * - RFC 7851
18 * - RFC 7263
19 */
20
21 #include "config.h"
22
23 #include <epan/packet.h>
24 #include <epan/conversation.h>
25 #include <epan/reassemble.h>
26 #include <epan/asn1.h>
27 #include <epan/uat.h>
28 #include <epan/to_str.h>
29 #include "packet-x509af.h"
30 #include "packet-tls-utils.h"
31 #include "packet-reload.h"
32
33 void proto_register_reload(void);
34 void proto_reg_handoff_reload(void);
35
36 /* Initialize the protocol and registered fields */
37 static int proto_reload = -1;
38
39
40 static int hf_reload_response_in = -1;
41 static int hf_reload_response_to = -1;
42 static int hf_reload_time = -1;
43 static int hf_reload_duplicate = -1;
44 static int hf_reload_token = -1;
45 static int hf_reload_forwarding = -1;
46 static int hf_reload_overlay = -1;
47 static int hf_reload_configuration_sequence = -1;
48 static int hf_reload_version = -1;
49 static int hf_reload_ttl = -1;
50 static int hf_reload_fragment_flag = -1;
51 static int hf_reload_fragment_fragmented = -1;
52 static int hf_reload_fragment_last_fragment = -1;
53 static int hf_reload_fragment_reserved = -1;
54 static int hf_reload_fragment_offset = -1;
55 static int hf_reload_trans_id = -1;
56 static int hf_reload_max_response_length = -1;
57 static int hf_reload_via_list_length = -1;
58 static int hf_reload_destination_list_length = -1;
59 static int hf_reload_options_length = -1;
60 static int hf_reload_via_list = -1;
61 static int hf_reload_destination = -1;
62 static int hf_reload_destination_compressed_id = -1;
63 static int hf_reload_destination_type = -1;
64 static int hf_reload_nodeid = -1;
65 static int hf_reload_resourceid = -1;
66 static int hf_reload_value = -1;
67 static int hf_reload_destination_data_node_id = -1;
68 static int hf_reload_destination_data_resource_id = -1;
69 static int hf_reload_destination_data_compressed_id = -1;
70 static int hf_reload_destination_list = -1;
71 static int hf_reload_forwarding_options = -1;
72 static int hf_reload_forwarding_option = -1;
73 static int hf_reload_forwarding_option_type = -1;
74 static int hf_reload_forwarding_option_flags = -1;
75 static int hf_reload_forwarding_option_flag_response_copy = -1;
76 static int hf_reload_forwarding_option_flag_destination_critical = -1;
77 static int hf_reload_forwarding_option_flag_forward_critical = -1;
78 static int hf_reload_forwarding_option_flag_ignore_state_keeping = -1;
79 static int hf_reload_attachreqans = -1;
80 static int hf_reload_ufrag = -1;
81 static int hf_reload_password = -1;
82 static int hf_reload_role = -1;
83 static int hf_reload_sendupdate = -1;
84 static int hf_reload_icecandidates = -1;
85 static int hf_reload_icecandidate = -1;
86 static int hf_reload_icecandidate_addr_port = -1;
87 static int hf_reload_icecandidate_relay_addr = -1;
88 static int hf_reload_icecandidate_foundation = -1;
89 static int hf_reload_icecandidate_priority = -1;
90 static int hf_reload_icecandidate_type = -1;
91 static int hf_reload_overlaylink_type = -1;
92 static int hf_reload_iceextension = -1;
93 static int hf_reload_iceextensions = -1;
94 static int hf_reload_iceextension_name = -1;
95 static int hf_reload_iceextension_value = -1;
96 static int hf_reload_ipaddressport = -1;
97 static int hf_reload_ipaddressport_type = -1;
98 static int hf_reload_ipv4addrport = -1;
99 static int hf_reload_ipv4addr = -1;
100 static int hf_reload_port = -1;
101 static int hf_reload_ipv6addrport = -1;
102 static int hf_reload_ipv6addr = -1;
103 static int hf_reload_message_contents = -1;
104 static int hf_reload_message_code = -1;
105 static int hf_reload_message_body = -1;
106 static int hf_reload_message_extensions = -1;
107 static int hf_reload_message_extension = -1;
108 static int hf_reload_message_extension_type = -1;
109 static int hf_reload_message_extension_critical = -1;
110 static int hf_reload_message_extension_content = -1;
111 static int hf_reload_error_response = -1;
112 static int hf_reload_error_response_code = -1;
113 static int hf_reload_error_response_info = -1;
114 static int hf_reload_security_block = -1;
115 static int hf_reload_certificates = -1;
116 static int hf_reload_genericcertificate = -1;
117 static int hf_reload_certificate_type = -1;
118 static int hf_reload_certificate = -1;
119 static int hf_reload_signature = -1;
120 static int hf_reload_signatureandhashalgorithm = -1;
121 static int hf_reload_hash_algorithm = -1;
122 static int hf_reload_signature_algorithm = -1;
123 static int hf_reload_signeridentity = -1;
124 static int hf_reload_signeridentity_type = -1;
125 static int hf_reload_signeridentity_identity = -1;
126 static int hf_reload_signeridentity_value = -1;
127 static int hf_reload_signeridentity_value_hash_alg = -1;
128 static int hf_reload_signeridentity_value_certificate_hash = -1;
129 static int hf_reload_signeridentity_value_certificate_node_id_hash = -1;
130 static int hf_reload_signature_value = -1;
131 static int hf_reload_length_uint8 = -1;
132 static int hf_reload_length_uint16 = -1;
133 static int hf_reload_length_uint24 = -1;
134 static int hf_reload_length_uint32 = -1;
135 static int hf_reload_opaque = -1;
136 static int hf_reload_opaque_data = -1;
137 static int hf_reload_opaque_string = -1;
138 static int hf_reload_routequeryreq = -1;
139 static int hf_reload_routequeryreq_destination = -1;
140 static int hf_reload_overlay_specific = -1;
141 static int hf_reload_probereq = -1;
142 static int hf_reload_probereq_requested_info = -1;
143 static int hf_reload_probe_information_type = -1;
144 static int hf_reload_probe_information = -1;
145 static int hf_reload_probe_information_data = -1;
146 static int hf_reload_responsible_set = -1;
147 static int hf_reload_num_resources = -1;
148 static int hf_reload_uptime = -1;
149 static int hf_reload_probeans = -1;
150 static int hf_reload_probeans_probe_info = -1;
151 static int hf_reload_appattachreq = -1;
152 static int hf_reload_appattachans = -1;
153 static int hf_reload_application = -1;
154 static int hf_reload_pingreq = -1;
155 static int hf_reload_pingans = -1;
156 static int hf_reload_ping_response_id = -1;
157 static int hf_reload_ping_time = -1;
158 static int hf_reload_storeddata = -1;
159 static int hf_reload_storedmetadata = -1;
160 static int hf_reload_storeddata_storage_time = -1;
161 static int hf_reload_storeddata_lifetime = -1;
162 static int hf_reload_datavalue = -1;
163 static int hf_reload_metadata = -1;
164 static int hf_reload_datavalue_exists = -1;
165 static int hf_reload_datavalue_value = -1;
166 static int hf_reload_metadata_value_length = -1;
167 static int hf_reload_metadata_hash_value = -1;
168 static int hf_reload_arrayentry = -1;
169 static int hf_reload_arrayentry_value = -1;
170 static int hf_reload_arrayentry_index = -1;
171 static int hf_reload_dictionaryentry = -1;
172 static int hf_reload_dictionarykey = -1;
173 static int hf_reload_dictionary_value = -1;
174 static int hf_reload_kinddata = -1;
175 static int hf_reload_findkinddata_closest = -1;
176 static int hf_reload_kinddata_kind = -1;
177 static int hf_reload_statkindresponse = -1;
178 static int hf_reload_kindid = -1;
179 static int hf_reload_kindid_list = -1;
180 static int hf_reload_generation_counter = -1;
181 static int hf_reload_values = -1;
182 static int hf_reload_storereq = -1;
183 static int hf_reload_resource = -1;
184 static int hf_reload_store_replica_num = -1;
185 static int hf_reload_store_kind_data = -1;
186 static int hf_reload_storeans = -1;
187 static int hf_reload_storeans_kind_responses = -1;
188 static int hf_reload_storekindresponse = -1;
189 static int hf_reload_replicas = -1;
190 static int hf_reload_statreq = -1;
191 static int hf_reload_fetchreq = -1;
192 static int hf_reload_fetchreq_specifiers = -1;
193 static int hf_reload_storeddataspecifier = -1;
194 static int hf_reload_storeddataspecifier_indices = -1;
195 static int hf_reload_storeddataspecifier_keys = -1;
196 static int hf_reload_arrayrange = -1;
197 static int hf_reload_fetchans = -1;
198 static int hf_reload_statans = -1;
199 static int hf_reload_findreq = -1;
200 static int hf_reload_findans = -1;
201 static int hf_reload_findkinddata = -1;
202 static int hf_reload_fragments = -1;
203 static int hf_reload_fragment = -1;
204 static int hf_reload_fragment_overlap = -1;
205 static int hf_reload_fragment_overlap_conflict = -1;
206 static int hf_reload_fragment_multiple_tails = -1;
207 static int hf_reload_fragment_too_long_fragment = -1;
208 static int hf_reload_fragment_error = -1;
209 static int hf_reload_fragment_count = -1;
210 static int hf_reload_reassembled_in = -1;
211 static int hf_reload_reassembled_length = -1;
212 static int hf_reload_configupdatereq = -1;
213 static int hf_reload_configupdatereq_type = -1;
214 static int hf_reload_configupdatereq_configdata = -1;
215 static int hf_reload_configupdatereq_kinds = -1;
216 static int hf_reload_kinddescription = -1;
217 static int hf_reload_chordupdate = -1;
218 static int hf_reload_chordupdate_type = -1;
219 static int hf_reload_chordupdate_predecessors = -1;
220 static int hf_reload_chordupdate_successors = -1;
221 static int hf_reload_chordupdate_fingers = -1;
222 static int hf_reload_chordroutequeryans = -1;
223 static int hf_reload_chordroutequeryans_next_peer = -1;
224 static int hf_reload_chordleave = -1;
225 static int hf_reload_chordleave_type = -1;
226 static int hf_reload_chordleave_predecessors = -1;
227 static int hf_reload_chordleave_successors = -1;
228 static int hf_reload_turnserver = -1;
229 static int hf_reload_turnserver_iteration = -1;
230 static int hf_reload_turnserver_server_address = -1;
231 static int hf_reload_sipregistration = -1;
232 static int hf_reload_sipregistration_type = -1;
233 static int hf_reload_sipregistration_data = -1;
234 static int hf_reload_sipregistration_data_uri = -1;
235 static int hf_reload_sipregistration_data_contact_prefs = -1;
236 static int hf_reload_sipregistration_data_destination_list = -1;
237 static int hf_reload_padding = -1;
238 static int hf_reload_redirserviceproviderdata = -1;
239 static int hf_reload_redirserviceproviderdata_serviceprovider = -1;
240 static int hf_reload_redirserviceproviderdata_namespace = -1;
241 static int hf_reload_redirserviceproviderdata_level = -1;
242 static int hf_reload_redirserviceproviderdata_node = -1;
243 static int hf_reload_redirserviceprovider = -1;
244 static int hf_reload_self_tuning_data = -1;
245 static int hf_reload_self_tuning_data_join_rate = -1;
246 static int hf_reload_self_tuning_data_leave_rate = -1;
247 static int hf_reload_self_tuning_data_network_size = -1;
248 static int hf_reload_dmflags = -1;
249 static int hf_reload_dmflag_status_info = -1;
250 static int hf_reload_dmflag_routing_table_size = -1;
251 static int hf_reload_dmflag_process_power = -1;
252 static int hf_reload_dmflag_bandwidth = -1;
253 static int hf_reload_dmflag_software_version = -1;
254 static int hf_reload_dmflag_machine_uptime = -1;
255 static int hf_reload_dmflag_app_uptime = -1;
256 static int hf_reload_dmflag_memory_footprint = -1;
257 static int hf_reload_dmflag_datasize_stored = -1;
258 static int hf_reload_dmflag_instances_stored = -1;
259 static int hf_reload_dmflag_messages_sent_rcvd = -1;
260 static int hf_reload_dmflag_ewma_bytes_sent = -1;
261 static int hf_reload_dmflag_ewma_bytes_rcvd = -1;
262 static int hf_reload_dmflag_underlay_hop = -1;
263 static int hf_reload_dmflag_battery_status = -1;
264 static int hf_reload_diagnosticrequest = -1;
265 static int hf_reload_diagnosticresponse = -1;
266 static int hf_reload_diagnosticextension = -1;
267 static int hf_reload_diagnosticextension_type = -1;
268 static int hf_reload_diagnosticextension_contents = -1;
269 static int hf_reload_diagnostic_expiration = -1;
270 static int hf_reload_diagnosticrequest_timestampinitiated = -1;
271 static int hf_reload_diagnosticrequest_extensions = -1;
272 static int hf_reload_pathtrackreq = -1;
273 static int hf_reload_pathtrackreq_destination = -1;
274 static int hf_reload_pathtrackreq_request = -1;
275 static int hf_reload_diagnosticinfo = -1;
276 static int hf_reload_diagnosticinfo_kind = -1;
277 static int hf_reload_diagnosticinfo_congestion_status = -1;
278 static int hf_reload_diagnosticinfo_number_peers = -1;
279 static int hf_reload_diagnosticinfo_processing_power = -1;
280 static int hf_reload_diagnosticinfo_bandwidth = -1;
281 static int hf_reload_diagnosticinfo_software_version = -1;
282 static int hf_reload_diagnosticinfo_machine_uptime = -1;
283 static int hf_reload_diagnosticinfo_app_uptime = -1;
284 static int hf_reload_diagnosticinfo_memory_footprint = -1;
285 static int hf_reload_diagnosticinfo_datasize_stored = -1;
286 static int hf_reload_diagnosticinfo_instances_stored = -1;
287 static int hf_reload_diagnosticinfo_instancesstored_info = -1;
288 static int hf_reload_diagnosticinfo_instancesstored_instances = -1;
289 static int hf_reload_diagnosticinfo_messages_sent_rcvd = -1;
290 static int hf_reload_diagnosticinfo_messages_sent_rcvd_info = -1;
291 static int hf_reload_diagnosticinfo_message_code = -1;
292 static int hf_reload_diagnosticinfo_messages_sent = -1;
293 static int hf_reload_diagnosticinfo_messages_rcvd = -1;
294 static int hf_reload_diagnosticinfo_ewma_bytes_sent = -1;
295 static int hf_reload_diagnosticinfo_ewma_bytes_rcvd = -1;
296 static int hf_reload_diagnosticinfo_underlay_hops = -1;
297 static int hf_reload_diagnosticinfo_battery_status = -1;
298 static int hf_reload_diagnosticresponse_timestampreceived = -1;
299 static int hf_reload_diagnosticresponse_hopcounter = -1;
300 static int hf_reload_diagnosticresponse_diagnostic_info_list = -1;
301 static int hf_reload_pathtrackans = -1;
302 static int hf_reload_pathtrackans_next_hop = -1;
303 static int hf_reload_pathtrackans_response = -1;
304 static int hf_reload_extensiveroutingmodeoption = -1;
305 static int hf_reload_routemode = -1;
306 static int hf_reload_extensiveroutingmode_transport = -1;
307 static int hf_reload_extensiveroutingmode_ipaddressport = -1;
308 static int hf_reload_extensiveroutingmode_destination = -1;
309 static int hf_reload_joinreq = -1;
310 static int hf_reload_joinreq_joining_peer_id = -1;
311 static int hf_reload_joinans = -1;
312 static int hf_reload_leavereq = -1;
313 static int hf_reload_leavereq_leaving_peer_id = -1;
314
315 static dissector_handle_t xml_handle;
316
317
318 /* Structure containing transaction specific information */
319 typedef struct _reload_transaction_t {
320 guint32 req_frame;
321 guint32 rep_frame;
322 nstime_t req_time;
323 } reload_transaction_t;
324
325 /* Structure containing conversation specific information */
326 typedef struct _reload_conv_info_t {
327 wmem_tree_t *transaction_pdus;
328 } reload_conv_info_t;
329
330
331 /* RELOAD Message classes = (message_code & 0x1) (response = request +1) */
332 #define RELOAD_REQUEST 0x0001
333 #define RELOAD_RESPONSE 0x0000
334
335 #define RELOAD_ERROR 0xffff
336
337 #define VERSION_DRAFT 0x01
338
339 /* RELOAD Message Methods = (message_code +1) & 0xfffe*/
340 #define METHOD_INVALID 0
341 #define METHOD_PROBE 2
342 #define METHOD_ATTACH 4
343 #define METHOD_STORE 8
344 #define METHOD_FETCH 10
345 #define METHOD_UNUSED_REMOVE 12
346 #define METHOD_FIND 14
347 #define METHOD_JOIN 16
348 #define METHOD_LEAVE 18
349 #define METHOD_UPDATE 20
350 #define METHOD_ROUTEQUERY 22
351 #define METHOD_PING 24
352 #define METHOD_STAT 26
353 #define METHOD_UNUSED_ATTACHLIGHT 28
354 #define METHOD_APPATTACH 30
355 #define METHOD_UNUSED_APP_ATTACHLIGHT 32
356 #define METHOD_CONFIGUPDATE 34
357 #define METHOD_EXP_A 36
358 #define METHOD_EXP_B 38
359 #define METHOD_PATH_TRACK 102
360 #define METHOD_ERROR 0xfffe
361
362
363 /* RELOAD Destinationtype */
364 #define DESTINATIONTYPE_RESERVED 0
365 #define DESTINATIONTYPE_NODE 1
366 #define DESTINATIONTYPE_RESOURCE 2
367 #define DESTINATIONTYPE_COMPRESSED 3
368
369 /* RELOAD forwarding option type */
370 #define OPTIONTYPE_RESERVED 0
371 #define OPTIONTYPE_EXTENSIVE_ROUTING_MODE 2
372
373 /* RELOAD CandTypes */
374 #define CANDTYPE_RESERVED 0
375 #define CANDTYPE_HOST 1
376 #define CANDTYPE_SRFLX 2
377 #define CANDTYPE_PRFLX 3
378 #define CANDTYPE_RELAY 4
379
380 /* IpAddressPort types */
381 #define IPADDRESSPORTTYPE_RESERVED 0
382 #define IPADDRESSPORTTYPE_IPV4 1
383 #define IPADDRESSPORTTYPE_IPV6 2
384
385 /* OverlayLink types */
386 #define OVERLAYLINKTYPE_RESERVED 0
387 #define OVERLAYLINKTYPE_DTLS_UDP_SR 1
388 #define OVERLAYLINKTYPE_DTLS_UDP_SR_NO_ICE 3
389 #define OVERLAYLINKTYPE_TLS_TCP_FH_NO_ICE 4
390 #define OVERLAYLINKTYPE_EXP_LINK 5
391
392 #define ERRORCODE_INVALID 0
393 #define ERRORCODE_UNUSED 1
394 #define ERRORCODE_FORBIDDEN 2
395 #define ERRORCODE_NOTFOUND 3
396 #define ERRORCODE_REQUESTTIMEOUT 4
397 #define ERRORCODE_GENERATIONCOUNTERTOOLOW 5
398 #define ERRORCODE_INCOMPATIBLEWITHOVERLAY 6
399 #define ERRORCODE_UNSUPPORTEDFORWARDINGOPTION 7
400 #define ERRORCODE_DATATOOLARGE 8
401 #define ERRORCODE_DATATOOOLD 9
402 #define ERRORCODE_TTLEXCEEDED 10
403 #define ERRORCODE_MESSAGETOOLARGE 11
404 #define ERRORCODE_UNKNOWNKIND 12
405 #define ERRORCODE_UNKNOWNEXTENSION 13
406 #define ERRORCODE_RESPONSETOOLARGE 14
407 #define ERRORCODE_CONFIGTOOOLD 15
408 #define ERRORCODE_CONFIGTOONEW 16
409 #define ERRORCODE_INPROGRESS 17
410 #define ERRORCODE_EXP_A 18
411 #define ERRORCODE_EXP_B 19
412 #define ERRORCODE_UNDERLAY_DESTINATION_UNREACHABLE 101
413 #define ERRORCODE_UNDERLAY_TIME_EXCEEDED 102
414 #define ERRORCODE_MESSAGE_EXPIRED 103
415 #define ERRORCODE_MISROUTING 104
416 #define ERRORCODE_LOOP_DETECTED 105
417 #define ERRORCODE_TTL_HOPS_EXCEEDED 106
418
419
420 /* Signer identity types */
421 #define SIGNERIDENTITYTYPE_RESERVED 0
422 #define SIGNERIDENTITYTYPE_CERTHASH 1
423 #define SIGNERIDENTITYTYPE_CERTHASHNODEID 2
424 #define SIGNERIDENTITYTYPE_NONE 3
425
426 /* Probe information type */
427 #define PROBEINFORMATIONTYPE_RESERVED 0
428 #define PROBEINFORMATIONTYPE_RESPONSIBLESET 1
429 #define PROBEINFORMATIONTYPE_NUMRESOURCES 2
430 #define PROBEINFORMATIONTYPE_UPTIME 3
431 #define PROBEINFORMATIONTYPE_EXP_PROBE 4
432
433 /* Data Kind ID */
434 #define DATAKINDID_INVALID 0
435 #define DATAKINDID_SIP_REGISTRATION 1
436 #define DATAKINDID_TURNSERVICE 2
437 #define DATAKINDID_CERTIFICATE_BY_NODE 3
438 #define DATAKINDID_RESERVED_ROUTING_TABLE_SIZE 4
439 #define DATAKINDID_RESERVED_SOFTWARE_VERSION 5
440 #define DATAKINDID_RESERVED_MACHINE_UPTIME 6
441 #define DATAKINDID_RESERVED_APP_UPTIME 7
442 #define DATAKINDID_RESERVED_MEMORY_FOOTPRINT 8
443 #define DATAKINDID_RESERVED_DATASIZE_STORED 9
444 #define DATAKINDID_RESERVED_INSTANCES_STORED 10
445 #define DATAKINDID_RESERVED_MESSAGES_SENT_RCVD 11
446 #define DATAKINDID_RESERVED_EWMA_BYTES_SENT 12
447 #define DATAKINDID_RESERVED_EWMA_BYTES_RCVD 13
448 #define DATAKINDID_RESERVED_LAST_CONTACT 14
449 #define DATAKINDID_RESERVED_RTT 15
450 #define DATAKINDID_CERTIFICATE_BY_USER 16
451 #define DATAKINDID_REDIR 104
452
453 /* Data model */
454 #define DATAMODEL_SINGLE 1
455 #define DATAMODEL_ARRAY 2
456 #define DATAMODEL_DICTIONARY 3
457
458 /* Message Extension Type */
459 #define MESSAGEEXTENSIONTYPE_RESERVED 0
460 #define MESSAGEEXTENSIONTYPE_EXP_EXT 1
461 #define MESSAGEEXTENSIONTYPE_SELF_TUNING_DATA 2 /* is 1 */
462 #define MESSAGEEXTENSIONTYPE_DIAGNOSTIC_PING 3 /* is 1 */
463
464 /* Config Update Type */
465 #define CONFIGUPDATETYPE_RESERVED 0
466 #define CONFIGUPDATETYPE_CONFIG 1
467 #define CONFIGUPDATETYPE_KIND 2
468
469 /* Chord Update Type */
470 #define CHORDUPDATETYPE_RESERVED 0
471 #define CHORDUPDATETYPE_PEER_READY 1
472 #define CHORDUPDATETYPE_NEIGHBORS 2
473 #define CHORDUPDATETYPE_FULL 3
474
475 /* Chord Leave Type */
476 #define CHORDLEAVETYPE_RESERVED 0
477 #define CHORDLEAVETYPE_FROM_SUCC 1
478 #define CHORDLEAVETYPE_FROM_PRED 2
479
480 /* Chord Leave Type */
481 #define SIPREGISTRATIONTYPE_URI 1
482 #define SIPREGISTRATIONTYPE_ROUTE 2
483
484 /* Diagnostic Kind Id Type */
485 #define DIAGNOSTICKINDID_RESERVED 0x0000
486 #define DIAGNOSTICKINDID_STATUS_INFO 0x0001
487 #define DIAGNOSTICKINDID_ROUTING_TABLE_SIZE 0x0002
488 #define DIAGNOSTICKINDID_PROCESS_POWER 0x0003
489 #define DIAGNOSTICKINDID_BANDWIDTH 0x0004
490 #define DIAGNOSTICKINDID_SOFTWARE_VERSION 0x0005
491 #define DIAGNOSTICKINDID_MACHINE_UPTIME 0x0006
492 #define DIAGNOSTICKINDID_APP_UPTIME 0x0007
493 #define DIAGNOSTICKINDID_MEMORY_FOOTPRINT 0x0008
494 #define DIAGNOSTICKINDID_DATASIZE_STORED 0x0009
495 #define DIAGNOSTICKINDID_INSTANCES_STORED 0x000A
496 #define DIAGNOSTICKINDID_MESSAGES_SENT_RCVD 0x000B
497 #define DIAGNOSTICKINDID_EWMA_BYTES_SENT 0x000C
498 #define DIAGNOSTICKINDID_EWMA_BYTES_RCVD 0x000D
499 #define DIAGNOSTICKINDID_UNDERLAY_HOP 0x000E
500 #define DIAGNOSTICKINDID_BATTERY_STATUS 0x000F
501
502 /* route modes */
503 #define ROUTEMODE_RESERVED 0
504 #define ROUTEMODE_DDR 1
505 #define ROUTEMODE_RPR 2
506
507 /* Application IDs */
508 #define APPLICATIONID_INVALID 0
509 #define APPLICATIONID_SIP_5060 5060
510 #define APPLICATIONID_SIP_5061 5061
511 #define APPLICATIONID_RESERVED 0xFFFF
512
513
514 #define TOPOLOGY_PLUGIN_CHORD_RELOAD "CHORD-RELOAD"
515
516 /* reload user configuration variables */
517 static gboolean reload_defragment = TRUE;
518 static guint reload_nodeid_length = 16;
519 static const char *reload_topology_plugin = TOPOLOGY_PLUGIN_CHORD_RELOAD;
520
521
522 /* Initialize the subtree pointers */
523 static gint ett_reload = -1;
524 static gint ett_reload_forwarding = -1;
525 static gint ett_reload_message = -1;
526 static gint ett_reload_security=-1;
527 static gint ett_reload_fragment_flag=-1;
528 static gint ett_reload_destination = -1;
529 static gint ett_reload_via_list = -1;
530 static gint ett_reload_destination_list = -1;
531 static gint ett_reload_resourceid = -1;
532 static gint ett_reload_forwarding_options = -1;
533 static gint ett_reload_forwarding_option = -1;
534 static gint ett_reload_forwarding_option_flags = -1;
535 static gint ett_reload_forwarding_option_directresponseforwarding = -1;
536 static gint ett_reload_attachreqans = -1;
537 static gint ett_reload_icecandidates = -1;
538 static gint ett_reload_icecandidate = -1;
539 static gint ett_reload_icecandidate_computed_address = -1;
540 static gint ett_reload_iceextension = -1;
541 static gint ett_reload_iceextensions = -1;
542 static gint ett_reload_ipaddressport = -1;
543 static gint ett_reload_ipv4addrport = -1;
544 static gint ett_reload_ipv6addrport = -1;
545 static gint ett_reload_message_contents = -1;
546 static gint ett_reload_message_extensions = -1;
547 static gint ett_reload_message_extension = -1;
548 static gint ett_reload_error_response = -1;
549 static gint ett_reload_security_block = -1;
550 static gint ett_reload_genericcertificate = -1;
551 static gint ett_reload_certificates = -1;
552 static gint ett_reload_signature = -1;
553 static gint ett_reload_signatureandhashalgorithm = -1;
554 static gint ett_reload_signeridentity = -1;
555 static gint ett_reload_signeridentity_identity = -1;
556 static gint ett_reload_signeridentity_value = -1;
557 static gint ett_reload_opaque = -1;
558 static gint ett_reload_message_body = -1;
559 static gint ett_reload_routequeryreq = -1;
560 static gint ett_reload_probereq = -1;
561 static gint ett_reload_probereq_requested_info = -1;
562 static gint ett_reload_probe_information = -1;
563 static gint ett_reload_probe_information_data = -1;
564 static gint ett_reload_probeans = -1;
565 static gint ett_reload_probeans_probe_info = -1;
566 static gint ett_reload_appattach = -1;
567 static gint ett_reload_pingreq = -1;
568 static gint ett_reload_pingans = -1;
569 static gint ett_reload_storeddata = -1;
570 static gint ett_reload_kinddata = -1;
571 static gint ett_reload_values = -1;
572 static gint ett_reload_datavalue = -1;
573 static gint ett_reload_arrayentry = -1;
574 static gint ett_reload_dictionaryentry = -1;
575 static gint ett_reload_storereq = -1;
576 static gint ett_reload_store_kind_data = -1;
577 static gint ett_reload_storeans = -1;
578 static gint ett_reload_storekindresponse = -1;
579 static gint ett_reload_storeans_kind_responses = -1;
580 static gint ett_reload_fetchreq = -1;
581 static gint ett_reload_fetchreq_specifiers = -1;
582 static gint ett_reload_storeddataspecifier = -1;
583 static gint ett_reload_storeddataspecifier_indices = -1;
584 static gint ett_reload_storeddataspecifier_keys = -1;
585 static gint ett_reload_fetchans = -1;
586 static gint ett_reload_statans = -1;
587 static gint ett_reload_findkinddata = -1;
588 static gint ett_reload_fragments = -1;
589 static gint ett_reload_fragment = -1;
590 static gint ett_reload_configupdatereq = -1;
591 static gint ett_reload_configupdatereq_config_data = -1;
592 static gint ett_reload_kinddescription = -1;
593 static gint ett_reload_configupdatereq_kinds = -1;
594 static gint ett_reload_storekindresponse_replicas = -1;
595 static gint ett_reload_nodeid_list = -1;
596 static gint ett_reload_chordupdate = -1;
597 static gint ett_reload_chordroutequeryans = -1;
598 static gint ett_reload_chordleave = -1;
599 static gint ett_reload_turnserver = -1;
600 static gint ett_reload_sipregistration = -1;
601 static gint ett_reload_sipregistration_data = -1;
602 static gint ett_reload_sipregistration_destination_list = -1;
603 static gint ett_reload_dictionaryentry_key = -1;
604 static gint ett_reload_overlay_specific = -1;
605 static gint ett_reload_kindid_list = -1;
606 static gint ett_reload_redirserviceproviderdata = -1;
607 static gint ett_reload_redirserviceprovider = -1;
608 static gint ett_reload_self_tuning_data = -1;
609 static gint ett_reload_findreq = -1;
610 static gint ett_reload_findans = -1;
611 static gint ett_reload_dmflags = -1;
612 static gint ett_reload_diagnosticextension = -1;
613 static gint ett_reload_diagnosticrequest = -1;
614 static gint ett_reload_diagnosticrequest_extensions = -1;
615 static gint ett_reload_pathtrackreq = -1;
616 static gint ett_reload_diagnosticinfo = -1;
617 static gint ett_reload_diagnosticinfo_instances_stored = -1;
618 static gint ett_reload_diagnosticinfo_instancesstored_info = -1;
619 static gint ett_reload_diagnosticinfo_messages_sent_rcvd = -1;
620 static gint ett_reload_diagnosticinfo_messages_sent_rcvd_info = -1;
621 static gint ett_reload_diagnosticresponse = -1;
622 static gint ett_reload_diagnosticresponse_diagnostic_info_list = -1;
623 static gint ett_reload_pathtrackans = -1;
624 static gint ett_reload_extensiveroutingmodeoption = -1;
625 static gint ett_reload_extensiveroutingmode_destination = -1;
626 static gint ett_reload_joinreq = -1;
627 static gint ett_reload_joinans = -1;
628 static gint ett_reload_leavereq = -1;
629
630 static expert_field ei_reload_truncated_field = EI_INIT;
631 static expert_field ei_reload_truncated_packet = EI_INIT;
632 static expert_field ei_reload_computed_len_too_big = EI_INIT;
633 static expert_field ei_reload_identity_type_unknown = EI_INIT;
634 static expert_field ei_reload_unknown_data_model = EI_INIT;
635 static expert_field ei_reload_no_xml_dissector = EI_INIT;
636
637 static const fragment_items reload_frag_items = {
638 &ett_reload_fragment,
639 &ett_reload_fragments,
640 &hf_reload_fragments,
641 &hf_reload_fragment,
642 &hf_reload_fragment_overlap,
643 &hf_reload_fragment_overlap_conflict,
644 &hf_reload_fragment_multiple_tails,
645 &hf_reload_fragment_too_long_fragment,
646 &hf_reload_fragment_error,
647 &hf_reload_fragment_count,
648 &hf_reload_reassembled_in,
649 &hf_reload_reassembled_length,
650 /* Reassembled data field */
651 NULL,
652 "RELOAD fragments"
653 };
654
655 static const gint *reload_dmflag_items[] = {
656 &hf_reload_dmflag_status_info,
657 &hf_reload_dmflag_routing_table_size,
658 &hf_reload_dmflag_process_power,
659 &hf_reload_dmflag_bandwidth,
660 &hf_reload_dmflag_software_version,
661 &hf_reload_dmflag_machine_uptime,
662 &hf_reload_dmflag_app_uptime,
663 &hf_reload_dmflag_memory_footprint,
664 &hf_reload_dmflag_datasize_stored,
665 &hf_reload_dmflag_instances_stored,
666 &hf_reload_dmflag_messages_sent_rcvd,
667 &hf_reload_dmflag_ewma_bytes_sent,
668 &hf_reload_dmflag_ewma_bytes_rcvd,
669 &hf_reload_dmflag_underlay_hop,
670 &hf_reload_dmflag_battery_status,
671 };
672
673 static uat_t *reloadkindids_uat = NULL;
674
675 typedef struct _Kind {
676 gchar *name;
677 guint32 id;
678 guint data_model;
679
680 } kind_t;
681
682 static kind_t predefined_kinds[] = {
683 {"INVALID" ,DATAKINDID_INVALID, -1},
684 {"SIP-REGISTRATION" ,DATAKINDID_SIP_REGISTRATION, DATAMODEL_DICTIONARY},
685 {"TURN-SERVICE" ,DATAKINDID_TURNSERVICE, DATAMODEL_SINGLE},
686 {"CERTIFICATE_BY_NODE" ,DATAKINDID_CERTIFICATE_BY_NODE, DATAMODEL_ARRAY},
687 {"RESERVED_ROUTING_TABLE_SIZE" ,DATAKINDID_RESERVED_ROUTING_TABLE_SIZE, -1},
688 {"RESERVED_SOFTWARE_VERSION" ,DATAKINDID_RESERVED_SOFTWARE_VERSION, -1},
689 {"RESERVED_MACHINE_UPTIME" ,DATAKINDID_RESERVED_MACHINE_UPTIME, -1},
690 {"DATAKINDID_RESERVED_APP_UPTIME" ,DATAKINDID_RESERVED_APP_UPTIME, -1},
691 {"RESERVED_MEMORY_FOOTPRINT" ,DATAKINDID_RESERVED_MEMORY_FOOTPRINT, -1},
692 {"RESERVED_DATASIZE_STORED" ,DATAKINDID_RESERVED_DATASIZE_STORED, -1},
693 {"RESERVED_INSTANCES_STORED" ,DATAKINDID_RESERVED_INSTANCES_STORED, -1},
694 {"RESERVED_MESSAGES_SENT_RCVD" ,DATAKINDID_RESERVED_MESSAGES_SENT_RCVD, -1},
695 {"RESERVED_EWMA_BYTES_SENT" ,DATAKINDID_RESERVED_EWMA_BYTES_SENT, -1},
696 {"RESERVED_EWMA_BYTES_RCVD" ,DATAKINDID_RESERVED_EWMA_BYTES_RCVD, -1},
697 {"RESERVED_LAST_CONTACT" ,DATAKINDID_RESERVED_LAST_CONTACT, -1},
698 {"RESERVED_RTT" ,DATAKINDID_RESERVED_RTT, -1},
699 {"CERTIFICATE_BY_USER" ,DATAKINDID_CERTIFICATE_BY_USER, DATAMODEL_ARRAY},
700 {"REDIR" ,DATAKINDID_REDIR, DATAMODEL_DICTIONARY},
701 };
702
703
704 static kind_t * kindidlist_uats = NULL;
705
706 static guint nreloadkinds = 0;
707
getKindFromId(guint32 id)708 static kind_t * getKindFromId(guint32 id) {
709 guint i;
710 /* user defined kinds have precedence */
711 for (i = 0; i < nreloadkinds; i++) {
712 if (id == kindidlist_uats[i].id) {
713 return (kindidlist_uats+i);
714 }
715 }
716
717 /* then pre-defined kinds */
718 {
719 guint npredefinedkinds = sizeof(predefined_kinds) / sizeof(kind_t);
720 for (i = 0; i < npredefinedkinds; i++) {
721 if (id == predefined_kinds[i].id) {
722 return (predefined_kinds+i);
723 }
724 }
725 }
726 return NULL;
727 }
728
729 /*-------------------------------------
730 * UAT for Kind-IDs
731 *-------------------------------------
732 */
733
734
uat_kindid_copy_cb(void * n,const void * o,size_t siz _U_)735 static void* uat_kindid_copy_cb(void* n, const void* o, size_t siz _U_) {
736 kind_t * new_record = (kind_t *)n;
737 const kind_t* old_record = (const kind_t *)o;
738
739 new_record->name = g_strdup(old_record->name);
740
741 return new_record;
742 }
743
uat_kindid_record_free_cb(void * r)744 static void uat_kindid_record_free_cb(void*r) {
745 kind_t* rec = (kind_t *)r;
746 g_free(rec->name);
747 }
748
749 UAT_DEC_CB_DEF(kindidlist_uats,id,kind_t)
750 UAT_CSTRING_CB_DEF(kindidlist_uats,name,kind_t)
751 UAT_VS_DEF(kindidlist_uats,data_model,kind_t,guint,0,"string")
752
753
754 #define MSG_LENGH_OFFSET 16
755 #define MIN_HDR_LENGTH 38 /* Forwarding header till options_length member (included) */
756
757 #define RELOAD_TOKEN 0xd2454c4f
758
759 #define IS_REQUEST(code) (code & 0x0001)
760 #define MSGCODE_TO_METHOD(code) ((code + 1) & 0xfffe)
761 #define MSGCODE_TO_CLASS(code) (code & 0x0001)
762
763
764 static const value_string versions[] = {
765 {VERSION_DRAFT, "0.1 DRAFT"},
766 {0x00, NULL}
767 };
768
769 static const value_string classes[] = {
770 {RELOAD_REQUEST, "Request"},
771 {RELOAD_RESPONSE, "Response"},
772 {0x00, NULL}
773 };
774
775 static const value_string methods[] = {
776 {METHOD_INVALID, "invalid"},
777 {METHOD_PROBE, "Probe"},
778 {METHOD_ATTACH, "Attach"},
779 {METHOD_STORE, "Store"},
780 {METHOD_FETCH, "Fetch"},
781 {METHOD_UNUSED_REMOVE, "Remove (Unused)"},
782 {METHOD_FIND, "Find"},
783 {METHOD_JOIN, "Join"},
784 {METHOD_LEAVE, "Leave"},
785 {METHOD_UPDATE, "Update"},
786 {METHOD_ROUTEQUERY, "RouteQuery"},
787 {METHOD_PING, "Ping"},
788 {METHOD_STAT, "Stat"},
789 {METHOD_UNUSED_ATTACHLIGHT, "AttachLight (Unused)"},
790 {METHOD_APPATTACH, "AppAttach"},
791 {METHOD_UNUSED_APP_ATTACHLIGHT, "AppAttachLight (Unused)"},
792 {METHOD_CONFIGUPDATE, "ConfigUpdate"},
793 {METHOD_EXP_A, "Exp_B"},
794 {METHOD_EXP_B, "Exp_A"},
795 {METHOD_PATH_TRACK, "Path_Track"},
796 {METHOD_ERROR, "Error"},
797 {0x00, NULL}
798 };
799
800 static const value_string classes_short[] = {
801 {RELOAD_REQUEST, "req"},
802 {RELOAD_RESPONSE, "ans"},
803 {0x00, NULL}
804 };
805
806 static const value_string classes_Short[] = {
807 {RELOAD_REQUEST, "Req"},
808 {RELOAD_RESPONSE, "Ans"},
809 {0x00, NULL}
810 };
811
812 static const value_string methods_short[] = {
813 {METHOD_INVALID, "invalid"},
814 {METHOD_PROBE, "probe"},
815 {METHOD_ATTACH, "attach"},
816 {METHOD_STORE, "store"},
817 {METHOD_FETCH, "fetch"},
818 {METHOD_UNUSED_REMOVE, "unused_remove"},
819 {METHOD_FIND, "find"},
820 {METHOD_JOIN, "join"},
821 {METHOD_LEAVE, "leave"},
822 {METHOD_UPDATE, "update"},
823 {METHOD_ROUTEQUERY, "route_query"},
824 {METHOD_PING, "ping"},
825 {METHOD_STAT, "stat"},
826 {METHOD_UNUSED_ATTACHLIGHT, "unused_attachlight"},
827 {METHOD_APPATTACH, "app_attach"},
828 {METHOD_UNUSED_APP_ATTACHLIGHT, "unused_app_attachlight"},
829 {METHOD_CONFIGUPDATE, "config_update"},
830 {METHOD_EXP_A, "exp_a"},
831 {METHOD_EXP_B, "exp_b"},
832 {METHOD_PATH_TRACK, "path_track"},
833 {METHOD_ERROR, "error"},
834 {0x00, NULL}
835 };
836
837
838
839 static const value_string destinationtypes[] = {
840 {DESTINATIONTYPE_RESERVED, "reserved"},
841 {DESTINATIONTYPE_NODE, "node"},
842 {DESTINATIONTYPE_RESOURCE, "resource"},
843 {DESTINATIONTYPE_COMPRESSED, "compressed"},
844 {0x00, NULL}
845 };
846
847 static const value_string forwardingoptiontypes[] = {
848 {OPTIONTYPE_RESERVED, "reserved"},
849 {OPTIONTYPE_EXTENSIVE_ROUTING_MODE, "extensive_routing_mode"},
850 {0x00, NULL}
851 };
852
853 static const value_string candtypes[] = {
854 {CANDTYPE_RESERVED, "reserved"},
855 {CANDTYPE_HOST, "host"},
856 {CANDTYPE_SRFLX, "srflx"},
857 {CANDTYPE_PRFLX, "prflx"},
858 {CANDTYPE_RELAY, "relay"},
859 {0x00, NULL}
860 };
861
862 static const value_string ipaddressporttypes [] = {
863 {IPADDRESSPORTTYPE_RESERVED, "reserved"},
864 {IPADDRESSPORTTYPE_IPV4, "IPV4"},
865 {IPADDRESSPORTTYPE_IPV6, "IPV6"},
866 {0x00, NULL}
867 };
868
869 static const value_string overlaylinktypes [] = {
870 {OVERLAYLINKTYPE_RESERVED, "reserved"},
871 {OVERLAYLINKTYPE_DTLS_UDP_SR, "DTLS-UDP-SR"},
872 {OVERLAYLINKTYPE_DTLS_UDP_SR_NO_ICE, "DTLS-UDP-SR-NO-ICE"},
873 {OVERLAYLINKTYPE_TLS_TCP_FH_NO_ICE, "TLS-TCP-FH-NO-ICE"},
874 {OVERLAYLINKTYPE_EXP_LINK, "EXP_LINK"},
875 {0x00, NULL}
876 };
877
878 static const value_string errorcodes [] = {
879 {ERRORCODE_INVALID, "invalid"},
880 {ERRORCODE_UNUSED, "Unused"},
881 {ERRORCODE_FORBIDDEN, "Error_Forbidden"},
882 {ERRORCODE_NOTFOUND, "Error_Not_Found"},
883 {ERRORCODE_REQUESTTIMEOUT, "Error_Request_Timeout"},
884 {ERRORCODE_GENERATIONCOUNTERTOOLOW, "Error_Generation_Counter_Too_Low"},
885 {ERRORCODE_INCOMPATIBLEWITHOVERLAY, "Error_Incompatible_with_Overlay"},
886 {ERRORCODE_UNSUPPORTEDFORWARDINGOPTION, "Error_Unsupported_Forwarding_Option"},
887 {ERRORCODE_DATATOOLARGE, "Error_Data_Too_Large"},
888 {ERRORCODE_DATATOOOLD, "Error_Data_Too_Old"},
889 {ERRORCODE_TTLEXCEEDED, "Error_TTL_Exceeded"},
890 {ERRORCODE_MESSAGETOOLARGE, "Error_Message_Too_Large"},
891 {ERRORCODE_UNKNOWNKIND, "Error_Unknown_Kind"},
892 {ERRORCODE_UNKNOWNEXTENSION, "Error_Unknown_Extension"},
893 {ERRORCODE_RESPONSETOOLARGE, "Error_Response_Too_Large"},
894 {ERRORCODE_CONFIGTOOOLD, "Error_Config_Too_Old"},
895 {ERRORCODE_CONFIGTOONEW, "Error_Config_Too_New"},
896 {ERRORCODE_CONFIGTOONEW, "Error_Config_Too_New"},
897 {ERRORCODE_INPROGRESS, "Error_In_Progress"},
898 {ERRORCODE_EXP_A, "Error_Exp_A"},
899 {ERRORCODE_EXP_B, "Error_Exp_B"},
900 {ERRORCODE_UNDERLAY_DESTINATION_UNREACHABLE, "Error_Underlay_Destination_Unreachable"},
901 {ERRORCODE_UNDERLAY_TIME_EXCEEDED, "Error_Underlay_Time_Exceeded"},
902 {ERRORCODE_MESSAGE_EXPIRED, "Error_Message_Expired"},
903 {ERRORCODE_MISROUTING, "Error_Upstream_Misrouting"},
904 {ERRORCODE_LOOP_DETECTED, "Error_Loop_Detected"},
905 {ERRORCODE_TTL_HOPS_EXCEEDED, "Error_TTL_Hops_Exceeded"},
906 {0x00, NULL}
907 };
908
909 static const value_string signeridentitytypes[] = {
910 {SIGNERIDENTITYTYPE_RESERVED, "reserved"},
911 {SIGNERIDENTITYTYPE_CERTHASH, "cert_hash"},
912 {SIGNERIDENTITYTYPE_CERTHASHNODEID, "cert_hash_node_id"},
913 {SIGNERIDENTITYTYPE_NONE, "none"},
914 {0x00, NULL}
915 };
916
917 static const value_string probeinformationtypes[] = {
918 {PROBEINFORMATIONTYPE_RESERVED, "reserved"},
919 {PROBEINFORMATIONTYPE_RESPONSIBLESET, "responsible_set"},
920 {PROBEINFORMATIONTYPE_NUMRESOURCES, "num_resources"},
921 {PROBEINFORMATIONTYPE_UPTIME, "uptime"},
922 {PROBEINFORMATIONTYPE_EXP_PROBE, "exp-probe"},
923 {0x00, NULL}
924 };
925
926
927 static const value_string datamodels[] = {
928 {DATAMODEL_SINGLE, "SINGLE"},
929 {DATAMODEL_ARRAY, "ARRAY"},
930 {DATAMODEL_DICTIONARY, "DICTIONARY"},
931 {0x00, NULL}
932 };
933
934 static const value_string messageextensiontypes[] = {
935 {MESSAGEEXTENSIONTYPE_RESERVED, "reserved"},
936 {MESSAGEEXTENSIONTYPE_EXP_EXT, "exp-ext"},
937 {MESSAGEEXTENSIONTYPE_SELF_TUNING_DATA, "sip_tuning_data"},
938 {MESSAGEEXTENSIONTYPE_DIAGNOSTIC_PING, "Diagnostic_Ping"},
939 {0x00, NULL}
940 };
941
942
943 static const value_string configupdatetypes[] = {
944 {CONFIGUPDATETYPE_RESERVED, "reserved"},
945 {CONFIGUPDATETYPE_CONFIG, "config"},
946 {CONFIGUPDATETYPE_KIND, "kind"},
947 {0x00, NULL}
948 };
949
950 static const value_string chordupdatetypes[] = {
951 {CHORDUPDATETYPE_RESERVED, "reserved"},
952 {CHORDUPDATETYPE_PEER_READY, "peer_ready"},
953 {CHORDUPDATETYPE_NEIGHBORS, "neighbors"},
954 {CHORDUPDATETYPE_FULL, "full"},
955 {0x00, NULL}
956 };
957
958 static const value_string chordleavetypes[] = {
959 {CHORDLEAVETYPE_RESERVED, "reserved"},
960 {CHORDLEAVETYPE_FROM_SUCC, "from_succ"},
961 {CHORDLEAVETYPE_FROM_PRED, "from_pred"},
962 {0x00, NULL}
963 };
964
965 static const value_string sipregistrationtypes[] = {
966 {SIPREGISTRATIONTYPE_URI, "sip_registration_uri"},
967 {SIPREGISTRATIONTYPE_ROUTE, "sip_registration_route"},
968 {0x00, NULL}
969 };
970
971 static const value_string diagnostickindids[] = {
972 {DIAGNOSTICKINDID_RESERVED, "reserved"},
973 {DIAGNOSTICKINDID_STATUS_INFO, "STATUS_INFO"},
974 {DIAGNOSTICKINDID_ROUTING_TABLE_SIZE, "ROUTING_TABLE_SIZ"},
975 {DIAGNOSTICKINDID_PROCESS_POWER, "PROCESS_POWER"},
976 {DIAGNOSTICKINDID_BANDWIDTH, "BANDWIDTH"},
977 {DIAGNOSTICKINDID_SOFTWARE_VERSION, "SOFTWARE_VERSION"},
978 {DIAGNOSTICKINDID_MACHINE_UPTIME, "MACHINE_UPTIME"},
979 {DIAGNOSTICKINDID_APP_UPTIME, "APP_UPTIME"},
980 {DIAGNOSTICKINDID_MEMORY_FOOTPRINT, "MEMORY_FOOTPRINT"},
981 {DIAGNOSTICKINDID_DATASIZE_STORED, "DATASIZE_STORED"},
982 {DIAGNOSTICKINDID_INSTANCES_STORED, "INSTANCES_STORED"},
983 {DIAGNOSTICKINDID_MESSAGES_SENT_RCVD, "MESSAGES_SENT_RCVD"},
984 {DIAGNOSTICKINDID_EWMA_BYTES_SENT, "EWMA_BYTES_SENT"},
985 {DIAGNOSTICKINDID_EWMA_BYTES_RCVD, "EWMA_BYTES_RCVD"},
986 {DIAGNOSTICKINDID_UNDERLAY_HOP, "UNDERLAY_HOP"},
987 {DIAGNOSTICKINDID_BATTERY_STATUS, "BATTERY_STATUS"},
988 {0x00, NULL}
989 };
990
991 static const value_string routemodes[] = {
992 {ROUTEMODE_RESERVED, "reserved"},
993 {ROUTEMODE_DDR, "DDR"},
994 {ROUTEMODE_RPR, "RPR"},
995 {0x00, NULL}
996 };
997
998 static const value_string applicationids[] = {
999 /* Application IDs */
1000 {APPLICATIONID_INVALID, "INVALID"},
1001 {APPLICATIONID_SIP_5060, "SIP"},
1002 {APPLICATIONID_SIP_5061, "SIP"},
1003 {APPLICATIONID_RESERVED, "Reserved"},
1004 {0x00, NULL}
1005 };
1006
1007
1008 /*
1009 * defragmentation
1010 */
1011 static reassembly_table reload_reassembly_table;
1012
1013
1014 static guint
get_reload_message_length(packet_info * pinfo _U_,tvbuff_t * tvb,int offset)1015 get_reload_message_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
1016 {
1017 guint32 length = tvb_get_ntohl(tvb, offset + MSG_LENGH_OFFSET);
1018 return length;
1019 }
1020
1021 static int
dissect_opaque_string_or_data(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int anchor_index,guint16 offset,guint16 length_size,gint32 max_field_length,gboolean is_string)1022 dissect_opaque_string_or_data(tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree, int anchor_index, guint16 offset, guint16 length_size, gint32 max_field_length, gboolean is_string)
1023 {
1024 proto_tree *opaque_tree;
1025 proto_item *ti_anchor;
1026 gint length_index = -1;
1027 gint32 length = -1;
1028 int hf = hf_reload_opaque;
1029 int hf_data = hf_reload_opaque_data;
1030 guint hf_data_encoding = ENC_NA;
1031
1032 if (anchor_index >= 0) {
1033 hf = anchor_index;
1034 }
1035
1036 if (is_string) {
1037 hf_data = hf_reload_opaque_string;
1038 hf_data_encoding = ENC_ASCII|ENC_NA;
1039 }
1040
1041 switch (length_size) {
1042 case 1:
1043 length_index = hf_reload_length_uint8;
1044 length = (gint32)tvb_get_guint8(tvb,offset);
1045 break;
1046 case 2:
1047 length_index = hf_reload_length_uint16;
1048 length = (gint32)tvb_get_ntohs(tvb, offset);
1049 break;
1050 case 3:
1051 length_index = hf_reload_length_uint24;
1052 length = ((gint32) (tvb_get_ntohs(tvb, offset) <<8) + (tvb_get_guint8(tvb, offset+2)));
1053 break;
1054 case 4:
1055 length_index = hf_reload_length_uint32;
1056 length = (gint32)tvb_get_ntohl(tvb, offset);
1057 break;
1058
1059 default:
1060 break;
1061 }
1062
1063 if (length_index < 0) return 0;
1064
1065 ti_anchor = proto_tree_add_item(tree, hf, tvb, offset, length_size + length, ENC_NA);
1066
1067 if (max_field_length > 0) {
1068 if ((length + length_size) > max_field_length) {
1069 expert_add_info(pinfo, ti_anchor, &ei_reload_computed_len_too_big);
1070 length = max_field_length - length_size;
1071 }
1072 }
1073
1074 opaque_tree = proto_item_add_subtree(ti_anchor, ett_reload_opaque);
1075 proto_tree_add_uint(opaque_tree, length_index, tvb, offset, length_size, (guint)length);
1076 if (length) {
1077 proto_tree_add_item(opaque_tree, hf_data, tvb, offset + length_size, length, hf_data_encoding);
1078 }
1079 if (hf != hf_reload_opaque) {
1080 proto_item_append_text(ti_anchor, " (opaque<%d>)", length);
1081 }
1082 else {
1083 proto_item_append_text(ti_anchor, "<%d>", length);
1084 }
1085
1086 return (length_size + length);
1087 }
1088
1089 static int
dissect_opaque(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int anchor_index,guint16 offset,guint16 length_size,gint32 max_field_length)1090 dissect_opaque(tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree, int anchor_index, guint16 offset, guint16 length_size, gint32 max_field_length) {
1091 return dissect_opaque_string_or_data(tvb, pinfo, tree, anchor_index, offset, length_size, max_field_length, FALSE);
1092 }
1093
1094 static int
dissect_opaque_string(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int anchor_index,guint16 offset,guint16 length_size,gint32 max_field_length)1095 dissect_opaque_string(tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree, int anchor_index, guint16 offset, guint16 length_size, gint32 max_field_length) {
1096 return dissect_opaque_string_or_data(tvb, pinfo, tree, anchor_index, offset, length_size, max_field_length, TRUE);
1097 }
1098
dissect_length(tvbuff_t * tvb,proto_tree * tree,guint16 offset,guint16 length_size)1099 static int dissect_length(tvbuff_t *tvb, proto_tree *tree, guint16 offset, guint16 length_size) {
1100 switch (length_size) {
1101 case 1:
1102 proto_tree_add_item(tree, hf_reload_length_uint8, tvb, offset, 1, ENC_BIG_ENDIAN);
1103 return 1;
1104
1105 case 2:
1106 proto_tree_add_item(tree, hf_reload_length_uint16, tvb, offset, 2, ENC_BIG_ENDIAN);
1107 return 2;
1108
1109 case 3:
1110 proto_tree_add_item(tree, hf_reload_length_uint24, tvb, offset, 3, ENC_BIG_ENDIAN);
1111 return 3;
1112
1113 case 4:
1114 proto_tree_add_item(tree, hf_reload_length_uint32, tvb, offset, 4, ENC_BIG_ENDIAN);
1115 return 4;
1116
1117 default:
1118 break;
1119 }
1120 return 0;
1121 }
1122
dissect_resourceid(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1123 static int dissect_resourceid(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1124 {
1125 proto_item *ti_local;
1126 proto_tree *local_tree;
1127 int hf = hf_reload_resourceid;
1128 guint8 local_length;
1129
1130 if (anchor >= 0) {
1131 hf = anchor;
1132 }
1133
1134 local_length = tvb_get_guint8(tvb, offset);
1135
1136 /* We don't know the node ID. Just assume that all the data is part of it */
1137 if (length < local_length+1) {
1138 ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1139 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ResourceId");
1140 return length;
1141 }
1142
1143 ti_local = proto_tree_add_item(tree, hf, tvb, offset, 1+local_length, ENC_NA);
1144 local_tree = proto_item_add_subtree(ti_local, ett_reload_resourceid);
1145 proto_tree_add_item(local_tree, hf_reload_length_uint8, tvb, offset, 1, ENC_BIG_ENDIAN);
1146 proto_tree_add_item(local_tree, hf_reload_opaque_data, tvb, offset+1, local_length, ENC_NA);
1147
1148 if (hf != hf_reload_resourceid) {
1149 proto_item_append_text(ti_local, " (ResourceId<%d>)", local_length);
1150 }
1151 else {
1152 proto_item_append_text(ti_local, "<%d>", local_length);
1153 }
1154
1155 return 1+local_length;
1156 }
1157
dissect_nodeid(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1158 static int dissect_nodeid(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1159 {
1160 proto_item *ti_nodeid;
1161 int hf = hf_reload_nodeid;
1162
1163 if (anchor >= 0) {
1164 hf = anchor;
1165 }
1166
1167 /* We don't know the node ID. Just assume that all the data is part of it */
1168 if (length < reload_nodeid_length) {
1169 ti_nodeid = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1170 expert_add_info_format(pinfo, ti_nodeid, &ei_reload_truncated_field, "Truncated NodeId");
1171 return length;
1172 }
1173
1174 ti_nodeid = proto_tree_add_item(tree, hf, tvb, offset, reload_nodeid_length, ENC_NA);
1175 {
1176 gboolean allZeros = TRUE;
1177 gboolean allOnes = TRUE;
1178 guint i;
1179
1180 for (i=0; i<reload_nodeid_length; i++) {
1181 guint8 byte = tvb_get_guint8(tvb,offset+i);
1182 if (byte != 0) {
1183 allZeros = FALSE;
1184 if (allOnes == FALSE) break;
1185 }
1186 if (byte != 0xFF) {
1187 allOnes = FALSE;
1188 if (allZeros == FALSE) break;
1189 }
1190 }
1191
1192 if (allZeros) {
1193 proto_item_append_text(ti_nodeid, "\n [Invalid]");
1194 }
1195 if (allOnes) {
1196 proto_item_append_text(ti_nodeid, "\n [Wildcard]");
1197 }
1198
1199 }
1200
1201
1202 return reload_nodeid_length;
1203 }
1204
1205 static int
dissect_destination(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1206 dissect_destination(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1207 {
1208 guint8 destination_type;
1209 proto_tree *destination_tree;
1210 proto_item *ti_destination;
1211 guint8 destination_length = 0;
1212 int hf = hf_reload_destination;
1213
1214 if (anchor >= 0) {
1215 hf = anchor;
1216 }
1217
1218 destination_type = tvb_get_guint8(tvb,offset);
1219
1220 if (destination_type & 0x80) {
1221 /* simple compressed case */
1222 ti_destination = proto_tree_add_item(tree, hf, tvb, offset, 2, ENC_NA);
1223 if (hf == anchor) {
1224 proto_item_append_text(ti_destination, " (Destination)");
1225 }
1226 proto_item_append_text(ti_destination, ": uint16");
1227 destination_tree = proto_item_add_subtree(ti_destination, ett_reload_destination);
1228 proto_tree_add_item(destination_tree,hf_reload_destination_compressed_id , tvb, offset, 2, ENC_BIG_ENDIAN);
1229 return 2;
1230 }
1231 else {
1232 /* normal case */
1233
1234 destination_length = tvb_get_guint8(tvb,offset+1);
1235 ti_destination = proto_tree_add_item(tree, hf, tvb, offset, 2+destination_length, ENC_NA);
1236 if (hf == anchor) {
1237 proto_item_append_text(ti_destination, " (Destination)");
1238 }
1239 destination_tree = proto_item_add_subtree(ti_destination, ett_reload_destination);
1240 proto_item_append_text(ti_destination, ": %s", val_to_str_const(destination_type, destinationtypes, "Unknown"));
1241
1242 proto_tree_add_item(destination_tree, hf_reload_destination_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1243 proto_tree_add_uint(destination_tree, hf_reload_length_uint8, tvb, offset+1, 1, destination_length);
1244 if (2 + destination_length > length) {
1245 expert_add_info_format(pinfo, ti_destination, &ei_reload_truncated_field, "Truncated Destination");
1246 return length;
1247 }
1248 switch(destination_type) {
1249 case DESTINATIONTYPE_NODE:
1250 dissect_nodeid(hf_reload_destination_data_node_id, tvb, pinfo, destination_tree, offset+2, destination_length);
1251 break;
1252
1253 case DESTINATIONTYPE_RESOURCE:
1254 dissect_resourceid(hf_reload_destination_data_resource_id, tvb, pinfo, destination_tree, offset+2, destination_length);
1255 break;
1256
1257 case DESTINATIONTYPE_COMPRESSED:
1258 dissect_opaque(tvb, pinfo, destination_tree, hf_reload_destination_data_compressed_id, offset+2, 1, destination_length);
1259 break;
1260 default:
1261 break;
1262 }
1263
1264 }
1265 return (2+destination_length);
1266 }
1267
1268
1269 static int
dissect_destination_list(tvbuff_t * tvb,packet_info * pinfo,proto_tree * list_tree,guint16 offset,guint16 length,int * numDestinations)1270 dissect_destination_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *list_tree, guint16 offset, guint16 length, int *numDestinations)
1271 {
1272 gint local_offset = 0;
1273 gint local_increment;
1274
1275 *numDestinations = 0;
1276 while (local_offset +2 <= length) {
1277 local_increment = dissect_destination(-1,tvb, pinfo, list_tree, offset + local_offset, length-local_offset);
1278 if (local_increment <= 0) break;
1279 local_offset += local_increment;
1280 (*numDestinations)++;
1281 }
1282 return local_offset;
1283 }
1284
1285 static int
dissect_probe_information(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1286 dissect_probe_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1287 {
1288 proto_item *ti_probe_information;
1289 proto_tree *probe_information_tree;
1290 guint8 type;
1291 guint8 probe_length;
1292
1293 type = tvb_get_guint8(tvb, offset);
1294 probe_length = tvb_get_guint8(tvb, offset + 1);
1295
1296 if (probe_length + 2 > length) {
1297 ti_probe_information = proto_tree_add_item(tree, hf_reload_probe_information, tvb, offset, length, ENC_NA);
1298 expert_add_info_format(pinfo, ti_probe_information, &ei_reload_truncated_field, "Truncated probe information");
1299 return length;
1300 }
1301 ti_probe_information = proto_tree_add_item(tree, hf_reload_probe_information, tvb, offset, 2 + probe_length, ENC_NA);
1302 probe_information_tree = proto_item_add_subtree(ti_probe_information, ett_reload_probe_information);
1303
1304 proto_tree_add_item(probe_information_tree, hf_reload_probe_information_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1305 proto_tree_add_uint(probe_information_tree, hf_reload_length_uint8, tvb, offset + 1, 1, probe_length);
1306
1307 {
1308 proto_item *ti_probe_information_data;
1309 proto_tree *probe_information_data_tree;
1310
1311 ti_probe_information_data = proto_tree_add_item(probe_information_tree, hf_reload_probe_information_data, tvb, offset+2, probe_length, ENC_NA);
1312 probe_information_data_tree = proto_item_add_subtree(ti_probe_information_data, ett_reload_probe_information_data);
1313
1314 switch(type) {
1315 case PROBEINFORMATIONTYPE_RESPONSIBLESET:
1316 if (probe_length < 4) {
1317 expert_add_info_format(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated responsible set");
1318 return 2 + probe_length;
1319 }
1320 proto_tree_add_item(probe_information_data_tree, hf_reload_responsible_set, tvb, offset + 2, 4, ENC_BIG_ENDIAN);
1321 break;
1322 case PROBEINFORMATIONTYPE_NUMRESOURCES:
1323 if (probe_length < 4) {
1324 expert_add_info_format(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated num resource info");
1325 return 2 + probe_length;
1326 }
1327 proto_tree_add_item(probe_information_data_tree, hf_reload_num_resources, tvb, offset + 2, 4, ENC_BIG_ENDIAN);
1328 break;
1329 case PROBEINFORMATIONTYPE_UPTIME:
1330 if (probe_length < 4) {
1331 expert_add_info_format(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated uptime info");
1332 return 2 + probe_length;
1333 }
1334 proto_tree_add_item(probe_information_data_tree, hf_reload_uptime, tvb, offset + 2, 4, ENC_BIG_ENDIAN);
1335 break;
1336 default:
1337 break;
1338 }
1339 }
1340 return probe_length + 2;
1341 }
1342
1343
1344
1345 static int
dissect_ipaddressport(int anchor,tvbuff_t * tvb,proto_tree * tree,guint16 offset)1346 dissect_ipaddressport(int anchor, tvbuff_t *tvb, proto_tree *tree, guint16 offset)
1347 {
1348 proto_item *ti_ipaddressport;
1349 proto_tree *ipaddressport_tree;
1350 guint8 ipaddressport_type;
1351 guint8 ipaddressport_length;
1352 int hf = hf_reload_ipaddressport;
1353
1354 if (anchor >= 0) {
1355 hf = anchor;
1356 }
1357
1358 ipaddressport_length = tvb_get_guint8(tvb, offset+1);
1359 ti_ipaddressport = proto_tree_add_item(tree, hf, tvb, offset, ipaddressport_length+2, ENC_NA);
1360 if (hf == anchor) proto_item_append_text(ti_ipaddressport, " (IpAddressPort)");
1361 ipaddressport_type = tvb_get_guint8(tvb, offset);
1362 proto_item_append_text(ti_ipaddressport, ": %s", val_to_str_const(ipaddressport_type, ipaddressporttypes,"Unknown Type"));
1363 if (ipaddressport_type == IPADDRESSPORTTYPE_IPV4) {
1364 proto_item_append_text(ti_ipaddressport, " (%s:%d)", tvb_ip_to_str(wmem_packet_scope(), tvb, offset+2),tvb_get_ntohs(tvb,offset+2+4));
1365 }
1366 else if (ipaddressport_type == IPADDRESSPORTTYPE_IPV6) {
1367 proto_item_append_text(ti_ipaddressport, " (%s:%d)", tvb_ip6_to_str(wmem_packet_scope(), tvb, offset+2),tvb_get_ntohs(tvb,offset+2+16));
1368 }
1369 ipaddressport_tree = proto_item_add_subtree(ti_ipaddressport, ett_reload_ipaddressport);
1370 proto_tree_add_item(ipaddressport_tree, hf_reload_ipaddressport_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1371 offset += 1;
1372 proto_tree_add_uint(ipaddressport_tree, hf_reload_length_uint8, tvb, offset, 1, ipaddressport_length);
1373 offset += 1;
1374 switch (ipaddressport_type) {
1375 case IPADDRESSPORTTYPE_IPV4:
1376 {
1377 proto_item *ti_ipv4;
1378 proto_tree *ipv4_tree;
1379 ti_ipv4 = proto_tree_add_item(ipaddressport_tree, hf_reload_ipv4addrport, tvb, offset, 6, ENC_NA);
1380 proto_item_append_text(ti_ipv4, ": %s:%d", tvb_ip_to_str(wmem_packet_scope(), tvb, offset),tvb_get_ntohs(tvb,offset+4));
1381 ipv4_tree = proto_item_add_subtree(ti_ipv4, ett_reload_ipv4addrport);
1382 proto_tree_add_item(ipv4_tree, hf_reload_ipv4addr, tvb, offset, 4, ENC_BIG_ENDIAN);
1383 proto_tree_add_item(ipv4_tree, hf_reload_port, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
1384 }
1385 break;
1386
1387 case IPADDRESSPORTTYPE_IPV6:
1388 {
1389 proto_item *ti_ipv6;
1390 proto_tree *ipv6_tree;
1391 ti_ipv6 = proto_tree_add_item(ipaddressport_tree, hf_reload_ipv6addrport, tvb, offset, 6, ENC_NA);
1392 proto_item_append_text(ti_ipv6, ": %s:%d", tvb_ip6_to_str(wmem_packet_scope(), tvb, offset),tvb_get_ntohs(tvb,offset+16));
1393 ipv6_tree = proto_item_add_subtree(ti_ipv6, ett_reload_ipv6addrport);
1394 proto_tree_add_item(ipv6_tree, hf_reload_ipv6addr, tvb, offset, 16, ENC_NA);
1395 proto_tree_add_item(ipv6_tree, hf_reload_port, tvb, offset + 16, 2, ENC_BIG_ENDIAN);
1396 }
1397 break;
1398
1399 default:
1400 break;
1401 }
1402
1403
1404 return (int) (2 + ipaddressport_length);
1405 }
1406
1407 static int
dissect_icecandidates(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1408 dissect_icecandidates(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1409 {
1410 proto_item *ti_icecandidates;
1411 proto_tree *icecandidates_tree;
1412 guint32 icecandidates_offset = 0;
1413 guint32 icecandidates_length;
1414 guint32 local_offset = 0;
1415 int nCandidates = 0;
1416
1417 icecandidates_length = tvb_get_ntohs(tvb, offset);
1418 /* Precalculate the length of the icecandidate list */
1419 if (2+icecandidates_length > length) {
1420 ti_icecandidates = proto_tree_add_item(tree, hf_reload_icecandidates, tvb, offset, length, ENC_NA);
1421 expert_add_info_format(pinfo, ti_icecandidates, &ei_reload_truncated_field, "Truncated ice candidates");
1422 return length;
1423 }
1424
1425 ti_icecandidates = proto_tree_add_item(tree, hf_reload_icecandidates, tvb, offset, 2+icecandidates_length, ENC_NA);
1426 proto_item_append_text(ti_icecandidates, " (IceCandidate<%d>)", icecandidates_length);
1427 icecandidates_tree = proto_item_add_subtree(ti_icecandidates, ett_reload_icecandidates);
1428 proto_tree_add_uint(icecandidates_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, icecandidates_length);
1429 local_offset += 2;
1430 while (icecandidates_offset < icecandidates_length) {
1431 proto_item *ti_icecandidate;
1432 proto_tree *icecandidate_tree;
1433 guint8 ipaddressport_length;
1434 guint8 computed_ipaddressport_length;
1435 guint16 iceextensions_length;
1436 guint8 foundation_length;
1437 guint8 candtype;
1438 guint16 icecandidate_offset = 0;
1439 /* compute the length */
1440 ipaddressport_length = tvb_get_guint8(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset+1);
1441 icecandidate_offset += 2 + ipaddressport_length;
1442 icecandidate_offset += 1;/* OverlayLink */
1443 foundation_length = tvb_get_guint8(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset);
1444 icecandidate_offset += 1 + foundation_length;
1445 icecandidate_offset += 4;/* priority */
1446 candtype = tvb_get_guint8(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset);
1447 icecandidate_offset += 1;/* candType */
1448 computed_ipaddressport_length = 0;
1449 switch (candtype) {
1450 case CANDTYPE_HOST:
1451 break;
1452 case CANDTYPE_SRFLX:
1453 case CANDTYPE_PRFLX:
1454 case CANDTYPE_RELAY:
1455 /* IpAddressPort */
1456 computed_ipaddressport_length = tvb_get_guint8(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset+1);
1457 icecandidate_offset += computed_ipaddressport_length+2;
1458 break;
1459 default:
1460 break;
1461 }
1462
1463 iceextensions_length = tvb_get_ntohs(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset);
1464 icecandidate_offset += iceextensions_length + 2;
1465
1466 /* icecandidate_offset is now equal to the length of this icecandicate */
1467 if (icecandidates_offset + icecandidate_offset > icecandidates_length) {
1468 expert_add_info_format(pinfo, ti_icecandidates, &ei_reload_truncated_field, "Truncated IceCandidate");
1469 break;
1470 }
1471 ti_icecandidate = proto_tree_add_item(icecandidates_tree, hf_reload_icecandidate, tvb, offset+local_offset+ icecandidates_offset, icecandidate_offset, ENC_NA);
1472 icecandidate_tree = proto_item_add_subtree(ti_icecandidate, ett_reload_icecandidate);
1473 /* parse from start */
1474 icecandidate_offset = 0;
1475 dissect_ipaddressport(hf_reload_icecandidate_addr_port,tvb, icecandidate_tree, offset+local_offset+icecandidates_offset+icecandidate_offset);
1476 icecandidate_offset += 2 + ipaddressport_length;
1477
1478 proto_tree_add_item(icecandidate_tree, hf_reload_overlaylink_type, tvb,
1479 offset+local_offset+icecandidates_offset+icecandidate_offset, 1, ENC_BIG_ENDIAN);
1480
1481 icecandidate_offset += 1;
1482 icecandidate_offset += dissect_opaque_string(tvb, pinfo,icecandidate_tree, hf_reload_icecandidate_foundation,offset+local_offset+icecandidates_offset + icecandidate_offset, 1, -1);
1483
1484 {
1485 guint32 priority;
1486
1487 priority = tvb_get_ntohl(tvb, offset+local_offset + icecandidates_offset);
1488 proto_tree_add_item(icecandidate_tree, hf_reload_icecandidate_priority, tvb, offset+local_offset + icecandidates_offset, 4, ENC_BIG_ENDIAN);
1489 icecandidate_offset += 4;
1490 proto_tree_add_item(icecandidate_tree, hf_reload_icecandidate_type, tvb,
1491 offset+local_offset+icecandidates_offset+icecandidate_offset, 1, ENC_BIG_ENDIAN);
1492 proto_item_append_text(ti_icecandidate, ": %s, priority=%d", val_to_str_const(candtype, candtypes, "Unknown"), priority);
1493 }
1494 icecandidate_offset += 1;
1495 {
1496 int item_index = -1;
1497 switch (candtype) {
1498 case CANDTYPE_HOST:
1499 break;
1500 case CANDTYPE_SRFLX:
1501 case CANDTYPE_PRFLX:
1502 case CANDTYPE_RELAY:
1503 item_index = hf_reload_icecandidate_relay_addr;
1504 break;
1505
1506 default:
1507 break;
1508 }
1509 if (item_index != -1) {
1510 dissect_ipaddressport(item_index,tvb, icecandidate_tree,
1511 offset+local_offset+icecandidates_offset+icecandidate_offset);
1512 icecandidate_offset += computed_ipaddressport_length + 2;
1513 }
1514 }
1515 /* Ice extensions */
1516 {
1517 guint32 iceextensions_offset = 0;
1518 proto_item *ti_iceextension, *ti_extensions;
1519 proto_tree *iceextension_tree,*extensions_tree;
1520 guint16 iceextension_name_length;
1521 guint16 iceextension_value_length;
1522 int nExtensions = 0;
1523 ti_extensions =
1524 proto_tree_add_item(icecandidate_tree, hf_reload_iceextensions, tvb,
1525 offset+local_offset+icecandidates_offset+icecandidate_offset, 2+iceextensions_length,
1526 ENC_NA);
1527 proto_item_append_text(ti_extensions, " (IceExtensions<%d>)", iceextensions_length);
1528 extensions_tree = proto_item_add_subtree(ti_extensions, ett_reload_iceextensions);
1529
1530 proto_tree_add_item(extensions_tree, hf_reload_length_uint16, tvb,
1531 offset+local_offset+icecandidates_offset+icecandidate_offset, 2, ENC_BIG_ENDIAN);
1532 icecandidate_offset += 2;
1533 while (iceextensions_offset < iceextensions_length) {
1534 int local_increment;
1535 iceextension_name_length =
1536 tvb_get_ntohs(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset+iceextensions_offset);
1537 iceextension_value_length =
1538 tvb_get_ntohs(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset+iceextensions_offset+iceextension_name_length + 2);
1539 if ((iceextensions_offset + 4 + iceextension_name_length + iceextension_value_length) > iceextensions_length) {
1540 expert_add_info_format(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated extensions");
1541 break;
1542 }
1543 ti_iceextension =
1544 proto_tree_add_item(extensions_tree, hf_reload_iceextension, tvb,
1545 offset+local_offset + icecandidates_offset + icecandidate_offset + iceextensions_offset, 4 + iceextension_name_length + iceextension_value_length, ENC_NA);
1546 iceextension_tree = proto_item_add_subtree(ti_iceextension, ett_reload_iceextension);
1547 dissect_opaque(tvb, pinfo, iceextension_tree, hf_reload_iceextension_name,offset+local_offset+ icecandidates_offset + icecandidate_offset + iceextensions_offset, 2, iceextension_name_length+2);
1548 dissect_opaque(tvb, pinfo, iceextension_tree, hf_reload_iceextension_value,offset+local_offset + icecandidates_offset + icecandidate_offset + iceextensions_offset +2 + iceextension_name_length, 2, iceextension_value_length+2);
1549 local_increment = 4 + iceextension_name_length + iceextension_value_length;
1550 if (local_increment <= 0) break;
1551 iceextensions_offset += local_increment;
1552 nExtensions++;
1553 }
1554 proto_item_append_text(ti_extensions, ": %d elements", nExtensions);
1555 }
1556 icecandidate_offset += iceextensions_length;
1557 if (icecandidate_offset <= 0) break;
1558 icecandidates_offset += icecandidate_offset;
1559 nCandidates++;
1560 }
1561 proto_item_append_text(ti_icecandidates, ": %d elements", nCandidates);
1562
1563 return (2 + icecandidates_length);
1564 }
1565
1566 static int
dissect_attachreqans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1567 dissect_attachreqans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1568 {
1569 proto_item *ti_attachreqans;
1570 proto_tree *attachreqans_tree;
1571 guint8 ufrag_length;
1572 guint8 password_length;
1573 guint8 role_length;
1574 guint16 icecandidates_length;
1575 guint16 local_offset = 0;
1576
1577 /* variable length structures: must 1st compute the length ... */
1578 ufrag_length = tvb_get_guint8(tvb,offset+local_offset);
1579 local_offset += 1;
1580 if (local_offset + ufrag_length > length) {
1581 ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA);
1582 expert_add_info_format(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans");
1583 return length;
1584 }
1585 local_offset += ufrag_length;
1586 password_length = tvb_get_guint8(tvb,offset+local_offset);
1587 local_offset += 1;
1588 if (local_offset + password_length > length) {
1589 ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA);
1590 expert_add_info_format(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans");
1591 return length;
1592 }
1593 local_offset += password_length;
1594 role_length = tvb_get_guint8(tvb,offset+local_offset);
1595 local_offset += 1;
1596 if (local_offset + role_length > length) {
1597 ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA);
1598 expert_add_info_format(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans");
1599 return length;
1600 }
1601 local_offset += role_length;
1602 icecandidates_length = tvb_get_ntohs(tvb, offset+local_offset);
1603 local_offset += 2;
1604 if (local_offset +icecandidates_length > length) {
1605 ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA);
1606 expert_add_info_format(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans");
1607 return length;
1608 }
1609 local_offset += icecandidates_length;
1610
1611 ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, local_offset, ENC_NA);
1612 attachreqans_tree = proto_item_add_subtree(ti_attachreqans, ett_reload_attachreqans);
1613
1614 /* restart parsing, field by field */
1615 local_offset = 0;
1616 local_offset += dissect_opaque_string(tvb, pinfo,attachreqans_tree, hf_reload_ufrag,offset+local_offset, 1, -1);
1617 local_offset += dissect_opaque_string(tvb, pinfo,attachreqans_tree, hf_reload_password,offset+local_offset, 1, -1);
1618 local_offset += dissect_opaque_string(tvb, pinfo,attachreqans_tree, hf_reload_role,offset+local_offset, 1, -1);
1619 local_offset += dissect_icecandidates(tvb, pinfo, attachreqans_tree, offset + local_offset, 2+icecandidates_length);
1620
1621 proto_tree_add_item(attachreqans_tree, hf_reload_sendupdate, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
1622 local_offset += 1;
1623
1624 return local_offset;
1625 }
1626
1627
1628 static int
dissect_sipregistration(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1629 dissect_sipregistration(tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree, guint16 offset, guint16 length)
1630 {
1631 proto_item *ti_local, *ti_sipregistrationdata;
1632 proto_tree *local_tree, *sipregistrationdata_tree;
1633 int local_offset = 0;
1634 guint16 length_field;
1635 guint8 type;
1636
1637 ti_local = proto_tree_add_item(tree, hf_reload_sipregistration, tvb, offset, length, ENC_NA);
1638 local_tree = proto_item_add_subtree(ti_local, ett_reload_sipregistration);
1639
1640 type = tvb_get_guint8(tvb, offset + local_offset);
1641 proto_tree_add_item(local_tree, hf_reload_sipregistration_type, tvb,offset+local_offset,1, ENC_BIG_ENDIAN);
1642 local_offset += 1;
1643 length_field = tvb_get_ntohs(tvb, offset+local_offset);
1644 proto_tree_add_item(local_tree, hf_reload_length_uint16, tvb,offset+local_offset,2, ENC_BIG_ENDIAN);
1645 local_offset += 2;
1646 if (length_field>0) {
1647 ti_sipregistrationdata = proto_tree_add_item(local_tree, hf_reload_sipregistration_data, tvb, offset, length_field, ENC_NA);
1648 sipregistrationdata_tree = proto_item_add_subtree(ti_sipregistrationdata, ett_reload_sipregistration_data);
1649
1650 switch(type) {
1651 case SIPREGISTRATIONTYPE_URI:
1652 dissect_opaque_string(tvb,pinfo, sipregistrationdata_tree, hf_reload_sipregistration_data_uri, offset+local_offset, 2, length_field);
1653 break;
1654
1655 case SIPREGISTRATIONTYPE_ROUTE:
1656 {
1657 guint16 route_offset = 0;
1658 guint16 destinations_length;
1659 int numDestinations = 0;
1660 proto_item *ti_destination_list;
1661 proto_tree *destination_list_tree;
1662 route_offset += dissect_opaque_string(tvb,pinfo, sipregistrationdata_tree, hf_reload_sipregistration_data_contact_prefs, offset+local_offset, 2, length_field);
1663 destinations_length = tvb_get_ntohs(tvb, offset+local_offset+route_offset);
1664 ti_destination_list = proto_tree_add_item(sipregistrationdata_tree, hf_reload_sipregistration_data_destination_list, tvb,offset+local_offset+route_offset, length_field-route_offset, ENC_NA);
1665 destination_list_tree = proto_item_add_subtree(ti_destination_list, ett_reload_sipregistration_destination_list);
1666 proto_tree_add_item(destination_list_tree, hf_reload_length_uint16, tvb,offset+local_offset+route_offset, 2, ENC_BIG_ENDIAN);
1667 route_offset += 2;
1668 if (destinations_length>0) {
1669 dissect_destination_list(tvb, pinfo, destination_list_tree, offset+local_offset+route_offset,destinations_length, &numDestinations);
1670 }
1671 proto_item_append_text(ti_destination_list, " (Destination<%d>): %d elements", destinations_length,numDestinations);
1672 }
1673 break;
1674 }
1675 }
1676 local_offset += length_field;
1677
1678 return local_offset;
1679 }
1680
1681 static int
dissect_turnserver(tvbuff_t * tvb,proto_tree * tree,guint16 offset,guint16 length)1682 dissect_turnserver(tvbuff_t *tvb, proto_tree *tree, guint16 offset, guint16 length)
1683 {
1684 proto_item *ti_local;
1685 proto_tree *local_tree;
1686 int local_offset = 0;
1687
1688 ti_local = proto_tree_add_item(tree, hf_reload_turnserver, tvb, offset, length, ENC_NA);
1689 local_tree = proto_item_add_subtree(ti_local, ett_reload_turnserver);
1690
1691 proto_tree_add_item(local_tree, hf_reload_turnserver_iteration, tvb,offset,1, ENC_BIG_ENDIAN);
1692 local_offset += 1;
1693 local_offset += dissect_ipaddressport(hf_reload_turnserver_server_address,tvb, local_tree, offset+local_offset);
1694
1695 return local_offset;
1696 }
1697
dissect_redirserviceproviderdata(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1698 static int dissect_redirserviceproviderdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1699 {
1700 proto_item *ti_local;
1701 proto_tree *local_tree;
1702 int local_offset = 0;
1703
1704 ti_local = proto_tree_add_item(tree, hf_reload_redirserviceproviderdata, tvb, offset, length, ENC_NA);
1705 local_tree = proto_item_add_subtree(ti_local, ett_reload_redirserviceproviderdata);
1706
1707 local_offset += dissect_nodeid(hf_reload_redirserviceproviderdata_serviceprovider, tvb, pinfo, local_tree, offset+local_offset, length);
1708 local_offset += dissect_opaque_string(tvb, pinfo, local_tree, hf_reload_redirserviceproviderdata_namespace, offset+local_offset, 2, length-local_offset);
1709 proto_tree_add_item(local_tree, hf_reload_redirserviceproviderdata_level, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
1710 local_offset += 2;
1711 proto_tree_add_item(local_tree, hf_reload_redirserviceproviderdata_node, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
1712
1713 return length;
1714 }
1715
dissect_redirserviceprovider(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)1716 static int dissect_redirserviceprovider(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
1717 {
1718 proto_item *ti_local;
1719 proto_tree *local_tree;
1720 int local_offset = 0;
1721 guint16 length_field;
1722
1723 length_field = tvb_get_ntohs(tvb, offset);
1724
1725 if (2+length_field>length) {
1726 ti_local = proto_tree_add_item(tree, hf_reload_redirserviceprovider, tvb, offset, length, ENC_NA);
1727 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated RedirServiceProvider");
1728 return length;
1729 }
1730
1731 ti_local = proto_tree_add_item(tree, hf_reload_redirserviceprovider, tvb, offset, length_field+2, ENC_NA);
1732 local_tree = proto_item_add_subtree(ti_local, ett_reload_redirserviceprovider);
1733
1734 proto_tree_add_item(local_tree, hf_reload_length_uint16, tvb, offset,2, ENC_BIG_ENDIAN);
1735 local_offset += 2;
1736
1737 dissect_redirserviceproviderdata(tvb, pinfo, local_tree, offset+local_offset, length_field);
1738
1739 return (2+length_field);
1740 }
1741
dissect_datavalue(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,gboolean meta,kind_t * kind)1742 static int dissect_datavalue(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, gboolean meta, kind_t *kind) {
1743 proto_item *ti_datavalue;
1744 proto_tree *datavalue_tree;
1745
1746 if (meta != TRUE) {
1747 guint value_length = tvb_get_ntohl(tvb,offset+1);
1748 int hf = hf_reload_datavalue;
1749
1750 if (anchor >= 0) {
1751 hf = anchor;
1752 }
1753
1754 if (1+4+value_length > length) {
1755 ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1756 expert_add_info_format(pinfo, ti_datavalue, &ei_reload_truncated_field, "Truncated DataValue");
1757 return length;
1758 }
1759
1760 ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset,1+4+value_length, ENC_NA);
1761 datavalue_tree = proto_item_add_subtree(ti_datavalue,ett_reload_datavalue);
1762 proto_tree_add_item(datavalue_tree, hf_reload_datavalue_exists, tvb, offset, 1, ENC_BIG_ENDIAN);
1763 if (kind != NULL) {
1764 switch(kind->id) {
1765
1766 case DATAKINDID_TURNSERVICE:
1767 {
1768 guint32 length_field = tvb_get_ntohl(tvb, offset+1);
1769 proto_tree_add_item(datavalue_tree, hf_reload_length_uint32, tvb, offset+1,4, ENC_BIG_ENDIAN);
1770 if (length_field>0) {
1771 dissect_turnserver(tvb, datavalue_tree, offset+1+4, length_field);
1772 }
1773 }
1774 break;
1775
1776 case DATAKINDID_SIP_REGISTRATION:
1777 {
1778 guint32 length_field = tvb_get_ntohl(tvb, offset+1);
1779 proto_tree_add_item(datavalue_tree, hf_reload_length_uint32, tvb, offset+1,4, ENC_BIG_ENDIAN);
1780 if (length_field>0) {
1781 dissect_sipregistration(tvb, pinfo, datavalue_tree, offset+1+4, length_field);
1782 }
1783 }
1784 break;
1785
1786 case DATAKINDID_CERTIFICATE_BY_NODE:
1787 case DATAKINDID_CERTIFICATE_BY_USER:
1788 {
1789 guint32 length_field = tvb_get_ntohl(tvb, offset+1);
1790 proto_tree_add_item(datavalue_tree, hf_reload_length_uint32, tvb, offset+1,4, ENC_BIG_ENDIAN);
1791 if (length_field>0) {
1792 asn1_ctx_t asn1_ctx;
1793
1794 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1795 dissect_x509af_Certificate(FALSE, tvb, offset + 1 + 4, &asn1_ctx,
1796 datavalue_tree, hf_reload_certificate);
1797 }
1798 }
1799 break;
1800
1801 case DATAKINDID_REDIR:
1802 {
1803 guint32 length_field = tvb_get_ntohl(tvb, offset+1);
1804 proto_tree_add_item(datavalue_tree, hf_reload_length_uint32, tvb, offset+1,4, ENC_BIG_ENDIAN);
1805 if (length_field>0) {
1806 dissect_redirserviceprovider(tvb, pinfo, datavalue_tree, offset+1+4, length_field);
1807 }
1808 }
1809 break;
1810
1811 default:
1812 dissect_opaque(tvb, pinfo, datavalue_tree, hf_reload_datavalue_value, offset +1, 4, length-1);
1813 break;
1814 }
1815 }
1816 else {
1817 dissect_opaque(tvb, pinfo, datavalue_tree, hf_reload_datavalue_value, offset +1, 4, length-1);
1818 }
1819 if (hf == anchor) {
1820 proto_item_append_text(ti_datavalue, " (DataValue)");
1821 }
1822 return (1+4+value_length);
1823 }
1824 else {
1825 /* meta data */
1826 guint hash_length = tvb_get_guint8(tvb, offset +1+4+1);
1827 int hf = hf_reload_metadata;
1828
1829 if (anchor >= 0) {
1830 hf = anchor;
1831 }
1832
1833
1834 if (1+4+1+1+hash_length > length) {
1835 ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1836 expert_add_info_format(pinfo, ti_datavalue, &ei_reload_truncated_field, "Truncated MetaData");
1837 return length;
1838 }
1839
1840 ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset,1+4+1+1+hash_length, ENC_NA);
1841 datavalue_tree = proto_item_add_subtree(ti_datavalue,ett_reload_datavalue);
1842 proto_tree_add_item(datavalue_tree, hf_reload_datavalue_exists, tvb, offset, 1, ENC_BIG_ENDIAN);
1843 proto_tree_add_item(datavalue_tree, hf_reload_metadata_value_length, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1844 proto_tree_add_item(datavalue_tree, hf_reload_hash_algorithm, tvb, offset+1+4, 1, ENC_BIG_ENDIAN);
1845 dissect_opaque(tvb, pinfo, datavalue_tree, hf_reload_metadata_hash_value, offset +1+4+1, 1, length-1-4-1);
1846
1847 if (hf == anchor) {
1848 proto_item_append_text(ti_datavalue, " (MetaData)");
1849 }
1850
1851 return (1+4+1+hash_length);
1852 }
1853 return 0;
1854 }
1855
getDataValueLength(tvbuff_t * tvb,guint16 offset,gboolean meta)1856 static guint getDataValueLength(tvbuff_t *tvb, guint16 offset, gboolean meta) {
1857 if (meta != TRUE) {
1858 guint value_length = tvb_get_ntohl(tvb,offset+1);
1859 return (1+4+value_length);
1860 }
1861 else {
1862 guint hash_length = tvb_get_guint8(tvb, offset +1+4+1);
1863 return (1+4+1+1+hash_length);
1864 }
1865 return 0;
1866 }
1867
dissect_arrayentry(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,gboolean meta,kind_t * kind)1868 static int dissect_arrayentry(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, gboolean meta, kind_t *kind) {
1869 proto_item *ti_arrayentry, *ti_index;
1870 proto_tree *arrayentry_tree;
1871 int data_length = getDataValueLength(tvb, offset+4, meta);
1872 int hf = hf_reload_arrayentry;
1873
1874 if (anchor >= 0) {
1875 hf = anchor;
1876 }
1877
1878 if (4+data_length > length) {
1879 ti_arrayentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1880 expert_add_info_format(pinfo, ti_arrayentry, &ei_reload_truncated_field, "Truncated ArrayEntry");
1881 return length;
1882 }
1883
1884 ti_arrayentry = proto_tree_add_item(tree, hf, tvb, offset,4+data_length, ENC_NA);
1885 arrayentry_tree = proto_item_add_subtree(ti_arrayentry,ett_reload_arrayentry);
1886 ti_index = proto_tree_add_item(arrayentry_tree, hf_reload_arrayentry_index, tvb, offset, 4, ENC_BIG_ENDIAN);
1887 if (0xffffffff == (guint32) tvb_get_ntohl(tvb, offset)) {
1888 proto_item_append_text(ti_index, "(append)");
1889 }
1890 dissect_datavalue(hf_reload_arrayentry_value,tvb, pinfo, arrayentry_tree, offset+4, length-4, meta, kind);
1891
1892 if (hf == anchor) {
1893 proto_item_append_text(ti_arrayentry, " (ArrayEntry)");
1894 }
1895
1896 return (4+data_length);
1897 }
1898
dissect_dictionaryentry(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,gboolean meta,kind_t * kind)1899 static int dissect_dictionaryentry(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, gboolean meta, kind_t *kind) {
1900 proto_item *ti_dictionaryentry;
1901 proto_tree *dictionaryentry_tree;
1902 int local_offset = 0;
1903 guint16 key_length = 0;
1904 int hf = hf_reload_dictionaryentry;
1905
1906 if (anchor >= 0) {
1907 hf = anchor;
1908 }
1909
1910 if (length < 2) {
1911 ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1912 expert_add_info_format(pinfo, ti_dictionaryentry, &ei_reload_truncated_field, "Truncated ArrayEntry");
1913 return length;
1914 }
1915 key_length = tvb_get_ntohs(tvb,offset);
1916
1917
1918 if (length < (key_length +2)) {
1919 ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1920 expert_add_info_format(pinfo, ti_dictionaryentry, &ei_reload_truncated_field, "Truncated ArrayEntry");
1921 return length;
1922 }
1923
1924 {
1925 int data_length = getDataValueLength(tvb, offset+2+key_length, meta);
1926 if (length < (key_length+2+data_length)) {
1927 ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
1928 }
1929 else {
1930 ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, 2+key_length+1+4+data_length, ENC_NA);
1931 }
1932 }
1933
1934
1935 dictionaryentry_tree = proto_item_add_subtree(ti_dictionaryentry,ett_reload_dictionaryentry);
1936
1937 if (hf == anchor) {
1938 proto_item_append_text(ti_dictionaryentry, " (DictionaryEntry)");
1939 }
1940
1941 if (kind != NULL) {
1942 switch(kind->id) {
1943 case DATAKINDID_SIP_REGISTRATION:
1944 case DATAKINDID_REDIR:
1945 {
1946 proto_item *ti_key;
1947 proto_tree *key_tree;
1948 ti_key = proto_tree_add_item(dictionaryentry_tree, hf_reload_dictionarykey, tvb, offset, 2+key_length, ENC_NA);
1949 key_tree = proto_item_add_subtree(ti_key,ett_reload_dictionaryentry_key);
1950 proto_tree_add_item(key_tree, hf_reload_length_uint16, tvb, offset, 2, ENC_BIG_ENDIAN);
1951 local_offset += 2;
1952 local_offset+= dissect_nodeid(-1, tvb, pinfo, key_tree, offset+2, key_length);
1953 }
1954 break;
1955
1956 default:
1957 local_offset += dissect_opaque(tvb, pinfo, dictionaryentry_tree, hf_reload_dictionarykey, offset, 2, length);
1958 break;
1959 }
1960 }
1961 else {
1962 local_offset +=
1963 dissect_opaque(tvb, pinfo, dictionaryentry_tree, hf_reload_dictionarykey, offset, 2, length);
1964 }
1965
1966 local_offset += dissect_datavalue(hf_reload_dictionary_value,tvb, pinfo, dictionaryentry_tree, offset+local_offset, length-local_offset, meta, kind);
1967
1968 return (local_offset);
1969 }
1970
1971 static int
dissect_signature(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset)1972 dissect_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset)
1973 {
1974 int local_offset = 0;
1975 proto_item *ti_signature;
1976 proto_tree *signature_tree;
1977 guint16 signeridentityvalue_length;
1978 guint16 signaturevalue_length;
1979
1980
1981 signeridentityvalue_length = tvb_get_ntohs(tvb, offset +2+1);
1982 signaturevalue_length = tvb_get_ntohs(tvb, offset + 2 + 1 + 2+ signeridentityvalue_length);
1983 ti_signature = proto_tree_add_item(tree,
1984 hf_reload_signature, tvb, offset,
1985 2 +/* SignatureAndHashAlgorithm */
1986 1 + 2 + signeridentityvalue_length +/* SignatureIdenty length*/
1987 2 + signaturevalue_length,
1988 ENC_NA);
1989
1990 signature_tree = proto_item_add_subtree(ti_signature, ett_reload_signature);
1991
1992 {
1993 proto_item *ti_signatureandhashalgorithm;
1994 proto_tree *signatureandhashalgorithm_tree;
1995 ti_signatureandhashalgorithm = proto_tree_add_item(signature_tree, hf_reload_signatureandhashalgorithm, tvb, offset, 2, ENC_NA);
1996 signatureandhashalgorithm_tree = proto_item_add_subtree( ti_signatureandhashalgorithm, ett_reload_signatureandhashalgorithm);
1997 proto_tree_add_item(signatureandhashalgorithm_tree, hf_reload_hash_algorithm, tvb, offset, 1, ENC_BIG_ENDIAN);
1998 local_offset += 1;
1999 proto_tree_add_item(signatureandhashalgorithm_tree, hf_reload_signature_algorithm, tvb, offset + local_offset, 1, ENC_BIG_ENDIAN);
2000 local_offset += 1;
2001 }
2002 /* Signeridentity */
2003 {
2004 proto_item *ti_signeridentity;
2005 proto_tree *signeridentity_tree;
2006 guint8 identity_type;
2007 ti_signeridentity = proto_tree_add_item(signature_tree,
2008 hf_reload_signeridentity,
2009 tvb, offset+local_offset,
2010 1 + 2 + signeridentityvalue_length,
2011 ENC_NA);
2012 signeridentity_tree = proto_item_add_subtree(ti_signeridentity, ett_reload_signeridentity);
2013 identity_type = tvb_get_guint8(tvb, offset + local_offset);
2014 proto_tree_add_item(signeridentity_tree, hf_reload_signeridentity_type, tvb,
2015 offset + local_offset, 1, ENC_BIG_ENDIAN);
2016 local_offset += 1;
2017 proto_tree_add_uint(signeridentity_tree, hf_reload_length_uint16, tvb,
2018 offset + local_offset, 2, signeridentityvalue_length);
2019 local_offset += 2;
2020 {
2021 proto_item *ti_signeridentity_identity;
2022 proto_tree * signeridentity_identity_tree;
2023 ti_signeridentity_identity = proto_tree_add_item(signeridentity_tree,
2024 hf_reload_signeridentity_identity,
2025 tvb, offset+local_offset,
2026 signeridentityvalue_length,
2027 ENC_NA);
2028 signeridentity_identity_tree = proto_item_add_subtree(ti_signeridentity_identity, ett_reload_signeridentity_identity);
2029 proto_item_append_text(ti_signeridentity_identity, " (SignerIdentityValue[%d])",signeridentityvalue_length);
2030 {
2031 proto_item *ti_signeridentityvalue;
2032 proto_tree *signeridentityvalue_tree;
2033 if (identity_type == SIGNERIDENTITYTYPE_CERTHASH || identity_type == SIGNERIDENTITYTYPE_CERTHASHNODEID) {
2034 guint8 certificate_hash_length;
2035
2036 certificate_hash_length = tvb_get_guint8(tvb, offset + local_offset + 1);
2037 if (1 + 1 + certificate_hash_length > signeridentityvalue_length) {
2038 expert_add_info_format(pinfo, ti_signeridentity, &ei_reload_truncated_field, "Truncated signature identity value");
2039 }
2040 else {
2041 ti_signeridentityvalue= proto_tree_add_item(signeridentity_identity_tree,
2042 hf_reload_signeridentity_value,
2043 tvb, offset + local_offset,
2044 1 + 1 + certificate_hash_length,
2045 ENC_NA);
2046 signeridentityvalue_tree = proto_item_add_subtree(ti_signeridentityvalue, ett_reload_signeridentity_value);
2047 proto_tree_add_item(signeridentityvalue_tree, hf_reload_signeridentity_value_hash_alg, tvb,
2048 offset + local_offset, 1, ENC_BIG_ENDIAN);
2049 dissect_opaque(tvb, pinfo, signeridentityvalue_tree,
2050 (identity_type == SIGNERIDENTITYTYPE_CERTHASH) ?
2051 hf_reload_signeridentity_value_certificate_hash:
2052 hf_reload_signeridentity_value_certificate_node_id_hash,
2053 offset + local_offset +1, 1, -1);
2054 }
2055 }
2056 else {
2057 expert_add_info(pinfo, signeridentity_identity_tree, &ei_reload_identity_type_unknown);
2058 }
2059 }
2060 }
2061 local_offset += signeridentityvalue_length;
2062 }
2063 local_offset += dissect_opaque(tvb, pinfo, signature_tree, hf_reload_signature_value, offset + local_offset, 2, -1);
2064
2065 return local_offset;
2066
2067 }
2068
2069
2070 static int
dissect_storeddata(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,kind_t * kind,gboolean meta)2071 dissect_storeddata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, kind_t *kind, gboolean meta)
2072 {
2073 proto_item *ti_storeddata;
2074 proto_tree *storeddata_tree;
2075 guint32 storeddata_length;
2076 guint32 local_offset;
2077
2078 int hf = hf_reload_storeddata;
2079
2080 if (meta == TRUE) {
2081 hf = hf_reload_storedmetadata;
2082 }
2083
2084 storeddata_length = tvb_get_ntohl(tvb, offset);
2085
2086 if (storeddata_length + 4 > length) {
2087 ti_storeddata = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
2088 expert_add_info_format(pinfo, ti_storeddata, &ei_reload_truncated_field, "Truncated StoredData");
2089 return length;
2090 }
2091
2092 local_offset = 0;
2093 ti_storeddata = proto_tree_add_item(tree, hf, tvb, offset, 4 + storeddata_length, ENC_NA);
2094 storeddata_tree = proto_item_add_subtree(ti_storeddata, ett_reload_storeddata);
2095
2096 proto_tree_add_uint(storeddata_tree, hf_reload_length_uint32, tvb, offset, 4, storeddata_length);
2097 local_offset += 4;
2098 {
2099 guint64 storage_time;
2100 guint32 remaining_ms;
2101 time_t storage_time_sec;
2102 nstime_t l_nsTime;
2103
2104 storage_time = tvb_get_ntoh64(tvb, offset+local_offset);
2105 storage_time_sec = (time_t)(storage_time/1000);
2106 remaining_ms = (guint32) (storage_time % 1000);
2107
2108 l_nsTime.secs = storage_time_sec;
2109 l_nsTime.nsecs = remaining_ms*1000*1000;
2110
2111 proto_tree_add_time(storeddata_tree, hf_reload_storeddata_storage_time, tvb, offset + local_offset, 8, &l_nsTime);
2112 }
2113 local_offset += 8;
2114 proto_tree_add_item(storeddata_tree, hf_reload_storeddata_lifetime, tvb, offset + local_offset, 4, ENC_BIG_ENDIAN);
2115 local_offset += 4;
2116 if ((NULL != kind) && (kind->id != DATAKINDID_INVALID)) {
2117 switch(kind->data_model) {
2118 case DATAMODEL_SINGLE:
2119 local_offset += dissect_datavalue(hf_reload_value,tvb, pinfo, storeddata_tree, offset+local_offset, (storeddata_length-local_offset+4), meta, kind);
2120 break;
2121 case DATAMODEL_ARRAY:
2122 local_offset += dissect_arrayentry(hf_reload_value,tvb, pinfo, storeddata_tree, offset+local_offset, (storeddata_length-local_offset+4), meta, kind);
2123 break;
2124 case DATAMODEL_DICTIONARY:
2125 local_offset += dissect_dictionaryentry(hf_reload_value,tvb, pinfo, storeddata_tree, offset+local_offset, (storeddata_length-local_offset+4), meta, kind);
2126 break;
2127 default:
2128 expert_add_info(pinfo, ti_storeddata, &ei_reload_unknown_data_model);
2129 return (storeddata_length + 4);
2130 }
2131 if (TRUE != meta) {
2132 dissect_signature(tvb, pinfo, storeddata_tree, offset +local_offset);
2133 }
2134 }
2135 return (storeddata_length + 4);
2136 }
2137
2138
2139
2140 static int
dissect_kindid(int anchor,tvbuff_t * tvb,proto_tree * tree,guint16 offset,kind_t ** kind)2141 dissect_kindid(int anchor, tvbuff_t *tvb, proto_tree *tree, guint16 offset, kind_t **kind)
2142 {
2143 proto_item *ti_kindid;
2144 guint32 kindid = 0;
2145 int hf = hf_reload_kindid;
2146
2147 if (anchor >= 0) {
2148 hf = anchor;
2149 }
2150
2151 *kind = NULL;
2152
2153 kindid = tvb_get_ntohl(tvb, offset);
2154 *kind = getKindFromId(kindid);
2155 ti_kindid = proto_tree_add_item(tree, hf, tvb, offset, 4, ENC_BIG_ENDIAN);
2156 if ((NULL != (*kind)) && ((*kind)->name != NULL)) {
2157 proto_item_append_text(ti_kindid, " (%s)", (*kind)->name);
2158 }
2159
2160 return 4;
2161 }
2162
2163 static int
dissect_kinddata(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,gboolean meta)2164 dissect_kinddata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, gboolean meta)
2165 {
2166 proto_item *ti_kinddata;
2167 proto_item *kinddata_tree;
2168 guint32 values_length;
2169 guint32 local_offset = 0;
2170 kind_t *kind;
2171 int hf = hf_reload_kinddata;
2172 int nValues = 0;
2173
2174 if (meta) {
2175 hf = hf_reload_statkindresponse;
2176 }
2177
2178 values_length = tvb_get_ntohl(tvb, offset + 4 + 8);
2179 if (12 + values_length > length) {
2180 ti_kinddata = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
2181 expert_add_info_format(pinfo, ti_kinddata, &ei_reload_truncated_field, "Truncated kind data");
2182 return length;
2183 }
2184 ti_kinddata = proto_tree_add_item(tree, hf, tvb, offset, 16+values_length, ENC_NA);
2185 kinddata_tree = proto_item_add_subtree(ti_kinddata, ett_reload_kinddata);
2186
2187 local_offset += dissect_kindid(hf_reload_kinddata_kind,tvb, kinddata_tree, offset+local_offset, &kind);
2188
2189 proto_tree_add_item(kinddata_tree, hf_reload_generation_counter, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
2190 local_offset += 8;
2191 {
2192 gint32 values_offset = 0;
2193 guint32 values_increment;
2194 proto_item *ti_values;
2195 proto_tree *values_tree;
2196
2197 ti_values = proto_tree_add_item(kinddata_tree, hf_reload_values, tvb, offset+local_offset, 4+values_length, ENC_NA);
2198 values_tree = proto_item_add_subtree(ti_values, ett_reload_values);
2199 if (meta) {
2200 proto_item_append_text(ti_values, " (StoredMetaData<%d>)", values_length);
2201 } else {
2202 proto_item_append_text(ti_values, " (StoredData<%d>)", values_length);
2203 }
2204
2205 proto_tree_add_uint(values_tree, hf_reload_length_uint32, tvb, offset +local_offset, 4, values_length);
2206 local_offset += 4;
2207
2208 while (values_offset >= 0 && (guint32)values_offset < values_length) {
2209 values_increment = dissect_storeddata(tvb, pinfo, values_tree, offset+local_offset+values_offset, values_length - values_offset, kind, meta);
2210 if (values_increment == 0) {
2211 break;
2212 }
2213 nValues++;
2214 values_offset += values_increment;
2215 }
2216 proto_item_append_text(ti_values, ": %d elements", nValues);
2217 }
2218
2219 local_offset += values_length;
2220 return local_offset;
2221 }
2222
dissect_nodeid_list(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,int hf)2223 static int dissect_nodeid_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, int hf)
2224 {
2225 guint16 list_length;
2226 guint16 local_offset = 0;
2227 gint32 list_offset = 0;
2228 guint16 list_increment = 0;
2229 int nNodeIds = 0;
2230 proto_item *ti_local;
2231 proto_tree *local_tree;
2232
2233 list_length= (guint16) tvb_get_ntohs(tvb, offset);
2234
2235 if (list_length+2>length) {
2236 ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
2237 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated NodeId list");
2238 }
2239 ti_local = proto_tree_add_item(tree, hf, tvb, offset, list_length+2, ENC_NA);
2240 proto_item_append_text(ti_local, " (NodeId<%d>)", list_length);
2241
2242 local_tree = proto_item_add_subtree(ti_local, ett_reload_nodeid_list);
2243
2244 local_offset += dissect_length(tvb, local_tree, offset, 2);
2245 while (list_offset >= 0 && list_offset < list_length) {
2246 dissect_nodeid(-1, tvb, pinfo, local_tree, offset+local_offset+list_offset,list_length-list_offset);
2247 list_increment = reload_nodeid_length;
2248 if (list_increment <= 0) break;
2249 list_offset += list_increment;
2250 nNodeIds++;
2251 }
2252 proto_item_append_text(ti_local, ":%d elements", nNodeIds);
2253
2254 return (list_length+2);
2255 }
2256
2257
2258 static int
dissect_storekindresponse(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2259 dissect_storekindresponse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2260 {
2261 proto_item *ti_local;
2262 proto_tree *local_tree;
2263 guint16 local_offset = 0;
2264 guint16 local_length = 0;
2265 guint16 replicas_length;
2266 kind_t *kind;
2267
2268 replicas_length = tvb_get_ntohs(tvb, offset+4+8);
2269 local_length = 4+8+2+replicas_length;
2270
2271 if (length < local_length) {
2272 ti_local = proto_tree_add_item(tree, hf_reload_storekindresponse, tvb, offset, length, ENC_NA);
2273 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated StoreKindResponse");
2274 return length;
2275 }
2276 ti_local = proto_tree_add_item(tree, hf_reload_storekindresponse, tvb, offset, 4+8+2+replicas_length, ENC_NA);
2277 local_tree = proto_item_add_subtree(ti_local, ett_reload_storekindresponse);
2278
2279 local_offset += dissect_kindid(hf_reload_kinddata_kind,tvb, local_tree, offset+local_offset, &kind);
2280 proto_tree_add_item(local_tree, hf_reload_generation_counter, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
2281 local_offset += 8;
2282 local_offset += dissect_nodeid_list(tvb, pinfo, local_tree, offset+local_offset, local_length-local_offset, hf_reload_replicas);
2283
2284 return local_offset;
2285 }
2286
2287 static int
dissect_storeans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2288 dissect_storeans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2289 {
2290 proto_item *ti_local, *ti_kind_responses;
2291 proto_tree *local_tree, *kind_responses_tree;
2292 guint16 local_offset = 0;
2293 guint16 kind_responses_length;
2294 gint32 kind_responses_offset = 0;
2295 int nKindResponses = 0;
2296
2297 ti_local = proto_tree_add_item(tree, hf_reload_storeans, tvb, offset, length, ENC_NA);
2298 local_tree = proto_item_add_subtree(ti_local, ett_reload_storeans);
2299 kind_responses_length = tvb_get_ntohs(tvb, offset);
2300 ti_kind_responses = proto_tree_add_item(local_tree, hf_reload_storeans_kind_responses, tvb, offset, 2+kind_responses_length, ENC_NA);
2301 kind_responses_tree = proto_item_add_subtree(ti_kind_responses, ett_reload_storeans_kind_responses);
2302 proto_item_append_text(ti_kind_responses, " (StoreKindResponse<%d>)", kind_responses_length);
2303
2304 proto_tree_add_item(kind_responses_tree, hf_reload_length_uint16, tvb, offset, 2, ENC_BIG_ENDIAN);
2305 local_offset += 2;
2306 while (kind_responses_offset >=0 && kind_responses_offset < kind_responses_length) {
2307 int local_increment = dissect_storekindresponse(tvb, pinfo, kind_responses_tree, offset+local_offset+kind_responses_offset, kind_responses_length-kind_responses_offset);
2308 if (local_increment <= 0) break;
2309 kind_responses_offset += local_increment;
2310 nKindResponses++;
2311 }
2312 local_offset += kind_responses_length;
2313 proto_item_append_text(ti_kind_responses, ": %d elements", nKindResponses);
2314
2315 return local_offset;
2316 }
2317
2318 static int
dissect_storereq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2319 dissect_storereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2320 {
2321 proto_item *ti_storereq;
2322 proto_tree *storereq_tree;
2323 guint32 local_offset = 0;
2324 guint32 kind_data_length;
2325
2326
2327 local_offset += tvb_get_guint8(tvb, offset) + 1; /* resource id length */
2328 if (local_offset > length) {
2329 ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA);
2330 expert_add_info_format(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: resource too long");
2331 return length;
2332 }
2333
2334 local_offset += 1; /* replica_num */
2335 if (local_offset > length) {
2336 ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA);
2337 expert_add_info_format(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: no room for replica_number");
2338 return length;
2339 }
2340
2341 kind_data_length = tvb_get_ntohl(tvb, offset + local_offset);
2342 local_offset += 4;
2343 if (local_offset + kind_data_length > length) {
2344 ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA);
2345 expert_add_info_format(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: kind_data too long");
2346 return length;
2347 }
2348 local_offset += kind_data_length;
2349
2350 ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, local_offset, ENC_NA);
2351 storereq_tree = proto_item_add_subtree(ti_storereq, ett_reload_storereq);
2352
2353 /* Parse from start */
2354 local_offset = 0;
2355 local_offset += dissect_resourceid(hf_reload_resource, tvb, pinfo, storereq_tree, offset+local_offset, length);
2356
2357 proto_tree_add_item(storereq_tree, hf_reload_store_replica_num, tvb, offset + local_offset, 1, ENC_BIG_ENDIAN);
2358 local_offset += 1;
2359
2360
2361 {
2362 gint32 kind_data_offset = 0;
2363 guint32 kind_data_increment;
2364 proto_item *ti_kind_data;
2365 proto_tree *kind_data_tree;
2366 int nKindDatas = 0;
2367
2368 ti_kind_data = proto_tree_add_item(storereq_tree, hf_reload_store_kind_data, tvb, offset+local_offset,4+kind_data_length, ENC_NA);
2369 proto_item_append_text(ti_kind_data, " (StoreKindData<%d>)", kind_data_length);
2370 kind_data_tree = proto_item_add_subtree(ti_kind_data, ett_reload_store_kind_data);
2371 proto_tree_add_item(kind_data_tree, hf_reload_length_uint32, tvb, offset + local_offset, 4, ENC_BIG_ENDIAN);
2372 local_offset += 4;
2373
2374 while (kind_data_offset >= 0 && (guint32)kind_data_offset < kind_data_length) {
2375 kind_data_increment = dissect_kinddata(tvb, pinfo, kind_data_tree, offset+local_offset+kind_data_offset, kind_data_length - kind_data_offset, FALSE);
2376 if (kind_data_increment == 0) {
2377 break;
2378 }
2379 nKindDatas++;
2380 kind_data_offset += kind_data_increment;
2381 }
2382
2383 proto_item_append_text(ti_kind_data, ": %d elements", nKindDatas);
2384 }
2385 local_offset += kind_data_length;
2386
2387 return local_offset;
2388 }
2389
dissect_arrayrange(tvbuff_t * tvb,proto_tree * tree,guint16 offset)2390 static int dissect_arrayrange(tvbuff_t *tvb, proto_tree *tree, guint16 offset) {
2391 proto_item *ti;
2392 gint32 first;
2393 gint32 last;
2394
2395 ti = proto_tree_add_item(tree, hf_reload_arrayrange, tvb, offset, (16), ENC_NA);
2396 first = tvb_get_ntohl(tvb, offset);
2397 last = tvb_get_ntohl(tvb, offset+4);
2398
2399 proto_item_append_text(ti, " [%d-", first);
2400 if ((guint32)last != 0xFFFFFFFF) {
2401 proto_item_append_text(ti, "%d]", last);
2402 }
2403 else {
2404 proto_item_append_text(ti, "end]");
2405 }
2406 return 8;
2407
2408 }
2409 static int
dissect_storeddataspecifier(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2410 dissect_storeddataspecifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2411 {
2412 guint16 length_field, local_offset = 0;
2413 proto_item *ti_storeddataspecifier;
2414 proto_tree *storeddataspecifier_tree;
2415 kind_t *kind = NULL;
2416
2417 length_field = tvb_get_ntohs(tvb, offset+4+8);
2418 if ((length_field + 4 + 8 + 2) > length) {
2419 ti_storeddataspecifier = proto_tree_add_item(tree, hf_reload_storeddataspecifier, tvb, offset, length, ENC_NA);
2420 expert_add_info_format(pinfo, ti_storeddataspecifier, &ei_reload_truncated_field, "Truncated StoredDataSpecifier");
2421 return length;
2422 }
2423
2424 ti_storeddataspecifier = proto_tree_add_item(tree, hf_reload_storeddataspecifier, tvb, offset, (length_field + 4 + 8 +2), ENC_NA);
2425 storeddataspecifier_tree = proto_item_add_subtree(ti_storeddataspecifier, ett_reload_storeddataspecifier);
2426
2427 local_offset += dissect_kindid(hf_reload_kinddata_kind,tvb,storeddataspecifier_tree, offset, &kind);
2428 proto_tree_add_item(storeddataspecifier_tree, hf_reload_generation_counter, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
2429 local_offset += 8;
2430 proto_tree_add_item(storeddataspecifier_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
2431 local_offset += 2;
2432
2433 if ((kind != NULL) && (kind->id != DATAKINDID_INVALID)) {
2434 switch(kind->data_model) {
2435 case DATAMODEL_ARRAY:
2436 {
2437 proto_item *ti_indices;
2438 proto_tree *indices_tree;
2439 gint32 indices_offset = 0;
2440 guint16 indices_length = tvb_get_ntohs(tvb, offset+local_offset);
2441 int nIndices = 0;
2442 ti_indices = proto_tree_add_item(storeddataspecifier_tree, hf_reload_storeddataspecifier_indices,
2443 tvb, offset+local_offset, 2+indices_length, ENC_NA);
2444 proto_item_append_text(ti_indices, " (ArrayRange<%d>)", indices_length);
2445 indices_tree = proto_item_add_subtree(ti_indices, ett_reload_storeddataspecifier_indices);
2446 proto_tree_add_item(indices_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
2447 local_offset += 2;
2448 while (indices_offset >= 0 && indices_offset < indices_length) {
2449 indices_offset += dissect_arrayrange(tvb, indices_tree, offset + local_offset + indices_offset);
2450 nIndices++;
2451 }
2452 proto_item_append_text(ti_indices, ": %d elements", nIndices);
2453 }
2454 break;
2455
2456 case DATAMODEL_DICTIONARY:
2457 {
2458 proto_item *ti_keys;
2459 proto_tree *keys_tree;
2460 gint32 keys_offset = 0;
2461 guint16 keys_length = tvb_get_ntohs(tvb, offset+local_offset);
2462 int nKeys = 0;
2463 ti_keys = proto_tree_add_item(tree, hf_reload_storeddataspecifier_keys, tvb, offset+local_offset, 2+keys_length, ENC_NA);
2464 keys_tree = proto_item_add_subtree(ti_keys, ett_reload_storeddataspecifier_keys);
2465 while (keys_offset >= 0 && keys_offset < keys_length) {
2466 guint32 local_increment;
2467 local_increment = dissect_opaque(tvb, pinfo, keys_tree, hf_reload_dictionarykey, offset, 2, keys_length-keys_offset);
2468 if (local_increment == 0) break;
2469 keys_offset += local_increment;
2470 nKeys++;
2471 }
2472 proto_item_append_text(ti_keys, "(%d keys)", nKeys);
2473
2474 }
2475 break;
2476
2477 default:
2478 break;
2479 }
2480 }
2481 return (length_field + 4 + 8 +2);
2482 }
2483
2484
2485 static int
dissect_fetchreq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length,gboolean meta)2486 dissect_fetchreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length, gboolean meta)
2487 {
2488 proto_item *ti_fetchreq;
2489 proto_item *ti_specifiers;
2490 proto_tree *fetchreq_tree;
2491 proto_tree *specifiers_tree;
2492 guint16 resourceid_length;
2493 guint16 specifiers_length;
2494 gint32 specifiers_offset = 0;
2495 int nSpecifiers = 0;
2496 guint16 local_offset = 0;
2497 guint16 local_length = 0;
2498 int hf = hf_reload_fetchreq;
2499
2500 if (meta == TRUE) {
2501 hf = hf_reload_statreq;
2502 }
2503
2504 resourceid_length = tvb_get_guint8(tvb,offset);
2505 specifiers_length = tvb_get_ntohs(tvb, offset+1+resourceid_length);
2506
2507 if (1+ resourceid_length+ 2 + specifiers_length > length) {
2508 ti_fetchreq = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
2509 expert_add_info_format(pinfo, ti_fetchreq, &ei_reload_truncated_field, "Truncated FetchReq");
2510 return length;
2511 }
2512 local_length = 1+ resourceid_length+ 2 + specifiers_length;
2513 ti_fetchreq = proto_tree_add_item(tree, hf, tvb, offset, local_length, ENC_NA);
2514 fetchreq_tree = proto_item_add_subtree(ti_fetchreq, ett_reload_fetchreq);
2515
2516 local_offset +=
2517 dissect_resourceid(hf_reload_resource, tvb, pinfo, fetchreq_tree, offset, local_length);
2518
2519 ti_specifiers = proto_tree_add_item(fetchreq_tree, hf_reload_fetchreq_specifiers, tvb, offset+local_offset, 2+specifiers_length, ENC_NA);
2520 specifiers_tree = proto_item_add_subtree(ti_specifiers, ett_reload_fetchreq_specifiers);
2521 proto_item_append_text(ti_specifiers, "(StoredDataSpecifier<%d>)", specifiers_length);
2522 proto_tree_add_item(specifiers_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
2523 local_offset += 2;
2524
2525 while (specifiers_offset >= 0 && specifiers_offset < specifiers_length) {
2526 guint32 specifiers_increment;
2527 specifiers_increment = dissect_storeddataspecifier(tvb, pinfo, specifiers_tree, offset+local_offset+specifiers_offset, specifiers_length-specifiers_offset);
2528 if (specifiers_increment == 0) {
2529 break;
2530 }
2531 nSpecifiers++;
2532 specifiers_offset += specifiers_increment;
2533 }
2534 proto_item_append_text(ti_specifiers, ": %d elements", nSpecifiers);
2535
2536 return (1+ resourceid_length+ 2 + specifiers_length);
2537 }
2538
2539
2540 static int
dissect_fetchans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2541 dissect_fetchans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2542 {
2543 proto_item *ti_fetchans;
2544 proto_tree *fetchans_tree;
2545 guint32 kind_responses_length;
2546 guint32 kind_responses_offset = 0;
2547
2548 kind_responses_length = tvb_get_ntohl(tvb, offset);
2549 if (4 + kind_responses_length > length) {
2550 ti_fetchans = proto_tree_add_item(tree, hf_reload_fetchans, tvb, offset, length, ENC_NA);
2551 expert_add_info_format(pinfo, ti_fetchans, &ei_reload_truncated_field, "Truncated FetchAns");
2552 return length;
2553 }
2554 ti_fetchans = proto_tree_add_item(tree, hf_reload_fetchans, tvb, offset, 4 + kind_responses_length, ENC_NA);
2555 fetchans_tree = proto_item_add_subtree(ti_fetchans, ett_reload_fetchans);
2556
2557 proto_tree_add_uint(fetchans_tree, hf_reload_length_uint32, tvb, offset, 4, kind_responses_length);
2558
2559 while (kind_responses_offset < kind_responses_length) {
2560 guint32 kind_responses_increment;
2561 kind_responses_increment = dissect_kinddata(tvb, pinfo, fetchans_tree, offset + 4 + kind_responses_offset, kind_responses_length - kind_responses_offset, FALSE);
2562 if (kind_responses_increment == 0) {
2563 break;
2564 }
2565 kind_responses_offset += kind_responses_increment;
2566 }
2567
2568 return 4 + kind_responses_length;
2569 }
2570
2571
2572 static int
dissect_statans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2573 dissect_statans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2574 {
2575 proto_item *ti_statans;
2576 proto_tree *statans_tree;
2577 guint32 kind_responses_length;
2578 guint32 kind_responses_offset = 0;
2579 int nResponses = 0;
2580
2581 kind_responses_length = tvb_get_ntohl(tvb, offset);
2582
2583 if (kind_responses_length > G_MAXUINT16 || 4 + kind_responses_length > length) {
2584 ti_statans = proto_tree_add_item(tree, hf_reload_statans, tvb, offset, length, ENC_NA);
2585 expert_add_info_format(pinfo, ti_statans, &ei_reload_truncated_field, "Truncated StatAns");
2586 return length;
2587 }
2588 ti_statans = proto_tree_add_item(tree, hf_reload_statans, tvb, offset, 4 + kind_responses_length, ENC_NA);
2589 proto_item_append_text(ti_statans, " (StatKindResponse<%d>)", kind_responses_length);
2590 statans_tree = proto_item_add_subtree(ti_statans, ett_reload_statans);
2591
2592 proto_tree_add_uint(statans_tree, hf_reload_length_uint32, tvb, offset, 4, kind_responses_length);
2593
2594
2595 while (kind_responses_offset < kind_responses_length) {
2596 guint32 kind_responses_increment;
2597 kind_responses_increment = dissect_kinddata(tvb, pinfo, statans_tree, offset + 4 + kind_responses_offset, kind_responses_length - kind_responses_offset, TRUE);
2598 if (kind_responses_increment == 0) {
2599 break;
2600 }
2601 nResponses++;
2602 kind_responses_offset += kind_responses_increment;
2603 }
2604
2605 proto_item_append_text(ti_statans, ": %d elements", nResponses);
2606
2607 return 4 + kind_responses_length;
2608 }
2609
2610
2611 static int
dissect_chordupdate(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2612 dissect_chordupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2613 {
2614 proto_item *ti_chordupdate;
2615 proto_tree *chordupdate_tree;
2616 guint16 local_offset = 0;
2617 guint8 type;
2618
2619 ti_chordupdate = proto_tree_add_item(tree, hf_reload_chordupdate, tvb, offset, length, ENC_NA);
2620 chordupdate_tree = proto_item_add_subtree(ti_chordupdate, ett_reload_chordupdate);
2621
2622 proto_tree_add_item(chordupdate_tree, hf_reload_uptime, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
2623 local_offset += 4;
2624 type = tvb_get_guint8(tvb, offset + local_offset);
2625 proto_tree_add_uint(chordupdate_tree, hf_reload_chordupdate_type, tvb, offset+local_offset, 1, type);
2626 local_offset += 1;
2627
2628 switch(type) {
2629 case CHORDUPDATETYPE_NEIGHBORS:
2630 local_offset += dissect_nodeid_list(tvb, pinfo, chordupdate_tree, offset+local_offset, length-local_offset, hf_reload_chordupdate_predecessors);
2631 local_offset += dissect_nodeid_list(tvb, pinfo, chordupdate_tree, offset+local_offset, length-local_offset, hf_reload_chordupdate_successors);
2632 break;
2633
2634 case CHORDUPDATETYPE_FULL:
2635 local_offset += dissect_nodeid_list(tvb, pinfo, chordupdate_tree, offset+local_offset, length-local_offset, hf_reload_chordupdate_predecessors);
2636 local_offset += dissect_nodeid_list(tvb, pinfo, chordupdate_tree, offset+local_offset, length-local_offset, hf_reload_chordupdate_successors);
2637 local_offset += dissect_nodeid_list(tvb, pinfo, chordupdate_tree, offset+local_offset, length-local_offset, hf_reload_chordupdate_fingers);
2638 break;
2639
2640 default:
2641 break;
2642 }
2643 return local_offset;
2644 }
2645
2646
2647 static int
dissect_chordroutequeryans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2648 dissect_chordroutequeryans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2649 {
2650 proto_item *ti_chordroutequeryans;
2651 proto_tree *chordroutequeryans_tree;
2652
2653 ti_chordroutequeryans = proto_tree_add_item(tree, hf_reload_chordroutequeryans, tvb, offset, length, ENC_NA);
2654 chordroutequeryans_tree = proto_item_add_subtree(ti_chordroutequeryans, ett_reload_chordroutequeryans);
2655 dissect_nodeid(hf_reload_chordroutequeryans_next_peer, tvb, pinfo, chordroutequeryans_tree, offset, length);
2656
2657 return length;
2658 }
2659
2660 static int
dissect_chordleavedata(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2661 dissect_chordleavedata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2662 {
2663 proto_item *ti_local;
2664 proto_tree *local_tree;
2665 guint16 local_offset = 0;
2666 guint8 type;
2667
2668 ti_local = proto_tree_add_item(tree, hf_reload_chordleave, tvb, offset, length, ENC_NA);
2669 local_tree = proto_item_add_subtree(ti_local, ett_reload_chordleave);
2670
2671 type = tvb_get_guint8(tvb, offset + local_offset);
2672 proto_tree_add_uint(local_tree, hf_reload_chordleave_type, tvb, offset+local_offset, 1, type);
2673 local_offset += 1;
2674
2675 switch(type) {
2676 case CHORDLEAVETYPE_FROM_SUCC:
2677 local_offset += dissect_nodeid_list(tvb, pinfo, local_tree, offset+local_offset, length-local_offset, hf_reload_chordleave_successors);
2678 break;
2679
2680 case CHORDLEAVETYPE_FROM_PRED:
2681 local_offset += dissect_nodeid_list(tvb, pinfo, local_tree, offset+local_offset, length-local_offset, hf_reload_chordleave_predecessors);
2682 break;
2683
2684 default:
2685 break;
2686 }
2687 return local_offset;
2688 }
2689
dissect_kindid_list(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2690 static int dissect_kindid_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2691 {
2692 proto_item *ti_local;
2693 proto_tree *local_tree;
2694 int kinds_length = 0;
2695 int kinds_offset = 0;
2696 int nKinds = 0;
2697
2698 kinds_length = tvb_get_guint8(tvb, offset);
2699
2700 if ((guint16)length<kinds_length+1) {
2701 ti_local = proto_tree_add_item(tree, hf_reload_kindid_list, tvb, offset, length, ENC_NA);
2702 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated kinds list");
2703 }
2704 ti_local = proto_tree_add_item(tree, hf_reload_kindid_list, tvb, offset, length, ENC_NA);
2705 local_tree = proto_item_add_subtree(ti_local, ett_reload_kindid_list);
2706 proto_item_append_text(ti_local, "(KindId<%d>)", kinds_length);
2707
2708 dissect_length(tvb, local_tree, offset, 1);
2709
2710 while (kinds_offset < kinds_length) {
2711 kind_t *kind;
2712 int local_increment = dissect_kindid(-1,tvb, local_tree,offset+1+kinds_offset, &kind);
2713 if (local_increment <= 0) break;
2714 kinds_offset += local_increment;
2715 nKinds++;
2716 }
2717 proto_item_append_text(ti_local, ": %d elements", nKinds);
2718
2719 return (1+kinds_length);
2720 }
2721
dissect_findreq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2722 static int dissect_findreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length) {
2723 proto_item *ti_local;
2724 proto_tree *local_tree;
2725 guint16 local_offset = 0;
2726
2727 ti_local = proto_tree_add_item(tree, hf_reload_findreq, tvb, offset, length, ENC_NA);
2728 local_tree = proto_item_add_subtree(ti_local, ett_reload_findreq);
2729
2730 local_offset += dissect_resourceid(hf_reload_resource, tvb, pinfo, local_tree, offset, length);
2731 dissect_kindid_list(tvb, pinfo, local_tree, offset+local_offset, length-local_offset);
2732
2733 return length;
2734 }
2735
dissect_findans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2736 static int dissect_findans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length) {
2737 proto_item *ti_local;
2738 proto_tree *local_tree;
2739 guint16 results_length;
2740
2741 ti_local = proto_tree_add_item(tree, hf_reload_findans, tvb, offset, length, ENC_NA);
2742 local_tree = proto_item_add_subtree(ti_local, ett_reload_findans);
2743 results_length = tvb_get_ntohs(tvb, offset);
2744 proto_item_append_text(ti_local, " (FindKindData<%d>)", results_length);
2745 if (results_length + 2 > length) {
2746 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated FindAns");
2747 }
2748 proto_tree_add_uint(local_tree, hf_reload_length_uint16, tvb, offset, 2, results_length);
2749
2750 {
2751 gint32 results_offset = 0;
2752 int nResults = 0;
2753 while (results_offset >= 0 && results_offset < results_length) {
2754 proto_item *ti_findkinddata;
2755 proto_tree *findkinddata_tree;
2756 guint16 findkinddata_length;
2757 kind_t *kind;
2758 findkinddata_length = 4/*kind id */ + 1 + tvb_get_guint8(tvb,offset + 2 + results_offset + 4)/* resourceId */;
2759 if (results_offset + findkinddata_length > results_length) {
2760 ti_findkinddata = proto_tree_add_item(local_tree, hf_reload_findkinddata, tvb, offset + results_offset, results_length - results_offset, ENC_NA);
2761 expert_add_info_format(pinfo, ti_findkinddata, &ei_reload_truncated_field, "Truncated FindKindData");
2762 break;
2763 }
2764
2765 ti_findkinddata = proto_tree_add_item(local_tree, hf_reload_findkinddata, tvb, offset + 2 + results_offset, findkinddata_length, ENC_NA);
2766 findkinddata_tree = proto_item_add_subtree(ti_findkinddata, ett_reload_findkinddata);
2767 dissect_kindid(hf_reload_kinddata_kind,tvb, findkinddata_tree, offset+2+results_offset,&kind);
2768 dissect_resourceid(hf_reload_findkinddata_closest, tvb, pinfo, findkinddata_tree, offset+2+results_offset+4, results_length - 4 - results_offset);
2769 if (findkinddata_length <= 0) break;
2770 results_offset += findkinddata_length;
2771 nResults++;
2772 }
2773 proto_item_append_text(ti_local, ": %d elements", nResults);
2774 }
2775
2776 return length;
2777 }
2778
dissect_selftuningdata(tvbuff_t * tvb,proto_tree * tree,guint16 offset)2779 static int dissect_selftuningdata(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
2780 {
2781 proto_item *ti_local;
2782 proto_tree *local_tree;
2783
2784 ti_local = proto_tree_add_item(tree, hf_reload_self_tuning_data, tvb, offset, 12, ENC_NA);
2785 local_tree = proto_item_add_subtree(ti_local, ett_reload_self_tuning_data);
2786
2787 proto_tree_add_item(local_tree, hf_reload_self_tuning_data_network_size, tvb, offset, 4, ENC_BIG_ENDIAN);
2788 proto_tree_add_item(local_tree, hf_reload_self_tuning_data_join_rate, tvb, offset+4, 4, ENC_BIG_ENDIAN);
2789 proto_tree_add_item(local_tree, hf_reload_self_tuning_data_leave_rate, tvb, offset+8, 4, ENC_BIG_ENDIAN);
2790
2791 return 12;
2792 }
2793
dissect_extensiveroutingmodeoption(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2794 static int dissect_extensiveroutingmodeoption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2795 {
2796 proto_item *ti_local;
2797 proto_tree *local_tree;
2798 guint16 local_offset = 0;
2799
2800 ti_local = proto_tree_add_item(tree, hf_reload_extensiveroutingmodeoption, tvb, offset, length, ENC_NA);
2801 local_tree = proto_item_add_subtree(ti_local, ett_reload_extensiveroutingmodeoption);
2802
2803 proto_tree_add_item(local_tree, hf_reload_routemode, tvb, offset, 1, ENC_BIG_ENDIAN);
2804 local_offset += 1;
2805 proto_tree_add_item(local_tree, hf_reload_extensiveroutingmode_transport, tvb,
2806 offset+local_offset, 1, ENC_BIG_ENDIAN);
2807 local_offset += 1;
2808 local_offset += dissect_ipaddressport(hf_reload_extensiveroutingmode_ipaddressport, tvb, local_tree, offset+local_offset);
2809 {
2810 proto_item *ti_destination;
2811 proto_tree *destination_tree;
2812 guint16 destination_length;
2813 int nDestinations = 0;
2814 destination_length = tvb_get_guint8(tvb, offset+local_offset);
2815 if (destination_length+1+local_offset>length) {
2816 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ExtensiveRoutingModeOption");
2817 destination_length = length -1-local_offset;
2818 }
2819 ti_destination = proto_tree_add_item(local_tree, hf_reload_extensiveroutingmode_destination, tvb,offset+local_offset, 1+destination_length, ENC_NA);
2820 proto_item_append_text(ti_destination, " (Destination<%d>)", destination_length);
2821 destination_tree = proto_item_add_subtree(ti_destination, ett_reload_extensiveroutingmode_destination);
2822 proto_tree_add_item(destination_tree, hf_reload_length_uint8, tvb,offset+local_offset, 1, ENC_BIG_ENDIAN);
2823 local_offset += 1;
2824 dissect_destination_list(tvb, pinfo, destination_tree, offset+local_offset, destination_length, &nDestinations);
2825 proto_item_append_text(ti_destination, ": %d elements", nDestinations);
2826 local_offset += destination_length;
2827 }
2828 return local_offset;
2829 }
2830
dissect_forwardingoption(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2831 static int dissect_forwardingoption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2832 {
2833 proto_item *ti_option;
2834 guint16 local_offset = 0;
2835 guint8 option_type = tvb_get_guint8(tvb,offset);
2836 guint8 option_flags = tvb_get_guint8(tvb, offset+ 1);
2837 guint16 option_length = tvb_get_ntohs(tvb, offset+ 2);
2838 proto_tree *option_tree;
2839
2840 ti_option = proto_tree_add_item(tree, hf_reload_forwarding_option, tvb, offset+local_offset, option_length + 4, ENC_NA);
2841 proto_item_append_text(ti_option, " type=%s, flags=%02x, length=%d", val_to_str_const(option_type, forwardingoptiontypes, "Unknown"), option_flags, option_length);
2842
2843 option_tree = proto_item_add_subtree(ti_option, ett_reload_forwarding_option);
2844 proto_tree_add_item(option_tree, hf_reload_forwarding_option_type, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
2845 {
2846 proto_item *ti_flags;
2847 proto_tree *flags_tree;
2848 guint32 bit_offset;
2849 ti_flags = proto_tree_add_uint(option_tree, hf_reload_forwarding_option_flags, tvb, offset+local_offset+1, 1, option_flags);
2850 flags_tree = proto_item_add_subtree(ti_flags, ett_reload_forwarding_option_flags);
2851 bit_offset = 8*(offset+local_offset+1);
2852 proto_tree_add_bits_item(flags_tree, hf_reload_forwarding_option_flag_ignore_state_keeping, tvb, bit_offset+4, 1, ENC_BIG_ENDIAN);
2853 proto_tree_add_bits_item(flags_tree, hf_reload_forwarding_option_flag_response_copy, tvb, bit_offset+5, 1, ENC_BIG_ENDIAN);
2854 proto_tree_add_bits_item(flags_tree, hf_reload_forwarding_option_flag_destination_critical, tvb, bit_offset+6, 1, ENC_BIG_ENDIAN);
2855 proto_tree_add_bits_item(flags_tree, hf_reload_forwarding_option_flag_forward_critical, tvb, bit_offset+7, 1, ENC_BIG_ENDIAN);
2856 }
2857 proto_tree_add_uint(option_tree, hf_reload_length_uint16, tvb, offset+local_offset+2, 2, option_length);
2858 local_offset += 4;
2859 if (local_offset + option_length > length) {
2860 expert_add_info_format(pinfo, ti_option, &ei_reload_truncated_field, "Truncated ForwardingOption");
2861 return length;
2862 }
2863
2864 switch (option_type) {
2865 case OPTIONTYPE_EXTENSIVE_ROUTING_MODE:
2866 dissect_extensiveroutingmodeoption(tvb, pinfo, option_tree, offset+local_offset, option_length);
2867 break;
2868
2869 default:
2870 proto_tree_add_item(option_tree, hf_reload_opaque_data, tvb, offset+local_offset, option_length, ENC_NA);
2871 break;
2872 }
2873 local_offset += option_length;
2874
2875 return local_offset;
2876 }
2877
dissect_dmflag(tvbuff_t * tvb,proto_tree * tree,guint16 offset)2878 static int dissect_dmflag(tvbuff_t *tvb, proto_tree *tree, guint16 offset) {
2879 proto_item *ti_local;
2880 proto_tree *local_tree;
2881 guint i;
2882 guint32 bit_offset = offset<<3;
2883
2884 ti_local = proto_tree_add_item(tree, hf_reload_dmflags, tvb, offset, 8, ENC_BIG_ENDIAN);
2885 local_tree = proto_item_add_subtree(ti_local, ett_reload_dmflags);
2886
2887 for (i=0; i<(sizeof(reload_dmflag_items)/sizeof(gint *)); i++) {
2888 if (reload_dmflag_items[i] != NULL) {
2889 proto_tree_add_bits_item(local_tree, *(reload_dmflag_items[i]), tvb, bit_offset+63-i, 1, ENC_BIG_ENDIAN);
2890 }
2891 }
2892 return 8;
2893 }
2894
dissect_diagnosticextension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2895 static int dissect_diagnosticextension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2896 {
2897 proto_item *ti_local;
2898 proto_tree *local_tree;
2899 guint16 local_offset = 0;
2900 guint16 local_length = 0;
2901
2902 local_length = 2 + 4 + tvb_get_ntohl(tvb, offset+2);
2903 ti_local = proto_tree_add_item(tree, hf_reload_diagnosticextension, tvb, offset, local_length, ENC_NA);
2904 local_tree = proto_item_add_subtree(ti_local, ett_reload_diagnosticextension);
2905
2906 proto_tree_add_item(local_tree, hf_reload_diagnosticextension_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2907 local_offset += 2;
2908 local_offset += dissect_opaque(tvb, pinfo, local_tree, hf_reload_diagnosticextension_contents, offset + local_offset, 4, length-2);
2909
2910 return local_offset;
2911 }
2912
dissect_diagnosticrequest(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2913 static int dissect_diagnosticrequest(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length) {
2914 proto_item *ti_local;
2915 proto_tree *local_tree;
2916 guint16 local_offset = 0;
2917 guint32 local_length = 0;
2918 int hf = hf_reload_diagnosticrequest;
2919
2920 if (anchor >= 0) {
2921 hf = anchor;
2922 }
2923
2924 ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
2925 local_tree = proto_item_add_subtree(ti_local, ett_reload_diagnosticrequest);
2926
2927 proto_tree_add_item(local_tree, hf_reload_diagnostic_expiration, tvb, offset, 8, ENC_TIME_MSECS|ENC_BIG_ENDIAN);
2928 local_offset += 8;
2929 proto_tree_add_item(local_tree, hf_reload_diagnosticrequest_timestampinitiated, tvb,
2930 offset+local_offset, 8, ENC_TIME_MSECS|ENC_BIG_ENDIAN);
2931 local_offset += 8;
2932 local_offset += dissect_dmflag(tvb, local_tree, offset+local_offset);
2933 local_length = tvb_get_ntohl(tvb, offset+local_offset);
2934 proto_tree_add_item(local_tree, hf_reload_length_uint32, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
2935 local_offset += 4;
2936
2937 if (local_offset+local_length > length) {
2938 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated DiagnosticRequest");
2939 local_length = length-local_offset;
2940 }
2941 if (local_length>0) {
2942 proto_item *ti_extensions;
2943 proto_tree *extensions_tree;
2944 guint32 extensions_offset = 0;
2945 guint32 extensions_length = 0;
2946 int nExtensions = 0;
2947
2948 ti_extensions = proto_tree_add_item(local_tree, hf_reload_diagnosticrequest_extensions, tvb, offset+local_offset, local_length, ENC_NA);
2949 extensions_tree = proto_item_add_subtree(ti_extensions, ett_reload_diagnosticrequest_extensions);
2950 extensions_length = tvb_get_ntohl(tvb, offset+local_offset);
2951 if (extensions_length+4 > local_length) {
2952 expert_add_info_format(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated Diagnostic extensions");
2953 extensions_length = local_length-4;
2954 }
2955 proto_item_append_text(ti_extensions, " (DiagnosticExtension<%d>)",extensions_length);
2956 proto_tree_add_item(extensions_tree, hf_reload_length_uint32, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
2957 while (extensions_offset<extensions_length) {
2958 int local_increment = dissect_diagnosticextension(tvb, pinfo, extensions_tree, offset+4+local_offset+extensions_offset, extensions_length-extensions_offset);
2959 if (local_increment <= 0) break;
2960 extensions_offset += local_increment;
2961 nExtensions++;
2962 }
2963 proto_item_append_text(ti_extensions, " : %d elements", nExtensions);
2964 }
2965 local_offset += local_length;
2966 return local_offset;
2967 }
2968
dissect_pathtrackreq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)2969 static int dissect_pathtrackreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
2970 {
2971 proto_item *ti_local;
2972 proto_tree *local_tree;
2973 guint16 local_offset = 0;
2974
2975 ti_local = proto_tree_add_item(tree, hf_reload_pathtrackreq, tvb, offset, length, ENC_NA);
2976 local_tree = proto_item_add_subtree(ti_local, ett_reload_pathtrackreq);
2977 local_offset += dissect_destination(hf_reload_pathtrackreq_destination, tvb, pinfo, local_tree, offset+local_offset,length);
2978 local_offset += dissect_diagnosticrequest(hf_reload_pathtrackreq_request, tvb, pinfo, local_tree, offset+local_offset, length-local_offset);
2979
2980 return local_offset;
2981 }
2982
dissect_diagnosticinfo(tvbuff_t * tvb,proto_tree * tree,guint16 offset,guint16 length)2983 static int dissect_diagnosticinfo(tvbuff_t *tvb, proto_tree *tree, guint16 offset, guint16 length)
2984 {
2985 proto_item *ti_local;
2986 proto_tree *local_tree;
2987 guint16 local_offset = 0;
2988 guint16 local_length = 0;
2989 guint16 kindid;
2990
2991 local_length = 2 + tvb_get_ntohs(tvb, offset+2);
2992 ti_local = proto_tree_add_item(tree, hf_reload_diagnosticinfo, tvb, offset, local_length+4, ENC_NA);
2993 local_tree = proto_item_add_subtree(ti_local, ett_reload_diagnosticinfo);
2994
2995 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_kind, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
2996 local_offset += 2;
2997 proto_tree_add_item(local_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
2998 local_offset += 2;
2999
3000 kindid = tvb_get_ntohs(tvb, offset);
3001 switch(kindid) {
3002 case DIAGNOSTICKINDID_STATUS_INFO:
3003 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_congestion_status, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
3004 break;
3005
3006 case DIAGNOSTICKINDID_ROUTING_TABLE_SIZE:
3007 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_number_peers, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3008 break;
3009
3010 case DIAGNOSTICKINDID_PROCESS_POWER:
3011 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_processing_power, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3012 break;
3013
3014 case DIAGNOSTICKINDID_BANDWIDTH:
3015 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_bandwidth, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3016 break;
3017
3018 case DIAGNOSTICKINDID_SOFTWARE_VERSION:
3019 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_software_version, tvb, offset+local_offset, length, ENC_ASCII|ENC_NA);
3020 break;
3021
3022 case DIAGNOSTICKINDID_MACHINE_UPTIME:
3023 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_machine_uptime, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
3024 break;
3025
3026 case DIAGNOSTICKINDID_APP_UPTIME:
3027 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_app_uptime, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
3028 break;
3029
3030 case DIAGNOSTICKINDID_MEMORY_FOOTPRINT:
3031 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_memory_footprint, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3032 break;
3033
3034 case DIAGNOSTICKINDID_DATASIZE_STORED:
3035 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_datasize_stored, tvb, offset+local_offset, 8, ENC_BIG_ENDIAN);
3036 break;
3037
3038 case DIAGNOSTICKINDID_INSTANCES_STORED:
3039 {
3040 proto_item *ti_instances;
3041 proto_tree *instances_tree;
3042 gint32 instances_offset = 0;
3043 int nElements = 0;
3044
3045 ti_instances = proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_instances_stored,\
3046 tvb, offset+local_offset, length, ENC_NA);
3047 instances_tree = proto_item_add_subtree(ti_instances, ett_reload_diagnosticinfo_instances_stored);
3048 proto_item_append_text(ti_instances, "[%d]", length);
3049 while (instances_offset >= 0 && instances_offset < length) {
3050 proto_item *ti_instances_per_kindid;
3051 proto_tree *instances_per_kindid_tree;
3052 kind_t *kind;
3053 guint64 instances;
3054 ti_instances_per_kindid = proto_tree_add_item(instances_tree, hf_reload_diagnosticinfo_instancesstored_info,
3055 tvb, offset+local_offset+instances_offset, 12, ENC_NA);
3056 instances_per_kindid_tree = proto_item_add_subtree(ti_instances_per_kindid,
3057 ett_reload_diagnosticinfo_instancesstored_info);
3058 dissect_kindid(hf_reload_kinddata_kind, tvb, instances_per_kindid_tree, offset+local_offset+instances_offset, &kind);
3059 proto_tree_add_item(instances_per_kindid_tree, hf_reload_diagnosticinfo_instancesstored_instances,
3060 tvb, offset+local_offset+instances_offset+4, 8, ENC_BIG_ENDIAN);
3061 instances = tvb_get_ntoh64(tvb, offset+local_offset+instances_offset+4);
3062 proto_item_append_text(ti_instances_per_kindid, ": %s/%" G_GINT64_MODIFIER "d",
3063 ((kind != NULL) && (kind->name != NULL)) ? kind->name : "UNKNOWN KIND", instances);
3064 instances_offset += 12;
3065 nElements++;
3066 }
3067 if (nElements>0) {
3068 proto_item_append_text(ti_instances, ": %d", nElements);
3069 }
3070 }
3071 break;
3072
3073
3074 case DIAGNOSTICKINDID_MESSAGES_SENT_RCVD:
3075 {
3076 proto_item *ti_messages;
3077 proto_tree *messages_tree;
3078 gint32 messages_offset = 0;
3079 int nElements = 0;
3080
3081 ti_messages = proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_messages_sent_rcvd,
3082 tvb, offset+local_offset, length, ENC_NA);
3083 messages_tree = proto_item_add_subtree(ti_messages, ett_reload_diagnosticinfo_messages_sent_rcvd);
3084 proto_item_append_text(ti_messages, "[%d]", length);
3085
3086 while (messages_offset >= 0 && messages_offset < length) {
3087 proto_item *ti_sent_rcvd;
3088 proto_tree *sent_rcvd_tree;
3089 guint16 message_code;
3090
3091 ti_sent_rcvd = proto_tree_add_item(messages_tree, hf_reload_diagnosticinfo_messages_sent_rcvd_info, tvb, offset+local_offset+messages_offset, 20, ENC_NA);
3092
3093 sent_rcvd_tree = proto_item_add_subtree(ti_sent_rcvd, ett_reload_diagnosticinfo_messages_sent_rcvd_info);
3094 message_code = tvb_get_ntohs(tvb, offset+local_offset+messages_offset);
3095 if (message_code == RELOAD_ERROR) {
3096 proto_tree_add_uint_format_value(sent_rcvd_tree, hf_reload_diagnosticinfo_message_code, tvb,
3097 offset+local_offset+messages_offset, 2,
3098 message_code,
3099 "error");
3100
3101 }
3102 else {
3103 proto_tree_add_uint_format_value(sent_rcvd_tree, hf_reload_diagnosticinfo_message_code, tvb,
3104 offset+local_offset+messages_offset, 2,
3105 message_code,
3106 "%s_%s",
3107 val_to_str_const(MSGCODE_TO_METHOD(message_code), methods_short, "Unknown"),
3108 val_to_str_const(MSGCODE_TO_CLASS(message_code), classes_short, "Unknown"));
3109 }
3110 proto_tree_add_item(sent_rcvd_tree, hf_reload_diagnosticinfo_messages_sent,
3111 tvb, offset+local_offset+messages_offset+2, 8, ENC_BIG_ENDIAN);
3112 proto_tree_add_item(sent_rcvd_tree, hf_reload_diagnosticinfo_messages_rcvd,
3113 tvb, offset+local_offset+messages_offset+2+8, 8, ENC_BIG_ENDIAN);
3114 messages_offset += 18;
3115 nElements++;
3116 }
3117 if (nElements>0) {
3118 proto_item_append_text(ti_messages, ": %d", nElements);
3119 }
3120 }
3121 break;
3122
3123 case DIAGNOSTICKINDID_EWMA_BYTES_SENT:
3124 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_ewma_bytes_sent, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3125 break;
3126
3127 case DIAGNOSTICKINDID_EWMA_BYTES_RCVD:
3128 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_ewma_bytes_rcvd, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3129 break;
3130
3131 case DIAGNOSTICKINDID_UNDERLAY_HOP:
3132 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_underlay_hops, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
3133 break;
3134
3135 case DIAGNOSTICKINDID_BATTERY_STATUS:
3136 proto_tree_add_item(local_tree, hf_reload_diagnosticinfo_battery_status, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
3137 break;
3138
3139 default:
3140 proto_tree_add_item(local_tree, hf_reload_opaque_data, tvb, offset+local_offset, length, ENC_NA);
3141 break;
3142
3143 }
3144
3145 return local_length;
3146 }
3147
3148
dissect_diagnosticresponse(int anchor,tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3149 static int dissect_diagnosticresponse(int anchor, tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree, guint16 offset, guint16 length) {
3150 proto_item *ti_local;
3151 proto_tree *local_tree;
3152 guint16 local_offset = 0;
3153 int hf = hf_reload_diagnosticresponse;
3154
3155 if (anchor >= 0) {
3156 hf = anchor;
3157 }
3158
3159 ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA);
3160 local_tree = proto_item_add_subtree(ti_local, ett_reload_diagnosticresponse);
3161
3162 proto_tree_add_item(local_tree, hf_reload_diagnostic_expiration, tvb, offset, 8, ENC_TIME_MSECS|ENC_BIG_ENDIAN);
3163 local_offset += 8;
3164 proto_tree_add_item(local_tree, hf_reload_diagnosticresponse_timestampreceived,
3165 tvb, offset+local_offset, 8, ENC_TIME_MSECS|ENC_BIG_ENDIAN);
3166 local_offset += 8;
3167 proto_tree_add_item(local_tree, hf_reload_diagnosticresponse_hopcounter, tvb, offset+local_offset, 1, ENC_BIG_ENDIAN);
3168
3169
3170 {
3171 proto_item *ti_diagnostics;
3172 proto_tree *diagnostics_tree;
3173 gint32 diagnostics_offset = 0;
3174 guint32 diagnostics_length = 0;
3175 int nDiagnostics = 0;
3176
3177 diagnostics_length = tvb_get_ntohl(tvb, offset+local_offset);
3178 if (diagnostics_length+local_offset+4>length) {
3179 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated Diagnostic Response");
3180 diagnostics_length = length -4 -local_offset;
3181 }
3182 ti_diagnostics = proto_tree_add_item(local_tree, hf_reload_diagnosticresponse_diagnostic_info_list, tvb, offset+local_offset, diagnostics_length, ENC_NA);
3183 diagnostics_tree = proto_item_add_subtree(ti_local, ett_reload_diagnosticresponse_diagnostic_info_list);
3184 proto_item_append_text(ti_diagnostics, " (DiagnosticInfo<%d>)",diagnostics_length);
3185 proto_tree_add_item(diagnostics_tree, hf_reload_length_uint32, tvb, offset+local_offset, 4, ENC_BIG_ENDIAN);
3186 local_offset += 4;
3187 while (diagnostics_offset >= 0 && (guint32)diagnostics_offset<diagnostics_length) {
3188 int local_increment = dissect_diagnosticinfo(tvb, diagnostics_tree, offset+local_offset+diagnostics_offset, diagnostics_length-diagnostics_offset);
3189 if (local_increment <= 0) break;
3190 diagnostics_offset += local_increment;
3191 nDiagnostics++;
3192 }
3193 proto_item_append_text(ti_diagnostics, " : %d elements", nDiagnostics);
3194 local_offset += diagnostics_length;
3195 }
3196
3197 return local_offset;
3198 }
3199
dissect_pathtrackans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3200 static int dissect_pathtrackans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3201 {
3202 proto_item *ti_local;
3203 proto_tree *local_tree;
3204 guint16 local_offset = 0;
3205
3206 ti_local = proto_tree_add_item(tree, hf_reload_pathtrackans, tvb, offset, length, ENC_NA);
3207 local_tree = proto_item_add_subtree(ti_local, ett_reload_pathtrackans);
3208 local_offset += dissect_destination(hf_reload_pathtrackans_next_hop, tvb, pinfo, local_tree, offset+local_offset,length);
3209 local_offset += dissect_diagnosticresponse(hf_reload_pathtrackans_response, tvb, pinfo, local_tree, offset+local_offset, length-local_offset);
3210
3211 return local_offset;
3212 }
3213
dissect_joinreq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3214 static int dissect_joinreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3215 {
3216 proto_item *ti_local;
3217 proto_tree *local_tree;
3218 guint16 local_offset = 0;
3219
3220 ti_local = proto_tree_add_item(tree, hf_reload_joinreq, tvb, offset, length, ENC_NA);
3221 local_tree = proto_item_add_subtree(ti_local, ett_reload_joinreq);
3222
3223 local_offset += dissect_nodeid(hf_reload_joinreq_joining_peer_id, tvb, pinfo, local_tree, offset, length);
3224 local_offset += dissect_opaque(tvb, pinfo, local_tree, hf_reload_overlay_specific, offset + local_offset, 2,
3225 length - local_offset);
3226 return local_offset;
3227 }
3228
dissect_joinans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3229 static int dissect_joinans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3230 {
3231 proto_item *ti_local;
3232 proto_tree *local_tree;
3233 guint16 local_offset = 0;
3234
3235 ti_local = proto_tree_add_item(tree, hf_reload_joinans, tvb, offset, length, ENC_NA);
3236 local_tree = proto_item_add_subtree(ti_local, ett_reload_joinans);
3237
3238 local_offset = dissect_opaque(tvb, pinfo, local_tree, hf_reload_overlay_specific,
3239 offset + local_offset, 2, length );
3240 return local_offset;
3241 }
3242
dissect_leavereq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3243 static int dissect_leavereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3244 {
3245 proto_item *ti_local;
3246 proto_tree *local_tree;
3247 guint16 local_offset = 0;
3248
3249 ti_local = proto_tree_add_item(tree, hf_reload_leavereq, tvb, offset, length, ENC_NA);
3250 local_tree = proto_item_add_subtree(ti_local, ett_reload_leavereq);
3251
3252 local_offset += dissect_nodeid(hf_reload_leavereq_leaving_peer_id, tvb, pinfo, local_tree, offset, length);
3253 if (0 == strcmp(TOPOLOGY_PLUGIN_CHORD_RELOAD, reload_topology_plugin)) {
3254 proto_item *ti_overlay_specific;
3255 proto_tree *overlay_specific_tree;
3256 guint16 overlay_length;
3257
3258 ti_overlay_specific = proto_tree_add_item(local_tree, hf_reload_overlay_specific,
3259 tvb, offset+local_offset, length - local_offset, ENC_NA);
3260 overlay_specific_tree = proto_item_add_subtree(ti_overlay_specific, ett_reload_overlay_specific);
3261 proto_tree_add_item(overlay_specific_tree, hf_reload_length_uint16, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
3262
3263 overlay_length = tvb_get_ntohs(tvb, offset+local_offset);
3264 local_offset+= 2;
3265 dissect_chordleavedata(tvb, pinfo, overlay_specific_tree, offset+local_offset, overlay_length);
3266 local_offset += overlay_length;
3267 }
3268 else {
3269 local_offset += dissect_opaque(tvb, pinfo, local_tree, hf_reload_overlay_specific,
3270 offset + reload_nodeid_length, 2, length - local_offset);
3271 }
3272
3273 return local_offset;
3274 }
3275
dissect_probereq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3276 static int dissect_probereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3277 {
3278 proto_item *ti_local, *ti_requested_info;
3279 proto_tree *local_tree, *requested_info_tree;
3280 guint8 info_list_length = 0;
3281
3282 ti_local = proto_tree_add_item(tree, hf_reload_probereq, tvb, offset, length, ENC_NA);
3283 local_tree = proto_item_add_subtree(ti_local, ett_reload_probereq);
3284 ti_requested_info = proto_tree_add_item(local_tree, hf_reload_probereq_requested_info, tvb, offset, length, ENC_NA);
3285 requested_info_tree = proto_item_add_subtree(ti_requested_info, ett_reload_probereq_requested_info);
3286 info_list_length = tvb_get_guint8(tvb, offset);
3287
3288 proto_item_append_text(ti_requested_info, " (ProbeInformationType<%d>)", info_list_length);
3289 proto_tree_add_uint(requested_info_tree, hf_reload_length_uint8, tvb, offset, 1, info_list_length);
3290
3291 if ((info_list_length+1) > length) {
3292 expert_add_info_format(pinfo, ti_requested_info, &ei_reload_truncated_field, "Truncated requested_info");
3293 info_list_length = length - 1;
3294 }
3295 {
3296 int probe_offset = 0;
3297 int nInfos = 0;
3298 while (probe_offset >= 0 && probe_offset < info_list_length) {
3299 proto_tree_add_item(requested_info_tree, hf_reload_probe_information_type,
3300 tvb, offset + 1 + probe_offset, 1, ENC_BIG_ENDIAN);
3301 probe_offset += 1;
3302 nInfos++;
3303 }
3304 proto_item_append_text(ti_requested_info, ": %d elements", nInfos);
3305 }
3306
3307 return info_list_length;
3308 }
3309
dissect_probeans(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3310 static int dissect_probeans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3311 {
3312 proto_item *ti_local, *ti_infos;
3313 proto_tree *local_tree, *infos_tree;
3314 guint16 info_list_length = 0;
3315
3316 ti_local = proto_tree_add_item(tree, hf_reload_probeans, tvb, offset, length, ENC_NA);
3317 local_tree = proto_item_add_subtree(ti_local, ett_reload_probeans);
3318
3319 info_list_length = tvb_get_ntohs(tvb, offset);
3320 if (info_list_length+2 >length) {
3321 expert_add_info_format(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ProbeAns");
3322 info_list_length = length - 2;
3323 }
3324 ti_infos = proto_tree_add_item(local_tree, hf_reload_probeans_probe_info, tvb, offset, info_list_length, ENC_NA);
3325 proto_item_append_text(ti_infos, " (ProbeInformation<%d>)", info_list_length);
3326 infos_tree = proto_item_add_subtree(ti_infos, ett_reload_probeans_probe_info);
3327 {
3328 int probe_offset = 0;
3329 int probe_increment;
3330 int nInfos = 0;
3331 while (probe_offset >= 0 && probe_offset < info_list_length) {
3332 probe_increment = dissect_probe_information(tvb, pinfo, infos_tree, offset + 2 + probe_offset, info_list_length - probe_offset);
3333 if (probe_increment <= 0) {
3334 break;
3335 }
3336 probe_offset += probe_increment;
3337 nInfos++;
3338 }
3339 proto_item_append_text(ti_infos, ": %d elements", nInfos);
3340 }
3341 return length;
3342 }
3343
dissect_reload_messagecontents(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,guint16 offset,guint16 length)3344 extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 offset, guint16 length)
3345 {
3346 guint32 message_body_length;
3347 guint32 extensions_length;
3348 proto_item *ti_message_contents;
3349 proto_tree *message_contents_tree;
3350 guint16 message_code;
3351
3352 message_body_length = tvb_get_ntohl(tvb, offset + 2);
3353 extensions_length = tvb_get_ntohl(tvb, offset + 2 + 4 + message_body_length);
3354
3355 if (2 + 4 + message_body_length + 4 + extensions_length > length) {
3356 ti_message_contents = proto_tree_add_item(tree, hf_reload_message_contents, tvb, offset, length, ENC_NA);
3357 expert_add_info_format(pinfo, ti_message_contents, &ei_reload_truncated_field, "Truncated MessageContents");
3358 return length;
3359 }
3360
3361 ti_message_contents = proto_tree_add_item(tree, hf_reload_message_contents, tvb, offset, 2 + 4 + message_body_length + 4 + extensions_length, ENC_NA);
3362 message_contents_tree = proto_item_add_subtree(ti_message_contents, ett_reload_message_contents);
3363
3364 message_code = tvb_get_ntohs(tvb, offset);
3365
3366 if (message_code != RELOAD_ERROR) {
3367 proto_item *ti_message_body;
3368 proto_tree *message_body_tree;
3369 const gchar *message_type_str = NULL;
3370
3371 /* message_code was already parsed */
3372 {
3373 proto_item *ti_message_code;
3374 ti_message_code = proto_tree_add_item(message_contents_tree, hf_reload_message_code, tvb,
3375 offset, 2, ENC_BIG_ENDIAN);
3376 proto_item_append_text(ti_message_code, " (%s_%s)",
3377 val_to_str(MSGCODE_TO_METHOD(message_code), methods_short, "Unknown %d"),
3378 val_to_str(MSGCODE_TO_CLASS(message_code), classes_short, "Unknown %d"));
3379 }
3380 offset += 2;
3381 /* Message body */
3382 ti_message_body = proto_tree_add_item(message_contents_tree, hf_reload_message_body, tvb, offset, 4 + message_body_length, ENC_NA);
3383 message_body_tree = proto_item_add_subtree(ti_message_body, ett_reload_message_body);
3384 proto_tree_add_uint(message_body_tree, hf_reload_length_uint32, tvb, offset, 4, message_body_length);
3385 offset += 4;
3386
3387 if (message_body_length > 0) {
3388 switch(MSGCODE_TO_METHOD(message_code)) {
3389 case METHOD_ROUTEQUERY:
3390 {
3391 if (IS_REQUEST(message_code)) {
3392 {
3393 proto_item * ti_routequeryreq;
3394 proto_tree * routequeryreq_tree;
3395 int destination_length;
3396 message_type_str = "RouteQueryReq";
3397 ti_routequeryreq = proto_tree_add_item(message_body_tree, hf_reload_routequeryreq,
3398 tvb, offset, message_body_length, ENC_NA);
3399 routequeryreq_tree = proto_item_add_subtree(ti_routequeryreq, ett_reload_routequeryreq);
3400 proto_tree_add_item(routequeryreq_tree, hf_reload_sendupdate, tvb, offset, 1, ENC_BIG_ENDIAN);
3401 destination_length = dissect_destination(hf_reload_routequeryreq_destination,
3402 tvb, pinfo, routequeryreq_tree, offset + 1, message_body_length - 1 - 2);
3403 dissect_opaque(tvb, pinfo, routequeryreq_tree, hf_reload_overlay_specific, offset + 1 + destination_length, 2, (message_body_length - 1 - destination_length));
3404 }
3405 }
3406 else {
3407 message_type_str = "ChordRouteQueryAns";
3408 /* Answer is entirely Overlay-specific */
3409 if (0 == strcmp(TOPOLOGY_PLUGIN_CHORD_RELOAD, reload_topology_plugin)) {
3410 dissect_chordroutequeryans(tvb, pinfo, message_body_tree, offset, message_body_length);
3411 }
3412 }
3413 }
3414 break;
3415
3416 case METHOD_PROBE:
3417 {
3418 if (IS_REQUEST(message_code)) {
3419 message_type_str = "ProbeReq";
3420 dissect_probereq(tvb, pinfo, message_body_tree, offset, message_body_length);
3421 }
3422 else {
3423 message_type_str = "ProbeAns";
3424 dissect_probeans(tvb, pinfo, message_body_tree, offset, message_body_length);
3425 }
3426 }
3427 break;
3428
3429 case METHOD_ATTACH:
3430 {
3431 message_type_str = "AttachReqAns";
3432 dissect_attachreqans(tvb, pinfo, message_body_tree, offset, message_body_length);
3433 }
3434 break;
3435
3436 case METHOD_APPATTACH:
3437 {
3438 /* Parse AppAttachReq/Ans */
3439 {
3440 guint16 local_offset = 0;
3441 proto_item *ti_appattach;
3442 proto_tree *appattach_tree;
3443 int hf = hf_reload_appattachans;
3444 message_type_str = "AttachAppAns";
3445 if (IS_REQUEST(message_code)) {
3446 hf = hf_reload_appattachreq;
3447 message_type_str = "AttachAppReq";
3448 }
3449 ti_appattach = proto_tree_add_item(message_body_tree, hf, tvb, offset+local_offset, message_body_length, ENC_NA);
3450 appattach_tree = proto_item_add_subtree(ti_appattach, ett_reload_appattach);
3451 local_offset += dissect_opaque_string(tvb, pinfo,appattach_tree, hf_reload_ufrag,offset+local_offset, 1, message_body_length-local_offset);
3452 local_offset += dissect_opaque_string(tvb, pinfo,appattach_tree, hf_reload_password,offset+local_offset, 1, message_body_length-local_offset);
3453 proto_tree_add_item(appattach_tree, hf_reload_application, tvb, offset+local_offset, 2, ENC_BIG_ENDIAN);
3454 local_offset += 2;
3455 local_offset += dissect_opaque_string(tvb, pinfo,appattach_tree, hf_reload_role,offset+local_offset, 1, message_body_length-local_offset);
3456 dissect_icecandidates(tvb, pinfo, appattach_tree, offset+local_offset, message_body_length-local_offset);
3457 }
3458 }
3459 break;
3460
3461 case METHOD_PING:
3462 {
3463 if (IS_REQUEST(message_code)) {
3464 proto_item *ti_local;
3465 proto_tree *local_tree;
3466 message_type_str = "PingReq";
3467 ti_local = proto_tree_add_item(message_body_tree, hf_reload_pingreq, tvb, offset, message_body_length, ENC_NA);
3468 local_tree = proto_item_add_subtree(ti_local, ett_reload_pingreq);
3469
3470 dissect_opaque(tvb, pinfo, local_tree, hf_reload_padding, offset, 2, message_body_length);
3471 }
3472 else {
3473 message_type_str = "PingAns";
3474 if (message_body_length < 16) {
3475 expert_add_info_format(pinfo, ti_message_contents, &ei_reload_truncated_field, "Truncated ping answer");
3476 }
3477 else {
3478 proto_item *ti_local;
3479 proto_tree *local_tree;
3480
3481 ti_local = proto_tree_add_item(message_body_tree, hf_reload_pingans, tvb, offset, message_body_length, ENC_NA);
3482 local_tree = proto_item_add_subtree(ti_local, ett_reload_pingans);
3483 proto_tree_add_item(local_tree, hf_reload_ping_response_id, tvb, offset, 8, ENC_BIG_ENDIAN);
3484 {
3485 guint64 timev;
3486 guint32 remaining_ms;
3487 time_t time_sec;
3488 nstime_t l_nsTime;
3489
3490 timev = tvb_get_ntoh64(tvb, offset+8);
3491 time_sec = (time_t)timev/1000;
3492 remaining_ms = (guint32)(timev % 1000);
3493
3494 l_nsTime.secs = time_sec;
3495 l_nsTime.nsecs = remaining_ms*1000*1000;
3496
3497 proto_tree_add_time(local_tree, hf_reload_ping_time, tvb, offset + 8, 8, &l_nsTime);
3498 }
3499 }
3500 }
3501 }
3502 break;
3503
3504 case METHOD_CONFIGUPDATE:
3505 {
3506 if (IS_REQUEST(message_code)) {
3507 guint16 local_offset = 0;
3508 proto_item *ti_configupdate;
3509 proto_tree *configupdate_tree;
3510 guint8 configupdate_type;
3511 guint32 configupdate_length;
3512
3513 message_type_str = "ConfigUpdateReq";
3514 ti_configupdate = proto_tree_add_item(message_body_tree, hf_reload_configupdatereq, tvb, offset+local_offset, message_body_length, ENC_NA);
3515 configupdate_tree = proto_item_add_subtree(ti_configupdate, ett_reload_configupdatereq);
3516 configupdate_type = tvb_get_guint8(tvb, offset + local_offset);
3517 proto_tree_add_uint(configupdate_tree, hf_reload_configupdatereq_type, tvb, offset+local_offset, 1, configupdate_type);
3518 local_offset += 1;
3519 configupdate_length = tvb_get_ntohl(tvb, offset + local_offset);
3520 proto_tree_add_uint(configupdate_tree, hf_reload_length_uint32, tvb, offset + local_offset, 4, configupdate_length);
3521 if (5 + configupdate_length > message_body_length) {
3522 expert_add_info_format(pinfo, ti_configupdate, &ei_reload_truncated_field, "Truncated ConfigUpdateReq");
3523 break;
3524 }
3525 local_offset += 4;
3526 switch(configupdate_type) {
3527 case CONFIGUPDATETYPE_CONFIG:
3528 {
3529
3530 if (xml_handle == NULL) {
3531 expert_add_info(pinfo, ti_configupdate, &ei_reload_no_xml_dissector);
3532 dissect_opaque_string(tvb, pinfo, configupdate_tree, hf_reload_configupdatereq_configdata, offset+local_offset, 3, configupdate_length);
3533 }
3534 else {
3535 proto_item *ti_config_data;
3536 proto_tree *config_data_tree;
3537 guint32 config_length;
3538 config_length = tvb_get_ntoh24(tvb,offset+local_offset);
3539 ti_config_data = proto_tree_add_item(configupdate_tree, hf_reload_configupdatereq_configdata, tvb, offset+local_offset, configupdate_length, ENC_NA);
3540 config_data_tree = proto_item_add_subtree(ti_config_data, ett_reload_configupdatereq_config_data);
3541 proto_tree_add_item(config_data_tree, hf_reload_length_uint24, tvb, offset+local_offset, 3, ENC_BIG_ENDIAN);
3542 call_dissector_only(xml_handle,
3543 tvb_new_subset_length_caplen(tvb, offset+local_offset+3, config_length, length-offset-local_offset-3),
3544 pinfo, config_data_tree, NULL);
3545 }
3546 }
3547
3548 break;
3549
3550 case CONFIGUPDATETYPE_KIND:
3551 {
3552 proto_item *ti_kinds;
3553 proto_tree *kinds_tree;
3554 guint32 kinds_length;
3555 guint32 kinds_offset = 0;
3556 int nKinds = 0;
3557
3558 ti_kinds = proto_tree_add_item(configupdate_tree, hf_reload_configupdatereq_kinds,
3559 tvb, offset+local_offset, configupdate_length, ENC_NA);
3560 kinds_tree = proto_item_add_subtree(ti_kinds, ett_reload_configupdatereq_kinds);
3561 kinds_length = tvb_get_ntoh24(tvb, offset+local_offset);
3562 proto_item_append_text(ti_kinds, " (KindDescription<%d>)", kinds_length);
3563 local_offset += dissect_length(tvb, kinds_tree, offset+local_offset, 3);
3564 while (kinds_offset < kinds_length) {
3565 guint16 local_increment = tvb_get_ntohs(tvb,offset+local_offset+kinds_offset);
3566 if (xml_handle == NULL) {
3567 expert_add_info(pinfo, ti_configupdate, &ei_reload_no_xml_dissector);
3568 dissect_opaque_string(tvb, pinfo, configupdate_tree, hf_reload_kinddescription,
3569 offset+local_offset+kinds_offset, 2, configupdate_length);
3570 }
3571 else {
3572 proto_item *ti_kinddescription;
3573 proto_tree *kinddescription_tree;
3574 ti_kinddescription = proto_tree_add_item(kinds_tree, hf_reload_kinddescription,
3575 tvb, offset+local_offset+kinds_offset, 2+local_increment, ENC_NA);
3576 kinddescription_tree = proto_item_add_subtree(ti_kinddescription, ett_reload_kinddescription);
3577 proto_tree_add_item(kinddescription_tree, hf_reload_length_uint16,
3578 tvb, offset+local_offset+kinds_offset, 2, ENC_BIG_ENDIAN);
3579 call_dissector(xml_handle,
3580 tvb_new_subset_length_caplen(tvb, offset+local_offset+kinds_offset+2,
3581 local_increment,
3582 length-(offset+local_offset+kinds_offset+2)),
3583 pinfo, kinddescription_tree);
3584 }
3585 local_increment += 2;
3586 if (local_increment <= 0) break;
3587 kinds_offset += local_increment;
3588 nKinds++;
3589 }
3590 proto_item_append_text(ti_kinds, ": %d elements", nKinds);
3591 }
3592 break;
3593 }
3594
3595 }
3596 else {
3597 message_type_str = "ConfigUpdateAns";
3598 }
3599 break;
3600 }
3601
3602 case METHOD_STORE:
3603 {
3604 if (IS_REQUEST(message_code)) {
3605 message_type_str = "StoreReq";
3606 dissect_storereq(tvb, pinfo, message_body_tree, offset, message_body_length);
3607 }
3608 else {
3609 message_type_str = "StoreAns";
3610 dissect_storeans(tvb, pinfo, message_body_tree, offset, message_body_length);
3611 }
3612 }
3613 break;
3614
3615 case METHOD_FETCH:
3616 {
3617 if (IS_REQUEST(message_code)) {
3618 message_type_str = "FetchReq";
3619 dissect_fetchreq(tvb, pinfo, message_body_tree, offset, message_body_length, FALSE);
3620 }
3621 else {
3622 /* response */
3623 message_type_str = "FetchAns";
3624 dissect_fetchans(tvb, pinfo, message_body_tree, offset, message_body_length);
3625 }
3626 }
3627 break;
3628
3629 case METHOD_STAT:
3630 {
3631 if (IS_REQUEST(message_code)) {
3632 message_type_str = "StatReq";
3633 dissect_fetchreq(tvb, pinfo, message_body_tree, offset, message_body_length, TRUE);
3634 }
3635 else {
3636 message_type_str = "StatAns";
3637 dissect_statans(tvb, pinfo, message_body_tree, offset, message_body_length);
3638 }
3639 }
3640 break;
3641
3642 case METHOD_FIND:
3643 {
3644 if (IS_REQUEST(message_code)) {
3645 message_type_str = "FindReq";
3646 dissect_findreq(tvb,pinfo, message_body_tree,offset,message_body_length);
3647 }
3648 else {
3649 message_type_str = "FindAns";
3650 dissect_findans(tvb, pinfo, message_body_tree, offset, message_body_length);
3651 }
3652 }
3653 break;
3654
3655 case METHOD_LEAVE:
3656 {
3657 if (IS_REQUEST(message_code)) {
3658 message_type_str = "LeaveReq";
3659 dissect_leavereq(tvb,pinfo, message_body_tree,offset,message_body_length);
3660 }
3661 else {
3662 message_type_str = "LeaveAns";
3663 dissect_opaque(tvb, pinfo, message_body_tree, hf_reload_overlay_specific, offset, 2, message_body_length);
3664 }
3665 }
3666 break;
3667
3668 case METHOD_JOIN:
3669 {
3670 if (IS_REQUEST(message_code)) {
3671 message_type_str = "JoinReq";
3672 dissect_joinreq(tvb, pinfo, message_body_tree, offset, message_body_length);
3673 }
3674 else {
3675 message_type_str = "JoinAns";
3676 dissect_joinans(tvb, pinfo, message_body_tree, offset, message_body_length);
3677 }
3678 }
3679 break;
3680
3681 case METHOD_UPDATE:
3682 if (0 == strcmp(TOPOLOGY_PLUGIN_CHORD_RELOAD, reload_topology_plugin)) {
3683 if (IS_REQUEST(message_code)) {
3684 message_type_str = "ChordUpdate";
3685 dissect_chordupdate(tvb, pinfo, message_body_tree, offset, message_body_length);
3686 }
3687 }
3688 break;
3689
3690 case METHOD_PATH_TRACK:
3691 if (IS_REQUEST(message_code)) {
3692 message_type_str = "PathTrackReck";
3693 dissect_pathtrackreq(tvb, pinfo, message_body_tree, offset, message_body_length);
3694 }
3695 else {
3696 message_type_str = "PathTrackAns";
3697 dissect_pathtrackans(tvb, pinfo, message_body_tree, offset, message_body_length);
3698 }
3699 break;
3700
3701 default:
3702 break;
3703 }
3704 }
3705 if (message_type_str!= NULL) {
3706 proto_item_append_text(ti_message_body, " (%s<%d>)", message_type_str, message_body_length);
3707 }
3708 else {
3709 proto_item_append_text(ti_message_body,
3710 " (%s%s<%d>)",
3711 val_to_str_const(MSGCODE_TO_METHOD(message_code),methods,"opaque"),
3712 val_to_str_const(MSGCODE_TO_CLASS(message_code), classes_Short, ""),
3713 message_body_length);
3714
3715 }
3716 }
3717 else {
3718 /* Error Response */
3719 guint16 error_length, error_code;
3720 proto_item *ti_message_body;
3721 proto_tree *message_body_tree;
3722 proto_item *ti_error;
3723 proto_tree *error_tree;
3724
3725 /* message_code was already parsed */
3726 proto_tree_add_uint_format_value(message_contents_tree, hf_reload_message_code,
3727 tvb, offset, 2, message_code, "Error");
3728 offset += 2;
3729
3730 /* Message body */
3731 ti_message_body = proto_tree_add_item(message_contents_tree, hf_reload_message_body,
3732 tvb, offset, 4 + message_body_length, ENC_NA);
3733 message_body_tree = proto_item_add_subtree(ti_message_body, ett_reload_message_body);
3734 error_length = tvb_get_ntohs(tvb, offset);
3735 proto_tree_add_uint(message_body_tree, hf_reload_length_uint32, tvb, offset, 4, message_body_length);
3736 offset += 4;
3737
3738 error_code = tvb_get_ntohs(tvb, offset);
3739 if (2 + 2 + error_length >length) {
3740 expert_add_info_format(pinfo, ti_message_body, &ei_reload_truncated_field, "Truncated error message");
3741 return length;
3742 }
3743
3744 ti_error = proto_tree_add_item(message_body_tree, hf_reload_error_response,
3745 tvb, offset, 2 + 2 + error_length, ENC_NA);
3746 error_tree = proto_item_add_subtree(ti_error, ett_reload_error_response);
3747 proto_tree_add_item(error_tree, hf_reload_error_response_code, tvb, offset, 2, ENC_BIG_ENDIAN);
3748 proto_item_append_text(ti_error, ": %s", val_to_str_const(error_code, errorcodes, "Unknown"));
3749 switch(error_code) {
3750 case ERRORCODE_GENERATIONCOUNTERTOOLOW:
3751 {
3752 guint16 local_length = tvb_get_ntohs(tvb, offset+2);
3753 proto_tree_add_item(error_tree, hf_reload_length_uint16, tvb, offset+2, 2, ENC_BIG_ENDIAN);
3754 dissect_storeans(tvb, pinfo, error_tree, offset+4, local_length);
3755 }
3756 break;
3757
3758 case ERRORCODE_UNKNOWNKIND:
3759 {
3760 guint16 local_length = tvb_get_ntohs(tvb, offset+2);
3761 proto_tree_add_item(error_tree, hf_reload_length_uint16, tvb, offset+2, 2, ENC_BIG_ENDIAN);
3762 dissect_kindid_list(tvb, pinfo, error_tree, offset+4, local_length);
3763 }
3764 break;
3765
3766 case ERRORCODE_UNDERLAY_DESTINATION_UNREACHABLE:
3767 {
3768 proto_tree_add_item(error_tree, hf_reload_opaque_string, tvb, offset+2, 32, ENC_ASCII|ENC_NA);
3769 }
3770 break;
3771
3772 default:
3773 dissect_opaque_string(tvb, pinfo, error_tree, hf_reload_error_response_info, offset+2, 2, -1);
3774 if (error_code <= 19) {
3775 guint16 info_length = tvb_get_ntohs(tvb,offset+2);
3776 if (info_length>0) {
3777 proto_item_append_text(ti_error, " (%s)", tvb_get_string_enc(pinfo->pool, tvb, offset+4, info_length, ENC_ASCII));
3778 }
3779 }
3780 break;
3781 }
3782 }
3783 offset += message_body_length;
3784
3785 {
3786 proto_tree *extensions_tree;
3787 proto_item *ti_extensions;
3788 proto_tree *extension_tree;
3789 gint32 extension_offset = 0;
3790 int nExtensions = 0;
3791
3792 ti_extensions =
3793 proto_tree_add_item(message_contents_tree, hf_reload_message_extensions, tvb, offset, 4+extensions_length, ENC_NA);
3794 extensions_tree = proto_item_add_subtree(ti_extensions, ett_reload_message_extensions);
3795 proto_tree_add_item(extensions_tree, hf_reload_length_uint32, tvb, offset, 4, ENC_BIG_ENDIAN);
3796 offset += 4;
3797 while (extension_offset >= 0 && (guint32)extension_offset < extensions_length) {
3798 guint16 type;
3799 proto_item *ti_extension;
3800 guint32 extension_content_length = tvb_get_ntohl(tvb, offset + extension_offset + 3);
3801 if ((extension_offset + 3 + 4 + extension_content_length) > extensions_length) {
3802 expert_add_info_format(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated message extensions");
3803 break;
3804 }
3805 ti_extension = proto_tree_add_item(extensions_tree, hf_reload_message_extension, tvb, offset+ extension_offset, 3 + 4 + extension_content_length, ENC_NA);
3806 extension_tree = proto_item_add_subtree(ti_extension, ett_reload_message_extension);
3807 type = tvb_get_ntohs(tvb, offset+ extension_offset);
3808 proto_tree_add_item(extension_tree, hf_reload_message_extension_type, tvb, offset+ extension_offset, 2, ENC_BIG_ENDIAN);
3809 proto_tree_add_item(extension_tree, hf_reload_message_extension_critical, tvb, offset+ extension_offset + 2, 1, ENC_BIG_ENDIAN);
3810 switch(type) {
3811
3812 case MESSAGEEXTENSIONTYPE_SELF_TUNING_DATA:
3813 {
3814 guint32 extension_length;
3815 proto_tree_add_item(extension_tree, hf_reload_length_uint32, tvb, offset+extension_offset+3, 4, ENC_BIG_ENDIAN);
3816 extension_length = tvb_get_ntohl(tvb, offset+extension_offset+3);
3817 if (extension_length > 0) {
3818 dissect_selftuningdata(tvb, extension_tree, offset+extension_offset+3+4);
3819 }
3820 }
3821 break;
3822
3823 case MESSAGEEXTENSIONTYPE_DIAGNOSTIC_PING:
3824 {
3825 guint32 extension_length;
3826 proto_tree_add_item(extension_tree, hf_reload_length_uint32, tvb, offset+extension_offset+3, 4, ENC_BIG_ENDIAN);
3827 extension_length = tvb_get_ntohl(tvb, offset+extension_offset+3);
3828 if ((extension_length > 0) && (MSGCODE_TO_METHOD(message_code) == METHOD_PING)) {
3829 if (IS_REQUEST(message_code)) {
3830 dissect_diagnosticrequest(-1, tvb, pinfo, extension_tree, offset+extension_offset+3+4, extension_length);
3831 }
3832 else {
3833 dissect_diagnosticresponse(-1, tvb, pinfo, extension_tree, offset+extension_offset+3+4, extension_length);
3834 }
3835 }
3836 }
3837 break;
3838
3839 default:
3840 dissect_opaque(tvb, pinfo, extension_tree, hf_reload_message_extension_content, offset + extension_offset + 3, 4, -1);
3841 break;
3842 }
3843 extension_offset += 3 + 4 + extension_content_length;
3844 nExtensions ++;
3845 }
3846 proto_item_append_text(ti_extensions, " (%d elements)", nExtensions);
3847 }
3848
3849 return ( 2 + 4 + message_body_length + 4 + extensions_length);
3850 }
3851
3852 static int
dissect_reload_message(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3853 dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3854 {
3855 proto_item *ti;
3856 proto_tree *reload_tree;
3857 guint32 relo_token;
3858 guint effective_length;
3859 guint msg_length, dgram_msg_length;
3860 guint16 offset;
3861 conversation_t *conversation;
3862 reload_conv_info_t *reload_info;
3863 reload_transaction_t *reload_trans;
3864 wmem_tree_key_t transaction_id_key[2];
3865 guint32 transaction_id[2];
3866 guint16 options_length;
3867 guint16 via_list_length;
3868 guint16 destination_list_length;
3869 guint16 message_code;
3870 guint16 error_code = 0;
3871 guint32 forwarding_length;
3872 proto_tree *reload_forwarding_tree;
3873 const char *msg_class_str;
3874 const char *msg_method_str = NULL;
3875 gboolean fragmented = FALSE;
3876 gboolean last_fragment = FALSE;
3877 fragment_head *reload_fd_head = NULL;
3878 guint32 fragment = 0;
3879 gboolean save_fragmented = FALSE;
3880 gboolean update_col_info = TRUE;
3881
3882 offset = 0;
3883 effective_length = tvb_captured_length(tvb);
3884
3885 /* First, make sure we have enough data to do the check. */
3886 if (effective_length < MIN_HDR_LENGTH)
3887 return 0;
3888
3889 /*
3890 * First check if the frame is really meant for us.
3891 */
3892 relo_token = tvb_get_ntohl(tvb,0);
3893
3894 if (relo_token != RELOAD_TOKEN) {
3895 return 0;
3896 }
3897
3898 msg_length = get_reload_message_length(pinfo, tvb, offset);
3899 dgram_msg_length = msg_length;
3900
3901 /* The message seems to be a valid reLOAD message! */
3902
3903 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RELOAD");
3904 col_clear(pinfo->cinfo, COL_INFO);
3905
3906 /* Create the transaction key which may be used to track the conversation */
3907 transaction_id[0] = tvb_get_ntohl(tvb, 20);
3908 transaction_id[1] = tvb_get_ntohl(tvb, 24);
3909
3910 transaction_id_key[0].length = 2;
3911 transaction_id_key[0].key = transaction_id;
3912 transaction_id_key[1].length = 0;
3913 transaction_id_key[1].key = NULL;
3914
3915 via_list_length = tvb_get_ntohs(tvb, 32);
3916 destination_list_length = tvb_get_ntohs(tvb, 34);
3917 options_length = tvb_get_ntohs(tvb, 36);
3918
3919 forwarding_length = MIN_HDR_LENGTH + (via_list_length + destination_list_length + options_length);
3920
3921
3922 /* Do we already have a conversation ? */
3923 conversation = find_or_create_conversation(pinfo);
3924
3925 /*
3926 * Do we already have a state structure for this conv
3927 */
3928 reload_info = (reload_conv_info_t *)conversation_get_proto_data(conversation, proto_reload);
3929 if (!reload_info) {
3930 /* No. Attach that information to the conversation, and add
3931 * it to the list of information structures.
3932 */
3933 reload_info = wmem_new(wmem_file_scope(), reload_conv_info_t);
3934 reload_info->transaction_pdus = wmem_tree_new(wmem_file_scope());
3935 conversation_add_proto_data(conversation, proto_reload, reload_info);
3936 }
3937
3938 ti = proto_tree_add_item(tree, proto_reload, tvb, 0, -1, ENC_NA);
3939
3940 reload_tree = proto_item_add_subtree(ti, ett_reload);
3941
3942 /*
3943 * Message dissection
3944 */
3945
3946 /*
3947 * Forwarding Header
3948 */
3949 ti = proto_tree_add_item(reload_tree, hf_reload_forwarding, tvb, 0, forwarding_length, ENC_NA);
3950 reload_forwarding_tree = proto_item_add_subtree(ti, ett_reload_forwarding);
3951
3952 proto_tree_add_uint(reload_forwarding_tree, hf_reload_token, tvb, 0, 4, relo_token);
3953 proto_tree_add_item(reload_forwarding_tree, hf_reload_overlay, tvb, 4, 4, ENC_BIG_ENDIAN);
3954 {
3955 proto_item *ti_tmp;
3956 guint16 tmp;
3957 tmp = tvb_get_ntohs(tvb,8);
3958 ti_tmp = proto_tree_add_item(reload_forwarding_tree, hf_reload_configuration_sequence, tvb, 8, 2, ENC_BIG_ENDIAN);
3959 if (tmp == 0) {
3960 proto_item_append_text(ti_tmp, "\n [sequence value not verified]");
3961 }
3962 }
3963 proto_tree_add_item(reload_forwarding_tree, hf_reload_version, tvb, 10, 1, ENC_BIG_ENDIAN);
3964
3965 proto_tree_add_item(reload_forwarding_tree, hf_reload_ttl, tvb, 11, 1, ENC_BIG_ENDIAN);
3966 {
3967 proto_item *ti_fragment;
3968 proto_tree *fragment_tree;
3969 guint32 bit_offset;
3970
3971 fragment = tvb_get_ntohl(tvb,12);
3972
3973 ti_fragment = proto_tree_add_uint(reload_forwarding_tree, hf_reload_fragment_flag, tvb, 12, 4, fragment);
3974 fragment_tree = proto_item_add_subtree(ti_fragment, ett_reload_fragment_flag);
3975 bit_offset = (12) * 8;
3976
3977 if (fragment & 0x80000000) {
3978 proto_item_append_text(ti_fragment, " (Fragment)");
3979 fragmented = TRUE;
3980 }
3981 if (fragment & 0x40000000) {
3982 proto_item_append_text(ti_fragment, " (Last)");
3983 last_fragment = TRUE;
3984 }
3985 proto_tree_add_bits_item(fragment_tree, hf_reload_fragment_fragmented, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3986 proto_tree_add_bits_item(fragment_tree, hf_reload_fragment_last_fragment, tvb, bit_offset+1, 1, ENC_BIG_ENDIAN);
3987 proto_tree_add_bits_item(fragment_tree, hf_reload_fragment_reserved, tvb, bit_offset+2, 6, ENC_BIG_ENDIAN);
3988 fragment = fragment & 0x00ffffff;
3989 proto_tree_add_uint(fragment_tree, hf_reload_fragment_offset, tvb, 13, 3, fragment);
3990 }
3991
3992 /* msg_length is already parsed */
3993 proto_tree_add_uint(reload_forwarding_tree, hf_reload_length_uint32, tvb, 16, 4, msg_length);
3994 proto_tree_add_item(reload_forwarding_tree, hf_reload_trans_id, tvb, 20, 8, ENC_BIG_ENDIAN);
3995 {
3996 proto_item *ti_tmp;
3997 guint32 tmp;
3998 tmp = tvb_get_ntohl(tvb,28);
3999 ti_tmp = proto_tree_add_item(reload_forwarding_tree, hf_reload_max_response_length, tvb, 28, 4, ENC_BIG_ENDIAN);
4000 if (0 == tmp) {
4001 proto_item_append_text(ti_tmp, "\n [Response length not restricted]");
4002 }
4003 }
4004 /* variable lengths fields lengths are already parsed */
4005 proto_tree_add_uint(reload_forwarding_tree, hf_reload_via_list_length, tvb, 32, 2, via_list_length);
4006 proto_tree_add_uint(reload_forwarding_tree, hf_reload_destination_list_length, tvb, 34, 2, destination_list_length);
4007 proto_tree_add_uint(reload_forwarding_tree, hf_reload_options_length, tvb, 36, 2, options_length);
4008
4009 offset += MIN_HDR_LENGTH;
4010
4011 if (((guint)offset + via_list_length) > msg_length) {
4012 expert_add_info(pinfo, ti, &ei_reload_truncated_packet);
4013 return MIN_HDR_LENGTH;
4014 }
4015
4016 if (via_list_length > 0) {
4017 proto_item *ti_vialist;
4018 proto_tree *vialist_tree;
4019 int numDestinations = 0;
4020 ti_vialist = proto_tree_add_item(reload_forwarding_tree, hf_reload_via_list, tvb, offset, via_list_length, ENC_NA);
4021 vialist_tree = proto_item_add_subtree(ti_vialist, ett_reload_via_list);
4022
4023 dissect_destination_list(tvb, pinfo, vialist_tree, offset, via_list_length, &numDestinations);
4024 proto_item_append_text(ti_vialist, " (Destination<%d>): %d elements",via_list_length,numDestinations);
4025 }
4026 offset += via_list_length;
4027
4028 if (((guint)offset + destination_list_length) > msg_length) {
4029 expert_add_info(pinfo, ti, &ei_reload_truncated_packet);
4030 return offset;
4031 }
4032
4033 if (destination_list_length > 0) {
4034 proto_item *ti_destination_list;
4035 proto_tree *destination_list_tree;
4036 int numDestinations;
4037 ti_destination_list = proto_tree_add_item(reload_forwarding_tree, hf_reload_destination_list,
4038 tvb, offset, destination_list_length, ENC_NA);
4039 destination_list_tree = proto_item_add_subtree(ti_destination_list, ett_reload_destination_list);
4040
4041 dissect_destination_list(tvb, pinfo, destination_list_tree, offset, destination_list_length, &numDestinations);
4042 proto_item_append_text(ti_destination_list, " (Destination<%d>): %d elements",
4043 destination_list_length,numDestinations);
4044 }
4045 offset += destination_list_length;
4046
4047 if (((guint)offset + options_length) > msg_length) {
4048 expert_add_info(pinfo, ti, &ei_reload_truncated_packet);
4049 return offset;
4050 }
4051
4052 if (options_length > 0) {
4053 gint32 local_offset = 0;
4054 proto_item *ti_options;
4055 proto_tree *options_tree;
4056 int nOptions = 0;
4057
4058 ti_options = proto_tree_add_item(reload_forwarding_tree, hf_reload_forwarding_options, tvb, offset+local_offset, options_length, ENC_NA);
4059 options_tree = proto_item_add_subtree(ti_options, ett_reload_forwarding_options);
4060 while (local_offset >=0 && local_offset < options_length) {
4061 int local_increment;
4062 local_increment = dissect_forwardingoption(tvb, pinfo, options_tree, offset+local_offset, options_length-local_offset);
4063 if (0 >= local_increment) break;
4064 local_offset += local_increment;
4065 nOptions++;
4066 }
4067 proto_item_append_text(ti_options, " (ForwardingOption<%d>): %d elements",options_length,nOptions);
4068 }
4069 offset += options_length;
4070
4071 if ((reload_defragment) && ((fragmented != FALSE) && !((fragment == 0) && (last_fragment)))) {
4072 tvbuff_t *next_tvb = NULL;
4073 reload_fd_head = NULL;
4074
4075 if (tvb_bytes_exist(tvb, offset, msg_length - offset)) {
4076 reload_fd_head = fragment_add_check(&reload_reassembly_table, tvb, offset,
4077 pinfo,
4078 transaction_id[0]^transaction_id[1],
4079 NULL,
4080 fragment,
4081 msg_length - offset,
4082 !last_fragment);
4083
4084 next_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled RELOAD",
4085 reload_fd_head, &reload_frag_items, &update_col_info, reload_tree);
4086 }
4087 if (next_tvb == NULL) {
4088 /* Just show this as a fragment. */
4089 col_add_fstr(pinfo->cinfo, COL_INFO, "Fragmented RELOAD protocol (trans id=%x%x off=%u",
4090 transaction_id[0],transaction_id[1], fragment);
4091 if (reload_fd_head && reload_fd_head->reassembled_in != pinfo->num) {
4092 col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]",
4093 reload_fd_head->reassembled_in);
4094 }
4095 save_fragmented = pinfo->fragmented;
4096 pinfo->fragmented = TRUE;
4097 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
4098 pinfo->fragmented = save_fragmented;
4099 return effective_length;
4100 }
4101 tvb = next_tvb;
4102 msg_length -= offset; /* need to adjust the length, as the new tvb starts after the forwarding header */
4103 offset = 0;
4104 }
4105
4106 effective_length = tvb_captured_length(tvb);
4107 if (effective_length < msg_length) {
4108 /* The effective length is too small for the packet */
4109 expert_add_info(pinfo, NULL, &ei_reload_truncated_packet);
4110 return 0;
4111 }
4112
4113 /*Handle retransmission after reassembly since we use message_contents for it */
4114
4115 message_code = tvb_get_ntohs(tvb, offset);
4116
4117 if (!pinfo->fd->visited) {
4118
4119 if ((reload_trans = (reload_transaction_t *)
4120 wmem_tree_lookup32_array(reload_info->transaction_pdus, transaction_id_key)) == NULL) {
4121 reload_trans = wmem_new(wmem_file_scope(), reload_transaction_t);
4122 reload_trans->req_frame = 0;
4123 reload_trans->rep_frame = 0;
4124 reload_trans->req_time = pinfo->abs_ts;
4125 wmem_tree_insert32_array(reload_info->transaction_pdus, transaction_id_key, (void *)reload_trans);
4126 }
4127
4128 /* check whether the message is a request or a response */
4129
4130 if (IS_REQUEST(message_code) && (message_code != RELOAD_ERROR)) {
4131 /* This is a request */
4132 if (reload_trans->req_frame == 0) {
4133 reload_trans->req_frame = pinfo->num;
4134 }
4135 }
4136 else {
4137 /* This is a catch-all for all non-request messages */
4138 if (reload_trans->rep_frame == 0) {
4139 reload_trans->rep_frame = pinfo->num;
4140 }
4141 }
4142 }
4143 else {
4144 reload_trans = (reload_transaction_t *)wmem_tree_lookup32_array(reload_info->transaction_pdus, transaction_id_key);
4145 }
4146
4147 if (!reload_trans) {
4148 /* create a "fake" pana_trans structure */
4149 reload_trans = wmem_new(pinfo->pool, reload_transaction_t);
4150 reload_trans->req_frame = 0;
4151 reload_trans->rep_frame = 0;
4152 reload_trans->req_time = pinfo->abs_ts;
4153 }
4154
4155 /* Retransmission control */
4156 if (IS_REQUEST(message_code) && (message_code != RELOAD_ERROR)) {
4157 if (reload_trans->req_frame != pinfo->num) {
4158 proto_item *it;
4159 it = proto_tree_add_uint(reload_tree, hf_reload_duplicate, tvb, 0, 0, reload_trans->req_frame);
4160 proto_item_set_generated(it);
4161 }
4162 if (reload_trans->rep_frame) {
4163 proto_item *it;
4164 it = proto_tree_add_uint(reload_tree, hf_reload_response_in, tvb, 0, 0, reload_trans->rep_frame);
4165 proto_item_set_generated(it);
4166 }
4167 }
4168 else {
4169 /* This is a response */
4170 if (reload_trans->rep_frame != pinfo->num) {
4171 proto_item *it;
4172 it = proto_tree_add_uint(reload_tree, hf_reload_duplicate, tvb, 0, 0, reload_trans->rep_frame);
4173 proto_item_set_generated(it);
4174 }
4175
4176 if (reload_trans->req_frame) {
4177 proto_item *it;
4178 nstime_t ns;
4179
4180 it = proto_tree_add_uint(reload_tree, hf_reload_response_to, tvb, 0, 0, reload_trans->req_frame);
4181 proto_item_set_generated(it);
4182
4183 nstime_delta(&ns, &pinfo->abs_ts, &reload_trans->req_time);
4184 it = proto_tree_add_time(reload_tree, hf_reload_time, tvb, 0, 0, &ns);
4185 proto_item_set_generated(it);
4186 }
4187 }
4188
4189 if (message_code == RELOAD_ERROR) {
4190 error_code = tvb_get_ntohs(tvb, forwarding_length + 2+4);
4191 msg_class_str = "Error Response";
4192 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", msg_class_str, val_to_str_const(error_code, errorcodes, "Unknown"));
4193 proto_item_append_text(ti, ": %s %s", msg_class_str, val_to_str_const(error_code, errorcodes, "Unknown"));
4194 }
4195 else {
4196 msg_class_str = val_to_str(MSGCODE_TO_CLASS(message_code), classes, "Unknown %d");
4197 msg_method_str = val_to_str(MSGCODE_TO_METHOD(message_code), methods, "Unknown %d");
4198
4199 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
4200 msg_method_str, msg_class_str);
4201 proto_item_append_text(ti, ": %s %s", msg_method_str, msg_class_str);
4202 }
4203
4204
4205 offset += dissect_reload_messagecontents(tvb, pinfo, reload_tree, offset, (effective_length - offset));
4206
4207 /* Security Block */
4208 {
4209 proto_item *ti_security_block;
4210 proto_tree *security_block_tree;
4211 proto_item *ti_certificates;
4212 proto_tree *certificates_tree;
4213 guint16 certificates_length;
4214 guint16 signeridentityvalue_length;
4215 guint16 signaturevalue_length;
4216 guint16 security_block_offset = 0;
4217
4218 certificates_length = tvb_get_ntohs(tvb, offset);
4219 security_block_offset += 2 + certificates_length;
4220 security_block_offset += 2; /* SignatureAndHashAlgorithm algorithm; */
4221 security_block_offset += 1; /* SignerIdentityType identity_type; */
4222 signeridentityvalue_length = tvb_get_ntohs(tvb, offset +security_block_offset);
4223 security_block_offset += 2;
4224 security_block_offset += signeridentityvalue_length;
4225 signaturevalue_length = tvb_get_ntohs(tvb, offset +security_block_offset);
4226 security_block_offset += 2;
4227 security_block_offset += signaturevalue_length;
4228
4229 ti_security_block = proto_tree_add_item(reload_tree, hf_reload_security_block, tvb, offset,
4230 security_block_offset, ENC_NA);
4231 security_block_tree = proto_item_add_subtree(ti_security_block, ett_reload_security_block);
4232 /* start parsing from the beginning */
4233 security_block_offset = 0;
4234 ti_certificates = proto_tree_add_item(security_block_tree,
4235 hf_reload_certificates, tvb, offset,
4236 2 + certificates_length,
4237 ENC_NA);
4238 proto_item_append_text(ti_certificates, " (GenericCertificate<%d>)", certificates_length);
4239 certificates_tree = proto_item_add_subtree(ti_certificates, ett_reload_certificates);
4240 proto_tree_add_uint(certificates_tree, hf_reload_length_uint16, tvb, offset, 2, certificates_length);
4241 security_block_offset += 2;
4242 /* certificates */
4243
4244 {
4245 gint32 certificate_offset = 0;
4246 int nCertificates = 0;
4247 while (certificate_offset >= 0 && certificate_offset < certificates_length) {
4248 proto_item *ti_genericcertificate;
4249 proto_tree *genericcertificate_tree;
4250 guint16 certificate_length;
4251
4252 certificate_length = tvb_get_ntohs(tvb, offset + security_block_offset + certificate_offset + 1);
4253 if (certificate_offset + 1 + 2 + certificate_length > certificates_length) {
4254 expert_add_info_format(pinfo, ti_security_block, &ei_reload_truncated_field, "Truncated certificate");
4255 break;
4256 }
4257 ti_genericcertificate =
4258 proto_tree_add_item(certificates_tree,
4259 hf_reload_genericcertificate, tvb, offset + security_block_offset + certificate_offset,
4260 1 + 2 + certificate_length,
4261 ENC_NA);
4262 genericcertificate_tree = proto_item_add_subtree(ti_genericcertificate, ett_reload_genericcertificate);
4263
4264 proto_tree_add_item(genericcertificate_tree, hf_reload_certificate_type, tvb,
4265 offset + security_block_offset + certificate_offset, 1, ENC_BIG_ENDIAN);
4266
4267 proto_tree_add_item(genericcertificate_tree, hf_reload_length_uint16, tvb,
4268 offset + security_block_offset + certificate_offset+1, 2, ENC_BIG_ENDIAN);
4269
4270 switch (tvb_get_guint8(tvb, offset + security_block_offset + certificate_offset)) {
4271 case 0: {
4272 asn1_ctx_t asn1_ctx;
4273
4274 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
4275 dissect_x509af_Certificate(FALSE, tvb, offset + security_block_offset + certificate_offset + 1 + 2, &asn1_ctx,
4276 genericcertificate_tree, hf_reload_certificate);
4277 }
4278 break;
4279
4280 default:
4281 dissect_opaque(tvb, pinfo, genericcertificate_tree, hf_reload_certificate, offset + security_block_offset + certificate_offset + 1, 2, -1);
4282 }
4283 certificate_offset += 1 + 2 + certificate_length;
4284 nCertificates++;
4285 }
4286 proto_item_append_text(ti_certificates, ": %d elements", nCertificates);
4287 }
4288
4289 security_block_offset += certificates_length;
4290
4291 dissect_signature(tvb, pinfo, security_block_tree, offset + security_block_offset);
4292 /* Signature */
4293 }
4294
4295
4296 return dgram_msg_length;
4297 }
4298
4299 static gboolean
dissect_reload_heur(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)4300 dissect_reload_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4301 {
4302 if (dissect_reload_message(tvb, pinfo, tree, data) == 0) {
4303 /*
4304 * It wasn't a valid RELOAD message, and wasn't
4305 * dissected as such.
4306 */
4307 return FALSE;
4308 }
4309 return TRUE;
4310 }
4311
4312 void
proto_register_reload(void)4313 proto_register_reload(void)
4314 {
4315 module_t *reload_module;
4316 expert_module_t* expert_reload;
4317 static hf_register_info hf[] = {
4318 { &hf_reload_response_in,
4319 { "Response in", "reload.response-in", FT_FRAMENUM,
4320 BASE_NONE, NULL, 0x0, "The response to this RELOAD Request is in this frame", HFILL
4321 }
4322 },
4323 { &hf_reload_response_to,
4324 { "Request in", "reload.response-to", FT_FRAMENUM,
4325 BASE_NONE, NULL, 0x0, "This is a response to the RELOAD Request in this frame", HFILL
4326 }
4327 },
4328 { &hf_reload_time,
4329 { "Time", "reload.time", FT_RELATIVE_TIME,
4330 BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL
4331 }
4332 },
4333 { &hf_reload_duplicate,
4334 { "Duplicated original message in", "reload.duplicate", FT_FRAMENUM,
4335 BASE_NONE, NULL, 0x0, "This is a duplicate of RELOAD message in this frame", HFILL
4336 }
4337 },
4338 { &hf_reload_forwarding,
4339 { "ForwardingHeader", "reload.forwarding", FT_NONE,
4340 BASE_NONE, NULL, 0x0, NULL, HFILL
4341 }
4342 },
4343 { &hf_reload_token,
4344 { "relo_token (uint32)", "reload.forwarding.token", FT_UINT32,
4345 BASE_HEX, NULL, 0x0, NULL, HFILL
4346 }
4347 },
4348 { &hf_reload_overlay,
4349 { "overlay (uint32)", "reload.forwarding.overlay", FT_UINT32,
4350 BASE_HEX, NULL, 0x0, NULL, HFILL
4351 }
4352 },
4353 { &hf_reload_configuration_sequence,
4354 { "configuration_sequence (uint16)", "reload.forwarding.configuration_sequence", FT_UINT16,
4355 BASE_DEC, NULL, 0x0, NULL, HFILL
4356 }
4357 },
4358 { &hf_reload_version,
4359 { "version (uint8)", "reload.forwarding.version", FT_UINT8,
4360 BASE_HEX, VALS(versions), 0x0, NULL, HFILL
4361 }
4362 },
4363 { &hf_reload_ttl,
4364 { "ttl (uint8)", "reload.forwarding.ttl", FT_UINT8,
4365 BASE_DEC, NULL, 0x0, NULL, HFILL
4366 }
4367 },
4368 { &hf_reload_fragment_flag,
4369 { "fragment (uint32)", "reload.forwarding.fragment", FT_UINT32,
4370 BASE_HEX, NULL, 0x0, NULL, HFILL
4371 }
4372 },
4373 { &hf_reload_fragment_fragmented,
4374 { "Fragmented (always set)", "reload.forwarding.fragment.fragmented", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4375 NULL, HFILL
4376 }
4377 },
4378 { &hf_reload_fragment_last_fragment,
4379 { "Last Fragment", "reload.forwarding.fragment.last", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4380 NULL, HFILL
4381 }
4382 },
4383 { &hf_reload_fragment_reserved,
4384 { "Reserved (always 0)", "reload.forwarding.fragment.reserved", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4385 NULL, HFILL
4386 }
4387 },
4388 { &hf_reload_fragment_offset,
4389 { "Fragment Offset","reload.forwarding.fragment.offset", FT_UINT32,
4390 BASE_DEC, NULL, 0x0, NULL, HFILL
4391 }
4392 },
4393 { &hf_reload_trans_id,
4394 { "transaction_id (uint32)", "reload.forwarding.trans_id", FT_UINT64,
4395 BASE_HEX, NULL, 0x0, NULL, HFILL
4396 }
4397 },
4398 { &hf_reload_max_response_length,
4399 { "max_response_length (uint32)", "reload.forwarding.max_response_length", FT_UINT32,
4400 BASE_DEC, NULL, 0x0, NULL, HFILL
4401 }
4402 },
4403 { &hf_reload_via_list_length,
4404 { "via_list_length (uint16)", "reload.forwarding.via_list.length", FT_UINT16,
4405 BASE_DEC, NULL, 0x0, NULL, HFILL
4406 }
4407 },
4408 { &hf_reload_destination_list_length,
4409 { "destination_list_length (uint16)", "reload.forwarding.destination_list.length", FT_UINT16,
4410 BASE_DEC, NULL, 0x0, NULL, HFILL
4411 }
4412 },
4413 { &hf_reload_options_length,
4414 { "options_length (uint16)", "reload.forwarding.options.length", FT_UINT16,
4415 BASE_DEC, NULL, 0x0, NULL, HFILL
4416 }
4417 },
4418 { &hf_reload_via_list,
4419 { "via_list", "reload.forwarding.via_list", FT_NONE,
4420 BASE_NONE, NULL, 0x0, NULL, HFILL
4421 }
4422 },
4423 { &hf_reload_destination,
4424 { "Destination", "reload.destination", FT_NONE,
4425 BASE_NONE, NULL, 0x0, NULL, HFILL
4426 }
4427 },
4428 { &hf_reload_destination_compressed_id,
4429 { "compressed_id (uint16)", "reload.forwarding.destination.compressed_id", FT_UINT16,
4430 BASE_HEX, NULL, 0x0, NULL, HFILL
4431 }
4432 },
4433 { &hf_reload_destination_type,
4434 { "type (DestinationType)", "reload.forwarding.destination.type", FT_UINT8,
4435 BASE_HEX, VALS(destinationtypes), 0x0, NULL, HFILL
4436 }
4437 },
4438 { &hf_reload_destination_data_node_id,
4439 { "node_id (NodeId)", "reload.destination.data.nodeid", FT_BYTES,
4440 BASE_NONE, NULL, 0x0, NULL, HFILL
4441 }
4442 },
4443 { &hf_reload_destination_data_resource_id,
4444 { "resource_id", "reload.destination.data.resourceid", FT_NONE,
4445 BASE_NONE, NULL, 0x0, NULL, HFILL
4446 }
4447 },
4448 { &hf_reload_nodeid,
4449 { "NodeId", "reload.nodeid", FT_BYTES,
4450 BASE_NONE, NULL, 0x0, NULL, HFILL
4451 }
4452 },
4453 { &hf_reload_resourceid,
4454 { "ResourceId", "reload.resource_id", FT_NONE,
4455 BASE_NONE, NULL, 0x0, NULL, HFILL
4456 }
4457 },
4458 { &hf_reload_destination_data_compressed_id,
4459 { "compressed_id", "reload.destination.data.compressed_id", FT_NONE,
4460 BASE_NONE, NULL, 0x0, NULL, HFILL
4461 }
4462 },
4463 { &hf_reload_destination_list,
4464 { "destination_list", "reload.forwarding.destination_list", FT_NONE,
4465 BASE_NONE, NULL, 0x0, NULL, HFILL
4466 }
4467 },
4468 { &hf_reload_forwarding_options,
4469 { "options", "reload.forwarding.options", FT_NONE,
4470 BASE_NONE, NULL, 0x0, NULL, HFILL
4471 }
4472 },
4473 { &hf_reload_forwarding_option,
4474 { "ForwardingOption", "reload.forwarding.option", FT_NONE,
4475 BASE_NONE, NULL, 0x0, NULL, HFILL
4476 }
4477 },
4478 { &hf_reload_forwarding_option_type,
4479 { "type (ForwardingOptionType)", "reload.forwarding.option.type", FT_UINT8,
4480 BASE_DEC, VALS(forwardingoptiontypes), 0x0, NULL, HFILL
4481 }
4482 },
4483 { &hf_reload_forwarding_option_flags,
4484 { "flags (uint8)", "reload.forwarding.option.flags", FT_UINT8,
4485 BASE_HEX, NULL, 0x0, NULL, HFILL
4486 }
4487 },
4488 { &hf_reload_forwarding_option_flag_ignore_state_keeping,
4489 { "IGNORE_STATE_KEEPING", "reload.forwarding.option.flag.ignore_state_keeping", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4490 NULL, HFILL
4491 }
4492 },
4493 { &hf_reload_forwarding_option_flag_response_copy,
4494 { "RESPONSE_COPY", "reload.forwarding.option.flag.response_copy", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4495 NULL, HFILL
4496 }
4497 },
4498 { &hf_reload_forwarding_option_flag_destination_critical,
4499 { "DESTINATION_CRITICAL", "reload.forwarding.option.flags.destination_critical", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4500 NULL, HFILL
4501 }
4502 },
4503 { &hf_reload_forwarding_option_flag_forward_critical,
4504 { "FORWARD_CRITICAL", "reload.forwarding.option.flags.forward_critical", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
4505 NULL, HFILL
4506 }
4507 },
4508 { &hf_reload_attachreqans,
4509 { "AttachReqAns", "reload.attachreqans", FT_NONE,
4510 BASE_NONE, NULL, 0x0, NULL, HFILL
4511 }
4512 },
4513 { &hf_reload_ufrag,
4514 { "ufrag", "reload.ufrag", FT_NONE,
4515 BASE_NONE, NULL, 0x0, NULL, HFILL
4516 }
4517 },
4518 { &hf_reload_password,
4519 { "password", "reload.password", FT_NONE,
4520 BASE_NONE, NULL, 0x0, NULL, HFILL
4521 }
4522 },
4523 { &hf_reload_role,
4524 { "role", "reload.role", FT_NONE,
4525 BASE_NONE, NULL, 0x0, NULL, HFILL
4526 }
4527 },
4528 { &hf_reload_icecandidates,
4529 { "candidates", "reload.icecandidates", FT_NONE,
4530 BASE_NONE, NULL, 0x0, NULL, HFILL
4531 }
4532 },
4533 { &hf_reload_icecandidate,
4534 { "IceCandidate", "reload.icecandidate", FT_NONE,
4535 BASE_NONE, NULL, 0x0, NULL, HFILL
4536 }
4537 },
4538 { &hf_reload_icecandidate_addr_port,
4539 { "addr_port", "reload.icecandidate.addr_port", FT_NONE,
4540 BASE_NONE, NULL, 0x0, NULL, HFILL
4541 }
4542 },
4543 { &hf_reload_icecandidate_relay_addr,
4544 { "rel_addr_port", "reload.icecandidate.relay_addr", FT_NONE,
4545 BASE_NONE, NULL, 0x0, NULL, HFILL
4546 }
4547 },
4548 { &hf_reload_ipaddressport,
4549 { "IpAddressPort", "reload.ipaddressport", FT_NONE,
4550 BASE_NONE, NULL, 0x0, NULL, HFILL
4551 }
4552 },
4553 { &hf_reload_ipaddressport_type,
4554 { "type (AddressType)", "reload.ipaddressport.type", FT_UINT8,
4555 BASE_HEX, VALS(ipaddressporttypes), 0x0, NULL, HFILL
4556 }
4557 },
4558 { &hf_reload_ipv4addrport,
4559 { "IPv4AddrPort", "reload.ipv4addrport", FT_NONE,
4560 BASE_NONE, NULL, 0x0, NULL, HFILL
4561 }
4562 },
4563 { &hf_reload_ipv4addr,
4564 { "addr (uint32)", "reload.ipv4addr", FT_IPv4,
4565 BASE_NONE, NULL, 0x0, NULL, HFILL
4566 }
4567 },
4568 { &hf_reload_ipv6addrport,
4569 { "IPv6AddrPort", "reload.ipv6addrport", FT_NONE,
4570 BASE_NONE, NULL, 0x0, NULL, HFILL
4571 }
4572 },
4573 { &hf_reload_ipv6addr,
4574 { "addr (uint128)", "reload.ipv6addr", FT_IPv6,
4575 BASE_NONE, NULL, 0x0, NULL, HFILL
4576 }
4577 },
4578 { &hf_reload_port,
4579 { "port (uint16)", "reload.port", FT_UINT16,
4580 BASE_DEC, NULL, 0x0, NULL, HFILL
4581 }
4582 },
4583 { &hf_reload_overlaylink_type,
4584 { "overlay_link (OverlayLinkType)", "reload.overlaylink.type", FT_UINT8,
4585 BASE_DEC, VALS(overlaylinktypes), 0x0, NULL, HFILL
4586 }
4587 },
4588 { &hf_reload_icecandidate_foundation,
4589 { "foundation", "reload.icecandidate.foundation", FT_NONE,
4590 BASE_NONE, NULL, 0x0, NULL, HFILL
4591 }
4592 },
4593 { &hf_reload_icecandidate_priority,
4594 { "priority (uint32)", "reload.icecandidate.priority", FT_UINT32,
4595 BASE_DEC, NULL, 0x0, NULL, HFILL
4596 }
4597 },
4598 { &hf_reload_icecandidate_type,
4599 { "Ice candidate type", "reload.icecandidate.type", FT_UINT8,
4600 BASE_DEC, VALS(candtypes), 0x0, NULL, HFILL
4601 }
4602 },
4603 { &hf_reload_iceextensions,
4604 { "extensions", "reload.iceextensions", FT_NONE,
4605 BASE_NONE, NULL, 0x0, NULL, HFILL
4606 }
4607 },
4608 { &hf_reload_iceextension,
4609 { "IceExtension", "reload.iceextension", FT_NONE,
4610 BASE_NONE, NULL, 0x0, NULL, HFILL
4611 }
4612 },
4613 { &hf_reload_iceextension_name,
4614 { "name", "reload.iceextension.name", FT_NONE,
4615 BASE_NONE, NULL, 0x0, NULL, HFILL
4616 }
4617 },
4618 { &hf_reload_iceextension_value,
4619 { "value", "reload.iceextension.value", FT_NONE,
4620 BASE_NONE, NULL, 0x0, NULL, HFILL
4621 }
4622 },
4623 { &hf_reload_sendupdate,
4624 { "send_update (Boolean)", "reload.sendupdate", FT_BOOLEAN,
4625 BASE_NONE, NULL, 0x0, NULL, HFILL
4626 }
4627 },
4628 { &hf_reload_message_contents,
4629 { "MessageContents", "reload.message.contents", FT_NONE,
4630 BASE_NONE, NULL, 0x0, NULL, HFILL
4631 }
4632 },
4633 { &hf_reload_message_code,
4634 { "message_code (uint16)", "reload.message.code", FT_UINT16,
4635 BASE_DEC, NULL, 0x0, NULL, HFILL
4636 }
4637 },
4638 { &hf_reload_message_body,
4639 { "message_body", "reload.message.body", FT_NONE,
4640 BASE_NONE, NULL, 0x0, NULL, HFILL
4641 }
4642 },
4643 { &hf_reload_message_extensions,
4644 { "extensions", "reload.message.extensions", FT_NONE,
4645 BASE_NONE, NULL, 0x0, NULL, HFILL
4646 }
4647 },
4648 { &hf_reload_message_extension,
4649 { "MessageExtension", "reload.message_extension", FT_NONE,
4650 BASE_NONE, NULL, 0x0, NULL, HFILL
4651 }
4652 },
4653 { &hf_reload_message_extension_type,
4654 { "type (MessageExtensionType)", "reload.message_extension.type", FT_UINT16,
4655 BASE_DEC, VALS(messageextensiontypes), 0x0, NULL, HFILL
4656 }
4657 },
4658 { &hf_reload_message_extension_critical,
4659 { "critical (Boolean)", "reload.message_extension.critical", FT_BOOLEAN,
4660 BASE_NONE, NULL, 0x0, NULL, HFILL
4661 }
4662 },
4663 { &hf_reload_message_extension_content,
4664 { "extension_content", "reload.message_extension.content", FT_BYTES,
4665 BASE_NONE, NULL, 0x0, NULL, HFILL
4666 }
4667 },
4668 { &hf_reload_error_response,
4669 { "ErrorResponse", "reload.error_response", FT_NONE,
4670 BASE_NONE, NULL, 0x0, NULL, HFILL
4671 }
4672 },
4673 { &hf_reload_error_response_code,
4674 { "error_code (uint16)", "reload.error_response.code", FT_UINT16,
4675 BASE_DEC, VALS(errorcodes), 0x0, NULL, HFILL
4676 }
4677 },
4678 { &hf_reload_error_response_info,
4679 { "error_info", "reload.error_response_info", FT_NONE,
4680 BASE_NONE, NULL, 0x0, NULL, HFILL
4681 }
4682 },
4683 { &hf_reload_security_block,
4684 { "SecurityBlock", "reload.security_block", FT_NONE,
4685 BASE_NONE, NULL, 0x0, NULL, HFILL
4686 }
4687 },
4688 { &hf_reload_certificates,
4689 { "certificates", "reload.certificates", FT_NONE,
4690 BASE_NONE, NULL, 0x0, NULL, HFILL
4691 }
4692 },
4693 { &hf_reload_certificate_type,
4694 { "type (CertificateType)", "reload.certificate.type", FT_UINT8,
4695 BASE_DEC, VALS(tls_certificate_type), 0x0, NULL, HFILL
4696 }
4697 },
4698 { &hf_reload_genericcertificate,
4699 { "GenericCertificate", "reload.genericcertificate", FT_NONE,
4700 BASE_NONE, NULL, 0x0, NULL, HFILL
4701 }
4702 },
4703 { &hf_reload_certificate,
4704 { "certificate", "reload.certificate", FT_NONE,
4705 BASE_NONE, NULL, 0x0, NULL, HFILL
4706 }
4707 },
4708 { &hf_reload_signature,
4709 { "signature (Signature)", "reload.signature", FT_NONE,
4710 BASE_NONE, NULL, 0x0, NULL, HFILL
4711 }
4712 },
4713 { &hf_reload_signatureandhashalgorithm,
4714 { "algorithm (SignatureAndHashAlgorithm)", "reload.signatureandhashalgorithm", FT_NONE,
4715 BASE_NONE, NULL, 0x0, NULL, HFILL
4716 }
4717 },
4718 { &hf_reload_hash_algorithm,
4719 { "hash (HashAlgorithm)", "reload.hash_algorithm", FT_UINT8,
4720 BASE_DEC, VALS(tls_hash_algorithm), 0x0, NULL, HFILL
4721 }
4722 },
4723 { &hf_reload_signeridentity_value_hash_alg,
4724 { "hash_alg (HashAlgorithm)", "reload.signeridentityvalue.hash_alg", FT_UINT8,
4725 BASE_DEC, VALS(tls_hash_algorithm), 0x0, NULL, HFILL
4726 }
4727 },
4728 { &hf_reload_signature_algorithm,
4729 { "signature (SignatureAlgorithm)", "reload.signature_algorithm", FT_UINT8,
4730 BASE_DEC, VALS(tls_signature_algorithm), 0x0, NULL, HFILL
4731 }
4732 },
4733 { &hf_reload_signeridentity,
4734 { "identity (SignerIdentity)", "reload.signature.identity", FT_NONE,
4735 BASE_NONE, NULL, 0x0, NULL, HFILL
4736 }
4737 },
4738 { &hf_reload_signeridentity_identity,
4739 { "identity", "reload.signature.identity.identity", FT_NONE,
4740 BASE_NONE, NULL, 0x0, NULL, HFILL
4741 }
4742 },
4743 { &hf_reload_signeridentity_type,
4744 { "identity_type (SignerIdentityType)", "reload.signature.identity.type", FT_UINT8,
4745 BASE_DEC, VALS(signeridentitytypes), 0x0, NULL, HFILL
4746 }
4747 },
4748 { &hf_reload_signeridentity_value,
4749 { "SignatureIdentityValue", "reload.signature.identity.value", FT_NONE,
4750 BASE_NONE, NULL, 0x0, NULL, HFILL
4751 }
4752 },
4753 { &hf_reload_signeridentity_value_certificate_hash,
4754 { "certificate_hash", "reload.signature.identity.value.certificate_hash", FT_NONE,
4755 BASE_NONE, NULL, 0x0, NULL, HFILL
4756 }
4757 },
4758 { &hf_reload_signeridentity_value_certificate_node_id_hash,
4759 { "certificate_node_id_hash", "reload.signature.identity.value.certificate_node_id_hash", FT_NONE,
4760 BASE_NONE, NULL, 0x0, NULL, HFILL
4761 }
4762 },
4763 { &hf_reload_signature_value,
4764 { "signature_value", "reload.signature.value", FT_NONE,
4765 BASE_NONE, NULL, 0x0, NULL, HFILL
4766 }
4767 },
4768 { &hf_reload_length_uint8,
4769 { "length (uint8)", "reload.length.8", FT_UINT8,
4770 BASE_DEC, NULL, 0x0, NULL, HFILL
4771 }
4772 },
4773 { &hf_reload_length_uint16,
4774 { "length (uint16)", "reload.length.16", FT_UINT16,
4775 BASE_DEC, NULL, 0x0, NULL, HFILL
4776 }
4777 },
4778 { &hf_reload_length_uint24,
4779 { "length (uint24)", "reload.length.24", FT_UINT32,
4780 BASE_DEC, NULL, 0x0, NULL, HFILL
4781 }
4782 },
4783 { &hf_reload_length_uint32,
4784 { "length (uint32)", "reload.length.32", FT_UINT32,
4785 BASE_DEC, NULL, 0x0, NULL, HFILL
4786 }
4787 },
4788 { &hf_reload_opaque,
4789 { "opaque", "reload.opaque", FT_NONE,
4790 BASE_NONE, NULL, 0x0, NULL, HFILL
4791 }
4792 },
4793 { &hf_reload_opaque_data,
4794 { "data (bytes)", "reload.opaque.data", FT_BYTES,
4795 BASE_NONE, NULL, 0x0, NULL, HFILL
4796 }
4797 },
4798 { &hf_reload_opaque_string,
4799 { "data (string)", "reload.opaque.string", FT_STRING,
4800 BASE_NONE, NULL, 0x0, NULL, HFILL
4801 }
4802 },
4803 { &hf_reload_routequeryreq,
4804 { "RouteQueryReq", "reload.routequeryreq", FT_NONE,
4805 BASE_NONE, NULL, 0x0, NULL, HFILL
4806 }
4807 },
4808 { &hf_reload_routequeryreq_destination,
4809 { "destination", "reload.routequeryreq.destination", FT_NONE,
4810 BASE_NONE, NULL, 0x0, NULL, HFILL
4811 }
4812 },
4813 { &hf_reload_overlay_specific,
4814 { "overlay_specific_data", "reload.overlay_specific_data", FT_NONE,
4815 BASE_NONE, NULL, 0x0, NULL, HFILL
4816 }
4817 },
4818 { &hf_reload_probereq,
4819 { "ProbeReq", "reload.probereq", FT_NONE,
4820 BASE_NONE, NULL, 0x0, NULL, HFILL
4821 }
4822 },
4823 { &hf_reload_probereq_requested_info,
4824 { "requested_info", "reload.probereq.requested_info", FT_NONE,
4825 BASE_NONE, NULL, 0x0, NULL, HFILL
4826 }
4827 },
4828 { &hf_reload_probe_information,
4829 { "ProbeInformation", "reload.probe_information", FT_NONE,
4830 BASE_NONE, NULL, 0x0, NULL, HFILL
4831 }
4832 },
4833 { &hf_reload_probe_information_data,
4834 { "value (ProbeInformationData)", "reload.probe_information_data", FT_NONE,
4835 BASE_NONE, NULL, 0x0, NULL, HFILL
4836 }
4837 },
4838 { &hf_reload_probe_information_type,
4839 { "type (ProbeInformationType)", "reload.probe_information.type", FT_UINT8,
4840 BASE_HEX, VALS(probeinformationtypes), 0x0, NULL, HFILL
4841 }
4842 },
4843 { &hf_reload_responsible_set,
4844 { "responsible_ppb (uint32)", "reload.responsible_set", FT_UINT32,
4845 BASE_HEX, NULL, 0x0, NULL, HFILL
4846 }
4847 },
4848 { &hf_reload_num_resources,
4849 { "num_resources (uint32)", "reload.num_resources", FT_UINT32,
4850 BASE_DEC, NULL, 0x0, NULL, HFILL
4851 }
4852 },
4853 { &hf_reload_uptime,
4854 { "uptime (uint32)", "reload.uptime", FT_UINT32,
4855 BASE_DEC, NULL, 0x0, NULL, HFILL
4856 }
4857 },
4858 { &hf_reload_probeans,
4859 { "ProbeAns", "reload.probeans", FT_NONE,
4860 BASE_NONE, NULL, 0x0, NULL, HFILL
4861 }
4862 },
4863 { &hf_reload_probeans_probe_info,
4864 { "probe_info", "reload.probe_info", FT_NONE,
4865 BASE_NONE, NULL, 0x0, NULL, HFILL
4866 }
4867 },
4868 { &hf_reload_appattachreq,
4869 { "AppAttachReq", "reload.appattachreq", FT_NONE,
4870 BASE_NONE, NULL, 0x0, NULL, HFILL
4871 }
4872 },
4873 { &hf_reload_appattachans,
4874 { "AppAttachAns", "reload.appattachans", FT_NONE,
4875 BASE_NONE, NULL, 0x0, NULL, HFILL
4876 }
4877 },
4878 { &hf_reload_application,
4879 { "application (uint16)", "reload.application", FT_UINT16,
4880 BASE_DEC, VALS(applicationids), 0x0, NULL, HFILL
4881 }
4882 },
4883 { &hf_reload_ping_response_id,
4884 { "response_id (uint64)", "reload.ping.response_id", FT_UINT64,
4885 BASE_DEC, NULL, 0x0, NULL, HFILL
4886 }
4887 },
4888 { &hf_reload_ping_time,
4889 { "time (uint64)", "reload.ping.time", FT_ABSOLUTE_TIME,
4890 ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL
4891 }
4892 },
4893 { &hf_reload_storeddata,
4894 { "StoredData", "reload.storeddata", FT_NONE,
4895 BASE_NONE, NULL, 0x0, NULL, HFILL
4896 }
4897 },
4898 { &hf_reload_storedmetadata,
4899 { "StoredMetaData", "reload.storedmetadata", FT_NONE,
4900 BASE_NONE, NULL, 0x0, NULL, HFILL
4901 }
4902 },
4903 { &hf_reload_storeddata_storage_time,
4904 { "storage_time (uint64)", "reload.storeddata.storage_time", FT_ABSOLUTE_TIME,
4905 ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL
4906 }
4907 },
4908 { &hf_reload_storeddata_lifetime,
4909 { "lifetime (uint32)", "reload.storeddata.lifetime", FT_UINT32,
4910 BASE_DEC, NULL, 0x0, NULL, HFILL
4911 }
4912 },
4913 { &hf_reload_datavalue,
4914 { "DataValue", "reload.datavalue", FT_NONE,
4915 BASE_NONE, NULL, 0x0, NULL, HFILL
4916 }
4917 },
4918 { &hf_reload_value,
4919 { "value", "reload.value", FT_NONE,
4920 BASE_NONE, NULL, 0x0, NULL, HFILL
4921 }
4922 },
4923 { &hf_reload_metadata,
4924 { "MetaData", "reload.metadata", FT_NONE,
4925 BASE_NONE, NULL, 0x0, NULL, HFILL
4926 }
4927 },
4928 { &hf_reload_datavalue_exists,
4929 { "exists (Boolean)", "reload.datavalue.exists", FT_BOOLEAN,
4930 BASE_NONE, NULL, 0x0, NULL, HFILL
4931 }
4932 },
4933 { &hf_reload_datavalue_value,
4934 { "value", "reload.datavaluevalue", FT_NONE,
4935 BASE_NONE, NULL, 0x0, NULL, HFILL
4936 }
4937 },
4938 { &hf_reload_metadata_value_length,
4939 { "value_length (uint32)", "reload.metadata.value_length", FT_UINT32,
4940 BASE_DEC, NULL, 0x0, NULL, HFILL
4941 }
4942 },
4943 { & hf_reload_metadata_hash_value,
4944 { "hash_value", "reload.metadata.hash_value", FT_NONE,
4945 BASE_NONE, NULL, 0x0, NULL, HFILL
4946 }
4947 },
4948 { &hf_reload_arrayentry,
4949 { "ArrayEntry", "reload.arrayentry", FT_NONE,
4950 BASE_NONE, NULL, 0x0, NULL, HFILL
4951 }
4952 },
4953 { &hf_reload_arrayentry_index,
4954 { "index (uint32)", "reload.arrayentry.index", FT_UINT32,
4955 BASE_DEC, NULL, 0x0, NULL, HFILL
4956 }
4957 },
4958 { &hf_reload_arrayentry_value,
4959 { "value", "reload.arrayentry.value", FT_NONE,
4960 BASE_NONE, NULL, 0x0, NULL, HFILL
4961 }
4962 },
4963 { &hf_reload_dictionaryentry,
4964 { "DictionaryEntry", "reload.dictionaryentry", FT_NONE,
4965 BASE_NONE, NULL, 0x0, NULL, HFILL
4966 }
4967 },
4968 { &hf_reload_dictionarykey,
4969 { "key (DictionaryKey)", "reload.dictionarykey", FT_NONE,
4970 BASE_NONE, NULL, 0x0, NULL, HFILL
4971 }
4972 },
4973 { &hf_reload_dictionary_value,
4974 { "value (DataValue)", "reload.dictionary.value", FT_NONE,
4975 BASE_NONE, NULL, 0x0, NULL, HFILL
4976 }
4977 },
4978 { &hf_reload_kinddata,
4979 { "StoreKindData", "reload.kinddata", FT_NONE,
4980 BASE_NONE, NULL, 0x0, NULL, HFILL
4981 }
4982 },
4983 { &hf_reload_kinddata_kind,
4984 { "kind (KindId)", "reload.kinddata.kind", FT_UINT32,
4985 BASE_DEC, NULL, 0x0, NULL, HFILL
4986 }
4987 },
4988 { &hf_reload_statkindresponse,
4989 { "StatKindResponse", "reload.statkindresponse", FT_NONE,
4990 BASE_NONE, NULL, 0x0, NULL, HFILL
4991 }
4992 },
4993 { &hf_reload_kindid,
4994 { "KindId", "reload.kindid", FT_UINT32,
4995 BASE_DEC, NULL, 0x0, NULL, HFILL
4996 }
4997 },
4998 { &hf_reload_kindid_list,
4999 { "kinds", "reload.kindid_list", FT_NONE,
5000 BASE_NONE, NULL, 0x0, NULL, HFILL
5001 }
5002 },
5003 { &hf_reload_generation_counter,
5004 { "generation_counter (uint64)", "reload.generation_counter", FT_UINT64,
5005 BASE_DEC, NULL, 0x0, NULL, HFILL
5006 }
5007 },
5008 { &hf_reload_values,
5009 { "values", "reload.kinddata.values_length", FT_NONE,
5010 BASE_NONE, NULL, 0x0, NULL, HFILL
5011 }
5012 },
5013 { &hf_reload_storereq,
5014 { "StoreReq", "reload.storereq", FT_NONE,
5015 BASE_NONE, NULL, 0x0, NULL, HFILL
5016 }
5017 },
5018 { &hf_reload_resource,
5019 { "resource", "reload.resource", FT_NONE,
5020 BASE_NONE, NULL, 0x0, NULL, HFILL
5021 }
5022 },
5023 { &hf_reload_store_replica_num,
5024 { "replica_number (uint8)", "reload.store.replica_number", FT_UINT8,
5025 BASE_DEC, NULL, 0x0, NULL, HFILL
5026 }
5027 },
5028 { &hf_reload_store_kind_data,
5029 { "kind_data", "reload.store.kind_data", FT_NONE,
5030 BASE_NONE, NULL, 0x0, NULL, HFILL
5031 }
5032 },
5033 { &hf_reload_storeans,
5034 { "StoreAns", "reload.storeans", FT_NONE,
5035 BASE_NONE, NULL, 0x0, NULL, HFILL
5036 }
5037 },
5038 { &hf_reload_storeans_kind_responses,
5039 { "kind_responses", "reload.storeans.kind_responses", FT_NONE,
5040 BASE_NONE, NULL, 0x0, NULL, HFILL
5041 }
5042 },
5043 { &hf_reload_storekindresponse,
5044 { "StoreKindResponse", "reload.storekindresponse", FT_NONE,
5045 BASE_NONE, NULL, 0x0, NULL, HFILL
5046 }
5047 },
5048 { &hf_reload_replicas,
5049 { "replicas", "reload.storekindresponse.replicas", FT_NONE,
5050 BASE_NONE, NULL, 0x0, NULL, HFILL
5051 }
5052 },
5053 { &hf_reload_statreq,
5054 { "StatReq", "reload.statreq", FT_NONE,
5055 BASE_NONE, NULL, 0x0, NULL, HFILL
5056 }
5057 },
5058 { &hf_reload_fetchans,
5059 { "FetchAns", "reload.fetchans", FT_NONE,
5060 BASE_NONE, NULL, 0x0, NULL, HFILL
5061 }
5062 },
5063 { &hf_reload_fetchreq,
5064 { "FetchReq", "reload.fetchreq", FT_NONE,
5065 BASE_NONE, NULL, 0x0, NULL, HFILL
5066 }
5067 },
5068 { &hf_reload_fetchreq_specifiers,
5069 { "specifiers", "reload.fetchreq.specifiers", FT_NONE,
5070 BASE_NONE, NULL, 0x0, NULL, HFILL
5071 }
5072 },
5073 { &hf_reload_arrayrange,
5074 { "ArrayRange", "reload.arrayrange", FT_NONE,
5075 BASE_NONE, NULL, 0x0, NULL, HFILL
5076 }
5077 },
5078 { &hf_reload_storeddataspecifier,
5079 { "StoredDataSpecifier", "reload.storeddataspecifier", FT_NONE,
5080 BASE_NONE, NULL, 0x0, NULL, HFILL
5081 }
5082 },
5083 { &hf_reload_storeddataspecifier_indices,
5084 { "indices", "reload.storeddataspecifier.indices", FT_NONE,
5085 BASE_NONE, NULL, 0x0, NULL, HFILL
5086 }
5087 },
5088 { &hf_reload_storeddataspecifier_keys,
5089 { "indices", "reload.storeddataspecifier.keys", FT_NONE,
5090 BASE_NONE, NULL, 0x0, NULL, HFILL
5091 }
5092 },
5093 { &hf_reload_statans,
5094 { "StatAns", "reload.statans", FT_NONE,
5095 BASE_NONE, NULL, 0x0, NULL, HFILL
5096 }
5097 },
5098 { &hf_reload_findans,
5099 { "FindAns", "reload.findans", FT_NONE,
5100 BASE_NONE, NULL, 0x0, NULL, HFILL
5101 }
5102 },
5103 { &hf_reload_findkinddata_closest,
5104 { "closest", "reload.findkindata.closest", FT_NONE,
5105 BASE_NONE, NULL, 0x0, NULL, HFILL
5106 }
5107 },
5108 { &hf_reload_findkinddata,
5109 { "FindKindData", "reload.findkinddata", FT_NONE,
5110 BASE_NONE, NULL, 0x0, NULL, HFILL
5111 }
5112 },
5113 { &hf_reload_fragment_overlap,
5114 { "Fragment overlap", "reload.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5115 "Fragment overlaps with other fragments", HFILL
5116 }
5117 },
5118
5119 { &hf_reload_fragment_overlap_conflict,
5120 { "Conflicting data in fragment overlap", "reload.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5121 "Overlapping fragments contained conflicting data", HFILL
5122 }
5123 },
5124
5125 { &hf_reload_fragment_multiple_tails,
5126 { "Multiple tail fragments found", "reload.fragment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5127 "Several tails were found when defragmenting the packet", HFILL
5128 }
5129 },
5130
5131 { &hf_reload_fragment_too_long_fragment,
5132 { "Fragment too long", "reload.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
5133 "Fragment contained data past end of packet", HFILL
5134 }
5135 },
5136
5137 { &hf_reload_fragment_error,
5138 { "Defragmentation error", "reload.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
5139 "Defragmentation error due to illegal fragments", HFILL
5140 }
5141 },
5142
5143 { &hf_reload_fragment_count,
5144 { "Fragment count", "reload.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
5145 NULL, HFILL
5146 }
5147 },
5148
5149 { &hf_reload_fragment,
5150 { "RELOAD fragment", "reload.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
5151 NULL, HFILL
5152 }
5153 },
5154
5155 { &hf_reload_fragments,
5156 { "RELOAD fragments", "reload.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
5157 NULL, HFILL
5158 }
5159 },
5160
5161 { &hf_reload_reassembled_in,
5162 { "Reassembled RELOAD in frame", "reload.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
5163 "This RELOAD packet is reassembled in this frame", HFILL
5164 }
5165 },
5166
5167 { &hf_reload_reassembled_length,
5168 { "Reassembled RELOAD length", "reload.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
5169 "The total length of the reassembled payload", HFILL
5170 }
5171 },
5172
5173 { &hf_reload_configupdatereq,
5174 { "ConfigUpdateReq", "reload.configupdatereq", FT_NONE,
5175 BASE_NONE, NULL, 0x0, NULL, HFILL
5176 }
5177 },
5178
5179 { &hf_reload_configupdatereq_type,
5180 { "type (ConfigUpdateType)", "reload.configupdatereq.type", FT_UINT8,
5181 BASE_DEC, VALS(configupdatetypes), 0x0, NULL, HFILL
5182 }
5183 },
5184
5185 { &hf_reload_configupdatereq_configdata,
5186 { "config_data", "reload.configupdatereq.config_data", FT_NONE,
5187 BASE_NONE, NULL, 0x0, NULL, HFILL
5188 }
5189 },
5190
5191 { &hf_reload_configupdatereq_kinds,
5192 { "kinds", "reload.configupdatereq.kinds", FT_NONE,
5193 BASE_NONE, NULL, 0x0, NULL, HFILL
5194 }
5195 },
5196 { &hf_reload_kinddescription,
5197 { "KindDescription", "reload.configupdatereq.kinddescription", FT_NONE,
5198 BASE_NONE, NULL, 0x0, NULL, HFILL
5199 }
5200 },
5201 { &hf_reload_pingreq,
5202 { "PingReq", "reload.pingreq", FT_NONE,
5203 BASE_NONE, NULL, 0x0, NULL, HFILL
5204 }
5205 },
5206 { &hf_reload_pingans,
5207 { "PingAns", "reload.pingans", FT_NONE,
5208 BASE_NONE, NULL, 0x0, NULL, HFILL
5209 }
5210 },
5211 { &hf_reload_padding,
5212 { "padding", "reload.padding", FT_NONE,
5213 BASE_NONE, NULL, 0x0, NULL, HFILL
5214 }
5215 },
5216
5217 { &hf_reload_chordupdate,
5218 { "ChordUpdate", "reload.chordupdate", FT_NONE,
5219 BASE_NONE, NULL, 0x0, NULL, HFILL
5220 }
5221 },
5222 { &hf_reload_chordupdate_type,
5223 { "type (ChordUpdateType)", "reload.chordupdate.type", FT_UINT8,
5224 BASE_DEC, VALS(chordupdatetypes), 0x0, NULL, HFILL
5225 }
5226 },
5227 { &hf_reload_chordupdate_predecessors,
5228 { "predecessors", "reload.chordupdate.predecessors", FT_NONE,
5229 BASE_NONE, NULL, 0x0, NULL, HFILL
5230 }
5231 },
5232 { &hf_reload_chordupdate_successors,
5233 { "successors", "reload.chordupdate.successors", FT_NONE,
5234 BASE_NONE, NULL, 0x0, NULL, HFILL
5235 }
5236 },
5237 { &hf_reload_chordupdate_fingers,
5238 { "fingers", "reload.chordupdate.fingers", FT_NONE,
5239 BASE_NONE, NULL, 0x0, NULL, HFILL
5240 }
5241 },
5242 { &hf_reload_chordroutequeryans,
5243 { "ChordRouteQueryAns", "reload.chordroutequeryans", FT_NONE,
5244 BASE_NONE, NULL, 0x0, NULL, HFILL
5245 }
5246 },
5247 { &hf_reload_chordroutequeryans_next_peer,
5248 { "next_peer (NodeId)", "reload.chordroutequeryans.nodeid", FT_BYTES,
5249 BASE_NONE, NULL, 0x0, NULL, HFILL
5250 }
5251 },
5252 { &hf_reload_chordleave,
5253 { "ChordLeaveData", "reload.chordleavedata", FT_NONE,
5254 BASE_NONE, NULL, 0x0, NULL, HFILL
5255 }
5256 },
5257 { &hf_reload_chordleave_type,
5258 { "type (ChordLeaveType)", "reload.chordleavedata.type", FT_UINT8,
5259 BASE_DEC, VALS(chordleavetypes), 0x0, NULL, HFILL
5260 }
5261 },
5262 { &hf_reload_chordleave_predecessors,
5263 { "predecessors", "reload.chordleavedata.predecessors", FT_NONE,
5264 BASE_NONE, NULL, 0x0, NULL, HFILL
5265 }
5266 },
5267 { &hf_reload_chordleave_successors,
5268 { "successors", "reload.chordleavedata.successors", FT_NONE,
5269 BASE_NONE, NULL, 0x0, NULL, HFILL
5270 }
5271 },
5272 { &hf_reload_turnserver,
5273 { "TurnServer", "reload.turnserver", FT_NONE,
5274 BASE_NONE, NULL, 0x0, NULL, HFILL
5275 }
5276 },
5277 { &hf_reload_turnserver_iteration,
5278 { "iteration (uint8)", "reload.turnserver.iteration", FT_UINT8,
5279 BASE_DEC, NULL, 0x0, NULL, HFILL
5280 }
5281 },
5282 { &hf_reload_turnserver_server_address,
5283 { "server_address", "reload.turnserver.server_address", FT_NONE,
5284 BASE_NONE, NULL, 0x0, NULL, HFILL
5285 }
5286 },
5287 { &hf_reload_sipregistration,
5288 { "SipRegistration", "reload.sipregistration", FT_NONE,
5289 BASE_NONE, NULL, 0x0, NULL, HFILL
5290 }
5291 },
5292 { &hf_reload_sipregistration_type,
5293 { "type (SipRegistrationType)", "reload.sipregistration.type", FT_UINT8,
5294 BASE_DEC, VALS(sipregistrationtypes), 0x0, NULL, HFILL
5295 }
5296 },
5297 { &hf_reload_sipregistration_data,
5298 { "data (SipRegistrationData)", "reload.sipregistration.data", FT_NONE,
5299 BASE_NONE, NULL, 0x0, NULL, HFILL
5300 }
5301 },
5302 { &hf_reload_sipregistration_data_uri,
5303 { "uri", "reload.sipregistration.data.uri", FT_NONE,
5304 BASE_NONE, NULL, 0x0, NULL, HFILL
5305 }
5306 },
5307 { &hf_reload_sipregistration_data_contact_prefs,
5308 { "contact_prefs", "reload.sipregistration.data.contact_prefs", FT_NONE,
5309 BASE_NONE, NULL, 0x0, NULL, HFILL
5310 }
5311 },
5312 { &hf_reload_sipregistration_data_destination_list,
5313 { "destination_list", "reload.sipregistration.data.destination_list", FT_NONE,
5314 BASE_NONE, NULL, 0x0, NULL, HFILL
5315 }
5316 },
5317 { &hf_reload_redirserviceprovider,
5318 { "RedirServiceProvider", "reload.redirserviceprovider", FT_NONE,
5319 BASE_NONE, NULL, 0x0, NULL, HFILL
5320 }
5321 },
5322 { &hf_reload_redirserviceproviderdata,
5323 { "data (RedirServiceProviderData)", "reload.redirserviceprovider.data", FT_NONE,
5324 BASE_NONE, NULL, 0x0, NULL, HFILL
5325 }
5326 },
5327 { &hf_reload_redirserviceproviderdata_serviceprovider,
5328 { "serviceProvider (NodeId)", "reload.redirserviceprovider.data.serviceprovider", FT_BYTES,
5329 BASE_NONE, NULL, 0x0, NULL, HFILL
5330 }
5331 },
5332 { &hf_reload_redirserviceproviderdata_namespace,
5333 { "namespace", "reload.redirserviceprovider.data.namespace", FT_NONE,
5334 BASE_NONE, NULL, 0x0, NULL, HFILL
5335 }
5336 },
5337 { &hf_reload_redirserviceproviderdata_level,
5338 { "level (uint16)", "reload.redirserviceprovider.data.level", FT_UINT16,
5339 BASE_DEC, NULL, 0x0, NULL, HFILL
5340 }
5341 },
5342 { &hf_reload_redirserviceproviderdata_node,
5343 { "node (uint16)", "reload.redirserviceprovider.data.node", FT_UINT16,
5344 BASE_DEC, NULL, 0x0, NULL, HFILL
5345 }
5346 },
5347 { &hf_reload_self_tuning_data,
5348 { "SelfTuningData", "reload.selftuning_data", FT_NONE,
5349 BASE_NONE, NULL, 0x0, NULL, HFILL
5350 }
5351 },
5352 { &hf_reload_self_tuning_data_network_size,
5353 { "network_size (uint32)", "reload.selftuning_data.network_size", FT_UINT32,
5354 BASE_DEC, NULL, 0x0, NULL, HFILL
5355 }
5356 },
5357 { &hf_reload_self_tuning_data_join_rate,
5358 { "join_rate (uint32)", "reload.selftuning_data.join_rate", FT_UINT32,
5359 BASE_DEC, NULL, 0x0, NULL, HFILL
5360 }
5361 },
5362 { &hf_reload_self_tuning_data_leave_rate,
5363 { "leave_rate (uint32)", "reload.selftuning_data.leave_rate", FT_UINT32,
5364 BASE_DEC, NULL, 0x0, NULL, HFILL
5365 }
5366 },
5367 { &hf_reload_findreq,
5368 { "FindReq", "reload.findreq", FT_NONE,
5369 BASE_NONE, NULL, 0x0, NULL, HFILL
5370 }
5371 },
5372 { &hf_reload_dmflags,
5373 { "dMFlags (uint64)", "reload.dmflags", FT_UINT64,
5374 BASE_HEX, NULL, 0x0, NULL, HFILL
5375 }
5376 },
5377 { &hf_reload_dmflag_status_info,
5378 { "STATUS_INFO", "reload.dmflags.status_info", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5379 NULL, HFILL
5380 }
5381 },
5382 { &hf_reload_dmflag_routing_table_size,
5383 { "ROUTING_TABLE_SIZE", "reload.dmflags.routing_table_size", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5384 NULL, HFILL
5385 }
5386 },
5387 { &hf_reload_dmflag_process_power,
5388 { "PROCESS_POWER", "reload.dmflags.process_power", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5389 NULL, HFILL
5390 }
5391 },
5392 { &hf_reload_dmflag_bandwidth,
5393 { "BANDWIDTH", "reload.dmflags.bandwidth", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5394 NULL, HFILL
5395 }
5396 },
5397 { &hf_reload_dmflag_software_version,
5398 { "SOFTWARE_VERSION", "reload.dmflags.software_version", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5399 NULL, HFILL
5400 }
5401 },
5402 { &hf_reload_dmflag_machine_uptime,
5403 { "MACHINE_UPTIME", "reload.dmflags.machine_uptime", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5404 NULL, HFILL
5405 }
5406 },
5407 { &hf_reload_dmflag_app_uptime,
5408 { "APP_UPTIME", "reload.dmflags.app_uptime", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5409 NULL, HFILL
5410 }
5411 },
5412 { &hf_reload_dmflag_memory_footprint,
5413 { "MEMORY_FOOTPRINT", "reload.dmflags.memory_footprint", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5414 NULL, HFILL
5415 }
5416 },
5417 { &hf_reload_dmflag_datasize_stored,
5418 { "DATASIZE_STORED", "reload.dmflags.datasize_stored", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5419 NULL, HFILL
5420 }
5421 },
5422 { &hf_reload_dmflag_instances_stored,
5423 { "INSTANCES_STORED", "reload.dmflags.instances_stored", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5424 NULL, HFILL
5425 }
5426 },
5427 { &hf_reload_dmflag_messages_sent_rcvd,
5428 { "MESSAGES_SENT_RCVD", "reload.dmflags.messages_sent_rcvd", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5429 NULL, HFILL
5430 }
5431 },
5432 { &hf_reload_dmflag_ewma_bytes_sent,
5433 { "EWMA_BYTES_SENT", "reload.dmflags.ewma_bytes_sent", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5434 NULL, HFILL
5435 }
5436 },
5437 { &hf_reload_dmflag_ewma_bytes_rcvd,
5438 { "EWMA_BYTES_RCVD", "reload.dmflags.ewma_bytes_rcvd", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5439 NULL, HFILL
5440 }
5441 },
5442 { &hf_reload_dmflag_underlay_hop,
5443 { "UNDERLAY_HOP", "reload.dmflags.underlay_hop", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5444 NULL, HFILL
5445 }
5446 },
5447 { &hf_reload_dmflag_battery_status,
5448 { "BATTERY_STATUS", "reload.dmflags.battery_status", FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
5449 NULL, HFILL
5450 }
5451 },
5452 { &hf_reload_diagnosticrequest,
5453 { "DiagnosticRequest", "reload.diagnosticrequest", FT_NONE,
5454 BASE_NONE, NULL, 0x0, NULL, HFILL
5455 }
5456 },
5457 { &hf_reload_diagnosticresponse,
5458 { "DiagnosticResponse", "reload.diagnosticresponse", FT_NONE,
5459 BASE_NONE, NULL, 0x0, NULL, HFILL
5460 }
5461 },
5462 { &hf_reload_diagnosticextension,
5463 { "DiagnosticExtension", "reload.diagnosticextension", FT_NONE,
5464 BASE_NONE, NULL, 0x0, NULL, HFILL
5465 }
5466 },
5467 { &hf_reload_diagnosticextension_type,
5468 { "type (DiagnosticExtensionRequestType)", "reload.diagnosticextension.type", FT_UINT16,
5469 BASE_DEC, NULL, 0x0, NULL, HFILL
5470 }
5471 },
5472 { &hf_reload_diagnosticextension_contents,
5473 { "diagnostic_extension_contents", "reload.diagnosticextension.contents", FT_NONE,
5474 BASE_NONE, NULL, 0x0, NULL, HFILL
5475 }
5476 },
5477 { &hf_reload_diagnostic_expiration, {
5478 "expiration (uint64)", "reload.diagnostic.expiration", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
5479 NULL, 0x0, NULL, HFILL
5480 }
5481 },
5482 { &hf_reload_diagnosticrequest_timestampinitiated, {
5483 "timestampInitiated (uint64)", "reload.diagnosticrequest.timestampinitiated",FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
5484 NULL, 0x0, NULL, HFILL
5485 }
5486 },
5487 { &hf_reload_diagnosticrequest_extensions,
5488 { "diagnostic_extensions", "reload.diagnosticrequest.extensions", FT_NONE,
5489 BASE_NONE, NULL, 0x0, NULL, HFILL
5490 }
5491 },
5492 { &hf_reload_pathtrackreq,
5493 { "PathTrackReq", "reload.pathtrackreq", FT_NONE,
5494 BASE_NONE, NULL, 0x0, NULL, HFILL
5495 }
5496 },
5497 { &hf_reload_pathtrackreq_destination,
5498 { "destination (Destination)", "reload.pathtrackreq.destination", FT_NONE,
5499 BASE_NONE, NULL, 0x0, NULL, HFILL
5500 }
5501 },
5502 { &hf_reload_pathtrackreq_request,
5503 { "request (DiagnosticRequest)", "reload.pathtrackreq.request", FT_NONE,
5504 BASE_NONE, NULL, 0x0, NULL, HFILL
5505 }
5506 },
5507 { &hf_reload_diagnosticinfo,
5508 { "DiagnosticInfo", "reload.diagnostic.info", FT_NONE,
5509 BASE_NONE, NULL, 0x0, NULL, HFILL
5510 }
5511 },
5512 { &hf_reload_diagnosticinfo_kind,
5513 { "kind (DiagnosticKindId)", "reload.diagnostic.kindid", FT_UINT16,
5514 BASE_DEC, VALS(diagnostickindids), 0x0, NULL, HFILL
5515 }
5516 },
5517 { &hf_reload_diagnosticinfo_congestion_status,
5518 { "congestion_status (uint8)", "reload.diagnostic.info.congestion_status", FT_UINT8,
5519 BASE_DEC, NULL, 0x0, NULL, HFILL
5520 }
5521 },
5522 { &hf_reload_diagnosticinfo_number_peers,
5523 { "number_peers (uint32)", "reload.diagnostic.info.number_peers", FT_UINT32,
5524 BASE_DEC, NULL, 0x0, NULL, HFILL
5525 }
5526 },
5527 { &hf_reload_diagnosticinfo_processing_power,
5528 { "processing_power (uint32)", "reload.diagnostic.info.processing_power", FT_UINT32,
5529 BASE_DEC, NULL, 0x0, NULL, HFILL
5530 }
5531 },
5532 { &hf_reload_diagnosticinfo_bandwidth,
5533 { "bandwidth (uint32)", "reload.diagnostic.info.bandwidth", FT_UINT32,
5534 BASE_DEC, NULL, 0x0, NULL, HFILL
5535 }
5536 },
5537 { &hf_reload_diagnosticinfo_software_version,
5538 { "software_version (opaque string)", "reload.diagnostic.info.software_version", FT_STRING,
5539 BASE_NONE, NULL, 0x0, NULL, HFILL
5540 }
5541 },
5542 { &hf_reload_diagnosticinfo_machine_uptime,
5543 { "machine_uptime (uint64)", "reload.diagnostic.info.machine_uptime", FT_UINT64,
5544 BASE_DEC, NULL, 0x0, NULL, HFILL
5545 }
5546 },
5547 { &hf_reload_diagnosticinfo_app_uptime,
5548 { "app_uptime (uint64)", "reload.diagnostic.info.app_uptime", FT_UINT64,
5549 BASE_DEC, NULL, 0x0, NULL, HFILL
5550 }
5551 },
5552 { &hf_reload_diagnosticinfo_memory_footprint,
5553 { "memory_footprint(uint32)", "reload.diagnostic.info.memory_footprint", FT_UINT32,
5554 BASE_DEC, NULL, 0x0, NULL, HFILL
5555 }
5556 },
5557 { &hf_reload_diagnosticinfo_datasize_stored,
5558 { "datasize_stored (uint64)", "reload.diagnostic.info.datasize_stored", FT_UINT64,
5559 BASE_DEC, NULL, 0x0, NULL, HFILL
5560 }
5561 },
5562 { &hf_reload_diagnosticinfo_instances_stored,
5563 { "instances_stored", "reload.diagnostic.info.instances_stored", FT_NONE,
5564 BASE_NONE, NULL, 0x0, NULL, HFILL
5565 }
5566 },
5567 { &hf_reload_diagnosticinfo_instancesstored_info,
5568 { "InstancesStoredInfo", "reload.diagnostic.info.instancesstored_info", FT_NONE,
5569 BASE_NONE, NULL, 0x0, NULL, HFILL
5570 }
5571 },
5572 { &hf_reload_diagnosticinfo_instancesstored_instances,
5573 { "instances (uint64)", "reload.diagnostic.info.instancesstored_instances", FT_UINT64,
5574 BASE_DEC, NULL, 0x0, NULL, HFILL
5575 }
5576 },
5577 { &hf_reload_diagnosticinfo_messages_sent_rcvd,
5578 { "messages_sent_rcvd", "reload.diagnostic.info.messages_sent_rcvd", FT_NONE,
5579 BASE_NONE, NULL, 0x0, NULL, HFILL
5580 }
5581 },
5582 { &hf_reload_diagnosticinfo_messages_sent_rcvd_info,
5583 { "MessagesSentRcvdInfo", "reload.diagnostic.info.messages_sent_rcvd.info", FT_NONE,
5584 BASE_NONE, NULL, 0x0, NULL, HFILL
5585 }
5586 },
5587 { &hf_reload_diagnosticinfo_message_code,
5588 { "messages_code (uint16)", "reload.diagnostic.info.message_code", FT_UINT16,
5589 BASE_HEX, NULL, 0x0, NULL, HFILL
5590 }
5591 },
5592 { &hf_reload_diagnosticinfo_messages_sent,
5593 { "sent (uint64)", "reload.diagnostic.info.messages_sent", FT_UINT64,
5594 BASE_DEC, NULL, 0x0, NULL, HFILL
5595 }
5596 },
5597 { &hf_reload_diagnosticinfo_messages_rcvd,
5598 { "rcvd (uint64)", "reload.diagnostic.info.messages_rcvd", FT_UINT64,
5599 BASE_DEC, NULL, 0x0, NULL, HFILL
5600 }
5601 },
5602 { &hf_reload_diagnosticinfo_ewma_bytes_sent,
5603 { "ewma_bytes_sent (uint32)", "reload.diagnostic.info.ewma_bytes_sent", FT_UINT32,
5604 BASE_DEC, NULL, 0x0, NULL, HFILL
5605 }
5606 },
5607 { &hf_reload_diagnosticinfo_ewma_bytes_rcvd,
5608 { "ewma_bytes_rcvd (uint32)", "reload.diagnostic.info.ewma_bytes_rcvd", FT_UINT32,
5609 BASE_DEC, NULL, 0x0, NULL, HFILL
5610 }
5611 },
5612 { &hf_reload_diagnosticinfo_underlay_hops,
5613 { "underlay_hops (uint8)", "reload.diagnostic.info.underlay_hops", FT_UINT8,
5614 BASE_DEC, NULL, 0x0, NULL, HFILL
5615 }
5616 },
5617 { &hf_reload_diagnosticinfo_battery_status,
5618 { "battery_status (uint8)", "reload.diagnostic.info.battery_status", FT_UINT8,
5619 BASE_DEC, NULL, 0x0, NULL, HFILL
5620 }
5621 },
5622 { &hf_reload_diagnosticresponse_timestampreceived, {
5623 "timestampReceived (uint64)", "reload.diagnosticresponse.timestampreceived",FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
5624 NULL, 0x0, NULL, HFILL
5625 }
5626 },
5627 { &hf_reload_diagnosticresponse_hopcounter,
5628 { "hopCounter (uint8)", "reload.diagnosticresponse.hopcounter", FT_UINT8,
5629 BASE_DEC, NULL, 0x0, NULL, HFILL
5630 }
5631 },
5632 { &hf_reload_diagnosticresponse_diagnostic_info_list,
5633 { "diagnostic_info_list", "reload.diagnosticresponse.diagnostic_info_list", FT_NONE,
5634 BASE_NONE, NULL, 0x0, NULL, HFILL
5635 }
5636 },
5637 { &hf_reload_pathtrackans,
5638 { "PathTrackAns", "reload.pathtrackans", FT_NONE,
5639 BASE_NONE, NULL, 0x0, NULL, HFILL
5640 }
5641 },
5642 { &hf_reload_pathtrackans_next_hop,
5643 { "next_hop", "reload.pathtrackans.next_hop", FT_NONE,
5644 BASE_NONE, NULL, 0x0, NULL, HFILL
5645 }
5646 },
5647 { &hf_reload_pathtrackans_response,
5648 { "response (DiagnosticResponse)", "reload.pathtrackand.response", FT_NONE,
5649 BASE_NONE, NULL, 0x0, NULL, HFILL
5650 }
5651 },
5652 { &hf_reload_extensiveroutingmodeoption,
5653 { "ExtensiveRoutingModeOption", "reload.extensiveroutingmodeoption", FT_NONE,
5654 BASE_NONE, NULL, 0x0, NULL, HFILL
5655 }
5656 },
5657 { &hf_reload_routemode,
5658 { "routemode (RouteMode)", "reload.routemode", FT_UINT8,
5659 BASE_DEC, VALS(routemodes), 0x0, NULL, HFILL
5660 }
5661 },
5662 { &hf_reload_extensiveroutingmode_transport,
5663 { "transport (OverlayLinkType)", "reload.extensiveroutingmode.transport", FT_UINT8,
5664 BASE_DEC, VALS(overlaylinktypes), 0x0, NULL, HFILL
5665 }
5666 },
5667 { &hf_reload_extensiveroutingmode_ipaddressport,
5668 { "ipaddressport (IpAddressPort)", "reload.extensiveroutingmode.ipaddressport", FT_NONE,
5669 BASE_NONE, NULL, 0x0, NULL, HFILL
5670 }
5671 },
5672 { &hf_reload_extensiveroutingmode_destination,
5673 { "destination", "reload.extensiveroutingmode.destination", FT_NONE,
5674 BASE_NONE, NULL, 0x0, NULL, HFILL
5675 }
5676 },
5677 { &hf_reload_joinreq,
5678 { "JoinReq", "reload.joinreq", FT_NONE,
5679 BASE_NONE, NULL, 0x0, NULL, HFILL
5680 }
5681 },
5682 { &hf_reload_joinans,
5683 { "JoinAns", "reload.joinans", FT_NONE,
5684 BASE_NONE, NULL, 0x0, NULL, HFILL
5685 }
5686 },
5687 { &hf_reload_joinreq_joining_peer_id,
5688 { "joining_peer_id (NodeId)", "reload.joinreq.joining_peer_id", FT_BYTES,
5689 BASE_NONE, NULL, 0x0, NULL, HFILL
5690 }
5691 },
5692 { &hf_reload_leavereq,
5693 { "LeaveReq", "reload.leavereq", FT_NONE,
5694 BASE_NONE, NULL, 0x0, NULL, HFILL
5695 }
5696 },
5697 { &hf_reload_leavereq_leaving_peer_id,
5698 { "leaving_peer_id (NodeId)", "reload.leavereq.leaving_peer_id", FT_BYTES,
5699 BASE_NONE, NULL, 0x0, NULL, HFILL
5700 }
5701 },
5702
5703 };
5704
5705 /* Setup protocol subtree array */
5706 static gint *ett[] = {
5707 &ett_reload,
5708 &ett_reload_forwarding,
5709 &ett_reload_message,
5710 &ett_reload_security,
5711 &ett_reload_fragment_flag,
5712 &ett_reload_destination,
5713 &ett_reload_via_list,
5714 &ett_reload_destination_list,
5715 &ett_reload_resourceid,
5716 &ett_reload_forwarding_options,
5717 &ett_reload_forwarding_option,
5718 &ett_reload_forwarding_option_flags,
5719 &ett_reload_forwarding_option_directresponseforwarding,
5720 &ett_reload_attachreqans,
5721 &ett_reload_icecandidates,
5722 &ett_reload_icecandidate,
5723 &ett_reload_icecandidate_computed_address,
5724 &ett_reload_iceextensions,
5725 &ett_reload_iceextension,
5726 &ett_reload_ipaddressport,
5727 &ett_reload_ipv4addrport,
5728 &ett_reload_ipv6addrport,
5729 &ett_reload_message_contents,
5730 &ett_reload_message_extensions,
5731 &ett_reload_message_extension,
5732 &ett_reload_error_response,
5733 &ett_reload_security_block,
5734 &ett_reload_certificates,
5735 &ett_reload_genericcertificate,
5736 &ett_reload_signature,
5737 &ett_reload_signatureandhashalgorithm,
5738 &ett_reload_signeridentity,
5739 &ett_reload_signeridentity_identity,
5740 &ett_reload_signeridentity_value,
5741 &ett_reload_opaque,
5742 &ett_reload_message_body,
5743 &ett_reload_routequeryreq,
5744 &ett_reload_probereq,
5745 &ett_reload_probereq_requested_info,
5746 &ett_reload_probe_information,
5747 &ett_reload_probe_information_data,
5748 &ett_reload_probeans,
5749 &ett_reload_probeans_probe_info,
5750 &ett_reload_appattach,
5751 &ett_reload_pingreq,
5752 &ett_reload_pingans,
5753 &ett_reload_storeddata,
5754 &ett_reload_kinddata,
5755 &ett_reload_values,
5756 &ett_reload_datavalue,
5757 &ett_reload_arrayentry,
5758 &ett_reload_dictionaryentry,
5759 &ett_reload_storereq,
5760 &ett_reload_store_kind_data,
5761 &ett_reload_storeans,
5762 &ett_reload_storeans_kind_responses,
5763 &ett_reload_storekindresponse,
5764 &ett_reload_fetchans,
5765 &ett_reload_fetchreq,
5766 &ett_reload_fetchreq_specifiers,
5767 &ett_reload_storeddataspecifier,
5768 &ett_reload_storeddataspecifier_indices,
5769 &ett_reload_storeddataspecifier_keys,
5770 &ett_reload_statans,
5771 &ett_reload_findans,
5772 &ett_reload_findkinddata,
5773 &ett_reload_fragments,
5774 &ett_reload_fragment,
5775 &ett_reload_configupdatereq,
5776 &ett_reload_configupdatereq_config_data,
5777 &ett_reload_kinddescription,
5778 &ett_reload_configupdatereq_kinds,
5779 &ett_reload_storekindresponse_replicas,
5780 &ett_reload_nodeid_list,
5781 &ett_reload_chordupdate,
5782 &ett_reload_chordroutequeryans,
5783 &ett_reload_chordleave,
5784 &ett_reload_turnserver,
5785 &ett_reload_sipregistration,
5786 &ett_reload_sipregistration_data,
5787 &ett_reload_sipregistration_destination_list,
5788 &ett_reload_dictionaryentry_key,
5789 &ett_reload_overlay_specific,
5790 &ett_reload_kindid_list,
5791 &ett_reload_redirserviceproviderdata,
5792 &ett_reload_redirserviceprovider,
5793 &ett_reload_self_tuning_data,
5794 &ett_reload_findreq,
5795 &ett_reload_dmflags,
5796 &ett_reload_diagnosticextension,
5797 &ett_reload_diagnosticrequest,
5798 &ett_reload_diagnosticrequest_extensions,
5799 &ett_reload_pathtrackreq,
5800 &ett_reload_diagnosticinfo,
5801 &ett_reload_diagnosticinfo_instances_stored,
5802 &ett_reload_diagnosticinfo_instancesstored_info,
5803 &ett_reload_diagnosticinfo_messages_sent_rcvd,
5804 &ett_reload_diagnosticinfo_messages_sent_rcvd_info,
5805 &ett_reload_diagnosticresponse,
5806 &ett_reload_diagnosticresponse_diagnostic_info_list,
5807 &ett_reload_pathtrackans,
5808 &ett_reload_extensiveroutingmodeoption,
5809 &ett_reload_extensiveroutingmode_destination,
5810 &ett_reload_joinreq,
5811 &ett_reload_joinans,
5812 &ett_reload_leavereq,
5813 };
5814
5815 static ei_register_info ei[] = {
5816 { &ei_reload_truncated_field, { "reload.truncated_field", PI_PROTOCOL, PI_ERROR, "Truncated field", EXPFILL }},
5817 { &ei_reload_truncated_packet, { "reload.truncated_packet", PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet", EXPFILL }},
5818 { &ei_reload_computed_len_too_big, { "reload.computed_len_too_big", PI_PROTOCOL, PI_ERROR, "Computed length > max_field length", EXPFILL }},
5819 { &ei_reload_identity_type_unknown, { "reload.signature.identity.type.unknown", PI_PROTOCOL, PI_ERROR, "Unknown identity type", EXPFILL }},
5820 { &ei_reload_unknown_data_model, { "reload.unknown_data_model", PI_PROTOCOL, PI_ERROR, "Unknown Data Model", EXPFILL }},
5821 { &ei_reload_no_xml_dissector, { "reload.no_xml_dissector", PI_PROTOCOL, PI_ERROR, "Can not find xml dissector", EXPFILL }},
5822 };
5823
5824 static uat_field_t reloadkindidlist_uats_flds[] = {
5825 UAT_FLD_DEC(kindidlist_uats,id,"Kind-ID Number","Custom Kind-ID Number"),
5826 UAT_FLD_CSTRING(kindidlist_uats,name,"Kind-ID Name","Custom Kind-ID Name"),
5827 UAT_FLD_VS(kindidlist_uats,data_model,"Kind-ID data model",datamodels,"Kind ID data model"),
5828 UAT_END_FIELDS
5829 };
5830
5831
5832 /* Register the protocol name and description */
5833 proto_reload = proto_register_protocol("REsource LOcation And Discovery", "RELOAD", "reload");
5834 register_dissector("reload", dissect_reload_message, proto_reload);
5835 /* Required function calls to register the header fields and subtrees used */
5836 proto_register_field_array(proto_reload, hf, array_length(hf));
5837 proto_register_subtree_array(ett, array_length(ett));
5838 expert_reload = expert_register_protocol(proto_reload);
5839 expert_register_field_array(expert_reload, ei, array_length(ei));
5840
5841 reload_module = prefs_register_protocol(proto_reload, NULL);
5842
5843 reloadkindids_uat =
5844 uat_new("Kind-ID Table",
5845 sizeof(kind_t),
5846 "reload_kindids", /* filename */
5847 TRUE, /* from_profile */
5848 &kindidlist_uats, /* data_ptr */
5849 &nreloadkinds, /* numitems_ptr */
5850 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
5851 NULL, /* Help section (currently a wiki page) */
5852 uat_kindid_copy_cb,
5853 NULL,
5854 uat_kindid_record_free_cb,
5855 NULL,
5856 NULL,
5857 reloadkindidlist_uats_flds);
5858
5859
5860 prefs_register_uat_preference(reload_module, "kindid.table",
5861 "Kind ID list",
5862 "A table of Kind ID definitions",
5863 reloadkindids_uat);
5864
5865 prefs_register_bool_preference(reload_module, "defragment",
5866 "Reassemble fragmented reload datagrams",
5867 "Whether fragmented RELOAD datagrams should be reassembled",
5868 &reload_defragment);
5869 prefs_register_uint_preference(reload_module, "nodeid_length",
5870 "NodeId Length",
5871 "Length of the NodeId as defined in the overlay.",
5872 10,
5873 &reload_nodeid_length);
5874 prefs_register_string_preference(reload_module, "topology_plugin",
5875 "topology plugin", "topology plugin defined in the overlay", &reload_topology_plugin);
5876
5877 reassembly_table_register(&reload_reassembly_table,
5878 &addresses_reassembly_table_functions);
5879 }
5880
5881 void
proto_reg_handoff_reload(void)5882 proto_reg_handoff_reload(void)
5883 {
5884 xml_handle = find_dissector_add_dependency("xml", proto_reload);
5885
5886 heur_dissector_add("udp", dissect_reload_heur, "RELOAD over UDP", "reload_udp", proto_reload, HEURISTIC_ENABLE);
5887 heur_dissector_add("tcp", dissect_reload_heur, "RELOAD over TCP", "reload_tcp", proto_reload, HEURISTIC_ENABLE);
5888 }
5889
5890 /*
5891 * Editor modelines - https://www.wireshark.org/tools/modelines.html
5892 *
5893 * Local variables:
5894 * c-basic-offset: 2
5895 * tab-width: 8
5896 * indent-tabs-mode: nil
5897 * End:
5898 *
5899 * vi: set shiftwidth=2 tabstop=8 expandtab:
5900 * :indentSize=2:tabSize=8:noTabs=true:
5901 */
5902