natfw/natfwstunturnclient/tsrc/ut_stunturnclient/inc/ut_cstunbindinggetaddress.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __UT_CSTUNBINDINGGETADDRESS_H__
       
    22 #define __UT_CSTUNBINDINGGETADDRESS_H__
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <digia/eunit/ceunittestsuiteclass.h>
       
    26 #include <digia/eunit/EUnitDecorators.h>
       
    27 #include <es_sock.h>
       
    28 
       
    29 
       
    30 //  INTERNAL INCLUDES
       
    31 #include "natfwstunclient.h"
       
    32 #include "cncmconnectionmultiplexer.h"
       
    33 #include "mncmconnectionmultiplexerobserver.h"
       
    34 #include "natfwstunclientobserver.h"
       
    35 #include "mstunbindingobserver.h"
       
    36 #include "cstunbindinggetaddress.h"
       
    37 
       
    38 //  FORWARD DECLARATIONS
       
    39 class CSTUNBinding;
       
    40 class CSTUNBindingImplementation;
       
    41 
       
    42 
       
    43 //  CLASS DEFINITION
       
    44 /**
       
    45  * TODO Auto-generated test suite
       
    46  *
       
    47  */
       
    48 NONSHARABLE_CLASS( ut_cstunbindinggetaddress )
       
    49      : public CEUnitTestSuiteClass, public MSTUNClientObserver, 
       
    50        public MNcmConnectionMultiplexerObserver,
       
    51        public MSTUNBindingObserver
       
    52     {
       
    53     public:     // Constructors and destructors
       
    54 
       
    55         /**
       
    56          * Two phase construction
       
    57          */
       
    58         static ut_cstunbindinggetaddress* NewL();
       
    59         static ut_cstunbindinggetaddress* NewLC();
       
    60         /**
       
    61          * Destructor
       
    62          */
       
    63         ~ut_cstunbindinggetaddress();
       
    64 
       
    65     private:    // Constructors and destructors
       
    66 
       
    67         ut_cstunbindinggetaddress();
       
    68         void ConstructL();
       
    69 
       
    70     public:     // From mstunclientobserver
       
    71 
       
    72         void STUNClientInitCompleted( const CSTUNClient& aClient,
       
    73                                       TInt aCompletionCode );   
       
    74     
       
    75 
       
    76         void STUNBindingEventOccurredL( TSTUNBindingEvent aEvent, 
       
    77                                         const CBinding& aBinding );
       
    78 
       
    79 
       
    80         void STUNBindingErrorOccurred( const CBinding& aBinding, 
       
    81                                        TInt aError );
       
    82 
       
    83     public:     // From MNcmConnectionMultiplexerObserver
       
    84     
       
    85         void Notify( TUint aSessionId, TUint aStreamId, TNotifyType aType, TInt aError );
       
    86         
       
    87     public: // From MSTUNBindingObserver
       
    88 
       
    89         const CSTUNClient& STUNClient() const;
       
    90 
       
    91         CDeltaTimer& TimerProvider();
       
    92         
       
    93         TInt RetransmitInterval() const;
       
    94         
       
    95         TTransportProtocol TransportProtocol() const;
       
    96         
       
    97         void AddressResolvedL( const CBinding& aBinding ) const;
       
    98 
       
    99         void ObtainSharedSecretL( CBinding& aBinding );
       
   100 
       
   101         TBool SharedSecretRejectedL( const CBinding& aBinding,
       
   102                                      const TDesC8& aUsername,
       
   103                                         const TDesC8& aPassword );
       
   104 
       
   105         TBool ObtainServerAddress( TInetAddr& aAddress );
       
   106         
       
   107         void ObtainTransactionIDL( TNATFWUNSAFTransactionID& aTransactionID );
       
   108 
       
   109         void AttachBindingL( const CBinding& aBinding );
       
   110 
       
   111         void DetachBinding( const CBinding& aBinding );
       
   112         
       
   113         void BindingErrorL( const CBinding& aBinding, TInt aError, TBool aIsFatal );
       
   114         
       
   115         void BindingEventOccurred( const CBinding& aBinding, 
       
   116                                    TSTUNCallbackInfo::TFunction aEvent );
       
   117                                            
       
   118         const TDesC8& UsernameForIndication();
       
   119 
       
   120         const TDesC8& PasswordForIndication();
       
   121         
       
   122 
       
   123     private:    // New methods
       
   124 
       
   125          void SetupL();
       
   126         
       
   127          void Teardown();
       
   128         
       
   129          void T_CSTUNBindingGetAddress__CSTUNBindingGetAddressL();
       
   130         
       
   131          void T_CSTUNBindingGetAddress_PublicAddressReceivedLL();
       
   132         
       
   133          void T_CSTUNBindingGetAddress_PublicAddressReceivedL2L();
       
   134         
       
   135          void T_CSTUNBindingGetAddress_TransactionErrorL();
       
   136         
       
   137          void T_CSTUNBindingGetAddress_SendRequestLL();
       
   138         
       
   139          void T_CSTUNBindingGetAddress_SetNeighbourStatesL();
       
   140         
       
   141 
       
   142     private:    // Data
       
   143 		
       
   144         CSTUNBindingGetAddress* iCSTUNBindingGetAddress;
       
   145         EUNIT_DECLARE_TEST_TABLE; 
       
   146 
       
   147         CSTUNBinding* iBinding;
       
   148         CSTUNBindingImplementation* iImpl;
       
   149         RSocketServ iSocketServ;
       
   150         RConnection iConnection;
       
   151         CDeltaTimer* iDeltatimer;
       
   152         CSTUNClient* iStunclient;
       
   153         TUint iStreamId;
       
   154         TUint iSubstreamId;
       
   155         CNcmConnectionMultiplexer* iMux;
       
   156         RSocket iSocket;
       
   157         TRequestStatus iStatus;
       
   158     };
       
   159 
       
   160 #endif      //  __UT_CSTUNBINDINGGETADDRESS_H__
       
   161 
       
   162 // End of file