~brand-nmapsi4/nmapsi4/master

« back to all changes in this revision

Viewing changes to nmapsi4/common/qprocessthread.h

  • Committer: Francesco Cecconi
  • Date: 2011-12-18 11:02:04 UTC
  • Revision ID: git-v1:60a69e132c8ffeb2727e558b2b2e8ac1713e332e
Removed nmapsi4-logr (dedicate repository) but it could be deprecated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2008-2011 by Francesco Cecconi                          *
3
 
 *   francesco.cecconi@gmail.com                                           *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License.        *
8
 
 *                                                                         *
9
 
 *   This program is distributed in the hope that it will be useful,       *
10
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 
 *   GNU General Public License for more details.                          *
13
 
 *                                                                         *
14
 
 *   You should have received a copy of the GNU General Public License     *
15
 
 *   along with this program; if not, write to the                         *
16
 
 *   Free Software Foundation, Inc.,                                       *
17
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 
 ***************************************************************************/
19
 
 
20
 
#ifndef QPROCESSTHREAD_H
21
 
#define QPROCESSTHREAD_H
22
 
 
23
 
#include <QtCore/QThread>
24
 
#include <QtCore/QByteArray>
25
 
#include <QtCore/QStringList>
26
 
#include <QtCore/QProcess>
27
 
#include <QtCore/QMetaType>
28
 
#include <QtCore/QPointer>
29
 
#include <QtCore/QDebug>
30
 
 
31
 
//local include
32
 
#include "nmapsi4Debug.h"
33
 
 
34
 
class QProcessThread : public QThread
35
 
{
36
 
    /*!
37
 
    * nmap thread class, start nmap with a QProcess and return
38
 
    * QByteArray result with a signal.
39
 
    */
40
 
    Q_OBJECT
41
 
 
42
 
public:
43
 
    /*!
44
 
     * Create a nmap QThread and start QProcess for nmap
45
 
     * with parameters.
46
 
     */
47
 
    QProcessThread(const QString& programName, const QStringList& parameters);
48
 
    ~QProcessThread();
49
 
signals:
50
 
    /*!
51
 
     * Return nmap QThread output with a Signal.
52
 
     */
53
 
    void threadEnd(const QStringList parameters, QByteArray dataBuffer, QByteArray errorBuffer);
54
 
    /*!
55
 
     * Return nmap QThread stdout for ETC and remaining scan time.
56
 
     */
57
 
    void flowFromThread(const QString parameters, const QString data);
58
 
 
59
 
private:
60
 
    QByteArray _pout;
61
 
    QByteArray _perr;
62
 
    QStringList _ParList;
63
 
    QString _programName;
64
 
 
65
 
private slots:
66
 
    void readFinished();
67
 
    void stopProcess();
68
 
    void readyReadData();
69
 
 
70
 
protected:
71
 
    QPointer<QProcess> _process;
72
 
    void run();
73
 
};
74
 
 
75
 
#endif