blob: cf372bc90c7439e2042d2699271da60a26c1fe09 [file] [log] [blame]
Hugo Benichi50a84c62016-09-02 09:00:59 +09001// LINT: LEGACY_NAMES
2syntax = "proto2";
3
4package clearcut.connectivity;
5
6option java_package = "com.android.server.connectivity.metrics";
7option 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, ...).
12message 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
Hugo Benichi807124a2016-11-24 11:25:01 +090020// Transport describes a physical technology used by a network. It is a subset
21// of the TRANSPORT_* constants defined in android.net.NetworkCapabilities.
22enum Transport {
23 UNKNOWN = 0;
24 BLUETOOTH = 1;
25 CELLULAR = 2;
26 ETHERNET = 3;
27 WIFI = 4;
28};
29
Hugo Benichi7c3a7862016-11-24 11:34:49 +090030// A pair of (key, value) integers for describing histogram-like statistics.
31message Pair {
32 optional int32 key = 1;
33 optional int32 value = 2;
34};
35
Hugo Benichi50a84c62016-09-02 09:00:59 +090036// Logs changes in the system default network. Changes can be 1) acquiring a
37// default network with no previous default, 2) a switch of the system default
38// network to a new default network, 3) a loss of the system default network.
39// This message is associated to android.net.metrics.DefaultNetworkEvent.
40message DefaultNetworkEvent {
41 // A value of 0 means this is a loss of the system default network.
42 optional NetworkId network_id = 1;
43
44 // A value of 0 means there was no previous default network.
45 optional NetworkId previous_network_id = 2;
46
47 // Whether the network supports IPv4, IPv6, or both.
48 enum IPSupport {
49 NONE = 0;
50 IPV4 = 1;
51 IPV6 = 2;
52 DUAL = 3;
53 };
54
55 // Best available information about IP support of the previous network when
56 // disconnecting or switching to a new default network.
57 optional IPSupport previous_network_ip_support = 3;
58
59 // The transport types of the new default network, represented by
60 // TRANSPORT_* constants as defined in NetworkCapabilities.
61 repeated int32 transport_types = 4;
62};
63
64// Logs IpReachabilityMonitor probe events and NUD_FAILED events.
65// This message is associated to android.net.metrics.IpReachabilityEvent.
66message IpReachabilityEvent {
67 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent.
Hugo Benichi807124a2016-11-24 11:25:01 +090068 // Deprecated since version 2, replaced by transport field.
69 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +090070
71 // The event type code of the probe, represented by constants defined in
72 // android.net.metrics.IpReachabilityEvent.
Hugo Benichid680d4c2016-10-13 13:16:16 +090073 // NUD_FAILED_ORGANIC and PROVISIONING_LOST_ORGANIC recorded since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +090074 optional int32 event_type = 2;
75};
76
77// Logs NetworkMonitor and ConnectivityService events related to the state of
78// a network: connection, evaluation, validation, lingering, and disconnection.
79// This message is associated to android.net.metrics.NetworkEvent.
80message NetworkEvent {
81 // The id of the network on which this event happened.
82 optional NetworkId network_id = 1;
83
84 // The type of network event, represented by NETWORK_* constants defined in
85 // android.net.metrics.NetworkEvent.
86 optional int32 event_type = 2;
87
88 // Only valid after finishing evaluating a network for Internet connectivity.
89 // The time it took for this evaluation to complete.
90 optional int32 latency_ms = 3;
91}
92
93// Logs individual captive portal probing events that are performed when
94// evaluating or reevaluating networks for Internet connectivity.
95// This message is associated to android.net.metrics.ValidationProbeEvent.
96message ValidationProbeEvent {
97 // The id of the network for which the probe was sent.
98 optional NetworkId network_id = 1;
99
100 // The time it took for that probe to complete or time out.
101 optional int32 latency_ms = 2;
102
103 // The type of portal probe, represented by PROBE_* constants defined in
104 // android.net.metrics.ValidationProbeEvent.
105 optional int32 probe_type = 3;
106
107 // The http code result of the probe test.
108 optional int32 probe_result = 4;
109}
110
111// Logs DNS lookup latencies. Repeated fields must have the same length.
112// This message is associated to android.net.metrics.DnsEvent.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900113// Deprecated since version 2.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900114message DNSLookupBatch {
115 // The id of the network on which the DNS lookups took place.
116 optional NetworkId network_id = 1;
117
118 // The types of the DNS lookups, as defined in android.net.metrics.DnsEvent.
119 repeated int32 event_types = 2;
120
121 // The return values of the DNS resolver for each DNS lookups.
122 repeated int32 return_codes = 3;
123
124 // The time it took for each DNS lookups to complete.
125 repeated int32 latencies_ms = 4;
126};
127
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900128// Represents a collections of DNS lookup latencies and counters for a
129// particular combination of DNS query type and return code.
130// Since version 2.
131message DNSLatencies {
132 // The type of the DNS lookups, as defined in android.net.metrics.DnsEvent.
133 // Acts as a key for a set of DNS query results.
134 // Possible values are: 0 for getaddrinfo, 1 for gethostbyname.
135 optional int32 type = 1;
136
137 // The return value of the DNS resolver for the DNS lookups.
138 // Acts as a key for a set of DNS query results.
139 // Possible values are: 0 for success, or errno code for failures.
140 optional int32 return_code = 2;
141
142 // The number of query operations recorded.
143 optional int32 query_count = 3;
144
145 // The number of query operations returning A IPv4 records.
146 optional int32 a_count = 4;
147
148 // The number of query operations returning AAAA IPv6 records.
149 optional int32 aaaa_count = 5;
150
151 // The time it took for each DNS lookup to complete. The number of repeated
152 // values can be less than query_count in case of event rate-limiting.
153 repeated int32 latencies_ms = 6;
154};
155
156// Represents latency and errno statistics of the connect() system call.
157// Since version 2.
158message ConnectStatistics {
159 // The number of connect() operations recorded.
160 optional int32 connect_count = 1;
161
162 // The number of connect() operations with IPv6 socket address.
163 optional int32 ipv6_addr_count = 2;
164
165 // The time it took for each successful connect() operation to complete.
166 // The number of repeated values can be less than connect_count in case of
167 // event rate-limiting.
168 repeated int32 latencies_ms = 3;
169
170 // Counts of all error values returned by failed connect() operations.
171 // The Pair key field is the errno code. The Pair value field is the count
172 // for that errno code.
173 repeated Pair errnos_counters = 4;
174};
175
Hugo Benichi50a84c62016-09-02 09:00:59 +0900176// Represents a DHCP event on a single interface, which can be a DHCPClient
177// state transition or a response packet parsing error.
178// This message is associated to android.net.metrics.DhcpClientEvent and
179// android.net.metrics.DhcpErrorEvent.
180message DHCPEvent {
181 // The interface name (wlan, rmnet, lo, ...) on which the event happened.
Hugo Benichi807124a2016-11-24 11:25:01 +0900182 // Deprecated since version 2, replaced by transport field.
183 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +0900184
185 oneof value {
186 // The name of a state in the DhcpClient state machine, represented by
187 // the inner classes of android.net.dhcp.DhcpClient.
188 string state_transition = 2;
189
190 // The error code of a DHCP error, represented by constants defined in
191 // android.net.metrics.DhcpErrorEvent.
192 int32 error_code = 3;
193 }
194
195 // Lifetime duration in milliseconds of a DhcpClient state, or transition
196 // time in milliseconds between specific pairs of DhcpClient's states.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900197 // Only populated since version 1, when state_transition is populated.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900198 optional int32 duration_ms = 4;
199}
200
201// Represents the generation of an Android Packet Filter program.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900202// Since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900203message ApfProgramEvent {
204 // Lifetime of the program in seconds.
205 optional int64 lifetime = 1;
206
207 // Number of RAs filtered by the APF program.
208 optional int32 filtered_ras = 2;
209
210 // Total number of RAs to filter currently tracked by ApfFilter. Can be more
211 // than filtered_ras if all available program size was exhausted.
212 optional int32 current_ras = 3;
213
214 // Length of the APF program in bytes.
215 optional int32 program_length = 4;
216
217 // True if the APF program is dropping multicast and broadcast traffic.
218 optional bool drop_multicast = 5;
219
220 // True if the interface on which APF runs has an IPv4 address.
221 optional bool has_ipv4_addr = 6;
222}
223
224// Represents Router Advertisement listening statistics for an interface with
225// Android Packet Filter enabled.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900226// Since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900227message ApfStatistics {
228 // The time interval in milliseconds these stastistics cover.
229 optional int64 duration_ms = 1;
230
231 // The total number of received RAs.
232 optional int32 received_ras = 2;
233
234 // The total number of received RAs that matched a known RA.
235 optional int32 matching_ras = 3;
236
237 // The total number of received RAs ignored due to the MAX_RAS limit.
238 optional int32 dropped_ras = 5;
239
240 // The total number of received RAs with an effective lifetime of 0 seconds.
241 // Effective lifetime for APF is the minimum of all lifetimes in a RA.
242 optional int32 zero_lifetime_ras = 6;
243
244 // The total number of received RAs that could not be parsed.
245 optional int32 parse_errors = 7;
246
247 // The total number of APF program updates triggered by an RA reception.
248 optional int32 program_updates = 8;
249
250 // The maximum APF program size in byte advertised by hardware.
251 optional int32 max_program_size = 9;
252}
253
254// Represents the reception of a Router Advertisement packet for an interface
255// with Android Packet Filter enabled.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900256// Since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900257message RaEvent {
258 // All lifetime values are expressed in seconds. The default value for an
259 // option lifetime that was not present in the RA option list is -1.
260 // The lifetime of an option (e.g., the Prefix Information Option) is the
261 // minimum lifetime of all such options in the packet.
262
263 // The value of the router lifetime in the RA packet.
264 optional int64 router_lifetime = 1;
265
266 // Prefix valid lifetime from the prefix information option.
267 optional int64 prefix_valid_lifetime = 2;
268
269 // Prefix preferred lifetime from the prefix information option.
270 optional int64 prefix_preferred_lifetime = 3;
271
272 // Route info lifetime.
273 optional int64 route_info_lifetime = 4;
274
275 // Recursive DNS server lifetime.
276 optional int64 rdnss_lifetime = 5;
277
278 // DNS search list lifetime.
279 optional int64 dnssl_lifetime = 6;
280}
281
282// Represents an IP provisioning event in IpManager and how long the
283// provisioning action took.
284// This message is associated to android.net.metrics.IpManagerEvent.
285message IpProvisioningEvent {
286 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent.
Hugo Benichi807124a2016-11-24 11:25:01 +0900287 // Deprecated since version 2, replaced by transport field.
288 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +0900289
290 // The code of the IP provisioning event, represented by constants defined in
291 // android.net.metrics.IpManagerEvent.
292 optional int32 event_type = 2;
293
294 // The duration of the provisioning action that resulted in this event.
295 optional int32 latency_ms = 3;
296}
297
298// Represents one of the IP connectivity event defined in this file.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900299// Next tag: 15
Hugo Benichi50a84c62016-09-02 09:00:59 +0900300message IpConnectivityEvent {
301 // Time in ms when the event was recorded.
302 optional int64 time_ms = 1;
303
Hugo Benichi807124a2016-11-24 11:25:01 +0900304 // Physical transport of the network on which the event happened.
305 // Since version 2.
306 optional Transport transport = 12;
307
Hugo Benichi50a84c62016-09-02 09:00:59 +0900308 // Event type.
309 oneof event {
310
311 // An event about the system default network.
312 DefaultNetworkEvent default_network_event = 2;
313
314 // An IP reachability probe event.
315 IpReachabilityEvent ip_reachability_event = 3;
316
317 // A network lifecycle event.
318 NetworkEvent network_event = 4;
319
320 // A batch of DNS lookups.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900321 // Deprecated in the nyc-mr2 release since version 2, and replaced by dns_latencies.
322 DNSLookupBatch dns_lookup_batch = 5 [deprecated = true];
323
324 // DNS lookup latency statistics.
325 DNSLatencies dns_latencies = 13;
326
327 // Connect latency and errno statistics.
328 ConnectStatistics connect_statistics = 14;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900329
330 // A DHCP client event or DHCP receive error.
331 DHCPEvent dhcp_event = 6;
332
333 // An IP provisioning event.
334 IpProvisioningEvent ip_provisioning_event = 7;
335
336 // A network validation probe event.
337 ValidationProbeEvent validation_probe_event = 8;
338
339 // An Android Packet Filter program event.
340 ApfProgramEvent apf_program_event = 9;
341
342 // An Android Packet Filter statistics event.
343 ApfStatistics apf_statistics = 10;
344
345 // An RA packet reception event.
346 RaEvent ra_event = 11;
347 };
348};
349
350// The information about IP connectivity events.
351message IpConnectivityLog {
352 // An array of IP connectivity events.
353 repeated IpConnectivityEvent events = 1;
354
355 // The number of events that had to be dropped due to a full buffer.
356 optional int32 dropped_events = 2;
Hugo Benichid680d4c2016-10-13 13:16:16 +0900357
358 // The version number of the metrics events being collected.
Hugo Benichi807124a2016-11-24 11:25:01 +0900359 // nyc-dev: not populated, implicitly 0.
360 // nyc-dr1: not populated, implicitly 1 (sailfish and marlin only).
361 // nyc-mr1: not populated, implicitly 1.
362 // nyc-mr2: 2.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900363 optional int32 version = 3;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900364};