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 NET_POLICY_SERVICE_STUB_H 17 #define NET_POLICY_SERVICE_STUB_H 18 19 #include <map> 20 21 #include "iremote_stub.h" 22 23 #include "i_net_policy_service.h" 24 25 namespace OHOS { 26 namespace NetManagerStandard { 27 class NetPolicyServiceStub : public IRemoteStub<INetPolicyService> { 28 public: 29 NetPolicyServiceStub(); 30 ~NetPolicyServiceStub(); 31 32 int32_t OnRemoteRequest( 33 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 34 35 private: 36 using NetPolicyServiceFunc = int32_t (NetPolicyServiceStub::*)(MessageParcel &, MessageParcel &); 37 38 private: 39 int32_t OnSetPolicyByUid(MessageParcel &data, MessageParcel &reply); 40 int32_t OnGetPolicyByUid(MessageParcel &data, MessageParcel &reply); 41 int32_t OnGetUidsByPolicy(MessageParcel &data, MessageParcel &reply); 42 int32_t OnIsUidNetAccessMetered(MessageParcel &data, MessageParcel &reply); 43 int32_t OnIsUidNetAccessIfaceName(MessageParcel &data, MessageParcel &reply); 44 int32_t OnRegisterNetPolicyCallback(MessageParcel &data, MessageParcel &reply); 45 int32_t OnUnregisterNetPolicyCallback(MessageParcel &data, MessageParcel &reply); 46 int32_t OnSetNetQuotaPolicies(MessageParcel &data, MessageParcel &reply); 47 int32_t OnGetNetQuotaPolicies(MessageParcel &data, MessageParcel &reply); 48 int32_t OnSetCellularPolicies(MessageParcel &data, MessageParcel &reply); 49 int32_t OnGetCellularPolicies(MessageParcel &data, MessageParcel &reply); 50 int32_t OnSetFactoryPolicy(MessageParcel &data, MessageParcel &reply); 51 int32_t OnSetBackgroundPolicy(MessageParcel &data, MessageParcel &reply); 52 int32_t OnGetBackgroundPolicy(MessageParcel &data, MessageParcel &reply); 53 int32_t OnGetBackgroundPolicyByUid(MessageParcel &data, MessageParcel &reply); 54 int32_t OnGetCurrentBackgroundPolicy(MessageParcel &data, MessageParcel &reply); 55 int32_t OnSnoozePolicy(MessageParcel &data, MessageParcel &reply); 56 int32_t OnSetIdleTrustlist(MessageParcel &data, MessageParcel &reply); 57 int32_t OnGetIdleTrustlist(MessageParcel &data, MessageParcel &reply); 58 59 private: 60 std::map<uint32_t, NetPolicyServiceFunc> memberFuncMap_; 61 }; 62 } // namespace NetManagerStandard 63 } // namespace OHOS 64 #endif // NET_POLICY_SERVICE_STUB_H 65