|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Implements the DHCPv4 States representing each interface |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file DHCPIP6States.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #include "DHCPIP6States.h" |
|
24 #include "DhcpIP6Msg.h" |
|
25 #include "DHCPIP6MsgSender.h" |
|
26 |
|
27 #include "DHCPServer.h" |
|
28 #include "DHCPStatesDebug.h" |
|
29 |
|
30 using namespace DHCPv6; |
|
31 |
|
32 #ifdef SYMBIAN_ESOCK_V3 |
|
33 CDHCPIP6ListenToNeighbor::~CDHCPIP6ListenToNeighbor() |
|
34 { |
|
35 if ( iNetSubscribe ) |
|
36 { |
|
37 iEvent.Cancel(*iNetSubscribe); |
|
38 } |
|
39 } |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 CAsynchEvent* CDHCPIP6ListenToNeighbor::ProcessL(TRequestStatus& aStatus) |
|
46 { |
|
47 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6ListenToNeighbor); |
|
48 //(static_cast<TEvent*>(this)->*iHandler)(); |
|
49 CDHCPIP6StateMachine& stmachine = DHCPIPv6(); |
|
50 //set us as an error event as well so that we catch the leave and can deregister if needed |
|
51 stmachine.SetErrorEvent( this ); |
|
52 stmachine.CancelTimer(); |
|
53 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::ProcessL err %d"), stmachine.LastError())); |
|
54 if ( iErr == KErrNone ) |
|
55 { |
|
56 iErr = stmachine.LastError(); |
|
57 if ( iErr == KErrNone || (iQuery && iQuery->iHandle) ) |
|
58 {//we can get here only when we want to subscribe or unsubscribe |
|
59 SubscribeL( stmachine.InterfaceName(), IPEvent::EMFlagReceived, iEvent ); |
|
60 } |
|
61 } |
|
62 if ( iErr == KErrNone && iQuery && iQuery->iHandle ) |
|
63 {//start timer in case we never get the signal |
|
64 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::ProcessL wait signal StartTimer"))); |
|
65 |
|
66 |
|
67 // The 14 second timeout comes from the 3x4 seconds the IP stack waits for RouterAdvs once it's sent out |
|
68 // its 3 RouterSols ... plus a bit for processing. Search for iRtrSolicitationInterval in tcpip/src/iface.cpp |
|
69 stmachine.StartTimer( TTimeIntervalSeconds(14)/*seconds*/, *this ); |
|
70 |
|
71 aStatus = KRequestPending; |
|
72 stmachine.SetAsyncCancelHandler(this); |
|
73 } |
|
74 else |
|
75 {//we're deregistered => start statemachine based on 'M' flag value |
|
76 ASSERT( this == DHCPIPv6().iFirstState ); |
|
77 CleanupStack::PushL(this); |
|
78 stmachine.iFirstState = NULL; |
|
79 stmachine.SetErrorEvent( NULL ); |
|
80 |
|
81 if (iErr == KErrTimedOut) |
|
82 { |
|
83 TimerExpired(); |
|
84 } |
|
85 else |
|
86 { |
|
87 // RA received |
|
88 if ( iMFlag ) |
|
89 { |
|
90 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("MFlag true. - Proceeding with Stateful"))); |
|
91 stmachine.StartInitL( NULL, CDHCPStateMachine::ESubsequentCalls ); |
|
92 } |
|
93 else |
|
94 { |
|
95 if( iOFlag ) |
|
96 { |
|
97 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("MFlag false, OFlag True - stateful autoconfiguration to get non-IPv6-address information"))); |
|
98 CompleteClientAndStartInform(); // complete client, as 'O' flag set - stateful autoconfiguration to get non-IPv6-address information |
|
99 } |
|
100 else |
|
101 { |
|
102 BecomeIdle(); // 'M' and 'O' flags are false |
|
103 } |
|
104 } |
|
105 } |
|
106 CleanupStack::PopAndDestroy(this); |
|
107 return stmachine.iFirstState; |
|
108 } |
|
109 stmachine.SetLastError( KErrNone ); //ignore the error |
|
110 return this; |
|
111 } |
|
112 |
|
113 /*static*/ |
|
114 void CDHCPIP6ListenToNeighbor::SignalHandlerFn( TAny* aThis, const Meta::SMetaData* aData ) |
|
115 { |
|
116 //Router Advt received, decide upon 'M' and 'O' flags |
|
117 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::SignalHandlerFn()"))); |
|
118 CDHCPIP6ListenToNeighbor* inst = reinterpret_cast<CDHCPIP6ListenToNeighbor*>(aThis); |
|
119 CDHCPIP6StateMachine& stmachine = inst->DHCPIPv6(); |
|
120 inst->iMFlag = static_cast<const IPEvent::CMFlagReceived*>(aData)->GetMFlag(); |
|
121 inst->iOFlag = static_cast<const IPEvent::CMFlagReceived*>(aData)->GetOFlag(); |
|
122 stmachine.CancelTimer(); |
|
123 TRequestStatus* p = &stmachine.iStatus; |
|
124 User::RequestComplete( p, KErrNone ); |
|
125 stmachine.SetAsyncCancelHandler(NULL); |
|
126 } |
|
127 |
|
128 void CDHCPIP6ListenToNeighbor::Cancel() |
|
129 { |
|
130 CDHCPIP6StateMachine& stmachine = DHCPIPv6(); |
|
131 stmachine.CancelTimer(); |
|
132 TRequestStatus* p = &stmachine.iStatus; |
|
133 User::RequestComplete( p, KErrCancel ); |
|
134 stmachine.SetAsyncCancelHandler(NULL); |
|
135 } |
|
136 |
|
137 |
|
138 void CDHCPIP6ListenToNeighbor::BecomeIdle() |
|
139 { |
|
140 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::BecomeIdle()"))); |
|
141 CDHCPIP6StateMachine& stmachine = DHCPIPv6(); |
|
142 TRequestStatus* p = &stmachine.iStatus; |
|
143 stmachine.SetIdle( ETrue ); |
|
144 User::RequestComplete( p, KErrNone ); |
|
145 stmachine.SetAsyncCancelHandler(NULL); |
|
146 } |
|
147 |
|
148 void CDHCPIP6ListenToNeighbor::CompleteClientAndStartInform() |
|
149 { |
|
150 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::CompleteClientAndStartInform()"))); |
|
151 CDHCPIP6StateMachine& stmachine = DHCPIPv6(); |
|
152 TRequestStatus* p = &stmachine.iStatus; |
|
153 stmachine.SetCompleteClientRequestTrue(); |
|
154 User::RequestComplete( p, KErrNone ); |
|
155 stmachine.SetAsyncCancelHandler(NULL); |
|
156 } |
|
157 |
|
158 |
|
159 void CDHCPIP6ListenToNeighbor::TimerExpired() |
|
160 { |
|
161 //start state-ful config since no signal received |
|
162 __CFLOG_VAR((KLogSubSysDHCP, KLogCode, _L8("CDHCPIP6ListenToNeighbor::TimerExpired()"))); |
|
163 CDHCPIP6StateMachine& stmachine = DHCPIPv6(); |
|
164 TRequestStatus* p = &stmachine.iStatus; |
|
165 User::RequestComplete( p, KErrTimedOut ); |
|
166 stmachine.SetAsyncCancelHandler(NULL); |
|
167 } |
|
168 #endif |
|
169 /** our selection criteria so far |
|
170 * - the first advertise msg received or the one with the highest |
|
171 * preference value |
|
172 * |
|
173 * some smarter selection criteria for server advertisements: |
|
174 * - Within a group of Advertise messages with the same server |
|
175 * preference value, a client MAY select those servers whose |
|
176 * Advertise messages advertise information of interest to the |
|
177 * client. For example, the client may choose a server that returned |
|
178 * an advertisement with configuration options of interest to the |
|
179 * client. |
|
180 * |
|
181 * - The client MAY choose a less-preferred server if that server has a |
|
182 * better set of advertised parameters, such as the available |
|
183 * addresses advertised in IAs. |
|
184 */ |
|
185 CAsynchEvent* CDHCPIP6Solicit::ProcessL(TRequestStatus& aStatus) |
|
186 { |
|
187 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Solicit); |
|
188 CDHCPIP6MessageSender* pSender = DHCPIPv6().MessageSender(); |
|
189 //ask for a signal after the first RT elapses |
|
190 pSender->SetMaxRetryCount( 1 ); |
|
191 pSender->SetMaxRetryTimeout( DHCPv6::KSolMaxRt ); |
|
192 TInt n = KIP6MaxSecs; |
|
193 if( iUserDefinedTimeout != 0 ) |
|
194 { |
|
195 n = iUserDefinedTimeout; |
|
196 } |
|
197 pSender->SetMaxRetryDuration( n ); |
|
198 pSender->SetInitialRetryTimeout( DHCPv6::KSolTimeout ); |
|
199 pSender->SetFirstSendDelay( DHCPv6::KSolMaxDelay ); |
|
200 //here we know that select follows after solicit |
|
201 pSender->SetListener(static_cast<CDHCPIP6Select*>(iNext)); |
|
202 return CDHCPAddressAcquisition::ProcessL( aStatus ); |
|
203 } |
|
204 |
|
205 void CDHCPIP6Select::SetMaxRetryCount(TInt aMaxRetryCount) |
|
206 { |
|
207 iMaxRetryCount = aMaxRetryCount; |
|
208 } |
|
209 |
|
210 const TInt KAdvertOverridePref = 255; |
|
211 CAsynchEvent* CDHCPIP6Select::ProcessL(TRequestStatus& aStatus) |
|
212 {//called when a message's been received or state's changed for us |
|
213 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Select); |
|
214 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
215 CDHCPIP6MessageSender* pSender = rDHCP.MessageSender(); |
|
216 CDHCPMessageHeaderIP6* v6Msg = rDHCP.DhcpMessage(); |
|
217 if(rDHCP.iReceiving || iDone) |
|
218 { // we're waiting to receive data from the socket |
|
219 /* |
|
220 collect advertisements so long we are waiting for the first retransmition timeout. |
|
221 Keep the first one and check the others for |
|
222 preference option with a pref value of 255. If the client receives an Advertise message |
|
223 that does not include a Preference option with a preference value of 255, the |
|
224 client continues to wait until the first RT elapses |
|
225 if pSender->Notifier() != this than the first RT's elapsed => we're happy |
|
226 with any message that is a valid advertisement |
|
227 */ |
|
228 rDHCP.iReceiving = EFalse; |
|
229 if(rDHCP.GetMessageType() == DHCPv6::EAdvertise) |
|
230 { |
|
231 /* |
|
232 examine the message and make decision based on the aforementioned |
|
233 selection criteria |
|
234 */ |
|
235 DHCPv6::COptionNode* option = v6Msg->GetOptions().FindOption(DHCPv6::EPreference); |
|
236 TInt serverPreference; |
|
237 if (option) |
|
238 { |
|
239 serverPreference = option->GetBigEndian(); |
|
240 } |
|
241 else |
|
242 { |
|
243 serverPreference = 0; |
|
244 } |
|
245 if(pSender->EventListener() != this || iDone || serverPreference == KAdvertOverridePref) |
|
246 { |
|
247 // We're not interested in further notifications |
|
248 pSender->SetListener( &rDHCP ); |
|
249 |
|
250 // Set-up sender, consume selected advertisement & initiate request |
|
251 // message |
|
252 pSender->SetMaxRetryCount(DHCPv6::KReqMaxRc); |
|
253 pSender->SetMaxRetryTimeout(DHCPv6::KReqMaxRt); |
|
254 pSender->SetMaxRetryDuration(KIP6MaxSecs); |
|
255 pSender->SetInitialRetryTimeout(DHCPv6::KReqTimeout); |
|
256 pSender->SetFirstSendDelay(0); |
|
257 |
|
258 if ( !iDone/*see CDHCPIP6Select::MSReportError*/ && iSelectedMessage.Length() ) |
|
259 { |
|
260 // Copy the selected message back the max length must be enough since we've read |
|
261 //iSelectedMessage into the v6Msg buffer |
|
262 v6Msg->Message().Des().Copy(iSelectedMessage); |
|
263 } |
|
264 |
|
265 return CDHCPSelect::ProcessL(aStatus); |
|
266 } |
|
267 else |
|
268 { // Work out if this advertisment's better for us |
|
269 |
|
270 if(serverPreference > iBestServerPreference ) |
|
271 { |
|
272 iBestServerPreference = serverPreference; |
|
273 |
|
274 // Store a copy away for later |
|
275 TInt ret= iSelectedMessage.ReAlloc(v6Msg->Message().Length()); |
|
276 if (ret == KErrNone) |
|
277 iSelectedMessage.Copy(v6Msg->Message()); |
|
278 else |
|
279 User::LeaveIfError(ret); |
|
280 } |
|
281 } |
|
282 } |
|
283 } |
|
284 |
|
285 // wait for a message (next or the first) |
|
286 return rDHCP.ReceiveL(&aStatus); |
|
287 } |
|
288 |
|
289 /* |
|
290 This method is called when the retransmission timer expires. |
|
291 */ |
|
292 TInt CDHCPIP6Select::MSReportError(TInt aError) |
|
293 {//called when the first RT's expired |
|
294 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
295 CDHCPIP6MessageSender* pSender = rDHCP.MessageSender(); |
|
296 if(aError == KErrTimedOut) |
|
297 { |
|
298 /* |
|
299 the first RT's elapsed so check the collected messages |
|
300 if we have one (the first one) we're done if not we start the sender again |
|
301 */ |
|
302 |
|
303 if (iBestServerPreference != -1) |
|
304 { |
|
305 pSender->Cancel(); |
|
306 iDone = ETrue; |
|
307 rDHCP.CancelMessageReceiver(); |
|
308 |
|
309 // Copy the selected message back the max length must be enough since we've read |
|
310 //iSelectedMessage into the v6Msg buffer |
|
311 rDHCP.DhcpMessage()->Message().Des().Copy(iSelectedMessage); |
|
312 |
|
313 return aError; |
|
314 } |
|
315 else |
|
316 { |
|
317 // We're not interested in further notifications |
|
318 pSender->SetListener(&rDHCP); |
|
319 pSender->SetMaxRetryCount(iMaxRetryCount); |
|
320 |
|
321 return KErrNone; // Causes the sender to continue |
|
322 } |
|
323 } |
|
324 |
|
325 // Something else's gone wrong => report it up |
|
326 pSender->SetListener(&rDHCP); |
|
327 |
|
328 return rDHCP.MSReportError(aError); |
|
329 } |
|
330 |
|
331 CDHCPIP6Select::~CDHCPIP6Select() |
|
332 { |
|
333 iSelectedMessage.Close(); |
|
334 } |
|
335 |
|
336 CAsynchEvent* CDHCPIP6InformRequest::ProcessL(TRequestStatus& aStatus) |
|
337 { |
|
338 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6InformRequest); |
|
339 CDHCPIP6MessageSender* pSender = DHCPIPv6().MessageSender(); |
|
340 pSender->SetMaxRetryCount( INT_MAX ); |
|
341 pSender->SetMaxRetryTimeout( DHCPv6::KInfMaxRt ); |
|
342 pSender->SetMaxRetryDuration( KIP6MaxSecs ); |
|
343 pSender->SetInitialRetryTimeout( DHCPv6::KInfTimeout ); |
|
344 pSender->SetFirstSendDelay( DHCPv6::KInfMaxDelay ); |
|
345 return CDHCPInformationConfig::ProcessL( aStatus ); |
|
346 } |
|
347 |
|
348 CAsynchEvent* CDHCPIP6Release::ProcessL(TRequestStatus& aStatus) |
|
349 { |
|
350 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Release); |
|
351 CDHCPIP6MessageSender* pSender = DHCPIPv6().MessageSender(); |
|
352 pSender->SetMaxRetryCount( DHCPv6::KRelMaxRc ); |
|
353 pSender->SetMaxRetryTimeout( KIP6MaxSecs ); |
|
354 pSender->SetMaxRetryDuration( KIP6MaxSecs ); |
|
355 pSender->SetInitialRetryTimeout( DHCPv6::KRelTimeout ); |
|
356 pSender->SetFirstSendDelay( 0 ); |
|
357 CDHCPRelease::ProcessL( aStatus ); //this fn doesn't actually complete status for v6 |
|
358 iStateMachine->SetActiveEvent( iNext ); //to shift the state after the receiver is ready |
|
359 return DHCPIPv6().ReceiveL( &aStatus ); |
|
360 } |
|
361 |
|
362 CAsynchEvent* CDHCPIP6Decline::ProcessL(TRequestStatus& aStatus) |
|
363 { |
|
364 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Decline); |
|
365 CDHCPIP6MessageSender* pSender = DHCPIPv6().MessageSender(); |
|
366 pSender->SetMaxRetryCount( DHCPv6::KDecMaxRc ); |
|
367 pSender->SetMaxRetryTimeout( KIP6MaxSecs ); |
|
368 pSender->SetMaxRetryDuration( KIP6MaxSecs ); |
|
369 pSender->SetInitialRetryTimeout( DHCPv6::KDecTimeout ); |
|
370 pSender->SetFirstSendDelay( 0 ); |
|
371 CDHCPDecline::ProcessL( aStatus ); //this fn doesn't actually complete status for v6 |
|
372 iStateMachine->SetActiveEvent( iNext ); //to shift the state after the receiver is ready |
|
373 return DHCPIPv6().ReceiveL( &aStatus ); |
|
374 } |
|
375 |
|
376 CDHCPState* CDHCPIP6ReplyNoBinding::ProcessAckNakL(TRequestStatus* aStatus) |
|
377 { |
|
378 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
379 if ( rDHCP.GetMessageType() == DHCPv6::EReply ) |
|
380 { |
|
381 rDHCP.CancelMessageSender(); |
|
382 rDHCP.iReceiving = EFalse; |
|
383 User::RequestComplete(aStatus, KErrNone); |
|
384 return static_cast<CDHCPState*>(iNext); |
|
385 } |
|
386 return rDHCP.ReceiveL( aStatus ); |
|
387 } |
|
388 |
|
389 CAsynchEvent* CDHCPIP6Confirm::ProcessL(TRequestStatus& aStatus) |
|
390 { |
|
391 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Confirm); |
|
392 CDHCPIP6MessageSender* pSender = DHCPIPv6().MessageSender(); |
|
393 pSender->SetMaxRetryCount( INT_MAX ); |
|
394 pSender->SetMaxRetryTimeout( DHCPv6::KCnfMaxRt ); |
|
395 pSender->SetMaxRetryDuration( DHCPv6::KCnfMaxRd ); |
|
396 pSender->SetInitialRetryTimeout( DHCPv6::KCnfTimeout ); |
|
397 pSender->SetFirstSendDelay( DHCPv6::KCnfMaxDelay ); |
|
398 return CDHCPRebootConfirm::ProcessL( aStatus ); |
|
399 } |
|
400 |
|
401 #if 0 |
|
402 CAsynchEvent* CDHCPIP6WaitForDAD::ProcessL(TRequestStatus& aStatus) |
|
403 { |
|
404 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6WaitForDAD); |
|
405 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
406 rDHCP.StartTimer(KOneSecond*20, *this); // 20 secs timer in case there's no response from IPNotifier. |
|
407 if (iAddressIndex == 1 && !CSubscribeChannel::ListenL(aStatus,event,rDHCP.C32Root())) |
|
408 { |
|
409 return this; |
|
410 } |
|
411 else |
|
412 { |
|
413 //read channel data and if success then attempt to bind to verify the result |
|
414 |
|
415 if ( rDHCP.ConfigureInterface( iAddressIndex++ ) ) |
|
416 {//set the next address as iCurrentAddress |
|
417 //and listen for DAD |
|
418 CSubscribeChannel::ListenL(aStatus,event,rDHCP.C32Root()); |
|
419 return this; |
|
420 } |
|
421 } |
|
422 return iNext; |
|
423 } |
|
424 #else |
|
425 CAsynchEvent* CDHCPIP6WaitForDAD::ProcessL(TRequestStatus& aStatus) |
|
426 { |
|
427 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6WaitForDAD); |
|
428 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
429 if (iAddressIndex == 0) |
|
430 {//start the first wait |
|
431 iAddressIndex++; |
|
432 CDHCPWaitForDADBind::ProcessL( aStatus ); |
|
433 return this; |
|
434 } |
|
435 else if ( iErr != KErrNone ) |
|
436 {//Mark the iAddressIndex as invalid and attempt to bind the next one |
|
437 rDHCP.iInterfaceConfigInfo.SetAddressStatus( iAddressIndex -1, DHCPv6::EMarkForDecline ); |
|
438 rDHCP.ConfigureInterfaceL( iAddressIndex++ ); |
|
439 //listen for DAD |
|
440 CDHCPWaitForDADBind::ProcessL( aStatus ); |
|
441 return this; |
|
442 } |
|
443 else |
|
444 {//Mark all but iAddressIndex as invalid |
|
445 } |
|
446 TRequestStatus* p = &aStatus; |
|
447 User::RequestComplete(p, iErr); |
|
448 return iNext; |
|
449 } |
|
450 |
|
451 void CDHCPIP6WaitForDAD::TimerExpired() |
|
452 { |
|
453 CDHCPWaitForDADBind::TimerExpired(); |
|
454 CDHCPStateMachine& rDHCP = Dhcp(); |
|
455 if ( !rDHCP.TimerActive() ) |
|
456 { |
|
457 //finish either => bound or not => bouncwe back to CDHCPIP6WaitForDAD::ProcessL |
|
458 TRequestStatus* p = &iStateMachine->iStatus; |
|
459 User::RequestComplete(p, KErrNone); //proceed back to the process function |
|
460 rDHCP.SetAsyncCancelHandler(NULL); |
|
461 } |
|
462 } |
|
463 #endif |
|
464 |
|
465 CAsynchEvent* CDHCPIP6Renew::ProcessL(TRequestStatus& aStatus) |
|
466 { |
|
467 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Renew); |
|
468 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
469 CDHCPIP6MessageSender* pSender = rDHCP.MessageSender(); |
|
470 pSender->SetMaxRetryCount( INT_MAX ); |
|
471 pSender->SetMaxRetryTimeout( DHCPv6::KRenMaxRt ); |
|
472 TInt n = rDHCP.iRebindTimeT2 - rDHCP.iRenewalTimeT1; |
|
473 if(iUserDefinedTimeout) |
|
474 { |
|
475 n = iUserDefinedTimeout; |
|
476 } |
|
477 else if ( n <= 0 ) |
|
478 { |
|
479 n = 2; //2 seconds |
|
480 } |
|
481 pSender->SetMaxRetryDuration( n ); |
|
482 pSender->SetInitialRetryTimeout( DHCPv6::KRenTimeout ); |
|
483 pSender->SetFirstSendDelay( 0 ); |
|
484 return CDHCPRenew::ProcessL( aStatus ); |
|
485 } |
|
486 |
|
487 CAsynchEvent* CDHCPIP6Rebind::ProcessL(TRequestStatus& aStatus) |
|
488 { |
|
489 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Rebind); |
|
490 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
491 CDHCPIP6MessageSender* pSender = rDHCP.MessageSender(); |
|
492 pSender->SetMaxRetryCount( INT_MAX ); |
|
493 pSender->SetMaxRetryTimeout( DHCPv6::KRebMaxRt ); |
|
494 TInt n = rDHCP.iLeaseTime - rDHCP.iRebindTimeT2; |
|
495 if(iUserDefinedTimeout) |
|
496 { |
|
497 n = iUserDefinedTimeout; |
|
498 } |
|
499 else if ( n <= 0 ) |
|
500 { |
|
501 n = 2; //2 seconds |
|
502 } |
|
503 pSender->SetMaxRetryDuration( n ); |
|
504 pSender->SetInitialRetryTimeout( DHCPv6::KRebTimeout ); |
|
505 pSender->SetFirstSendDelay( 0 ); |
|
506 return CDHCPRebind::ProcessL( aStatus ); |
|
507 } |
|
508 |
|
509 CAsynchEvent* CDHCPIP6Reconfigure::ProcessL(TRequestStatus& aStatus) |
|
510 { |
|
511 DHCP_DEBUG_PUBLISH_STATE(DHCPDebug::EDHCPIP6Reconfigure); |
|
512 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
513 if (!rDHCP.iReceiving) |
|
514 { |
|
515 rDHCP.InitialiseSocketL(); |
|
516 } |
|
517 return CDHCPRequest::ProcessL(aStatus); |
|
518 } |
|
519 |
|
520 CDHCPState* CDHCPIP6Reconfigure::ProcessAckNakL(TRequestStatus* aStatus) |
|
521 {//check for reconfigure reply msg |
|
522 CDHCPIP6StateMachine& rDHCP = DHCPIPv6(); |
|
523 if ( rDHCP.GetMessageType() == DHCPv6::EReconfigure ) |
|
524 { |
|
525 rDHCP.iReceiving = EFalse; |
|
526 User::RequestComplete(aStatus, KErrNone); |
|
527 return static_cast<CDHCPState*>(iNext); |
|
528 } |
|
529 return rDHCP.ReceiveL( aStatus ); |
|
530 } |