realtimenetprots/sipfw/SIP/ServerResolver/inc/CSIPServerResolver.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2006-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          : CSIPServerResolver.h
       
    16 * Part of       : ServerResolver
       
    17 * Version       : SIP/5.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 #ifndef CSIPSERVERRESOLVER_H
       
    28 #define CSIPSERVERRESOLVER_H
       
    29 
       
    30 //INCLUDES
       
    31 #include <e32base.h>
       
    32 #include <in_sock.h>
       
    33 #include <stringpool.h>
       
    34 #include "_sipcodecdefs.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CURIBase;
       
    38 class CSIPViaHeader;
       
    39 class MSIPServerResolverObserver;
       
    40 class CSIPHostResolver;
       
    41 class CSIPHostPort;
       
    42 class CSIPURI;
       
    43 class MSIPResolvingResult;
       
    44 class CServerQuery;
       
    45 class CURIContainer;
       
    46 
       
    47 // CLASS DEFINITION
       
    48 /**
       
    49  * CSIPServerResolver implements a
       
    50  */
       
    51 class CSIPServerResolver : public CBase
       
    52 	{
       
    53 	public:// Constructors and destructor
       
    54 
       
    55     	/**
       
    56 	 	* Creates a new CSIPServerResolver instance
       
    57 	 	* @param aServer for server session
       
    58 	 	* @param aConnection for connection
       
    59 	 	* @returns a new instance of CSIPServerResolver
       
    60 	 	*/
       
    61 		static CSIPServerResolver* NewL( RSocketServ& aServer, 
       
    62                                 		 RConnection& aConnection );
       
    63 
       
    64     	/**
       
    65 	 	* Creates a new CSIPServerResolver instance 
       
    66 	 	* and pushes it to CleanupStack
       
    67 	 	* @param aServer for server session
       
    68 	 	* @param aConnection for connection
       
    69 	 	* @returns a new instance of CSIPServerResolver
       
    70 	 	*/
       
    71 		static CSIPServerResolver* NewLC( RSocketServ& aServer, 
       
    72                                       	  RConnection& aConnection );
       
    73 
       
    74 		/**
       
    75 	 	* Destructor.
       
    76 	 	*/
       
    77 		~CSIPServerResolver();
       
    78 
       
    79 	public:
       
    80 		
       
    81 		/**
       
    82 	 	* Resolves a CURIBase object to 0..n MSIPResolvingResult objects
       
    83 	 	* asynchronously. MSIPServerResolverObserver is called when
       
    84 	 	* resolving completes.
       
    85 	 	*
       
    86 	 	*
       
    87  	 	* @param aURI The URI to be resolved. 
       
    88 	 	*        Not used after this function returns.
       
    89 	 	* @param aSkipNaptrAndSrvQueries if ETrue skip NAPTR and SRV
       
    90 	 	*        queries and perform only A/AAAA query
       
    91 	 	* @param aResult an array for the resolved results.
       
    92 	 	* @param aObserver	callback that will be used when resolving 
       
    93 	 	*    	has been completed. The ownership is not transferred.
       
    94 	 	* Function accept only one same aObserver pointer at the time,
       
    95 	 	* otherwise function leave with errorcode  KErrAlreadyExists
       
    96 	 	*/
       
    97 		void GetByURIL( const CURIContainer& aURI,
       
    98 		                TBool aSkipNaptrAndSrvQueries,
       
    99 						RPointerArray< MSIPResolvingResult >& aResult,
       
   100 		            	MSIPServerResolverObserver* aObserver ); 
       
   101 
       
   102 		/**
       
   103 	 	* Resolves a CSIPViaHeader object to 0..n MSIPResolvingResult objects
       
   104 	 	* asynchronously. MSIPServerResolverObserver is called when
       
   105 	 	* resolving completes.
       
   106 	 	*
       
   107  	 	* @param aVia The Via-header to be resolved. 
       
   108 	 	*        Not used after this function returns.
       
   109 	 	* @param aResult an array for the resolved results.
       
   110 	 	* @param aObserver	callback that will be used when resolving 
       
   111 	 	*        has been completed. The ownership is not transferred.
       
   112 	 	* Function accept only one same aObserver pointer at the time,
       
   113 	 	* otherwise function leave with errorcode  KErrAlreadyExists
       
   114 	 	*/
       
   115 		void GetByViaL( CSIPViaHeader& aVia,
       
   116 						RPointerArray< MSIPResolvingResult >& aResult,
       
   117 						MSIPServerResolverObserver* aObserver );
       
   118 
       
   119 		/**
       
   120 	 	* Cancels all outstanding operations for the given observer.
       
   121 	 	*
       
   122 	 	* @param aObserver	The observer.
       
   123 	 	* 
       
   124 	 	*/
       
   125 		void Cancel( MSIPServerResolverObserver* aObserver );
       
   126 	
       
   127 	private:// Constructors and destructor
       
   128 
       
   129 		CSIPServerResolver();
       
   130 	
       
   131 		void ConstructL( RSocketServ& aServer,
       
   132 					 	 RConnection& aConnection );
       
   133 					 	 
       
   134 	private:// New methods
       
   135 	
       
   136 		void ChooseQueryL( MSIPServerResolverObserver* aObserver,
       
   137                       	   const TDesC8& aTarget,
       
   138                       	   RPointerArray< MSIPResolvingResult >& aResult,
       
   139                       	   TBool aSipsUri,
       
   140                       	   TUint aPort,
       
   141                       	   RStringF aProtocol,
       
   142                       	   TBool aForceUDP = EFalse,
       
   143                       	   TBool aSkipNaptrAndSrvQueries = EFalse );
       
   144 
       
   145 		void SetA_AAAAQueryL( CServerQuery* aQuery );
       
   146 		
       
   147 		void SetSRVQueryL( CServerQuery* aQuery );
       
   148 		
       
   149 		void SetNaptrQueryL( CServerQuery* aQuery );
       
   150                     
       
   151         RStringF TransportProtocolL( const CSIPURI& aURI,
       
   152                                      TBool& aForceUdp ) const;
       
   153                                      
       
   154         RStringF DefaultTransport( TBool aSipsUri ) const; 
       
   155         
       
   156         TUint DefaultPort( TBool aUseTls ) const;                           
       
   157 	
       
   158 	private://data
       
   159 	
       
   160 		CSIPHostResolver* iResolver;
       
   161 		
       
   162 	private: // For testing purposes
       
   163 
       
   164 		UNIT_TEST(CSIPServerResolverTest)
       
   165 	};
       
   166 #endif // end of CSIPSERVERRESOLVER_H
       
   167 
       
   168 // End of File