1/*
2 * Copyright (C) 2017 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 = "proto3";
18
19package android.service;
20
21option java_multiple_files = true;
22option java_outer_classname = "NetworkStatsServiceProto";
23
24// Represents dumpsys from NetworkStatsService (netstats).
25message NetworkStatsServiceDumpProto {
26    repeated NetworkInterfaceProto active_interfaces = 1;
27
28    repeated NetworkInterfaceProto active_uid_interfaces = 2;
29
30    // Device level network stats, which may include non-IP layer traffic.
31    NetworkStatsRecorderProto dev_stats = 3;
32
33    // IP-layer traffic stats.
34    NetworkStatsRecorderProto xt_stats = 4;
35
36    // Per-UID network stats.
37    NetworkStatsRecorderProto uid_stats = 5;
38
39    // Per-UID, per-tag network stats, excluding the default tag (i.e. tag=0).
40    NetworkStatsRecorderProto uid_tag_stats = 6;
41}
42
43// Corresponds to NetworkStatsService.mActiveIfaces/mActiveUidIfaces.
44message NetworkInterfaceProto {
45    string interface = 1;
46
47    NetworkIdentitySetProto identities = 2;
48}
49
50// Corresponds to NetworkIdentitySet.
51message NetworkIdentitySetProto {
52    repeated NetworkIdentityProto identities = 1;
53}
54
55// Corresponds to NetworkIdentity.
56message NetworkIdentityProto {
57    // Constats from ConnectivityManager.TYPE_*.
58    int32 type = 1;
59
60    string subscriber_id = 2;
61
62    string network_id = 3;
63
64    bool roaming = 4;
65
66    bool metered = 5;
67}
68
69// Corresponds to NetworkStatsRecorder.
70message NetworkStatsRecorderProto {
71    int64 pending_total_bytes = 1;
72
73    NetworkStatsCollectionProto complete_history = 2;
74}
75
76// Corresponds to NetworkStatsCollection.
77message NetworkStatsCollectionProto {
78    repeated NetworkStatsCollectionStatsProto stats = 1;
79}
80
81// Corresponds to NetworkStatsCollection.mStats.
82message NetworkStatsCollectionStatsProto {
83    NetworkStatsCollectionKeyProto key = 1;
84
85    NetworkStatsHistoryProto history = 2;
86}
87
88// Corresponds to NetworkStatsCollection.Key.
89message NetworkStatsCollectionKeyProto {
90    NetworkIdentitySetProto identity = 1;
91
92    int32 uid = 2;
93
94    int32 set = 3;
95
96    int32 tag = 4;
97}
98
99// Corresponds to NetworkStatsHistory.
100message NetworkStatsHistoryProto {
101    // Duration for this bucket in milliseconds.
102    int64 bucket_duration_ms = 1;
103
104    repeated NetworkStatsHistoryBucketProto buckets = 2;
105}
106
107// Corresponds to each bucket in NetworkStatsHistory.
108message NetworkStatsHistoryBucketProto {
109    // Bucket start time in milliseconds since epoch.
110    int64 bucket_start_ms = 1;
111
112    int64 rx_bytes = 2;
113
114    int64 rx_packets = 3;
115
116    int64 tx_bytes = 4;
117
118    int64 tx_packets = 5;
119
120    int64 operations = 6;
121}
122