1 /*
2  * Copyright (c) 2021-2022 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 NET_POLICY_CALLBACK_PROXY_H
17 #define NET_POLICY_CALLBACK_PROXY_H
18 
19 #include "iremote_proxy.h"
20 
21 #include "i_net_policy_callback.h"
22 #include "net_policy_constants.h"
23 #include "net_quota_policy.h"
24 
25 namespace OHOS {
26 namespace NetManagerStandard {
27 class NetPolicyCallbackProxy : public IRemoteProxy<INetPolicyCallback> {
28 public:
29     explicit NetPolicyCallbackProxy(const sptr<IRemoteObject> &impl);
30     virtual ~NetPolicyCallbackProxy();
31 
32 public:
33     int32_t NetUidPolicyChange(uint32_t uid, uint32_t policy) override;
34     int32_t NetUidRuleChange(uint32_t uid, uint32_t rule) override;
35     int32_t NetQuotaPolicyChange(const std::vector<NetQuotaPolicy> &quotaPolicies) override;
36     int32_t NetStrategySwitch(const std::string &simId, bool enable) override;
37     int32_t NetMeteredIfacesChange(std::vector<std::string> &ifaces) override;
38     int32_t NetBackgroundPolicyChange(bool isBackgroundPolicyAllow) override;
39 
40 private:
41     bool WriteInterfaceToken(MessageParcel &data);
42 
43 private:
44     int32_t SendRequest(MessageParcel &data, uint32_t code);
45     static inline BrokerDelegator<NetPolicyCallbackProxy> delegator_;
46 };
47 } // namespace NetManagerStandard
48 } // namespace OHOS
49 #endif // NET_POLICY_CALLBACK_PROXY_H