summaryrefslogblamecommitdiffstats
path: root/workspace/LogReceiver/logreceiver.h
blob: 26a3934ce680dfe1dfee57d8bb1713f593d4c9da (plain) (tree)
1
2
3
4
5
6
7
8
9


                     

                              
 


                   
                                   


        
                      

                       

                          


                                   
                                              

                                                                                  
 


                                                         

        
                             
                          
                                                    
                                               
                                                     



                                                 
 
                                                             
                                          

                                                                     
                                                              
                                       
 


                       
#ifndef LOGRECEIVER_H
#define LOGRECEIVER_H

#include <qprocess.h>
#include <qnetworkinterface.h>

class QLocalServer;
class QLocalSocket;

class LogReceiver: public QObject {
Q_OBJECT

public:
	LogReceiver();
	~LogReceiver();

	void initAndRun();

private slots:
	void handleNewConnection();
	void handleNewInput();
	void handleNewInputLine(QString data);
	void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
	void handleProcessStarted();

signals:
    void addNewInterface(QString ifName, int index);
    void changeProgressBarValue(int index, int newValue);

private:
	QLocalServer *server;
	quint16 blockSize;
	QMap<int, QNetworkInterface > interfacesMap;
	QMap<QString, int> indexToIfaceNameMap;
	QMap<QLocalSocket *, QLocalSocket *> clients;
	QMap<Q_PID, QProcess * > clientProcesses;
	QString pathToDhcpcdExe;
	QStringList dhcpcdArguments;


	void runDHCPCD(QList<QNetworkInterface> &interfaces);
	void runDHCPCD(QString interface);
	void checkCarrierState(QList<QNetworkInterface> &interfaces);
	bool checkCarrierState(QString interface);
	QList<QNetworkInterface> getListOfNetworkInterfaces();
	bool checkBlackList(QString i);

};

#endif // LOGRECEIVER_H