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 #ifndef LITE_DEFAULT_CLIENT_ADAPTER_H 16 #define LITE_DEFAULT_CLIENT_ADAPTER_H 17 #include "default_client.h" 18 19 #include <log.h> 20 #include <ohos_errno.h> 21 #include <pthread.h> 22 #include <string.h> 23 #include <service_registry.h> 24 #include "client_factory.h" 25 #include "endpoint.h" 26 #include "ipc_skeleton.h" 27 #include "iproxy_client.h" 28 #include "memory_adapter.h" 29 #include "thread_adapter.h" 30 31 #ifdef __cplusplus 32 #if __cplusplus 33 extern "C" { 34 #endif 35 #endif 36 #undef LOG_TAG 37 #undef LOG_DOMAIN 38 #define LOG_TAG "Samgr" 39 #define LOG_DOMAIN 0xD001800 40 41 typedef struct IClientHeader IClientHeader; 42 typedef struct IDefaultClient IDefaultClient; 43 typedef struct IClientEntry IClientEntry; 44 struct IClientHeader { 45 SaName key; 46 SvcIdentity target; 47 uint32 deadId; 48 uintptr_t saId; 49 }; 50 51 struct IClientEntry { 52 INHERIT_IUNKNOWNENTRY(IClientProxy); 53 }; 54 55 #pragma pack(1) 56 struct IDefaultClient { 57 IClientHeader header; 58 IClientEntry entry; 59 }; 60 #pragma pack() 61 62 uintptr_t GetRemoteSaIdInner(const char *service, const char *feature); 63 void ProxyInvokeArgInner(IpcIo *reply, IClientHeader *header); 64 SvcIdentity QueryRemoteIdentityInner(const char *deviceId, const char *service, const char *feature); 65 #ifdef __cplusplus 66 #if __cplusplus 67 } 68 #endif 69 #endif 70 #endif // LITE_DEFAULT_CLIENT_H 71