1 /* 2 * Copyright (c) 2021-20223 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_NET_STATS_SERVICE_H 17 #define I_NET_STATS_SERVICE_H 18 19 #include <string> 20 21 #include "i_net_stats_callback.h" 22 #include "iremote_broker.h" 23 #include "net_stats_constants.h" 24 #include "net_stats_info.h" 25 #include "stats_ipc_interface_code.h" 26 27 namespace OHOS { 28 namespace NetManagerStandard { 29 class INetStatsService : public IRemoteBroker { 30 public: 31 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetStatsService"); 32 33 public: 34 virtual int32_t GetIfaceRxBytes(uint64_t &stats, const std::string &interfaceName) = 0; 35 virtual int32_t GetIfaceTxBytes(uint64_t &stats, const std::string &interfaceName) = 0; 36 virtual int32_t GetCellularRxBytes(uint64_t &stats) = 0; 37 virtual int32_t GetCellularTxBytes(uint64_t &stats) = 0; 38 virtual int32_t GetAllRxBytes(uint64_t &stats) = 0; 39 virtual int32_t GetAllTxBytes(uint64_t &stats) = 0; 40 virtual int32_t GetUidRxBytes(uint64_t &stats, uint32_t uid) = 0; 41 virtual int32_t GetUidTxBytes(uint64_t &stats, uint32_t uid) = 0; 42 virtual int32_t GetAllStatsInfo(std::vector<NetStatsInfo> &info) = 0; 43 virtual int32_t RegisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 44 virtual int32_t UnregisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 45 virtual int32_t GetIfaceStatsDetail(const std::string &iface, uint64_t start, uint64_t end, 46 NetStatsInfo &statsInfo) = 0; 47 virtual int32_t GetUidStatsDetail(const std::string &iface, uint32_t uid, uint64_t start, uint64_t end, 48 NetStatsInfo &statsInfo) = 0; 49 virtual int32_t UpdateIfacesStats(const std::string &iface, uint64_t start, uint64_t end, 50 const NetStatsInfo &stats) = 0; 51 virtual int32_t UpdateStatsData() = 0; 52 virtual int32_t ResetFactory() = 0; 53 }; 54 } // namespace NetManagerStandard 55 } // namespace OHOS 56 #endif // I_NET_STATS_SERVICE_H 57