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 message SrpServerInfo { 245 // The state of the SRP server 246 optional SrpServerState state = 1; 247 248 // Listening port number 249 optional uint32 port = 2; 250 // The address mode {unicast, anycast} of the SRP server 251 optional SrpServerAddressMode address_mode = 3; 252 253 // The registration information of hosts on the SRP server 254 optional SrpServerRegistrationInfo hosts = 4; 255 256 // The registration information of services on the SRP server 257 optional SrpServerRegistrationInfo services = 5; 258 259 // The counters of response codes sent by the SRP server 260 optional SrpServerResponseCounters response_counters = 6; 261 } 262 263 message DnsServerResponseCounters { 264 // The number of successful responses 265 optional uint32 success_count = 1; 266 267 // The number of server failure responses 268 optional uint32 server_failure_count = 2; 269 270 // The number of format error responses 271 optional uint32 format_error_count = 3; 272 273 // The number of name error responses 274 optional uint32 name_error_count = 4; 275 276 // The number of 'not implemented' responses 277 optional uint32 not_implemented_count = 5; 278 279 // The number of other responses 280 optional uint32 other_count = 6; 281 } 282 283 message DnsServerInfo { 284 // The counters of response codes sent by the DNS server 285 optional DnsServerResponseCounters response_counters = 1; 286 287 // The number of DNS queries resolved at the local SRP server 288 optional uint32 resolved_by_local_srp_count = 2; 289 } 290 291 message MdnsResponseCounters { 292 // The number of successful responses 293 optional uint32 success_count = 1; 294 295 // The number of 'not found' responses 296 optional uint32 not_found_count = 2; 297 298 // The number of 'invalid arg' responses 299 optional uint32 invalid_args_count = 3; 300 301 // The number of 'duplicated' responses 302 optional uint32 duplicated_count = 4; 303 304 // The number of 'not implemented' responses 305 optional uint32 not_implemented_count = 5; 306 307 // The number of unknown error responses 308 optional uint32 unknown_error_count = 6; 309 310 // The number of aborted responses 311 optional uint32 aborted_count = 7; 312 313 // The number of invalid state responses 314 optional uint32 invalid_state_count = 8; 315 } 316 317 message MdnsInfo { 318 // The response counters of host registrations 319 optional MdnsResponseCounters host_registration_responses = 1; 320 321 // The response counters of service registrations 322 optional MdnsResponseCounters service_registration_responses = 2; 323 324 // The response counters of host resolutions 325 optional MdnsResponseCounters host_resolution_responses = 3; 326 327 // The response counters of service resolutions 328 optional MdnsResponseCounters service_resolution_responses = 4; 329 330 // The EMA (Exponential Moving Average) latencies of mDNS operations 331 332 // The EMA latency of host registrations in milliseconds 333 optional uint32 host_registration_ema_latency_ms = 5; 334 335 // The EMA latency of service registrations in milliseconds 336 optional uint32 service_registration_ema_latency_ms = 6; 337 338 // The EMA latency of host resolutions in milliseconds 339 optional uint32 host_resolution_ema_latency_ms = 7; 340 341 // The EMA latency of service resolutions in milliseconds 342 optional uint32 service_resolution_ema_latency_ms = 8; 343 } 344 345 enum Nat64State { 346 NAT64_STATE_UNSPECIFIED = 0; 347 NAT64_STATE_DISABLED = 1; 348 NAT64_STATE_NOT_RUNNING = 2; 349 NAT64_STATE_IDLE = 3; 350 NAT64_STATE_ACTIVE = 4; 351 } 352 353 message BorderRoutingNat64State { 354 optional Nat64State prefix_manager_state = 1; 355 optional Nat64State translator_state = 2; 356 } 357 358 message WpanBorderRouter { 359 // Border routing counters 360 optional BorderRoutingCounters border_routing_counters = 1; 361 362 // Information about the SRP server 363 optional SrpServerInfo srp_server = 2; 364 365 // Information about the DNS server 366 optional DnsServerInfo dns_server = 3; 367 368 // Information about the mDNS publisher 369 optional MdnsInfo mdns = 4; 370 371 // Information about the state of components of NAT64 372 optional BorderRoutingNat64State nat64_state = 5; 373 } 374 375 message RcpStabilityStatistics { 376 optional uint32 rcp_timeout_count = 1; 377 optional uint32 rcp_reset_count = 2; 378 optional uint32 rcp_restoration_count = 3; 379 optional uint32 spinel_parse_error_count = 4; 380 optional int32 rcp_firmware_update_count = 5; 381 optional uint32 thread_stack_uptime = 6; 382 } 383 384 message RcpInterfaceStatistics { 385 optional uint32 rcp_interface_type = 1; 386 optional uint64 transferred_frames_count = 2; 387 optional uint64 transferred_valid_frames_count = 3; 388 optional uint64 transferred_garbage_frames_count = 4; 389 optional uint64 rx_frames_count = 5; 390 optional uint64 rx_bytes_count = 6; 391 optional uint64 tx_frames_count = 7; 392 optional uint64 tx_bytes_count = 8; 393 } 394 395 message WpanRcp { 396 optional RcpStabilityStatistics rcp_stability_statistics = 1; 397 optional RcpInterfaceStatistics rcp_interface_statistics = 2; 398 } 399 400 message CoexMetrics { 401 optional uint32 count_tx_request = 1; 402 optional uint32 count_tx_grant_immediate = 2; 403 optional uint32 count_tx_grant_wait = 3; 404 optional uint32 count_tx_grant_wait_activated = 4; 405 optional uint32 count_tx_grant_wait_timeout = 5; 406 optional uint32 count_tx_grant_deactivated_during_request = 6; 407 optional uint32 tx_average_request_to_grant_time_us = 7; 408 optional uint32 count_rx_request = 8; 409 optional uint32 count_rx_grant_immediate = 9; 410 optional uint32 count_rx_grant_wait = 10; 411 optional uint32 count_rx_grant_wait_activated = 11; 412 optional uint32 count_rx_grant_wait_timeout = 12; 413 optional uint32 count_rx_grant_deactivated_during_request = 13; 414 optional uint32 count_rx_grant_none = 14; 415 optional uint32 rx_average_request_to_grant_time_us = 15; 416 } 417 418 optional WpanStats wpan_stats = 1; 419 optional WpanTopoFull wpan_topo_full = 2; 420 optional WpanBorderRouter wpan_border_router = 3; 421 optional WpanRcp wpan_rcp = 4; 422 optional CoexMetrics coex_metrics = 5; 423} 424 425message ThreadnetworkTopoEntryRepeated { 426 message TopoEntry { 427 // 0~15: uint16_t rloc_16 428 // 16~31: uint16_t version Thread version of the neighbor 429 optional uint32 combo_telemetry1 = 1; 430 // 0~7: uint8_t link_quality_in 431 // 8~15: int8_t average_rssi 432 // 16~23: int8_t last_rssi 433 // 24~31: uint8_t network_data_version 434 optional uint32 combo_telemetry2 = 2; 435 optional uint32 age_sec = 3; 436 // Each bit on the flag represents a bool flag 437 // 0: rx_on_when_idle 438 // 1: full_function 439 // 2: secure_data_request 440 // 3: full_network_data 441 // 4: is_child 442 optional uint32 topo_entry_flags = 4; 443 optional uint32 link_frame_counter = 5; 444 optional uint32 mle_frame_counter = 6; 445 optional uint32 timeout_sec = 7; 446 // 0~15: uint16_t frame_error_rate. Frame error rate (0xffff->100%). Requires error tracking feature. 447 // 16~31: uint16_t message_error_rate. (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 448 optional uint32 combo_telemetry3 = 8; 449 } 450 451 message TopoEntryRepeated { 452 repeated TopoEntry topo_entries = 1; 453 } 454 455 optional TopoEntryRepeated topo_entry_repeated = 1; 456} 457 458message ThreadnetworkDeviceInfoReported { 459 // OpenThread host build version. 460 optional string ot_host_version = 1; 461 462 // OpenThread RCP build version. 463 optional string ot_rcp_version = 2; 464 465 // Thread protocol version. 466 optional int32 thread_version = 3; 467 468 // Thread Daemon version. 469 optional string thread_daemon_version = 4; 470} 471