|
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 // |
|
15 |
|
16 #ifndef __CSECURESOCKETCONTROLLER_H__ |
|
17 #define __CSECURESOCKETCONTROLLER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "chttpsecuresocket.h" |
|
22 |
|
23 class CSecureSocket; |
|
24 |
|
25 class CSecureSocketController : public CHttpSecureSocket |
|
26 /** |
|
27 This controller class manages secure socket connections for the provided |
|
28 socket. This class handles the connecting and handshaking of the secure |
|
29 socket and allows the clients to continue using the secure socket as they |
|
30 would a normal socket. |
|
31 @internalComponent |
|
32 */ |
|
33 { |
|
34 public: // methods |
|
35 |
|
36 static CSecureSocketController* NewL(TAny* aInitParams); |
|
37 |
|
38 virtual ~CSecureSocketController(); |
|
39 |
|
40 void StartSecureHandshakeL(TRequestStatus& aStatus, const TDesC8& aHostName); |
|
41 |
|
42 void RecvOneOrMore(TDes8& aBuffer, TRequestStatus& aStatus, TSockXfrLength& aLength); |
|
43 |
|
44 void CancelRecv(); |
|
45 |
|
46 void Send(const TDesC8& aBuffer, TRequestStatus& aStatus); |
|
47 |
|
48 void CancelSend(); |
|
49 |
|
50 const CX509Certificate* ServerCert(); |
|
51 |
|
52 void CancelHandshake(); |
|
53 |
|
54 TInt CipherSuite(TDes8& aCipherSuite); |
|
55 |
|
56 TInt PendingBytesToRead (); |
|
57 |
|
58 private: // methods |
|
59 |
|
60 CSecureSocketController(RSocket& aSocket, MCommsInfoProvider& aCommsInfoProvider); |
|
61 |
|
62 |
|
63 private: // attributes |
|
64 |
|
65 /** The socket that requires a secure connection, should already be opened and |
|
66 takes ownership. |
|
67 */ |
|
68 RSocket& iSocket; |
|
69 |
|
70 /** Reference to the Comms infomation provider for security preferences. |
|
71 */ |
|
72 MCommsInfoProvider& iCommsInfoProvider; |
|
73 |
|
74 /** The secure socket layer. Created when once a connection has been made. |
|
75 */ |
|
76 CSecureSocket* iTlsSocket; |
|
77 |
|
78 }; |
|
79 |
|
80 #endif // __CSECURESOCKETCONTROLLER_H__ |