blob: 64ce2359f76f0520fb7e6b5e450a0d54cf1272c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/* Copyright */
#ifndef ELAPI_SINK_H
#define ELAPI_SINK_H
#include <time.h>
#include "elapi_collection.h"
#define ELAPI_SINK_OK 0 /* Sink can be used for logging */
#define ELAPI_SINK_SUSPENDED 1 /* Sink is temporary disabled due to recoverable error */
#define ELAPI_SINK_DISABLED 2 /* Sink is explicitely disabled by the application */
#define ELAPI_SINK_PULSE 3 /* Sink is disabled for this one event */
#define SINK_LIB_NAME_SIZE 100
#define SINK_ENTRY_POINT "get_sink_info"
#define SINK_NAME_TEMPLATE "libelapi_sink_%s.so"
#define SINK_NEVER_RETRY -1
/* Flags related to loading sinks */
#define SINK_FLAG_NO_LIMIT 0x00000000 /* NO limits to loading and manipulating this sink - default */
#define SINK_FLAG_LOAD_SINGLE 0x00000001 /* Only allow one instance of the sink per process */
struct data_descriptor {
char *appname;
void *config;
void *internal_data;
};
/* Log facility callbacks */
typedef int (*init_fn)(struct data_descriptor *dblock);
typedef void (*cleanup_fn)(struct data_descriptor *dblock);
typedef int (*format_fn)(struct data_descriptor *dblock, struct collection_item *event);
typedef int (*submit_fn)(struct data_descriptor *dblock);
typedef void (*close_fn)(struct data_descriptor *dblock);
struct sink_capability {
int retry_interval;
int flags;
int instance;
init_fn init_cb;
cleanup_fn cleanup_cb;
format_fn format_cb;
submit_fn submit_cb;
close_fn close_cb;
};
/* The only open function the link can expose */
typedef void (*capability_fn)(struct sink_capability *sink_cpb_block);
struct sink_descriptor {
struct sink_capability sink_cpb_block;
struct data_descriptor dblock;
int suspended;
time_t lasttry;
void *lib_handle;
};
/*Standard capability function */
void get_sink_info(struct sink_capability *sink_cpb_block);
#endif
|