multimediacommsengine/mmcesrv/mmceevent/tsrc/ut_event/inc/sipprofile.h
changeset 0 1bce908db942
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 #include "MCEEventTestConsts.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 
       
    38 class CSIPConcreteProfile;
       
    39 class CSIPProfileRegistry;
       
    40 class CSIPProfileRegistryBase;
       
    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 * Uers'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. Array element contains one "Contact" header
       
   108 * parameter.
       
   109 */
       
   110 const TUint32 KSIPContactHeaderParams = 12;
       
   111 
       
   112 /** 
       
   113 * SIP Registrar  
       
   114 */
       
   115 const TUint32 KSIPRegistrar = 130;
       
   116 
       
   117 /** 
       
   118 * SIP Outbound Proxy
       
   119 */
       
   120 const TUint32 KSIPOutboundProxy = 131;
       
   121 
       
   122 /** 
       
   123 * HTTP Digest user name which value is type of TDesC8 
       
   124 */
       
   125 const TUint32 KSIPDigestUserName = 150;
       
   126 
       
   127 /** 
       
   128 * HTTP Digest realm which value is type of TDesC8
       
   129 */
       
   130 const TUint32 KSIPDigestRealm = 151;
       
   131 
       
   132 /** 
       
   133 * SIP server's address which value is of type TDesC8
       
   134 */
       
   135 const TUint32 KSIPServerAddress = 152;
       
   136 
       
   137 // CLASS DECLARATION
       
   138 
       
   139 /**
       
   140 * Class contains profile information of particular SIP service
       
   141 * provider. Class provides functions for quering profile parameter
       
   142 * values.
       
   143 *  @lib sipprofilecli.lib
       
   144 */
       
   145 class CSIPProfile: public CBase, public MSIPRegistrationContext
       
   146 	{	
       
   147     public:  // Constructors and destructor
       
   148 		/**
       
   149         * Destructor.
       
   150 		*/
       
   151 		IMPORT_C ~CSIPProfile();
       
   152 
       
   153     public: // New functions
       
   154 		/**
       
   155 		* Gets profile type information
       
   156 		* @return profile type information
       
   157 		*/
       
   158 		IMPORT_C const TSIPProfileTypeInfo& Type() const;
       
   159 
       
   160 		/** 
       
   161 		* Gets profile parameter
       
   162 		* @param aParam a parameter to get
       
   163 		* @param aVal on return will contain parameter value
       
   164 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   165 		*/
       
   166 		IMPORT_C TInt GetParameter(TUint32 aParam, TDesC8 const *& aVal) const; 
       
   167 
       
   168 		/** 
       
   169 		* Gets profile parameter
       
   170 		* @param aParam a parameter to get
       
   171 		* @param aVal on return will contain parameter value
       
   172 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   173 		*/
       
   174 		IMPORT_C TInt GetParameter(TUint32 aParam, TUint32& aVal) const;
       
   175 
       
   176 		/** 
       
   177 		* Gets profile parameter
       
   178 		* @param aParam a parameter to get
       
   179 		* @param aVal on return will contain parameter value
       
   180 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   181 		*/
       
   182 		IMPORT_C TInt GetParameter(TUint32 aParam, TBool& aVal) const;
       
   183 
       
   184 		/** 
       
   185 		* Gets profile parameter
       
   186 		* @param aParam a parameter to get
       
   187 		* @param aVal on return will contain parameter value
       
   188 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   189 		*/
       
   190 		IMPORT_C TInt GetParameter(TUint32 aParam, MDesC8Array const *& aVal) const;
       
   191 
       
   192 		/** 
       
   193 		* Gets profile parameter that is defined for a particular SIP server
       
   194 		* @param aServer a SIP server type
       
   195 		* @param aParam a parameter to get
       
   196 		* @param aVal on return will contain parameter value
       
   197 		* @return KErrNotFound if parameter was not found, KErrNone otherwise
       
   198 		*/
       
   199 		IMPORT_C TInt GetParameter(TUint32 aServerType, TUint32 aParam, TDesC8 const *& aVal) const;
       
   200 
       
   201 	public: //Functions from base class
       
   202 		/**
       
   203 		* Tests if the registration context can be
       
   204 		* used for creating SIP messages/dialogs
       
   205 		* Profile can be used, when CSIPProfileRegistry::IsEnabled() == ETrue
       
   206 		* and Status() == ERegistered.
       
   207 		* @return ETrue if can be used, EFalse otherwise
       
   208 		*/
       
   209 		TBool IsContextActive() const;
       
   210 
       
   211 		/**
       
   212 		* 
       
   213 		* For internal use only
       
   214 		* @return context id
       
   215 		*/
       
   216 		TUint32 ContextId() const;
       
   217 		
       
   218 
       
   219 	public: //New functions
       
   220 
       
   221 		/**
       
   222         * Two-phased constructor.
       
   223 		* @param aSIPRegistry a SIP profile client providing connection to SIP 
       
   224 		*		 profile server.
       
   225         */
       
   226 
       
   227 		static CSIPProfile* NewL(CSIPProfileRegistry* aSIPRegistry);
       
   228 
       
   229 		/**
       
   230 		* Sets profiles enabled state
       
   231 		* @param aEnabled ETrue if enabled
       
   232 		*/
       
   233 
       
   234 		void SetEnabled(TBool aEnabled);
       
   235 
       
   236 		/**
       
   237 		* Sets concrete profile that holds actual data 
       
   238 		* @param aProfile profile instance containing data
       
   239 		*/
       
   240 
       
   241 		void SetConcreteProfile(CSIPConcreteProfile* aProfile);
       
   242 
       
   243 		/**
       
   244 		* Clears concrete profile that holds actual data 
       
   245 		*/
       
   246 
       
   247 		void ClearConcreteProfile();
       
   248 
       
   249 		/**
       
   250 		* Gets concrete profile that holds actual data
       
   251 		* @return concrete profile holding data
       
   252 		*/
       
   253 
       
   254 		CSIPConcreteProfile& ConcreteProfile();
       
   255 
       
   256 		/**
       
   257 		* Gets concrete profile that holds actual data
       
   258 		* @return concrete profile holding data
       
   259 		*/
       
   260 
       
   261 		const CSIPConcreteProfile& ConcreteProfile() const;
       
   262 
       
   263 		/**
       
   264 		* Checks if the profile is enabled
       
   265 		* @return ETrue if enabled, EFalse otherwise
       
   266 		*/
       
   267 
       
   268 		TBool IsEnabled() const;
       
   269 
       
   270 		/**
       
   271 		* Gets last occurred error during registration
       
   272 		* @return last occurred error code, KErrNone if no error
       
   273 		*/
       
   274 		TInt LastRegistrationError() const;
       
   275 
       
   276 		/**
       
   277 		* Checks if two profiles are equal
       
   278 		* @return ETrue if equal
       
   279 		*/
       
   280 		TBool operator==(const CSIPProfile& 
       
   281 							     aProfile) const;
       
   282 
       
   283 		/**
       
   284 		* sets pointer to registry for profile
       
   285 		*/
       
   286 		void SetRegistry(CSIPProfileRegistryBase* aRegistry);
       
   287 		
       
   288 		/**
       
   289 		* Clears pointer to registry from profile
       
   290 		*/
       
   291 		void ClearRegistry();
       
   292 		
       
   293 	protected:
       
   294 
       
   295 		/**
       
   296 		* 2nd phase constructor. 
       
   297 		*/				
       
   298 		void ConstructL();
       
   299 
       
   300     private: // fo test stubs
       
   301         
       
   302         /**
       
   303         * Two-phased constructor.
       
   304 		* @param aSIPRegistry a SIP profile client providing connection to SIP 
       
   305 		*		 profile server.
       
   306         */
       
   307 
       
   308 		static CSIPProfile* NewL();
       
   309 		
       
   310 		/**
       
   311 		* Constructor. 
       
   312 		*/				
       
   313 		CSIPProfile();
       
   314 		
       
   315 	private:
       
   316 		TBool						iEnabled;
       
   317     
       
   318         // for unit testing
       
   319         TInt iError;
       
   320         TInt iAorError;
       
   321         TInt iParamError;
       
   322         CDesC8Array* iAORs;
       
   323         CDesC8Array* iContactParams;
       
   324     
       
   325         MCE_EVENT_UNITTEST_DEFS
       
   326 };
       
   327 
       
   328 #endif