Lorenzo Colitti | ef7b2a1 | 2017-07-10 19:06:57 +0900 | [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 | package android.net; |
| 18 | |
| 19 | import android.net.NetworkStats; |
| 20 | |
| 21 | /** |
Lorenzo Colitti | 62801ec | 2017-08-11 13:47:49 +0900 | [diff] [blame] | 22 | * Interface for NetworkManagementService to query tethering statistics and set data limits. |
Lorenzo Colitti | ef7b2a1 | 2017-07-10 19:06:57 +0900 | [diff] [blame] | 23 | * |
| 24 | * TODO: this does not really need to be an interface since Tethering runs in the same process |
| 25 | * as NetworkManagementService. Consider refactoring Tethering to use direct access to |
| 26 | * NetworkManagementService instead of using INetworkManagementService, and then deleting this |
| 27 | * interface. |
| 28 | * |
| 29 | * @hide |
| 30 | */ |
| 31 | interface ITetheringStatsProvider { |
Lorenzo Colitti | 62801ec | 2017-08-11 13:47:49 +0900 | [diff] [blame] | 32 | // Returns cumulative statistics for all tethering sessions since boot, on all upstreams. |
Lorenzo Colitti | 5356a35 | 2017-08-17 19:23:08 +0900 | [diff] [blame] | 33 | // @code {how} is one of the NetworkStats.STATS_PER_* constants. If {@code how} is |
| 34 | // {@code STATS_PER_IFACE}, the provider should not include any traffic that is already |
| 35 | // counted by kernel interface counters. |
| 36 | NetworkStats getTetherStats(int how); |
Lorenzo Colitti | 62801ec | 2017-08-11 13:47:49 +0900 | [diff] [blame] | 37 | |
| 38 | // Sets the interface quota for the specified upstream interface. This is defined as the number |
| 39 | // of bytes, starting from zero and counting from now, after which data should stop being |
| 40 | // forwarded to/from the specified upstream. A value of QUOTA_UNLIMITED means there is no limit. |
| 41 | void setInterfaceQuota(String iface, long quotaBytes); |
| 42 | |
| 43 | // Indicates that no data usage limit is set. |
| 44 | const int QUOTA_UNLIMITED = -1; |
Lorenzo Colitti | ef7b2a1 | 2017-07-10 19:06:57 +0900 | [diff] [blame] | 45 | } |