sipproviderplugins/sipprovider/sipconnectionplugins/inc/sipscpr.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // SIP SubConnection Provider class.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef SYMBIAN_SIPSCPR_H
       
    24 #define SYMBIAN_SIPSCPR_H
       
    25 
       
    26 #include <comms-infras/ss_subconnprov.h>
       
    27 #include <comms-infras/corescpr.h>
       
    28 #include <comms-infras/corescprstates.h>
       
    29 #include <comms-infras/corescpractivities.h>
       
    30 #include <cs_subconevents.h>
       
    31 #include <cs_subconparams.h>
       
    32 #include <sip_subconevents.h>
       
    33 #include <sip_subconparams.h>
       
    34 #include <comms-infras/ss_nodemessages.h>
       
    35 #include <comms-infras/ss_mmnode.h>
       
    36 #include <comms-infras/ss_parameterfamilybundle.h>
       
    37 
       
    38 #include <comms-infras/ss_log.h>
       
    39 #include "sipscprfactory.h"
       
    40 #include "SipStateMachine.h"	
       
    41 #include "transitionengine.h"
       
    42 #include "sipprovisioninfo.h" 
       
    43 #include "sipcprmessages.h"
       
    44 
       
    45 
       
    46 #ifdef __CFLOG_ACTIVE
       
    47 	#define KSipSCprTag KESockSubConnectionTag
       
    48 	_LIT8(KSipSCprSubTag, "sipscpr");
       
    49 #endif
       
    50 
       
    51 
       
    52 namespace SipSCprStates
       
    53 	{
       
    54 
       
    55 	class TNoTagOrAlreadyStarted;
       
    56     class TNoTagOrAlreadyStopped;
       
    57    	class TStoreProvision;
       
    58     class TStartSession;
       
    59     class TAwaitingSessionEstablished;    
       
    60     class TStopSession;
       
    61     class TAwaitingSessionTerminated;
       
    62     class TSetParameters;
       
    63     //class TSendProviderDown;
       
    64 	}
       
    65 
       
    66 
       
    67 namespace SipSCpr
       
    68 {
       
    69 enum TSCprStage
       
    70   	{
       
    71    	EFresh = 0,
       
    72    	EStarting,
       
    73    	EActive,
       
    74    	EStopping,
       
    75    	EStopped
       
    76    	};
       
    77 }
       
    78 	
       
    79 class TSipSCprMessages
       
    80 	{
       
    81 public:
       
    82 	enum 
       
    83 	{ERealmId = 0x200041F6};
       
    84 private:
       
    85 	enum
       
    86 	{	
       
    87 	ESipSCprSessionEstablished = Messages::TEBase::TNull::EId+8000,
       
    88 	ESipSCprSessionTerminated,
       
    89 	ESipSCprSessionError,
       
    90 	EConnectionUp
       
    91 	};
       
    92 public:
       
    93 	typedef Messages::TMessageSigNumber<ESipSCprSessionEstablished, TSipSCprMessages::ERealmId> TSipSessionEstablished;
       
    94 	typedef Messages::TMessageSigNumber<ESipSCprSessionTerminated, TSipSCprMessages::ERealmId> TSipSessionTerminated;
       
    95 	typedef Messages::TMessageSigNumber<ESipSCprSessionError, TSipSCprMessages::ERealmId> TSipSessionError;
       
    96 	typedef Messages::TMessageSigNumber<EConnectionUp, TSipSCprMessages::ERealmId> TConnectionUp;	
       
    97 	};
       
    98 
       
    99 
       
   100 class CSipSubConnectionProvider : public CCoreSubConnectionProvider,
       
   101 									public MSIPStateMachineClient
       
   102 /** SIP subconnection provider
       
   103 
       
   104 @internalTechnology
       
   105 @released Since 9.4 */
       
   106     {
       
   107     friend class CSipSubConnectionProviderFactory;
       
   108 	friend class SipSCprStates::TNoTagOrAlreadyStarted;
       
   109     friend class SipSCprStates::TNoTagOrAlreadyStopped;
       
   110    	friend class SipSCprStates::TStoreProvision;
       
   111     friend class SipSCprStates::TStartSession;
       
   112     friend class SipSCprStates::TAwaitingSessionEstablished;    
       
   113     friend class SipSCprStates::TStopSession;
       
   114     friend class SipSCprStates::TAwaitingSessionTerminated;
       
   115     friend class SipSCprStates::TSetParameters;
       
   116     //friend class SipSCprStates::TSendProviderDown;
       
   117     
       
   118 	
       
   119 public:
       
   120     typedef CSipSubConnectionProviderFactory FactoryType;   
       
   121     
       
   122     static CSipSubConnectionProvider* NewL(ESock::CSubConnectionProviderFactoryBase& aFactory, TSubConnOpen::TSubConnType aSubConnType);
       
   123     
       
   124     /**
       
   125     Destructor of the class
       
   126     */
       
   127 	virtual ~CSipSubConnectionProvider();
       
   128 	
       
   129 	/**
       
   130 	Returns the address of the object of this class. This address will be used to create 
       
   131 	SIP high-level state machine
       
   132 	*/
       
   133 	MSIPStateMachineClient* NodeAddr();
       
   134 	
       
   135 	//-=========================================================
       
   136 	// MSIPStateMachineClient methods
       
   137 	//-=========================================================	
       
   138 	virtual void CallEstablished();
       
   139 	virtual void CallTerminated(TInt aError, TInt aSipCode);
       
   140 	virtual void IncomingCall(TIncomingCallParameters& aCallParams);
       
   141 	virtual void CredentialsRequired(const TDesC8 & aRealm);    
       
   142 	virtual void ReceiveNotification(TDesC8 & aNotification);
       
   143 	
       
   144 	TSubConnOpen::TSubConnType subconType;
       
   145 
       
   146 protected:
       
   147     CSipSubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory);
       
   148     /**
       
   149     Second-level of the construction of the object of the class
       
   150     
       
   151     @aSubConnType  subconnection type (Could be CreateNew, Default and WaitIncoming)
       
   152     */
       
   153     void ConstructL(TSubConnOpen::TSubConnType aSubConnType);
       
   154     
       
   155     virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
       
   156     
       
   157     /**
       
   158     intializes the iParameterBundle with the incoming conneciton paramenter values
       
   159     
       
   160     @param aCallParams, incoming connection parameter values
       
   161     */
       
   162 	void InitialiseParametersL(TIncomingCallParameters& aCallParams);
       
   163 	
       
   164 	// Sets the parameters(invite or subscribe) into SIP state machine
       
   165 	void DoParametersAboutToBeSetL(ESock::RCFParameterFamilyBundle_const& aParameterBundle);
       
   166 	
       
   167 	/**
       
   168 	Creates the SIP High-level state machine 
       
   169 	*/
       
   170 	void CreateStateMachineL();
       
   171 	
       
   172 		
       
   173 protected:
       
   174 	TBool					iAwaitingSubConnection;
       
   175 	SipSCpr::TSCprStage		iStage;
       
   176 	CSipStateMachine*		iSipSm;
       
   177 	CSIPTransitionEngine*	iTransitionEngine;
       
   178 	//TPtrC8					iFromField;
       
   179 	TDesC8*					iFromField;
       
   180 	TInt					iStopCode;
       
   181 	TInt 					iActivityAwaitingResponse;
       
   182     };
       
   183 
       
   184 #endif //SYMBIAN_SIPSCPR_H
       
   185