summaryrefslogtreecommitdiffstats
path: root/kmyfirewall/core/kmftarget.h
blob: e0fe3fdf1642b6dde7bf7c899be447f9c8670c4e (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
/*
Author: Christian Hubinger <chubinger@irrsinnig.org>, (C) 2001-2008
*/
#ifndef KMFTARGET_H
#define KMFTARGET_H

#include "netfilterobject.h"

// QT includes

#include <tqptrlist.h>
#include <tqstring.h>
#include <tqdom.h>

// KDE includes
#include <kdemacros.h>
#include <kprocess.h>

// Project includes
#include "kmfnetzone.h"

#include "xmlnames.h"
class TQWidget;

namespace KMF {
class IPAddress;
class KMFError;
class KMFTargetConfig;
class KMFDoc;
class KMFNetwork;
class KMFRulesetDoc;
class KMFProcessWrapper;
class KMFInstallerInterface;
class KMFCompilerInterface;
/**
	@author Christian Hubinger <chubinger@irrsinnig.org>
*/

class KDE_EXPORT KMFTarget : public NetfilterObject {
	Q_OBJECT
  TQ_OBJECT
public:
	KMFTarget( NetfilterObject *parent, const char* name, const TQString& targetName, KMFNetwork* net );

    ~KMFTarget();
	
	virtual int type();
	virtual void clear();
	
	virtual const TQDomDocument& getDOMTree();
	virtual void loadXML(const TQDomDocument&, TQStringList& errors );
	virtual void loadXML( TQDomNode, TQStringList& errors );
	
	KMFNetZone* zone() const {
		return m_zone;
	}
	
	bool isLocalhost(); 
	bool isLocalExecuteTarget(); 
	
	const TQString& guiName() const {
		return m_guiName;
	};
	void setGuiName( const TQString& );

	const TQString& name();

	IPAddress* address() {
		return m_address;
	};
	
	void setAddress( const TQString& );
	
	int sshPort() const {
		return m_ssh_port;
	};
	
	void setSSHPort( int );
	
	bool readOnly() const {
		return m_readOnly;
	};
	void setReadOnly( bool );	

	bool isCurrentTarget();
	KMFNetwork* network();
	
	void setParentZone( KMFNetZone* );
	KMFError* tryAutoConfiguration();
	
	KMFTargetConfig* config();
	
	TQString toString();
	TQString toFriendlyString();
	const TQString& getFishUrl();
	
	
	KMFDoc* doc();
	
	KMFRulesetDoc* rulesetDoc();
	KMFInstallerInterface* installer();
	KMFCompilerInterface* compiler();
	
	protected: 
		TQGuardedPtr<KMFNetZone> m_zone;
		IPAddress *m_address;
		int m_ssh_port;
		TQString m_guiName;
		
	private:
		void ensureDoc();
		KMFTargetConfig *m_config;
		KMFDoc *m_doc;
		KMFNetwork *m_network;
		bool m_readOnly;
		TQString m_allOut;	
	signals:
		void sigTargetChanged( KMFTarget* );
};	
}
#endif