multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/inc/sipprofile.h
changeset 0 1bce908db942
child 18 91f50911ea81
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2003 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:    The class providing profile data of SIP service provider
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CSIPPROFILE_H
       
    22 #define CSIPPROFILE_H
       
    23 
       
    24 //  INCLUDES
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32std.h>
       
    28 #include <badesca.h>
       
    29 
       
    30 
       
    31 #include "sipregistrationcontext.h"
       
    32 #include "sipprofiletypeinfo.h"
       
    33 #include "mcesrv.h"
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 
       
    37 class CSIPConcreteProfile;
       
    38 class CSIPProfileRegistry;
       
    39 class CSIPProfileRegistryBase;
       
    40 
       
    41 /** 
       
    42 * SIP Profile ID which value is type of TUint32
       
    43 */
       
    44 const TUint32 KSIPProfileId = 1;
       
    45 
       
    46 /** 
       
    47 * SIP Provider Name which value is type of TDesC8
       
    48 */
       
    49 const TUint32 KSIPProviderName = 2;
       
    50 
       
    51 /** 
       
    52 * Access Point ID which value is type of TUint32
       
    53 */
       
    54 const TUint32 KSIPAccessPointId = 3;
       
    55 
       
    56 /** 
       
    57 * Signaling compression (SigComp) which value is type of TBool. 
       
    58 * ETrue indicates that SigComp is enabled
       
    59 */
       
    60 const TUint32 KSIPSigComp = 4;
       
    61 
       
    62 /** 
       
    63 * Security Negotiation which value is type of TBool. ETrue indicates that
       
    64 * Security Negotiation is enabled
       
    65 */
       
    66 const TUint32 KSIPSecurityNegotiation = 5;
       
    67 
       
    68 /** 
       
    69 * Auto Registration which value is type of TBool. ETrue indicates that 
       
    70 * profile is enabled for auto registration
       
    71 */
       
    72 const TUint32 KSIPAutoRegistration = 6;
       
    73 
       
    74 /** 
       
    75 * Defined user's address-of-record which value is type of TDesC8 
       
    76 */
       
    77 const TUint32 KSIPUserAor = 7;
       
    78 
       
    79 /** 
       
    80 * Registration which value is type of TBool. ETrue indicates that
       
    81 * profile is registered 
       
    82 */
       
    83 const TUint32 KSIPProfileRegistered = 8;
       
    84 
       
    85 /** 
       
    86 * Users's registered address-of-records which value is of type MDesC8Array.
       
    87 * Note that array will contain AORs only in case the profile is registered.
       
    88 */
       
    89 const TUint32 KSIPRegisteredAors = 9;
       
    90 
       
    91 /** 
       
    92 * Negotiated security mechanism during registration procedure which value
       
    93 * is of type TDesC8.
       
    94 * Note that descriptor will contain value only in case the profile is 
       
    95 * registered.
       
    96 */
       
    97 const TUint32 KSIPNegotiatedSecurityMechanism = 10;
       
    98 
       
    99 /** 
       
   100 * Default profile which value is type of TBool. 
       
   101 * ETrue indicates that profile is default  
       
   102 */
       
   103 const TUint32 KSIPDefaultProfile = 11;
       
   104 
       
   105 /** 
       
   106 * "Contact" header parameters used during registration which value
       
   107 * is of type MDesC8Array. Each array element contains one "Contact"-header
       
   108 * parameter.
       
   109 */
       
   110 const TUint32 KSIPContactHeaderParams = 12;
       
   111 
       
   112 /** 
       
   113 * The user's registered "Contact"-header including the whole value of the header
       
   114 * except for the header's name ("Contact:"). 
       
   115 * The value is of type TDesC8.
       
   116 * Note that the value is available only in case the profile is registered.
       
   117 */
       
   118 const TUint32 KSIPRegisteredContact = 13;
       
   119 
       
   120 /** 
       
   121 * SNAP (Service Network Access Point) ID which value is type of TUint32.
       
   122 * This is an optional parameter. When this parameter is configured, 
       
   123 * KSIPAccessPointId has a meaningful value only when the profile is registered.
       
   124 */
       
   125 const TUint32 KSIPSnapId = 14;
       
   126 
       
   127 /** 
       
   128 * A unique Contact-header's user-part 
       
   129 * generated automatically by the SIP implementation.
       
   130 * The value is of type TDesC8.
       
   131 * This parameter is read-only and 
       
   132 * trying to set it will fail with KErrAccessDenied.
       
   133 */
       
   134 const TUint32 KSIPContactHeaderUser = 15;
       
   135 
       
   136 
       
   137 /** 
       
   138 * SIP Registrar  
       
   139 */
       
   140 const TUint32 KSIPRegistrar = 130;
       
   141 
       
   142 /** 
       
   143 * SIP Outbound Proxy
       
   144 */
       
   145 const TUint32 KSIPOutboundProxy = 131;
       
   146 
       
   147 /** 
       
   148 * HTTP Digest user name which value is type of TDesC8 
       
   149 */
       
   150 const TUint32 KSIPDigestUserName = 150;
       
   151 
       
   152 /** 
       
   153 * HTTP Digest realm which value is type of TDesC8
       
   154 */
       
   155 const TUint32 KSIPDigestRealm = 151;
       
   156 
       
   157 /** 
       
   158 * SIP server's address which value is of type TDesC8
       
   159 */
       
   160 const TUint32 KSIPServerAddress = 152;
       
   161 
       
   162 
       
   163 // CLASS DECLARATION
       
   164 
       
   165 /**
       
   166 * Class contains profile information of particular SIP service
       
   167 * provider. Class provides functions for quering profile parameter
       
   168 * values.
       
   169 *  @lib sipprofilecli.lib
       
   170 */
       
   171 class CSIPProfile: public CBase, public MSIPRegistrationContext
       
   172 	{	
       
   173     public:  // Constructors and destructor
       
   174 		/**
       
   175         * Destructor.
       
   176 		*/
       
   177 		IMPORT_C ~CSIPProfile();
       
   178 
       
   179     public: // New functions
       
   180 		/**
       
   181 		* Gets profile type information
       
   182 		* @return profile type information
       
   183 		*/
       
   184 		IMPORT_C const TSIPProfileTypeInfo& Type() const;
       
   185 
       
   186 		/** 
       
   187 		* Gets profile parameter
       
   188 		* @param aParam a parameter to get
       
   189 		* @param aVal on return will contain parameter value
       
   190 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   191 		*/
       
   192 		IMPORT_C TInt GetParameter(TUint32 aParam, TDesC8 const *& aVal) const; 
       
   193 
       
   194 		/** 
       
   195 		* Gets profile parameter
       
   196 		* @param aParam a parameter to get
       
   197 		* @param aVal on return will contain parameter value
       
   198 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   199 		*/
       
   200 		IMPORT_C TInt GetParameter(TUint32 aParam, TUint32& aVal) const;
       
   201 
       
   202 		/** 
       
   203 		* Gets profile parameter
       
   204 		* @param aParam a parameter to get
       
   205 		* @param aVal on return will contain parameter value
       
   206 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   207 		*/
       
   208 		IMPORT_C TInt GetParameter(TUint32 aParam, TBool& aVal) const;
       
   209 
       
   210 		/** 
       
   211 		* Gets profile parameter
       
   212 		* @param aParam a parameter to get
       
   213 		* @param aVal on return will contain parameter value
       
   214 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   215 		*/
       
   216 		IMPORT_C TInt GetParameter(TUint32 aParam, MDesC8Array const *& aVal) const;
       
   217 
       
   218 		/** 
       
   219 		* Gets profile parameter that is defined for a particular SIP server
       
   220 		* @param aServer a SIP server type
       
   221 		* @param aParam a parameter to get
       
   222 		* @param aVal on return will contain parameter value
       
   223 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   224 		*/
       
   225 		IMPORT_C TInt GetParameter(TUint32 aServerType, TUint32 aParam, TDesC8 const *& aVal) const;
       
   226 
       
   227 	public: //Functions from base class
       
   228 		/**
       
   229 		* Tests if the registration context can be
       
   230 		* used for creating SIP messages/dialogs
       
   231 		* Profile can be used, when CSIPProfileRegistry::IsEnabled() == ETrue
       
   232 		* and Status() == ERegistered.
       
   233 		* @return ETrue if can be used, EFalse otherwise
       
   234 		*/
       
   235 		TBool IsContextActive() const;
       
   236 
       
   237 		/**
       
   238 		* 
       
   239 		* For internal use only
       
   240 		* @return context id
       
   241 		*/
       
   242 		TUint32 ContextId() const;
       
   243 		
       
   244 
       
   245 	public: //New functions
       
   246 
       
   247 		/**
       
   248         * Two-phased constructor.
       
   249 		* @param aSIPRegistry a SIP profile client providing connection to SIP 
       
   250 		*		 profile server.
       
   251         */
       
   252 
       
   253 		static CSIPProfile* NewL(CSIPProfileRegistry* aSIPRegistry);
       
   254 
       
   255 		/**
       
   256         * Two-phased constructor.
       
   257 		* @param aSIPRegistry a SIP profile client providing connection to SIP 
       
   258 		*		 profile server.
       
   259 		* Constructs an object and adds the pointer to the cleanup stack;
       
   260 		*/
       
   261 
       
   262 		static CSIPProfile* NewLC(CSIPProfileRegistry* aSIPRegistry);
       
   263 
       
   264 		/**
       
   265 		* Sets profiles enabled state
       
   266 		* @param aEnabled ETrue if enabled
       
   267 		*/
       
   268 
       
   269 		void SetEnabled(TBool aEnabled);
       
   270 
       
   271 		/**
       
   272 		* Sets concrete profile that holds actual data 
       
   273 		* @param aProfile profile instance containing data
       
   274 		*/
       
   275 
       
   276 		void SetConcreteProfile(CSIPConcreteProfile* aProfile);
       
   277 
       
   278 		/**
       
   279 		* Clears concrete profile that holds actual data 
       
   280 		*/
       
   281 
       
   282 		void ClearConcreteProfile();
       
   283 
       
   284 		/**
       
   285 		* Gets concrete profile that holds actual data
       
   286 		* @return concrete profile holding data
       
   287 		*/
       
   288 
       
   289 		CSIPConcreteProfile& ConcreteProfile();
       
   290 
       
   291 		/**
       
   292 		* Gets concrete profile that holds actual data
       
   293 		* @return concrete profile holding data
       
   294 		*/
       
   295 
       
   296 		const CSIPConcreteProfile& ConcreteProfile() const;
       
   297 
       
   298 		/**
       
   299 		* Checks if the profile is enabled
       
   300 		* @return ETrue if enabled, EFalse otherwise
       
   301 		*/
       
   302 
       
   303 		TBool IsEnabled() const;
       
   304 
       
   305 		/**
       
   306 		* Gets last occurred error during registration
       
   307 		* @return last occurred error code, KErrNone if no error
       
   308 		*/
       
   309 		TInt LastRegistrationError() const;
       
   310 
       
   311 		/**
       
   312 		* Checks if two profiles are equal
       
   313 		* @return ETrue if equal
       
   314 		*/
       
   315 		TBool operator==(const CSIPProfile& 
       
   316 							     aProfile) const;
       
   317 
       
   318 		/**
       
   319 		* sets pointer to registry for profile
       
   320 		*/
       
   321 		void SetRegistry(CSIPProfileRegistryBase* aRegistry);
       
   322 		
       
   323 		/**
       
   324 		* Clears pointer to registry from profile
       
   325 		*/
       
   326 		void ClearRegistry();
       
   327 		
       
   328 	public: // for unittesting
       
   329 	    
       
   330 	    void SetParam( TUint aParam, HBufC8* aValue );
       
   331 	
       
   332 		
       
   333 	protected:
       
   334 
       
   335 		/**
       
   336 		* Constructor. 
       
   337 		*/				
       
   338 		CSIPProfile(CSIPProfileRegistryBase* aRegistry);
       
   339 		
       
   340 		/**
       
   341 		* 2nd phase constructor. 
       
   342 		*/				
       
   343 		void ConstructL();
       
   344 
       
   345     private: // fo test stubs
       
   346         
       
   347         /**
       
   348         * Two-phased constructor.
       
   349 		* @param aSIPRegistry a SIP profile client providing connection to SIP 
       
   350 		*		 profile server.
       
   351         */
       
   352 
       
   353 		static CSIPProfile* NewL();
       
   354 		
       
   355 		/**
       
   356 		* Constructor. 
       
   357 		*/				
       
   358 		CSIPProfile();
       
   359 		
       
   360 		
       
   361 
       
   362 	protected:
       
   363 	//	CSIPConcreteProfile*		iSIPProfile;
       
   364 		CSIPProfileRegistryBase*	iSIPProfileRegistry;
       
   365 
       
   366 	private:
       
   367 		TBool						iEnabled;
       
   368     
       
   369         // for unit testing
       
   370         CDesC8Array* iAORs;
       
   371         CDesC8Array* iContactParams;
       
   372         HBufC8* iAor;
       
   373         HBufC8* iDigestRealm;
       
   374         HBufC8* iPrivateIdentity;
       
   375         HBufC8* iDigestUsername;
       
   376         HBufC8* iDigestPassword;
       
   377         HBufC8* iRequestUriUser;
       
   378         HBufC8* iContactHeader;
       
   379         
       
   380     	//definitions for unit testing
       
   381     	MCESRV_UT_DEFINITIONS
       
   382 
       
   383 };
       
   384 
       
   385 #endif