|
OpenVAS Scanner 23.32.3
|
#include "ipc.h"#include "ipc_pipe.h"#include <errno.h>#include <fcntl.h>#include <glib.h>#include <gvm/base/logging.h>#include <json-glib/json-glib.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/wait.h>#include <unistd.h>
Go to the source code of this file.
Macros | |
| #define | G_LOG_DOMAIN "lib misc" |
| GLib logging domain. | |
| #define | IPC_CONTEXTS_CAP_STEP 10 |
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 | |
| int | ipc_destroy (struct ipc_context *context) |
| destroys given context | |
| char * | ipc_retrieve (struct ipc_context *context, enum ipc_relation from) |
| retrieves data for the relation based on the context | |
| 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. | |
| 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 | |
| int | ipc_destroy_contexts (struct ipc_contexts *ctxs) |
| destroys given contexts | |
| #define IPC_CONTEXTS_CAP_STEP 10 |
Definition at line 29 of file ipc.c.
Referenced by ipc_add_context(), and ipc_contexts_init().
| struct ipc_contexts * ipc_add_context | ( | struct ipc_contexts * | ctxs, |
| struct ipc_context * | ctx ) |
adds a given context to contexts
| ctxs | the context holder array to be used to add a new ctx |
| ctx | the context to be added to ctxs |
Definition at line 274 of file ipc.c.
References ipc_contexts::ctxs, and IPC_CONTEXTS_CAP_STEP.
Referenced by reuse_or_add_context().

| int ipc_close | ( | struct ipc_context * | context | ) |
closes given context
| context | the ipc_context to be closed |
Definition at line 116 of file ipc.c.
References ipc_context::closed, ipc_context::context, IPC_PIPE, ipc_pipe_close(), and ipc_context::type.
Referenced by ipc_destroy_contexts(), and procs_cleanup_children().


| struct ipc_contexts * ipc_contexts_init | ( | int | cap | ) |
initializes ipc_contexts with a given preallocated capacity.
| cap | to size to be preallocated, if 0 it will not preallocate but allocate on each enw entry. |
Definition at line 248 of file ipc.c.
References ipc_contexts::cap, ipc_contexts::ctxs, free(), IPC_CONTEXTS_CAP_STEP, and malloc().
Referenced by create_ipc_process(), and pre_fn_call().


| int ipc_destroy | ( | struct ipc_context * | context | ) |
destroys given context
| context | the ipc_context to be destroyed. |
Definition at line 68 of file ipc.c.
References ipc_context::context, IPC_PIPE, ipc_pipe_destroy(), and ipc_context::type.
Referenced by ipc_exec_as_process().


| int ipc_destroy_contexts | ( | struct ipc_contexts * | ctxs | ) |
destroys given contexts
| ctxs | the context holder array to be destroyed. |
Definition at line 305 of file ipc.c.
References ipc_contexts::ctxs, free(), and ipc_close().
Referenced by clean_procs(), and pre_fn_call().


| 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.
| type | the protocol type to be initialized |
| exec_ctx | the execution context to be executed. |
Definition at line 175 of file ipc.c.
References ipc_context::context, ipc_exec_context::func, ipc_exec_context::func_arg, IPC_CHILD, ipc_destroy(), ipc_init(), IPC_MAIN, IPC_PIPE, malloc(), ipc_context::pid, pid, ipc_exec_context::post_func, ipc_exec_context::pre_arg, ipc_exec_context::pre_func, ipc_context::relation, ipc_exec_context::shared_context, and ipc_context::type.
Referenced by create_ipc_process().


| struct ipc_context * ipc_init | ( | enum ipc_protocol | type, |
| enum ipc_relation | relation ) |
initializes a new context.
| type | the protocol type to be initialized |
| relation | the relation of the context to be initialized when supported by the type. |
Definition at line 140 of file ipc.c.
References ipc_context::context, free(), ipc_init_pipe(), IPC_PIPE, ipc_context::relation, and ipc_context::type.
Referenced by ipc_exec_as_process().


| char * ipc_retrieve | ( | struct ipc_context * | context, |
| enum ipc_relation | from ) |
retrieves data for the relation based on the context
| context | the ipc_context to be used; must be previously initialized via ipc_init. |
| to | the recieving direction of the message when it is supported by the given ipc_context. |
Definition at line 95 of file ipc.c.
References ipc_context::context, IPC_PIPE, ipc_pipe_retrieve(), and ipc_context::type.
Referenced by read_ipc().


| 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
| context | the ipc_context to be used; must be previously initialized via ipc_init. |
| to | the target direction of the message when it is supported by the given ipc_context. |
| msg | the message to send |
| len | the length of msg |
Definition at line 46 of file ipc.c.
References ipc_context::context, IPC_PIPE, ipc_pipe_send(), len, and ipc_context::type.
Referenced by add_hostname(), nasl_update_table_driven_lsc_data(), and send_user_agent_via_ipc().

