1 /*
2 
3                           Firewall Builder
4 
5                  Copyright (C) 2009 NetCitadel, LLC
6 
7   Author:  Vadim Kurland     vadim@vk.crocodile.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 #include "../../config.h"
27 
28 #include <fstream>
29 #include <iostream>
30 #include <algorithm>
31 #include <functional>
32 #include <stdexcept>
33 
34 #include <assert.h>
35 #include <string>
36 #include <cstring>
37 #include <iomanip>
38 
39 #include "fwbuilder/Resources.h"
40 #include "fwbuilder/FWOptions.h"
41 #include "fwbuilder/Firewall.h"
42 #include "fwbuilder/Interface.h"
43 
44 #include "CompilerDriver_pix.h"
45 #include "PolicyCompiler_pix.h"
46 #include "OSConfigurator_pix_os.h"
47 
48 #include <QFileInfo>
49 #include <QDir>
50 
51 
52 using namespace std;
53 using namespace libfwbuilder;
54 using namespace fwcompiler;
55 
56 
CompilerDriver_pix(FWObjectDatabase * db)57 CompilerDriver_pix::CompilerDriver_pix(FWObjectDatabase *db) :
58     CompilerDriver(db)
59 {
60 }
61 
62 // create a copy of itself, including objdb
clone()63 CompilerDriver* CompilerDriver_pix::clone()
64 {
65     CompilerDriver_pix* new_cd = new CompilerDriver_pix(objdb);
66     if (inEmbeddedMode()) new_cd->setEmbeddedMode();
67     return new_cd;
68 }
69 
protocolInspectorCommands()70 string CompilerDriver_pix::protocolInspectorCommands()
71 {
72     OSConfigurator_pix_os oscnf(objdb , locateObject(), false);
73     oscnf.prolog();
74     return oscnf.getProtocolInspectionCommands();
75 }
76 
printProlog(QTextStream & file,const string & prolog_code)77 void CompilerDriver_pix::printProlog(QTextStream &file, const string &prolog_code)
78 {
79     file << endl;
80     file << "#" << endl;
81     file << "# Prolog script" << endl;
82     file << "#" << endl;
83     file << prolog_code << endl;
84     file << "#" << endl;
85     file << "# End of prolog script" << endl;
86     file << "#" << endl;
87 }
88 
89