pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnection.h
branchRCL_3
changeset 21 09b1ac925e3f
equal deleted inserted replaced
20:63339781d179 21:09b1ac925e3f
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Secure connections test application
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_TESTTLSCONNECTION_H
       
    19 #define C_TESTTLSCONNECTION_H
       
    20 
       
    21 #include <es_sock.h>                    // RConnection
       
    22 #include <in_sock.h>                    // TInetAddr
       
    23 #include <commdbconnpref.h>             // TCommDbConnPref
       
    24 #include "tlsconnectionobserver.h"      // MTlsConnectionObserver, TTlsConnectionState
       
    25 
       
    26 class CSecureSocket;
       
    27 
       
    28 
       
    29 class CTlsConnection : public CActive
       
    30     {
       
    31     public:     // new functions
       
    32         static CTlsConnection* NewL( MTlsConnectionObserver& aObs );
       
    33         ~CTlsConnection();
       
    34         void ConnectL( const TDesC& aHostName, TInt aPort, TInt aDelay );
       
    35         void Disconnect();
       
    36 
       
    37     protected:  // from CActive
       
    38         void RunL();
       
    39         void DoCancel();
       
    40         TInt RunError( TInt aError );
       
    41 
       
    42     private:    // constructors
       
    43         CTlsConnection( MTlsConnectionObserver& aObs );
       
    44         void ConstructL();
       
    45 
       
    46     private:    // new functions
       
    47         void CloseConnection();
       
    48         void CloseSession();
       
    49         void StateChange( TTlsConnectionState aNewState, TInt aError = KErrNone );
       
    50         void ReadL();
       
    51 
       
    52     private:    // data
       
    53         MTlsConnectionObserver& iObserver;
       
    54         RConnection iConnection;
       
    55         RSocketServ iSockServer;
       
    56         TCommDbConnPref iConnPref;
       
    57         TUint32 iCurrentIap;
       
    58         TNifProgressBuf iProgress;
       
    59         HBufC* iHostName;
       
    60         HBufC8* iHostNameForCertCheck;
       
    61         TInt iPort;
       
    62         TInt iDelay;
       
    63         RHostResolver iHostResolver;
       
    64         TNameEntry iNameEntry;
       
    65         TInetAddr iRemoteAddr;
       
    66         RSocket iSocket;
       
    67         CSecureSocket* iSecureSocket;
       
    68         HBufC8* iRecvBuffer;
       
    69         TPtr8* iRecvBufPtr;
       
    70         TSockXfrLength iRecvLength;
       
    71         HBufC8* iSendBuffer;
       
    72         TPtr8* iSendBufPtr;
       
    73         TSockXfrLength iSendLength;
       
    74         TInt iTotalRecvCount;
       
    75         TTlsConnectionState iState;
       
    76         RTimer iDelayTimer;
       
    77     };
       
    78 
       
    79 
       
    80 #endif // C_TESTTLSCONNECTION_H
       
    81