~ubuntu-branches/ubuntu/quantal/dovecot/quantal

« back to all changes in this revision

Viewing changes to sieve/src/lib-sieve/sieve-match-types.h

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-29 09:21:32 UTC
  • mfrom: (4.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100629092132-q4pr5lfuvmjqou19
Tags: 1:1.2.12-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  + Add mail-stack-delivery as per server-maverick-mail-integration spec:
   - Update debian/rules
   - Convert existing package to a dummy package and add new binary in debian/control
   - Update maintainer scripts.
   - Move previously installed backups and config files to new package name
     space in preinst
   - Add new debian/mail-stack-delivery.prerm to handle downgrades
   - Rename debian/dovecot-postfix.* to debian/mail-stack-delivery.*
  + Use Snakeoil SSL certificates by default.
    - debian/control: Depend on ssl-cert.
    - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert paths to snakeoil.
    - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - Created debian/dovecot-common.ufw.profile.
    - debian/rules: install profile.
    - debian/control: suggest ufw.
  + debian/{control,rules}: enable PIE hardening.
  + debian/control: Update Vcs-* headers.
  + Add SMTP-AUTH support for Outlook (login auth mechanism) 
  + debian/dovecot-common.dirs: Added usr/share/doc/dovecot-common
  + debian/patches/fix-dovecot-config-parser.patch: Fix ordering of external config 
    files. (LP: #597818)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file
2
2
 */
3
 
 
 
3
 
4
4
#ifndef __SIEVE_MATCH_TYPES_H
5
5
#define __SIEVE_MATCH_TYPES_H
6
6
 
17
17
struct sieve_match_type_context;
18
18
 
19
19
/*
20
 
 * Core match types 
 
20
 * Core match types
21
21
 */
22
 
 
 
22
 
23
23
enum sieve_match_type_code {
24
24
        SIEVE_MATCH_TYPE_IS,
25
25
        SIEVE_MATCH_TYPE_CONTAINS,
34
34
/*
35
35
 * Match type definition
36
36
 */
37
 
 
 
37
 
38
38
struct sieve_match_type_def {
39
39
        struct sieve_object_def obj_def;
40
40
 
42
42
         * for every tested value? (TRUE = first alternative)
43
43
         */
44
44
        bool is_iterative;
45
 
        
 
45
 
46
46
        /* Is the key value allowed to contain formatting to extract multiple keys
47
47
         * out of the same string?
48
48
         */
49
49
        bool allow_key_extract;
50
 
                
 
50
 
51
51
        bool (*validate)
52
 
                (struct sieve_validator *valdtr, struct sieve_ast_argument **arg, 
 
52
                (struct sieve_validator *valdtr, struct sieve_ast_argument **arg,
53
53
                        struct sieve_match_type_context *ctx);
54
54
        bool (*validate_context)
55
 
                (struct sieve_validator *valdtr, struct sieve_ast_argument *arg, 
 
55
                (struct sieve_validator *valdtr, struct sieve_ast_argument *arg,
56
56
                        struct sieve_match_type_context *ctx, struct sieve_ast_argument *key_arg);
57
 
                        
 
57
 
58
58
        /*
59
59
         * Matching
60
60
         */
61
61
 
62
62
        void (*match_init)(struct sieve_match_context *mctx);
63
63
 
64
 
        /* WARNING: some tests may pass a val == NULL parameter indicating that the 
65
 
         * passed value has no significance. For string-type matches this should map 
66
 
         * to the empty string "", but for match types that consider the passed values 
67
 
         * as objects rather than strings (e.g. :count) this means that the passed 
68
 
         * value should be skipped. 
 
64
        /* WARNING: some tests may pass a val == NULL parameter indicating that the
 
65
         * passed value has no significance. For string-type matches this should map
 
66
         * to the empty string "", but for match types that consider the passed values
 
67
         * as objects rather than strings (e.g. :count) this means that the passed
 
68
         * value should be skipped.
69
69
         */
70
70
        int (*match)
71
 
                (struct sieve_match_context *mctx, const char *val, size_t val_size, 
 
71
                (struct sieve_match_context *mctx, const char *val, size_t val_size,
72
72
                        const char *key, size_t key_size, int key_index);
73
73
        int (*match_deinit)(struct sieve_match_context *mctx);
74
74
};
75
75
 
76
 
/* 
 
76
/*
77
77
 * Match type instance
78
78
 */
79
79
 
80
80
struct sieve_match_type {
81
81
        struct sieve_object object;
82
82
 
83
 
        const struct sieve_match_type_def *def; 
 
83
        const struct sieve_match_type_def *def;
84
84
};
85
85
 
86
86
#define SIEVE_MATCH_TYPE_DEFAULT(definition) \
108
108
        struct sieve_ast_argument *argument;
109
109
 
110
110
        const struct sieve_match_type *match_type;
111
 
        
 
111
 
112
112
        /* Only filled in when match_type->validate_context() is called */
113
113
        const struct sieve_comparator *comparator;
114
 
        
 
114
 
115
115
        /* Context data could be used in the future to pass data between validator and
116
 
         * generator in match types that use extra parameters. Currently not 
 
116
         * generator in match types that use extra parameters. Currently not
117
117
         * necessary, not even for the relational extension.
118
118
         */
119
119
        void *ctx_data;
127
127
        (struct sieve_validator *valdtr, const struct sieve_extension *ext,
128
128
                const struct sieve_match_type_def *mcht);
129
129
 
130
 
/* 
131
 
 * Match values 
 
130
/*
 
131
 * Match values
132
132
 */
133
133
 
134
134
struct sieve_match_values;
136
136
bool sieve_match_values_set_enabled
137
137
        (struct sieve_interpreter *interp, bool enable);
138
138
bool sieve_match_values_are_enabled
139
 
        (struct sieve_interpreter *interp);     
140
 
        
 
139
        (struct sieve_interpreter *interp);
 
140
 
141
141
struct sieve_match_values *sieve_match_values_start
142
142
        (struct sieve_interpreter *interp);
143
143
void sieve_match_values_set
145
145
void sieve_match_values_add
146
146
        (struct sieve_match_values *mvalues, string_t *value);
147
147
void sieve_match_values_add_char
148
 
        (struct sieve_match_values *mvalues, char c);   
 
148
        (struct sieve_match_values *mvalues, char c);
149
149
void sieve_match_values_skip
150
150
        (struct sieve_match_values *mvalues, int num);
151
 
        
 
151
 
152
152
void sieve_match_values_commit
153
153
        (struct sieve_interpreter *interp, struct sieve_match_values **mvalues);
154
154
void sieve_match_values_abort
155
155
        (struct sieve_match_values **mvalues);
156
 
        
 
156
 
157
157
void sieve_match_values_get
158
158
        (struct sieve_interpreter *interp, unsigned int index, string_t **value_r);
159
159
 
160
160
/*
161
 
 * Match type tagged argument 
 
161
 * Match type tagged argument
162
162
 */
163
163
 
164
164
extern const struct sieve_argument_def match_type_tag;
170
170
}
171
171
 
172
172
void sieve_match_types_link_tags
173
 
        (struct sieve_validator *valdtr, 
 
173
        (struct sieve_validator *valdtr,
174
174
                struct sieve_command_registration *cmd_reg, int id_code);
175
175
 
176
176
/*
179
179
 
180
180
bool sieve_match_type_validate
181
181
        (struct sieve_validator *valdtr, struct sieve_command *cmd,
182
 
                struct sieve_ast_argument *key_arg, 
183
 
                const struct sieve_match_type *mcht_default, 
 
182
                struct sieve_ast_argument *key_arg,
 
183
                const struct sieve_match_type *mcht_default,
184
184
                const struct sieve_comparator *cmp_default);
185
185
 
186
186
/*
187
187
 * Match type operand
188
188
 */
189
 
 
 
189
 
190
190
extern const struct sieve_operand_def match_type_operand;
191
191
extern const struct sieve_operand_class sieve_match_type_operand_class;
192
192
 
202
202
 
203
203
static inline void sieve_opr_match_type_emit
204
204
(struct sieve_binary *sbin, const struct sieve_match_type *mcht)
205
 
 
205
{
206
206
        sieve_opr_object_emit(sbin, mcht->object.ext, mcht->object.def);
207
207
}
208
208
 
229
229
 
230
230
bool sieve_match_substring_validate_context
231
231
        (struct sieve_validator *valdtr, struct sieve_ast_argument *arg,
232
 
                struct sieve_match_type_context *ctx, 
 
232
                struct sieve_match_type_context *ctx,
233
233
                struct sieve_ast_argument *key_arg);
234
234
 
235
235
#endif /* __SIEVE_MATCH_TYPES_H */