50 #include "../include/libtrap/trap.h" 63 static void create_dump(
void *priv, uint32_t idx,
const char *path)
75 void *p = (
void *) (mh + 1);
116 char *param_iterator = NULL;
121 if (params == NULL) {
133 ret = sscanf(n_str,
"%d", &n);
135 if ((ret != 1) || (n <= 0) || (n > 255)) {
136 VERBOSE(
CL_ERROR,
"Generator IFC expects a number from 1 to 255 as the 1st parameter.");
156 VERBOSE(
CL_ERROR,
"Bad length of the 2nd parameter of generator IFC.");
int blackhole_send(void *priv, const void *data, uint16_t size, int timeout)
void generator_terminate(void *priv)
#define TRAP_E_OK
Success, no error.
char * trap_get_param_by_delimiter(const char *source, char **dest, const char delimiter)
Splitter of params string. Cut the first param, copy it into dest and returns pointer to the start of...
ifc_get_client_stats_json_func_t get_client_stats_json
Pointer to get_client_stats_json function.
#define TRAP_IFC_PARAM_DELIMITER
void blackhole_destroy(void *priv)
ifc_get_id_func_t get_id
Pointer to get_id function.
void blackhole_terminate(void *priv)
char * blackhole_ifc_get_id(void *priv)
struct generator_private_s generator_private_t
void blackhole_flush(void *priv)
#define TRAP_E_TERMINATED
Interface was terminated during reading/writing.
int create_blackhole_ifc(trap_ctx_priv_t *ctx, char *params, trap_output_ifc_t *ifc)
ifc_create_dump_func_t create_dump
Pointer to function for generating of dump.
#define VERBOSE(level, format, args...)
ifc_get_client_count_func_t get_client_count
Pointer to get_client_count function.
static void create_dump(void *priv, uint32_t idx, const char *path)
ifc_send_func_t send
Pointer to send function.
int32_t blackhole_get_client_count(void *priv)
uint8_t generator_ifc_is_conn(void *priv)
#define TRAP_E_MEMORY
Memory allocation error.
ifc_destroy_func_t destroy
Pointer to destructor function.
void generator_destroy(void *priv)
ifc_terminate_func_t terminate
Pointer to terminate function.
char * generator_ifc_get_id(void *priv)
int generator_recv(void *priv, void *data, uint32_t *size, int timeout)
static int trap_error(trap_ctx_priv_t *ctx, int err_num)
int create_generator_ifc(trap_ctx_priv_t *ctx, char *params, trap_input_ifc_t *ifc)
ifc_flush_func_t flush
Pointer to flush function.
void * priv
Pointer to instance's private data.
Interface of TRAP interfaces.
int8_t blackhole_get_client_stats_json(void *priv, json_t *client_stats_arr)
#define TRAP_E_BADPARAMS
Bad parameters passed to interface initializer.