summaryrefslogtreecommitdiff
path: root/src/bin/smman.h
blob: 55584a7c0ed06e69d4ffc2b2087cb04e7fa0b9dd (plain) (blame)
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
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Getopt.h>
#include <Eio.h>
#include <Conf.h>
#include <Rules.h>
#include <Spy.h>
#include <Store.h>
#include <cJSON.h>

int smman_log_dom_global;

typedef struct _Smman
{
   Rules *rules;
   Spy *spy;
   Store *store;
   Eina_Inlist *filters;

   struct
   {
      const char *server,
                 *host;
   } cfg;

   struct
   {
      Ecore_Event_Handler *sl, /* SPY_EVENT_LINE */
                          *su; /* ECORE_EVENT_SIGNAL_USER */
   } ev;
} Smman;

typedef struct _Filter
{
   EINA_INLIST;
   const char *filename;
   Spy_File *sf;
   Eina_Hash *rules;
} Filter;

#define ERR(...) EINA_LOG_DOM_ERR(smman_log_dom_global, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(smman_log_dom_global, __VA_ARGS__)
#define NFO(...) EINA_LOG_DOM_INFO(smman_log_dom_global, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(smman_log_dom_global, __VA_ARGS__)
#define CRI(...) EINA_LOG_DOM_CRIT(smman_log_dom_global, __VA_ARGS__)

void config_done(void *data, Conf *conf);
void config_error(void *data, Conf *conf, const char *errstr);

void filter_load(void *data, Rules *rules, Rule *rule);
void filter_load_done(void *data, Rules *rules);
void filter_load_error(void *data, Rules *rules, const char *errstr);
Eina_Bool filter_reload(void *data, int type, void *ev);

Eina_Bool log_line_event(void *data, int type, void *event);

char * sdupf(const char *s, ...);
char * date_es(void);