1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef CRM_COMMON_ElECTION__H
19 # define CRM_COMMON_ElECTION__H
20
21
22
23
24
25
26
27 typedef struct election_s election_t;
28
29 enum election_result
30 {
31 election_start = 0,
32 election_in_progress,
33 election_lost,
34 election_won,
35 election_error,
36 };
37
38 void election_fini(election_t *e);
39 void election_reset(election_t *e);
40 election_t *election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb);
41
42 void election_timeout_set_period(election_t *e, guint period_ms);
43 void election_timeout_stop(election_t *e);
44
45 void election_vote(election_t *e);
46 bool election_check(election_t *e);
47 void election_remove(election_t *e, const char *uname);
48 enum election_result election_state(election_t *e);
49 enum election_result election_count_vote(election_t *e, xmlNode *vote, bool can_win);
50
51 #endif