netstats.proto revision da65a52f87ca1a31c9e01e99756e38d37d7e7202
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    NetworkStatsRecorderProto dev_stats = 3;
31
32    NetworkStatsRecorderProto xt_stats = 4;
33
34    NetworkStatsRecorderProto uid_stats = 5;
35
36    NetworkStatsRecorderProto uid_tag_stats = 6;
37}
38
39// Corresponds to NetworkStatsService.mActiveIfaces/mActiveUidIfaces.
40message NetworkInterfaceProto {
41    string interface = 1;
42
43    NetworkIdentitySetProto identities = 2;
44}
45
46// Corresponds to NetworkIdentitySet.
47message NetworkIdentitySetProto {
48    repeated NetworkIdentityProto identities = 1;
49}
50
51// Corresponds to NetworkIdentity.
52message NetworkIdentityProto {
53    // Constats from ConnectivityManager.TYPE_*.
54    int32 type = 1;
55
56    string subscriber_id = 2;
57
58    string network_id = 3;
59
60    bool roaming = 4;
61
62    bool metered = 5;
63}
64
65// Corresponds to NetworkStatsRecorder.
66message NetworkStatsRecorderProto {
67    int64 pending_total_bytes = 1;
68
69    NetworkStatsCollectionProto complete_history = 2;
70}
71
72// Corresponds to NetworkStatsCollection.
73message NetworkStatsCollectionProto {
74    repeated NetworkStatsCollectionStatsProto stats = 1;
75}
76
77// Corresponds to NetworkStatsCollection.mStats.
78message NetworkStatsCollectionStatsProto {
79    NetworkStatsCollectionKeyProto key = 1;
80
81    NetworkStatsHistoryProto history = 2;
82}
83
84// Corresponds to NetworkStatsCollection.Key.
85message NetworkStatsCollectionKeyProto {
86    NetworkIdentitySetProto identity = 1;
87
88    int32 uid = 2;
89
90    int32 set = 3;
91
92    int32 tag = 4;
93}
94
95// Corresponds to NetworkStatsHistory.
96message NetworkStatsHistoryProto {
97    // Duration for this bucket in milliseconds.
98    int64 bucket_duration_ms = 1;
99
100    repeated NetworkStatsHistoryBucketProto buckets = 2;
101}
102
103// Corresponds to each bucket in NetworkStatsHistory.
104message NetworkStatsHistoryBucketProto {
105    // Bucket start time in milliseconds since epoch.
106    int64 bucket_start_ms = 1;
107
108    int64 rx_bytes = 2;
109
110    int64 rx_packets = 3;
111
112    int64 tx_bytes = 4;
113
114    int64 tx_packets = 5;
115
116    int64 operations = 6;
117}
118