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 OHOS_IPC_RPC_IREMOTTE_INVOKER_H
17 #define OHOS_IPC_RPC_IREMOTTE_INVOKER_H
18 
19 #include "ipc_skeleton.h"
20 #include "rpc_types.h"
21 #include "serializer.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 typedef struct {
28     void *connector;
29     int32_t (*AcquireHandle)(int32_t handle);
30     int32_t (*ReleaseHandle)(int32_t handle);
31     int32_t (*SendRequest)(SvcIdentity target, uint32_t code, IpcIo *data,
32         IpcIo *reply, MessageOption option, uintptr_t *buffer);
33     int32_t (*FreeBuffer)(void *ptr);
34     int32_t (*SetMaxWorkThread)(int32_t maxThreadNum);
35     void (*JoinThread)(bool initiative);
36     void (*ExitCurrentThread)(void);
37     void (*JoinProcessThread)(bool initiative);
38     int32_t (*SetRegistryObject)(SvcIdentity target, SvcIdentity *samgr);
39     int32_t (*AddDeathRecipient)(int32_t handle, void *cookie);
40     int32_t (*RemoveDeathRecipient)(int32_t handle, void *cookie);
41     void (*InvokerResetIpc)(void);
42 } RemoteInvoker;
43 
44 RemoteInvoker *InitRemoteInvoker(int32_t proto);
45 void DeinitRemoteInvoker(RemoteInvoker *invoker, int32_t proto);
46 #ifdef __cplusplus
47 }
48 #endif /* __cplusplus */
49 #endif /* OHOS_IPC_RPC_IREMOTTE_INVOKER_H */