/usr/include/dovecot/sieve/sieve-ext-variables.h is in dovecot-dev 1:2.2.9-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
*/
/*
* Public interface for other extensions to use
*/
#ifndef __SIEVE_EXT_VARIABLES_H
#define __SIEVE_EXT_VARIABLES_H
#include "lib.h"
#include "sieve-common.h"
#include "sieve-extensions.h"
#include "sieve-objects.h"
#include "sieve-code.h"
/*
* Limits
*/
unsigned int sieve_variables_get_max_scope_size(void);
/*
* Variable extension
*/
/* FIXME: this is not suitable for future plugin support */
extern const struct sieve_extension_def variables_extension;
static inline const struct sieve_extension *sieve_ext_variables_get_extension
(struct sieve_instance *svinst)
{
return sieve_extension_register(svinst, &variables_extension, FALSE);
}
/*
* Variable name
*/
struct sieve_variable_name {
string_t *identifier;
int num_variable;
};
ARRAY_DEFINE_TYPE(sieve_variable_name, struct sieve_variable_name);
bool sieve_variable_identifier_is_valid(const char *identifier);
/*
* Variable scope
*/
struct sieve_variable {
const char *identifier;
unsigned int index;
const struct sieve_extension *ext;
void *context;
};
struct sieve_variable_scope;
struct sieve_variable_scope *sieve_variable_scope_create
(struct sieve_instance *svinst, const struct sieve_extension *ext);
void sieve_variable_scope_ref
(struct sieve_variable_scope *scope);
void sieve_variable_scope_unref
(struct sieve_variable_scope **scope);
pool_t sieve_variable_scope_pool
(struct sieve_variable_scope *scope);
struct sieve_variable *sieve_variable_scope_declare
(struct sieve_variable_scope *scope, const char *identifier);
struct sieve_variable *sieve_variable_scope_import
(struct sieve_variable_scope *scope, struct sieve_variable *var);
struct sieve_variable *sieve_variable_scope_get_variable
(struct sieve_variable_scope *scope, const char *identifier, bool create);
struct sieve_variable *sieve_variable_scope_get_indexed
(struct sieve_variable_scope *scope, unsigned int index);
/* Binary */
struct sieve_variable_scope_binary *sieve_variable_scope_binary_create
(struct sieve_variable_scope *scope);
void sieve_variable_scope_binary_ref
(struct sieve_variable_scope_binary *scpbin);
void sieve_variable_scope_binary_unref
(struct sieve_variable_scope_binary **scpbin);
struct sieve_variable_scope *sieve_variable_scope_binary_dump
(struct sieve_instance *svinst, const struct sieve_extension *ext,
const struct sieve_dumptime_env *denv, sieve_size_t *address);
struct sieve_variable_scope_binary *sieve_variable_scope_binary_read
(struct sieve_instance *svinst, const struct sieve_extension *ext,
struct sieve_binary_block *sblock, sieve_size_t *address);
struct sieve_variable_scope *sieve_variable_scope_binary_get
(struct sieve_variable_scope_binary *scpbin);
unsigned int sieve_variable_scope_binary_get_size
(struct sieve_variable_scope_binary *scpbin);
/*
* Variable namespaces
*/
struct sieve_variables_namespace;
struct sieve_variables_namespace_def {
struct sieve_object_def obj_def;
bool (*validate)
(struct sieve_validator *valdtr,
const struct sieve_variables_namespace *nspc,
struct sieve_ast_argument *arg, struct sieve_command *cmd,
ARRAY_TYPE(sieve_variable_name) *var_name, void **var_data,
bool assignment);
bool (*generate)
(const struct sieve_codegen_env *cgenv,
const struct sieve_variables_namespace *nspc,
struct sieve_ast_argument *arg, struct sieve_command *cmd,
void *var_data);
bool (*dump_variable)
(const struct sieve_dumptime_env *denv,
const struct sieve_variables_namespace *nspc,
const struct sieve_operand *oprnd, sieve_size_t *address);
int (*read_variable)
(const struct sieve_runtime_env *renv,
const struct sieve_variables_namespace *nspc,
const struct sieve_operand *oprnd, sieve_size_t *address, string_t **str);
};
#define SIEVE_VARIABLES_DEFINE_NAMESPACE(OP) SIEVE_EXT_DEFINE_OBJECT(OP)
#define SIEVE_VARIABLES_DEFINE_NAMESPACES(OPS) SIEVE_EXT_DEFINE_OBJECTS(OPS)
struct sieve_variables_namespace {
struct sieve_object object;
const struct sieve_variables_namespace_def *def;
};
void sieve_variables_namespace_register
(const struct sieve_extension *var_ext, struct sieve_validator *valdtr,
const struct sieve_extension *ext,
const struct sieve_variables_namespace_def *nspc_def);
extern const struct sieve_operand_class sieve_variables_namespace_operand_class;
void sieve_variables_opr_namespace_variable_emit
(struct sieve_binary_block *sblock, const struct sieve_extension *var_ext,
const struct sieve_extension *ext,
const struct sieve_variables_namespace_def *nspc_def);
/* Iteration over all declared variables */
struct sieve_variable_scope_iter;
struct sieve_variable_scope_iter *sieve_variable_scope_iterate_init
(struct sieve_variable_scope *scope);
bool sieve_variable_scope_iterate
(struct sieve_variable_scope_iter *iter, struct sieve_variable **var_r);
void sieve_variable_scope_iterate_deinit
(struct sieve_variable_scope_iter **iter);
/* Statistics */
unsigned int sieve_variable_scope_declarations
(struct sieve_variable_scope *scope);
unsigned int sieve_variable_scope_size
(struct sieve_variable_scope *scope);
/* Get all native variables */
struct sieve_variable * const *sieve_variable_scope_get_variables
(struct sieve_variable_scope *scope, unsigned int *size_r);
/*
* Variable storage
*/
struct sieve_variable_storage;
struct sieve_variable_storage *sieve_variable_storage_create
(pool_t pool, struct sieve_variable_scope_binary *scpbin);
bool sieve_variable_get
(struct sieve_variable_storage *storage, unsigned int index,
string_t **value);
bool sieve_variable_get_modifiable
(struct sieve_variable_storage *storage, unsigned int index,
string_t **value);
bool sieve_variable_assign
(struct sieve_variable_storage *storage, unsigned int index,
const string_t *value);
bool sieve_variable_get_identifier
(struct sieve_variable_storage *storage, unsigned int index,
const char **identifier);
const char *sieve_variable_get_varid
(struct sieve_variable_storage *storage, unsigned int index);
/*
* Variables access
*/
bool sieve_ext_variables_is_active
(const struct sieve_extension *var_ext, struct sieve_validator *valdtr);
struct sieve_variable_scope *sieve_ext_variables_get_local_scope
(const struct sieve_extension *var_ext, struct sieve_validator *valdtr);
/* Runtime */
static inline const char *sieve_ext_variables_get_varid
(const struct sieve_extension *ext, unsigned int index)
{
if ( ext == NULL )
return t_strdup_printf("%ld", (long) index);
return t_strdup_printf("%s:%ld", sieve_extension_name(ext), (long) index);
}
struct sieve_variable_storage *sieve_ext_variables_runtime_get_storage
(const struct sieve_extension *var_ext, const struct sieve_runtime_env *renv,
const struct sieve_extension *ext);
void sieve_ext_variables_runtime_set_storage
(const struct sieve_extension *var_ext, const struct sieve_runtime_env *renv,
const struct sieve_extension *ext, struct sieve_variable_storage *storage);
const char *sieve_ext_variables_runtime_get_identifier
(const struct sieve_extension *var_ext, const struct sieve_runtime_env *renv,
const struct sieve_extension *ext, unsigned int index);
/*
* Variable arguments
*/
bool sieve_variable_argument_activate
(const struct sieve_extension *this_ext, struct sieve_validator *valdtr,
struct sieve_command *cmd, struct sieve_ast_argument *arg, bool assignment);
/*
* Variable operands
*/
extern const struct sieve_operand_def variable_operand;
void sieve_variables_opr_variable_emit
(struct sieve_binary_block *sblock, const struct sieve_extension *var_ext,
struct sieve_variable *var);
void sieve_variables_opr_match_value_emit
(struct sieve_binary_block *sblock, const struct sieve_extension *var_ext,
unsigned int index);
int sieve_variable_operand_read_data
(const struct sieve_runtime_env *renv, struct sieve_operand *operand,
sieve_size_t *address, const char *field_name,
struct sieve_variable_storage **storage_r, unsigned int *var_index_r);
int sieve_variable_operand_read
(const struct sieve_runtime_env *renv, sieve_size_t *address,
const char *field_name, struct sieve_variable_storage **storage_r,
unsigned int *var_index_r);
static inline bool sieve_operand_is_variable
(const struct sieve_operand *operand)
{
return ( operand != NULL && operand->def != NULL &&
operand->def == &variable_operand );
}
/*
* Modifiers
*/
struct sieve_variables_modifier_def {
struct sieve_object_def obj_def;
unsigned int precedence;
bool (*modify)(string_t *in, string_t **result);
};
struct sieve_variables_modifier {
struct sieve_object object;
const struct sieve_variables_modifier_def *def;
};
extern const struct sieve_operand_class sieve_variables_modifier_operand_class;
#define SIEVE_VARIABLES_DEFINE_MODIFIER(OP) SIEVE_EXT_DEFINE_OBJECT(OP)
#define SIEVE_VARIABLES_DEFINE_MODIFIERS(OPS) SIEVE_EXT_DEFINE_OBJECTS(OPS)
#define sieve_variables_modifier_name(smodf) \
( (smodf)->object.def->identifier )
void sieve_variables_modifier_register
(const struct sieve_extension *var_ext, struct sieve_validator *valdtr,
const struct sieve_extension *ext,
const struct sieve_variables_modifier_def *smodf);
/*
* Code dumping
*/
void sieve_ext_variables_dump_set_scope
(const struct sieve_extension *var_ext, const struct sieve_dumptime_env *denv,
const struct sieve_extension *ext, struct sieve_variable_scope *scope);
#endif /* __SIEVE_EXT_VARIABLES_H */
|