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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#ifndef _LIBGLOUGLOU_H_
#define _LIBGLOUGLOU_H_
#include <sys/types.h>
#include <dnet.h>
#include <event.h>
#if defined(__OpenBSD__)
#include <sys/queue.h>
#else
#include <bsd/sys/queue.h>
#endif
#define GLOUGLOU_PROBE_DEFAULT_PORT 4430
#define GLOUGLOU_VIZ_DEFAULT_PORT 4431
/* proto.c */
struct gg_packet {
};
/* probe.c */
struct gg_probe {
};
struct gg_probe *gg_probe_connect(struct addr *ip, int port,
int (*handle_conn)(struct gg_probe *prb),
int (*handle_pkt)(struct gg_probe *prb, struct gg_packet *pkt));
void gg_probe_disconnect(struct gg_probe *);
int gg_probe_send(struct gg_probe *probe, struct gg_packet *pkt);
/* server.c */
struct gg_server {
};
struct gg_server *gg_server_start(struct addr *ip, int port,
int (*handle_conn)(struct gg_server *srv),
int (*handle_pkt)(struct gg_server *srv, struct gg_packet *pkt));
void gg_server_stop(struct gg_server *srv);
/* log.c */
#define LOG_FORCED -2
#define LOG_FATAL -1
#define LOG_WARN 0
#define LOG_INFO 1
#define LOG_DEBUG 2
int log_init(char *, int);
void log_shutdown(void);
void log_tmp(const char *, ...);
void log_debug(const char *, ...);
void log_info(const char *, ...);
void log_warn(const char *, ...);
#if defined(__OpenBSD__)
void __dead log_fatal(const char *, ...);
#else
void log_fatal(const char *, ...);
#endif
/* utils.c */
struct mod {
LIST_ENTRY(mod) entry;
void *handle;
};
struct modules {
LIST_HEAD(, mod) list;
int count;
};
void *xmalloc(size_t);
void *xcalloc(size_t, size_t);
void fd_nonblock(int);
void addrcpy(struct sockaddr_in *, struct sockaddr_in *);
int addrcmp(struct sockaddr_in *, struct sockaddr_in *);
void droppriv(char *, int, char *);
struct modules *modules_load(char *, char *);
int exec_pipe(char *, char **, char *, char **);
void kill_wait(pid_t, int);
struct event *tcp_server_create(struct event_base *, struct addr *, int, event_callback_fn, void *);
struct event *udp_server_create(struct event_base *, struct addr *, int, event_callback_fn, void *);
#endif /* _LIBGLOUGLOU_H_ */
|