summaryrefslogtreecommitdiffstats
path: root/LogReceiver/networkdiscovery.h
diff options
context:
space:
mode:
authorNiklas2011-10-05 17:39:35 +0200
committerNiklas2011-10-05 17:39:35 +0200
commitbe915d3cfcc639d6303bf8bc0e5ad825e0ef2f95 (patch)
treec52ed62bb40ad926271f0637f9a29aee2889543c /LogReceiver/networkdiscovery.h
parenttried to solve the timing problem. but failed. it is also enough to test for ... (diff)
downloadfbgui-be915d3cfcc639d6303bf8bc0e5ad825e0ef2f95.tar.gz
fbgui-be915d3cfcc639d6303bf8bc0e5ad825e0ef2f95.tar.xz
fbgui-be915d3cfcc639d6303bf8bc0e5ad825e0ef2f95.zip
modified the check for carrier signal. on autoUp==true: if no interface is in running state, the app will check the state of the interface several times (can be specified by us with the _ifUpCountdown value)
Diffstat (limited to 'LogReceiver/networkdiscovery.h')
-rw-r--r--LogReceiver/networkdiscovery.h42
1 files changed, 25 insertions, 17 deletions
diff --git a/LogReceiver/networkdiscovery.h b/LogReceiver/networkdiscovery.h
index 4a9bc3c..8b9359c 100644
--- a/LogReceiver/networkdiscovery.h
+++ b/LogReceiver/networkdiscovery.h
@@ -1,10 +1,8 @@
#ifndef NetworkDiscovery_H
#define NetworkDiscovery_H
-//#include <QMap>
#include <QtNetwork>
#include <QtCore>
-//#include <QProcess>
#include <arpa/inet.h>
#include <stdio.h>
@@ -14,28 +12,19 @@
#include <syslog.h>
#include <sysfs/libsysfs.h>
-
-
#include "interfaceconfiguration.h"
#include "networkmanager.h"
+#include "sleeper.h"
+
+#include "../common/fbgui.h"
+
#include "status.h"
#include "dhcp.h"
#include "interface.h"
-//#include <QProcess>
-//#include <QLocalSocket>
-//#include <QLocalServer>
-//#include <QTcpSocket>
-//#include <QSsl>
-#include <QNetworkConfigurationManager>
-//#include <QNetworkAccessManager>
-#include <QWidget>
-#define DEFAULT_QTSOCKETADDRESS "/var/tmp/qt_c_socket_default"
-#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/customdhcpcd/src/customdhcpcd"
-#define DEFAULT_GATEWAY_INFO_LOCATION "/var/tmp/gateways_"
-#define ACK_SIZE 4
+#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/customdhcpcd/src/build/cdhcpcd"
class NetworkDiscovery: public QObject {
Q_OBJECT
@@ -45,6 +34,8 @@ public:
~NetworkDiscovery();
void initAndRun(QString serverIp, bool userChoice,
+ bool autoUp,
+ QString pathToLogFile,
QString serverPath = DEFAULT_QTSOCKETADDRESS,
QString pathToExe = DEFAULT_PATHTODHCPCDEXE,
QStringList* args = NULL);
@@ -53,6 +44,7 @@ public:
QString getGatewayForInterface(QString ifName);
int ip4_setManualConfiguration(QVariantMap result);
+ QString readLogFile();
private slots:
void handleNewConnection();
@@ -62,6 +54,11 @@ private slots:
void handleProcessStarted();
void handleClientDisconnect();
+ void slotReadyForRun();
+
+ void checkForIsRunning();
+
+
signals:
void addInterface(const QString &ifName);
void changeProgressBarValue(const QString & ifName, const int $newValue);
@@ -72,6 +69,8 @@ signals:
void continueBoot(QString ifName, int userChoice);
void setManualConfInterfaces(QString jsonArr);
+ void readyForRun();
+
private:
QLocalServer *_server;
QMap<QLocalSocket *, QLocalSocket *> _clients;
@@ -84,7 +83,14 @@ private:
NetworkManager _networkManager;
bool _userChoice;
bool _blocked;
+ bool _autoUp;
QString _serverIp;
+ QString _pathToLogFile;
+ QList<QString> _ifUpList;
+ QList<QString> _ifDownList;
+ QMap<QString, bool> _ifMap;
+ int _ifUpCountdown;
+ QTimer* _timer;
QMap<QString, interfaceconfiguration*> _ifcMap;
@@ -94,12 +100,14 @@ private:
void runDHCPCD(QString interface);
QList<QString>checkCarrierState(QList<QString> &interfaces);
bool checkCarrierState(QString interface);
- bool checkForIsRunning(QNetworkInterface networkInterface);
bool checkConnectivity(QString ifName);
bool checkConnectivityViaTcp(QString server);
QList<QString> getListOfNetworkInterfaces();
bool checkBlackList(QString i);
+ QList<QString> getListOfNetworkInterfacesWithAutoUp();
+
+
};
#endif // NetworkDiscovery_H