summaryrefslogtreecommitdiffstats
path: root/src/anvil/penalty.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
commit0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch)
tree3f3789daa2f6db22da6e55e92bee0062a7d613fe /src/anvil/penalty.h
parentInitial commit. (diff)
downloaddovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz
dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/anvil/penalty.h')
-rw-r--r--src/anvil/penalty.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/anvil/penalty.h b/src/anvil/penalty.h
new file mode 100644
index 0000000..23a182c
--- /dev/null
+++ b/src/anvil/penalty.h
@@ -0,0 +1,22 @@
+#ifndef PENALTY_H
+#define PENALTY_H
+
+#define PENALTY_MAX_VALUE ((1 << 16)-1)
+
+struct penalty *penalty_init(void);
+void penalty_deinit(struct penalty **penalty);
+
+void penalty_set_expire_secs(struct penalty *penalty, unsigned int expire_secs);
+
+unsigned int penalty_get(struct penalty *penalty, const char *ident,
+ time_t *last_penalty_r);
+/* if checksum is non-zero and it already exists for ident, the value
+ is set to "value-1", otherwise it's set to "value". */
+void penalty_inc(struct penalty *penalty, const char *ident,
+ unsigned int checksum, unsigned int value);
+
+bool penalty_has_checksum(struct penalty *penalty, const char *ident,
+ unsigned int checksum);
+void penalty_dump(struct penalty *penalty, struct ostream *output);
+
+#endif