williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// Secure Sockets
|
williamr@2
|
15 |
//
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
@file
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#ifndef __SECURESOCKET_H__
|
williamr@2
|
23 |
#define __SECURESOCKET_H__
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#include <e32base.h>
|
williamr@2
|
26 |
#include <e32cons.h>
|
williamr@2
|
27 |
#include <c32comm.h>
|
williamr@2
|
28 |
#include <es_sock.h>
|
williamr@2
|
29 |
#include <ssl.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
#include <sslerr.h>
|
williamr@2
|
32 |
#include <x509cert.h>
|
williamr@2
|
33 |
|
williamr@2
|
34 |
#include <securesocketinterface.h>
|
williamr@4
|
35 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@4
|
36 |
#include <securesocket_internal.h>
|
williamr@4
|
37 |
#endif
|
williamr@2
|
38 |
|
williamr@2
|
39 |
class MGenericSecureSocket;
|
williamr@2
|
40 |
|
williamr@2
|
41 |
class CSecureSocket : public CBase
|
williamr@2
|
42 |
/**
|
williamr@2
|
43 |
* Secure sockets class.
|
williamr@2
|
44 |
*
|
williamr@2
|
45 |
* @publishedAll
|
williamr@2
|
46 |
* @released
|
williamr@2
|
47 |
*
|
williamr@2
|
48 |
* @since v6.2 */
|
williamr@2
|
49 |
// New secure sockets can be created through the static CSecureSocket::NewL method.
|
williamr@2
|
50 |
{
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
IMPORT_C static CSecureSocket* NewL(RSocket& aSocket,const TDesC& aProtocol);
|
williamr@2
|
53 |
IMPORT_C static CSecureSocket* NewL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
|
williamr@2
|
54 |
|
williamr@2
|
55 |
/** Standard destructor. */
|
williamr@2
|
56 |
~CSecureSocket();
|
williamr@2
|
57 |
|
williamr@2
|
58 |
// export CSecureSocket methods
|
williamr@2
|
59 |
IMPORT_C TInt AvailableCipherSuites( TDes8& aCiphers );
|
williamr@2
|
60 |
IMPORT_C void CancelAll();
|
williamr@2
|
61 |
IMPORT_C void CancelHandshake();
|
williamr@2
|
62 |
IMPORT_C void CancelRecv();
|
williamr@2
|
63 |
IMPORT_C void CancelSend();
|
williamr@2
|
64 |
IMPORT_C const CX509Certificate* ClientCert();
|
williamr@2
|
65 |
IMPORT_C TClientCertMode ClientCertMode();
|
williamr@2
|
66 |
IMPORT_C TDialogMode DialogMode();
|
williamr@2
|
67 |
IMPORT_C void Close();
|
williamr@2
|
68 |
IMPORT_C TInt CurrentCipherSuite( TDes8& aCipherSuite );
|
williamr@2
|
69 |
IMPORT_C void FlushSessionCache();
|
williamr@2
|
70 |
IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TDes8& aOption);
|
williamr@2
|
71 |
IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TInt& aOption);
|
williamr@2
|
72 |
IMPORT_C TInt Protocol(TDes& aProtocol);
|
williamr@2
|
73 |
IMPORT_C void Recv (TDes8& aDesc, TRequestStatus& aStatus );
|
williamr@2
|
74 |
IMPORT_C void RecvOneOrMore( TDes8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen );
|
williamr@2
|
75 |
IMPORT_C void RenegotiateHandshake(TRequestStatus& aStatus );
|
williamr@2
|
76 |
IMPORT_C void Send( const TDesC8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen );
|
williamr@2
|
77 |
IMPORT_C void Send( const TDesC8& aDesc, TRequestStatus& aStatus );
|
williamr@2
|
78 |
IMPORT_C const CX509Certificate* ServerCert();
|
williamr@2
|
79 |
IMPORT_C TInt SetAvailableCipherSuites(const TDesC8& aCiphers);
|
williamr@2
|
80 |
IMPORT_C TInt SetClientCert(const CX509Certificate& aCert);
|
williamr@2
|
81 |
IMPORT_C TInt SetClientCertMode(const TClientCertMode aClientCertMode);
|
williamr@2
|
82 |
IMPORT_C TInt SetDialogMode(const TDialogMode aDialogMode);
|
williamr@2
|
83 |
IMPORT_C TInt SetProtocol(const TDesC& aProtocol);
|
williamr@2
|
84 |
IMPORT_C TInt SetOpt(TUint aOptionName, TUint aOptionLevel, const TDesC8& aOption=TPtrC8(NULL,0));
|
williamr@2
|
85 |
IMPORT_C TInt SetOpt(TUint aOptionName, TUint aOptionLevel, TInt aOption);
|
williamr@2
|
86 |
IMPORT_C TInt SetServerCert(const CX509Certificate& aCert);
|
williamr@2
|
87 |
IMPORT_C void StartClientHandshake(TRequestStatus& aStatus);
|
williamr@2
|
88 |
IMPORT_C void StartServerHandshake(TRequestStatus& aStatus);
|
williamr@2
|
89 |
|
williamr@2
|
90 |
private:
|
williamr@2
|
91 |
void ConstructL(RSocket& aSocket,const TDesC& aProtocol);
|
williamr@2
|
92 |
void ConstructL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
|
williamr@2
|
93 |
|
williamr@2
|
94 |
enum {ESecureSocketStateOpen, ESecureSocketStateClosed};
|
williamr@2
|
95 |
|
williamr@2
|
96 |
TUint iSecureSocketState;
|
williamr@2
|
97 |
|
williamr@4
|
98 |
TInt iUNUSED;
|
williamr@2
|
99 |
MSecureSocket* iSecureImplementation;
|
williamr@2
|
100 |
};
|
williamr@2
|
101 |
|
williamr@2
|
102 |
#endif // __SECURESOCKET_H__
|