1 // LINT: LEGACY_NAMES 2 syntax = "proto2"; 3 4 package clearcut.connectivity; 5 6 option java_package = "com.android.server.connectivity.metrics"; 7 option java_outer_classname = "IpConnectivityLogClass"; 8 9 // NetworkId represents the id given by the system to a physical network on the 10 // Android device. It is used to relates events to each other for devices with 11 // multiple networks (WiFi, 4G, ...). 12 // Deprecated since version 3, replaced by top-level network_id field in 13 // IpConnectivityEvent. 14 message NetworkId { 15 // Every network gets assigned a network_id on creation based on order of 16 // creation. Thus network_id N is assigned to the network created directly 17 // after network N-1. Thus there is no PII involved here. Zero means no 18 // network. The value 0 is never assigned to a network. 19 optional int32 network_id = 1; 20 }; 21 22 // LinkLayer describes a physical link layer technology used by a network. 23 // It is not intended to map one to one to the TRANSPORT_* constants defined in 24 // android.net.NetworkCapabilities. Instead it is intended to be used as 25 // a dimension field for metrics events and aggregated metrics. 26 // Next tag: 7 27 enum LinkLayer { 28 // An unknown link layer technology. 29 UNKNOWN = 0; 30 31 BLUETOOTH = 1; 32 CELLULAR = 2; 33 ETHERNET = 3; 34 WIFI = 4; 35 36 // Indicates that the link layer dimension is not relevant for the metrics or 37 // event considered. 38 NONE = 5; 39 40 // Indicates that the metrics or event considered may involve several links. 41 MULTIPLE = 6; 42 }; 43 44 // A pair of (key, value) integers for describing histogram-like statistics. 45 message Pair { 46 optional int32 key = 1; 47 optional int32 value = 2; 48 }; 49 50 // Logs changes in the system default network. Changes can be 1) acquiring a 51 // default network with no previous default, 2) a switch of the system default 52 // network to a new default network, 3) a loss of the system default network. 53 // This message is associated to android.net.metrics.DefaultNetworkEvent. 54 message DefaultNetworkEvent { 55 // A value of 0 means this is a loss of the system default network. 56 optional NetworkId network_id = 1; 57 58 // A value of 0 means there was no previous default network. 59 optional NetworkId previous_network_id = 2; 60 61 // Whether the network supports IPv4, IPv6, or both. 62 enum IPSupport { 63 NONE = 0; 64 IPV4 = 1; 65 IPV6 = 2; 66 DUAL = 3; 67 }; 68 69 // Best available information about IP support of the previous network when 70 // disconnecting or switching to a new default network. 71 optional IPSupport previous_network_ip_support = 3; 72 73 // The transport types of the new default network, represented by 74 // TRANSPORT_* constants as defined in NetworkCapabilities. 75 repeated int32 transport_types = 4; 76 }; 77 78 // Logs IpReachabilityMonitor probe events and NUD_FAILED events. 79 // This message is associated to android.net.metrics.IpReachabilityEvent. 80 message IpReachabilityEvent { 81 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. 82 // Deprecated since version 2, to be replaced by link_layer field. 83 optional string if_name = 1 [deprecated = true]; 84 85 // The event type code of the probe, represented by constants defined in 86 // android.net.metrics.IpReachabilityEvent. 87 // NUD_FAILED_ORGANIC and PROVISIONING_LOST_ORGANIC recorded since version 1. 88 optional int32 event_type = 2; 89 }; 90 91 // Logs NetworkMonitor and ConnectivityService events related to the state of 92 // a network: connection, evaluation, validation, lingering, and disconnection. 93 // This message is associated to android.net.metrics.NetworkEvent. 94 message NetworkEvent { 95 // The id of the network on which this event happened. 96 // Deprecated since version 3. 97 optional NetworkId network_id = 1 [deprecated = true]; 98 99 // The type of network event, represented by NETWORK_* constants defined in 100 // android.net.metrics.NetworkEvent. 101 optional int32 event_type = 2; 102 103 // Only valid after finishing evaluating a network for Internet connectivity. 104 // The time it took for this evaluation to complete. 105 optional int32 latency_ms = 3; 106 } 107 108 // Logs individual captive portal probing events that are performed when 109 // evaluating or reevaluating networks for Internet connectivity. 110 // This message is associated to android.net.metrics.ValidationProbeEvent. 111 message ValidationProbeEvent { 112 // The id of the network for which the probe was sent. 113 // Deprecated since version 3. 114 optional NetworkId network_id = 1 [deprecated = true]; 115 116 // The time it took for that probe to complete or time out. 117 optional int32 latency_ms = 2; 118 119 // The type of portal probe, represented by PROBE_* constants defined in 120 // android.net.metrics.ValidationProbeEvent. 121 optional int32 probe_type = 3; 122 123 // The http code result of the probe test. 124 optional int32 probe_result = 4; 125 } 126 127 // Logs DNS lookup latencies. Repeated fields must have the same length. 128 // This message is associated to android.net.metrics.DnsEvent. 129 // Deprecated since version 2. 130 message DNSLookupBatch { 131 // The id of the network on which the DNS lookups took place. 132 optional NetworkId network_id = 1; 133 134 // The types of the DNS lookups, as defined in android.net.metrics.DnsEvent. 135 repeated int32 event_types = 2; 136 137 // The return values of the DNS resolver for each DNS lookups. 138 repeated int32 return_codes = 3; 139 140 // The time it took for each DNS lookups to complete. 141 repeated int32 latencies_ms = 4; 142 }; 143 144 // Represents a collections of DNS lookup latencies and counters for a 145 // particular combination of DNS query type and return code. 146 // Since version 2. 147 message DNSLatencies { 148 // The type of the DNS lookups, as defined in android.net.metrics.DnsEvent. 149 // Acts as a key for a set of DNS query results. 150 // Possible values are: 0 for getaddrinfo, 1 for gethostbyname. 151 optional int32 type = 1; 152 153 // The return value of the DNS resolver for the DNS lookups. 154 // Acts as a key for a set of DNS query results. 155 // Possible values are: 0 for success, or errno code for failures. 156 optional int32 return_code = 2; 157 158 // The number of query operations recorded. 159 optional int32 query_count = 3; 160 161 // The number of query operations returning A IPv4 records. 162 optional int32 a_count = 4; 163 164 // The number of query operations returning AAAA IPv6 records. 165 optional int32 aaaa_count = 5; 166 167 // The time it took for each DNS lookup to complete. The number of repeated 168 // values can be less than query_count in case of event rate-limiting. 169 repeated int32 latencies_ms = 6; 170 }; 171 172 // Represents latency and errno statistics of the connect() system call. 173 // Since version 2. 174 // Next tag: 7 175 message ConnectStatistics { 176 // The number of connect() operations recorded. 177 optional int32 connect_count = 1; 178 179 // The number of connect() operations done in blocking mode. 180 // Since version 3. 181 optional int32 connect_blocking_count = 5; 182 183 // The number of connect() operations with IPv6 socket address. 184 optional int32 ipv6_addr_count = 2; 185 186 // The time it took for successful blocking connect() operations to complete 187 // The number of repeated values can be less than connect_blocking_count in 188 // case of event rate-limiting. 189 repeated int32 latencies_ms = 3; 190 191 // The time it took for successful connect() operation to complete in 192 // non-blocking mode. The number of repeated values can be less than 193 // connect_count - connect_blocking_count in case of event rate-limiting. 194 repeated int32 non_blocking_latencies_ms = 6; 195 196 // Counts of all error values returned by failed connect() operations. 197 // The Pair key field is the errno code. The Pair value field is the count 198 // for that errno code. 199 repeated Pair errnos_counters = 4; 200 }; 201 202 // Represents a DHCP event on a single interface, which can be a DHCPClient 203 // state transition or a response packet parsing error. 204 // This message is associated to android.net.metrics.DhcpClientEvent and 205 // android.net.metrics.DhcpErrorEvent. 206 message DHCPEvent { 207 // The interface name (wlan, rmnet, lo, ...) on which the event happened. 208 // Deprecated since version 2, to be replaced by link_layer field. 209 optional string if_name = 1 [deprecated = true]; 210 211 oneof value { 212 // The name of a state in the DhcpClient state machine, represented by 213 // the inner classes of android.net.dhcp.DhcpClient. 214 string state_transition = 2; 215 216 // The error code of a DHCP error, represented by constants defined in 217 // android.net.metrics.DhcpErrorEvent. 218 int32 error_code = 3; 219 } 220 221 // Lifetime duration in milliseconds of a DhcpClient state, or transition 222 // time in milliseconds between specific pairs of DhcpClient's states. 223 // Only populated since version 1, when state_transition is populated. 224 optional int32 duration_ms = 4; 225 } 226 227 // Represents the generation of an Android Packet Filter program. 228 // Since version 1. 229 // Next tag: 8 230 message ApfProgramEvent { 231 // Maximum lifetime of the program in seconds. 232 optional int64 lifetime = 1; 233 234 // Effective lifetime of the program in seconds from the time the 235 // program was installed to the time it was replaced or removed. 236 optional int64 effective_lifetime = 7; 237 238 // Number of RAs filtered by the APF program. 239 optional int32 filtered_ras = 2; 240 241 // Total number of RAs to filter currently tracked by ApfFilter. Can be more 242 // than filtered_ras if all available program size was exhausted. 243 optional int32 current_ras = 3; 244 245 // Length of the APF program in bytes. 246 optional int32 program_length = 4; 247 248 // True if the APF program is dropping multicast and broadcast traffic. 249 optional bool drop_multicast = 5; 250 251 // True if the interface on which APF runs has an IPv4 address. 252 optional bool has_ipv4_addr = 6; 253 } 254 255 // Represents Router Advertisement listening statistics for an interface with 256 // Android Packet Filter enabled. 257 // Since version 1. 258 // Next tag: 12 259 message ApfStatistics { 260 // The time interval in milliseconds these stastistics cover. 261 optional int64 duration_ms = 1; 262 263 // The total number of received RAs. 264 optional int32 received_ras = 2; 265 266 // The total number of received RAs that matched a known RA. 267 optional int32 matching_ras = 3; 268 269 // The total number of received RAs ignored due to the MAX_RAS limit. 270 optional int32 dropped_ras = 5; 271 272 // The total number of received RAs with an effective lifetime of 0 seconds. 273 // Effective lifetime for APF is the minimum of all lifetimes in a RA. 274 optional int32 zero_lifetime_ras = 6; 275 276 // The total number of received RAs that could not be parsed. 277 optional int32 parse_errors = 7; 278 279 // The total number of APF program updates triggered by an RA reception. 280 optional int32 program_updates = 8; 281 282 // The maximum APF program size in byte advertised by hardware. 283 optional int32 max_program_size = 9; 284 285 // The total number of successful APF program updates triggered by any state 286 // change in ApfFilter. Since version 3. 287 optional int32 program_updates_all = 10; 288 289 // The total number of APF program updates triggered when disabling the 290 // multicast filter. Since version 3. 291 optional int32 program_updates_allowing_multicast = 11; 292 } 293 294 // Represents the reception of a Router Advertisement packet for an interface 295 // with Android Packet Filter enabled. 296 // Since version 1. 297 message RaEvent { 298 // All lifetime values are expressed in seconds. The default value for an 299 // option lifetime that was not present in the RA option list is -1. 300 // The lifetime of an option (e.g., the Prefix Information Option) is the 301 // minimum lifetime of all such options in the packet. 302 303 // The value of the router lifetime in the RA packet. 304 optional int64 router_lifetime = 1; 305 306 // Prefix valid lifetime from the prefix information option. 307 optional int64 prefix_valid_lifetime = 2; 308 309 // Prefix preferred lifetime from the prefix information option. 310 optional int64 prefix_preferred_lifetime = 3; 311 312 // Route info lifetime. 313 optional int64 route_info_lifetime = 4; 314 315 // Recursive DNS server lifetime. 316 optional int64 rdnss_lifetime = 5; 317 318 // DNS search list lifetime. 319 optional int64 dnssl_lifetime = 6; 320 } 321 322 // Represents an IP provisioning event in IpManager and how long the 323 // provisioning action took. 324 // This message is associated to android.net.metrics.IpManagerEvent. 325 message IpProvisioningEvent { 326 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. 327 // Deprecated since version 2, to be replaced by link_layer field. 328 optional string if_name = 1 [deprecated = true]; 329 330 // The code of the IP provisioning event, represented by constants defined in 331 // android.net.metrics.IpManagerEvent. 332 optional int32 event_type = 2; 333 334 // The duration of the provisioning action that resulted in this event. 335 optional int32 latency_ms = 3; 336 } 337 338 // Represents one of the IP connectivity event defined in this file. 339 // Next tag: 19 340 message IpConnectivityEvent { 341 // Time in ms when the event was recorded. 342 optional int64 time_ms = 1; 343 344 // Physical link layer of the network on which the event happened. 345 // Acts as a dimension key. 346 // Since version 2. 347 optional LinkLayer link_layer = 15; 348 349 // Represents the id given by the system to a physical network on the device. 350 // Every network gets assigned a unique id on creation from a monotonic 351 // counter. The value 0 is never assigned to a network and means no network. 352 // It is used to correlate different types of events to each other for devices 353 // with multiple networks (WiFi, 4G, ...). 354 // Since version 3. 355 optional int32 network_id = 16; 356 357 // The interface name (wlan, rmnet, lo, ...) on which the event happened. 358 // Present if the link_layer field was not inferred from the if_name on 359 // the device, so that post-processing of the serialized proto can backfill 360 // link_layer. Since version 3. 361 optional string if_name = 17; 362 363 // The transport types of the network on which the event happened, expressed 364 // as a bit field of TRANSPORT_* constants as defined in NetworkCapabilities. 365 // Present if the link_layer field was not inferred from the transport types, 366 // so that post-processing of the serialized proto can backfill link_layer 367 // Since version 3. 368 optional int64 transports = 18; 369 370 oneof event { 371 372 // An event about the system default network. 373 // The link_layer field is not relevant for this event and set to NONE. 374 DefaultNetworkEvent default_network_event = 2; 375 376 // An IP reachability probe event. 377 IpReachabilityEvent ip_reachability_event = 3; 378 379 // A network lifecycle event. 380 NetworkEvent network_event = 4; 381 382 // A batch of DNS lookups. 383 // Deprecated in the nyc-mr2 release since version 2,and replaced by 384 // dns_latencies. 385 DNSLookupBatch dns_lookup_batch = 5 [deprecated = true]; 386 387 // DNS lookup latency statistics. 388 DNSLatencies dns_latencies = 13; 389 390 // Connect latency and errno statistics. 391 ConnectStatistics connect_statistics = 14; 392 393 // A DHCP client event or DHCP receive error. 394 DHCPEvent dhcp_event = 6; 395 396 // An IP provisioning event. 397 IpProvisioningEvent ip_provisioning_event = 7; 398 399 // A network validation probe event. 400 ValidationProbeEvent validation_probe_event = 8; 401 402 // An Android Packet Filter program event. 403 ApfProgramEvent apf_program_event = 9; 404 405 // An Android Packet Filter statistics event. 406 ApfStatistics apf_statistics = 10; 407 408 // An RA packet reception event. 409 RaEvent ra_event = 11; 410 }; 411 }; 412 413 // The information about IP connectivity events. 414 message IpConnectivityLog { 415 // An array of IP connectivity events. 416 repeated IpConnectivityEvent events = 1; 417 418 // The number of events that had to be dropped due to a full buffer. 419 optional int32 dropped_events = 2; 420 421 // The version number of the metrics events being collected. 422 // nyc: not populated, implicitly 0. 423 // nyc-dr1: not populated, implicitly 1 (sailfish and marlin only). 424 // nyc-mr1: not populated, implicitly 1. 425 // nyc-mr2: 2. 426 // oc: 3. 427 optional int32 version = 3; 428 }; 429