1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18option java_multiple_files = true;
19
20package com.android.networkstack.metrics;
21
22import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
23
24message CapportApiData {
25    // The TTL of the network connection provided by captive portal
26    optional int32 remaining_ttl_secs = 1;
27
28    // The limit traffic data of the network connection provided by captive portal
29    optional int32 remaining_bytes = 2;
30
31    // Is portal url option included in the DHCP packet (Yes, No)
32    optional bool has_portal_url = 3;
33
34    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
35    optional bool has_venue_info = 4;
36}
37
38message ProbeEvent {
39    // The probe type (http or https, or captive portal API...)
40    optional .android.stats.connectivity.ProbeType probe_type = 1;
41
42    // The latency in microseconds of the probe event
43    optional int32 latency_micros = 2;
44
45    // The result of the probe event
46    optional .android.stats.connectivity.ProbeResult probe_result = 3;
47
48    // The CaptivePortal API info
49    optional CapportApiData capport_api_data = 4;
50}
51
52message ProbeEvents {
53    // Record probe event during the validation
54    repeated ProbeEvent probe_event = 1;
55}
56
57/**
58 * The DHCP (Dynamic Host Configuration Protocol) session info
59 * Logged from:
60 * src/android/net/dhcp/DhcpClient.java
61 */
62message DhcpSession {
63    // The DHCP Feature(s) enabled in this session
64    repeated .android.stats.connectivity.DhcpFeature used_features = 1;
65
66    // The discover packet (re)transmit count
67    optional int32 discover_count = 2;
68
69    // The request packet (re)transmit count
70    optional int32 request_count = 3;
71
72    // The IPv4 address conflict count
73    // (only be meaningful when duplicate address detection is enabled)
74    optional int32 conflict_count = 4;
75
76    // The DHCP packet parsing error code in this session
77    // (defined in android.net.metrics.DhcpErrorEvent)
78    repeated .android.stats.connectivity.DhcpErrorCode error_code = 5;
79
80    // The result of DHCP hostname transliteration
81    optional .android.stats.connectivity.HostnameTransResult ht_result = 6;
82}
83
84/**
85 * Logs Network IP provisioning event
86 * Logged from:
87 * src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
88 */
89message NetworkIpProvisioningReported {
90    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
91    optional .android.stats.connectivity.TransportType transport_type = 1;
92
93    // The latency in microseconds of IP Provisioning over IPV4
94    optional int32 ipv4_latency_micros = 2;
95
96    // The latency in microseconds of IP Provisioning over IPV6
97    optional int32 ipv6_latency_micros = 3;
98
99    // The time duration between provisioning start and end (success or failure)
100    optional int64 provisioning_duration_micros = 4;
101
102    // The specific disconnect reason for this IP provisioning
103    optional .android.stats.connectivity.DisconnectCode disconnect_code = 5;
104
105    // Log DHCP session info (Only valid for IPv4)
106    optional DhcpSession dhcp_session = 6;
107
108    // The random number between 0 ~ 999 for sampling
109    optional int32 random_number = 7;
110}
111
112/**
113 * Logs Network DHCP Renew event
114 * Logged from:
115 * src/android/net/dhcp/DhcpClient.java
116 */
117message NetworkDhcpRenewReported {
118    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
119    optional .android.stats.connectivity.TransportType transport_type = 1;
120
121    // The request packet (re)transmit count
122    optional int32 request_count = 2;
123
124    // The latency in microseconds of DHCP Renew
125    optional int32 latency_micros = 3;
126
127    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
128    optional .android.stats.connectivity.DhcpErrorCode error_code = 4;
129
130    // The result of DHCP renew
131    optional .android.stats.connectivity.DhcpRenewResult renew_result = 5;
132
133    // The random number between 0 ~ 999 for sampling
134    optional int32 random_number = 6;
135}
136
137/**
138 * Logs Network Validation event
139 * Logged from:
140 * src/com/android/server/connectivity/NetworkMonitor.java
141 */
142message NetworkValidationReported {
143    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
144    optional .android.stats.connectivity.TransportType transport_type = 1;
145
146    // Record each probe event
147    optional ProbeEvents probe_events = 2;
148
149    // The result of the network validation
150    optional .android.stats.connectivity.ValidationResult validation_result = 3;
151
152    // The latency in microseconds of network validation
153    optional int32 latency_micros = 4;
154
155    // The validation index (the first validation attempt or second, third...)
156    optional int32 validation_index = 5;
157
158    // The random number between 0 ~ 999 for sampling
159    optional int32 random_number = 6;
160}
161
162/**
163 * Logs NetworkStack Quirk event
164 * Logged from:
165 * src/com/android/networkstack/
166 * This will be defined as count metrics on server side
167 */
168message NetworkStackQuirkReported {
169    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
170    optional .android.stats.connectivity.TransportType transport_type = 1;
171
172    // Record each Quirk event
173    optional .android.stats.connectivity.NetworkQuirkEvent event = 2;
174}
175