1 // Copyright (c) 2001-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef __SECURESOCKET_H__
23 #define __SECURESOCKET_H__
34 #include <securesocketinterface.h>
35 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
36 #include <securesocket_internal.h>
39 class MGenericSecureSocket;
41 class CSecureSocket : public CBase
43 * Secure sockets class.
49 // New secure sockets can be created through the static CSecureSocket::NewL method.
52 IMPORT_C static CSecureSocket* NewL(RSocket& aSocket,const TDesC& aProtocol);
53 IMPORT_C static CSecureSocket* NewL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
55 /** Standard destructor. */
58 // export CSecureSocket methods
59 IMPORT_C TInt AvailableCipherSuites( TDes8& aCiphers );
60 IMPORT_C void CancelAll();
61 IMPORT_C void CancelHandshake();
62 IMPORT_C void CancelRecv();
63 IMPORT_C void CancelSend();
64 IMPORT_C const CX509Certificate* ClientCert();
65 IMPORT_C TClientCertMode ClientCertMode();
66 IMPORT_C TDialogMode DialogMode();
67 IMPORT_C void Close();
68 IMPORT_C TInt CurrentCipherSuite( TDes8& aCipherSuite );
69 IMPORT_C void FlushSessionCache();
70 IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TDes8& aOption);
71 IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TInt& aOption);
72 IMPORT_C TInt Protocol(TDes& aProtocol);
73 IMPORT_C void Recv (TDes8& aDesc, TRequestStatus& aStatus );
74 IMPORT_C void RecvOneOrMore( TDes8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen );
75 IMPORT_C void RenegotiateHandshake(TRequestStatus& aStatus );
76 IMPORT_C void Send( const TDesC8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen );
77 IMPORT_C void Send( const TDesC8& aDesc, TRequestStatus& aStatus );
78 IMPORT_C const CX509Certificate* ServerCert();
79 IMPORT_C TInt SetAvailableCipherSuites(const TDesC8& aCiphers);
80 IMPORT_C TInt SetClientCert(const CX509Certificate& aCert);
81 IMPORT_C TInt SetClientCertMode(const TClientCertMode aClientCertMode);
82 IMPORT_C TInt SetDialogMode(const TDialogMode aDialogMode);
83 IMPORT_C TInt SetProtocol(const TDesC& aProtocol);
84 IMPORT_C TInt SetOpt(TUint aOptionName, TUint aOptionLevel, const TDesC8& aOption=TPtrC8(NULL,0));
85 IMPORT_C TInt SetOpt(TUint aOptionName, TUint aOptionLevel, TInt aOption);
86 IMPORT_C TInt SetServerCert(const CX509Certificate& aCert);
87 IMPORT_C void StartClientHandshake(TRequestStatus& aStatus);
88 IMPORT_C void StartServerHandshake(TRequestStatus& aStatus);
91 void ConstructL(RSocket& aSocket,const TDesC& aProtocol);
92 void ConstructL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
94 enum {ESecureSocketStateOpen, ESecureSocketStateClosed};
96 TUint iSecureSocketState;
99 MSecureSocket* iSecureImplementation;
102 #endif // __SECURESOCKET_H__