/** * Copyright (c) 2010,2011 - RZ Uni Freiburg * Copyright (c) 2010,2011 - OpenSLX Project * * This program/file is free software distributed under the GPL version 2. * See http://openslx.org/COPYING * * If you have any feedback please consult http://openslx.org/feedback and * send your feedback to feedback@openslx.org * * General information about OpenSLX can be found under http://openslx.org */ #ifndef NetworkDiscovery_H #define NetworkDiscovery_H #include #include #include #include #include #include #include #include #include #include "interfaceconfiguration.h" #include "networkmanager.h" #include "dhcp.h" #include "globals.h" #include "../common/fbgui.h" class NetworkDiscovery: public QObject { Q_OBJECT public: NetworkDiscovery(QObject *parent = 0); ~NetworkDiscovery(); void initAndRun(bool userChoice, QStringList* args = NULL); bool checkConnectivity(QString ifName); bool checkConnectivityViaTcp(); int ip4_setManualConfiguration(QVariantMap result); void tryAgain(); void prepareTryAgain(); // Public member access QList getIfUpList(); InterfaceConfiguration* getInterfaceConfig(QString ifName); QString GetErrorStr(); public slots: void readyForRun(); void checkForIsRunning(); void handleNewConnection(); void handleClientDisconnect(); void handleNewInput(); void handleNewInputLine(QLocalSocket * client, QString data); void handleProcessStarted(); void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); signals: void updateStatus(QString status); void addInterface(const QString &ifName); void updateIfStatus(QString ifName, QString status); void changeProgressBarValue(const QString & ifName, const int $newValue); void connectionEstablished(QString ifName); void allProcessesFinished(); void continueBootWithoutCheck(QString ifName); void abortBoot(QString msg); private: void mainWork(); void getListOfNetworkInterfaces(); void getListOfNetworkInterfacesWithAutoUp(); bool checkBlackList(QString i); bool checkConnectivityViaTcp(QString server); void runDHCPCD(QList &interfaces); void runDHCPCD(QString interface); void killDHCPCD(); void handleNewInput(QLocalSocket * client); QLocalServer *_server; QLocalSocket *_client; QMap _clients; QMap _ifNameToClient; QMap _clientProcessToIfNameMap; //QList _pidsList; bool _userChoice; bool _blocked; QTimer*_timer; QList _ifUpList; QList _ifDownList; int _ifUpCountdown; int _numberOfProcesses; QStringList _dhcpcdArguments; NetworkManager* _networkManager; QMap _ifcMap; QString _errorStr; }; #endif // NetworkDiscovery_H