OpenVAS Scanner 23.23.1
ipc.h File Reference
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  ipc_context
struct  ipc_contexts
struct  ipc_exec_context

Typedefs

typedef void(* ipc_process_func) (struct ipc_context *, void *)

Enumerations

enum  ipc_protocol { IPC_PIPE }
enum  ipc_relation { IPC_MAIN , IPC_CHILD }

Functions

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
char * ipc_retrieve (struct ipc_context *context, enum ipc_relation from)
 retrieves data for the relation based on the context
int ipc_destroy (struct ipc_context *context)
 destroys given context
int ipc_close (struct ipc_context *context)
 closes given context
struct ipc_contextipc_exec_as_process (enum ipc_protocol type, struct ipc_exec_context exec_context)
 runs given functions with the given protocol type.
struct ipc_contextipc_init (enum ipc_protocol protocol, enum ipc_relation relation)
 initializes a new context.
struct ipc_contextsipc_contexts_init (int len)
 initializes ipc_contexts with a given preallocated capacity.
struct ipc_contextsipc_add_context (struct ipc_contexts *ctxs, struct ipc_context *ctx)
 adds a given context to contexts
int ipc_destroy_contexts (struct ipc_contexts *ctxs)
 destroys given contexts

Typedef Documentation

◆ ipc_process_func

typedef void(* ipc_process_func) (struct ipc_context *, void *)

Enumeration Type Documentation

◆ ipc_protocol

Enumerator
IPC_PIPE 

◆ ipc_relation

Enumerator
IPC_MAIN 
IPC_CHILD 

Function Documentation

◆ ipc_add_context()

struct ipc_contexts * ipc_add_context ( struct ipc_contexts * ctxs,
struct ipc_context * ctx )

adds a given context to contexts

Parameters
ctxsthe context holder array to be used to add a new ctx
ctxthe context to be added to ctxs
Returns
a pointer to the given ctxs or NULL on failure.

◆ ipc_close()

int ipc_close ( struct ipc_context * context)

closes given context

Parameters
contextthe ipc_context to be closed
Returns
-1 when context is either NULL or already closed or 0 on success.

◆ ipc_contexts_init()

struct ipc_contexts * ipc_contexts_init ( int cap)

initializes ipc_contexts with a given preallocated capacity.

Parameters
capto size to be preallocated, if 0 it will not preallocate but allocate on each enw entry.
Returns
a heap initialized contexts or NULL on failure.

◆ ipc_destroy()

int ipc_destroy ( struct ipc_context * context)

destroys given context

Parameters
contextthe ipc_context to be destroyed.
Returns
0 on success, -1 on context null or failure to destroy

◆ ipc_destroy_contexts()

int ipc_destroy_contexts ( struct ipc_contexts * ctxs)

destroys given contexts

Parameters
ctxsthe context holder array to be destroyed.
Returns
0 on success or -1 on failure.

◆ ipc_exec_as_process()

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.

Parameters
typethe protocol type to be initialized
exec_ctxthe execution context to be executed.
Returns
a heap initialized context or NULL on failure.

◆ ipc_init()

struct ipc_context * ipc_init ( enum ipc_protocol type,
enum ipc_relation relation )

initializes a new context.

Parameters
typethe protocol type to be initialized
relationthe relation of the context to be initialized when supported by the type.
Returns
a heap initialized context or NULL on failure.

◆ ipc_retrieve()

char * ipc_retrieve ( struct ipc_context * context,
enum ipc_relation from )

retrieves data for the relation based on the context

Parameters
contextthe ipc_context to be used; must be previously initialized via ipc_init.
tothe recieving direction of the message when it is supported by the given ipc_context.
Returns
a heap initialized data or NULL

◆ ipc_send()

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

Parameters
contextthe ipc_context to be used; must be previously initialized via ipc_init.
tothe target direction of the message when it is supported by the given ipc_context.
msgthe message to send
lenthe length of msg
Returns
bytes written, -2 when the context or msg or context type is unknown, -1 on write error