summaryrefslogtreecommitdiffstats
path: root/kmyfirewall/core/kmfnetwork.h
blob: 248e3936794364f9b522f5d942d5d83a33426ce9 (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Christian Hubinger <chubinger@irrsinnig.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef KMFNETWORK_H
#define KMFNETWORK_H

#include "kmfdoc.h"
#include "kmfundoengine.h"

// QT includes
#include <tqdom.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqptrlist.h>

// KDE includes
#include <kurl.h>

// Project includes
#include "ipaddress.h"
#include "kmfprotocol.h"

namespace KMF {
class KMFError;
class KMFNetZone;
class KMFTarget;
class IPAddress;
class KMFCompilerInterface;
class KMyFirewallInterface;

/**
@author Christian Hubinger
*/

class KDE_EXPORT KMFNetwork : public KMFDoc {

//##### static stuff ####
public:
	

//##### end static stuff

public:
	KMFNetwork( NetfilterObject*, const char*, KMyFirewallInterface* app );

	~KMFNetwork();
	/** resets the document to the initial values */
	virtual void clear();

	/** Reeturn if the Network is empty */
	bool isEmpty();
	
	/** Return DomDocument of this Chain */
	const TQDomDocument& getDOMTree();

	virtual void loadXML( const TQDomDocument&, TQStringList& errors );
	virtual void loadXML( TQDomNode, TQStringList& errors );
	virtual int type();
	
	void parseDocument( const KURL&, TQStringList& errors );
		
	/** Get the File dialog filter string for the document type */	
	virtual const TQString& getFileDialogFilter();
		
 	KMFDoc* currentDoc();
	KMFIPTDoc* currentDocAsIPTDoc();
	KMFGenericDoc* currentDocAsGenericDoc();

 	KMFTarget* currentTarget();
 	void setCurrentTarget( KMFTarget* );
 	
	KMFNetZone* netzone() const {
		return m_myNetwork;
	}	
	
	virtual KMFError* exportXMLRuleset( bool promtFile, bool asTemplate );
	
protected:
	virtual KMFError* exportXMLRuleset( const KURL& url  );
	void initDoc();
	void setupDefaultHosts();
	
private:
	bool loadProtocolLibrary();
	bool loadCustomProtocolLibrary();
// 	KMFCompilerInterface* compiler();

private: // DATA
	TQGuardedPtr<KMFNetZone> m_myNetwork;
	TQGuardedPtr<KMFTarget> m_target;
	
/*	KMFNetZone *m_myNetwork;
	KMFTarget *m_target;*/
};
}
#endif