File: sieve-script-private.h

package info (click to toggle)
dovecot 1%3A2.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 (103 lines) | stat: -rw-r--r-- 2,334 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
 */

#ifndef __SIEVE_SCRIPT_PRIVATE_H
#define __SIEVE_SCRIPT_PRIVATE_H

#include "sieve-script.h"

/*
 * Script object
 */

struct sieve_script_vfuncs {
	struct sieve_script *(*alloc)(void);
	void (*destroy)(struct sieve_script *script);

	int (*open)
		(struct sieve_script *script, const char *data,
			const char *const *options, enum sieve_error *error_r);

	int (*get_stream)
		(struct sieve_script *script, struct istream **stream_r,
			enum sieve_error *error_r);
	
	int (*binary_read_metadata)
		(struct sieve_script *_script, struct sieve_binary_block *sblock,
			sieve_size_t *offset);
	void (*binary_write_metadata)
		(struct sieve_script *script, struct sieve_binary_block *sblock);
	struct sieve_binary *(*binary_load)
		(struct sieve_script *script, enum sieve_error *error_r);
	int (*binary_save)
		(struct sieve_script *script, struct sieve_binary *sbin,
			bool update, enum sieve_error *error_r);

	int (*get_size)
		(const struct sieve_script *script, uoff_t *size_r);

	bool (*equals)
		(const struct sieve_script *script, const struct sieve_script *other);
};

struct sieve_script {
	pool_t pool;
	unsigned int refcount;

	const char *driver_name;
	const struct sieve_script *script_class;
	struct sieve_script_vfuncs v;

	struct sieve_instance *svinst;
	struct sieve_error_handler *ehandler;

	const char *name;
	const char *data;
	const char *location;
	const char *bin_dir;

	/* Stream */
	struct istream *stream;

	unsigned int open:1;
};

void sieve_script_init
	(struct sieve_script *script, struct sieve_instance *svinst,
		const struct sieve_script *script_class, const char *data,
		const char *name, struct sieve_error_handler *ehandler);

int sieve_script_setup_bindir
	(struct sieve_script *script, mode_t mode);

/*
 * Built-in file script driver
 */

#define SIEVE_FILE_SCRIPT_DRIVER_NAME "file"

struct sieve_file_script {
	struct sieve_script script;

	struct stat st;
	struct stat lnk_st;

	const char *path;
	const char *dirpath;
	const char *filename;
	const char *binpath;

	int fd;
};

extern const struct sieve_script sieve_file_script;

/*
 * Built-in dict script driver
 */

#define SIEVE_DICT_SCRIPT_DRIVER_NAME "dict"

extern const struct sieve_script sieve_dict_script;

#endif /* __SIEVE_SCRIPT_PRIVATE_H */