1 /*
2 
3                           Firewall Builder
4 
5                  Copyright (C) 2006 NetCitadel, LLC
6 
7   Author:  Vadim Kurland     vadim@fwbuilder.org
8 
9   $Id$
10 
11   This program is free software which we release under the GNU General Public
12   License. You may redistribute and/or modify this program under the terms
13   of that license as published by the Free Software Foundation; either
14   version 2 of the License, or (at your option) any later version.
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.  See the
19   GNU General Public License for more details.
20 
21   To get a copy of the GNU General Public License, write to the Free Software
22   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 
24   ######################################################################
25 
26   Class Preprocessor performs various operations on the original copy
27   of the object database before other compilers are called to process
28   rules. All other cmpilers create a local copy copy of the database
29   and work with it, but Preprocessor works with the original
30   database. Currently Preprocessor expands MultiAddress
31   objects. Preprocessor can be overloaded as any other Compiler with
32   customizations added to its prolog() or compile() methods.
33 
34 */
35 
36 #ifndef __PREPROCESSOR_HH__
37 #define __PREPROCESSOR_HH__
38 
39 #include "fwcompiler/Compiler.h"
40 #include "fwbuilder/FWObjectDatabase.h"
41 
42 #include <string>
43 
44 namespace fwcompiler {
45 
46     class Preprocessor : public Compiler {
47 
48         void findMultiAddressObjectsUsedInRules(libfwbuilder::FWObject *top);
49 
50 public:
51 	virtual std::string myPlatformName();
52 
53 	virtual ~Preprocessor();
54 	Preprocessor(libfwbuilder::FWObjectDatabase *_db,
55                      libfwbuilder::Firewall *fw, bool ipv6_policy);
56 
57         /**
58          * converts a single object. convertObjects calls this method for every
59          * object that may need to be converted
60          */
61         virtual void convertObject(libfwbuilder::FWObject *obj);
62 
63 	virtual int  prolog();
64 	virtual void compile();
65 	virtual void epilog();
66     };
67 }
68 
69 #endif
70