1//
2// Copyright (C) 2018 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";
18
19package com_android_server_wifi;
20
21option java_package = "com.android.server.wifi";
22option java_outer_classname = "WifiScoreCardProto";
23
24message NetworkList {
25  optional int64 start_time_millis = 1; // Start of collection period
26  optional int64 end_time_millis = 2;   // End of collection period
27  // A collection of network descriptions
28  repeated Network networks = 3;
29};
30
31// Describes a network, consisting of a collection of access points that share
32// the same SSID, the same security type, and (hopefully) the same L3 subnet.
33// This message is not stored in the MemoryStore. It is used to package
34// the access points of a network together in dumpsys output or similar.
35// For this purpose, the network_config_id and network_agent_id may be useful
36// for cross-referencing with other parts of the bug report. Neither of these
37// are meaningful across reboots.
38message Network {
39  optional string ssid = 1;                // The SSID (not stored)
40  optional SecurityType security_type = 2; // Wireless security type
41  repeated AccessPoint access_points = 3;  // The list of related APs
42  optional int32 network_config_id = 4;    // The networkId of WifiConfiguration
43  optional int32 network_agent_id = 5;     // Latest NetworkAgent netId
44};
45
46// Describes an access point (single BSSID)
47//
48// Beyond the BSSID, a concise id is assigned to track references
49// among APs. These ids are local to the device, but unique among all APs
50// known to the device. The BSSID itself is not stored in persistent storage.
51message AccessPoint {
52  optional int32 id = 1;               // Concise id
53  optional bytes bssid = 2;            // BSSID of the access point (not stored)
54  optional SecurityType security_type = 6; // Wireless security type
55  optional Technology technology = 3;  // Wireless technology
56  repeated Signal event_stats = 4;     // Statistics taken at specific events
57  repeated Roam roams = 5;             // Roaming failures and successes
58};
59
60// Describes the IEEE 802.11 security type
61enum SecurityType {
62    OPEN = 0;         // Open - no encryption
63    WEP = 1;          // Should not be used
64    PSK = 2;          // WPA2
65    EAP = 3;          // Extensible Authentication Protocol
66    SAE = 4;          // WPA3
67    EAP_SUITE_B = 5;
68    OWE = 6;          // Opportunistic Wireless Encryption
69};
70
71// Describes the IEEE 802.11 technology used by the access point
72enum Technology {
73  MODE_UNKNOWN = 0;   // not known
74  MODE_11A = 1;       // 802.11a
75  MODE_11B = 2;       // 802.11b
76  MODE_11G = 3;       // 802.11g
77  MODE_11N = 4;       // 802.11n
78  MODE_11AC = 5;      // 802.11ac
79};
80
81// Records statistics gathered at various points in the life-cycle of
82// a connection, e.g., at disconnections of various flavors. May be
83// further split out by frequency.
84//
85message Signal {
86  optional Event event = 1;                   // Type of the event
87  optional int32 frequency = 2;               // Frequency (MHz)
88  optional UnivariateStatistic rssi = 3;      // Signal strength (dBm) of beacons
89  optional UnivariateStatistic linkspeed = 4; // Link speed (Mbits/sec)
90  optional UnivariateStatistic elapsed_ms = 5; // Milliseconds since connection attempt
91};
92
93// Statistics about a real value
94message UnivariateStatistic {
95  // Short-term statistics (for current collection period)
96  optional int64 count = 1;           // Number of events
97  optional double sum = 2;            // Sum of values
98  optional double sum_of_squares = 3; // Sum of squares of values
99  optional double min_value = 4;      // Minimum value during period
100  optional double max_value = 5;      // Maximum value during period
101
102  // Long-term statistics
103  // These are accumulated over a longer time span, and are aged so that
104  // more recent measurements get a higher weight.
105  optional double historical_mean = 6;     // Long-term average
106  optional double historical_variance = 7; // Long-term variance
107};
108
109// Tracks roaming failures and successes
110message Roam {
111  optional int32 to_id = 1;           // AP that we roamed to
112  optional int32 good = 2;            // Successful roams
113  optional int32 bad = 3;             // Failed roams
114};
115
116// Events where statistics may be collected
117enum Event {
118  SIGNAL_POLL = 1;
119  SCAN_BEFORE_SUCCESSFUL_CONNECTION = 2;
120  FIRST_POLL_AFTER_CONNECTION = 3;
121  IP_CONFIGURATION_SUCCESS = 4;
122  SCAN_BEFORE_FAILED_CONNECTION = 5;
123  CONNECTION_FAILURE = 6;
124  IP_REACHABILITY_LOST = 7;
125  LAST_POLL_BEFORE_ROAM = 8;
126  ROAM_SUCCESS = 9;
127  WIFI_DISABLED = 10;
128  ROAM_FAILURE = 11;
129  LAST_POLL_BEFORE_SWITCH = 12;
130  VALIDATION_SUCCESS = 13;
131};
132