-
Notifications
You must be signed in to change notification settings - Fork 4
/
common.h
55 lines (36 loc) · 986 Bytes
/
common.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
#ifndef TECHFORUM_common_h
# define TECHFORUM_common_h 1
# include <glib.h>
# include <zmq.h>
# include <zookeeper.h>
void uuid_randomize(gchar *d, gsize dl);
void main_set_log_handlers(void);
// Environment common to all entities
struct zenv_s
{
zhandle_t *zh; // ZooKeeper handle
void *zctx; // ZeroMQ context
struct zreactor_s *zr;
};
void zenv_init(struct zenv_s *zenv);
void zenv_close(struct zenv_s *zenv);
// Environment common to standalone services
struct zsrv_env_s
{
struct zenv_s zenv;
struct zservice_s *zsrv;
};
void zsrv_env_init(const gchar *type, struct zsrv_env_s *ctx);
void zsrv_env_close(struct zsrv_env_s *ctx);
// Environment common to clients
struct zclt_env_s
{
struct zenv_s zenv;
gchar uuid[32];
gchar cell[32];
struct zsock_s *zsock;
};
void zclt_env_init(const gchar *type, const gchar *target,
struct zclt_env_s *ctx);
void zclt_env_close(struct zclt_env_s *ctx);
#endif // TECHFORUM_common_h