-
Notifications
You must be signed in to change notification settings - Fork 2
/
mon.h
61 lines (46 loc) · 1.26 KB
/
mon.h
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
#ifndef MON_H
#define MON_H
#include <event2/bufferevent.h>
/* Monitor descriptor */
enum mon_type {
MON_UNKNOWN,
/* report every N seconds */
MON_KEEPALIVE,
/* Marker; above is nothing, below are inputs */
_MON_UNKNOWN_IN,
/* report input changes */
MON_REPORT,
MON_REPORT_H,
MON_REPORT_L,
/* count input changes */
MON_COUNT,
MON_COUNT_H,
MON_COUNT_L,
/* Marker; above are inputs, below are outputs */
_MON_UNKNOWN_OUT,
/* set for a pre-determined time */
MON_SET_ONCE,
MON_CLEAR_ONCE,
/* switch between set and clear */
MON_SET_LOOP,
MON_CLEAR_LOOP,
};
struct _mon {
enum mon_type typ;
unsigned int id;
unsigned char port,offset;
};
int mon_new(enum mon_type typ, unsigned char port, unsigned char offset, struct bufferevent *buf,
unsigned int msec1, unsigned int msec2);
int mon_grab(int id, struct bufferevent *buf);
int mon_del(int id, struct bufferevent *buf);
void mon_delbuf(struct bufferevent *buf);
/* Enumerate the monitors. Return something != 0 to break the enumerator loop. */
typedef int (*mon_enum_fn)(struct _mon *mon, void *priv);
int mon_enum(mon_enum_fn, void *priv);
const char *mon_typname(enum mon_type typ);
/* check monitor state */
void mon_sync(void);
/* report details */
const char *mon_detail(struct _mon *mon);
#endif