~ubuntu-branches/ubuntu/precise/knemo/precise

« back to all changes in this revision

Viewing changes to src/knemod/backends/nettoolsbackend.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-01-06 17:16:51 UTC
  • mfrom: (1.1.9 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100106171651-ff58ryfnav4l1zbm
Tags: 0.6.0-1
* New upstream release 
  - Fixes "FTBFS: sysbackend.cpp:362: error: 'KILO' was not declared in
  this scope" (Closes: #560496)
  - Fixes "context menu does not appear" (Closes: #504791)
* Add Build-Depends: libnl-dev - Linux netlink sockets library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of KNemo
2
 
   Copyright (C) 2004 Percy Leonhardt <percy@eris23.de>
3
 
   Copyright (C) 2009 John Stamp <jstamp@users.sourceforge.net>
4
 
 
5
 
   KNemo is free software; you can redistribute it and/or modify
6
 
   it under the terms of the GNU Library General Public License as
7
 
   published by the Free Software Foundation; either version 2 of
8
 
   the License, or (at your option) any later version.
9
 
 
10
 
   KNemo is distributed in the hope that it will be useful,
11
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
   GNU Library General Public License for more details.
14
 
 
15
 
   You should have received a copy of the GNU Library General Public License
16
 
   along with this library; see the file COPYING.LIB.  If not, write to
17
 
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
   Boston, MA 02110-1301, USA.
19
 
*/
20
 
 
21
 
#ifndef NETTOOLSBACKEND_H
22
 
#define NETTOOLSBACKEND_H
23
 
 
24
 
#include "backendbase.h"
25
 
#include <QProcess>
26
 
 
27
 
class KProcess;
28
 
 
29
 
/**
30
 
 * The nettools backend runs 'ifconfig', 'iwconfig' and 'route'
31
 
 * and parses their output. It then triggers the interface
32
 
 * monitor to look for changes in the state of the interface.
33
 
 *
34
 
 * @short Update the information of the interfaces via nettools
35
 
 * @author Percy Leonhardt <percy@eris23.de>
36
 
 */
37
 
 
38
 
class NetToolsBackend : public QObject, BackendBase
39
 
{
40
 
    Q_OBJECT
41
 
public:
42
 
    NetToolsBackend(QHash<QString, Interface *>& interfaces );
43
 
    virtual ~NetToolsBackend();
44
 
 
45
 
    static BackendBase* createInstance( QHash<QString, Interface *>& interfaces );
46
 
 
47
 
    void update();
48
 
    QString getDefaultRouteIface();
49
 
 
50
 
private slots:
51
 
    void routeProcessExited( int exitCode, QProcess::ExitStatus status );
52
 
    void routeProcessStdout();
53
 
    void ifconfigProcessExited( int exitCode, QProcess::ExitStatus status );
54
 
    void ifconfigProcessStdout();
55
 
    void iwconfigProcessExited( int exitCode, QProcess::ExitStatus status );
56
 
    void iwconfigProcessStdout();
57
 
 
58
 
private:
59
 
    void parseRouteOutput();
60
 
    void parseIfconfigOutput();
61
 
    void updateInterfaceData( QString& config, InterfaceData& data, int type );
62
 
    void parseIwconfigOutput();
63
 
    void updateWirelessData( QString& ifaceName, QString& config, WirelessData& data );
64
 
    void parseWirelessEncryption( QString& config, WirelessData& data );
65
 
 
66
 
    QString mRouteStdout;
67
 
    QString mIfconfigStdout;
68
 
    QString mIwconfigStdout;
69
 
    KProcess* mRouteProcess;
70
 
    KProcess* mIfconfigProcess;
71
 
    KProcess* mIwconfigProcess;
72
 
};
73
 
 
74
 
#endif // NETTOOLSBACKEND_H