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 HKS_SAMGR_SERVER_H
17 #define HKS_SAMGR_SERVER_H
18 
19 #include <stdio.h>
20 
21 #include <ohos_init.h>
22 
23 #include "iproxy_server.h"
24 #include "samgr_lite.h"
25 #include "serializer.h"
26 #include "service.h"
27 
28 #include "hks_log.h"
29 #include "hks_mem.h"
30 #include "hks_request.h"
31 
32 #define HKS_SAMGR_SERVICE "huks_service"
33 #define HKS_SAMGR_FEATRURE "huks_feature"
34 
35 typedef struct {
36     IpcIo *reply;
37     uint32_t callingUid;
38 } HksIpcContext;
39 
40 typedef struct {
41     INHERIT_SERVER_IPROXY;
42 } HksMgrFeatureApi;
43 
44 typedef struct {
45     INHERIT_SERVICE;
46     Identity identity;
47 } HksMgrService;
48 
49 typedef struct {
50     INHERIT_FEATURE;
51     INHERIT_IUNKNOWNENTRY(HksMgrFeatureApi);
52     Identity identity;
53     Service *parent;
54 } HksMgrFeature;
55 
56 enum HksIpcCode {
57     HKS_IPC_MSG_BASE = 0x00010,
58 
59     HKS_IPC_MSG_OK,
60     HKS_IPC_MSG_ERROR,
61     HKS_IPC_MSG_RECEIVED,
62 
63     /* new error code must be added before HKS_MSG_MAX */
64     HKS_IPC_MSG_MAX,
65 };
66 
67 struct HksIpcHandle {
68     IpcIo *io;
69     uint32_t state;
70 };
71 
72 #endif