1 /*
2  * Copyright (c) 2024 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 EL5_FILEKEY_MANAGER_STUB_H
17 #define EL5_FILEKEY_MANAGER_STUB_H
18 
19 #include <map>
20 
21 #include "el5_filekey_manager_interface.h"
22 #include "el5_filekey_manager_log.h"
23 #include "iremote_stub.h"
24 
25 namespace OHOS {
26 namespace Security {
27 namespace AccessToken {
28 class El5FilekeyManagerStub : public IRemoteStub<El5FilekeyManagerInterface> {
29 public:
30     El5FilekeyManagerStub();
31     virtual ~El5FilekeyManagerStub();
32     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
33 
34 private:
35     void SetFuncInMap();
36     void AcquireAccessInner(MessageParcel &data, MessageParcel &reply);
37     void ReleaseAccessInner(MessageParcel &data, MessageParcel &reply);
38     void GenerateAppKeyInner(MessageParcel &data, MessageParcel &reply);
39     void DeleteAppKeyInner(MessageParcel &data, MessageParcel &reply);
40     void GetUserAppKeyInner(MessageParcel &data, MessageParcel &reply);
41     void ChangeUserAppkeysLoadInfoInner(MessageParcel &data, MessageParcel &reply);
42     void SetFilePathPolicyInner(MessageParcel &data, MessageParcel &reply);
43     void RegisterCallbackInner(MessageParcel &data, MessageParcel &reply);
44 
45     void MarshallingKeyInfos(MessageParcel &reply, std::vector<std::pair<int32_t, std::string>>& keyInfos);
46     int32_t UnmarshallingLoadInfos(MessageParcel &data, std::vector<std::pair<std::string, bool>> &loadInfos);
47 
48     using RequestType = void (El5FilekeyManagerStub::*)(MessageParcel &data, MessageParcel &reply);
49     std::map<uint32_t, RequestType> requestMap_;
50 };
51 }  // namespace AccessToken
52 }  // namespace Security
53 }  // namespace OHOS
54 #endif // EL5_FILEKEY_MANAGER_STUB_H
55