10 /* interval in seconds */
11 #define TR_CFGWATCH_DEFAULT_POLL 1
12 #define TR_CFGWATCH_DEFAULT_SETTLE 5
13 /* note: settling time is minimum - only checked on poll intervals */
17 struct timespec mtime;
20 typedef struct tr_cfgwatch_data {
21 struct timeval poll_interval; /* how often should we check for updates? */
22 struct timeval settling_time; /* how long should we wait for changes to settle before updating? */
23 char *config_dir; /* what directory are we watching? */
24 struct tr_fstat *fstat_list; /* file names and mtimes */
25 int n_files; /* number of files in fstat_list */
26 int change_detected; /* have we detected a change? */
27 struct timeval last_change_detected; /* when did we last note a changed mtime? */
28 TR_CFG_MGR *cfg_mgr; /* what trust router config are we updating? */
29 void (*update_cb)(TR_CFG *new_cfg, void *cookie); /* callback after config updated */
30 void *update_cookie; /* data for the update_cb() */
35 TR_CFGWATCH *tr_cfgwatch_create(TALLOC_CTX *mem_ctx);
36 int tr_read_and_apply_config(TR_CFGWATCH *cfgwatch);
37 int tr_cfgwatch_event_init(struct event_base *base, TR_CFGWATCH *cfg_status, struct event **cfgwatch_ev);
39 #endif /* TR_CFGWATCH_H */