1/* 2 * Copyright (c) 2023, The OpenThread Authors. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. Neither the name of the copyright holder nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29syntax = "proto2"; 30 31package android.os.statsd.threadnetwork; 32 33option java_package = "com.android.os.threadnetwork"; 34option java_multiple_files = true; 35 36// Thread Telemetry data definition. 37message ThreadnetworkTelemetryDataReported { 38 message WpanStats { 39 optional int32 phy_rx = 1; 40 optional int32 phy_tx = 2; 41 optional int32 mac_unicast_rx = 3; 42 optional int32 mac_unicast_tx = 4; 43 optional int32 mac_broadcast_rx = 5; 44 optional int32 mac_broadcast_tx = 6; 45 optional int32 mac_tx_ack_req = 7; 46 optional int32 mac_tx_no_ack_req = 8; 47 optional int32 mac_tx_acked = 9; 48 optional int32 mac_tx_data = 10; 49 optional int32 mac_tx_data_poll = 11; 50 optional int32 mac_tx_beacon = 12; 51 optional int32 mac_tx_beacon_req = 13; 52 optional int32 mac_tx_other_pkt = 14; 53 optional int32 mac_tx_retry = 15; 54 optional int32 mac_rx_data = 16; 55 optional int32 mac_rx_data_poll = 17; 56 optional int32 mac_rx_beacon = 18; 57 optional int32 mac_rx_beacon_req = 19; 58 optional int32 mac_rx_other_pkt = 20; 59 optional int32 mac_rx_filter_whitelist = 21; 60 optional int32 mac_rx_filter_dest_addr = 22; 61 optional int32 mac_tx_fail_cca = 23; 62 optional int32 mac_rx_fail_decrypt = 24; 63 optional int32 mac_rx_fail_no_frame = 25; 64 optional int32 mac_rx_fail_unknown_neighbor = 26; 65 optional int32 mac_rx_fail_invalid_src_addr = 27; 66 optional int32 mac_rx_fail_fcs = 28; 67 optional int32 mac_rx_fail_other = 29; 68 optional int32 ip_tx_success = 30; 69 optional int32 ip_rx_success = 31; 70 optional int32 ip_tx_failure = 32; 71 optional int32 ip_rx_failure = 33; 72 optional uint32 node_type = 34; 73 optional uint32 channel = 35; 74 optional int32 radio_tx_power = 36; 75 optional float mac_cca_fail_rate = 37; 76 } 77 78 message WpanTopoFull { 79 optional uint32 rloc16 = 1; 80 optional uint32 router_id = 2; 81 optional uint32 leader_router_id = 3; 82 optional uint32 leader_rloc16 = 4; // replaced optional bytes leader_address = 5; 83 optional uint32 leader_weight = 5; 84 optional uint32 leader_local_weight = 6; 85 optional uint32 preferred_router_id = 7; 86 optional uint32 partition_id = 8; 87 optional uint32 child_table_size = 9; 88 optional uint32 neighbor_table_size = 10; 89 optional int32 instant_rssi = 11; 90 optional bool has_extended_pan_id = 12; 91 optional bool is_active_br = 13; 92 optional bool is_active_srp_server = 14; 93 optional uint32 sum_on_link_prefix_changes = 15; 94 } 95 96 enum NodeType { 97 NODE_TYPE_UNSPECIFIED = 0; 98 NODE_TYPE_ROUTER = 1; 99 NODE_TYPE_END = 2; 100 NODE_TYPE_SLEEPY_END = 3; 101 NODE_TYPE_MINIMAL_END = 4; 102 103 NODE_TYPE_OFFLINE = 5; 104 NODE_TYPE_DISABLED = 6; 105 NODE_TYPE_DETACHED = 7; 106 107 NODE_TYPE_NL_LURKER = 0x10; 108 NODE_TYPE_COMMISSIONER = 0x20; 109 NODE_TYPE_LEADER = 0x40; 110 } 111 112 message PacketsAndBytes { 113 optional int64 packet_count = 1; 114 optional int64 byte_count = 2; 115 } 116 117 message Nat64TrafficCounters { 118 optional int64 ipv4_to_ipv6_packets = 1; 119 optional int64 ipv4_to_ipv6_bytes = 2; 120 optional int64 ipv6_to_ipv4_packets = 3; 121 optional int64 ipv6_to_ipv4_bytes = 4; 122 } 123 124 message Nat64ProtocolCounters { 125 optional Nat64TrafficCounters tcp = 1; 126 optional Nat64TrafficCounters udp = 2; 127 optional Nat64TrafficCounters icmp = 3; 128 } 129 130 message Nat64PacketCounters { 131 optional int64 ipv4_to_ipv6_packets = 1; 132 optional int64 ipv6_to_ipv4_packets = 2; 133 } 134 135 message Nat64ErrorCounters { 136 optional Nat64PacketCounters unknown = 1; 137 optional Nat64PacketCounters illegal_packet = 2; 138 optional Nat64PacketCounters unsupported_protocol = 3; 139 optional Nat64PacketCounters no_mapping = 4; 140 } 141 142 message BorderRoutingCounters { 143 // The number of Router Advertisement packets received by otbr-agent on the 144 // infra link 145 optional int64 ra_rx = 1; 146 147 // The number of Router Advertisement packets successfully transmitted by 148 // otbr-agent on the infra link. 149 optional int64 ra_tx_success = 2; 150 151 // The number of Router Advertisement packets failed to transmit by 152 // otbr-agent on the infra link. 153 optional int64 ra_tx_failure = 3; 154 155 // The number of Router Solicitation packets received by otbr-agent on the 156 // infra link 157 optional int64 rs_rx = 4; 158 159 // The number of Router Solicitation packets successfully transmitted by 160 // otbr-agent on the infra link. 161 optional int64 rs_tx_success = 5; 162 163 // The number of Router Solicitation packets failed to transmit by 164 // otbr-agent on the infra link. 165 optional int64 rs_tx_failure = 6; 166 167 // The counters for inbound unicast packets 168 optional PacketsAndBytes inbound_unicast = 7; 169 170 // The counters for inbound multicast packets 171 optional PacketsAndBytes inbound_multicast = 8; 172 173 // The counters for outbound unicast packets 174 optional PacketsAndBytes outbound_unicast = 9; 175 176 // The counters for outbound multicast packets 177 optional PacketsAndBytes outbound_multicast = 10; 178 179 // The inbound and outbound NAT64 traffic through the border router 180 optional Nat64ProtocolCounters nat64_protocol_counters = 11; 181 182 // Error counters for NAT64 translator on the border router 183 optional Nat64ErrorCounters nat64_error_counters = 12; 184 } 185 186 message SrpServerRegistrationInfo { 187 // The number of active hosts/services registered on the SRP server. 188 optional uint32 fresh_count = 1; 189 190 // The number of hosts/services in 'Deleted' state on the SRP server. 191 optional uint32 deleted_count = 2; 192 193 // The sum of lease time in milliseconds of all active hosts/services on the 194 // SRP server. 195 optional uint64 lease_time_total_ms = 3; 196 197 // The sum of key lease time in milliseconds of all active hosts/services on 198 // the SRP server. 199 optional uint64 key_lease_time_total_ms = 4; 200 201 // The sum of remaining lease time in milliseconds of all active 202 // hosts/services on the SRP server. 203 optional uint64 remaining_lease_time_total_ms = 5; 204 205 // The sum of remaining key lease time in milliseconds of all active 206 // hosts/services on the SRP server. 207 optional uint64 remaining_key_lease_time_total_ms = 6; 208 } 209 210 message SrpServerResponseCounters { 211 // The number of successful responses 212 optional uint32 success_count = 1; 213 214 // The number of server failure responses 215 optional uint32 server_failure_count = 2; 216 217 // The number of format error responses 218 optional uint32 format_error_count = 3; 219 220 // The number of 'name exists' responses 221 optional uint32 name_exists_count = 4; 222 223 // The number of refused responses 224 optional uint32 refused_count = 5; 225 226 // The number of other responses 227 optional uint32 other_count = 6; 228 } 229 230 enum SrpServerState { 231 SRP_SERVER_STATE_UNSPECIFIED = 0; 232 SRP_SERVER_STATE_DISABLED = 1; 233 SRP_SERVER_STATE_RUNNING = 2; 234 SRP_SERVER_STATE_STOPPED = 3; 235 } 236 237 // The address mode used by the SRP server 238 enum SrpServerAddressMode { 239 SRP_SERVER_ADDRESS_MODE_UNSPECIFIED = 0; 240 SRP_SERVER_ADDRESS_MODE_UNICAST = 1; 241 SRP_SERVER_ADDRESS_MODE_STATE_ANYCAST = 2; 242 } 243 244 enum UpstreamDnsQueryState { 245 UPSTREAMDNS_QUERY_STATE_UNSPECIFIED = 0; 246 UPSTREAMDNS_QUERY_STATE_ENABLED = 1; 247 UPSTREAMDNS_QUERY_STATE_DISABLED = 2; 248 } 249 250 message SrpServerInfo { 251 // The state of the SRP server 252 optional SrpServerState state = 1; 253 254 // Listening port number 255 optional uint32 port = 2; 256 // The address mode {unicast, anycast} of the SRP server 257 optional SrpServerAddressMode address_mode = 3; 258 259 // The registration information of hosts on the SRP server 260 optional SrpServerRegistrationInfo hosts = 4; 261 262 // The registration information of services on the SRP server 263 optional SrpServerRegistrationInfo services = 5; 264 265 // The counters of response codes sent by the SRP server 266 optional SrpServerResponseCounters response_counters = 6; 267 } 268 269 message DnsServerResponseCounters { 270 // The number of successful responses 271 optional uint32 success_count = 1; 272 273 // The number of server failure responses 274 optional uint32 server_failure_count = 2; 275 276 // The number of format error responses 277 optional uint32 format_error_count = 3; 278 279 // The number of name error responses 280 optional uint32 name_error_count = 4; 281 282 // The number of 'not implemented' responses 283 optional uint32 not_implemented_count = 5; 284 285 // The number of other responses 286 optional uint32 other_count = 6; 287 288 // The number of queries handled by Upstream DNS server. 289 optional uint32 upstream_dns_queries = 7; 290 291 // The number of responses handled by Upstream DNS server. 292 optional uint32 upstream_dns_responses = 8; 293 294 // The number of upstream DNS failures. 295 optional uint32 upstream_dns_failures = 9; 296 } 297 298 message DnsServerInfo { 299 // The counters of response codes sent by the DNS server 300 optional DnsServerResponseCounters response_counters = 1; 301 302 // The number of DNS queries resolved at the local SRP server 303 optional uint32 resolved_by_local_srp_count = 2; 304 305 // The state of upstream DNS query 306 optional UpstreamDnsQueryState upstream_dns_query_state = 3; 307 } 308 309 message MdnsResponseCounters { 310 // The number of successful responses 311 optional uint32 success_count = 1; 312 313 // The number of 'not found' responses 314 optional uint32 not_found_count = 2; 315 316 // The number of 'invalid arg' responses 317 optional uint32 invalid_args_count = 3; 318 319 // The number of 'duplicated' responses 320 optional uint32 duplicated_count = 4; 321 322 // The number of 'not implemented' responses 323 optional uint32 not_implemented_count = 5; 324 325 // The number of unknown error responses 326 optional uint32 unknown_error_count = 6; 327 328 // The number of aborted responses 329 optional uint32 aborted_count = 7; 330 331 // The number of invalid state responses 332 optional uint32 invalid_state_count = 8; 333 } 334 335 message MdnsInfo { 336 // The response counters of host registrations 337 optional MdnsResponseCounters host_registration_responses = 1; 338 339 // The response counters of service registrations 340 optional MdnsResponseCounters service_registration_responses = 2; 341 342 // The response counters of host resolutions 343 optional MdnsResponseCounters host_resolution_responses = 3; 344 345 // The response counters of service resolutions 346 optional MdnsResponseCounters service_resolution_responses = 4; 347 348 // The EMA (Exponential Moving Average) latencies of mDNS operations 349 350 // The EMA latency of host registrations in milliseconds 351 optional uint32 host_registration_ema_latency_ms = 5; 352 353 // The EMA latency of service registrations in milliseconds 354 optional uint32 service_registration_ema_latency_ms = 6; 355 356 // The EMA latency of host resolutions in milliseconds 357 optional uint32 host_resolution_ema_latency_ms = 7; 358 359 // The EMA latency of service resolutions in milliseconds 360 optional uint32 service_resolution_ema_latency_ms = 8; 361 } 362 363 enum Nat64State { 364 NAT64_STATE_UNSPECIFIED = 0; 365 NAT64_STATE_DISABLED = 1; 366 NAT64_STATE_NOT_RUNNING = 2; 367 NAT64_STATE_IDLE = 3; 368 NAT64_STATE_ACTIVE = 4; 369 } 370 371 message BorderRoutingNat64State { 372 optional Nat64State prefix_manager_state = 1; 373 optional Nat64State translator_state = 2; 374 } 375 376 message TrelPacketCounters { 377 // The number of packets successfully transmitted through TREL 378 optional uint64 trel_tx_packets = 1; 379 380 // The number of bytes successfully transmitted through TREL 381 optional uint64 trel_tx_bytes = 2; 382 383 // The number of packet transmission failures through TREL 384 optional uint64 trel_tx_packets_failed = 3; 385 386 // The number of packets successfully received through TREL 387 optional uint64 trel_rx_packets = 4; 388 389 // The number of bytes successfully received through TREL 390 optional uint64 trel_rx_bytes = 5; 391 } 392 393 message TrelInfo { 394 // Whether TREL is enabled. 395 optional bool is_trel_enabled = 1; 396 397 // The number of TREL peers. 398 optional uint32 num_trel_peers = 2; 399 400 // TREL packet counters 401 optional TrelPacketCounters counters = 3; 402 } 403 404 message BorderAgentCounters { 405 // The number of ePSKc activations 406 optional uint32 epskc_activations = 1; 407 408 // The number of ePSKc deactivations due to cleared via API 409 optional uint32 epskc_deactivation_clears = 2; 410 411 // The number of ePSKc deactivations due to timeout 412 optional uint32 epskc_deactivation_timeouts = 3; 413 414 // The number of ePSKc deactivations due to max connection attempts reached 415 optional uint32 epskc_deactivation_max_attempts = 4; 416 417 // The number of ePSKc deactivations due to commissioner disconnected 418 optional uint32 epskc_deactivation_disconnects = 5; 419 420 // The number of ePSKc activation failures caused by invalid border agent 421 // state 422 optional uint32 epskc_invalid_ba_state_errors = 6; 423 424 // The number of ePSKc activation failures caused by invalid argument 425 optional uint32 epskc_invalid_args_errors = 7; 426 427 // The number of ePSKc activation failures caused by failed to start secure 428 // session 429 optional uint32 epskc_start_secure_session_errors = 8; 430 431 // The number of successful secure session establishment with ePSKc 432 optional uint32 epskc_secure_session_successes = 9; 433 434 // The number of failed secure session establishement with ePSKc 435 optional uint32 epskc_secure_session_failures = 10; 436 437 // The number of active commissioner petitioned over secure session 438 // establishment with ePSKc 439 optional uint32 epskc_commissioner_petitions = 11; 440 441 // The number of successful secure session establishment with PSKc 442 optional uint32 pskc_secure_session_successes = 12; 443 444 // The number of failed secure session establishement with PSKc 445 optional uint32 pskc_secure_session_failures = 13; 446 447 // The number of active commissioner petitioned over secure session 448 // establishment with PSKc 449 optional uint32 pskc_commissioner_petitions = 14; 450 451 // The number of MGMT_ACTIVE_GET.req received 452 optional uint32 mgmt_active_get_reqs = 15; 453 454 // The number of MGMT_PENDING_GET.req received 455 optional uint32 mgmt_pending_get_reqs = 16; 456 } 457 458 message BorderAgentInfo { 459 // The border agent counters 460 optional BorderAgentCounters border_agent_counters = 1; 461 } 462 463 message WpanBorderRouter { 464 // Border routing counters 465 optional BorderRoutingCounters border_routing_counters = 1; 466 467 // Information about the SRP server 468 optional SrpServerInfo srp_server = 2; 469 470 // Information about the DNS server 471 optional DnsServerInfo dns_server = 3; 472 473 // Information about the mDNS publisher 474 optional MdnsInfo mdns = 4; 475 476 // Information about the state of components of NAT64 477 optional BorderRoutingNat64State nat64_state = 5; 478 479 // Information about TREL. 480 optional TrelInfo trel_info = 6; 481 482 // Information about the Border Agent 483 optional BorderAgentInfo border_agent_info = 7; 484 } 485 486 message RcpStabilityStatistics { 487 optional uint32 rcp_timeout_count = 1; 488 optional uint32 rcp_reset_count = 2; 489 optional uint32 rcp_restoration_count = 3; 490 optional uint32 spinel_parse_error_count = 4; 491 optional int32 rcp_firmware_update_count = 5; 492 optional uint32 thread_stack_uptime = 6; 493 } 494 495 message RcpInterfaceStatistics { 496 optional uint32 rcp_interface_type = 1; 497 optional uint64 transferred_frames_count = 2; 498 optional uint64 transferred_valid_frames_count = 3; 499 optional uint64 transferred_garbage_frames_count = 4; 500 optional uint64 rx_frames_count = 5; 501 optional uint64 rx_bytes_count = 6; 502 optional uint64 tx_frames_count = 7; 503 optional uint64 tx_bytes_count = 8; 504 } 505 506 message WpanRcp { 507 optional RcpStabilityStatistics rcp_stability_statistics = 1; 508 optional RcpInterfaceStatistics rcp_interface_statistics = 2; 509 } 510 511 message CoexMetrics { 512 optional uint32 count_tx_request = 1; 513 optional uint32 count_tx_grant_immediate = 2; 514 optional uint32 count_tx_grant_wait = 3; 515 optional uint32 count_tx_grant_wait_activated = 4; 516 optional uint32 count_tx_grant_wait_timeout = 5; 517 optional uint32 count_tx_grant_deactivated_during_request = 6; 518 optional uint32 tx_average_request_to_grant_time_us = 7; 519 optional uint32 count_rx_request = 8; 520 optional uint32 count_rx_grant_immediate = 9; 521 optional uint32 count_rx_grant_wait = 10; 522 optional uint32 count_rx_grant_wait_activated = 11; 523 optional uint32 count_rx_grant_wait_timeout = 12; 524 optional uint32 count_rx_grant_deactivated_during_request = 13; 525 optional uint32 count_rx_grant_none = 14; 526 optional uint32 rx_average_request_to_grant_time_us = 15; 527 } 528 529 optional WpanStats wpan_stats = 1; 530 optional WpanTopoFull wpan_topo_full = 2; 531 optional WpanBorderRouter wpan_border_router = 3; 532 optional WpanRcp wpan_rcp = 4; 533 optional CoexMetrics coex_metrics = 5; 534} 535 536message ThreadnetworkTopoEntryRepeated { 537 message TopoEntry { 538 // 0~15: uint16_t rloc_16 539 // 16~31: uint16_t version Thread version of the neighbor 540 optional uint32 combo_telemetry1 = 1; 541 // 0~7: uint8_t link_quality_in 542 // 8~15: int8_t average_rssi 543 // 16~23: int8_t last_rssi 544 // 24~31: uint8_t network_data_version 545 optional uint32 combo_telemetry2 = 2; 546 optional uint32 age_sec = 3; 547 // Each bit on the flag represents a bool flag 548 // 0: rx_on_when_idle 549 // 1: full_function 550 // 2: secure_data_request 551 // 3: full_network_data 552 // 4: is_child 553 optional uint32 topo_entry_flags = 4; 554 optional uint32 link_frame_counter = 5; 555 optional uint32 mle_frame_counter = 6; 556 optional uint32 timeout_sec = 7; 557 // 0~15: uint16_t frame_error_rate. Frame error rate (0xffff->100%). Requires error tracking feature. 558 // 16~31: uint16_t message_error_rate. (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 559 optional uint32 combo_telemetry3 = 8; 560 } 561 562 message TopoEntryRepeated { 563 repeated TopoEntry topo_entries = 1; 564 } 565 566 optional TopoEntryRepeated topo_entry_repeated = 1; 567} 568 569message ThreadnetworkDeviceInfoReported { 570 // OpenThread host build version. 571 optional string ot_host_version = 1; 572 573 // OpenThread RCP build version. 574 optional string ot_rcp_version = 2; 575 576 // Thread protocol version. 577 optional int32 thread_version = 3; 578 579 // Thread Daemon version. 580 optional string thread_daemon_version = 4; 581} 582