Commit 992a0312 992a0312a4eb7acb44b5063f8a93c2636c7c9859 by Sergey Poznyakoff

Added libsieve.h

1 parent abd9717e
...@@ -17,6 +17,7 @@ pkginclude_HEADERS = \ ...@@ -17,6 +17,7 @@ pkginclude_HEADERS = \
17 folder.h \ 17 folder.h \
18 header.h \ 18 header.h \
19 iterator.h \ 19 iterator.h \
20 libsieve.h \
20 list.h \ 21 list.h \
21 locker.h \ 22 locker.h \
22 mailbox.h \ 23 mailbox.h \
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #include <sys/types.h>
19 #include <mailutils/mailutils.h>
20
21 typedef struct sieve_machine sieve_machine_t;
22
23 typedef int (*sieve_instr_t) __P((sieve_machine_t *mach, list_t *args));
24
25 typedef enum {
26 SVT_VOID,
27 SVT_NUMBER,
28 SVT_STRING,
29 SVT_STRING_LIST,
30 SVT_TAG,
31 SVT_IDENT,
32 SVT_VALUE_LIST
33 } sieve_data_type;
34
35 typedef struct {
36 sieve_data_type type;
37 union {
38 char *string;
39 long number;
40 list_t list;
41 } v;
42 } sieve_value_t;
43
44 typedef struct {
45 char *name;
46 int num;
47 sieve_data_type argtype;
48 } sieve_tag_def_t;
49
50 typedef struct {
51 char *name;
52 int required;
53 sieve_instr_t instr;
54 int num_req_args;
55 sieve_data_type *req_args;
56 int num_tags;
57 sieve_tag_def_t *tags;
58 } sieve_register_t;
59
60
61 void *sieve_alloc __P((size_t size));
62 int sieve_open_source __P((const char *name));
63 int sieve_parse __P((const char *name));
64 sieve_value_t * sieve_value_create __P((sieve_data_type type, void *data));
65
66 sieve_register_t *sieve_test_lookup __P((const char *name));
67 sieve_register_t *sieve_action_lookup __P((const char *name));
68 int sieve_register_test __P((const char *name, sieve_instr_t instr,
69 sieve_data_type *arg_types,
70 sieve_tag_def_t *tags, int required));
71 int sieve_register_action __P((const char *name, sieve_instr_t instr,
72 sieve_data_type *arg_types,
73 sieve_tag_def_t *tags, int required));
74
75 void sieve_slist_destroy __P((list_t *plist));
76 void sieve_require __P((list_t slist));