1 /*
2  * Copyright (c) 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 DLP_PERMISSION_ASYNC_STUB_H
17 #define DLP_PERMISSION_ASYNC_STUB_H
18 
19 #include <iremote_stub.h>
20 #include <nocopyable.h>
21 #include "i_dlp_permission_callback.h"
22 #include "dlp_permission_callback.h"
23 
24 namespace OHOS {
25 namespace Security {
26 namespace DlpPermission {
27 class DlpPermissionAsyncStub : public IRemoteStub<IDlpPermissionCallback> {
28 public:
29     DISALLOW_COPY_AND_MOVE(DlpPermissionAsyncStub);
30     explicit DlpPermissionAsyncStub(std::shared_ptr<GenerateDlpCertificateCallback>& impl);
31     explicit DlpPermissionAsyncStub(std::shared_ptr<ParseDlpCertificateCallback>& impl);
32     ~DlpPermissionAsyncStub() override = default;
33 
34     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
35 
36     void OnGenerateDlpCertificate(int32_t result, const std::vector<uint8_t>& cert) override;
37     void OnParseDlpCertificate(int32_t result, const PermissionPolicy& policy,
38         const std::vector<uint8_t>& cert) override;
39 
40 private:
41     int32_t OnGenerateDlpCertificateStub(MessageParcel& data, MessageParcel& reply);
42     int32_t OnParseDlpCertificateStub(MessageParcel& data, MessageParcel& reply);
43 
44     std::shared_ptr<GenerateDlpCertificateCallback> generateDlpCertificateCallback_ {nullptr};
45     std::shared_ptr<ParseDlpCertificateCallback> parseDlpCertificateCallback_ {nullptr};
46 };
47 }  // namespace DlpPermission
48 }  // namespace Security
49 }  // namespace OHOS
50 
51 #endif  // DLP_PERMISSION_ASYNC_STUB_H
52