• 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     void RetryLoadDeviceAuthSa(void);
31 
32 private:
33     static inline BrokerDelegator<ProxyDevAuth> delegator_;
34 };
35 
36 class ProxyDevAuthData {
37 public:
38     ProxyDevAuthData() = default;
39     virtual ~ProxyDevAuthData() = default;
40     int32_t EncodeCallRequest(int32_t type, const uint8_t *param, int32_t paramSz);
41     int32_t FinalCallRequest(int32_t methodId);
42     int32_t ActCall(bool withSync);
43     void SetCallbackStub(sptr<IRemoteObject> cbRemote);
44     MessageParcel *GetReplyParcel(void);
45 
46 public:
47     MessageParcel replyParcel;
48 private:
49     MessageParcel dataParcel;
50     MessageParcel tmpDataParcel;
51     sptr<IRemoteObject> cbStub = nullptr;
52     int32_t paramCnt = 0;
53     sptr<ProxyDevAuth> GetProxy() const;
54     bool withCallback = false;
55 };
56 }
57 #endif
58