ze-filter  (ze-filter-0.8.0-develop-180218)
ze-msg-score.h
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : Tue Nov 28 21:56:02 CET 2006
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 
25 #ifndef __ZE_MSG_SCORE_H
26 
33 #define BSCORE_LO 0.25
34 #define BSCORE_MI 0.50
35 #define BSCORE_HI 0.65
36 
37 
38 
39 #define MSG_ACTION_UNDEF -1
40 #define MSG_ACTION_OK 0
41 
42 #define MSG_ACTION_REJECT 1
43 #define MSG_ACTION_DISCARD 2
44 
45 #define MSG_ACTION_QUARANTINE 3
46 
47 #define MSG_ACTION_HEADER_HAM 4
48 #define MSG_ACTION_HEADER_SPAM_LO 5
49 #define MSG_ACTION_HEADER_SPAM_HI 6
50 #define MSG_ACTION_HEADER_NEUTRAL 7
51 
52 #define MSG_EVAL_FUNCTION 11
53 
54 typedef struct scores_scale_T
55 {
56  double kf1;
57  double kf0;
58  double bayes;
59  double oracle;
60  double urlbl;
61  double regex;
63 
64 typedef struct test_score_T
65 {
66  bool actif;
67  double value;
68  double odds;
69 } test_score_T;
70 
71 typedef struct msg_scores_T
72 {
73  double combined;
74  bool spam;
75 
76  bool do_regex;
77  int body;
78  int headers;
79 
80  bool do_urlbl;
81  int urlbl;
82 
83  bool do_oracle;
84  int oracle;
85  double noracle;
86 
87  bool do_bayes;
88  double bayes;
89 #if 0
90  bool do_logreg;
91  double logreg;
92 #endif
94 
95  /* NEW */
102 
104 } msg_scores_T;
105 
106 /*
107  *
108  */
109 bool configure_msg_eval_function(char *val);
110 bool configure_msg_score_scales(char *val);
111 
112 bool display_msg_eval();
113 double compute_msg_score(msg_scores_T * scores);
114 
115 bool create_msg_score_header(char *buf,
116  size_t size,
117  char *id,
118  char *hostname,
119  msg_scores_T * scores);
120 
121 #if 1
122 #define DEFAULT_MSG_EVAL "VECTOR; KBAYES=1.0; KURLBL=0.040; KREGEX=0.020; KORACLE=0.083"
123 #else
124 #define DEFAULT_MSG_EVAL "LOGIT; KBAYES=1.0; KURLBL=0.040; KREGEX=0.020; KORACLE=0.083"
125 #endif
126 #define DEFAULT_MSG_SCALE "SSCORE1=7.; SSCORE0=0.; SBAYES=1.0; SURLBL=0.2; SREGEX=0.2; SORACLE=1."
127 
128 bool fill_msg_scale(scores_scale_T * scale);
129 
130 /*
131  *
132  */
133 bool register_msg_action(int which, char *val);
134 bool evaluate_msg_action(int action,
135  msg_scores_T * scp,
136  double score, char *str);
137 
140 # define __ZE_MSG_SCORE_H 1
141 #endif /* __ZE_MSG_SCORE_H */
double combined
Definition: ze-msg-score.h:73
bool register_msg_action(int which, char *val)
Definition: ze-msg-score.c:968
test_score_T Bayes
Definition: ze-msg-score.h:96
bool configure_msg_eval_function(char *val)
Definition: ze-msg-score.c:450
bool display_msg_eval()
Definition: ze-msg-score.c:555
test_score_T Oracle
Definition: ze-msg-score.h:99
struct scores_scale_T scores_scale_T
bool evaluate_msg_action(int action, msg_scores_T *scp, double score, char *str)
bool fill_msg_scale(scores_scale_T *scale)
Definition: ze-msg-score.c:810
scores_scale_T scale
Definition: ze-msg-score.h:93
test_score_T Body
Definition: ze-msg-score.h:101
bool create_msg_score_header(char *buf, size_t size, char *id, char *hostname, msg_scores_T *scores)
Definition: ze-msg-score.c:737
bool configure_msg_score_scales(char *val)
Definition: ze-msg-score.c:511
test_score_T LogReg
Definition: ze-msg-score.h:97
struct msg_scores_T msg_scores_T
double value
Definition: ze-msg-score.h:67
test_score_T Global
Definition: ze-msg-score.h:103
double bayes
Definition: ze-msg-score.h:88
double noracle
Definition: ze-msg-score.h:85
test_score_T Urlbl
Definition: ze-msg-score.h:98
double compute_msg_score(msg_scores_T *scores)
Definition: ze-msg-score.c:634
test_score_T Headers
Definition: ze-msg-score.h:100
struct test_score_T test_score_T