File: testsuite-objects.h

package info (click to toggle)
dovecot 1:2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (86 lines) | stat: -rw-r--r-- 2,032 bytes parent folder | download | duplicates (3)
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
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
 */

#ifndef __TESTSUITE_OBJECTS_H
#define __TESTSUITE_OBJECTS_H

#include "sieve-common.h"
#include "sieve-objects.h"

#include "testsuite-common.h"

/*
 * Testsuite object operand
 */

struct testsuite_object_operand_interface {
	struct sieve_extension_objects testsuite_objects;
};

extern const struct sieve_operand_class testsuite_object_oprclass;

/*
 * Testsuite object access
 */

struct testsuite_object_def {
	struct sieve_object_def obj_def;

	int (*get_member_id)(const char *identifier);
	const char *(*get_member_name)(int id);

	bool (*set_member)
		(const struct sieve_runtime_env *renv, int id, string_t *value);
	string_t *(*get_member)
		(const struct sieve_runtime_env *renv, int id);
};

struct testsuite_object {
	struct sieve_object object;

	const struct testsuite_object_def *def;
};

/*
 * Testsuite object registration
 */

void testsuite_register_core_objects
	(struct testsuite_validator_context *ctx);
void testsuite_object_register
	(struct sieve_validator *valdtr, const struct sieve_extension *ext,
		const struct testsuite_object_def *tobj_def);

/*
 * Testsuite object argument
 */

bool testsuite_object_argument_activate
	(struct sieve_validator *valdtr, struct sieve_ast_argument *arg,
		struct sieve_command *cmd);

/*
 * Testsuite object code
 */

bool testsuite_object_read
  (struct sieve_binary_block *sblock, sieve_size_t *address,
		struct testsuite_object *tobj);
bool testsuite_object_read_member
  (struct sieve_binary_block *sblock, sieve_size_t *address,
		struct testsuite_object *tobj, int *member_id_r);

bool testsuite_object_dump
	(const struct sieve_dumptime_env *denv, sieve_size_t *address);

const char *testsuite_object_member_name
	(const struct testsuite_object *object, int member_id);

/*
 * Testsuite core objects
 */

extern const struct testsuite_object_def message_testsuite_object;
extern const struct testsuite_object_def envelope_testsuite_object;

#endif /* __TESTSUITE_OBJECTS_H */