1 /* 2 3 Firewall Builder 4 5 Copyright (C) 2011 NetCitadel, LLC 6 7 Author: Vadim Kurland vadim@fwbuilder.org 8 9 This program is free software which we release under the GNU General Public 10 License. You may redistribute and/or modify this program under the terms 11 of that license as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 To get a copy of the GNU General Public License, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 */ 23 24 #ifndef _SNMPCRAWLERTHREAD_H_ 25 #define _SNMPCRAWLERTHREAD_H_ 26 27 #include "../../config.h" 28 29 #include <QWidget> 30 #include <QThread> 31 32 #include <map> 33 #include <set> 34 35 #include "fwbuilder/libfwbuilder-config.h" 36 #include "fwbuilder/FWObject.h" 37 #include "fwbuilder/InetAddrMask.h" 38 #include "fwbuilder/ThreadTools.h" 39 40 #ifdef HAVE_LIBSNMP 41 42 // avoid #include "snmp.h" since it conflicts with Qt, see #2185 43 namespace libfwbuilder 44 { 45 class SNMPCrawler; 46 class SyncFlag; 47 class CrawlerFind; 48 }; 49 50 51 class SNMPCrawlerThread : public QThread 52 { 53 Q_OBJECT; 54 55 libfwbuilder::SNMPCrawler *q; 56 libfwbuilder::SyncFlag *stop_flag; 57 58 QWidget *ui; 59 60 public: 61 SNMPCrawlerThread(QWidget *ui, 62 const QString &seedHost, 63 const QString &community, 64 bool recursive, 65 bool followP2P, 66 int snmpRetries, 67 int snmpTimeout, 68 const std::vector<libfwbuilder::InetAddrMask> *include); 69 virtual ~SNMPCrawlerThread(); 70 71 void run(); 72 void stop(); 73 74 std::map<libfwbuilder::InetAddr, libfwbuilder::CrawlerFind> getAllIPs(); 75 std::set<libfwbuilder::InetAddrMask> getNetworks(); 76 77 signals: 78 void finished(); 79 }; 80 81 #endif 82 83 #endif 84