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_push_stats_info.h" 24 #include "net_stats_constants.h" 25 #include "net_stats_info.h" 26 #include "net_stats_info_sequence.h" 27 #include "net_stats_network.h" 28 #include "stats_ipc_interface_code.h" 29 30 namespace OHOS { 31 namespace NetManagerStandard { 32 class INetStatsService : public IRemoteBroker { 33 public: 34 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetStatsService"); 35 36 public: 37 virtual int32_t GetIfaceRxBytes(uint64_t &stats, const std::string &interfaceName) = 0; 38 virtual int32_t GetIfaceTxBytes(uint64_t &stats, const std::string &interfaceName) = 0; 39 virtual int32_t GetCellularRxBytes(uint64_t &stats) = 0; 40 virtual int32_t GetCellularTxBytes(uint64_t &stats) = 0; 41 virtual int32_t GetAllRxBytes(uint64_t &stats) = 0; 42 virtual int32_t GetAllTxBytes(uint64_t &stats) = 0; 43 virtual int32_t GetUidRxBytes(uint64_t &stats, uint32_t uid) = 0; 44 virtual int32_t GetUidTxBytes(uint64_t &stats, uint32_t uid) = 0; 45 virtual int32_t GetAllStatsInfo(std::vector<NetStatsInfo> &info) = 0; 46 virtual int32_t GetAllSimStatsInfo(std::vector<NetStatsInfo> &infos) = 0; 47 virtual int32_t GetTrafficStatsByNetwork(std::unordered_map<uint32_t, NetStatsInfo> &infos, 48 const sptr<NetStatsNetwork> &network) = 0; 49 virtual int32_t GetTrafficStatsByUidNetwork(std::vector<NetStatsInfoSequence> &infos, uint32_t uid, 50 const sptr<NetStatsNetwork> &network) = 0; 51 virtual int32_t SetAppStats(const PushStatsInfo &info) = 0; 52 virtual int32_t RegisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 53 virtual int32_t UnregisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 54 virtual int32_t GetIfaceStatsDetail(const std::string &iface, uint64_t start, uint64_t end, 55 NetStatsInfo &statsInfo) = 0; 56 virtual int32_t GetUidStatsDetail(const std::string &iface, uint32_t uid, uint64_t start, uint64_t end, 57 NetStatsInfo &statsInfo) = 0; 58 virtual int32_t UpdateIfacesStats(const std::string &iface, uint64_t start, uint64_t end, 59 const NetStatsInfo &stats) = 0; 60 virtual int32_t UpdateStatsData() = 0; 61 virtual int32_t ResetFactory() = 0; 62 virtual int32_t GetCookieRxBytes(uint64_t &stats, uint64_t cookie) = 0; 63 virtual int32_t GetCookieTxBytes(uint64_t &stats, uint64_t cookie) = 0; 64 }; 65 } // namespace NetManagerStandard 66 } // namespace OHOS 67 #endif // I_NET_STATS_SERVICE_H 68