13#include <gvm/base/logging.h>
14#include <json-glib/json-glib.h>
26#define G_LOG_DOMAIN "lib misc"
29#define IPC_CONTEXTS_CAP_STEP 10
50 if (context == NULL || msg == NULL)
52 switch (context->
type)
73 switch (context->
type)
100 switch (context->
type)
119 if (context == NULL || context->
closed == 1)
121 switch (context->
type)
145 if ((ctx = calloc (1,
sizeof (*ctx))) == NULL)
179 if (exec_ctx.
func == NULL)
225 if ((pctx =
malloc (
sizeof (*pctx))) == NULL)
284 if (
ctxs->ctxs == NULL)
310 for (i = 0; i <
ctxs->len; i++)
int ipc_close(struct ipc_context *context)
closes given context
struct ipc_context * ipc_init(enum ipc_protocol type, enum ipc_relation relation)
initializes a new context.
int ipc_send(struct ipc_context *context, enum ipc_relation to, const char *msg, size_t len)
sends given msg to the target based on the given context
int ipc_destroy(struct ipc_context *context)
destroys given context
struct ipc_context * ipc_exec_as_process(enum ipc_protocol type, struct ipc_exec_context exec_ctx)
runs given functions with the given protocol type.
struct ipc_contexts * ipc_contexts_init(int cap)
initializes ipc_contexts with a given preallocated capacity.
struct ipc_contexts * ipc_add_context(struct ipc_contexts *ctxs, struct ipc_context *ctx)
adds a given context to contexts
char * ipc_retrieve(struct ipc_context *context, enum ipc_relation from)
retrieves data for the relation based on the context
int ipc_destroy_contexts(struct ipc_contexts *ctxs)
destroys given contexts
#define IPC_CONTEXTS_CAP_STEP
struct ipc_pipe_context * ipc_init_pipe(void)
initializes a new context. Do not use this method directly, use ipc_init of ipc.h instead.
int ipc_pipe_send(struct ipc_pipe_context *context, const char *msg, int len)
sends given msg via the given context. Do not use this method directly, use ipc_send of ipc....
int ipc_pipe_destroy(struct ipc_pipe_context *context)
destroys given context. Do not use this method directly, use ipc_destroy of ipc.h instead.
int ipc_pipe_close(struct ipc_pipe_context *context)
closes given context. Do not use this method directly, use ipc_close of ipc.h instead.
char * ipc_pipe_retrieve(struct ipc_pipe_context *context)
retrieves message from the given context. Do not use this method directly, use ipc_retrieve of ipc....
enum ipc_relation relation
struct ipc_context * ctxs
ipc_process_func pre_func
ipc_process_func post_func