summaryrefslogtreecommitdiffstats
path: root/doxygen/man/man3/NetworkDiscovery.3
blob: 98c10447c21db9361d325c6510e77688bf2be8b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
.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 <networkdiscovery.h>\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 <interfaceName>;<state>;<subState>;<msg> ) 
.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: <interfaceName>'. 
.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.