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 message NetworkId { 13 // Every network gets assigned a network_id on creation based on order of 14 // creation. Thus network_id N is assigned to the network created directly 15 // after network N-1. Thus there is no PII involved here. Zero means no 16 // network. The value 0 is never assigned to a network. 17 optional int32 network_id = 1; 18 }; 19 20 // Logs changes in the system default network. Changes can be 1) acquiring a 21 // default network with no previous default, 2) a switch of the system default 22 // network to a new default network, 3) a loss of the system default network. 23 // This message is associated to android.net.metrics.DefaultNetworkEvent. 24 message DefaultNetworkEvent { 25 // A value of 0 means this is a loss of the system default network. 26 optional NetworkId network_id = 1; 27 28 // A value of 0 means there was no previous default network. 29 optional NetworkId previous_network_id = 2; 30 31 // Whether the network supports IPv4, IPv6, or both. 32 enum IPSupport { 33 NONE = 0; 34 IPV4 = 1; 35 IPV6 = 2; 36 DUAL = 3; 37 }; 38 39 // Best available information about IP support of the previous network when 40 // disconnecting or switching to a new default network. 41 optional IPSupport previous_network_ip_support = 3; 42 43 // The transport types of the new default network, represented by 44 // TRANSPORT_* constants as defined in NetworkCapabilities. 45 repeated int32 transport_types = 4; 46 }; 47 48 // Logs IpReachabilityMonitor probe events and NUD_FAILED events. 49 // This message is associated to android.net.metrics.IpReachabilityEvent. 50 message IpReachabilityEvent { 51 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. 52 optional string if_name = 1; 53 54 // The event type code of the probe, represented by constants defined in 55 // android.net.metrics.IpReachabilityEvent. 56 optional int32 event_type = 2; 57 }; 58 59 // Logs NetworkMonitor and ConnectivityService events related to the state of 60 // a network: connection, evaluation, validation, lingering, and disconnection. 61 // This message is associated to android.net.metrics.NetworkEvent. 62 message NetworkEvent { 63 // The id of the network on which this event happened. 64 optional NetworkId network_id = 1; 65 66 // The type of network event, represented by NETWORK_* constants defined in 67 // android.net.metrics.NetworkEvent. 68 optional int32 event_type = 2; 69 70 // Only valid after finishing evaluating a network for Internet connectivity. 71 // The time it took for this evaluation to complete. 72 optional int32 latency_ms = 3; 73 } 74 75 // Logs individual captive portal probing events that are performed when 76 // evaluating or reevaluating networks for Internet connectivity. 77 // This message is associated to android.net.metrics.ValidationProbeEvent. 78 message ValidationProbeEvent { 79 // The id of the network for which the probe was sent. 80 optional NetworkId network_id = 1; 81 82 // The time it took for that probe to complete or time out. 83 optional int32 latency_ms = 2; 84 85 // The type of portal probe, represented by PROBE_* constants defined in 86 // android.net.metrics.ValidationProbeEvent. 87 optional int32 probe_type = 3; 88 89 // The http code result of the probe test. 90 optional int32 probe_result = 4; 91 } 92 93 // Logs DNS lookup latencies. Repeated fields must have the same length. 94 // This message is associated to android.net.metrics.DnsEvent. 95 message DNSLookupBatch { 96 // The id of the network on which the DNS lookups took place. 97 optional NetworkId network_id = 1; 98 99 // The types of the DNS lookups, as defined in android.net.metrics.DnsEvent. 100 repeated int32 event_types = 2; 101 102 // The return values of the DNS resolver for each DNS lookups. 103 repeated int32 return_codes = 3; 104 105 // The time it took for each DNS lookups to complete. 106 repeated int32 latencies_ms = 4; 107 }; 108 109 // Represents a DHCP event on a single interface, which can be a DHCPClient 110 // state transition or a response packet parsing error. 111 // This message is associated to android.net.metrics.DhcpClientEvent and 112 // android.net.metrics.DhcpErrorEvent. 113 message DHCPEvent { 114 // The interface name (wlan, rmnet, lo, ...) on which the event happened. 115 optional string if_name = 1; 116 117 oneof value { 118 // The name of a state in the DhcpClient state machine, represented by 119 // the inner classes of android.net.dhcp.DhcpClient. 120 string state_transition = 2; 121 122 // The error code of a DHCP error, represented by constants defined in 123 // android.net.metrics.DhcpErrorEvent. 124 int32 error_code = 3; 125 } 126 127 // Lifetime duration in milliseconds of a DhcpClient state, or transition 128 // time in milliseconds between specific pairs of DhcpClient's states. 129 // Only populated when state_transition is populated. 130 optional int32 duration_ms = 4; 131 } 132 133 // Represents the generation of an Android Packet Filter program. 134 message ApfProgramEvent { 135 // Lifetime of the program in seconds. 136 optional int64 lifetime = 1; 137 138 // Number of RAs filtered by the APF program. 139 optional int32 filtered_ras = 2; 140 141 // Total number of RAs to filter currently tracked by ApfFilter. Can be more 142 // than filtered_ras if all available program size was exhausted. 143 optional int32 current_ras = 3; 144 145 // Length of the APF program in bytes. 146 optional int32 program_length = 4; 147 148 // True if the APF program is dropping multicast and broadcast traffic. 149 optional bool drop_multicast = 5; 150 151 // True if the interface on which APF runs has an IPv4 address. 152 optional bool has_ipv4_addr = 6; 153 } 154 155 // Represents Router Advertisement listening statistics for an interface with 156 // Android Packet Filter enabled. 157 message ApfStatistics { 158 // The time interval in milliseconds these stastistics cover. 159 optional int64 duration_ms = 1; 160 161 // The total number of received RAs. 162 optional int32 received_ras = 2; 163 164 // The total number of received RAs that matched a known RA. 165 optional int32 matching_ras = 3; 166 167 // The total number of received RAs ignored due to the MAX_RAS limit. 168 optional int32 dropped_ras = 5; 169 170 // The total number of received RAs with an effective lifetime of 0 seconds. 171 // Effective lifetime for APF is the minimum of all lifetimes in a RA. 172 optional int32 zero_lifetime_ras = 6; 173 174 // The total number of received RAs that could not be parsed. 175 optional int32 parse_errors = 7; 176 177 // The total number of APF program updates triggered by an RA reception. 178 optional int32 program_updates = 8; 179 180 // The maximum APF program size in byte advertised by hardware. 181 optional int32 max_program_size = 9; 182 } 183 184 // Represents the reception of a Router Advertisement packet for an interface 185 // with Android Packet Filter enabled. 186 message RaEvent { 187 // All lifetime values are expressed in seconds. The default value for an 188 // option lifetime that was not present in the RA option list is -1. 189 // The lifetime of an option (e.g., the Prefix Information Option) is the 190 // minimum lifetime of all such options in the packet. 191 192 // The value of the router lifetime in the RA packet. 193 optional int64 router_lifetime = 1; 194 195 // Prefix valid lifetime from the prefix information option. 196 optional int64 prefix_valid_lifetime = 2; 197 198 // Prefix preferred lifetime from the prefix information option. 199 optional int64 prefix_preferred_lifetime = 3; 200 201 // Route info lifetime. 202 optional int64 route_info_lifetime = 4; 203 204 // Recursive DNS server lifetime. 205 optional int64 rdnss_lifetime = 5; 206 207 // DNS search list lifetime. 208 optional int64 dnssl_lifetime = 6; 209 } 210 211 // Represents an IP provisioning event in IpManager and how long the 212 // provisioning action took. 213 // This message is associated to android.net.metrics.IpManagerEvent. 214 message IpProvisioningEvent { 215 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. 216 optional string if_name = 1; 217 218 // The code of the IP provisioning event, represented by constants defined in 219 // android.net.metrics.IpManagerEvent. 220 optional int32 event_type = 2; 221 222 // The duration of the provisioning action that resulted in this event. 223 optional int32 latency_ms = 3; 224 } 225 226 // Represents one of the IP connectivity event defined in this file. 227 // Next tag: 12 228 message IpConnectivityEvent { 229 // Time in ms when the event was recorded. 230 optional int64 time_ms = 1; 231 232 // Event type. 233 oneof event { 234 235 // An event about the system default network. 236 DefaultNetworkEvent default_network_event = 2; 237 238 // An IP reachability probe event. 239 IpReachabilityEvent ip_reachability_event = 3; 240 241 // A network lifecycle event. 242 NetworkEvent network_event = 4; 243 244 // A batch of DNS lookups. 245 DNSLookupBatch dns_lookup_batch = 5; 246 247 // A DHCP client event or DHCP receive error. 248 DHCPEvent dhcp_event = 6; 249 250 // An IP provisioning event. 251 IpProvisioningEvent ip_provisioning_event = 7; 252 253 // A network validation probe event. 254 ValidationProbeEvent validation_probe_event = 8; 255 256 // An Android Packet Filter program event. 257 ApfProgramEvent apf_program_event = 9; 258 259 // An Android Packet Filter statistics event. 260 ApfStatistics apf_statistics = 10; 261 262 // An RA packet reception event. 263 RaEvent ra_event = 11; 264 }; 265 }; 266 267 // The information about IP connectivity events. 268 message IpConnectivityLog { 269 // An array of IP connectivity events. 270 repeated IpConnectivityEvent events = 1; 271 272 // The number of events that had to be dropped due to a full buffer. 273 optional int32 dropped_events = 2; 274 }; 275