1
/* Copyright (c) 2002-2009 Dovecot Sieve authors, see the included COPYING file
12
#include "sieve-config.h"
13
#include "sieve-types.h"
14
#include "sieve-error.h"
17
* Main Sieve library interface
21
* Initializes the sieve engine. Must be called before any sieve functionality
24
bool sieve_init(void);
27
* Frees all memory allocated by the sieve engine.
29
void sieve_deinit(void);
31
/* sieve_get_capabilities():
34
const char *sieve_get_capabilities(const char *name);
36
/* sieve_set_extensions():
39
void sieve_set_extensions(const char *extensions);
45
/* sieve_compile_script:
47
struct sieve_binary *sieve_compile_script
48
(struct sieve_script *script, struct sieve_error_handler *ehandler);
52
* Compiles the script into a binary.
54
struct sieve_binary *sieve_compile
55
(const char *script_path, const char *script_name,
56
struct sieve_error_handler *ehandler);
59
* Reading/writing Sieve binaries
64
* First tries to open the binary version of the specified script and
65
* if it does not exist or if it contains errors, the script is
66
* (re-)compiled. The binary is updated if the script is recompiled.
67
* Note that errors in the bytecode are not caught here.
70
struct sieve_binary *sieve_open
71
(const char *scriptpath, const char *script_name,
72
struct sieve_error_handler *ehandler, bool *exists_r);
76
* Saves the binary as the file indicated by the path parameter. If
77
* path is NULL, it chooses the default path relative to the original
81
(struct sieve_binary *sbin, const char *bin_path);
85
* Loads the sieve binary indicated by the provided path.
87
struct sieve_binary *sieve_load
88
(const char *bin_path);
92
* Closes a compiled/opened sieve binary.
94
void sieve_close(struct sieve_binary **sbin);
102
* Dumps the byte code in human-readable form to the specified ostream.
104
void sieve_dump(struct sieve_binary *sbin, struct ostream *stream);
108
* Executes the bytecode, but only prints the result to the given stream.
111
(struct sieve_binary *sbin, const struct sieve_message_data *msgdata,
112
const struct sieve_script_env *senv, struct sieve_error_handler *ehandler,
113
struct ostream *stream, bool *keep);
121
* Executes the binary, including the result.
124
(struct sieve_binary *sbin, const struct sieve_message_data *msgdata,
125
const struct sieve_script_env *senv, struct sieve_error_handler *ehandler,
129
* Multiscript support
132
struct sieve_multiscript;
134
struct sieve_multiscript *sieve_multiscript_start_execute
135
(const struct sieve_message_data *msgdata, const struct sieve_script_env *senv);
136
struct sieve_multiscript *sieve_multiscript_start_test
137
(const struct sieve_message_data *msgdata, const struct sieve_script_env *senv,
138
struct ostream *stream);
140
bool sieve_multiscript_run
141
(struct sieve_multiscript *mscript, struct sieve_binary *sbin,
142
struct sieve_error_handler *ehandler, bool final);
144
int sieve_multiscript_status(struct sieve_multiscript *mscript);
146
int sieve_multiscript_finish
147
(struct sieve_multiscript **mscript, struct sieve_error_handler *ehandler,
154
struct sieve_directory;
156
struct sieve_directory *sieve_directory_open(const char *path);
157
const char *sieve_directory_get_scriptfile(struct sieve_directory *sdir);
158
void sieve_directory_close(struct sieve_directory **sdir);