diff options
Diffstat (limited to 'workspace/networkDiscovery/networkdiscovery.cpp')
| -rw-r--r-- | workspace/networkDiscovery/networkdiscovery.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/workspace/networkDiscovery/networkdiscovery.cpp b/workspace/networkDiscovery/networkdiscovery.cpp deleted file mode 100644 index e308de4..0000000 --- a/workspace/networkDiscovery/networkdiscovery.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include <sys/file.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <arpa/inet.h> -#include <errno.h> -#include <fcntl.h> -#include <getopt.h> -#include <paths.h> -#include <signal.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifdef __cplusplus -extern "C" { -#endif -#include "dhcpcd/config.h" -#include "dhcpcd/client.h" -#include "dhcpcd/dhcpcd.h" -#include "dhcpcd/dhcp.h" -#include "dhcpcd/interface.h" -#include "dhcpcd/logger.h" -#include "dhcpcd/socket.h" -#include "dhcpcd/version.h" -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - -#include <QtGui> -#include "networkdiscovery.h" -#include <QNetworkInterface> -#include <QtNetwork> - - -#endif - -NetworkDiscovery::NetworkDiscovery(QWidget *parent) - : QWidget(parent) -{ - ui.setupUi(this); - QList<QNetworkInterface> interfaces = getListOfNetworkInterfaces(); - - /** - * test if i get some dhcp values for the dummy0 interface - */ - doDHCP(interfaces); - doDhcp(interfaces.first()); -} - -NetworkDiscovery::~NetworkDiscovery() -{ - -} - -QList<QNetworkInterface> NetworkDiscovery::getListOfNetworkInterfaces() { - QList<QNetworkInterface> nIList = QNetworkInterface::allInterfaces(); - QList<QNetworkInterface> result; - foreach(QNetworkInterface nI, nIList) { - if (((!(nI.flags() & QNetworkInterface::CanBroadcast)|| - nI.flags() & QNetworkInterface::IsLoopBack) || - nI.flags() & QNetworkInterface::IsPointToPoint)) - { - continue; - } - qDebug() << nI.humanReadableName(); - result.append(nI); - } - return result; -} - -int NetworkDiscovery::doDHCP(QList<QNetworkInterface> interfaces) -{ - return 0; -} - - - -int NetworkDiscovery::doDhcp(QNetworkInterface interface) -{ - nd_main("eth0"); -} - -void NetworkDiscovery::listenToLogger() -{ - skt = new QLocalSocket(this); - - connect(skt, SIGNAL(readyRead()), this, SLOT(handleLoggedMessage())); - connect(skt, SIGNAL(error(QLocalSocket::LocalSocketError)), - this, SLOT(displayError(QLocalSocket::LocalSocketError))); - skt->connectToServer(COM_CH); -} - -void NetworkDiscovery::handleLoggedMessage() -{ - -} - -void NetworkDiscovery::displayError(QLocalSocket::LocalSocketError socketError) - { - switch (socketError) { - case QLocalSocket::ServerNotFoundError: - QMessageBox::information(this, tr("Fortune Client"), - tr("The host was not found. Please check the " - "host name and port settings.")); - break; - case QLocalSocket::ConnectionRefusedError: - QMessageBox::information(this, tr("Fortune Client"), - tr("The connection was refused by the peer. " - "Make sure the fortune server is running, " - "and check that the host name and port " - "settings are correct.")); - break; - case QLocalSocket::PeerClosedError: - break; - default: - QMessageBox::information(this, tr("Fortune Client"), - tr("The following error occurred: %1.") - .arg(skt->errorString())); - } - } - |
