diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-22 14:43:24 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-22 14:46:10 +0200 |
commit | d3e49c4280f10584587fad83bc08c6a168c174d3 (patch) | |
tree | 9127d2f55556a0a049bef296c14da74e0b05904e /src/pingu_host.h | |
parent | 82ec45bb8abf8052a558e8ad589b66b34a0084fa (diff) | |
download | pingu-d3e49c4280f10584587fad83bc08c6a168c174d3.tar.bz2 pingu-d3e49c4280f10584587fad83bc08c6a168c174d3.tar.xz |
move soures to src subdir
Diffstat (limited to 'src/pingu_host.h')
-rw-r--r-- | src/pingu_host.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/pingu_host.h b/src/pingu_host.h new file mode 100644 index 0000000..4f4c341 --- /dev/null +++ b/src/pingu_host.h @@ -0,0 +1,45 @@ +#ifndef PINGU_HOST_H +#define PINGU_HOST_H + +#include <ev.h> + +#include "pingu_burst.h" + +#define PINGU_HOST_STATUS_OFFLINE 0 +#define PINGU_HOST_STATUS_ONLINE 1 + +/* consider online by default */ +#define PINGU_HOST_DEFAULT_STATUS PINGU_HOST_STATUS_ONLINE + +struct pingu_host { + struct list_head host_list_entry; + char *host; + char *label; + const char *up_action; + const char *down_action; + int status; + int max_retries; + int required_replies; + ev_tstamp timeout; + + ev_tstamp burst_interval; + struct ev_timer burst_timeout_watcher; + struct pingu_burst burst; + struct pingu_iface *iface; +}; + +void execute_action(const char *action); + +struct pingu_host *pingu_host_new(char *hoststr, float burst_interval, + int max_retries, int required_replies, + float timeout, + const char *up_action, + const char *down_action); +int pingu_host_set_status(struct pingu_host *host, int status); +int pingu_host_init(struct ev_loop *loop); +int pingu_host_verify_status(struct ev_loop *loop, struct pingu_host *host); +void pingu_host_dump_status(int fd, char *filter); +void pingu_host_iface_deleted(struct pingu_iface *iface); +void pingu_host_cleanup(void); + +#endif |