Move function definition to aul header
[platform/core/appfw/aul-1.git] / include / aul_rpc_port.h
index 5de80c7..224857c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef __AUL_RPC_PORT_H__
 #define __AUL_RPC_PORT_H__
 
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <aul.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef AUL_K_RPC_PORT
 #define AUL_K_RPC_PORT "__K_RPC_PORT"
+#endif
+
+typedef void *aul_rpc_port_watch_h;
+
+typedef void (*aul_rpc_port_appeared_cb)(const char *app_id,
+               const char *port_name, int pid, void *user_data);
+
+typedef void (*aul_rpc_port_vanished_cb)(const char *app_id,
+               const char *port_name, int pid, void *user_data);
 
-int aul_rpc_port_prepare_stub(const char *appid, const char *port_name);
+int aul_rpc_port_prepare_stub(const char *app_id, const char *port_name);
 
-int aul_rpc_port_create_socket_pair(const char *appid, const char *port_name,
+int aul_rpc_port_usr_prepare_stub(const char *app_id, const char *port_name,
+               uid_t uid);
+
+int aul_rpc_port_create_socket_pair(const char *app_id, const char *port_name,
                int (*fds)[2]);
 
 int aul_rpc_port_notify_rpc_finished(void);
 
+int aul_rpc_port_set_private_sharing(const char *app_id, const char *paths[],
+               unsigned int size);
+
+int aul_rpc_port_unset_private_sharing(const char *app_id);
+
+int aul_rpc_port_create(const char *port_name, int *fd);
+
+int aul_rpc_port_usr_create(const char *port_name, uid_t uid, int *fd);
+
+int aul_rpc_port_destroy(const char *port_name);
+
+int aul_rpc_port_usr_destroy(const char *port_name, uid_t uid);
+
+int aul_rpc_port_add_watch(const char *app_id, const char *port_name,
+               aul_rpc_port_appeared_cb appeared_cb,
+               aul_rpc_port_vanished_cb vanished_cb,
+               void *user_data,
+               aul_rpc_port_watch_h *handle);
+
+int aul_rpc_port_usr_add_watch(const char *app_id, const char *port_name,
+               aul_rpc_port_appeared_cb appeared_cb,
+               aul_rpc_port_vanished_cb vanished_cb,
+               void *user_data, uid_t uid,
+               aul_rpc_port_watch_h *handle);
+
+
+int aul_rpc_port_remove_watch(aul_rpc_port_watch_h handle);
+
+int aul_rpc_port_exist(const char *appid, const char *port_name, bool *exist);
+
+int aul_rpc_port_usr_exist(const char *appid, const char *port_name, uid_t uid,
+               bool *exist);
+
+int aul_rpc_port_get_path(const char *appid, const char *port_name,
+               char **path);
+
+int aul_rpc_port_usr_get_path(const char *appid, const char *port_name,
+               uid_t uid, char **path);
+
 #ifdef __cplusplus
 }
 #endif