• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 IPC_DEV_AUTH_PROXY_H
17 #define IPC_DEV_AUTH_PROXY_H
18 
19 #include "ipc_iface.h"
20 #include "iremote_proxy.h"
21 #include "ipc_callback_stub.h"
22 
23 namespace OHOS {
24 class ProxyDevAuth : public IRemoteProxy<IMethodsIpcCall> {
25 public:
26     explicit ProxyDevAuth(const sptr<IRemoteObject> &impl);
27     ~ProxyDevAuth();
28     int32_t DoCallRequest(MessageParcel &dataParcel, MessageParcel &replyParcel, bool withSync);
29     static bool ServiceRunning(void);
30 
31 private:
32     static inline BrokerDelegator<ProxyDevAuth> delegator_;
33 };
34 
35 class ProxyDevAuthData {
36 public:
37     ProxyDevAuthData() = default;
38     virtual ~ProxyDevAuthData() = default;
39     int32_t EncodeCallRequest(int32_t type, const uint8_t *param, int32_t paramSz);
40     int32_t FinalCallRequest(int32_t methodId);
41     int32_t ActCall(bool withSync);
42     void SetCallbackStub(sptr<IRemoteObject> cbRemote);
43     MessageParcel *GetReplyParcel(void);
44 
45 public:
46     MessageParcel replyParcel;
47 private:
48     MessageParcel dataParcel;
49     MessageParcel tmpDataParcel;
50     sptr<IRemoteObject> cbStub = nullptr;
51     int32_t paramCnt = 0;
52     sptr<ProxyDevAuth> GetProxy() const;
53     bool withCallback = false;
54 };
55 }
56 #endif
57