diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /pigeonhole/src/lib-sieve/sieve-objects.h | |
parent | Initial commit. (diff) | |
download | dovecot-upstream.tar.xz dovecot-upstream.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/src/lib-sieve/sieve-objects.h')
-rw-r--r-- | pigeonhole/src/lib-sieve/sieve-objects.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pigeonhole/src/lib-sieve/sieve-objects.h b/pigeonhole/src/lib-sieve/sieve-objects.h new file mode 100644 index 0000000..e3f300f --- /dev/null +++ b/pigeonhole/src/lib-sieve/sieve-objects.h @@ -0,0 +1,67 @@ +#ifndef SIEVE_OBJECTS_H +#define SIEVE_OBJECTS_H + +/* + * Object definition + */ + +struct sieve_object_def { + const char *identifier; + const struct sieve_operand_def *operand; + unsigned int code; +}; + +#define SIEVE_OBJECT(_identifier, _operand, _code) \ + .obj_def = { \ + .identifier = (_identifier), \ + .operand = (_operand), \ + .code = (_code) \ + } + +/* + * Object instance + */ + +struct sieve_object { + const struct sieve_object_def *def; + const struct sieve_extension *ext; +}; + +#define SIEVE_OBJECT_DEFAULT(_obj) \ + { &((_obj).obj_def), NULL } + +#define SIEVE_OBJECT_EXTENSION(_obj) \ + (_obj->object.ext) + +#define SIEVE_OBJECT_SET_DEF(_obj, def_value) \ + STMT_START { \ + (_obj)->def = def_value; \ + (_obj)->object.def = &(_obj)->def->obj_def; \ + } STMT_END + + +/* + * Object coding + */ + +void sieve_opr_object_emit + (struct sieve_binary_block *sblock, const struct sieve_extension *ext, + const struct sieve_object_def *obj_def); + +bool sieve_opr_object_read_data + (struct sieve_binary_block *sblock, const struct sieve_operand *operand, + const struct sieve_operand_class *opclass, sieve_size_t *address, + struct sieve_object *obj); + +bool sieve_opr_object_read + (const struct sieve_runtime_env *renv, + const struct sieve_operand_class *opclass, sieve_size_t *address, + struct sieve_object *obj); + +bool sieve_opr_object_dump + (const struct sieve_dumptime_env *denv, + const struct sieve_operand_class *opclass, sieve_size_t *address, + struct sieve_object *obj); + + +#endif |