realtimenetprots/sipfw/SIP/ConnectionMgr/src/CNATTraversalNotIntegrated.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 * Name          : CNATTraversalNotIntegrated.h
       
    16 * Part of       : ConnectionMgr
       
    17 * Version       : SIP/5.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef CNATTRAVERSALNOTINTEGRATED_H
       
    29 #define CNATTRAVERSALNOTINTEGRATED_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <sipnattraversalcontroller.h>
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 // HELPER CLASS DEFINITION
       
    37 
       
    38 class TPendingAsyncRequest
       
    39     {
       
    40     public: // Methods
       
    41     
       
    42         TPendingAsyncRequest( TDeltaTimerEntry aTimerEntry,
       
    43                               TUint32 aIapId,
       
    44                               MSIPNATTraversalRequestObserver& aObserver,
       
    45                               TUint32 aRequestId );
       
    46         
       
    47         TBool MatchRequestId( TUint32 aRequestId ) const;
       
    48         
       
    49         TBool MatchIapId( TUint32 aIapId ) const;
       
    50               
       
    51     public: // Data
       
    52     
       
    53         TDeltaTimerEntry iTimerEntry;
       
    54         
       
    55         TUint32 iIapId;
       
    56         
       
    57         MSIPNATTraversalRequestObserver& iObserver;
       
    58         
       
    59         TUint32 iRequestId;
       
    60     };
       
    61 
       
    62 // CLASS DEFINITION
       
    63 /**
       
    64 * Handling situations where NATTravesalController ecom plugin cannot be used.
       
    65 */
       
    66 class CNATTraversalNotIntegrated : public CSIPNATTraversalController
       
    67     {
       
    68     public: // Constructor and destructor
       
    69     
       
    70         static CNATTraversalNotIntegrated* NewL();
       
    71 
       
    72         ~CNATTraversalNotIntegrated();
       
    73 
       
    74     public: // From CSIPNATTraversalController
       
    75 
       
    76         TUint32 ResolvePublicAddrL(
       
    77             TUint32 aIapId,
       
    78             RConnection& aConnection,
       
    79             const TInetAddr& aLocalAddr,
       
    80             const TDesC8& aDomain,
       
    81             RSocket& aUdpSocket,
       
    82             const TInetAddr& aNextHopAddr,
       
    83             MSIPNATBindingObserver* aBindingObserver,
       
    84             MSIPNATTraversalRequestObserver& aRequestObserver );
       
    85 
       
    86         void Cancel( TUint32 aRequestId );        
       
    87 
       
    88         TBool RefreshNATBindingL( 
       
    89             RSocket& aSocket,
       
    90             const MSIPNATBindingObserver* aBindingObserver );
       
    91             
       
    92         TBool RefreshNATBindingL(
       
    93             CSecureSocket& aSecureSocket,
       
    94             const MSIPNATBindingObserver* aBindingObserver );
       
    95   
       
    96         void UpdateNextHop( 
       
    97             const TInetAddr& aNextHopAddr,
       
    98             const MSIPNATBindingObserver* aBindingObserver );  
       
    99   
       
   100         void SocketIdle( 
       
   101             TBool aIdle,
       
   102             RSocket& aSocket );
       
   103              
       
   104         void SocketIdle( 
       
   105             TBool aIdle,
       
   106             CSecureSocket& aSecureSocket );
       
   107                
       
   108         void DataReceivedL( 
       
   109             const TDesC8& aData,
       
   110             const RSocket& aUdpSocket,
       
   111             TBool& aHandled );    
       
   112 
       
   113         void FreeResources( 
       
   114             TUint32 aIapId );
       
   115 
       
   116         void FreeResources( 
       
   117             MSIPNATBindingObserver& aBindingObserver );
       
   118 
       
   119     
       
   120     public: // New methods
       
   121     
       
   122         static TInt CompletionCallback( TAny* aAny );
       
   123         
       
   124     private: // Constructors
       
   125 
       
   126         void ConstructL();
       
   127         
       
   128         CNATTraversalNotIntegrated();
       
   129         
       
   130     private: // New methods
       
   131     
       
   132         void AddAsyncRequestL( TUint32 aIapId,
       
   133                                MSIPNATTraversalRequestObserver& aRequestObserver,
       
   134                                TUint32 aRequestId );
       
   135         
       
   136         void CompletePendingAsyncRequest();
       
   137         
       
   138         TUint32 NextRequestId();
       
   139         
       
   140     private: // Data
       
   141     
       
   142         CDeltaTimer* iAsyncCompletionTimer;
       
   143         
       
   144         RArray< TPendingAsyncRequest > iAsyncRequests;
       
   145         
       
   146         TUint32 iRequestIdCounter;
       
   147         
       
   148         
       
   149 #ifdef CPPUNIT_TEST
       
   150         friend class COutgoingRequestQueueTest;
       
   151 #endif
       
   152         
       
   153     };
       
   154 
       
   155 
       
   156 #endif // CNATTRAVERSALNOTINTEGRATED_H