sipproviderplugins/sipprovider/sipconnectionplugins/src/sipdeftscpr.cpp
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 Default SubConnection Provider implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include "sipdeftscpr.h"
       
    24 #include "sipscprstates.h"
       
    25 //#include <ss_nodemessages_service_provider.h>
       
    26 
       
    27 using namespace ESock;
       
    28 using namespace NetStateMachine;
       
    29 using namespace Messages;
       
    30 using namespace MeshMachine;
       
    31 
       
    32 
       
    33 //-=========================================================
       
    34 //
       
    35 // Activities
       
    36 //
       
    37 //-========================================================
       
    38 
       
    39 namespace SipDeftSCprProvisionActivity
       
    40 {
       
    41 DECLARE_DEFINE_NODEACTIVITY(ECFActivityStoreProvision, SipDeftSCprProvision, TCFDataClient::TProvisionConfig)
       
    42 	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingProvision, MeshMachine::TNoTag)	
       
    43 	LAST_NODEACTIVITY_ENTRY(KNoTag, PRStates::TStoreProvision)
       
    44 NODEACTIVITY_END()
       
    45 }
       
    46 
       
    47 namespace SipDeftSCprNoBearerActivity
       
    48 {
       
    49 DECLARE_DEFINE_NODEACTIVITY(ECFActivityNoBearer, SipDeftSCprNoBearer, TCFControlProvider::TNoBearer)
       
    50 	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingNoBearer, MeshMachine::TNoTag)
       
    51 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
       
    52 NODEACTIVITY_END()
       
    53 }
       
    54 
       
    55 //Default SIP SCPR shouldn't get Set Params, we do nothing instead of raising an error.
       
    56 namespace SipDeftSCprParamsRequest
       
    57 {
       
    58 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    59 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, SipDeftSCprSetParams, TCFScpr::TSetParamsRequest)
       
    60 	FIRST_NODEACTIVITY_ENTRY(PRStates::TAwaitingParamRequest, MeshMachine::TNoTag)
       
    61 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
       
    62 NODEACTIVITY_END()
       
    63 #else
       
    64 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, SipDeftSCprSetParams, TCFScpr::TParamsRequest)
       
    65 	FIRST_NODEACTIVITY_ENTRY(SCprStates::TAwaitingParamRequest, MeshMachine::TNoTag)
       
    66 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
       
    67 NODEACTIVITY_END()
       
    68 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    69 }
       
    70 
       
    71 namespace SipDeftSCprNotification
       
    72 {
       
    73 DECLARE_DEFINE_NODEACTIVITY(ECFActivityNotification, SipDeftSCprNotif, TCFSubConnControlClient::TSubConnNotification)
       
    74 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingSubConEvent, MeshMachine::TNoTag)
       
    75 NODEACTIVITY_END()
       
    76 }
       
    77 
       
    78 namespace SipDeftSCprApplyReq
       
    79 {
       
    80 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    81 DECLARE_DEFINE_NODEACTIVITY(ECFActivityApplyChanges, SipDeftSCprApplyReq, TCFScpr::TApplyRequest)
       
    82 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, PRStates::TAwaitingApplyRequest, MeshMachine::TNoTag)
       
    83 NODEACTIVITY_END()
       
    84 #else
       
    85 DECLARE_DEFINE_NODEACTIVITY(ECFActivityApplyChanges, SipDeftSCprApplyReq, TCFScpr::TApplyRequest)
       
    86 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, SCprStates::TAwaitingApplyRequest, MeshMachine::TNoTag)
       
    87 NODEACTIVITY_END()
       
    88 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    89 }
       
    90 
       
    91 //copied the PR:StartActivity and culled stuff that we don't need
       
    92 // Since SIP scpr never has a service provider, fork will always return KNoTag
       
    93 //This should explain the NoTagOrBearerPresentBlockedByStop :-)
       
    94 namespace SipDeftSCprStartActivity
       
    95 {
       
    96 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, SipDeftSCprStart, TCFServiceProvider::TStart, PRActivities::CStartActivity::NewL)
       
    97     FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, CoreNetStates::TNoTagOrBearerPresentBlockedByStop)
       
    98 	LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStarted)
       
    99 NODEACTIVITY_END()
       
   100 }
       
   101 
       
   102 namespace SipDeftSCprStopActivity
       
   103 {
       
   104 DECLARE_DEFINE_NODEACTIVITY(ECFActivityStop, SipDeftSCprStop, TCFServiceProvider::TStop)
       
   105 	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStop, MeshMachine::TNoTag)
       
   106 	LAST_NODEACTIVITY_ENTRY(KNoTag, PRStates::TSendStopped)
       
   107 NODEACTIVITY_END()
       
   108 }
       
   109 
       
   110 namespace SipDeftSCprRejoinDataClient
       
   111 {
       
   112 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityRejoin, SipDeftSCprRejoin, TCFRejoiningProvider::TRejoinDataClientRequest, PRActivities::CRejoinDataClientActivity::NewL)
       
   113 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TRaiseError<KErrNotSupported>, CoreNetStates::TAwaitingDataClientRejoin, MeshMachine::TNoTag)
       
   114 NODEACTIVITY_END()
       
   115 }
       
   116 
       
   117 
       
   118 namespace SipDeftPRDataClientStartActivity
       
   119 {
       
   120 DECLARE_DEFINE_NODEACTIVITY(ECFActivityStartDataClient, SipDeftPRDataClientStart, TCFDataClient::TStart)
       
   121 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingDataClientStart, MeshMachine::TNoTag)
       
   122 NODEACTIVITY_END()
       
   123 }
       
   124 
       
   125 
       
   126 namespace SipDeftPRGoneDownActivity
       
   127 {
       
   128 DECLARE_DEFINE_NODEACTIVITY(ECFActivityGoneDown, SipDeftPRGoneDown, TCFControlClient::TGoneDown)
       
   129 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingGoneDown, MeshMachine::TNoTag)
       
   130 NODEACTIVITY_END()
       
   131 }
       
   132 
       
   133 namespace SipDeftPRBindToRequestActivity
       
   134 {
       
   135 DECLARE_DEFINE_NODEACTIVITY(ECFActivityBindTo, SipDeftPRBindToRequest, TCFDataClient::TBindTo)
       
   136 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingBindTo, MeshMachine::TNoTag)
       
   137 NODEACTIVITY_END()
       
   138 }
       
   139 
       
   140 namespace SipDeftPRDataClientIdleActivity
       
   141 {
       
   142 DECLARE_DEFINE_NODEACTIVITY(ECFActivityDataClientIdle, SipDeftPRDataClientIdle, TCFControlProvider::TIdle)
       
   143 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingDataClientIdle, MeshMachine::TNoTag)
       
   144 NODEACTIVITY_END()
       
   145 }
       
   146 
       
   147 namespace SipDeftPRDataClientActiveActivity
       
   148 {
       
   149 DECLARE_DEFINE_NODEACTIVITY(ECFActivityDataClientActive, SipDeftPRDataClientActive, TCFControlProvider::TActive)
       
   150 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingDataClientActive, MeshMachine::TNoTag)
       
   151 NODEACTIVITY_END()
       
   152 }
       
   153 
       
   154 /*
       
   155 namespace SipDeftReBindLeaveAndForward
       
   156 {
       
   157 DECLARE_DEFINE_NODEACTIVITY(ECFActivityReBindLayer, SipDeftPRReBindLayer, TCFReconnect::TReBindLayer)
       
   158 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingReBindLayer, MeshMachine::TNoTag)
       
   159 NODEACTIVITY_END()
       
   160 }
       
   161 
       
   162 
       
   163 namespace SipDeftPRControlClientJoinActivity
       
   164 {
       
   165 DECLARE_DEFINE_NODEACTIVITY(ECFActivityControlClientJoin, SipDeftPRControlClientJoin, TCFNodeSignalBase::TNullMessageId)
       
   166 	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CoreNetStates::TAwaitingControlClientJoin, MeshMachine::TNoTag)
       
   167 NODEACTIVITY_END()
       
   168 }
       
   169 
       
   170 namespace SipDeftPRDataClientJoinActivity
       
   171 { //This activity needs the activity object (& it can fail on AddClientL, so no point converting)
       
   172 DECLARE_DEFINE_NODEACTIVITY(ECFActivityDataClientJoin, SipDeftPRDataClientJoin, TCFFactory::TPeerFoundOrCreated)
       
   173 	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientJoinRequest, MeshMachine::TNoTag)
       
   174 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
       
   175 NODEACTIVITY_END()
       
   176 }
       
   177 
       
   178 namespace SipDeftPRBuildLowerLayerActivity
       
   179 {
       
   180 DECLARE_DEFINE_NODEACTIVITY(ECFActivityBuildLowerLayer, SipDeftPRBuildLowerLayer, TCFReconnect::TBuildLowerLayer)
       
   181 	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingBuildLowerLayer, MeshMachine::TNoTag)
       
   182 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
       
   183 NODEACTIVITY_END()
       
   184 }
       
   185 
       
   186 */
       
   187 namespace SipDefaultSCprActivities
       
   188 {
       
   189 DECLARE_DEFINE_ACTIVITY_MAP(activityMap)
       
   190 	ACTIVITY_MAP_ENTRY(SipDeftSCprProvisionActivity, SipDeftSCprProvision)
       
   191 	ACTIVITY_MAP_ENTRY(SipDeftSCprNoBearerActivity, SipDeftSCprNoBearer)
       
   192 	ACTIVITY_MAP_ENTRY(SipDeftSCprStartActivity, SipDeftSCprStart)
       
   193 	ACTIVITY_MAP_ENTRY(SipDeftSCprStopActivity, SipDeftSCprStop)
       
   194 	ACTIVITY_MAP_ENTRY( SipDeftSCprParamsRequest, SipDeftSCprSetParams)	
       
   195 	ACTIVITY_MAP_ENTRY(SipDeftSCprRejoinDataClient, SipDeftSCprRejoin)		
       
   196 	ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
       
   197 }  
       
   198 
       
   199 
       
   200 
       
   201 //-=========================================================
       
   202 //
       
   203 // CSipDefaultSubConnectionProvider methods
       
   204 //
       
   205 //-=========================================================	
       
   206 CSipDefaultSubConnectionProvider::~CSipDefaultSubConnectionProvider()
       
   207     {
       
   208     LOG_NODE_DESTROY(KSipSCprTag, CSipDefaultSubConnectionProvider);
       
   209     }
       
   210 
       
   211 CSipDefaultSubConnectionProvider::CSipDefaultSubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory)
       
   212 	: CCoreSubConnectionProvider(aFactory, SipDefaultSCprActivities::activityMap::Self())
       
   213     {
       
   214     LOG_NODE_CREATE(KSipSCprTag, CSipDefaultSubConnectionProvider);
       
   215     }
       
   216     
       
   217 void CSipDefaultSubConnectionProvider::ConstructL()
       
   218     {    
       
   219     CCoreSubConnectionProvider::ConstructL();
       
   220     }    
       
   221 
       
   222 CSipDefaultSubConnectionProvider *CSipDefaultSubConnectionProvider::NewL(ESock::CSubConnectionProviderFactoryBase& aFactory)
       
   223 	{
       
   224 	CSipDefaultSubConnectionProvider* prov = new (ELeave) CSipDefaultSubConnectionProvider(aFactory);
       
   225     CleanupStack::PushL(prov);
       
   226     prov->ConstructL();
       
   227     CleanupStack::Pop(prov);
       
   228     return prov;
       
   229 	}
       
   230 
       
   231 void CSipDefaultSubConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
       
   232     {
       
   233 	TNodeContext<CSipDefaultSubConnectionProvider> ctx(*this, aMessage, aSender, aRecipient);
       
   234     CCoreSubConnectionProvider::Received(ctx);
       
   235     User::LeaveIfError(ctx.iReturn);
       
   236 	}
       
   237 	
       
   238 
       
   239 
       
   240