source: npl/mailserver/dspam/dspam-3.10.2/man/libdspam.3 @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 6.7 KB
Line 
1.\" $Id: libdspam.3,v 1.13 2011/06/28 00:13:48 sbajic Exp $
2.\"  -*- nroff -*-
3.\"
4.\" dspam3.9
5.\"
6.\" Authors:    Jonathan A. Zdziarski <jonathan@nuclearelephant.com>
7.\"             Stevan Bajic <stevan@bajic.ch>
8.\"
9.\" Copyright (C) 2002-2012 DSPAM Project
10.\" All rights reserved
11.\"
12.TH libdspam 3  "Apr 17, 2010" "libdspam" "libdspam"
13
14.SH NAME
15libdspam - Core message processing and classification library for DSPAM
16.PP
17\fBDSPAM\fP Core Analyis Engine Functions
18
19.SH SYNOPSIS
20.nf
21.B #include <libdspam.h>
22.sp
23.BI "DSPAM_CTX *dspam_init(const char *" username ", const char *" group ", "
24.BI "  const char *" home ", int " operating_mode ", u_int32_t " flags ");"
25.sp
26.BI "DSPAM_CTX *dspam_create(const char *" username ", const char *" group ", "
27.BI "  const char *" home ", int " operating_mode ", u_int32_t " flags ");"
28.sp
29.BI "int dspam_addattribute(DSPAM_CTX *" CTX ", const char *" key ", "
30.BI "  const char *" value ");"
31.sp
32.BI "int dspam_clearattributes(DSPAM_CTX *" CTX ");"
33.sp
34.BI "int dspam_attach(DSPAM_CTX *" CTX ", void *" dbh ");"
35.sp
36.BI "int dspam_process(DSPAM_CTX *" CTX ", const char *" message ");"
37.sp
38.BI "int dspam_getsource(DSPAM_CTX *" CTX ", char *" buf ", size_t " size ");"
39.sp
40.BI "int dspam_detach(DSPAM_CTX *" CTX ");"
41.sp
42.BI "int dspam_destroy(DSPAM_CTX *" CTX ");"
43.fi
44.SH DESCRIPTION
45\fBlibdspam\fP provides core message processing and classification
46functionality.
47.PP
48The \fBdspam_init()\fP function creates and initializes a new classification
49context and attaches the context to whatever backend storage facility was
50configured. The \fBuser\fP and \fBgroup\fP arguments provided are used to
51read and write information stored for the user and group specified. The
52\fBhome\fP argument is used to configure libdspam's storage around the
53base directory specified. The \fBmode\fP specifies the operating mode to
54initialize the classification context with and may be one of:
55.PP
56 \fBDSM_PROCESS\fP   Classify and learn the supplied message using whatever training mode is specified
57 \fBDSM_CLASSIFY\fP  Classify the supplied message only; do not learn or update any counters.
58 \fBDSM_TOOLS\fP     No processing, attach to storage only
59.PP
60The \fBflags\fP provided further tune the classification context for a specific
61function. Multiple flags may be OR'd together.
62.PP
63 \fBDSF_UNLEARN\fP   Unlearn the message
64 \fBDSF_BIAS\fP      Assign processor bias to unknown tokens
65 \fBDSF_SIGNATURE\fP A binary signature is requested/provided
66 \fBDSF_NOISE\fP     Apply Bayesian Noise Reduction logic
67 \fBDSF_WHITELIST\fP Use automatic whitelisting logic
68 \fBDSF_MERGED\fP    Merge group metadata with user's in memory
69.PP
70Upon successful completion, \fBdspam_init()\fP will return a pointer to a new
71\fBclassification context\fP structure containing a copy of the configuration
72passed into dspam_init(), a connected storage driver handle, and a set of
73preliminary user control data read from storage.
74.PP
75The \fBdspam_create()\fP function performs in exactly the same manner as
76the dspam_init() function, but does not attach to storage. Instead, the
77caller must also call \fBdspam_attach()\fP after setting any storage-
78specific attributes using \fBdspam_addattribute()\fP. This is useful for
79cases where the implementor would prefer to configure storage internally
80rather than having libdspam read a configuration from a file.
81.PP
82The \fBdspam_addattribute()\fP function is called to set attributes within
83the classification context. Some storage drivers support the use of passing
84specific attributes such as server connect information. The driver-independent
85attributes supported by DSPAM include:
86.PP
87 \fBIgnoreHeader\fP   Specify a specific header to ignore
88 \fBLocalMX\fP        Specify a local mail exchanger to assist in
89                correct results from \fBdspam_getsource()\fP.
90.PP
91Only driver-dependent attributes need be set prior to a call to
92\fBdspam_attach()\fP. Driver-independent attributes may be set both before
93and after storage has been attached.
94.PP
95The \fBdspam_attach()\fP function attaches the storage interface to the
96classification context and alternatively established an initial connection with
97storage if \fBdbh\fP is \fBNULL\fP. Some storage drivers support only a
98NULL value for dbh, while others (such as mysql_drv, pgsql_drv, and
99sqlite_drv) allow an open database handle to be attached. This function
100should only be called after an initial call to \fBdspam_create()\fP and
101should never be called if using \fBdspam_init()\fP, as storage is
102automatically attached by a call to dspam_init().
103.PP
104The \fBdspam_process()\fP function performs analysis of the \fBmessage\fP
105passed into it and will return zero on successful completion. If successful,
106CTX->result will be set to one of three classification results:
107.PP
108 \fBDSR_ISSPAM\fP        Message was classified as spam
109 \fBDSR_ISINNOCENT\fP    Message was classified as nonspam
110 \fBDSR_ISWHITELISTED\fP Recipient was automatically whitelisted
111.PP
112Should the call fail, one of the following errors will be returned:
113.PP
114 \fBEINVAL\fP    An invalid call or invalid parameter used.
115 \fBEUNKNOWN\fP  Unexpected error, such as malloc() failure
116 \fBEFILE\fP     Error opening or writing to a file or file handle
117 \fBELOCK\fP     Locking failure
118 \fBEFAILURE\fP  The operation itself has failed
119.PP
120The \fBdspam_getsource()\fP function extracts the source sender from the
121message passed in during a call to \fBdspam_process()\fP and writes not more
122than \fBsize\fP bytes to \fBbuf\fP.
123.PP
124The \fBdspam_detach()\fP function can be called when a detachment from
125storage is desired, but the context is still needed. The storage driver
126is closed, leaving the classification context in place. Once the context
127is no longer needed, another call to \fBdspam_destroy()\fP should be
128made. If you are closing storage and destroying the context at the same
129time, it is not necessary to call this function. Instead you may call
130\fBdspam_destroy()\fP directly.
131.PP
132The \fBdspam_clearattributes()\fP function is called to clear any attributes
133previously set using \fBdspam_addattribute()\fP within the classification
134context. It is necessary to call this function prior to replacing any
135attributes already written.
136.PP
137The \fBdspam_destroy()\fP function should be called when the context is
138no longer needed. If a connection was established to storage internally,
139the connection is closed and all data is flushed and written. If a
140handle was attached, the handle will remain open.
141.PP
142.SH COPYRIGHT
143Copyright \(co 2002\-2012 DSPAM Project
144.br
145All rights reserved.
146.br
147
148For more information, see http://dspam.sourceforge.net.
149
150.SH "SEE ALSO"
151.BR dspam (1),
152.BR dspam_admin (1),
153.BR dspam_clean (1),
154.BR dspam_crc (1),
155.BR dspam_dump (1),
156.BR dspam_logrotate (1),
157.BR dspam_merge (1),
158.BR dspam_stats (1),
159.BR dspam_train (1)
Note: See TracBrowser for help on using the repository browser.