#ifndef STATS_H
#define STATS_H
struct stats;
struct stats_item;
struct stats_vfuncs {
const char *short_name;
unsigned int (*field_count)(void);
const char *(*field_name)(unsigned int n);
unsigned int n);
};
/* Allocate struct stats from a given pool. */
/* Returns the number of bytes allocated to stats. */
size_t stats_alloc_size(void);
/* Copy all stats from src to dest. */
/* Returns the number of stats fields. */
unsigned int stats_field_count(void);
/* Returns the name of a stats field (exported to doveadm). */
const char *stats_field_name(unsigned int n);
/* Returns the value of a stats field as a string (exported to doveadm). */
unsigned int n);
/* Return diff_stats_r->field = stats2->field - stats1->field.
diff1 is supposed to have smaller values than diff2. Returns TRUE if this
is so, FALSE if not */
/* dest->field += src->field */
/* Returns TRUE if any fields have changed in cur since prev in a way that
a plugin should send the updated statistics to the stats process. Not all
fields necessarily require sending an update. */
/* Export stats into a buffer in binary format. */
/* Import stats from a buffer. The buffer doesn't need to contain an update to
all the stats items - old_stats are used for that item in such case.
Currently it's not allowed to have unknown items in the buffer. */
const char **error_r);
/* Return a pointer to stats where the specified item starts. The returned
pointer can be used to fill up the item-specific stats (up to its
alloc_size() number of bytes). */
#endif