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