Add set/unset private sharing 45/228245/4
authorhyunho <hhstark.kang@samsung.com>
Fri, 20 Mar 2020 03:12:38 +0000 (12:12 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Fri, 15 May 2020 04:27:27 +0000 (04:27 +0000)
rpc_port_set_private_sharing
rpc_port_unset_private_sharing

Change-Id: I52a082cdcc415759fc11e4ce33c5ca438f011f1d
Signed-off-by: hyunho <hhstark.kang@samsung.com>
include/rpc-port-internal.h
src/port-internal.cc
src/port-internal.h
src/rpc-port.cc

index 3af29e485863533c8dca47a4f3e33a25696b59fa..7bb91af63ec4471dca3c6992363d2d335ef9580e 100644 (file)
@@ -30,6 +30,11 @@ int rpc_port_stub_create_mockup(rpc_port_stub_h *h, const char *port_name);
 int rpc_port_proxy_connect_sync(rpc_port_proxy_h h, const char *appid,
                const char *port_name);
 
+int rpc_port_set_private_sharing(rpc_port_h port, const char *paths[],
+               unsigned int size);
+
+int rpc_port_unset_private_sharing(rpc_port_h port);
+
 #ifdef __cplusplus
 }
 #endif
index 369b7825c8cc1f178cdc40e4df3d5b914d172814..55f2dbe6a3a10daecba265b81ed5ff47f30b94e4 100644 (file)
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <uuid/uuid.h>
 #include <dlog.h>
+#include <aul_rpc_port.h>
 
 #include "rpc-port.h"
 #include "port-internal.h"
@@ -59,6 +60,20 @@ Port::~Port() {
   close(fd_);
 }
 
+int Port::SetPrivateSharing(const char *paths[], unsigned int size) {
+  int ret = aul_rpc_port_set_private_sharing(id_.c_str(), paths, size);
+  if (ret != 0)
+    return RPC_PORT_ERROR_IO_ERROR;
+  return RPC_PORT_ERROR_NONE;
+}
+
+int Port::UnsetPrivateSharing() {
+  int ret = aul_rpc_port_unset_private_sharing(id_.c_str());
+  if (ret != 0)
+    return RPC_PORT_ERROR_IO_ERROR;
+  return RPC_PORT_ERROR_NONE;
+}
+
 int Port::Read(void* buf, unsigned int size) {
   unsigned int left = size;
   ssize_t nb;
index 2c0bb71658adfeb7d35a58bed6a3cdd4516915f4..2f0ec39dc8d07d9056a75b3d9e7e34004a7e0fb8 100644 (file)
@@ -31,6 +31,9 @@ class Port {
   Port(int fd, std::string id);
   virtual ~Port();
 
+  int SetPrivateSharing(const char *paths[], unsigned int size);
+  int UnsetPrivateSharing();
+
   int Read(void* buf, unsigned int size);
   int Write(const void* buf, unsigned int size);
   int GetFd() const {
index 2a36d25c05255af25ed9512c6178e772f1b34ba0..0b00a1f0889b2ef32b41b0e210172f229b8f090b 100644 (file)
@@ -448,3 +448,21 @@ RPC_API int rpc_port_stub_get_port(rpc_port_stub_h h,
   return RPC_PORT_ERROR_NONE;
 }
 
+RPC_API int rpc_port_set_private_sharing(rpc_port_h h,
+    const char *paths[], unsigned int size) {
+  if (h == nullptr || paths == nullptr)
+    return RPC_PORT_ERROR_INVALID_PARAMETER;
+
+  auto port = static_cast<Port*>(h);
+
+  return port->SetPrivateSharing(paths, size);
+}
+
+RPC_API int rpc_port_unset_private_sharing(rpc_port_h h) {
+  if (h == nullptr)
+    return RPC_PORT_ERROR_INVALID_PARAMETER;
+
+  auto port = static_cast<Port*>(h);
+
+  return port->UnsetPrivateSharing();
+}
\ No newline at end of file