view src/anvil/penalty.h @ 22656:1789bf2a1e01

director: Make sure HOST-RESET-USERS isn't used with max_moving_users=0 The reset command would just hang in that case. doveadm would never have sent this, so this is just an extra sanity check.
author Timo Sirainen <>
date Sun, 05 Nov 2017 23:51:56 +0200
parents 1282d027ce67
line wrap: on
line source

#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);