multimediacommsengine/mmcesrv/mmceserver/inc/mceactionset.h
changeset 0 1bce908db942
child 9 5d1d815214a5
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 MCEACTIONSET_H
       
    22 #define MCEACTIONSET_H
       
    23 
       
    24 #include <e32std.h>
       
    25 #include "mcesrv.h"
       
    26 #include "mcesession.h"
       
    27 #include "mcestate.h"
       
    28 #include "mcesipsession.h"
       
    29 #include "mcedefs.h"
       
    30 
       
    31 
       
    32 // FORWARD DECLARATION
       
    33 class CMceSipSession;
       
    34 class CSIPServerTransaction;
       
    35 class CSIPClientTransaction;
       
    36 class CMceMsgBase;
       
    37 class CMceMediaManager;
       
    38 class CSIPHeaderBase;
       
    39 class CSdpDocument;
       
    40 class CSIPMessageElements;
       
    41 class CMceComSession;
       
    42 class CSIPResponseElements;
       
    43 class CMceMsgSIPReply;
       
    44 class CMceMsgSIPData;
       
    45 class TMceMccComEvent;
       
    46 class TMceStateTransitionEvent;
       
    47 
       
    48 
       
    49 const TInt KMceAutoReasonPhrase = KErrNotFound;
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54 *  MCE SIP session.
       
    55 *
       
    56 *  @lib 
       
    57 *  @since
       
    58 */
       
    59 class TMceActionSet 
       
    60 	{
       
    61 	
       
    62 public: // Constructors and destructor
       
    63 
       
    64 	/**
       
    65 	* C++ constructor
       
    66 	* @param aSession, reference to session.
       
    67 	*/
       
    68 	TMceActionSet( CMceSipSession& aSession );
       
    69 
       
    70 public://state changing related
       
    71 
       
    72 	/**
       
    73 	* Changes server state
       
    74 	* @param aNewState new server state
       
    75 	*/
       
    76     void StateChanged( TMceStateIndex aNewState );
       
    77 
       
    78 	/**
       
    79 	* Changes client state synchronously as a response 
       
    80 	* to client's ITC call
       
    81 	* @param aIds set of ids defining ITC call context
       
    82 	* @param aNewState new client state
       
    83 	* @param aStatus status
       
    84 	*/
       
    85     void ClientStateChanged( TMceIds& aIds, 
       
    86                              CMceSession::TState aNewState,
       
    87                              TInt aStatus = KErrNone );
       
    88                              
       
    89 	/**
       
    90 	* Changes client state. 
       
    91 	* This is called when there is no SIP data for client
       
    92 	* explaining the reason of state change. This happens,
       
    93 	* for example, when client is establishing session and
       
    94 	* there is no response, but media manager fails in offer
       
    95 	* creation.
       
    96 	* @param aNewState new client state
       
    97 	* @param aReason a reason of state change
       
    98 	*/
       
    99     void ClientStateChangedL( CMceSession::TState aNewState, 
       
   100                               TInt aReason = KErrNone );
       
   101         
       
   102 	/**
       
   103 	* Changes client state. 
       
   104 	* This is called when there is SIP response explaining
       
   105 	* the reason of state change. If handling of response fails
       
   106 	* (error) reason is used for identifying the problem.
       
   107 	* @param aNewState new client state
       
   108 	* @param aResponse SIP response
       
   109 	* @param aReason a reason of state change
       
   110 	*/
       
   111     void ClientStateChangedL( CMceSession::TState aNewState, 
       
   112                               CSIPClientTransaction& aResponse,
       
   113                               TInt aReason = KErrNone );
       
   114                               
       
   115                               
       
   116 	/**
       
   117 	* Changes client state. 
       
   118 	* This is called when there is SIP request explaining
       
   119 	* the reason of state change. Only BYE is supported.
       
   120 	* This method should not be used when handling INVITE request,
       
   121 	* becauseINVITE causes always new incoming session creation and thus
       
   122 	* state change is always EIncoming. 
       
   123 	* @param aNewState new client state
       
   124 	* @param aRequest SIP request
       
   125 	* @param aReason a reason of state change
       
   126 	*/
       
   127     void ClientStateChangedL( CMceSession::TState aNewState, 
       
   128                               CSIPServerTransaction& aRequest );
       
   129 
       
   130 
       
   131 	/**
       
   132 	* Changes client state. Used in session update.
       
   133 	* This is called when there is SIP response explaining
       
   134 	* the reason of state change and client session (body) must be 
       
   135 	* updated because of it. If handling of response has been 
       
   136 	* failed (error) reason is used for identifying the problem.
       
   137 	* If reason is other than KErrNone, EMceItcUpdateFailed is 
       
   138 	* used in callback.
       
   139 	* @param aNewState new client state
       
   140 	* @param aBody client session
       
   141 	* @param aResponse SIP response
       
   142 	* @param aReason a reason of state change
       
   143 	*/
       
   144     void ClientStateChangedL( CMceSession::TState aNewState, 
       
   145                               CMceComSession& aBody,
       
   146                               CSIPClientTransaction& aResponse,
       
   147                               TInt aReason = KErrNone );
       
   148 
       
   149 	/**
       
   150 	* Changes client state. Used in session update.
       
   151 	* This is called when client session (body) must be 
       
   152 	* updated. This happens, for example, when client is updating
       
   153 	* session, but media manager fails in update creation and 
       
   154 	* rollback is needed.
       
   155 	* EMceItcUpdateFailed call back is used always
       
   156 	* used in callback.
       
   157 	* @param aNewState new client state
       
   158 	* @param aBody client session
       
   159 	* @param aReason a reason of state change
       
   160 	*/
       
   161     void ClientStateChangedL( CMceSession::TState aNewState, 
       
   162                               CMceComSession& aBody, 
       
   163                               TInt aReason );
       
   164 
       
   165     
       
   166     
       
   167 	/**
       
   168 	* informs client of occured severe error
       
   169 	* @param aError a reason of error
       
   170 	*/
       
   171     void ClientErrorOccured( TInt aError );
       
   172     
       
   173     
       
   174 public://basic session establisment and update
       
   175     
       
   176     /**
       
   177     * Encode body to SDP. Encoded body can me obtained with 
       
   178     * Offer() method.
       
   179     */
       
   180     void EncodeL();
       
   181     
       
   182     /**
       
   183     * Decode body from SDP, which is created with
       
   184     * method CreateSDP() and stored as session offer.
       
   185     * @return warning code
       
   186     */
       
   187     TMceSipWarningCode DecodeL();
       
   188     
       
   189     /**
       
   190     * Decode body from SDP, which is created with
       
   191     * method CreateSDP() and stored as session offer.
       
   192     * @return warning code
       
   193     */
       
   194     TMceSipWarningCode Decode();
       
   195 
       
   196     /**
       
   197     * Update media manager according to body
       
   198     * @return return status:
       
   199     *       -System error < 0: error situation
       
   200     *       -KMceReady: update was synchronous
       
   201     *       -KMceAsync: updating asynchronously, wait EMEMediaUpdated event. 
       
   202     */
       
   203     TMceReturnStatus UpdateL();
       
   204     
       
   205     /**
       
   206     * Update media manager according to body
       
   207     * @return return status:
       
   208     *       -System error < 0: error situation
       
   209     *       -KMceReady: update was synchronous
       
   210     *       -KMceAsync: updating asynchronously, wait EMEMediaUpdated event. 
       
   211     */
       
   212     TMceReturnStatus Update();
       
   213 
       
   214     /**
       
   215     * Reserve resources
       
   216     * @return return status:
       
   217     *       -System error < 0: error situation
       
   218     *       -KMceReady: reservation was synchronous or not needed
       
   219     *       -KMceAsync: reserving asynchronously, wait EMEMediaReserved event. 
       
   220     */                  
       
   221     TMceReturnStatus ReserveL();
       
   222     
       
   223     /**
       
   224     * Update clients parameters in body
       
   225     * @param aIds set of ids defining ITC call context
       
   226     * @param aBody client session
       
   227     */
       
   228     void UpdateBodyL( TMceIds& aIds, CMceMsgBase& aBody );
       
   229     
       
   230     /**
       
   231     * Create body candidate for session update.
       
   232     * @param aType the direction of the body candidate
       
   233     */
       
   234     void CreateBodyCandidateL( CMceComSession::TType aType );
       
   235     
       
   236     /**
       
   237     * Returns truth value, reservation needed.
       
   238     * @return ETrue, if reservation is needed
       
   239     */
       
   240     TBool ReservationNeeded();
       
   241     
       
   242     /**
       
   243 	* Sends INVITE with SDP
       
   244 	*/
       
   245     void SendInviteL();
       
   246     
       
   247 	/**
       
   248 	* Informs client about new incoming session
       
   249 	* @param aInvite server transaction
       
   250 	*/
       
   251     void ClientUpdateIncomingSessionL( CSIPServerTransaction& aInvite );
       
   252     
       
   253 	/**
       
   254 	* Informs client about new incoming session update
       
   255 	* @param aInvite server transaction
       
   256 	* @param aCallback callback for client
       
   257 	*/
       
   258     void ClientUpdateSessionL( CSIPServerTransaction& aInvite, 
       
   259                                TUint32 aCallback = EMceItcIncomingUpdate );
       
   260     
       
   261 public://requests
       
   262 
       
   263 	/**
       
   264 	* Sends INVITE
       
   265 	* @param aData session body for creation of SDP content
       
   266 	*/
       
   267     void SendInviteL( CMceComSession& aData );
       
   268     
       
   269 	/**
       
   270 	* Sends ACK to response (2XX)
       
   271 	* @param aResponse client transaction
       
   272 	*/
       
   273 	void SendACKL( CSIPClientTransaction& aResponse );
       
   274 	
       
   275 	/**
       
   276 	* Sends BYE with default headers
       
   277 	*/
       
   278     void SendBYEL();
       
   279     
       
   280 	/**
       
   281 	* Sends BYE with client defined headers and content
       
   282 	* This is called when client terminates (EMceItcTerminateSession)
       
   283 	* @param aData data containing headers
       
   284 	*/
       
   285     void SendBYEL( CMceMsgBase& aData );
       
   286 
       
   287 	/**
       
   288 	* Sends CANCEL
       
   289     * @return ETrue, if CANCEL was sent
       
   290 	*/
       
   291     TBool SendCancelL();
       
   292     
       
   293     /**
       
   294 	* Sends UPDATE
       
   295     * @return ETrue, if UPDATE was sent
       
   296 	*/
       
   297     void SendUpdateRequestL();
       
   298     
       
   299     /**
       
   300 	* Sends PRACK
       
   301 	* @param aContent if ETrue, use content in PRACK
       
   302     * @return ETrue, if PRACK was sent
       
   303 	*/
       
   304     void SendPrackL( TBool aContent = ETrue );
       
   305     
       
   306 	/**
       
   307 	* Sends Extension Request 
       
   308 	* @param  aData SIP data 
       
   309 	* @param aIds set of ids defining ITC call context
       
   310    	*/
       
   311     void SendExtensionRequestL( CMceMsgBase& aData, TMceIds& aIds );
       
   312     
       
   313     
       
   314     /**
       
   315 	* Receive Response to the Extension Requests sent.
       
   316 	* @param aEvent, event
       
   317 	*/
       
   318     void ReceiveExtensionRequestL( TMceStateTransitionEvent& aEvent );
       
   319     
       
   320     /**
       
   321 	* Receive Error for an Extension Request sent. 
       
   322 	* Error Can be anything like ICMP, SIP Timeout.
       
   323 	* @param aRequest, request for which error is received.
       
   324 	*/
       
   325     void ReceiveExtensionError( CSIPTransactionBase& aTransaction, TInt aError );
       
   326 
       
   327                  
       
   328 public://responses
       
   329 
       
   330 
       
   331 	/**
       
   332 	* Sends answer to offer carried by INVITE
       
   333 	* This is called when client accepts (EMceItcAcceptSession)
       
   334 	* @param aRequest server transaction
       
   335 	* @param aReply user defined response (CMceMsgSIPReply)
       
   336 	*/
       
   337     void SendAnswerL( CSIPServerTransaction& aRequest, 
       
   338                       CMceMsgBase& aReply );
       
   339                       
       
   340 	/**
       
   341 	* Sends answer to offer carried by re-INVITE
       
   342 	* @param aRequest the re-invite
       
   343 	*/
       
   344     void SendAnswerL( CSIPServerTransaction& aRequest );
       
   345     
       
   346 	/**
       
   347 	* Sends rejection 488 Not Acceptable Here to offer with warning,
       
   348 	* if warning is assigned to one of 3xx warnings. If warning is assigned
       
   349 	* to 4xx, 5xx or 6xx it is been interpretet as response code.
       
   350 	* @param aReason reason why 488 or response code is sent
       
   351 	* @param aInvite server transaction
       
   352 	*/
       
   353     void SendRejectOfferWithWarningL( TMceSipWarningCode aReason, 
       
   354                                       CSIPServerTransaction& aInvite );
       
   355 	/**
       
   356 	* Sends 200OK reponse (to BYE)
       
   357 	* @param aRequest server transaction
       
   358 	*/
       
   359     void Send200OKL( CSIPServerTransaction& aRequest );
       
   360     
       
   361 	/**
       
   362 	* Sends 603 Decline or user response to request (INVITE)
       
   363 	* @param aRequest server transaction
       
   364 	* @param aReply user defined response (CMceMsgSIPReply)
       
   365 	*/
       
   366     void SendDeclineL( CSIPServerTransaction& aRequest, 
       
   367                        CMceMsgBase& aReply );
       
   368     
       
   369 	/**
       
   370 	* Sends 180 Ringing to request (INVITE)
       
   371 	* @param aRequest server transaction
       
   372 	* @param aReply user defined response (CMceMsgSIPReply)
       
   373 	* @return ETrue, if response was sent reliably
       
   374 	*/
       
   375     TBool SendRingL( CSIPServerTransaction& aRequest,
       
   376                     CMceMsgBase& aReply );
       
   377 
       
   378     /**
       
   379 	* Sends 182 SipQueued message to request (INVITE)
       
   380 	* @param aRequest server transaction
       
   381 	* @param aReply user defined response (CMceMsgSIPReply)
       
   382 	* @return ETrue, if response was sent reliably
       
   383 	*/
       
   384 
       
   385 	
       
   386     TBool SendSipQueuedL( CSIPServerTransaction& aRequest,
       
   387                           CMceMsgBase& aReply );
       
   388 	
       
   389                         
       
   390     /**
       
   391 	* Sends a response to request (INVITE). 
       
   392 	* For responses sent automatically by state machine, 
       
   393 	* not for those coming from client.
       
   394 	* @param aRequest server transaction
       
   395 	* @param aCode the reason code
       
   396 	* @param aReason the reasn phrase as string pool index
       
   397 	*/
       
   398     void SendResponseL( CSIPServerTransaction& aRequest,
       
   399                         TUint32 aCode,
       
   400                         TInt aReason );
       
   401 
       
   402     /**
       
   403     * Seize re-sending UPDATE/PRACK. 
       
   404     * @return ETrue if interrupt succeeded.
       
   405     */                           
       
   406     TBool InterruptConfirming();
       
   407 	
       
   408    /**
       
   409 	* Receive Responses to the Extnesion request sent.
       
   410 	* @param aResponse, response need to be sent to the client
       
   411 	* @param aBody session body
       
   412 	*/
       
   413     
       
   414     void ReceiveExtensionResponseL( CSIPClientTransaction& aResponse, 
       
   415     						CMceComSession& aBody );
       
   416     
       
   417 
       
   418 	/**
       
   419 	* Sends a response to the extension requests received
       
   420 	* @param  aData SIP data 
       
   421 	* @param aIds set of ids defining ITC call context
       
   422 	*/
       
   423     void SendExtensionResponseL( CMceMsgBase& aData, TMceIds& aIds );
       
   424        
       
   425     
       
   426 public://new functions
       
   427 
       
   428 	/**
       
   429 	* Called when update has been succeed
       
   430 	*/
       
   431     void UpdateSucceed();
       
   432     
       
   433 	/**
       
   434 	* Called when update has been failed
       
   435 	*/
       
   436     void UpdateFailed();
       
   437     
       
   438 	/**
       
   439 	* Encodes session body
       
   440 	* @return aEncodedBody place holder to encode session body
       
   441 	*/
       
   442     HBufC8* BodyToTextL();
       
   443 
       
   444 	/**
       
   445 	* Creates SDP document based on client/server transaction
       
   446 	* @param aSDPContainer transaction 
       
   447 	* containing SDP document in its content
       
   448 	* @return system wide error / SDP error
       
   449 	*/
       
   450     TInt CreateSDP( CSIPTransactionBase& aSDPContainer );
       
   451     
       
   452     
       
   453    /**
       
   454     * Process the ReliableResponse 
       
   455     * @return EFalse if response contains RSeq value that is not one higher than the last one.
       
   456     */
       
   457     TBool ProcessReliableResponse( const CSIPResponseElements& aResponseElements );
       
   458     
       
   459     
       
   460     /**
       
   461     * Handle Reliable Response 
       
   462     * @return EFalse if response contains RSeq value that is not one higher than the last one.
       
   463     */
       
   464 	TBool TMceActionSet::NeedToProcessL( TMceStateTransitionEvent& aEvent );
       
   465     
       
   466     
       
   467     /**
       
   468     * Check if session response contact header has sips uri or tls parameters
       
   469     * @param aTransaction sip transaction msgs
       
   470     * @return void
       
   471     */
       
   472     void CheckContactIsSecureL( CSIPTransactionBase& aTransaction );
       
   473     
       
   474     
       
   475    /**
       
   476     * Finds if the Request is Extenssion Request
       
   477     * @return ETrue if the Request is Extension Request
       
   478     */
       
   479 
       
   480     TBool IsExtensionRequest( RStringF method );
       
   481 
       
   482     
       
   483 public://Session timer related
       
   484 	
       
   485 	/**
       
   486 	* Process session timer data in received INVITE
       
   487 	* @param aRequest the request
       
   488 	*/
       
   489 	void ProcessSessionTimerServerL( CSIPServerTransaction& aRequest );
       
   490 
       
   491 	/**
       
   492 	* Process session timer data in received response
       
   493 	* @param aResponse the response
       
   494 	*/
       
   495 	void ProcessSessionTimerClientL( CSIPClientTransaction& aResponse );
       
   496 	
       
   497 	/**
       
   498 	* Resets session timer
       
   499 	*/
       
   500     void ResetSessionTimerL();
       
   501 
       
   502     /**
       
   503 	* Stop pending timer
       
   504 	*/
       
   505     void StopPendingTimer();
       
   506 
       
   507 	/**
       
   508 	* Sends re-invite indicating session refresh
       
   509 	*/
       
   510     void SendSessionRefreshL();
       
   511     
       
   512 public://Media related
       
   513 
       
   514 	/**
       
   515 	* Handles ITC function, which controls media
       
   516 	* @param aIds set of ids defining ITC call context
       
   517 	* @param aAction ITC function defining the action
       
   518 	* @return aReturnMessage message to return
       
   519 	*/
       
   520     HBufC8* ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction );
       
   521 
       
   522 	/**
       
   523 	* Handles ITC function, which controls media
       
   524 	* @param aIds set of ids defining ITC call context
       
   525 	* @param aAction ITC function defining the action
       
   526 	* @param aMessage message
       
   527 	*/
       
   528     void ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction,
       
   529                         const TDesC8& aMessage );
       
   530 
       
   531 	/**
       
   532 	* Handles ITC function, which controls media
       
   533 	* @param aIds set of ids defining ITC call context
       
   534 	* @param aAction ITC function defining the action
       
   535 	* @param aMessage message
       
   536 	*/
       
   537     void ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction,
       
   538                         TPtr8& aMessage );
       
   539 
       
   540     
       
   541 	/**
       
   542 	* Stops all media
       
   543 	*/
       
   544     void StopMedia();
       
   545     
       
   546     /*
       
   547     * stop the ongoing updating media
       
   548     */
       
   549     void StopUpdatingMedia();
       
   550 
       
   551 
       
   552 	/**
       
   553 	* Informs client about new incoming session update
       
   554 	* @param aInvite server transaction
       
   555 	*/
       
   556     void ClientMediaStateChangedL( TMceMccComEvent* aMccEvent, 
       
   557                                   TMceMediaEventCode aEvent = EMceMediaEventReceived );
       
   558     
       
   559 
       
   560 protected://methods
       
   561 
       
   562 
       
   563 	/**
       
   564 	* Converts SDP document to text
       
   565 	* @param aDocument SDP document
       
   566 	* @return SDP document as text
       
   567 	*/
       
   568 	HBufC8* CreateSDPContentLC( CSdpDocument& aDocument );
       
   569 		
       
   570 	/**
       
   571 	* Creates multipart-mixed content
       
   572 	* @param aDocument SDP document
       
   573 	* @param aUserContentType user defined content type to be mixed in
       
   574 	* @param aUserContent user content to be mixed in
       
   575 	* @return multipart-mixed content
       
   576 	*/
       
   577     HBufC8* CreateMultipartContentLC( CSdpDocument& aDocument,
       
   578         	                          const TDesC8& aUserContentType, 
       
   579         	                          const TDesC8& aUserContent );
       
   580 
       
   581 	/**
       
   582 	* Process session timer data in received INVITE
       
   583 	* @param aElements message elements
       
   584 	*/
       
   585     void ProcessSessionTimerServerL( const CSIPMessageElements& aElements );
       
   586     
       
   587 	/**
       
   588 	* Adds session timer headers, when session is acting as server, 
       
   589 	* to response
       
   590 	* @param aSipHeaders SIP headers container
       
   591 	*/
       
   592 	void AddSessionTimerFieldsServerL( 
       
   593 	                                  RPointerArray<CSIPHeaderBase>& aHeaders );
       
   594 	/**
       
   595 	* Adds session timer headers, when session is acting as client, 
       
   596 	* to request
       
   597 	* @param aSipHeaders SIP headers container
       
   598 	*/
       
   599 	void AddSessionTimerFieldsClientL( 
       
   600 	                            RPointerArray<CSIPHeaderBase>& aSipHeaders );
       
   601 
       
   602 	/**
       
   603 	* Sends response to request.
       
   604 	* @param aRequest the request
       
   605 	* @param aResponse the response from client
       
   606 	* @return ETrue, if response was sent reliably
       
   607 	*/
       
   608     TBool SendResponseL( CSIPServerTransaction& aRequest, 
       
   609                         CMceMsgSIPReply& aResponse );
       
   610                         
       
   611 	/**
       
   612 	* Sends warning response to request.
       
   613 	* @param aResponseCode the response code
       
   614 	* @param aWarnCode the warning code
       
   615 	* @param aRequest the request
       
   616 	*/
       
   617     void SendWarningResponseL( const TUint aResponseCode,
       
   618                                const TUint aWarnCode,
       
   619                                CSIPServerTransaction& aRequest );
       
   620 
       
   621 	/**
       
   622 	* Processes invite
       
   623 	* @param aBody session body
       
   624 	* @param aInvite the invite
       
   625 	*/
       
   626     const CSIPMessageElements* ProcessInviteL( 
       
   627                                     CMceComSession& aBody,
       
   628                                     CSIPServerTransaction& aInvite );
       
   629                                                
       
   630 	/**
       
   631 	* Sends session body via callback mechanism to client (session)
       
   632 	* @param aIds set of ids defining ITC callback context
       
   633 	* @param aBody session body
       
   634 	* @param aContent content of message
       
   635 	*/
       
   636     void SendBodyToClientL( TMceIds& aIds,
       
   637                             CMceComSession& aBody, 
       
   638                             HBufC8* aContent );
       
   639 
       
   640     
       
   641 	/**
       
   642 	* Sends SIP data via callback mechanism to client (session)
       
   643 	* @param aIds set of ids defining ITC callback context
       
   644 	* @param aData SIP data
       
   645 	* @param aContent content of message
       
   646 	*/
       
   647     void SendSIPDataToClientL( TMceIds& aIds,
       
   648                                CMceMsgBase& aData, 
       
   649                                HBufC8* aContent );
       
   650                                 
       
   651 
       
   652 	/**
       
   653 	* Fills client reply from SIP response
       
   654 	* @param aReply client reply
       
   655 	* @param aResponse SIP response
       
   656 	* @return message elements
       
   657 	*/
       
   658     const CSIPMessageElements* ResponseDataL( 
       
   659                                         CMceMsgSIPReply& aReply, 
       
   660                                         CSIPClientTransaction& aResponse,
       
   661                                         CMceComSession& aBody );
       
   662                                               
       
   663 	/**
       
   664 	* Fills session body from SIP request
       
   665 	* @param aContainer session body
       
   666 	* @param aRequest SIP request
       
   667 	* @return message elements
       
   668 	*/
       
   669     const CSIPMessageElements* RequestDataL( CMceComSession& aContainer, 
       
   670                                              CSIPServerTransaction& aRequest );
       
   671                                               
       
   672 	/**
       
   673 	* Fills client (request) data from SIP request
       
   674 	* @param aContainer client (request) data
       
   675 	* @param aRequest SIP request
       
   676 	* @return message elements
       
   677 	*/
       
   678     const CSIPMessageElements* RequestDataL( CMceMsgSIPData& aContainer, 
       
   679                                              CSIPServerTransaction& aRequest );
       
   680 
       
   681 	/**
       
   682 	* Adds SIP headers to SIP request/response. If no headers, adds
       
   683 	* default headers
       
   684 	* @param aMessageElements message elements of SIP request/response
       
   685 	* @param aPrimaryHeaders headers
       
   686 	* @param aMethodInd if request, indicates method, whose default headers
       
   687 	* @param aContact if ETrue, the Contact header is created and added
       
   688 	* will be added
       
   689 	*/
       
   690     void AddHeadersL( CSIPMessageElements& aMessageElements,
       
   691                       CDesC8Array* aPrimaryHeaders,
       
   692                       TInt aMethodInd = KErrNotFound );
       
   693 
       
   694 	/**
       
   695 	* Adds SIP headers to SIP request/response. If no headers, adds
       
   696 	* default headers
       
   697 	* @param aHeaders SIP headers container
       
   698 	* @param aPrimaryHeaders headers
       
   699 	* @param aMethodInd if request, indicates method, whose default headers
       
   700 	* @param aContact if ETrue, the Contact header is created and added
       
   701 	* will be added
       
   702 	*/
       
   703     void AddHeadersL( RPointerArray<CSIPHeaderBase>& aHeaders,
       
   704                       CDesC8Array* aPrimaryHeaders,
       
   705                       TInt aMethodInd = KErrNotFound );
       
   706     
       
   707     /**
       
   708     * Adds the SIP extension headers according to support of the extensions.
       
   709     * @param aHeaders SIP headers container
       
   710     * @param aTransactionType the transaction type as SIP string constant
       
   711     * @param aIsBody ETrue, if request/response will contain a body
       
   712     * @param aIsResponse ETrue, if the headers are for response 
       
   713     * @param aResponseCode the response code
       
   714     * @return ETrue if this yelds to a relibly sent provisional response.
       
   715     */
       
   716     TBool AddExtensionHeadersL( RPointerArray<CSIPHeaderBase>& aHeaders,
       
   717                                 TInt aTransactionType,
       
   718                                 TBool aIsBody,
       
   719                                 TBool aIsResponse = EFalse,
       
   720                                 TUint aResponseCode = KErrNone );
       
   721 
       
   722     /**
       
   723     * Sends specified request. Supports INVITE, PRACK and UPDATE.
       
   724     * @param the request method as SIP string
       
   725     * @param client data
       
   726 	* @param aContent if ETrue, use content in request
       
   727     */
       
   728     void SendRequestL( TInt aMethod, CMceComSession* aData = NULL, 
       
   729                        TBool aContent = ETrue );
       
   730                            
       
   731     /**
       
   732     * Find active body for sip session.
       
   733     * @return active body
       
   734     */
       
   735     CMceComSession& ActiveBody();
       
   736     
       
   737     
       
   738 private://data
       
   739     
       
   740     //SIP session instance
       
   741     CMceSipSession& iSession;
       
   742     
       
   743 	//definitions for unit testing
       
   744 	MCESRV_UT_DEFINITIONS
       
   745 
       
   746 	};
       
   747 
       
   748 
       
   749 /**
       
   750  * implementaion of event handler interface
       
   751  *
       
   752  */
       
   753 class TMceComEventHandler : public  MMceEventHandler
       
   754     {
       
   755     
       
   756 public:
       
   757 
       
   758      TMceComEventHandler( CMceMediaManager& aMediaManager );
       
   759     
       
   760      TMceComEventHandler( CMceMediaManager& aMediaManager,
       
   761                           TPtr8& aWriteData );
       
   762 
       
   763      TMceComEventHandler( CMceMediaManager& aMediaManager,
       
   764                           const TDesC8& aReadData );
       
   765 
       
   766      TMceComEventHandler( CMceMediaManager& aMediaManager,
       
   767                           HBufC8*& aWriteData );
       
   768 
       
   769     /**
       
   770      * Handles event for sink
       
   771      * @param aTarget target
       
   772      * @param aEvent event
       
   773      */
       
   774      TInt HandleL( CMceComMediaSink& aTarget, TMceComEvent& aEvent );
       
   775      
       
   776     /**
       
   777      * Handles event for source
       
   778      * @param aTarget target
       
   779      * @param aEvent event
       
   780      */
       
   781      TInt HandleL( CMceComMediaSource& aTarget, TMceComEvent& aEvent );
       
   782      
       
   783     /**
       
   784      * Handles event for rtp sink
       
   785      * @param aTarget target
       
   786      * @param aEvent event
       
   787      */
       
   788      TInt HandleL( CMceComRtpSink& aTarget, TMceComEvent& aEvent );
       
   789      
       
   790     /**
       
   791      * Handles event for rtp source
       
   792      * @param aTarget target
       
   793      * @param aEvent event
       
   794      */
       
   795      TInt HandleL( CMceComRtpSource& aTarget, TMceComEvent& aEvent );
       
   796      
       
   797      
       
   798     /**
       
   799      * Handles event for speaker sink
       
   800      * @param aTarget target
       
   801      * @param aEvent event
       
   802      */
       
   803      TInt HandleL( CMceComSpeakerSink& aTarget, TMceComEvent& aEvent );
       
   804      
       
   805     /**
       
   806      * Handles event for display sink
       
   807      * @param aTarget target
       
   808      * @param aEvent event
       
   809      */
       
   810      TInt HandleL( CMceComDisplaySink& aTarget, TMceComEvent& aEvent );
       
   811     
       
   812     /**
       
   813      * Handles event for mic source
       
   814      * @param aTarget target
       
   815      * @param aEvent event
       
   816      */
       
   817      TInt HandleL( CMceComMicSource& aTarget, TMceComEvent& aEvent );
       
   818 
       
   819     /**
       
   820      * Handles event for camera source
       
   821      * @param aTarget target
       
   822      * @param aEvent event
       
   823      */
       
   824      TInt HandleL( CMceComCameraSource& aTarget, TMceComEvent& aEvent );
       
   825     
       
   826     /**
       
   827      * Handles event for file source
       
   828      * @param aTarget target
       
   829      * @param aEvent event
       
   830      */
       
   831      TInt HandleL( CMceComFileSource& aTarget, TMceComEvent& aEvent );
       
   832 
       
   833     /**
       
   834      * Handles event for file sink
       
   835      * @param aTarget target
       
   836      * @param aEvent event
       
   837      */
       
   838      TInt HandleL( CMceComFileSink& aTarget, TMceComEvent& aEvent );
       
   839 
       
   840      
       
   841 private://NOT owned data
       
   842     
       
   843      //media manager instance
       
   844      CMceMediaManager& iMediaManager;
       
   845 
       
   846      TPtr8* iWriteData;
       
   847      const TDesC8* iReadData;
       
   848      
       
   849      HBufC8** iReturnData;
       
   850      
       
   851      };
       
   852 
       
   853 
       
   854 #endif //MCEACTIONSET_H
       
   855 
       
   856 
       
   857 // End of File