1 /* 2 * Copyright (c) 2021 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 #include "iremote_broker.h" 21 22 #include "i_net_stats_callback.h" 23 #include "net_stats_constants.h" 24 #include "net_stats_info.h" 25 26 namespace OHOS { 27 namespace NetManagerStandard { 28 class INetStatsService : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetStatsService"); 31 enum { 32 CMD_START = 0, 33 CMD_SYSTEM_READY = 1, 34 CMD_GET_IFACE_STATS_DETAIL = 2, 35 CMD_GET_UID_STATS_DETAIL = 3, 36 CMD_UPDATE_IFACES_STATS = 4, 37 CMD_UPDATE_STATS_DATA = 5, 38 CMD_NSM_REGISTER_NET_STATS_CALLBACK = 6, 39 CMD_NSM_UNREGISTER_NET_STATS_CALLBACK = 7, 40 CMD_NSM_RESET_FACTORY = 8, 41 CMD_END = 100, 42 }; 43 44 public: 45 virtual int32_t RegisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 46 virtual int32_t UnregisterNetStatsCallback(const sptr<INetStatsCallback> &callback) = 0; 47 virtual NetStatsResultCode GetIfaceStatsDetail(const std::string &iface, uint32_t start, uint32_t end, 48 NetStatsInfo &statsInfo) = 0; 49 virtual NetStatsResultCode GetUidStatsDetail(const std::string &iface, uint32_t uid, 50 uint32_t start, uint32_t end, NetStatsInfo &statsInfo) = 0; 51 virtual NetStatsResultCode UpdateIfacesStats(const std::string &iface, 52 uint32_t start, uint32_t end, const NetStatsInfo &stats) = 0; 53 virtual NetStatsResultCode UpdateStatsData() = 0; 54 virtual NetStatsResultCode ResetFactory() = 0; 55 }; 56 } // namespace NetManagerStandard 57 } // namespace OHOS 58 #endif // I_NET_STATS_SERVICE_H