From f25bb13718f334bc0c96d29ea9f3a57c0a6f3a34 Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Tue, 20 Apr 2021 04:08:58 -0400 Subject: lib: add wpipc library Simple library that uses sockets for inter-process communication. It provides an API to create server and client objects. Users can add custom handlers in the server, and clients can send requests for those custom handlers. Signed-off-by: George Kiagiadakis --- lib/client.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/client.h (limited to 'lib/client.h') diff --git a/lib/client.h b/lib/client.h new file mode 100644 index 0000000..7ac8e1a --- /dev/null +++ b/lib/client.h @@ -0,0 +1,56 @@ +/* PipeWire AGL Cluster IPC + * + * Copyright © 2021 Collabora Ltd. + * @author Julian Bouzas + * + * SPDX-License-Identifier: MIT + */ + +#ifndef __ICIPC_CLIENT_H__ +#define __ICIPC_CLIENT_H__ + +#include + +#include + +#include "sender.h" +#include "defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define icipc_client_to_sender(self) ((struct icipc_sender *)(self)) + +struct icipc_client; + +ICIPC_API +struct icipc_client * +icipc_client_new (const char *path, bool connect); + +ICIPC_API +void +icipc_client_free (struct icipc_client *self); + +ICIPC_API +bool +icipc_client_send_request (struct icipc_client *self, + const char *name, + const struct spa_pod *args, + icipc_sender_reply_func_t reply, + void *data); + +/* for reply handlers only */ + +ICIPC_API +const struct spa_pod * +icipc_client_send_request_finish (struct icipc_sender *self, + const uint8_t *buffer, + size_t size, + const char **error); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit 1.2.3-korg