ipappsrv_plat/multimedia_comms_api/inc/mcesession.h
changeset 0 1bce908db942
child 49 64c62431ac08
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 CMCESESSION_H
       
    22 #define CMCESESSION_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <mcedefs.h>
       
    27 
       
    28 // DATA TYPES
       
    29 typedef TUint TMceSessionType;
       
    30 
       
    31 // CONSTANTS
       
    32 const TMceSessionType KMceSessionNormal = 1;
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class TMceTransactionDataContainer;
       
    36 class CDesC8Array;
       
    37 class MDesC8Array;
       
    38 class TMceIds;
       
    39 class CMceMediaStream;
       
    40 class CMceManager;
       
    41 class TMceFactory;
       
    42 class RReadStream;
       
    43 class RWriteStream;
       
    44 class CMceItcSender;
       
    45 class CMceSessionReceiver;
       
    46 class MMceFcMsgObserver;
       
    47 class CMceComSession;
       
    48 class MMceComSerializationContext;
       
    49 class CMceMsgBase;
       
    50 class TMceEvent;
       
    51 class CMceInSession;
       
    52 class CMceMsgSIPReply;
       
    53 class CMceMsgSIPData;
       
    54 class TMceFactory;
       
    55 class CMceEvent;
       
    56 class CMceRefer;
       
    57 class CMceStreamBundle;
       
    58 template <class T> class CMceMsgArray;
       
    59 
       
    60 
       
    61 // CLASS DECLARATION
       
    62 
       
    63 /**
       
    64 * Base class for MCE sessions, inherited by both CMceInSession and CMceOutSession.
       
    65 *
       
    66 * CMceSession represents peer-to-peer connection made with remote terminal.
       
    67 * This connection is also known as dialog and it is set up using SIP INVITE
       
    68 * method.
       
    69 *
       
    70 * The characteristics of the session are defined by user of this class by attaching
       
    71 * media streams into the session.
       
    72 *
       
    73 * After the session has been succesfylly established, it can be later updated and
       
    74 * must be finally terminated.
       
    75 *
       
    76 * If for any reason instance of this class is deleted while in established state,
       
    77 * session is automatically terminated by MCE server.
       
    78 *
       
    79 *  @lib mceclient.lib
       
    80 */
       
    81 class CMceSession : public CBase
       
    82 	{	
       
    83 	public: // Session states
       
    84 
       
    85 	    enum TState
       
    86 	        {
       
    87 	        EIdle, 			// Idle
       
    88 	        EOffering,      // Outgoing session, or session update establishment in progress, 
       
    89 	        EIncoming,		// Session received incoming call
       
    90 	        EReserving,     // UpdateL called to incoming session during session establishment
       
    91 	        EAnswering, 	// Answering an incoming call
       
    92 	        EProceeding,	// Session media negotiations proceeding
       
    93 	        EEstablished,   // Session established
       
    94 	        ECancelling,    // Cancelling outgoing session establishment
       
    95 	        ETerminating,   // Terminating session
       
    96 	        ETerminated,    // Session terminated
       
    97 	        };
       
    98 
       
    99 	public: // Session termination reasons
       
   100 
       
   101 	    enum TReason
       
   102 	        {
       
   103 	        EDeclined,
       
   104 	        EBusy,
       
   105 	        ECancelled,
       
   106 	        EDisconnected
       
   107 	        };
       
   108 
       
   109 	public :// Control (signalling) path security levels
       
   110 
       
   111 		enum TControlPathSecurityLevel 
       
   112 	        {
       
   113 	        EControlPathSecurityUnknown,
       
   114 	        EControlPathUnsecure,
       
   115 	        EControlPathSecure
       
   116 	        };
       
   117         
       
   118 	public: 
       
   119 
       
   120 	    /**
       
   121 	    * Destructor.
       
   122 	    */
       
   123 		virtual ~CMceSession();
       
   124 
       
   125 	public: // Functions
       
   126 
       
   127 	    /**
       
   128 	    * Returns the state of the session.
       
   129 	    * @return The current state of the session
       
   130 	    */
       
   131 	    IMPORT_C TState State() const;
       
   132 
       
   133 	    /**
       
   134 	    * Returns the state of network connection of the session.
       
   135 	    * @return ETrue if connection active, EFalse if connection inactive.
       
   136 	    */
       
   137 	    IMPORT_C TBool ConnectionActive() const;
       
   138 	    
       
   139 	    /**
       
   140 	    * Removes media stream from session.
       
   141 		* @pre State() == CMceSession::EIdle ||
       
   142 		*      State() == CMceSession::EIncoming ||
       
   143 		*      State() == CMceSession::EEstablished
       
   144 		* @post aMediaStream cannot be used anymore and contents of 
       
   145 		*       previously returned stream array (CMceSession::Streams())
       
   146 		*       are not anymore valid
       
   147 	    * @param aMediaStream media stream to be removed
       
   148 	    */
       
   149 	    IMPORT_C void RemoveStreamL( CMceMediaStream& aMediaStream );
       
   150 
       
   151 	    /**
       
   152 		* Updates offered session parameters during session
       
   153 		* establishement phase for first answer.
       
   154 	    * Updates established session using re-invite.
       
   155 	    * In state EIncoming the timeout value must be smaller or equal to
       
   156 	    * offered value obtained by SessionTimer().
       
   157 		* @pre State() == CMceSession::EIncoming ||
       
   158 		*      State() == CMceSession::EEstablished
       
   159 		* @post State() == CMceSession::EReserving for incoming session ||
       
   160 		*       State() == CMceSession::EOffering for established session
       
   161 	    * @param aTimeout, the session timer value in seconds
       
   162 	    * @param aHeaders, SIP headers to be added. Ownership is
       
   163 		*		 transferred.
       
   164 	    * @param aContentType, content type of the body.
       
   165 		*		 Ownership is transferred.
       
   166 	    * @param aContent, content to be added in body. Ownership is 
       
   167 		*		 transferred.
       
   168 	    * @param aContentHeaders, content headers to be added. Ownership is
       
   169 		*		 transferred.
       
   170 	    */
       
   171 		IMPORT_C void UpdateL( TUint32 aTimeout = 0,
       
   172                                CDesC8Array* aHeaders = 0, 
       
   173                                HBufC8* aContentType = 0,
       
   174                                HBufC8* aContent = 0,
       
   175                                CDesC8Array* aContentHeaders = 0 ); 
       
   176 
       
   177         /**
       
   178 	    * Terminates established session.
       
   179 		* @pre State() == CMceSession::EEstablished
       
   180 		* @post State() == CMceSession::ETerminating
       
   181 	    * @param aHeaders, SIP headers to be added. Ownership is
       
   182 		*		 transferred.
       
   183 	    * @param aContentType, content type of the body.
       
   184 		*		 Ownership is transferred.
       
   185 	    * @param aContent, content to be added in body. Ownership is 
       
   186 		*		 transferred.
       
   187 	    */
       
   188 		IMPORT_C void TerminateL( CDesC8Array* aHeaders = 0,
       
   189 					              HBufC8* aContentType = 0,
       
   190 					              HBufC8* aContent = 0 ); 
       
   191 
       
   192 	    /**
       
   193 	    * Returns the streams belonging to the session.
       
   194 	    * @return streams of the session.
       
   195 	    */
       
   196 		IMPORT_C const RPointerArray<CMceMediaStream>& Streams() const;
       
   197 
       
   198 	    /**
       
   199 	    * Returns the recipient of the session.
       
   200 		* @pre State() == CMceSession::EIncoming ||
       
   201 		*      State() == CMceSession::EEstablished
       
   202 	    * @return The recipients address.
       
   203 	    */
       
   204 	    IMPORT_C const TDesC8& Recipient() const;
       
   205 
       
   206 	    /**
       
   207 	    * Returns the originator of the session.
       
   208 		* @pre State() == CMceSession::EIdle ||
       
   209 		*      State() == CMceSession::EIncoming ||
       
   210 		*      State() == CMceSession::EEstablished
       
   211 	    * @return the originators address.
       
   212 	    */
       
   213 	    IMPORT_C const TDesC8& Originator() const;
       
   214 
       
   215 	    /**
       
   216 		* Configures session by updating SDP session lines. 
       
   217 		* In order to get complete update, whole session must be 
       
   218 		* updated causing sending of re-invite.
       
   219 		* @pre State() == CMceSession::EIdle ||
       
   220 		*      State() == CMceSession::EIncoming ||
       
   221 		*      State() == CMceSession::EEstablished
       
   222 		* @pre aSessionSDPLines != 0
       
   223 	    * @param aSessionSDPLines, application specific SDP lines for session.
       
   224 		*		 Ownership is transferred.
       
   225 	    */
       
   226 		IMPORT_C void SetSessionSDPLinesL( CDesC8Array* aSessionSDPLines );
       
   227 		
       
   228 		/**
       
   229 		* Gets SDP lines of the session.
       
   230 		* @return array of session SDP lines, owneship is transferred.
       
   231 		*/
       
   232 		IMPORT_C MDesC8Array* SessionSDPLinesL();
       
   233 
       
   234 		/**
       
   235 	    * Returns the session timer value of the session.
       
   236 		* @return the session timer value.
       
   237 	    */
       
   238 		IMPORT_C TUint32 SessionTimer() const;
       
   239 				
       
   240 		/**
       
   241 		* Adds grouped media streams to the session. Changes SDP
       
   242 		* of the session. In order to get complete update, whole
       
   243 		* session must be updated causing sending of re-invite.
       
   244 		* @pre State() == CMceSession::EIdle ||
       
   245 		*      State() == CMceSession::EIncoming ||
       
   246 		*      State() == CMceSession::EEstablished
       
   247 		* @pre aBundle != 0
       
   248 	    * @param aBundle group of media streams;
       
   249 	    *        ownership of the bundle is transferred
       
   250 	    */
       
   251 		IMPORT_C void AddBundleL( CMceStreamBundle* aBundle );
       
   252 		
       
   253 		/**
       
   254 	    * Removes grouped media stream from session. Changes SDP
       
   255 		* of the session. In order to get complete update, whole
       
   256 		* session must be updated causing sending of re-invite.
       
   257 		* @pre State() == CMceSession::EIdle ||
       
   258 		*      State() == CMceSession::EIncoming ||
       
   259 		*      State() == CMceSession::EEstablished
       
   260 		* @post aBundle cannot be used anymore and contents of 
       
   261 		*       previously returned bundle array (CMceSession::Bundles())
       
   262 		*       are not anymore valid
       
   263 	    * @param aBundle bundle to be removed
       
   264 	    */
       
   265 	    IMPORT_C void RemoveBundleL( CMceStreamBundle& aBundle );
       
   266 		
       
   267 		/**
       
   268 	    * Gets the grouped media streams of the session.
       
   269 	    * @return bundles of the session
       
   270 	    */
       
   271 		IMPORT_C const RPointerArray< CMceStreamBundle >& Bundles() const;
       
   272 		
       
   273         /**
       
   274         * Returns the associated events, if any.
       
   275 	    * @return RPointerArray array of associated events. 
       
   276 	    *         The ownership is transferred.
       
   277 	    */
       
   278 		IMPORT_C RPointerArray< CMceEvent >* AssociatedEventsL() const;
       
   279 
       
   280         /**
       
   281         * Returns the associated refers, if any.
       
   282 	    * @return RPointerArray array of associated refers. 
       
   283 	    *         The ownership is transferred.
       
   284 	    */
       
   285 		IMPORT_C RPointerArray< CMceRefer >* AssociatedRefersL() const;
       
   286 
       
   287         /**
       
   288         * Gets session modifier of type TUint.
       
   289         * @param aModifier is a modifier to be retrieved
       
   290         * @param aValue on return will contain modifier value
       
   291         * @leave KErrNotFound if modifier is not found
       
   292         */
       
   293         IMPORT_C void GetModifierL( TMceSessionModifier aModifier,
       
   294                                     TUint& aValue ) const;
       
   295 
       
   296         /**
       
   297         * Sets session modifier of type TUint.
       
   298         * @param aModifier is a modifier to be set 
       
   299         * @param aValue is a new value of a modifier
       
   300         * @leave KErrNotFound if modifier is not found
       
   301         */
       
   302         IMPORT_C void SetModifierL( TMceSessionModifier aModifier, 
       
   303                                     TUint aValue );        
       
   304 
       
   305         /**
       
   306         * Returns the identifier of profile used by the sesison.
       
   307 	    * @return TUint32 Identifier of the used profile. 0, 
       
   308 	    *         if session is setup without profile.
       
   309 	    */
       
   310 		IMPORT_C TUint32 Profile() const;
       
   311 
       
   312 		 /**
       
   313 		* Configures connections of the session by setting
       
   314 		* type of service value for outgoing datagrams.
       
   315 		* @pre State() == CMceSession::EIdle ||
       
   316 		*      State() == CMceSession::EIncoming
       
   317 		* @pre aServiceType >= 0 && aServiceType < 256 
       
   318 		* @param aServiceType, Type of service value for outgoing datagrams.
       
   319 		*/
       
   320 		IMPORT_C void SetServiceTypeL( TUint32 aServiceType );       
       
   321 
       
   322 		/**
       
   323 		* Returns setting for type of service value for outgoing datagrams
       
   324 		* used in session.
       
   325 		* @return Type of service value for outgoing datagrams.
       
   326 		*/
       
   327 		IMPORT_C TUint32 ServiceType() const;       
       
   328 		
       
   329 	    /** 
       
   330 	    * Checks the assumed end-to-end security level 
       
   331 	    * on the session control/signalling path.  
       
   332 	    * @return the assumed control path security level     
       
   333 	    */ 
       
   334     	IMPORT_C TControlPathSecurityLevel ControlPathSecurityLevel() const;
       
   335 
       
   336 	    /**
       
   337 		* Sends an outgoing extension SIP request such as INFO 
       
   338 		* within an existing session.
       
   339 		* @pre State() != CMceSession::EIdle &&
       
   340 		*      State() != CMceSession::EIncoming &&
       
   341 		*      State() != CMceSession::ETerminated
       
   342 		* @pre aMethod != "REGISTER" |"INVITE" | "BYE" | "CANCEL" | "ACK" |
       
   343         *   "SUBSCRIBE" | "NOTIFY" | "UPDATE" | "PRACK" | "REFER"
       
   344 	    * @param aMethod, SIP method
       
   345 	    * @param aHeaders, SIP headers to be added. 
       
   346 	    *        The ownership is transferred.
       
   347 	    * @param aContentType, content type of the body.
       
   348 		*		 The ownership is transferred.
       
   349 	    * @param aContent, content to be added in body. 
       
   350 	    *        The ownership is transferred.
       
   351 	    */
       
   352 		IMPORT_C TMceTransactionId SendRequestL( const TDesC8& aMethod,
       
   353 		                                         CDesC8Array* aHeaders = 0,
       
   354 		                                         HBufC8* aContentType = 0,
       
   355 		                                         HBufC8* aContent = 0 ); 
       
   356 				 
       
   357 		/**
       
   358 		* Sends a response to an incoming extension SIP request 
       
   359 		* such as INFO within an existing session.
       
   360 		* @pre State() != CMceSession::EIdle &&
       
   361 		*      State() != CMceSession::EIncoming &&
       
   362 		*      State() != CMceSession::ETerminated
       
   363 	    * @param aTransactionId Transaction Identifier
       
   364 	    * @param aReason, Reason Phrase
       
   365 	    * @param aCode, Response Code 
       
   366 	    * @param aHeaders, SIP headers to be added. 
       
   367 	    *        The ownership is transferred.
       
   368 	    * @param aContentType, content type of the body.
       
   369 		*		 The ownership is transferred.
       
   370 	    * @param aContent, content to be added in body. 
       
   371 	    *        The ownership is transferred.
       
   372 	    */	
       
   373 		IMPORT_C void SendResponseL( TMceTransactionId aTransactionId,
       
   374 		                             const TDesC8& aReason,
       
   375 		                             TUint32 aCode,	
       
   376 		                             CDesC8Array* aHeaders = 0,
       
   377 		                             HBufC8* aContentType = 0,
       
   378 		                             HBufC8* aContent = 0 );
       
   379 
       
   380 	    /**
       
   381 	    * Adds media stream into session.
       
   382 		* @pre State() == CMceSession::EIdle ||
       
   383 		*      State() == CMceSession::EIncoming ||
       
   384 		*      State() == CMceSession::EEstablished
       
   385 		* @pre aMediaStream != 0
       
   386 	    * @param aMediaStream, media stream to be added.
       
   387 	    *		 ownership is transferred.
       
   388 	    */
       
   389 	    virtual void AddStreamL( CMceMediaStream* aMediaStream );
       
   390 
       
   391 	    /**
       
   392 	    * Returns the type of the session.
       
   393 	    * @return The type of the session.
       
   394 	    */
       
   395 	    virtual TMceSessionType Type() const;
       
   396 
       
   397 
       
   398 	public: //event handling interface
       
   399 
       
   400 	    /**
       
   401 	    * Handles reception of session update
       
   402 	    * @param aId id of object whose state is needed to be updated
       
   403 	    */
       
   404 	    void EventReceivedL( TMceIds& aId );
       
   405 
       
   406 	    /**
       
   407 	    * Handles reception of session update
       
   408 	    * @param aId id of object whose state is needed to be updated
       
   409 	    * @param aMessage the message
       
   410 	    */
       
   411 	    void EventReceivedL( TMceIds& aId, CMceMsgBase& aMessage );
       
   412 
       
   413 	    /**
       
   414 	    * Handles reception of session update
       
   415 	    * @param aId id of object whose state is needed to be updated
       
   416 	    * @param aMessage the message
       
   417 	    * @param aContent the content
       
   418 	    */
       
   419 	    void EventReceivedL( TMceIds& aId, CMceMsgBase& aMessage, HBufC8* aContent );
       
   420 
       
   421 	    /**
       
   422 	    * Handles reception of session update
       
   423 	    * @param aInSession the incoming update
       
   424 	    * @param aContent the content
       
   425 	    */
       
   426         void IncomingUpdateL( CMceInSession* aInSession, HBufC8* aContent );
       
   427 
       
   428 	    /**
       
   429 	    * Floor control message handling
       
   430 	    * @param aMessage FC message
       
   431 	    */
       
   432 	    void FCMessageReceived( HBufC8* aMessage );
       
   433 		
       
   434 		/**
       
   435 	    * Floor control error handling
       
   436 	    * @param aError FC error
       
   437 	    */
       
   438 		void FCErrorOccurred( TInt aError );
       
   439 		
       
   440 	    /**
       
   441 	    * Handling of error
       
   442 	    * @param aError the error
       
   443 	    */
       
   444 	    void ErrorOccuredL( TInt aError );
       
   445 	    
       
   446     public: // from MMceComSerializable
       
   447 
       
   448         /**
       
   449         * Returns serialization id
       
   450         * @return serialization id
       
   451         */
       
   452         TUint64 SerializationId() const;
       
   453 
       
   454         /**
       
   455         * Internalizes flat data
       
   456         * @param aReadStream read stream
       
   457         */
       
   458         void InternalizeFlatL( RReadStream& aReadStream );
       
   459 
       
   460         /**
       
   461         * Externalizes flat data
       
   462         * @param aWriteStream write stream
       
   463         */
       
   464         void ExternalizeFlatL( RWriteStream& aWriteStream );
       
   465 
       
   466         /**
       
   467         * Internalizes
       
   468         * @param aSerCtx context for serialization
       
   469         */
       
   470         virtual void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   471         
       
   472         /**
       
   473         * Externalizes
       
   474         * @param aSerCtx context for serialization
       
   475         */
       
   476         virtual void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   477 
       
   478     public: //internal serialization
       
   479     	    
       
   480 	    /**
       
   481 	    * Factory
       
   482 	    * @return factory
       
   483 	    */
       
   484 	    TMceFactory BaseFactory();
       
   485 	    
       
   486 	    /**
       
   487 	    * Factory
       
   488 	    * @return factory
       
   489 	    */
       
   490 	    static TMceFactory Factory();
       
   491 	    
       
   492 	public: //internal
       
   493 
       
   494 	    /**
       
   495 	    * ID 
       
   496 	    * @return ID
       
   497 	    */
       
   498 		TUint32 Id() const;
       
   499 		
       
   500 	    /**
       
   501 	    * Dialog ID 
       
   502 	    * @return Dialog ID 
       
   503 	    */
       
   504 		TUint32 DialogId() const;
       
   505 		
       
   506 	    /**
       
   507 	    * Returns SIP params and gives ownership of them to caller.
       
   508 	    * After call, SIP params are destroyed from session
       
   509 	    * @param aHeaders SIP headers
       
   510 	    * @param aContentType SIP content type
       
   511 	    * @param aContentHeaders SIP content headers
       
   512 	    */
       
   513 		void GetSIPParams( CDesC8Array*& aHeaders, 
       
   514 		                   HBufC8*& aContentType, 
       
   515 		                   CDesC8Array*& aContentHeaders );
       
   516 
       
   517 	    /**
       
   518 	    * Sets SIP params 
       
   519 	    * @param aHeaders SIP headers
       
   520 	    * @param aContentType SIP content type
       
   521 	    * @param aContentHeaders SIP content headers
       
   522 	    */
       
   523 	    void SetSIPParams( CDesC8Array* aHeaders, 
       
   524 	                       HBufC8* aContentType,
       
   525 	                       CDesC8Array* aContentHeaders );
       
   526 	    
       
   527 	    /**
       
   528 	    * Handles SIP parameter cleanup in leave situations.
       
   529 	    * @param aAny this session
       
   530 	    */
       
   531 	    static void SIPParamsCleanup( TAny* aSession );
       
   532 	    
       
   533 	    /**
       
   534 	    * Gets sender for ITC.
       
   535 	    * @return ITC sender
       
   536 	    */
       
   537 	    CMceItcSender& ITCSender() const;
       
   538 
       
   539 	    /**
       
   540 	    * Gets manager
       
   541 	    * @return manager
       
   542 	    */
       
   543 	    CMceManager& Manager() const;
       
   544 
       
   545 	    /**
       
   546 	    * Sets observer for FC.
       
   547 	    * @return ITC sender
       
   548 	    */
       
   549 	    void SetFCObserver(MMceFcMsgObserver* aPtr);
       
   550 
       
   551 	    /**
       
   552 	    * Prepares ids for ITC
       
   553 	    * @param aId ITC ids
       
   554 	    */
       
   555 	    void PrepareForITC( TMceIds& aId );
       
   556 	    
       
   557 	    /**
       
   558 	    * Sets this instance as zombie
       
   559 	    * @param aInSession the incoming update
       
   560 	    */
       
   561         void SetZombie( CMceInSession& aInSession );
       
   562         
       
   563 	    /**
       
   564 	    * Return ETrue, if session is zombie by update
       
   565 	    * @return ETrue, if session is zombie by update
       
   566 	    */
       
   567 	    TBool IsZombie();
       
   568 
       
   569 	protected:
       
   570 
       
   571 	    /**
       
   572 	     * C++ default constructor.
       
   573 	     * @param aManager, reference to session manager.
       
   574 	     * @param aProfileId, id of the sip profile used for the session.
       
   575 	     */
       
   576 		CMceSession( CMceManager* aManager, TUint32 aProfileId );
       
   577 
       
   578 	    /**
       
   579 	     * second-phase constructor
       
   580 	     */
       
   581 		void ConstructL( TBool aUpdateSession = EFalse );
       
   582 
       
   583 	    /**
       
   584 	    * Initializes 
       
   585 	    */
       
   586 	    void InitializeL( TBool aClientSideMedia = ETrue, 
       
   587 	                      TBool aDiscardUnusedCodecs = EFalse );
       
   588 	    
       
   589 	    /**
       
   590 	     * Sends an ITC event
       
   591 	     * @param aITCFunction ITC operation	     
       
   592 	     */
       
   593 		void SendITCEventL( TUint8 aITCFunction );
       
   594 	    
       
   595 	    /**
       
   596 	     * Synchronizes session data with server
       
   597 	     * @param aIds ITC ids	     
       
   598 	     */
       
   599         void SynchronizeL( TMceIds& aIds );
       
   600         
       
   601 	    /**
       
   602 	     * Adds stream to media streams list
       
   603 	     * @param aMediaStream media stream
       
   604 	     */
       
   605 	    void DoAddStreamL( CMceMediaStream* aMediaStream );
       
   606 
       
   607 		/**
       
   608 	     * Checks if the stream should be initialized.
       
   609 	     * @param aMediaStream media stream
       
   610 	     */
       
   611 	    virtual TBool StreamInitializeCondition(
       
   612 	    	CMceMediaStream& aMediaStream ) const = 0;
       
   613 
       
   614 	private://event handling & update
       
   615 
       
   616 	    /**
       
   617 	    * Traversal event handler
       
   618 	    * @param aEvent the event
       
   619 	    */
       
   620 	    void EventReceivedL( TMceEvent& aEvent );
       
   621 	    
       
   622 	    /**
       
   623 	    * Called after update
       
   624 	    */
       
   625 	    void Updated();
       
   626 	    
       
   627 	    /**
       
   628 	    * Called after update has failed
       
   629 	    */
       
   630 	    void UpdateFailed( TMceEvent& aEvent, 
       
   631 						   TMceTransactionDataContainer* aContainer );
       
   632 	    
       
   633 	    /**
       
   634 	    * Updates whole session object witn new one
       
   635 	    * @param aSession new session
       
   636 	    */
       
   637 	    void UpdateL( CMceSession& aSession );
       
   638 
       
   639 	    /**
       
   640 	    * Handles event
       
   641 	    * @param aEvent the event
       
   642 	    */
       
   643 	    void HandleEvent( TMceEvent& aEvent );
       
   644 	    
       
   645 
       
   646 		/**
       
   647 	    * Handles Request Event within session
       
   648 	    * @param aEvent the event
       
   649 	    */
       
   650 	    void HandleEventRequestReceivedL( TMceEvent& aEvent );
       
   651 
       
   652 
       
   653 		/**
       
   654 	    * Handles Responses Event within session
       
   655 	    * @param aEvent the event
       
   656 	    */
       
   657 	    void HandleEventResponseReceivedL( TMceEvent& aEvent );
       
   658 
       
   659 	    
       
   660 	    
       
   661 	    /**
       
   662 	    * Sets container based on response
       
   663 	    * @param aReply the data for container
       
   664 	    * @param aContent a content
       
   665 	    * @return ETrue if content was deleted, otherwise EFalse
       
   666 	    */
       
   667         TBool SetContainer( CMceMsgSIPReply& aReply, HBufC8* aContent );
       
   668 
       
   669 	    /**
       
   670 	    * Sets container based on request
       
   671 	    * @param aRequest the data for container
       
   672 	    * @param aContent a content
       
   673 	    * @return ETrue if content was deleted, otherwise EFalse
       
   674 	    */
       
   675         TBool SetContainer( CMceMsgSIPData& aRequest, HBufC8* aContent );
       
   676 
       
   677 	    /**
       
   678 	    * Sets container based on response & handles session update
       
   679 	    * @param aMsgArray the data for container
       
   680 	    * @param aContent a content
       
   681 	    */
       
   682         void SetContainer( CMceMsgArray<TMceFactory>& aMsgArray, HBufC8* aContent );
       
   683         
       
   684         /**
       
   685 	    * Sends the Update
       
   686 	    * @param aContent
       
   687 	    */
       
   688         void SendUpdateL( HBufC8* aContent );
       
   689 	    
       
   690 
       
   691 
       
   692 	protected: // Not owned data
       
   693 
       
   694 	    /**
       
   695 	     * manager
       
   696 	     */
       
   697 	     CMceManager* iManager;
       
   698 
       
   699 	    /**
       
   700 	     * profile id
       
   701 	     */
       
   702 	     TUint32 iProfileId;
       
   703 
       
   704 	protected: // owned data
       
   705 
       
   706 	    /**
       
   707 	     * flat data container
       
   708 	     */
       
   709 		CMceComSession* iFlatData;
       
   710 
       
   711 	    /**
       
   712 	     * sender
       
   713 	     */
       
   714 	    CMceItcSender* iSender;
       
   715 	    
       
   716 	    /**
       
   717 	     * receiver
       
   718 	     */
       
   719 		CMceSessionReceiver* iReceiver;
       
   720 	    
       
   721 	    /**
       
   722 	     * FC observer
       
   723 	     */
       
   724 		MMceFcMsgObserver* iFCObserver;
       
   725 		
       
   726 		/**
       
   727 	     * media streams
       
   728 	     */
       
   729 		RPointerArray<CMceMediaStream> iMediaStreams;
       
   730 		 
       
   731 	private: // Owned data
       
   732 
       
   733 		
       
   734 	    /**
       
   735 	     * bundles
       
   736 	     */
       
   737 		RPointerArray<CMceStreamBundle> iBundles;
       
   738 
       
   739     private: // Reserved for future use
       
   740     
       
   741         TAny* iReserved;       
       
   742 
       
   743 		//for testing
       
   744 
       
   745 		friend class CMceManager;
       
   746 		friend class CMceFcMsgExchange;
       
   747 		
       
   748 	    MCE_UNIT_TEST_DEFS
       
   749 	        
       
   750 	};
       
   751 
       
   752 #endif // CMCESESSION_H