• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 DSLM_IPC_PROCESS_H
17 #define DSLM_IPC_PROCESS_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <map>
22 #include <mutex>
23 
24 #include "iremote_object.h"
25 #include "message_parcel.h"
26 #include "refbase.h"
27 #include "singleton.h"
28 
29 #include "device_security_defines.h"
30 
31 namespace OHOS {
32 namespace Security {
33 namespace DeviceSecurityLevel {
34 class DslmIpcProcess : public Singleton<DslmIpcProcess> {
35 public:
36     int32_t DslmProcessGetDeviceSecurityLevel(MessageParcel &data, MessageParcel &reply);
37     class RemoteHolder : public Singleton<RemoteHolder> {
38     public:
39         bool Push(uint32_t owner, uint32_t cookie, const sptr<IRemoteObject> &object);
40         sptr<IRemoteObject> Pop(uint32_t owner, uint32_t cookie);
41 
42     private:
43         std::map<uint64_t, sptr<IRemoteObject>> map_;
44         std::mutex mutex_;
45     };
46 
47 private:
48     int32_t DslmGetRequestFromParcel(MessageParcel &data, DeviceIdentify &identify, RequestOption &option,
49         sptr<IRemoteObject> &object, uint32_t &cookie);
50 
51     int32_t DslmSetResponseToParcel(MessageParcel &reply, uint32_t status);
52 };
53 } // namespace DeviceSecurityLevel
54 } // namespace Security
55 } // namespace OHOS
56 
57 #endif // DSLM_IPC_PROCESS_H