.TH "NetworkDiscovery" 3 "Wed Nov 9 2011" "ndgui/NetworkDiscovery" \" -*- nroff -*- .ad l .nh .SH NAME NetworkDiscovery \- .PP the logic behind the \fBNetworkDiscovery\fP. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Slots" .in +1c .ti -1c .RI "void \fBhandleNewConnection\fP ()" .br .ti -1c .RI "void \fBhandleNewInput\fP ()" .br .ti -1c .RI "void \fBhandleNewInputLine\fP (QLocalSocket *client, QString data)" .br .ti -1c .RI "void \fBhandleProcessFinished\fP (int exitCode, QProcess::ExitStatus exitStatus)" .br .ti -1c .RI "void \fBhandleProcessStarted\fP ()" .br .ti -1c .RI "void \fBhandleClientDisconnect\fP ()" .br .ti -1c .RI "void \fBslotReadyForRun\fP ()" .br .ti -1c .RI "void \fBcheckForIsRunning\fP ()" .br .in -1c .SS "Signals" .in +1c .ti -1c .RI "void \fBaddInterface\fP (const QString &ifName)" .br .ti -1c .RI "void \fBchangeProgressBarValue\fP (const QString &ifName, const int $newValue)" .br .ti -1c .RI "void \fBconnectionEstablished\fP (QString ifName)" .br .ti -1c .RI "void \fBabortBoot\fP (QString msg)" .br .ti -1c .RI "void \fBupdateIfStatus\fP (QString ifName, QString status)" .br .ti -1c .RI "void \fBupdateStatus\fP (QString status)" .br .ti -1c .RI "void \fBallProcessesFinished\fP ()" .br .ti -1c .RI "void \fBcontinueBoot\fP (QString ifName)" .br .ti -1c .RI "void \fBcontinueBootWithoutCheck\fP (QString ifName)" .br .ti -1c .RI "void \fBsetManualConfInterfaces\fP (QString jsonArr)" .br .ti -1c .RI "void \fBreadyForRun\fP ()" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBNetworkDiscovery\fP (QObject *parent=0)" .br .ti -1c .RI "\fB~NetworkDiscovery\fP ()" .br .ti -1c .RI "void \fBinitAndRun\fP (QString serverIp, bool userChoice, bool autoUp, QString pathToLogFile, QString serverPath=DEFAULT_QTSOCKETADDRESS, QString pathToExe=DEFAULT_PATHTODHCPCDEXE, QStringList *args=NULL)" .br .ti -1c .RI "int \fBip4_replaceDefaultRoute\fP (QString ifName, QString gateway, int mss)" .br .ti -1c .RI "QString \fBgetGatewayForInterface\fP (QString ifName)" .br .ti -1c .RI "int \fBip4_setManualConfiguration\fP (QVariantMap result)" .br .ti -1c .RI "QString \fBreadLogFile\fP ()" .br .ti -1c .RI "void \fBtryAgain\fP ()" .br .ti -1c .RI "void \fBprepareTryAgain\fP ()" .br .ti -1c .RI "bool \fBcheckConnectivity\fP (QString ifName)" .br .ti -1c .RI "bool \fBcheckConnectivityViaTcp\fP ()" .br .ti -1c .RI "QVariantMap \fBgetInterfaceConfig\fP (QString ifName)" .br .ti -1c .RI "QString \fBGetErrorStr\fP ()" .br .in -1c .SH "Detailed Description" .PP the logic behind the \fBNetworkDiscovery\fP. This class holds all the logic of the \fBNetworkDiscovery\fP. It's main task is to search for usable interfaces, check if they are wired (in Running state) and start a cdhcpcd process for each interface. It also sends signals to the ndgui class for presenting notifications to the user. .SH "Constructor & Destructor Documentation" .PP .SS "NetworkDiscovery::NetworkDiscovery (QObject *parent = \fC0\fP)"constructor .SS "NetworkDiscovery::~NetworkDiscovery ()"destructor .SH "Member Function Documentation" .PP .SS "void NetworkDiscovery::abortBoot (QStringmsg)\fC [signal]\fP" .SS "void NetworkDiscovery::addInterface (const QString &ifName)\fC [signal]\fP" .SS "void NetworkDiscovery::allProcessesFinished ()\fC [signal]\fP" .SS "void NetworkDiscovery::changeProgressBarValue (const QString &ifName, const int $newValue)\fC [signal]\fP" .SS "bool NetworkDiscovery::checkConnectivity (QStringifName)"checks the connectivity. tries to open a TCP connection to the server (see _serverIp). For this it adjusts the routing table. (sets the gateway of the interface as default gateway) Gateway is written into the dhcpcd config file of this interface. (see DEFAULT_INTERFACE_CONF_LOCATION '/var/tmp/conf_') .PP \fBParameters:\fP .RS 4 \fIifName\fP name of a interface. .RE .PP \fBReturns:\fP .RS 4 true: connection is possible false: connection not possible .RE .PP .SS "bool NetworkDiscovery::checkConnectivityViaTcp ()" .SS "void NetworkDiscovery::checkForIsRunning ()\fC [slot]\fP"only called if autoUp == true. check the IsRunning flag of each interface in the _ifDownList. connected to the timeout signal of the timer. .SS "void NetworkDiscovery::connectionEstablished (QStringifName)\fC [signal]\fP" .SS "void NetworkDiscovery::continueBoot (QStringifName)\fC [signal]\fP" .SS "void NetworkDiscovery::continueBootWithoutCheck (QStringifName)\fC [signal]\fP" .SS "QString NetworkDiscovery::GetErrorStr ()" .SS "QString NetworkDiscovery::getGatewayForInterface (QStringifName)"returns the gateway address, written into the dhcp config file. .PP \fBParameters:\fP .RS 4 \fIifName\fP name of the interface. .RE .PP \fBReturns:\fP .RS 4 gateway address as string. or empty string if no interface config was found. .RE .PP .SS "QVariantMap NetworkDiscovery::getInterfaceConfig (QStringifName)" .SS "void NetworkDiscovery::handleClientDisconnect ()\fC [slot]\fP"called when a client disconnects. .SS "void NetworkDiscovery::handleNewConnection ()\fC [slot]\fP"connected to the new client arrived signal. connects the client readyRead signal with the handleNewInput slot. .SS "void NetworkDiscovery::handleNewInput ()\fC [slot]\fP"This method is connected to the readyRead Signal of the QLocalSocket client. send an ACK to the client with every received message. .SS "void NetworkDiscovery::handleNewInputLine (QLocalSocket *client, QStringdata)\fC [slot]\fP"This Method processes the send messages. .PP This Method processes the send messages. It splits the line into several components. Those components are: interface: interface name ==> indicates the process who send the message s_state: is the number representation of syslog.h LOG levels s_subState: is the number representation of the dhcp.c DHCP states (1 - 8) plus the status. h states (9 - ..) msg: is a message which can contain additional informations .PP According to the s_state and s_subState we emit the \fBchangeProgressBarValue()\fP signal with different values. .PP \fBParameters:\fP .RS 4 \fIclient\fP the client who send the message .br \fIdata\fP the message. (format ;;; ) .RE .PP .SS "void NetworkDiscovery::handleProcessFinished (intexitCode, QProcess::ExitStatusexitStatus)\fC [slot]\fP"This Method is called when a process is finished. .PP This Method is called when a process is finished. This slot is connected with the signal finished() of the QProcess class. If the process finishes, it will be checked if the process exited normal or if an unexpected error occurred. For this, we determine the sender (which is a QProcess), get the corresponding interface (which is stored in a map), and check the exitCode. Further actions are taken according to the exitCode check. Normal exit: emit changeProgressBar() to 100% emit \fBupdateIfStatus()\fP to check connection \fBcheckConnectivity()\fP .PP \fBSee also:\fP .RS 4 \fBNetworkDiscovery::checkConnectivity()\fP Unexpected exit: emit \fBupdateIfStatus()\fP to process exited unexpected .RE .PP \fBParameters:\fP .RS 4 \fIexitCode\fP .br \fIexitStatus\fP .RE .PP \fBReturns:\fP .RS 4 bool returns true: if the interface name i starts with a letter in the blacklist. .RE .PP returns false: else .PP \fBSee also:\fP .RS 4 NetworkDiscovery::getListOfNetworkInterfaces() .RE .PP .SS "void NetworkDiscovery::handleProcessStarted ()\fC [slot]\fP"This Method is called when a process is started. .PP This Method is called when a process is started. It prints the message: 'process started for interface: '. .SS "void NetworkDiscovery::initAndRun (QStringserverIp, booluserChoice, boolautoUp, QStringpathToLogFile, QStringserverPath = \fCDEFAULT_QTSOCKETADDRESS\fP, QStringpathToExe = \fCDEFAULT_PATHTODHCPCDEXE\fP, QStringList *args = \fCNULL\fP)"initialize all important class members and start the main work. .PP \fBParameters:\fP .RS 4 \fIserverIp\fP the ip of the server with which we are testing the connectivity. .br \fIuserChoice\fP true if the user wishes to have a user choice. true: the chooseInterfaceDialog will be showed. .br \fIautoUp\fP true if we want to 'auto Up' all down interfaces. .br \fIpathToLogFile\fP the path to the log file. .br \fIserverPath\fP the path to the server socket (default value: DEFAULT_QTSOCKETADDRESS '/var/tmp/qt_c_socket_default') .br \fIpathToExe\fP the path to the customdhcpcd exe. (default value: #define DEFAULT_QTSOCKETADDRESS '/var/tmp/qt_c_socket_default') .br \fIargs\fP additional arguments for the customdhcpcd client. (default value: NULL) .RE .PP .SS "int NetworkDiscovery::ip4_replaceDefaultRoute (QStringifName, QStringgateway, intmss)"replace the default route. sets af automatically to AF_INET .PP \fBParameters:\fP .RS 4 \fIifName\fP interface name .br \fIgateway\fP gateway address .br \fImss\fP mss value (i think this is the metric. in most cases this value is 0) .RE .PP .SS "int NetworkDiscovery::ip4_setManualConfiguration (QVariantMapresult)"replace the dhcp configuration with the manual config, entered by the user. if we can not establish a connection with the entered values, reset to the old dhcp values. .PP \fBParameters:\fP .RS 4 \fIresult\fP a json object formated string. .RE .PP \fBReturns:\fP .RS 4 0 if everything ok .RE .PP .SS "void NetworkDiscovery::prepareTryAgain ()" .SS "QString NetworkDiscovery::readLogFile ()"reads the log file. .PP \fBReturns:\fP .RS 4 the log file as one string. .RE .PP .SS "void NetworkDiscovery::readyForRun ()\fC [signal]\fP" .SS "void NetworkDiscovery::setManualConfInterfaces (QStringjsonArr)\fC [signal]\fP" .SS "void NetworkDiscovery::slotReadyForRun ()\fC [slot]\fP"emits the addInterface signal for each interface name in _ifUpList and calls the runDHCPCD method. if the _ifUpList is empty, this method emits an abortBoot signal. connected to the readyForRun signal. .SS "void NetworkDiscovery::tryAgain ()" .SS "void NetworkDiscovery::updateIfStatus (QStringifName, QStringstatus)\fC [signal]\fP" .SS "void NetworkDiscovery::updateStatus (QStringstatus)\fC [signal]\fP" .SH "Author" .PP Generated automatically by Doxygen for ndgui/NetworkDiscovery from the source code.