Move TRP messaging to tr_msg.c. Fix old bug.
[trust_router.git] / include / tr_cfgwatch.h
1 #ifndef TR_CFGWATCH_H
2 #define TR_CFGWATCH_H
3
4 #include <talloc.h>
5 #include <time.h>
6 #include <sys/time.h>
7
8
9 struct tr_fstat {
10   char *name;
11   struct timespec mtime;
12 };
13
14 struct tr_cfgwatch_data {
15   struct timeval poll_interval; /* how often should we check for updates? */
16   struct timeval settling_time; /* how long should we wait for changes to settle before updating? */
17   char *config_dir; /* what directory are we watching? */
18   struct tr_fstat *fstat_list; /* file names and mtimes */
19   int n_files; /* number of files in fstat_list */
20   int change_detected; /* have we detected a change? */
21   struct timeval last_change_detected; /* when did we last note a changed mtime? */
22   TR_CFG_MGR *cfg_mgr; /* what trust router config are we updating? */
23 };
24 typedef struct tr_cfgwatch_data TR_CFGWATCH;
25
26
27 /* prototypes */
28 TR_CFGWATCH *tr_cfgwatch_create(TALLOC_CTX *mem_ctx);
29 int tr_read_and_apply_config(TR_CFGWATCH *cfgwatch);
30 int tr_cfgwatch_event_init(struct event_base *base, TR_CFGWATCH *cfg_status, struct event **cfgwatch_ev);
31
32 #endif /* TR_CFGWATCH_H */