1ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti/*
2ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * Copyright (C) 2017 The Android Open Source Project
3ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *
4ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * Licensed under the Apache License, Version 2.0 (the "License");
5ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * you may not use this file except in compliance with the License.
6ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * You may obtain a copy of the License at
7ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *
8ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *      http://www.apache.org/licenses/LICENSE-2.0
9ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *
10ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * Unless required by applicable law or agreed to in writing, software
11ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * distributed under the License is distributed on an "AS IS" BASIS,
12ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * See the License for the specific language governing permissions and
14ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * limitations under the License.
15ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti */
16ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti
17ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colittipackage android.net;
18ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti
19ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colittiimport android.net.NetworkStats;
20ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti
21ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti/**
2262801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti * Interface for NetworkManagementService to query tethering statistics and set data limits.
23ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *
24ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * TODO: this does not really need to be an interface since Tethering runs in the same process
25ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * as NetworkManagementService. Consider refactoring Tethering to use direct access to
26ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * NetworkManagementService instead of using INetworkManagementService, and then deleting this
27ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * interface.
28ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti *
29ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti * @hide
30ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti */
31ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colittiinterface ITetheringStatsProvider {
3262801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    // Returns cumulative statistics for all tethering sessions since boot, on all upstreams.
335356a35c3bcfcdf2d184c620af6bfbf9bddf35c5Lorenzo Colitti    // @code {how} is one of the NetworkStats.STATS_PER_* constants. If {@code how} is
345356a35c3bcfcdf2d184c620af6bfbf9bddf35c5Lorenzo Colitti    // {@code STATS_PER_IFACE}, the provider should not include any traffic that is already
355356a35c3bcfcdf2d184c620af6bfbf9bddf35c5Lorenzo Colitti    // counted by kernel interface counters.
365356a35c3bcfcdf2d184c620af6bfbf9bddf35c5Lorenzo Colitti    NetworkStats getTetherStats(int how);
3762801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti
3862801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    // Sets the interface quota for the specified upstream interface. This is defined as the number
3962801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    // of bytes, starting from zero and counting from now, after which data should stop being
4062801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    // forwarded to/from the specified upstream. A value of QUOTA_UNLIMITED means there is no limit.
4162801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    void setInterfaceQuota(String iface, long quotaBytes);
4262801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti
4362801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    // Indicates that no data usage limit is set.
4462801ec2b7d2c56d9c092324950b320fd3f62c51Lorenzo Colitti    const int QUOTA_UNLIMITED = -1;
45ef7b2a13ce4c34950b52de27dcf65b74388d7b3dLorenzo Colitti}
46