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[],
+int rpc_port_set_private_sharing_array(rpc_port_h port, const char *paths[],
unsigned int size);
+int rpc_port_set_private_sharing(rpc_port_h port, const char *path);
+
int rpc_port_unset_private_sharing(rpc_port_h port);
#ifdef __cplusplus
close(fd_);
}
-int Port::SetPrivateSharing(const char *paths[], unsigned int size) {
+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::SetPrivateSharing(const char* path) {
+ const char* file_list[1] = {path};
+ int ret = aul_rpc_port_set_private_sharing(id_.c_str(), file_list, 1);
+ 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)
Port(int fd, std::string id);
virtual ~Port();
- int SetPrivateSharing(const char *paths[], unsigned int size);
+ int SetPrivateSharing(const char* paths[], unsigned int size);
+ int SetPrivateSharing(const char* path);
int UnsetPrivateSharing();
int Read(void* buf, unsigned int size);
return RPC_PORT_ERROR_NONE;
}
-RPC_API int rpc_port_set_private_sharing(rpc_port_h h,
- const char *paths[], unsigned int size) {
+RPC_API int rpc_port_set_private_sharing_array(rpc_port_h h,
+ const char* paths[], unsigned int size) {
if (h == nullptr || paths == nullptr)
return RPC_PORT_ERROR_INVALID_PARAMETER;
return port->SetPrivateSharing(paths, size);
}
+RPC_API int rpc_port_set_private_sharing(rpc_port_h h, const char* path) {
+ if (h == nullptr || path == nullptr)
+ return RPC_PORT_ERROR_INVALID_PARAMETER;
+
+ auto port = static_cast<Port*>(h);
+
+ return port->SetPrivateSharing(path);
+}
+
RPC_API int rpc_port_unset_private_sharing(rpc_port_h h) {
if (h == nullptr)
return RPC_PORT_ERROR_INVALID_PARAMETER;