aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/upstream.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-04 17:05:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-04 17:05:18 +0000
commita6a1a8d5aea8439b78645d2dc77b61a898020b7d (patch)
tree1b94a56d91e74bb4799911a88da2268ae5ff444c /src/libutil/upstream.h
parentb99cd00a121e1f80077144678207f21c82690544 (diff)
downloadrspamd-a6a1a8d5aea8439b78645d2dc77b61a898020b7d.tar.gz
rspamd-a6a1a8d5aea8439b78645d2dc77b61a898020b7d.zip
[Feature] Implement event watchers for upstreams
Diffstat (limited to 'src/libutil/upstream.h')
-rw-r--r--src/libutil/upstream.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libutil/upstream.h b/src/libutil/upstream.h
index 9b5c7794c..56d6fa6c5 100644
--- a/src/libutil/upstream.h
+++ b/src/libutil/upstream.h
@@ -181,6 +181,31 @@ typedef void (*rspamd_upstream_traverse_func) (struct upstream *up, guint idx,
void rspamd_upstreams_foreach (struct upstream_list *ups,
rspamd_upstream_traverse_func cb, void *ud);
+enum rspamd_upstreams_watch_event {
+ RSPAMD_UPSTREAM_WATCH_SUCCESS = 1u << 0,
+ RSPAMD_UPSTREAM_WATCH_FAILURE = 1u << 1,
+ RSPAMD_UPSTREAM_WATCH_OFFLINE = 1u << 2,
+ RSPAMD_UPSTREAM_WATCH_ONLINE = 1u << 3,
+ RSPAMD_UPSTREAM_WATCH_ALL = (1u << 0) | (1u << 1) | (1u << 2) | (1u << 3),
+};
+
+typedef void (*rspamd_upstream_watch_func) (struct upstream *up,
+ enum rspamd_upstreams_watch_event event,
+ guint cur_errors,
+ void *ud);
+
+/**
+ * Adds new watcher to the upstreams list
+ * @param ups
+ * @param events
+ * @param func
+ * @param ud
+ */
+void rspamd_upstreams_add_watch_callback (struct upstream_list *ups,
+ enum rspamd_upstreams_watch_event events,
+ rspamd_upstream_watch_func func,
+ gpointer ud);
+
/**
* Returns the current IP address of the upstream
* @param up