summaryrefslogtreecommitdiffstats
path: root/plugins/ipfilter/ipfilterplugin.h
blob: 2ef114a6aa456955cef049ebcd810e559c53dc7a (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
/***************************************************************************
 *   Copyright (C) 2005 by Joris Guisson                                   *
 *   joris.guisson@gmail.com                                               *
 *   ivasic@gmail.com                                                      *
 *                                                                         *
 *   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 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.             *
 ***************************************************************************/
#ifndef KTIPFILTERPLUGIN_H
#define KTIPFILTERPLUGIN_H

#include <interfaces/plugin.h>
#include <interfaces/ipblockinginterface.h>

#include "ipblockingprefpage.h"
#include "antip2p.h"

class TQString;

namespace kt
{	
	class IPBlockingPrefPage;
	
	/**
	 * @author Ivan Vasic <ivasic@gmail.com>
	 * @brief IP filter plugin
	 * 
	 * This plugin will load IP ranges from specific files into KT IPBlocklist.
	 */
	class IPFilterPlugin : public Plugin, public kt::IPBlockingInterface
	{
		TQ_OBJECT
  
	public:
		IPFilterPlugin(TQObject* parent, const char* name, const TQStringList& args);
		virtual ~IPFilterPlugin();

		virtual void load();
		virtual void unload();
		
		///Loads the KT format list filter
		void loadFilters();
		
		///Loads the anti-p2p filter list
		bool loadAntiP2P();
		
		///Unloads the anti-p2p filter list
		bool unloadAntiP2P();
		
		
		///Checks if IP is listed in AntiP2P filter list.
		bool isBlockedIP(const TQString& ip);
		
		bool versionCheck(const TQString & version) const;
	private:
		IPBlockingPrefPage* pref;
		AntiP2P* level1;
	};

}

#endif