quota.h revision cf41318871bd42358df3420e50614f5310b08c77
#ifndef QUOTA_H
#define QUOTA_H
struct mail;
struct mailbox;
struct mail_user;
/* Message storage size kilobytes. */
#define QUOTA_NAME_STORAGE_KILOBYTES "STORAGE"
/* Message storage size bytes. This is used only internally. */
#define QUOTA_NAME_STORAGE_BYTES "STORAGE_BYTES"
/* Number of messages. */
#define QUOTA_NAME_MESSAGES "MESSAGE"
struct quota;
struct quota_settings;
struct quota_root_settings;
struct quota_root;
struct quota_root_iter;
struct quota_transaction_context;
struct quota_param_parser {
char *param_name;
};
extern struct quota_param_parser quota_param_hidden;
extern struct quota_param_parser quota_param_ignoreunlimited;
extern struct quota_param_parser quota_param_noenforcing;
extern struct quota_param_parser quota_param_ns;
enum quota_recalculate {
/* We may want to recalculate quota because we weren't able to call
quota_free*() correctly for all mails. Quota needs to be
recalculated unless the backend does the quota tracking
internally. */
/* doveadm quota recalc called - make sure the quota is correct */
};
enum quota_alloc_result {
/* Mail size is larger than even the maximum allowed quota. */
};
enum quota_get_result {
/* Quota limit exists and was returned successfully */
/* Quota is unlimited, but its value was returned */
/* Quota resource name doesn't exist */
/* Internal error */
};
struct quota_transaction_context *qt);
struct quota_settings **set_r,
const char **error_r);
/* Add a new rule too the quota root. Returns 0 if ok, -1 if rule is invalid. */
/* Add a new warning rule for the quota root. Returns 0 if ok, -1 if rule is
invalid. */
/* Initialize quota for the given user. Returns 0 and quota_r on success,
-1 and error_r on failure. */
/* List all visible quota roots. They don't need to be freed. */
/* Return quota root or NULL. */
/* Returns name of the quota root. */
/* Return a list of all resources set for the quota root. */
/* Returns TRUE if quota root is marked as hidden (so it shouldn't be visible
to users via IMAP GETQUOTAROOT command). */
/* Returns 1 if values were successfully returned, 0 if resource name doesn't
exist or isn't enabled, -1 if error. */
enum quota_get_result
const char **error_r);
/* Returns 0 if OK, -1 if error (eg. permission denied, invalid name). */
/* Start a new quota transaction. */
/* Commit quota transaction. Returns 0 if ok, -1 if failed. */
/* Rollback quota transaction changes. */
/* Allocate from quota if there's space. error_r is set when result is not
* QUOTA_ALLOC_RESULT_OK. */
/* Like quota_try_alloc(), but don't actually allocate anything. */
/* Update quota by allocating/freeing space used by mail. */
/* Mark the quota to be recalculated */
enum quota_recalculate recalculate);
/* Execute quota_over_scripts if needed. */
/* Common quota parameters parsing loop */
#endif