• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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_CONN_SERVICE_STUB_H
17 #define NET_CONN_SERVICE_STUB_H
18 
19 #include <map>
20 
21 #include "iremote_stub.h"
22 
23 #include "i_net_conn_service.h"
24 
25 namespace OHOS {
26 namespace NetManagerStandard {
27 class NetConnServiceStub : public IRemoteStub<INetConnService> {
28 public:
29     NetConnServiceStub();
30     ~NetConnServiceStub();
31 
32     int32_t OnRemoteRequest(
33         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
34 
35 private:
36     using NetConnServiceFunc = int32_t (NetConnServiceStub::*)(MessageParcel &, MessageParcel &);
37     using NetConnServiceFuncPer = std::pair<NetConnServiceFunc, std::set<std::string>>;
38 
39 private:
40     int32_t OnSystemReady(MessageParcel &data, MessageParcel &reply);
41     bool CheckPermission(const std::set<std::string> &permissions);
42     bool CheckPermissionWithCache(const std::set<std::string> &permissions);
43     int32_t OnRegisterNetSupplier(MessageParcel &data, MessageParcel &reply);
44     int32_t OnUnregisterNetSupplier(MessageParcel &data, MessageParcel &reply);
45     int32_t OnRegisterNetSupplierCallback(MessageParcel &data, MessageParcel &reply);
46     int32_t OnRegisterNetConnCallback(MessageParcel &data, MessageParcel &reply);
47     int32_t OnRegisterNetConnCallbackBySpecifier(MessageParcel &data, MessageParcel &reply);
48     int32_t OnUnregisterNetConnCallback(MessageParcel &data, MessageParcel &reply);
49     int32_t OnUpdateNetStateForTest(MessageParcel &data, MessageParcel &reply);
50     int32_t OnUpdateNetSupplierInfo(MessageParcel &data, MessageParcel &reply);
51     int32_t OnUpdateNetLinkInfo(MessageParcel &data, MessageParcel &reply);
52     int32_t OnGetDefaultNet(MessageParcel &data, MessageParcel &reply);
53     int32_t OnHasDefaultNet(MessageParcel &data, MessageParcel &reply);
54     int32_t OnGetIfaceNames(MessageParcel &data, MessageParcel &reply);
55     int32_t OnGetIfaceNameByType(MessageParcel &data, MessageParcel &reply);
56     int32_t OnRegisterNetDetectionCallback(MessageParcel &data, MessageParcel &reply);
57     int32_t OnUnRegisterNetDetectionCallback(MessageParcel &data, MessageParcel &reply);
58     int32_t OnNetDetection(MessageParcel &data, MessageParcel &reply);
59     int32_t OnGetSpecificNet(MessageParcel &data, MessageParcel &reply);
60     int32_t OnGetAllNets(MessageParcel &data, MessageParcel &reply);
61     int32_t OnGetSpecificUidNet(MessageParcel &data, MessageParcel &reply);
62     int32_t OnGetConnectionProperties(MessageParcel &data, MessageParcel &reply);
63     int32_t OnGetNetCapabilities(MessageParcel &data, MessageParcel &reply);
64     int32_t OnGetAddressesByName(MessageParcel &data, MessageParcel &reply);
65     int32_t OnGetAddressByName(MessageParcel &data, MessageParcel &reply);
66     int32_t OnBindSocket(MessageParcel &data, MessageParcel &reply);
67     int32_t OnSetAirplaneMode(MessageParcel &data, MessageParcel &reply);
68     int32_t OnIsDefaultNetMetered(MessageParcel &data, MessageParcel &reply);
69     int32_t OnSetGlobalHttpProxy(MessageParcel &data, MessageParcel &reply);
70     int32_t OnGetGlobalHttpProxy(MessageParcel &data, MessageParcel &reply);
71     int32_t OnGetNetIdByIdentifier(MessageParcel &data, MessageParcel &reply);
72     int32_t OnSetAppNet(MessageParcel &data, MessageParcel &reply);
73 
74 private:
75     std::map<uint32_t, NetConnServiceFuncPer> memberFuncMap_;
76 };
77 } // namespace NetManagerStandard
78 } // namespace OHOS
79 #endif // NET_CONN_SERVICE_STUB_H
80