2 * Copyright (c) 2018 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __AUL_RPC_PORT_H__
18 #define __AUL_RPC_PORT_H__
20 #include <sys/types.h>
29 #ifndef AUL_K_RPC_PORT
30 #define AUL_K_RPC_PORT "__K_RPC_PORT"
33 typedef void *aul_rpc_port_watch_h;
35 typedef void (*aul_rpc_port_appeared_cb)(const char *app_id,
36 const char *port_name, int pid, void *user_data);
38 typedef void (*aul_rpc_port_vanished_cb)(const char *app_id,
39 const char *port_name, int pid, void *user_data);
41 int aul_rpc_port_prepare_stub(const char *app_id, const char *port_name);
43 int aul_rpc_port_usr_prepare_stub(const char *app_id, const char *port_name,
46 int aul_rpc_port_create_socket_pair(const char *app_id, const char *port_name,
49 int aul_rpc_port_notify_rpc_finished(void);
51 int aul_rpc_port_set_private_sharing(const char *app_id, const char *paths[],
54 int aul_rpc_port_unset_private_sharing(const char *app_id);
56 int aul_rpc_port_create(const char *port_name, int *fd);
58 int aul_rpc_port_usr_create(const char *port_name, uid_t uid, int *fd);
60 int aul_rpc_port_destroy(const char *port_name);
62 int aul_rpc_port_usr_destroy(const char *port_name, uid_t uid);
64 int aul_rpc_port_add_watch(const char *app_id, const char *port_name,
65 aul_rpc_port_appeared_cb appeared_cb,
66 aul_rpc_port_vanished_cb vanished_cb,
68 aul_rpc_port_watch_h *handle);
70 int aul_rpc_port_usr_add_watch(const char *app_id, const char *port_name,
71 aul_rpc_port_appeared_cb appeared_cb,
72 aul_rpc_port_vanished_cb vanished_cb,
73 void *user_data, uid_t uid,
74 aul_rpc_port_watch_h *handle);
77 int aul_rpc_port_remove_watch(aul_rpc_port_watch_h handle);
79 int aul_rpc_port_exist(const char *appid, const char *port_name, bool *exist);
81 int aul_rpc_port_usr_exist(const char *appid, const char *port_name, uid_t uid,
84 int aul_rpc_port_get_path(const char *appid, const char *port_name,
87 int aul_rpc_port_usr_get_path(const char *appid, const char *port_name,
88 uid_t uid, char **path);
94 #endif /* __AUL_RPC_PORT_H__ */