|
1 // Copyright (c) 2003-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 // Hello Request message implementation file. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "hellorequest.h" |
|
23 |
|
24 |
|
25 CHelloRequest::CHelloRequest( CTlsConnection& aTlsConnection, CStateMachine& aStateMachine ) : |
|
26 CHandshakeReceive( aTlsConnection.TlsProvider(), aStateMachine, aTlsConnection.RecordParser() ), |
|
27 iTlsConnection( aTlsConnection ) |
|
28 { |
|
29 } |
|
30 |
|
31 TBool CHelloRequest::AcceptMessage( const TUint8 aHandshakeType ) const |
|
32 { |
|
33 LOG(Log::Printf(_L("CHelloRequest::AcceptMessage()\n"));) |
|
34 |
|
35 __ASSERT_DEBUG( (iStateMachine->History() == KTlsApplicationData), TlsPanic(ETlsPanicHelloRequestRecWhileInAppData )); |
|
36 return aHandshakeType == ETlsHelloRequestMsg; |
|
37 } |
|
38 |
|
39 CAsynchEvent* CHelloRequest::ProcessL( TRequestStatus& aStatus ) |
|
40 { |
|
41 LOG(Log::Printf(_L("CHelloRequest::ProcessL()\n"));) |
|
42 |
|
43 CStateMachine* pSendAppData = (CStateMachine*)iTlsConnection.SendAppData(); |
|
44 __ASSERT_DEBUG( pSendAppData, TlsPanic(ETlsPanicNullStateMachine)); |
|
45 |
|
46 if ( pSendAppData->ClientStatus() ) |
|
47 { //ok lets wait till the ongoing data is send under current crypto & compression |
|
48 pSendAppData->RegisterNotify( this ); |
|
49 } |
|
50 else |
|
51 { //start renegotiation since app data send SM stoped |
|
52 iTlsConnection.StartRenegotiation( &aStatus ); //iStateMachine will wait for re-negotiation |
|
53 //to complete |
|
54 //!!!at this stage 'this' has been deleted |
|
55 } |
|
56 |
|
57 //iStateMachine will wait for re-negotiation => no |
|
58 //User::RequestComplete( KErrNone ); is called |
|
59 |
|
60 return NULL; //once the renegotiation has completed the iStateMachine stops |
|
61 } |
|
62 |
|
63 TBool CHelloRequest::OnCompletion( CStateMachine* aStateMachine ) |
|
64 { |
|
65 LOG(Log::Printf(_L("CHelloRequest::OnCompletion()\n"));) |
|
66 |
|
67 //ok the app data has been sent |
|
68 //deregister this as a notifier |
|
69 aStateMachine->DeRegisterNotify( this ); |
|
70 //and register iTlsConnection back again |
|
71 //(we could as well remember what has been registered but since it's always |
|
72 //iTlsConnection .....) |
|
73 aStateMachine->RegisterNotify( &iTlsConnection ); |
|
74 iTlsConnection.StartRenegotiation( &iStateMachine->iStatus ); //iStateMachine will wait for re-negotiation |
|
75 //to complete |
|
76 //!!!at this stage this has been deleted |
|
77 |
|
78 return EFalse; //don't want delete Data Send State Machine |
|
79 } |
|
80 |