Libtrap: Internal development docs  1.16.1
Data Structures | Typedefs | Functions
ifc_dummy.c File Reference

TRAP dummy interfaces (generator and blackhole) More...

#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <assert.h>
#include "../include/libtrap/trap.h"
#include "trap_ifc.h"
#include "trap_error.h"
Include dependency graph for ifc_dummy.c:

Go to the source code of this file.

Data Structures

struct  generator_private_s
 

Typedefs

typedef struct generator_private_s generator_private_t
 

Functions

static void create_dump (void *priv, uint32_t idx, const char *path)
 
int generator_recv (void *priv, void *data, uint32_t *size, int timeout)
 
void generator_terminate (void *priv)
 
void generator_destroy (void *priv)
 
char * generator_ifc_get_id (void *priv)
 
uint8_t generator_ifc_is_conn (void *priv)
 
int create_generator_ifc (trap_ctx_priv_t *ctx, char *params, trap_input_ifc_t *ifc)
 
int blackhole_send (void *priv, const void *data, uint16_t size, int timeout)
 
void blackhole_flush (void *priv)
 
void blackhole_terminate (void *priv)
 
void blackhole_destroy (void *priv)
 
int32_t blackhole_get_client_count (void *priv)
 
int8_t blackhole_get_client_stats_json (void *priv, json_t *client_stats_arr)
 
char * blackhole_ifc_get_id (void *priv)
 
int create_blackhole_ifc (trap_ctx_priv_t *ctx, char *params, trap_output_ifc_t *ifc)
 

Detailed Description

TRAP dummy interfaces (generator and blackhole)

Author
Vaclav Bartos ibart.nosp@m.osv@.nosp@m.fit.v.nosp@m.utbr.nosp@m..cz
Date
2013
2014

Definition in file ifc_dummy.c.

Typedef Documentation

◆ generator_private_t

Function Documentation

◆ blackhole_destroy()

void blackhole_destroy ( void *  priv)

Definition at line 204 of file ifc_dummy.c.

◆ blackhole_flush()

void blackhole_flush ( void *  priv)

Definition at line 193 of file ifc_dummy.c.

◆ blackhole_get_client_count()

int32_t blackhole_get_client_count ( void *  priv)

Definition at line 209 of file ifc_dummy.c.

◆ blackhole_get_client_stats_json()

int8_t blackhole_get_client_stats_json ( void *  priv,
json_t *  client_stats_arr 
)

Definition at line 215 of file ifc_dummy.c.

◆ blackhole_ifc_get_id()

char* blackhole_ifc_get_id ( void *  priv)

Definition at line 222 of file ifc_dummy.c.

◆ blackhole_send()

int blackhole_send ( void *  priv,
const void *  data,
uint16_t  size,
int  timeout 
)

Definition at line 188 of file ifc_dummy.c.

◆ blackhole_terminate()

void blackhole_terminate ( void *  priv)

Definition at line 198 of file ifc_dummy.c.

◆ create_blackhole_ifc()

int create_blackhole_ifc ( trap_ctx_priv_t ctx,
char *  params,
trap_output_ifc_t ifc 
)

Create Blackhole interface (output ifc). Send function of this interface does nothing, so everything sent to a blackhole is dropped.

Parameters
[in]ctxPointer to the private libtrap context data (trap_ctx_init()).
[in]paramsIgnored.
[out]ifcCreated interface.
Returns
Always returns 0.

Definition at line 227 of file ifc_dummy.c.

◆ create_dump()

static void create_dump ( void *  priv,
uint32_t  idx,
const char *  path 
)
static

Definition at line 63 of file ifc_dummy.c.

◆ create_generator_ifc()

int create_generator_ifc ( trap_ctx_priv_t ctx,
char *  params,
trap_input_ifc_t ifc 
)

Create Generator interface (input ifc). Receive function of this interface returns always the same data. These data are given in params on creation.

Parameters
[in]ctxPointer to the private libtrap context data (trap_ctx_init()).
[in]paramsArray of n+1 bytes. First byte is equal to n, other bytes are data the generator should generate.
[out]ifcCreated interface.
Returns
Error code (0 on success). Generated interface is returned in ifc.

Definition at line 113 of file ifc_dummy.c.

◆ generator_destroy()

void generator_destroy ( void *  priv)

Definition at line 95 of file ifc_dummy.c.

◆ generator_ifc_get_id()

char* generator_ifc_get_id ( void *  priv)

Definition at line 104 of file ifc_dummy.c.

◆ generator_ifc_is_conn()

uint8_t generator_ifc_is_conn ( void *  priv)

Definition at line 109 of file ifc_dummy.c.

◆ generator_recv()

int generator_recv ( void *  priv,
void *  data,
uint32_t *  size,
int  timeout 
)

Definition at line 69 of file ifc_dummy.c.

◆ generator_terminate()

void generator_terminate ( void *  priv)

Definition at line 87 of file ifc_dummy.c.