epoc32/include/securesocket.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Secure Sockets
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20 */
    21 
    22 #ifndef __SECURESOCKET_H__
    23 #define __SECURESOCKET_H__
    24 
    25 #include <e32base.h>
    26 #include <e32cons.h>
    27 #include <c32comm.h>
    28 #include <es_sock.h>
    29 #include <ssl.h>
    30 
    31 #include <sslerr.h>
    32 #include <x509cert.h>
    33 
    34 #include <securesocketinterface.h>
    35 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    36 #include <securesocket_internal.h>
    37 #endif
    38 
    39 class MGenericSecureSocket;
    40 
    41 class CSecureSocket : public CBase
    42 /** 
    43  * Secure sockets class. 
    44  * 
    45  * @publishedAll
    46  * @released
    47  *
    48  * @since v6.2 */
    49  // New secure sockets can be created through the static CSecureSocket::NewL method.
    50 	{
    51 public:
    52 	IMPORT_C static CSecureSocket* NewL(RSocket& aSocket,const TDesC& aProtocol);
    53 	IMPORT_C static CSecureSocket* NewL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
    54 
    55 	/** Standard destructor. */
    56 	~CSecureSocket();
    57  
    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);	
    89 
    90 private:
    91 	void ConstructL(RSocket& aSocket,const TDesC& aProtocol);
    92 	void ConstructL(MGenericSecureSocket& aSocket,const TDesC& aProtocol);
    93 
    94 	enum {ESecureSocketStateOpen, ESecureSocketStateClosed};
    95 
    96 	TUint iSecureSocketState;
    97 
    98 	TInt iUNUSED;
    99 	MSecureSocket* iSecureImplementation;
   100 	};
   101 
   102 #endif // __SECURESOCKET_H__