File: message_processor.h

package info (click to toggle)
couriergrey 0.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,996 kB
  • sloc: sh: 11,994; ansic: 10,591; cpp: 790; makefile: 496; yacc: 289; sed: 16
file content (73 lines) | stat: -rw-r--r-- 2,192 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* ---------------------------------------------------------------------------
 *  couriergrey - Greylisting filter for Courier
 *  Copyright (C) 2007-2012  Matthias Wimmer <m@tthias.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 *  USA.
 * ---------------------------------------------------------------------------
 * vi: sw=4:tabstop=8
 */

#ifndef MESSAGE_PROCESSOR_H
#define MESSAGE_PROCESSOR_H

#ifdef HAVE_CONFIG_H
#   include <config.h>
#endif

#include <whitelist.h>

#ifndef N_
#   define N_(n) (n)
#endif

namespace couriergrey {
    /**
     * a message_processor reads the filenames of a message from an accepted socket,
     * checks the message and gives back the greylisting response code on the socket
     *
     * @note you have to instantiate this class using the new operator as the
     * do_process() method will delete the instance using the delete operator when
     * finished.
     */
    class message_processor {
	public:
	    /**
	     * create a message_processor for an accepted domain socket
	     *
	     * @param fd the handle of the accepted domain socket
	     */
	    message_processor(int fd, whitelist const& used_whitelist);

	    /**
	     * do the actual processing
	     *
	     * This can be run in its own thread
	     */
	    void do_process();
	private:
	    /**
	     * the handle of the socket to process
	     */
	    int fd;

	    /**
	     * whitelist to use
	     */
	    whitelist const& used_whitelist;
    };
}

#endif // MESSAGE_PROCESSOR_H