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 #ifndef I_NOTIFY_CALLBACK_H 16 #define I_NOTIFY_CALLBACK_H 17 18 #include <string> 19 20 #include "dhcp_result_parcel.h" 21 #include "iremote_broker.h" 22 23 namespace OHOS { 24 namespace NetsysNative { 25 class INotifyCallback : public IRemoteBroker { 26 public: 27 virtual ~INotifyCallback() = default; 28 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetsysNative.INotifyCallback"); 31 enum { 32 ON_INTERFACE_ADDRESS_UPDATED = 0, 33 ON_INTERFACE_ADDRESS_REMOVED, 34 ON_INTERFACE_ADDED, 35 ON_INTERFACE_REMOVED, 36 ON_INTERFACE_CHANGED, 37 ON_INTERFACE_LINK_STATE_CHANGED, 38 ON_ROUTE_CHANGED, 39 ON_DHCP_SUCCESS, 40 ON_BANDWIDTH_REACHED_LIMIT, 41 }; 42 43 public: 44 virtual int32_t OnInterfaceAddressUpdated(const std::string &addr, const std::string &ifName, int flags, 45 int scope) = 0; 46 virtual int32_t OnInterfaceAddressRemoved(const std::string &addr, const std::string &ifName, int flags, 47 int scope) = 0; 48 virtual int32_t OnInterfaceAdded(const std::string &ifName) = 0; 49 virtual int32_t OnInterfaceRemoved(const std::string &ifName) = 0; 50 virtual int32_t OnInterfaceChanged(const std::string &ifName, bool up) = 0; 51 virtual int32_t OnInterfaceLinkStateChanged(const std::string &ifName, bool up) = 0; 52 virtual int32_t OnRouteChanged(bool updated, const std::string &route, const std::string &gateway, 53 const std::string &ifName) = 0; 54 virtual int32_t OnDhcpSuccess(sptr<DhcpResultParcel> &dhcpResult) = 0; 55 virtual int32_t OnBandwidthReachedLimit(const std::string &limitName, const std::string &iface) = 0; 56 }; 57 } // namespace NetsysNative 58 } // namespace OHOS 59 #endif // I_NOTIFY_CALLBACK_H 60