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 = "proto2"; 18package android.service; 19 20option java_multiple_files = true; 21option java_outer_classname = "NetworkStatsServiceProto"; 22 23// Represents dumpsys from NetworkStatsService (netstats). 24message NetworkStatsServiceDumpProto { 25 repeated NetworkInterfaceProto active_interfaces = 1; 26 27 repeated NetworkInterfaceProto active_uid_interfaces = 2; 28 29 // Device level network stats, which may include non-IP layer traffic. 30 optional NetworkStatsRecorderProto dev_stats = 3; 31 32 // IP-layer traffic stats. 33 optional NetworkStatsRecorderProto xt_stats = 4; 34 35 // Per-UID network stats. 36 optional NetworkStatsRecorderProto uid_stats = 5; 37 38 // Per-UID, per-tag network stats, excluding the default tag (i.e. tag=0). 39 optional NetworkStatsRecorderProto uid_tag_stats = 6; 40} 41 42// Corresponds to NetworkStatsService.mActiveIfaces/mActiveUidIfaces. 43message NetworkInterfaceProto { 44 // Name of the network interface (eg: wlan). 45 optional string interface = 1; 46 47 optional 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 // Constants from ConnectivityManager.TYPE_*. 58 optional int32 type = 1; 59 60 optional bool roaming = 4; 61 62 optional bool metered = 5; 63 64 optional bool default_network = 6; 65 66 optional int32 oem_managed_network = 7; 67} 68 69// Corresponds to NetworkStatsRecorder. 70message NetworkStatsRecorderProto { 71 optional int64 pending_total_bytes = 1; 72 73 optional 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 optional NetworkStatsCollectionKeyProto key = 1; 84 85 optional NetworkStatsHistoryProto history = 2; 86} 87 88// Corresponds to NetworkStatsCollection.Key. 89message NetworkStatsCollectionKeyProto { 90 optional NetworkIdentitySetProto identity = 1; 91 92 optional int32 uid = 2; 93 94 optional int32 set = 3; 95 96 optional int32 tag = 4; 97} 98 99// Corresponds to NetworkStatsHistory. 100message NetworkStatsHistoryProto { 101 // Duration for this bucket in milliseconds. 102 optional 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 optional int64 bucket_start_ms = 1; 111 112 optional int64 rx_bytes = 2; 113 114 optional int64 rx_packets = 3; 115 116 optional int64 tx_bytes = 4; 117 118 optional int64 tx_packets = 5; 119 120 optional int64 operations = 6; 121}