Skip to content
Snippets Groups Projects
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);

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.