1 /* script.h -- script definition 2 * Larry Greenfield 3 * 4 * Copyright (c) 1994-2008 Carnegie Mellon University. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 18 * 3. The name "Carnegie Mellon University" must not be used to 19 * endorse or promote products derived from this software without 20 * prior written permission. For permission or any legal 21 * details, please contact 22 * Carnegie Mellon University 23 * Center for Technology Transfer and Enterprise Creation 24 * 4615 Forbes Avenue 25 * Suite 302 26 * Pittsburgh, PA 15213 27 * (412) 268-7393, fax: (412) 268-7395 28 * innovation@andrew.cmu.edu 29 * 30 * 4. Redistributions of any form whatsoever must retain the following 31 * acknowledgment: 32 * "This product includes software developed by Computing Services 33 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 34 * 35 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 36 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 37 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 38 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 39 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 40 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 41 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 42 */ 43 44 #ifndef SIEVE_SCRIPT_H 45 #define SIEVE_SCRIPT_H 46 47 #include <sys/types.h> 48 49 #include "sieve_interface.h" 50 #include "interp.h" 51 #include "tree.h" 52 53 struct sieve_script { 54 sieve_interp_t interp; 55 56 /* was a "require" done for these? */ 57 struct sieve_support { 58 int fileinto : 1; 59 int reject : 1; 60 int envelope : 1; 61 int body : 1; 62 int vacation : 1; 63 int imapflags : 1; 64 int notify : 1; 65 int regex : 1; 66 int subaddress : 1; 67 int relational : 1; 68 int i_ascii_numeric: 1; 69 int include : 1; 70 int copy : 1; 71 int date : 1; 72 int index : 1; 73 int vacation_seconds: 1; 74 int imap4flags : 1; 75 int mailbox : 1; 76 int mboxmetadata : 1; 77 int servermetadata : 1; 78 int variables : 1; 79 } support; 80 81 void *script_context; 82 commandlist_t *cmds; 83 84 int err; 85 char addrerr[500]; /* buffer for address parser error messages */ 86 char sieveerr[1024]; 87 }; 88 89 typedef struct sieve_bytecode sieve_bytecode_t; 90 91 struct sieve_bytecode { 92 ino_t inode; /* used to prevent mmapping the same script */ 93 const char *data; 94 size_t len; 95 int fd; 96 97 int is_executing; /* used to prevent recursive INCLUDEs */ 98 99 sieve_bytecode_t *next; 100 }; 101 102 struct sieve_execute { 103 sieve_bytecode_t *bc_list; /* list of loaded bytecode buffers */ 104 sieve_bytecode_t *bc_cur; /* currently active bytecode buffer */ 105 }; 106 107 int script_require(sieve_script_t *s, char *req); 108 109 #endif 110