blob: da0bf4c47b94b932de5bc9cfbb1e4e9feb9fb330 [file] [log] [blame]
Lorenzo Colittief7b2a12017-07-10 19:06:57 +09001/*
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
17package android.net;
18
19import android.net.NetworkStats;
20
21/**
Lorenzo Colitti62801ec2017-08-11 13:47:49 +090022 * Interface for NetworkManagementService to query tethering statistics and set data limits.
Lorenzo Colittief7b2a12017-07-10 19:06:57 +090023 *
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 */
31interface ITetheringStatsProvider {
Lorenzo Colitti62801ec2017-08-11 13:47:49 +090032 // Returns cumulative statistics for all tethering sessions since boot, on all upstreams.
Lorenzo Colitti5356a352017-08-17 19:23:08 +090033 // @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 Colitti62801ec2017-08-11 13:47:49 +090037
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 Colittief7b2a12017-07-10 19:06:57 +090045}