networkcontrol/ipnetworklayer/src/ipprotodeftscprstates.cpp
changeset 0 af10295192d8
child 5 1422c6cd3f0c
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2006-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 // IPProto SubConnection Provider states/transitions
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <comms-infras/netcfgextprov.h>
       
    24 #include <networking/qos3gpp_subconparams.h>
       
    25 #include <cs_subconparams.h>
       
    26 #include <cs_subconevents.h>
       
    27 #include <comms-infras/corescpractivities.h>
       
    28 #include <comms-infras/linkmessages.h>		// for TLinkMessage
       
    29 #include "ipprotodeftscpr.h"
       
    30 #include "ipprotodeftscprstates.h"
       
    31 #include "ItfInfoConfigExt.h"
       
    32 #include <comms-infras/es_config.h>
       
    33 #include <es_panic.h>
       
    34 #include <comms-infras/ss_datamonitoringprovider.h>
       
    35 #include <comms-infras/ss_log.h>
       
    36 
       
    37 using namespace Messages;
       
    38 using namespace MeshMachine;
       
    39 using namespace ESock;
       
    40 using namespace NetStateMachine;
       
    41 using namespace IPProtoDeftSCpr;
       
    42 
       
    43 
       
    44 DEFINE_SMELEMENT(TStoreProvision, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
    45 void IPProtoDeftSCpr::TStoreProvision::DoL()
       
    46 	{
       
    47 	PRStates::TStoreProvision storeProvision(iContext);
       
    48 	storeProvision.DoL();			// set up iContext.Node().iProvisionConfig
       
    49 
       
    50     // Allocate and add the data monitoring shared memory pointers the provisioning info
       
    51 	CIPProtoDeftSubConnectionProvider& node = iContext.Node();
       
    52 	TDataMonitoringSubConnProvisioningInfo* subConnProvisioningInfo = const_cast<TDataMonitoringSubConnProvisioningInfo*>(static_cast<const TDataMonitoringSubConnProvisioningInfo*>(node.AccessPointConfig().FindExtension(STypeId::CreateSTypeId(TDataMonitoringSubConnProvisioningInfo::iUid, TDataMonitoringSubConnProvisioningInfo::iId))));
       
    53 	ASSERT(subConnProvisioningInfo);
       
    54 
       
    55 #ifdef _DEBUG
       
    56 	_LIT8(KNote, "Note");
       
    57 	if (subConnProvisioningInfo->iDataVolumesPtr || subConnProvisioningInfo->iThresholdsPtr)
       
    58 		{
       
    59 		__CFLOG_VAR((KIPProtoDeftScprTag, KNote, _L8("IPProtoDeftSCpr %x:\tNOTE: data monitoring subconnection structure re-assigned"), &node));
       
    60 		}
       
    61 #endif
       
    62 	
       
    63 	// In the situation where there is an existing IPProtoSCPr in the ELeaving state (which has been
       
    64 	// stopped and has had a TDestroy sent to it) we can safely re-assign the pointers in the (shared)
       
    65 	// data monitoring subconnection structure from pointing to that IPProtoSCPr instance to this one.
       
    66 	// This is because the IP Shim Flow corresponding to that IPProtoSCPr should not be performing any
       
    67 	// data transfer, after having unbound from its lower flow and closed its binders in response to a
       
    68 	// TDataClientStop.  The structure itself is allocated in the CPR.
       
    69 
       
    70 	::new (subConnProvisioningInfo) TDataMonitoringSubConnProvisioningInfo(&node.iDataVolumes, &node.iThresholds);
       
    71 	}
       
    72 
       
    73 //-=========================================================
       
    74 // Data monitoring support
       
    75 //-=========================================================
       
    76 DEFINE_SMELEMENT(TAwaitingDataMonitoringNotification, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
    77 TBool IPProtoDeftSCpr::TAwaitingDataMonitoringNotification::Accept()
       
    78 	{
       
    79 	return iContext.iMessage.IsMessage<TCFDataMonitoringNotification::TDataMonitoringNotification>();
       
    80 	}
       
    81 
       
    82 DEFINE_SMELEMENT(TProcessDataMonitoringNotification, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
    83 void IPProtoDeftSCpr::TProcessDataMonitoringNotification::DoL()
       
    84 	{
       
    85 	TCFDataMonitoringNotification::TDataMonitoringNotification& msg =
       
    86 		message_cast<TCFDataMonitoringNotification::TDataMonitoringNotification>(iContext.iMessage);
       
    87 
       
    88 	iContext.Node().DataNotificationL(msg);
       
    89 	}
       
    90 
       
    91 // NetCfgExtension Support
       
    92 //-=========================================================
       
    93 DEFINE_SMELEMENT(TAwaitingStateChangeOrCancel, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
    94 TBool IPProtoDeftSCpr::TAwaitingStateChangeOrCancel::Accept()
       
    95 	{
       
    96 	return (iContext.iMessage.IsMessage<TCFMessage::TStateChange>() || iContext.iMessage.IsMessage<TEBase::TCancel>());
       
    97 	}
       
    98 
       
    99 DEFINE_SMELEMENT(TAwaitingStateChange, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
   100 TBool IPProtoDeftSCpr::TAwaitingStateChange::Accept()
       
   101     {
       
   102     return (iContext.iMessage.IsMessage<TCFMessage::TStateChange>());
       
   103     }
       
   104 
       
   105 DEFINE_SMELEMENT(TAwaitingConfigureNetwork, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
   106 TBool IPProtoDeftSCpr::TAwaitingConfigureNetwork::Accept()
       
   107 	{
       
   108 	return iContext.iMessage.IsMessage<TCFIPProtoMessage::TConfigureNetwork>();
       
   109 	}
       
   110 
       
   111 DEFINE_SMELEMENT(TAwaitingNetworkConfiguredOrError, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
   112 TBool IPProtoDeftSCpr::TAwaitingNetworkConfiguredOrError::Accept()
       
   113 	{
       
   114 	return (iContext.iMessage.IsMessage<TCFIPProtoMessage::TNetworkConfigured>()
       
   115 			||  iContext.iMessage.IsMessage<TEBase::TError>());
       
   116 	}
       
   117 
       
   118 DEFINE_SMELEMENT(TNoTagOrSwallowMessage, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   119 TInt IPProtoDeftSCpr::TNoTagOrSwallowMessage::TransitionTag()
       
   120 	{
       
   121 	const RMetaExtensionContainerC& mec = iContext.Node().AccessPointConfig();
       
   122 	const CNetCfgExtProvision* provision = static_cast<const CNetCfgExtProvision*>(mec.FindExtension(
       
   123 	        STypeId::CreateSTypeId(CNetCfgExtProvision::EUid, CNetCfgExtProvision::ETypeId)));
       
   124 	TCFMessage::TStateChange& msg = message_cast<TCFMessage::TStateChange>(iContext.iMessage);
       
   125 
       
   126 	if (provision && KLinkLayerOpen == msg.iStateChange.iStage)
       
   127 		{
       
   128 		return KSwallowMessage;
       
   129 		}
       
   130 	else
       
   131 		{
       
   132 		return KNoTag;
       
   133 		}
       
   134 	}
       
   135 
       
   136 DEFINE_SMELEMENT(TStopNetCfgExtOrNoTag, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   137 TInt IPProtoDeftSCpr::TStopNetCfgExtOrNoTag::TransitionTag()
       
   138 	{
       
   139 	if (iContext.Node().iControl)
       
   140 		return KStopNetCfgExt;
       
   141 
       
   142 	return KNoTag;
       
   143 	}
       
   144 
       
   145 DEFINE_SMELEMENT(TNetworkConfiguredOrErrorTagOrCancelTagOrNoTag, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   146 TInt IPProtoDeftSCpr::TNetworkConfiguredOrErrorTagOrCancelTagOrNoTag::TransitionTag()
       
   147 	{
       
   148 	if (iContext.iMessage.IsMessage<TEBase::TCancel>())
       
   149 		{
       
   150 		iContext.iNodeActivity->SetError(KErrCancel);
       
   151 		return KCancelTag;
       
   152 		}
       
   153 					
       
   154 	TCFMessage::TStateChange& msg = message_cast<TCFMessage::TStateChange>(iContext.iMessage);
       
   155 
       
   156 	if (msg.iStateChange.iError != KErrNone)
       
   157 		{
       
   158 		iContext.iNodeActivity->SetError(msg.iStateChange.iError);
       
   159 		return KErrorTag;
       
   160 		}
       
   161 
       
   162 	if (msg.iStateChange.iStage == KLinkLayerOpen)
       
   163 		{
       
   164 		return KNetworkConfigured;
       
   165 		}
       
   166 
       
   167 	return KNoTag;
       
   168 	}
       
   169 
       
   170 DEFINE_SMELEMENT(TNetworkConfiguredOrErrorTagOrCancelTagOrNoTagBackward, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   171 TInt IPProtoDeftSCpr::TNetworkConfiguredOrErrorTagOrCancelTagOrNoTagBackward::TransitionTag()
       
   172 	{
       
   173 	TInt tag = IPProtoDeftSCpr::TNetworkConfiguredOrErrorTagOrCancelTagOrNoTag::TransitionTag();
       
   174 	if (tag == KNoTag)
       
   175 		return tag | NetStateMachine::EBackward;
       
   176 	return tag;
       
   177 	}
       
   178 
       
   179 DEFINE_SMELEMENT(TErrorTagOrNoTag, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   180 TInt IPProtoDeftSCpr::TErrorTagOrNoTag::TransitionTag()
       
   181 	{
       
   182 	TEBase::TError *error = message_cast<TEBase::TError>(&iContext.iMessage);
       
   183 	if (error)
       
   184 		{
       
   185 		iContext.iNodeActivity->SetError(error->iValue);
       
   186 
       
   187 		return KErrorTag;
       
   188 		}
       
   189 	TCFIPProtoMessage::TNetworkConfigured* msg = message_cast<TCFIPProtoMessage::TNetworkConfigured>(&iContext.iMessage);
       
   190 
       
   191 	if (msg->iValue != KErrNone)
       
   192 		{
       
   193 		iContext.iNodeActivity->SetError(msg->iValue);
       
   194 
       
   195 		return KErrorTag;
       
   196 		}
       
   197 	return KNoTag;
       
   198 	}
       
   199 
       
   200 DEFINE_SMELEMENT(TNoTagOrConfigureNetwork, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   201 TInt IPProtoDeftSCpr::TNoTagOrConfigureNetwork::TransitionTag()
       
   202 	{
       
   203 	const RMetaExtensionContainerC& mec = iContext.Node().AccessPointConfig();
       
   204 	const CNetCfgExtProvision* provision = static_cast<const CNetCfgExtProvision*>(mec.FindExtension(
       
   205 	        STypeId::CreateSTypeId(CNetCfgExtProvision::EUid, CNetCfgExtProvision::ETypeId)));
       
   206 
       
   207 	if (provision)
       
   208 		{
       
   209 		return KConfigureNetwork;
       
   210 		}
       
   211 	else
       
   212 		{
       
   213 		return KNoTag;
       
   214 		}
       
   215 	}
       
   216 
       
   217 DEFINE_SMELEMENT(TNoTagOrProviderStoppedOrDaemonReleased, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   218 TInt IPProtoDeftSCpr::TNoTagOrProviderStoppedOrDaemonReleased::TransitionTag()
       
   219     {
       
   220     iContext.iNodeActivity->SetError(message_cast<TCFDataClient::TStop>(iContext.iMessage).iValue);
       
   221     if (iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData, TCFClientType::EStarted)) != NULL)
       
   222         {
       
   223         // At least one data client started 
       
   224         if(iContext.Node().iControl)
       
   225             {
       
   226             return MeshMachine::KNoTag;
       
   227             }
       
   228         else
       
   229             {
       
   230             return KDaemonReleased;
       
   231             }
       
   232         }
       
   233     return CoreNetStates::KProviderStopped;
       
   234     }
       
   235 
       
   236 DEFINE_SMELEMENT(TDaemonReleasedStateChangedOrNoTagBackward, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   237 TInt IPProtoDeftSCpr::TDaemonReleasedStateChangedOrNoTagBackward::TransitionTag()
       
   238     {
       
   239     TInt tag = IPProtoDeftSCpr::TDaemonReleasedStateChangedOrNoTag::TransitionTag();
       
   240     if (tag == KNoTag)
       
   241         return tag | NetStateMachine::EBackward;
       
   242     return tag;
       
   243     }
       
   244 
       
   245 DEFINE_SMELEMENT(TDaemonReleasedStateChangedOrNoTag, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   246 TInt IPProtoDeftSCpr::TDaemonReleasedStateChangedOrNoTag::TransitionTag()
       
   247     {
       
   248     TCFMessage::TStateChange& msg = message_cast<TCFMessage::TStateChange>(iContext.iMessage);
       
   249  
       
   250     if (msg.iStateChange.iStage == KConfigDaemonFinishedDeregistrationStop)
       
   251         {
       
   252         return KDaemonReleasedStateChanged;
       
   253         }
       
   254     return KNoTag;
       
   255     }
       
   256 
       
   257 DEFINE_SMELEMENT(TConfigureNetwork, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   258 void IPProtoDeftSCpr::TConfigureNetwork::DoL()
       
   259 	{
       
   260 	iContext.iNodeActivity->PostRequestTo(iContext.NodeId(), TCFIPProtoMessage::TConfigureNetwork().CRef());
       
   261 	}
       
   262 
       
   263 DEFINE_SMELEMENT(TSendNetworkConfigured, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   264 void IPProtoDeftSCpr::TSendNetworkConfigured::DoL()
       
   265 	{
       
   266 	TCFIPProtoMessage::TNetworkConfigured resp(iContext.iNodeActivity->Error());
       
   267 	iContext.iNodeActivity->SetError(KErrNone);
       
   268 	iContext.iNodeActivity->PostToOriginators(resp);
       
   269 	}
       
   270 
       
   271 DEFINE_SMELEMENT(TStartNetCfgExt, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   272 void IPProtoDeftSCpr::TStartNetCfgExt::DoL()
       
   273 	{
       
   274 	ASSERT(!iContext.Node().iNotify);
       
   275 	ASSERT(!iContext.Node().iControl);
       
   276 
       
   277 	iContext.Node().iNotify = CNetCfgExtNotify::NewL(&iContext.Node());
       
   278 	iContext.Node().iControl = CNifConfigurationControl::NewL(*iContext.Node().iNotify);
       
   279 	iContext.Node().iControl->ConfigureNetworkL();
       
   280 	}
       
   281 
       
   282 
       
   283 DEFINE_SMELEMENT(TStopNetCfgExt, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   284 void IPProtoDeftSCpr::TStopNetCfgExt::DoL()
       
   285 	{
       
   286 	if(!iContext.Node().iControl) return;
       
   287 
       
   288 	iContext.Node().iControl->Deregister(EConfigDaemonDeregisterCauseStop);
       
   289 	}
       
   290 
       
   291 DEFINE_SMELEMENT(TStopNetCfgExtDelete, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   292 void IPProtoDeftSCpr::TStopNetCfgExtDelete::DoL()
       
   293     {
       
   294     if(!iContext.Node().iControl)
       
   295         {
       
   296         return;
       
   297         }
       
   298     iContext.Node().iControl->AsyncDelete();
       
   299     iContext.Node().iControl = NULL;
       
   300  
       
   301     delete iContext.Node().iNotify;
       
   302     iContext.Node().iNotify = NULL;
       
   303     }
       
   304 
       
   305 DEFINE_SMELEMENT(TResetSentTo, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   306 void IPProtoDeftSCpr::TResetSentTo::DoL()
       
   307 	{
       
   308 	iContext.iNodeActivity->ClearPostedTo();
       
   309 	}
       
   310 
       
   311 //-=========================================================
       
   312 // Ioctl Support
       
   313 //-=========================================================
       
   314 DEFINE_SMELEMENT(TAwaitingIoctlProcessed, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
   315 TBool IPProtoDeftSCpr::TAwaitingIoctlProcessed::Accept()
       
   316 	{
       
   317 	return iContext.iMessage.IsMessage<TCFLegacyMessage::TLegacyRMessage2Processed>();
       
   318 	}
       
   319 
       
   320 void IPProtoDeftSCpr::TAwaitingIoctlProcessed::Cancel()
       
   321 	{
       
   322 	CIPProtoDeftSubConnectionProvider* node = static_cast<CIPProtoDeftSubConnectionProvider*>(&iContext.Node());
       
   323 	if (node->iControl)
       
   324 		{
       
   325 		node->iControl->CancelControl();
       
   326 		}
       
   327 
       
   328 	iContext.Activity()->SetError(KErrCancel);
       
   329 	}
       
   330 
       
   331 DEFINE_SMELEMENT(TNoTagOrTryNetCfgExt, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   332 TInt IPProtoDeftSCpr::TNoTagOrTryNetCfgExt::TransitionTag()
       
   333 	{
       
   334 	TCFLegacyMessage::TLegacyRMessage2Processed& msg = message_cast<TCFLegacyMessage::TLegacyRMessage2Processed>(iContext.iMessage);
       
   335 	
       
   336 	if ((msg.iResponse.iType == ESock::TLegacyRMessage2Response::ENormal && msg.iResponse.iCode == KErrNone)
       
   337 		|| msg.iResponse.iType == ESock::TLegacyRMessage2Response::EPanic)
       
   338 		{
       
   339 		return KNoTag;
       
   340 		}
       
   341 	else
       
   342 		{
       
   343 		return KTryNetCfgExt;
       
   344 		}
       
   345 	}
       
   346 
       
   347 DEFINE_SMELEMENT(TTryServiceProviderOrTryNetCfgExt, NetStateMachine::MStateFork, IPProtoDeftSCpr::TContext)
       
   348 TInt IPProtoDeftSCpr::TTryServiceProviderOrTryNetCfgExt::TransitionTag()
       
   349 	{
       
   350 	MeshMachine::CNodeParallelMessageStoreActivityBase* act = static_cast<MeshMachine::CNodeParallelMessageStoreActivityBase*>(iContext.Activity());
       
   351 
       
   352 	ASSERT(act->Message().IsTypeOf(Meta::STypeId::CreateSTypeId(TCFSigLegacyRMessage2Ext::EUid, TCFSigLegacyRMessage2Ext::ETypeId)));
       
   353 	if ((static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage.Int0() == KCOLConfiguration
       
   354 			&& static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage.Int1() == KConnGetSipServerAddr))
       
   355 		{
       
   356 		return KTryServiceProvider;
       
   357 		}
       
   358 	else
       
   359 		{
       
   360 		return KTryNetCfgExt;
       
   361 		}
       
   362 	}
       
   363 
       
   364 DEFINE_SMELEMENT(TForwardToServiceProvider, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   365 void IPProtoDeftSCpr::TForwardToServiceProvider::DoL()
       
   366 	{
       
   367 	ASSERT(iContext.iMessage.IsTypeOf(Meta::STypeId::CreateSTypeId(TCFSigLegacyRMessage2Ext::EUid, TCFSigLegacyRMessage2Ext::ETypeId)));
       
   368 	
       
   369 	MeshMachine::CNodeParallelMessageStoreActivityBase* act = static_cast<MeshMachine::CNodeParallelMessageStoreActivityBase*>(iContext.Activity());
       
   370 
       
   371 	TCFSigLegacyRMessage2Ext::RReadOnlyRMessage& ioctl(static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage);
       
   372 	RLegacyResponseMsg r(iContext, static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage, static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage.Int0());
       
   373 			
       
   374 	// currently only supporting configuration ioctls
       
   375 	if (ioctl.Int0() == KCOLConfiguration && ioctl.Int1() == KConnGetSipServerAddr)
       
   376 		{
       
   377 		TSipServerAddrBuf sipAddr;
       
   378 		if (ioctl.GetDesLengthL(2) != sipAddr.Length())
       
   379 			{
       
   380 			r.Panic(KESockClientPanic, EBadDescriptor);
       
   381 			act->ClearPostedTo();
       
   382 			return; // the sip address handlers will complete the message
       
   383 			}
       
   384 		}
       
   385 		
       
   386 	RNodeInterface* dc = iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
       
   387 	
       
   388 	iContext.Activity()->PostRequestTo(*dc, iContext.iMessage);
       
   389 	}
       
   390 
       
   391 DEFINE_SMELEMENT(THandoffToNetCfgExt, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   392 void IPProtoDeftSCpr::THandoffToNetCfgExt::DoL()
       
   393 	{
       
   394 	ASSERT(iContext.Activity());
       
   395 	MeshMachine::CNodeParallelMessageStoreActivityBase* act = static_cast<MeshMachine::CNodeParallelMessageStoreActivityBase*>(iContext.Activity());
       
   396 
       
   397 	TCFSigLegacyRMessage2Ext::RReadOnlyRMessage& ioctl(static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage);
       
   398 	RLegacyResponseMsg r(iContext, static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage, static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage.Int0());
       
   399 
       
   400 	if (ioctl.Int0() == KCOLConfiguration && ioctl.Int1() == KConnGetSipServerAddr)
       
   401 		{
       
   402 		TCFSigLegacyRMessage2Ext::RReadOnlyRMessage& ioctl(static_cast<TCFSigLegacyRMessage2Ext&>(act->Message()).iMessage);
       
   403 		TSipServerAddrBuf sipAddr;
       
   404 		if (ioctl.GetDesLengthL(2) != sipAddr.Length())
       
   405 			{
       
   406 			r.Panic(KESockClientPanic, EBadDescriptor);
       
   407 			act->ClearPostedTo();
       
   408 			return; // the sip address handlers will complete the message
       
   409 			}
       
   410 		}
       
   411 		
       
   412 	if ((ioctl.Int0() == KCOLConfiguration && ioctl.Int1() == KConnGetSipServerAddr))
       
   413 		{
       
   414 		TSipServerAddrBuf sipBuf;
       
   415 		ioctl.ReadL( 2, sipBuf );
       
   416 
       
   417 		if( sipBuf().index != 0 )
       
   418 			{
       
   419 			r.Complete(KErrNotFound);
       
   420 			act->ClearPostedTo();
       
   421 			return;
       
   422 			}
       
   423 		}
       
   424 		
       
   425 	// IPProto returns KErrNotSupported if DHCP is not configured for the IAP
       
   426 	// so we want to make sure DHCP fallback is only ever tried once for index
       
   427 	// zero.  Otherwise, the last address index that the caller tries may return
       
   428 	// KErrNotSupported instead of the expected KErrNotFound.
       
   429 	if (iContext.Node().iControl)
       
   430 		{
       
   431 		iContext.Node().iControl->SendIoctlMessageL(r);
       
   432 		act->ClearPostedTo();
       
   433 		}
       
   434 	else
       
   435 		{
       
   436 		const RMetaExtensionContainerC& mec = iContext.Node().AccessPointConfig();
       
   437 		const CNetCfgExtProvision* provision = static_cast<const CNetCfgExtProvision*>(mec.FindExtension(
       
   438 				STypeId::CreateSTypeId(CNetCfgExtProvision::EUid, CNetCfgExtProvision::ETypeId)));
       
   439 
       
   440 		if (provision)
       
   441 			{
       
   442 			r.Complete(KErrNotReady);
       
   443 			act->ClearPostedTo();
       
   444 			}
       
   445 		else
       
   446 			{
       
   447 			r.Complete(KErrNotSupported);
       
   448 			act->ClearPostedTo();
       
   449 			}
       
   450 		}
       
   451 	}
       
   452 
       
   453 //
       
   454 // support for AgentEventNotification
       
   455 //
       
   456 DEFINE_SMELEMENT(TAwaitingAgentEventNotification, NetStateMachine::MState, IPProtoDeftSCpr::TContext)
       
   457 TBool IPProtoDeftSCpr::TAwaitingAgentEventNotification::Accept()
       
   458 	{
       
   459 	return iContext.iMessage.IsMessage<TLinkMessage::TAgentEventNotification>();
       
   460 	}
       
   461 
       
   462 DEFINE_SMELEMENT(TProcessAgentEvent, NetStateMachine::MStateTransition, IPProtoDeftSCpr::TContext)
       
   463 void IPProtoDeftSCpr::TProcessAgentEvent::DoL()
       
   464 	{
       
   465 	if (iContext.Node().iControl)
       
   466 		{
       
   467 		// AgentEventNotification originates from the AgentSCPr as a result of an AgentEvent()
       
   468 		// call from the Agent.  Although the message is generic, it was primarily created to pass the
       
   469 		// event ECurrentNetworkChangeEvent from the Agent towards the NetCfgExt for CDMA2000 support.
       
   470 		// The "aEventData" and "aSource" fields of the EventNotification() call are not used for this
       
   471 		// event, and hence are passed as null values.
       
   472 		TLinkMessage::TAgentEventNotification& msg = message_cast<TLinkMessage::TAgentEventNotification>(iContext.iMessage);
       
   473 		iContext.Node().iControl->EventNotification(TNetworkAdaptorEventType(msg.iValue1), msg.iValue2, KNullDesC8, NULL);
       
   474 		}
       
   475 	}
       
   476