-
Stephan Bosch authoredStephan Bosch authored
sieve-binary.h 4.97 KiB
#ifndef __SIEVE_BINARY_H
#define __SIEVE_BINARY_H
#include "lib.h"
#include "str.h"
#include "sieve-common.h"
struct sieve_binary;
struct sieve_binary *sieve_binary_create_new(struct sieve_script *script);
void sieve_binary_ref(struct sieve_binary *sbin);
void sieve_binary_unref(struct sieve_binary **sbin);
inline pool_t sieve_binary_pool(struct sieve_binary *sbin);
inline struct sieve_script *sieve_binary_script(struct sieve_binary *sbin);
void sieve_binary_activate(struct sieve_binary *sbin);
bool sieve_binary_save
(struct sieve_binary *sbin, const char *path);
struct sieve_binary *sieve_binary_open
(const char *path, struct sieve_script *script);
bool sieve_binary_up_to_date(struct sieve_binary *sbin);
bool sieve_binary_load(struct sieve_binary *sbin);
/*
* Block management
*/
enum sieve_binary_system_block {
SBIN_SYSBLOCK_EXTENSIONS,
SBIN_SYSBLOCK_MAIN_PROGRAM,
SBIN_SYSBLOCK_LAST
};
bool sieve_binary_block_set_active
(struct sieve_binary *sbin, unsigned int id, unsigned *old_id_r);
unsigned int sieve_binary_block_create(struct sieve_binary *sbin);
inline void sieve_binary_block_clear
(struct sieve_binary *sbin, unsigned int id);
/*
* Extension support
*/
struct sieve_binary_extension {
const struct sieve_extension *extension;
bool (*binary_save)(struct sieve_binary *sbin);
void (*binary_free)(struct sieve_binary *sbin);
bool (*binary_is_up_to_date)(struct sieve_binary *sbin);
};
inline void sieve_binary_extension_set_context
(struct sieve_binary *sbin, int ext_id, void *context);
inline const void *sieve_binary_extension_get_context
(struct sieve_binary *sbin, int ext_id);
inline void sieve_binary_extension_set
(struct sieve_binary *sbin, int ext_id,
const struct sieve_binary_extension *bext);
unsigned int sieve_binary_extension_create_block
(struct sieve_binary *sbin, int ext_id);
int sieve_binary_extension_link
(struct sieve_binary *sbin, int ext_id);