1 /* 2 * Copyright (c) 2020 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 #ifndef LITE_IPC_MANAGER_H 16 #define LITE_IPC_MANAGER_H 17 18 #include <ipc_auth_interface.h> 19 #include "service.h" 20 #include "iproxy_server.h" 21 #include "endpoint.h" 22 #include "sa_store.h" 23 #ifdef MINI_SAMGR_LITE_RPC 24 #include "utils_list.h" 25 #endif 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif 31 #endif 32 #define SAMGR_SERVICE "samgr" 33 #define MAX_SYSCAP_NAME_LEN 64 34 typedef struct SamgrServer SamgrServer; 35 typedef struct SamgrProxy SamgrProxy; 36 typedef struct SysCapImpl SysCapImpl; 37 typedef enum MsgId { 38 MSG_CLEAN, 39 }MsgId; 40 struct SamgrProxy { 41 INHERIT_SERVER_IPROXY; 42 }; 43 44 struct SamgrServer { 45 INHERIT_SERVICE; 46 INHERIT_IPROXY_ENTRY(SamgrProxy); 47 Identity identity; 48 Endpoint *samgr; 49 MutexId mtx; 50 SAStore store; 51 IpcAuthInterface *ipcAuth; 52 MutexId sysCapMtx; 53 Vector sysCapabilitys; 54 }; 55 56 struct SysCapImpl { 57 char name[MAX_SYSCAP_NAME_LEN + 1]; 58 BOOL isRegister; 59 }; 60 61 #ifdef MINI_SAMGR_LITE_RPC 62 typedef struct { 63 UTILS_DL_LIST list; 64 SaName saName; 65 uintptr_t saId; 66 int token; 67 } SaNode; 68 SaNode *GetSaNodeBySaName(const char *service, const char *feature); 69 SaNode *GetSaNodeBySaId(uintptr_t saId); 70 #endif 71 72 #ifdef __cplusplus 73 #if __cplusplus 74 } 75 #endif 76 #endif 77 #endif // LITE_IPC_MANAGER_H 78