All Classes Files Functions Variables Enumerations Enumerator Groups Pages
FiltersCommon.idl
Go to the documentation of this file.
1 /**
2  * @file FiltersCommon.idl
3  * @brief Rules for Filtering Messages
4  *
5  * @author Frantisek Boranek
6  *
7  * @copyright Copyright © 2017 Kerio Technologies s.r.o.
8  */
9 
10 #import <kerio/web/idl/SharedStructures.idl>
11 
12 module kerio {
13 module jsonapi {
14 module filters{
15 
16 /**
17  * List of all possible targets whose state can be
18  * tested as filter's initial condition.
19  */
20 enum FilterConditionType {
21  CtEnvelopeRecipient, ///< Recipient from SMTP envelope 'RCPT TO:'
22  CtEnvelopeSender, ///< Sender from SMTP envelope 'MAIL FROM:'
23  CtRecipient, ///< content of message headers 'To' and 'Cc'
24  CtSender, ///< content of message header 'Sender'
25  CtFrom, ///< content of message header 'From'
26  CtCc, ///< content of message header 'Cc'
27  CtTo, ///< content of message header 'To'
28  CtSubject, ///< messages with certain subject
29  CtAttachment, ///< messages that have attachment
30  CtSize, ///< messages with certain size (in Bytes)
31  CtSpam, ///< messages marked as spam
32  CtAll ///< all messages
33 };
34 
35 /**
36  * List of all possible comparators of targets (see ConditionTargetType)
37  * which can be used to test filter's initial conditions.
38  */
39 enum FilterComparatorType {
40  CcEqual, ///< tests whether target (ex. sender) is EQUAL to some string
41  CcContain, ///< tests whether target (ex. sender) CONTAINS to some string
42  CcNotContain, ///< tests whether target (ex. sender) NOT CONTAINS to some string
43  CcNotEqual, ///< tests whether target (ex. sender) IS NOT to some string
44  CcUnder, ///< tests whether size of mail is UNDER some number of Bytes
45  CcOver, ///< tests whether size of mail is OVER some number of Bytes
46  CcNoComparator ///< marks conditions that do not need any comparator (ex. has attachment, for all messages and is spam)
47 };
48 
49 /**
50  * Defines initial condition of filter rule. Filter's initial
51  * conditions are tested whenever we need find out whether
52  * filter should be applied or not.
53  */
55  FilterConditionType testedTarget; ///< some aspect of message that will be tested using selected comparator and against parameters
56  FilterComparatorType comparator; ///< type of target comparator (has to be set correctly, even for CtAttachment and CtAll - CcNoComparator)
57  kerio::web::StringList parameters; ///< zero, one or more values that will be used to compare to target using selected comparator
58 };
59 
60 /**
61  * All possible types of filter's actions. Type of action effects number of parameters
62  * that this action requires. Every action has sequence of parameters. Types defined
63  * by FilterActionType enumeration hold information about required parameters as comment.
64  *
65  * @Warning: According to the selected type of action, you have to provide (set) all parameters
66  * to filter action that this type of action requires.
67  */
68 enum FilterActionType {
69  FaAddHeader, ///< two mandatory parameters: 1. header name, 2. header value (Headers 'Content-*' are forbidden)
70  FaSetHeader, ///< two mandatory parameters: 1. header name, 2. header value (Headers 'Content-*' are forbidden)
71  FaRemoveHeader, ///< one mandatory parameter: 1. header name (Headers 'Content-*' and 'Receive' are forbidden)
72  FaAddRecipient, ///< one mandatory parameter: 1. address
73  FaCopyToAddress, ///< one mandatory parameter: 1. address
74  FaReject, ///< one mandatory parameter: 1. reason (for mail rejection)
75  FaFileInto, ///< one mandatory parameter: 1. path to directory where to store mail
76  FaRedirect, ///< one mandatory parameter: 1. address where to redirect mail
77  FaDiscard, ///< no parameters required
78  FaKeep, ///< no parameters required
79  FaNotify, ///< three mandatory parameters: 1. address; 2. subject; 3. text of notification
80  FaSetReadFlag, ///< no parameters required
81  FaAutoReply, ///< one mandatory parameter: 1. text of message
82  FaStop ///< no parameters required
83 };
84 
85 /**
86  * Defines action of filter rule. Filter's action are
87  * performed when all filter's initial conditions are
88  * meet.
89  */
90 struct FilterAction {
91  FilterActionType type;
92  kerio::web::StringList parameters; ///< list of parameters (see FilterActionType for more info)
93 };
94 
95 /**
96  * Types of filter's conditions evaluation.
97  */
98 enum EvaluationModeType {
99  EmAnyOf,
100  EmAllOf
101 };
102 
103 typedef sequence<FilterAction> FilterActionList;
104 typedef sequence<FilterCondition> FilterConditionList;
105 
106 
107 };
108 };
109 }; // end of namespace