--- a/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def Mon May 24 18:38:45 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def Mon May 24 18:44:15 2010 +0100
@@ -135,4 +135,7 @@
??1CNodeParallelMessageStoreActivityBase@MeshMachine@@UAE@XZ @ 134 NONAME ; MeshMachine::CNodeParallelMessageStoreActivityBase::~CNodeParallelMessageStoreActivityBase(void)
??0CNodeParallelMessageStoreActivityBase@MeshMachine@@IAE@ABUTNodeActivity@1@AAVAMMNodeBase@1@I@Z @ 135 NONAME ; MeshMachine::CNodeParallelMessageStoreActivityBase::CNodeParallelMessageStoreActivityBase(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &, unsigned int)
?StartL@CNodeParallelMessageStoreActivityBase@MeshMachine@@MAEXAAVTNodeContextBase@2@ABVXNodePeerId@Messages@@ABUTStateTriple@NetStateMachine@@@Z @ 136 NONAME ; void MeshMachine::CNodeParallelMessageStoreActivityBase::StartL(class MeshMachine::TNodeContextBase &, class Messages::XNodePeerId const &, struct NetStateMachine::TStateTriple const &)
+ ?SetPostedTo@CNodeActivityBase@MeshMachine@@QAEXABVRNodeInterface@Messages@@@Z @ 137 NONAME ; void MeshMachine::CNodeActivityBase::SetPostedTo(class Messages::RNodeInterface const &)
+ ?PostedToNodeId@CNodeActivityBase@MeshMachine@@QBEABVTNodeId@Messages@@XZ @ 138 NONAME ; class Messages::TNodeId const & MeshMachine::CNodeActivityBase::PostedToNodeId(void) const
+ ?PostedToPeer@CNodeActivityBase@MeshMachine@@QBEPBVRNodeInterface@Messages@@XZ @ 139 NONAME ; class Messages::RNodeInterface const * MeshMachine::CNodeActivityBase::PostedToPeer(void) const
--- a/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def Mon May 24 18:38:45 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def Mon May 24 18:44:15 2010 +0100
@@ -203,4 +203,7 @@
_ZTIN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 202 NONAME
_ZTVN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 203 NONAME
_ZN11MeshMachine37CNodeParallelMessageStoreActivityBase6StartLERNS_16TNodeContextBaseERKN8Messages11XNodePeerIdERKN15NetStateMachine12TStateTripleE @ 204 NONAME
+ _ZN11MeshMachine17CNodeActivityBase11SetPostedToERKN8Messages14RNodeInterfaceE @ 205 NONAME
+ _ZNK11MeshMachine17CNodeActivityBase12PostedToPeerEv @ 206 NONAME
+ _ZNK11MeshMachine17CNodeActivityBase14PostedToNodeIdEv @ 207 NONAME
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Mon May 24 18:38:45 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Mon May 24 18:44:15 2010 +0100
@@ -637,10 +637,13 @@
Get the id of the node that the last request from this activity was sent to.
@return Node id of the last node the activity has posted a request to
*/
- const Messages::TNodeId PostedToId() const
- {
- return iPostedToId;
- }
+ IMPORT_C const Messages::TNodeId& PostedToNodeId() const;
+
+ /**
+ Get the id of the node that the last request from this activity was sent to.
+ @return Node id of the last node the activity has posted a request to
+ */
+ IMPORT_C const Messages::RNodeInterface* PostedToPeer() const;
/**
Get the id of the message that started this activity.
@@ -697,6 +700,13 @@
@param aNodeId Node id to set the postedTo id to
*/
IMPORT_C void SetPostedTo(const Messages::TNodeId& aNodeId);
+
+ /**
+ Manually set the postedTo id
+
+ @param aNodeId Node id to set the postedTo id to
+ */
+ IMPORT_C void SetPostedTo(const Messages::RNodeInterface& aRecipient);
/**
Clear the postedTo id
@@ -930,8 +940,60 @@
const TNodeActivity& iActivitySig;
- // Last node a message was sent to
- Messages::TNodeId iPostedToId;
+ class RPostedToNodeOrPeer
+ /*
+ * Class is used to store the recipient of the last request sent from the 'this'
+ * (the activity). This recipient can be represented either by its TNodeId address
+ * or, if it's a peer of the local node, by RNodeInterface.
+ * The implementation may seem awkward or overengineered. This is to protect binary
+ * compatibility (it used to be TNodeId here and sizeof TNodeId was all there was at hand).
+ *
+ * Rules of the game are that RPostedToNodeOrPeer:iBuf is a shared dwelling for either:
+ * - address of an RNodeInterface (in case posted to is a peer)
+ * - TNodeId (in case posted to is not a peer)
+ * Inspecting the content of iBuf and the assumptions around it are a little fragile
+ * (based on TNodeId class layout a bit), so the code must be viligent.
+ * _Node and _Peer perform arbitral happy conversion, so there can be 3 reasons why _Node()->Ptr() is NULL:
+ * (1) iBuf stores a 4 byte ptr to RNodeInterface and what Ptr normally returns is beyond these 4 bytes in a land hopefully zeroed by ::Close
+ * (2) iBuf stores nothing.
+ * (3) iBuf stores a TNodeId pointing a NULL node (effectivelly TNodeId::NullId()). (3) is only theoretical as Open(TNodeId) prevens Ptr be NULL
+ * Therefore it is safe to assume that if Ptr() is NULL, it is either a valid pointer to a peer or NULL.
+ * Happily _Peer() will return that pointer or NULL respectivelly.*
+ */
+ {
+ private:
+ typedef Messages::RNodeInterface* TPeerType;
+ public:
+ RPostedToNodeOrPeer();
+ void Open(const Messages::RNodeInterface& aPeer);
+ void Open(const Messages::TNodeId& aNode);
+ void Close();
+
+ const Messages::RNodeInterface* Peer() const;
+ const Messages::TNodeId& NodeId() const;
+
+ private:
+ TPeerType* _Peer()
+ {
+ return reinterpret_cast<TPeerType*>(&iBuf[0]);
+ }
+
+ const TPeerType* _Peer() const
+ {
+ return reinterpret_cast<const TPeerType*>(&iBuf[0]);
+ }
+
+ Messages::TNodeId* _Node()
+ {
+ return reinterpret_cast<Messages::TNodeId*>(&iBuf[0]);
+ }
+
+ const Messages::TNodeId* _Node() const
+ {
+ return reinterpret_cast<const Messages::TNodeId*>(&iBuf[0]);
+ }
+ TUint8 iBuf[__Align8(sizeof(Messages::TNodeId))];
+ } iPostedToId;
};
--- a/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Mon May 24 18:38:45 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Mon May 24 18:44:15 2010 +0100
@@ -169,8 +169,8 @@
//what's set as iPostedToId or from one of the orginators.
//if the message's recipient specifies the activity id, then that
//activity must much that of 'this'.
- TBool sender = iPostedToId.IsNull() ||
- aContext.iSender == iPostedToId ||
+ TBool sender = PostedToNodeId().IsNull() ||
+ aContext.iSender == PostedToNodeId() ||
FindOriginator(aContext.iSender) != KErrNotFound;
const TNodeCtxId* recipient = address_cast<const TNodeCtxId>(&aContext.iRecipient);
TBool activity = (recipient == NULL || ActivityId() == recipient->NodeCtx());
@@ -183,7 +183,7 @@
if(!sender)
{
MESH_LOG((KMeshMachineSubTag(), _L8("CNodeActivityBase %08x:\tiPostedToId mismatch:"), this));
- NM_LOG_ADDRESS(KMeshMachineSubTag(), iPostedToId);
+ NM_LOG_ADDRESS(KMeshMachineSubTag(), PostedToNodeId());
NM_LOG_ADDRESS(KMeshMachineSubTag(), aContext.iSender);
MESH_LOG((KMeshMachineSubTag(), _L8("CNodeActivityBase %08x:\toriginators' mismatch:"), this));
for (TInt i = iOriginators.Count() - 1; i>=0; i--)
@@ -319,11 +319,12 @@
EXPORT_C void CNodeActivityBase::Cancel(TNodeContextBase& aContext)
{//we expect KErrCancel be set as a result of the state cancelation
- MESH_LOG((KMeshMachineSubTag, _L8("CNodeActivityBase %08x:\tCancel(), iPostedToId %08x"), this, iPostedToId.Ptr() ? &iPostedToId.Node() : NULL));
+ MESH_LOG((KMeshMachineSubTag, _L8("CNodeActivityBase %08x:\tCancel(), PostedToNodeId %08x"), this, PostedToNodeId().Ptr()));
- if (!iPostedToId.IsNull())
- {
- RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), iPostedToId, TEBase::TCancel().CRef());
+ if ((PostedToPeer() && !(PostedToPeer()->Flags() & TClientType::ELeaving)) ||
+ PostedToNodeId() == aContext.Node().Id())
+ {//only safe to forward TCancels to non-leavers or self. There is an underlying assumption that a node won't dissapear in presence of activities (see AMMNodeBase::~AMMNodeBase)
+ RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), PostedToNodeId(), TEBase::TCancel().CRef());
}
else
{
@@ -363,12 +364,44 @@
EXPORT_C void CNodeActivityBase::SetPostedTo(const TNodeId& aNodeId)
{
- iPostedToId = aNodeId;
+ //You are being punished for storing a postedto TNodeId that you also know as your peer.
+ //the Messages::RNodeInterface& overload of CNodeActivityBase::SetPostedTo
+ //It is dangerous to use this overload for peers when the relation with these peers
+ //is being terminated. the PostedTo facility is also used to forward TCancel in
+ //the automatic calencallation handling. No message can be posted to a leaving peer
+ //but only peers (Messages::RNodeInterfaces) can be recognised as leaving.
+ //
+ //ASSERT temporarily commened out as it is a behavioural break. A Polonium BR
+ //has been drafted and will be raised when the RNodeInterface overloads end up in the
+ //codeline. http://polonium.ext.nokia.com/changerequests/cr/601/
+ //__ASSERT_DEBUG(iNode.FindClient(aNodeId) == NULL, User::Panic(KSpecAssert_ElemMeshMachActC, 14));
+
+ if (aNodeId == Messages::TNodeId::NullId())
+ {
+ ClearPostedTo();
+ return;
+ }
+ iPostedToId.Open(aNodeId);
+ }
+
+EXPORT_C void CNodeActivityBase::SetPostedTo(const Messages::RNodeInterface& aRecepient)
+ {
+ iPostedToId.Open(aRecepient);
}
EXPORT_C void CNodeActivityBase::ClearPostedTo()
{
- iPostedToId.SetNull();
+ iPostedToId.Close();
+ }
+
+EXPORT_C const Messages::TNodeId& CNodeActivityBase::PostedToNodeId() const
+ {
+ return iPostedToId.NodeId();
+ }
+
+EXPORT_C const Messages::RNodeInterface* CNodeActivityBase::PostedToPeer() const
+ {
+ return iPostedToId.Peer();
}
EXPORT_C void CNodeActivityBase::PostRequestTo(const RNodeInterface& aRecipient, const TSignalBase& aMessage, const TBool aRecipientIdCritical)
@@ -376,7 +409,11 @@
aRecipient.PostMessage(TNodeCtxId(ActivityId(), iNode.Id()), aMessage);
// Provide the option for the identity of the receipient to be unimportant when the response arrives
- iPostedToId = aRecipientIdCritical ? aRecipient.RecipientId() : TNodeId::NullId();
+ ClearPostedTo();
+ if (aRecipientIdCritical)
+ {
+ SetPostedTo(aRecipient);
+ }
}
//Avoid using this function, always prefer PostRequestTo(const RNodeInterface& aRecipient, const TNodeSignal& aMessage)
@@ -385,7 +422,11 @@
RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), aRecipient, aMessage);
// Provide the option for the identity of the receipient to be unimportant when the response arrives
- iPostedToId = aRecipientIdCritical ? aRecipient : TNodeId::NullId();
+ ClearPostedTo();
+ if (aRecipientIdCritical)
+ {
+ SetPostedTo(aRecipient);
+ }
}
EXPORT_C TBool CNodeActivityBase::IsIdle() const
@@ -419,6 +460,49 @@
}
}
+
+
+
+//-=========================================================
+//
+//CNodeActivityBase::RPostedToNodeOrPeer
+//
+//-=========================================================
+CNodeActivityBase::RPostedToNodeOrPeer::RPostedToNodeOrPeer()
+ {
+ Close();
+ }
+
+void CNodeActivityBase::RPostedToNodeOrPeer::Open(const Messages::RNodeInterface& aPeer)
+ {
+ Close();
+ *_Peer() = const_cast<Messages::RNodeInterface*>(&aPeer);
+ }
+
+void CNodeActivityBase::RPostedToNodeOrPeer::Open(const Messages::TNodeId& aNode)
+ {
+ __ASSERT_DEBUG(aNode.Ptr(), User::Panic(KSpecAssert_ElemMeshMachActC, 15));
+ //see Messages::TNodeId::operator= (snapping size is essential in case aNode is more than just plain TNodeId).
+ *_Node() = Messages::TNodeId();
+
+ //normal assigment
+ *_Node() = aNode;
+ }
+void CNodeActivityBase::RPostedToNodeOrPeer::Close()
+ {
+ Mem::FillZ(iBuf, sizeof(iBuf));
+ }
+
+const Messages::RNodeInterface* CNodeActivityBase::RPostedToNodeOrPeer::Peer() const
+ {
+ return _Node()->Ptr() ? NULL : *_Peer();
+ }
+const Messages::TNodeId& CNodeActivityBase::RPostedToNodeOrPeer::NodeId() const
+ {
+ return (_Node()->Ptr() ? *_Node() : (*_Peer() ? (*_Peer())->RecipientId() : Messages::TNodeId::NullId()));
+ }
+
+
//-=========================================================
//
//CNodeRetryActivity
--- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Mon May 24 18:38:45 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Mon May 24 18:44:15 2010 +0100
@@ -231,7 +231,7 @@
for (TInt i = iActivities.Count() - 1; i>=0 && a==NULL; i--)
{
CNodeActivityBase* act = iActivities[i];
- const TNodeId& postedTo = act->iPostedToId;
+ const TNodeId& postedTo = act->PostedToNodeId();
if (!act->IsIdle()
&& (postedTo.IsNull() || aContext.iSender == postedTo)
&& (recipient->NodeCtx() == act->ActivityId()))
@@ -429,6 +429,7 @@
}
}
+
EXPORT_C void AMMNodeBase::AbortActivitiesOriginatedBy(TNodeContextBase& aContext, const TNodeId& aCommsId, TBool aIsNodeBeingDestroyed)
{
CNodeActivityBase* caller = aContext.iNodeActivity;
@@ -437,6 +438,20 @@
for (TInt i = iActivities.Count() - 1; i>=0; i--)
{
aContext.iNodeActivity = iActivities[i];
+
+ if (!abortAll && aContext.iNodeActivity->PostedToNodeId() == aCommsId)
+ {//clear postedto if a leaver has been set as a postedto at any of the running activities.
+ //No other messages will ever come from the leaver and it is not gonna be safe to forward TCancels
+ //to the leaver, so at least postedto must be cleared to avoid the crash. It could be speculated that
+ //if the postedto is still set, then either the postedto node failed to respond or the local activity failed to
+ //clear postedto when it had responded. Worth putting a speculative ASSERT here to catch misdeeds.
+
+ //clearing postedto shouldn't be done in here (AbortActivitiesOriginatedBy), but I (RZ) have expressed my disrespect to the
+ //this method before and the suggestion that it should go (replaced by a CancelActivitiesOriginatedBy).
+ //So instead of introducing another method that loops through activities i decided to piggyback the function in an
+ //existing method. Note that the final logic should be based on RNodeInterfaces and not TNodeIds.
+ aContext.iNodeActivity->ClearPostedTo();
+ }
// We dont want to abort already idle activities or they may error.
if(aContext.iNodeActivity->IsIdle())
--- a/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h Mon May 24 18:38:45 2010 +0100
+++ b/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h Mon May 24 18:44:15 2010 +0100
@@ -85,7 +85,8 @@
EMBuf_IndexOutofRange =43,
EMBuf_InvalidLengthOrOffset =44,
EMBuf_AsyncAllocInvalidState =45,
- EMBuf_InsufficientSpaceToStorePond = 45
+ EMBuf_InsufficientSpaceToStorePond = 46,
+ EMBuf_InvalidAsyncReqImpl = 47
};
#endif // __MBufPanic_h__
--- a/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp Mon May 24 18:38:45 2010 +0100
+++ b/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp Mon May 24 18:44:15 2010 +0100
@@ -76,7 +76,8 @@
@param aAllocator The handle to the allocator
*/
{
- iAsyncReqImpl->Alloc(aChain, aSize, aMinSize, aMaxSize, aStatus);
+ __ASSERT_ALWAYS(iAsyncReqImpl != NULL, CommsBuf::Panic(EMBuf_InvalidAsyncReqImpl));
+ iAsyncReqImpl->Alloc(aChain, aSize, aMinSize, aMaxSize, aStatus);
}
@@ -85,7 +86,10 @@
Cancel the asynchronous request
*/
{
- iAsyncReqImpl->Cancel();
+ if (iAsyncReqImpl)
+ {
+ iAsyncReqImpl->Cancel();
+ }
}
EXPORT_C void RCommsBufAsyncRequest::Complete(TInt aCode)
@@ -95,5 +99,6 @@
@param aCode The request completion code
*/
{
+ __ASSERT_ALWAYS(iAsyncReqImpl != NULL, CommsBuf::Panic(EMBuf_InvalidAsyncReqImpl));
iAsyncReqImpl->Complete(aCode);
}
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp Mon May 24 18:44:15 2010 +0100
@@ -179,7 +179,7 @@
__ASSERT_DEBUG(cp, User::Panic(KSpecAssert_ESockMbCrCPRAct, 4)); //We are a Cpr, must exist.
//PostedTo() could be our service provider or possibly other peer
- if (PostedToId() != cp->RecipientId())
+ if (PostedToPeer() != cp)
{
cp->PostMessage(TNodeCtxId(ActivityId(), iNode.Id()),
TEBase::TCancel().CRef());
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Mon May 24 18:44:15 2010 +0100
@@ -1604,12 +1604,20 @@
// CommsBinderActivity and CCommsBinderCombiningActivity.
//
//-=========================================================
-
+// When I node need to create the data client, this mutex block if the dataclient is leaving.
+// A scenario can arise when a connection is being started, stopped and started again in succession.
+// the stop might interfere with the second start and ccause the second start to fail.
+// this mutex will ensure that the leaving DC is completely destroyed, and then the second start is continued
+// - when any of the data clients is being destroyed
+// - when a non-leaving data client is present or the activity is already running
+//
EXPORT_C TBool CCommsBinderActivity::TDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext)
{
TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId());
__ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 17)); //Diagnostic
- if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext))
+ TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>(
+ /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving));
+ if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext)))
{
return EFalse;
}
@@ -1620,7 +1628,9 @@
{
TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId());
__ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 18)); //Diagnostic
- if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault))
+ TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>(
+ /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving));
+ if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault)))
{
return EFalse;
}
@@ -1701,6 +1711,7 @@
iPendingBinder->SetFlags(TCFClientType::EActivating);
}
+
EXPORT_C void CCommsBinderActivity::Cancel(TNodeContextBase& aContext)
{
if (iPendingBinder)
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp Mon May 24 18:44:15 2010 +0100
@@ -259,7 +259,8 @@
__ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider));
TCFDataClient::TBindTo& bt = message_cast<TCFDataClient::TBindTo>(iContext.iMessage);
- iContext.Node().AddClientL(bt.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+ RNodeInterface* newSP = iContext.Node().AddClientL(bt.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+ __ASSERT_DEBUG(iContext.Node().ServiceProvider()==newSP, ConnPanic(KPanicNoServiceProvider)); //[RZ] revise this, possibly overdefensive
//If this is attach, we need to see if we are a monitor or not
TClientType clientType(TCFClientType::ECtrl);
@@ -276,7 +277,7 @@
{
clientType.SetFlags(TCFClientType::EAttach);
}
- iContext.iNodeActivity->PostRequestTo(bt.iNodeId,
+ iContext.iNodeActivity->PostRequestTo(*newSP,
TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
}
@@ -287,7 +288,7 @@
__ASSERT_DEBUG(iContext.iPeer == iContext.Node().ServiceProvider(), ConnPanic(KPanicExpectedNoServiceProvider));
TCFServiceProvider::TCommsBinderResponse& br = message_cast<TCFServiceProvider::TCommsBinderResponse>(iContext.iMessage);
- iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EDefault));
+ RNodeInterface* scpr = iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EDefault));
//If this is attach, we need to see if we are a monitor or not
TCFClientType clientType(TCFClientType::ECtrl);
@@ -304,7 +305,7 @@
clientType.SetFlags(TCFClientType::EAttach);
}
- iContext.iNodeActivity->PostRequestTo(br.iNodeId,
+ iContext.iNodeActivity->PostRequestTo(*scpr,
TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
}
@@ -315,10 +316,10 @@
__ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider));
TCFSelector::TSelectComplete& sc = message_cast<TCFSelector::TSelectComplete>(iContext.iMessage);
- iContext.Node().AddClientL(sc.iNodeId,TClientType(TCFClientType::EServProvider, TCFClientType::EAvailabilityProvider));
+ RNodeInterface* mcpr = iContext.Node().AddClientL(sc.iNodeId,TClientType(TCFClientType::EServProvider, TCFClientType::EAvailabilityProvider));
- iContext.iNodeActivity->PostRequestTo(sc.iNodeId,
+ iContext.iNodeActivity->PostRequestTo(*mcpr,
TCFServiceProvider::TJoinRequest(iContext.NodeId(), TCFClientType(TCFClientType::ECtrl)).CRef());
}
@@ -351,7 +352,8 @@
TCFServiceProvider::TCommsBinderResponse& br = message_cast<TCFServiceProvider::TCommsBinderResponse>(iContext.iMessage);
- iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+ RNodeInterface* sp = iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+ __ASSERT_DEBUG(iContext.Node().ServiceProvider()==sp, ConnPanic(KPanicNoServiceProvider)); //[RZ] revise this, possibly overdefensive
//If this is attach, we need to see if we are a monitor or not
TCFClientType clientType;
@@ -368,7 +370,7 @@
clientType.SetFlags(TCFClientType::EAttach);
}
- iContext.iNodeActivity->PostRequestTo(br.iNodeId,
+ iContext.iNodeActivity->PostRequestTo(*sp,
TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/TE_DummyProvider_ip.tcpip.esk Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,51 @@
+[sockman]
+protocols= tcp,udp,icmp,icmp6,ip,ip6,rawip,resolver,dummy
+
+[rawip]
+filename= tcpip6.prt
+bindto= ip6
+index= 8
+
+[icmp]
+filename= tcpip6.prt
+bindto= ip6
+index= 7
+
+[ip]
+filename= tcpip6.prt
+bindto= ip6,resolver
+index= 6
+
+[resolver]
+filename= tcpip6.prt
+index= 5
+
+[tcp]
+filename= tcpip6.prt
+bindto= ip6
+index= 4
+
+[udp]
+filename= tcpip6.prt
+bindto= ip6
+index= 3
+
+[icmp6]
+filename= tcpip6.prt
+bindto= ip6
+index= 2
+
+[ip6]
+filename= tcpip6.prt
+index= 1
+bindto= resolver
+
+[nifman]
+default= csd
+
+[interfaces]
+ppp= ppp.nif
+
+[dummy]
+flow_factory_uid= 271080847
+flow_protocol_id= 254
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_008.ini Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,28 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=70
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_009.ini Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,47 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=10
+
+[CreateSocket]
+SocketName=Socket1
+
+[OpenSocket]
+SocketName=Socket1
+SocketServName=SockSvr1
+ConnName=Conn1
+Protocol=DummyProtocol
+ConnType=271069227
+
+[BindSocket]
+SocketName=Socket1
+SrcAddr=0.0.0.0
+SrcPort=0
+Protocol=DummyProtocol
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseSocket]
+SocketName=Socket1
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
\ No newline at end of file
--- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg Mon May 24 18:44:15 2010 +0100
@@ -136,6 +136,36 @@
END_ADD
## CASE005 END ##
+##############################################################
+## CASE008 BEGIN ##
+ADD_SECTION
+# COMMDB_ID = 9
+ Id=70
+ Name=DummyAPHasNextLayer
+ Tier=Link.TierTable.0x1028302B
+ MCpr=MCprTable.1
+ AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.5
+ Cpr=CprTable.1
+ SCpr=SCprTable.1
+ Protocol=ProtocolTable.1
+ FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 10
+ Id=71
+ Name=DummyAPBottom
+ Tier=Link.TierTable.0x1028302B
+ MCpr=MCprTable.1
+ Cpr=CprTable.1
+ CprConfig=0x0010 #behavioural differentiator. See dummypr_metaconnprov.h. This cpr will arrest TDestroy for 3 sec
+ SCpr=SCprTable.1
+ Protocol=ProtocolTable.1
+ FIELD_COUNT=8
+END_ADD
+## CASE008 END ##
+
+
############################################################
## APPrioritySelectionPolicyTable
##
@@ -176,7 +206,14 @@
APCOUNT=1
FIELD_COUNT=4
END_ADD
-
+ADD_SECTION
+# COMMDB_ID = 5
+ Id=5
+ Name=SelectionPolicyCase004
+ AP1=Link.AccessPointTable.71
+ APCOUNT=1
+ FIELD_COUNT=4
+END_ADD
############################################################
## TierTable
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Mon May 24 18:44:15 2010 +0100
@@ -27,6 +27,7 @@
data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_004.script TestData\scripts\te_dummyprovider_004.script
data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_005.script TestData\scripts\te_dummyprovider_005.script
data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_006.script TestData\scripts\te_dummyprovider_006.script
+data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_008.script TestData\scripts\te_dummyprovider_008.script
data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_incomingSCPR.script TestData\scripts\te_dummyprovider_incomingSCPR.script
data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyproviders.cfg TestData\configs\te_dummyproviders.cfg
@@ -36,6 +37,6 @@
data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_004.ini TestData\configs\te_dummyprovider_004.ini
data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_005.ini TestData\configs\te_dummyprovider_005.ini
data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_006.ini TestData\configs\te_dummyprovider_006.ini
-
+data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_008.ini TestData\configs\te_dummyprovider_008.ini
#endif // __TE_DummyProviders_IBY__
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Mon May 24 18:44:15 2010 +0100
@@ -29,6 +29,8 @@
../scripts/te_dummyprovider_005.script z:/testdata/scripts/te_dummyprovider_005.script
../scripts/te_dummyprovider_006.script z:/testdata/scripts/te_dummyprovider_006.script
+../scripts/te_dummyprovider_008.script z:/testdata/scripts/te_dummyprovider_008.script
+
../scripts/te_dummyprovider_incomingSCPR.script z:/testdata/scripts/te_dummyprovider_incomingscpr.script
../configs/te_dummyproviders.cfg z:/testdata/configs/te_dummyproviders.cfg
../configs/te_dummyprovider_001.ini z:/testdata/configs/te_dummyprovider_001.ini
@@ -38,3 +40,5 @@
../configs/te_dummyprovider_005.ini z:/testdata/configs/te_dummyprovider_005.ini
../configs/te_dummyprovider_006.ini z:/testdata/configs/te_dummyprovider_006.ini
+
+../configs/te_dummyprovider_008.ini z:/testdata/configs/te_dummyprovider_008.ini
--- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Mon May 24 18:44:15 2010 +0100
@@ -32,6 +32,8 @@
RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_004.script
RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_005.script
RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_006.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_008.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_009.script
RUN_SCRIPT z:\testdata\scripts\te_esock_test_unloadesockForced.script
RUN_SCRIPT z:\testdata\scripts\te_esock_test_remove_config_files.script
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_008.script Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Running CASE008
+PRINT Connection from application started, stopped and started again. The leaving CPR needs
+PRINT to be destroyed before a new one is created by MCPR. In order to simulate this scenario
+PRINT the lower later CPR arrests TDestroy for 3 sec. The stop completes and the second start resumes
+PRINT The CommsBinderRequest is parked at MCPR till the time CPR is leaving. The activity is unparked
+PRINT after CPR is destroyed a new one is created by MCPR. This results in only 1 dataclient to MCPR at a time
+
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+START_TESTCASE COMINF-ESOCK-DummyProviders-008
+//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-008
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_008.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_008.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_008.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_008.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-008
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE008
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_009.script Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Running CASE009
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+
+START_TESTCASE COMINF-ESOCK-DummyProviders-009
+//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-009
+//! @SYMTestCaseDesc
+//! @SYMTestActions
+//! @SYMTestExpectedResults
+//! @SYMTestPriority
+//! @SYMTestType CT
+//! @SYMComponent comms-infras_esock
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+RUN_UTILS CopyFile c:\private\101f7989\ESock\ip.tcpip.esk c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS CopyFile z:\testdata\configs\TE_DummyProvider_ip.tcpip.esk c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_009.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_009.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketStep z:\testdata\configs\te_dummyprovider_009.ini CreateSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite openrsocketStep z:\testdata\configs\te_dummyprovider_009.ini OpenSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite bindrsocketStep z:\testdata\configs\te_dummyprovider_009.ini BindSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_009.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketStep z:\testdata\configs\te_dummyprovider_009.ini CloseSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_009.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_009.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-009
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+RUN_UTILS MakeReadWrite c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS CopyFile c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive
+
+
+PRINT Completed CASE001
+
+END_TESTCASE COMINF-ESOCK-DummyProviders-009
+
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Mon May 24 18:44:15 2010 +0100
@@ -105,6 +105,7 @@
TUint iSocketType;
TUint iProtocol;
+ TUint iAddrFamily;
TInt iPacketSize;
TInt iNrOfPackets;
TInetAddr iLocalIP;
@@ -482,7 +483,7 @@
RSocket* FindSocket(const TDesC& aSocketName);
TInt CreateSocket(const TDesC& aSocketName);
TInt OpenSocket(const TRSocketParams& aParams);
- TInt BindSocket(const TRSocketParams& aParams);
+ TInt BindSocket(TRSocketParams& aParams);
TInt ConnectSocket(TRSocketParams& aParams, TRequestStatus& aRequestStatus);
TInt CancelConnectSocket(const TRSocketParams& aParams);
void SendAndReceiveDataL(const TRSocketParams& aParams);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h Mon May 24 18:44:15 2010 +0100
@@ -25,7 +25,7 @@
#include <test/testexecutestepbase.h>
#include "Te_EsockStepBase.h"
-
+#include "Connections.TestSteps.h"
// General constants
//------------------
@@ -34,6 +34,9 @@
_LIT(KTe_ProtocolName,"ProtocolName");
_LIT(KTe_SourceAddressName,"SrcAddr");
_LIT(KTe_SourcePortName,"SrcPort");
+_LIT(KTe_SocketType,"SocketType");
+_LIT(KTe_SocketDatagram,"SockDatagram");
+_LIT(KTe_SocketStream,"SockStream");
_LIT(KTe_DestinationAddressName,"DstAddr");
_LIT(KTe_DestinationPortName,"DstPort");
_LIT(KTe_PacketSizeName,"PacketSize");
@@ -55,9 +58,12 @@
// Protocol types
_LIT(KTe_TCPName,"TCP");
_LIT(KTe_UDPName,"UDP");
-_LIT(KDummyProtocolName,"Dummy");
+_LIT(KTe_DummyNetworkProtocolName,"DummyNetworkProtocol");
+_LIT(KTe_DummyProtocolName,"DummyProtocol");
-static const TInt KProtocolInetDummy = 253;
+
+static const TInt KDummyNetworkProtocol = 253;
+static const TInt KDummyProtocol = 254;
_LIT(KSocketDataCheckTransformType, "SocketDataCheckTransformType");
@@ -74,12 +80,30 @@
TInt ConfigureFromIni();
private:
- TBool iCancelFlag;
+ TBool iCancelFlag;
TRSocketParams iParams; //current params (.ini)
};
_LIT(KConnectRSocketStep,"ConnectRSocketStep");
+/**
+Class implementing BindRSocketStep
+
+@internalComponent
+*/
+class CBindRSocketStep : public CTe_EsockStepBase
+ {
+public:
+ CBindRSocketStep(CCEsockTestBase*& aEsockTest);
+ TVerdict doSingleTestStep();
+ TInt ConfigureFromIni();
+
+private:
+ TRSocketParams iParams; //current params (.ini)
+ };
+
+_LIT(KBindRSocketStep,"BindRSocketStep");
+
/**
Class implementing AddRSocketToRSubConnectionOOMStep
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Mon May 24 18:44:15 2010 +0100
@@ -835,7 +835,7 @@
RConnection* c = iConns.Find(aParams.iConnectionName);
if (c==NULL)
return KErrNotFound;
- error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol, *c);
+ error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol, *c);
}
else if (aParams.iSubconnectionName.Length()>0)
{
@@ -844,7 +844,7 @@
{
return KErrNotFound;
}
- error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol, *sc);
+ error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol, *sc);
}
else if (aParams.iProtocolName.Length()>0)
{
@@ -852,17 +852,15 @@
}
else
{
- error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol);
+ error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol);
}
return error;
}
-TInt CCEsockTestBase::BindSocket(const TRSocketParams& /*aParams*/)
+TInt CCEsockTestBase::BindSocket(TRSocketParams& aSockeSParams)
{
- return KErrNotSupported;
- /*
RSocket* s = iSocks.Find(aSockeSParams.iSocketName);
if (s==NULL)
return KErrNotFound;
@@ -874,8 +872,8 @@
return error;
//bind to Local address for TCP or UDP
+
return s->Bind(aSockeSParams.iLocalIP);
- */
}
TInt CCEsockTestBase::ConnectSocket(TRSocketParams& aParams, TRequestStatus& aRequestStatus)
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp Mon May 24 18:44:15 2010 +0100
@@ -73,28 +73,58 @@
}
else
{
- TPtrC protocol;
- if (GetStringFromConfig(iSection,KTe_Protocol,protocol)!=1)
- {
- INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
- return KErrNotFound;
+ TInt protocolInt = 0;
+ //Try obtaining protocol type as int, failing that, go to predefined types
+ if (GetIntFromConfig(iSection, KTe_Protocol, protocolInt)!=1)
+ {
+ TPtrC protocolStr;
+ if (GetStringFromConfig(iSection, KTe_Protocol,protocolStr)!=1 )
+ {
+ INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
+ return KErrNotFound;
+ }
+ if (protocolStr.Compare(KTe_TCPName)==0)
+ { protocolInt = KProtocolInetTcp; iParams.iSocketType = KSockStream;}
+ else if (protocolStr.Compare(KTe_UDPName)==0)
+ { protocolInt = KProtocolInetUdp; iParams.iSocketType = KSockDatagram;}
+ else if (protocolStr.Compare(KTe_DummyNetworkProtocolName)==0)
+ { protocolInt = KDummyNetworkProtocol; iParams.iSocketType = KSockDatagram;}
+ else if (protocolStr.Compare(KTe_DummyProtocolName)==0)
+ { protocolInt = KDummyProtocol; iParams.iSocketType = KSockDatagram;}
+ else
+ {
+ INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocolStr);
+ return KErrNotFound;
+ }
+ }
+ iParams.iProtocol = protocolInt;
}
-
- if (protocol.Compare(KTe_TCPName)==0)
- { iParams.iProtocol = KProtocolInetTcp; iParams.iSocketType = KSockStream; }
- else if (protocol.Compare(KTe_UDPName)==0)
- { iParams.iProtocol = KProtocolInetUdp; iParams.iSocketType = KSockDatagram; }
- else if (protocol.Compare(KDummyProtocolName)==0)
- {
- iParams.iProtocol = KProtocolInetDummy;
- iParams.iSocketType = KSockDatagram;
- }
- else
- {
- INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
- return KErrNotFound;
- }
+
+ TPtrC socketTypeStr;
+ if (GetStringFromConfig(iSection, KTe_SocketType,socketTypeStr)!=1 )
+ {
+ INFO_PRINTF2(_L("%S: Socket type missing, defaulting based on specified protocol"),&iParams.iSocketName);
}
+ else
+ {
+ if (socketTypeStr.Compare(KTe_SocketDatagram)==0)
+ { iParams.iSocketType = KSockDatagram;}
+ else if (socketTypeStr.Compare(KTe_SocketStream)==0)
+ { iParams.iSocketType = KSockStream; }
+ else
+ {
+ INFO_PRINTF3(_L("%S: Socket type (%S) not recognised."),&iParams.iSocketName,&socketTypeStr);
+ return KErrNotFound;
+ }
+ }
+
+
+ TInt protocolInt = KAfInet;
+ if (GetIntFromConfig(iSection, KTe_ConnectionType, protocolInt)!=1 )
+ {
+ INFO_PRINTF2(_L("%S: Address Family (ConnType) missing, defaulting to KAfInet"),&iParams.iSocketName);
+ }
+ iParams.iAddrFamily = protocolInt;
// All ok if we got this far
return KErrNone;
@@ -199,6 +229,71 @@
return EPass;
}
+// Bind Socket
+//---------------
+
+CBindRSocketStep::CBindRSocketStep(CCEsockTestBase*& aEsockTest)
+: CTe_EsockStepBase(aEsockTest)
+ {
+ SetTestStepName(KBindRSocketStep);
+ }
+
+TInt CBindRSocketStep::ConfigureFromIni()
+ {
+ // Read in appropriate fields
+ if((GetStringFromConfig(iSection, KTe_SocketName, iParams.iSocketName) != 1)
+ || (iParams.iSocketName.Length() == 0))
+ {
+ INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+ return KErrNotFound;
+ }
+
+ TInt protocolInt = 0;
+ if (GetIntFromConfig(iSection, KTe_Protocol, protocolInt)!=1)
+ {
+ TPtrC protocolStr;
+ if (GetStringFromConfig(iSection, KTe_Protocol,protocolStr)!=1 )
+ {
+ INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
+ return KErrNotFound;
+ }
+ if (protocolStr.Compare(KTe_TCPName)==0)
+ { protocolInt = KProtocolInetTcp; }
+ else if (protocolStr.Compare(KTe_UDPName)==0)
+ { protocolInt = KProtocolInetUdp; }
+ else if (protocolStr.Compare(KTe_DummyNetworkProtocolName)==0)
+ { protocolInt = KDummyNetworkProtocol; }
+ else if (protocolStr.Compare(KTe_DummyProtocolName)==0)
+ { protocolInt = KDummyProtocol; }
+ else
+ {
+ INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocolStr);
+ return KErrNotFound;
+ }
+ }
+ iParams.iProtocol = protocolInt;
+
+ // IP Address Local
+ if (GetIpAddressFromConfig(iSection,KTe_SourceAddressName,iParams.iLocalIP)!=1)
+ {
+ INFO_PRINTF2(_L("%S: Local address missing."),&iParams.iSocketName);
+ }
+
+ // All ok if we got this far
+ return KErrNone;
+ }
+
+TVerdict CBindRSocketStep::doSingleTestStep()
+ {
+ TInt error = iEsockTest->BindSocket(iParams/*,reqStat*/);
+ if (error!=KErrNone)
+ {
+ INFO_PRINTF2(_L("Could not bind socket (%S)."),&iParams.iSocketName);
+ INFO_PRINTF2(_L("Error: %d."),error);
+ SetTestStepResult(EFail);
+ }
+ return TestStepResult();
+ }
// Connect Socket
//---------------
@@ -232,10 +327,10 @@
{ iParams.iProtocol = KProtocolInetTcp; }
else if (protocol.Compare(KTe_UDPName)==0)
{ iParams.iProtocol = KProtocolInetUdp; }
- else if (protocol.Compare(KDummyProtocolName)==0)
- {
- iParams.iProtocol = KProtocolInetDummy;
- }
+ else if (protocol.Compare(KTe_DummyNetworkProtocolName)==0)
+ { iParams.iProtocol = KDummyNetworkProtocol; }
+ else if (protocol.Compare(KTe_DummyProtocolName)==0)
+ { iParams.iProtocol = KDummyProtocol; }
else
{
INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
@@ -363,10 +458,10 @@
{ iParams.iProtocol = KProtocolInetTcp; }
else if (protocol.Compare(KTe_UDPName)==0)
{ iParams.iProtocol = KProtocolInetUdp; }
- else if (protocol.Compare(KDummyProtocolName)==0)
- {
- iParams.iProtocol = KProtocolInetDummy;
- }
+ else if (protocol.Compare(KTe_DummyNetworkProtocolName)==0)
+ { iParams.iProtocol = KDummyNetworkProtocol; }
+ else if (protocol.Compare(KTe_DummyProtocolName)==0)
+ { iParams.iProtocol = KDummyProtocol; }
else
{
INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Mon May 24 18:44:15 2010 +0100
@@ -198,6 +198,8 @@
testStep = new CConnectRSocketServStep(iEsockTest);
else if(aStepName.CompareF (KConnectRSocketStep) == 0)
testStep = new CConnectRSocketStep(iEsockTest);
+ else if(aStepName.CompareF (KBindRSocketStep) == 0)
+ testStep = new CBindRSocketStep(iEsockTest);
else if(aStepName.CompareF (KControlRSubConnectionStep) == 0)
testStep = new CControlRSubConnectionStep(iEsockTest);
else if(aStepName.CompareF (KCreateRConnectionStep) == 0)
--- a/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini Mon May 24 18:44:15 2010 +0100
@@ -113,13 +113,13 @@
[OpenSocket2]
SocketName=Socket2
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
SubConnName=SubConn1
SocketServName=SockSvr1
[ConnectSocket2]
SocketName=Socket2
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
SrcAddr=0.0.0.0
SrcPort=0
DstAddr=192.168.1.2
@@ -128,7 +128,7 @@
[SendReceiveOnSocket2]
SocketName=Socket2
PacketSize=512
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
NrOfPackets=1
ReceiveTimeout=5
--- a/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp Mon May 24 18:44:15 2010 +0100
@@ -35,7 +35,8 @@
SOURCE dummypr_mcprpubsubsubscriber.cpp
SOURCE dummypr_metaconnprov.cpp
SOURCE dummypr_tiermanager.cpp
-SOURCE dummypr_network_flow.cpp
+SOURCE dummypr_flow.cpp
+SOURCE dummypr_network_flow.cpp
SOURCE activityTest.cpp
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Mon May 24 18:44:15 2010 +0100
@@ -26,7 +26,7 @@
#include <comms-infras/mobilitycpr.h>
#include <comms-infras/mobilitycprstates.h>
-
+#include <elements/mm_activities_internal.h>
#ifdef __FLOG_ACTIVE
// CommsDebugUtility logging tags. Use them to enable tracing for DummyCPR
@@ -34,6 +34,12 @@
_LIT8(KTestDummyLogTag2,"TestDummyRef");
#endif
+enum TCFNodeActivityId
+ {
+ ECFActivityDummyCprDestroy = ESock::ECFActivityCustom +1,
+ };
+
+
class CDummyConnectionProvider : public CMobilityConnectionProvider, public ESock::MLegacyControlApiExt,
public ITFHIERARCHY_LINK_1(CDummyConnectionProvider, CMobilityConnectionProvider, ESock::MLegacyControlApiExt)
@@ -67,6 +73,37 @@
TConnType iConnStatus;
};
+
+class CDelayTimer: public CTimer
+ {
+public:
+ static CDelayTimer* NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId );
+
+ virtual ~CDelayTimer();
+ void Start( TInt aIntervalInSecs );
+
+public:
+class TDelayMessage : public Messages::TSignatureBase
+ {
+public:
+ TDelayMessage();
+ TDelayMessage(const TNodeSignal::TMessageId& aMessageId);
+ };
+
+private:
+ CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId );
+ void ConstructL();
+
+protected: // From CTimer (CActive)
+ void RunL();
+
+private:
+ Messages::RNodeInterface* iSender;
+ Messages::TNodeId iRecipient;
+ Messages::TNodeSignal::TMessageId iMessageId;
+ };
+
+
//-================================================
//
// States and Transitions
@@ -88,6 +125,13 @@
virtual TBool Accept();
DECLARE_SMELEMENT_FOOTER( TAwaitingStart )
+DECLARE_SMELEMENT_HEADER( TAwaitingDestroy, MeshMachine::TState<TContext>, NetStateMachine::MState, DummyCPRStates::TContext )
+ virtual TBool Accept();
+DECLARE_SMELEMENT_FOOTER( TAwaitingDestroy )
+
+DECLARE_SMELEMENT_HEADER( TThreeSecDelayAndPostToSelf, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummyCPRStates::TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TThreeSecDelayAndPostToSelf )
} // namespace DummyCPRStates
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h Mon May 24 18:44:15 2010 +0100
@@ -33,6 +33,9 @@
using namespace ESock;
+_LIT(KDummyProtocolName, "dummy");
+_LIT(KDumberProtocolName, "dumber");
+
//-=========================================================
//
// CDummyTierManagerFactory
@@ -157,18 +160,18 @@
//-=========================================================
//
-// CDummyNetworkFlowFactory
+// CDummyFlowFactory
//
//-=========================================================
-class CDummyNetworkFlowFactory : public ESock::CSubConnectionFlowFactoryBase
+class CDummyFlowFactory : public ESock::CSubConnectionFlowFactoryBase
{
public:
enum { iUid = 0x10285D8F };
- static CDummyNetworkFlowFactory* NewL(TAny* aConstructionParameters);
- ~CDummyNetworkFlowFactory();
+ static CDummyFlowFactory* NewL(TAny* aConstructionParameters);
+ ~CDummyFlowFactory();
protected:
- CDummyNetworkFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer);
+ CDummyFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer);
// from CSubConnectionFlowFactoryBase
virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,153 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Dummy network flow
+//
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__DUMMYPR_FLOW_H__)
+#define __DUMMYPR_FLOW_H__
+
+#include "dummypr_factory.h"
+#include <comms-infras/ss_protflow.h>
+#include <comms-infras/ss_subconnflow.h>
+#include <comms-infras/es_sap.h>
+#include <comms-infras/nifif.h>
+
+#include <comms-infras/ss_nodemessages_dataclient.h>
+#include <comms-infras/ss_nodemessages_flow.h>
+
+
+namespace ESock
+{
+
+
+class CDummyFlow : public CSubConnectionFlowBase,
+ public MSessionData,
+ public MSessionControl,
+ public MFlowBinderControl,
+ public MSessionControlNotify,
+ public MSessionDataNotify
+/**
+@internalComponent
+@released since v9.6
+ */
+ {
+public:
+ enum {EProtocolId = 254};
+ typedef CDummyFlowFactory FactoryType; //for factoryobject_cast to work
+
+ static CDummyFlow* NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
+ void SetSSP(CServProviderBase& aSSP);
+
+ inline CServProviderBase* Provider();
+
+protected:
+ // Lifetime
+ CDummyFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
+ virtual ~CDummyFlow();
+ void SetSockType(TUint aSockType);
+ TInt LockToConnectionInfo();
+
+ // MSessionData
+ virtual TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
+ virtual TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
+ virtual void GetData(TDes8& aDesc, TUint aOptions, TSockAddr* anAddr);
+ virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr);
+
+ // MSessionControl
+ virtual void Start();
+ virtual void LocalName(TSockAddr& anAddr) const;
+ virtual void SetLocalName(TSockAddr& anAddr);
+ virtual void RemName(TSockAddr& anAddr) const;
+ virtual TInt SetRemName(TSockAddr& anAddr);
+ virtual TInt GetOption(TUint aLevel,TUint aName,TDes8& anOption) const;
+ virtual void Ioctl(TUint aLevel,TUint aName,TDes8* anOption);
+ virtual void CancelIoctl(TUint aLevel,TUint aName);
+ virtual TInt SetOption(TUint aLevel, TUint aName,const TDesC8 &anOption);
+ virtual void ActiveOpen();
+ virtual void ActiveOpen(const TDesC8& aConnectionData);
+ virtual TInt PassiveOpen(TUint aQueueSize);
+ virtual TInt PassiveOpen(TUint aQueueSize,const TDesC8& aConnectionData);
+ virtual void Shutdown(MSessionControl::TCloseType aOption);
+ virtual void Shutdown(MSessionControl::TCloseType aOption, const TDesC8& aDisconnectionData);
+ virtual void AutoBind();
+ virtual TInt SecurityCheck(MProvdSecurityChecker* aSecurityChecker);
+
+ // MFlowBinderControl
+ //session binders for CSocket
+ virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
+ virtual MSessionData* BindL(MSessionDataNotify& aNotify);
+ virtual void Unbind();
+ virtual CSubConnectionFlowBase& CloneFlowL();
+ virtual CSubConnectionFlowBase* Flow();
+
+private:
+ // MSessionControlNotify
+ void ConnectComplete();
+ void ConnectComplete(const TDesC8& aConnectData);
+ void ConnectComplete(CSubConnectionFlowBase& anSSP);
+ void ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData);
+ void CanClose(MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
+ void CanClose(const TDesC8& aDisconnectData,MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
+ TInt Error(TInt anError,TUint anOperationMask);
+ void Disconnect( );
+ void Disconnect(TDesC8& aDisconnectData);
+ void IoctlComplete(TDesC8* aBuf);
+ void DisconnectFromListener(CSubConnectionFlowBase& aSSP);
+ void SetLocalNameComplete();
+
+
+ // MSessionDataNotify
+ void NewData(TUint aCount);
+ void CanSend();
+
+protected:
+ // CSubConnectionFlowBase
+ virtual MFlowBinderControl* DoGetBinderControlL();
+
+ // Messages::ANode
+ virtual void ReceivedL(
+ const Messages::TRuntimeCtxId& aSender,
+ const Messages::TNodeId& aRecipient,
+ Messages::TSignatureBase& aMessage
+ );
+
+ void BindToL(TCFDataClient::TBindTo& aBindTo);
+
+
+private:
+ // Flow binders
+ MFlowBinderControl* iLowerFlowBinderControl;
+
+ // Lower session binding
+ MSessionControl* iLowerFlowControl;
+ MSessionData* iLowerFlowData;
+
+ // Upper session binding
+ MSessionControlNotify* iSessionControlNotify;
+ MSessionDataNotify* iSessionDataNotify;
+
+ RCFParameterFamilyBundleC iParamBundle;
+ };
+
+}
+
+
+#endif // __DUMMYPR_FLOW_H__
+
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Mon May 24 18:44:15 2010 +0100
@@ -43,6 +43,7 @@
ESCPRHangOnRebind = 1, //when lit on CprConfig, the SCPR will hang on rebind
ESCPRHangOnStart = 2, //when lit on CprConfig, the SCPR will hang on start
ESCPRFailOnRebind = 3, //when lit on CprConfig, the SCPR will fail on rebind
+ ECPRWaitOnThreeSecDestroy = 4, //when lit on CprConfig, the CPR will wait for 3 sec on destroy before resuming
};
static TBool Is(TInt aValue, TInt aFlags)
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h Mon May 24 18:44:15 2010 +0100
@@ -35,9 +35,6 @@
namespace ESock
{
-_LIT(KDummyProtocolName, "dummy");
-_LIT(KDumberProtocolName, "dumber");
-
class CDummyNetworkFlow : public CSubConnectionFlowBase,
public MSessionData,
public MSessionControl,
@@ -51,7 +48,8 @@
{
friend class CSocket;
public:
- typedef CDummyNetworkFlowFactory FactoryType; //for factoryobject_cast to work
+ enum {EProtocolId = 253};
+ typedef CDummyFlowFactory FactoryType; //for factoryobject_cast to work
static CDummyNetworkFlow* NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
void SetSSP(CServProviderBase& aSSP);
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h Mon May 24 18:44:15 2010 +0100
@@ -158,6 +158,64 @@
virtual TBool Accept();
DECLARE_SMELEMENT_FOOTER( TAwaitingBrokenStart )
+DECLARE_SMELEMENT_HEADER( TRebindSelf, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TRebindSelf )
+
+
+
+
+
+struct TWaitForBindToMutex
+ {
+ static TBool IsBlocked(const MeshMachine::TNodeContextBase& aContext)
+ {
+ return aContext.iNode.CountActivities(ESock::ECFActivityBindTo) == 0;
+ }
+ };
+
+struct TWaitForNoDataClients
+ {
+ static TBool IsBlocked(const MeshMachine::TNodeContextBase& aContext)
+ {
+ return aContext.iNode.GetFirstClient<Messages::TDefaultClientMatchPolicy>(Messages::TClientType(ESock::TCFClientType::EData)) != NULL;
+ }
+ };
+
+DECLARE_SERIALIZABLE_STATE(
+ TNoTagWaitForBindTo,
+ TWaitForBindToMutex,
+ MeshMachine::TNoTag
+ )
+
+DECLARE_SERIALIZABLE_STATE(
+ TNoTagWaitNoDataClients,
+ TWaitForNoDataClients,
+ MeshMachine::TNoTag
+ )
+
+
+
+DECLARE_SMELEMENT_HEADER( TCancelPreviousSelfRequest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TCancelPreviousSelfRequest )
+
+class CrazyIdle : public MeshMachine::CNodeRetryActivity
+ {
+public:
+ DECLARE_SMELEMENT_HEADER( TAwaitingCancelled, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
+ virtual TBool Accept();
+ DECLARE_SMELEMENT_FOOTER( TAwaitingCancelled )
+
+ static MeshMachine::CNodeActivityBase* CrazyIdle::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode );
+protected:
+ CrazyIdle( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
+ :MeshMachine::CNodeRetryActivity(aActivitySig, aNode)
+ {};
+private:
+ ~CrazyIdle();
+ };
+
DECLARE_ACTIVITY_MAP(stateMap)
} // namespace DummyCPRStates
@@ -239,5 +297,6 @@
ESock::RCFParameterFamilyBundleC iFlowParameters;
};
+
#endif // __DummySCPR_SUBCONNPROV_H__
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Mon May 24 18:44:15 2010 +0100
@@ -52,12 +52,63 @@
static const TUint KDefaultMaxPreallocatedActivityCount = 2;
static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
static const TUint KDummyCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
+static const TUint KDestroyDelay = 3;
+static const TUint KMillion = 1000000;
//-================================================
//
// States and Transitions
//
//-================================================
+CDelayTimer* CDelayTimer::NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId )
+ {
+ CDelayTimer* timer = new(ELeave) CDelayTimer( aSender, aRecipient, aMessageId );
+ CleanupStack::PushL( timer );
+ timer->ConstructL();
+ CleanupStack::Pop();
+ return timer;
+ }
+
+CDelayTimer::~CDelayTimer()
+ {
+ Cancel();
+ }
+
+CDelayTimer::CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) :
+ CTimer( EPriorityStandard ),
+ iSender(aSender),
+ iRecipient(aRecipient),
+ iMessageId(aMessageId)
+ {
+ CActiveScheduler::Add( this );
+ }
+
+void CDelayTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ }
+
+void CDelayTimer::RunL()
+ {
+ CDelayTimer::TDelayMessage msg(iMessageId);
+ Messages::RClientInterface::OpenPostMessageClose(iSender->RecipientId() , iRecipient, msg );
+ delete this;
+ }
+
+void CDelayTimer::Start( TInt aIntervalInSecs )
+ {
+ After( TTimeIntervalMicroSeconds32( aIntervalInSecs * KMillion ) );
+ }
+
+CDelayTimer::TDelayMessage::TDelayMessage()
+ {
+ }
+
+CDelayTimer::TDelayMessage::TDelayMessage(const TNodeSignal::TMessageId& aMessageId)
+: TSignatureBase(aMessageId)
+ {
+ }
+
+
namespace DummyCPRStates
{
DEFINE_SMELEMENT(TSetClientAsIncoming, NetStateMachine::MStateTransition, DummyCPRStates::TContext)
@@ -87,6 +138,13 @@
createSCPR.DoL();
}
+DEFINE_SMELEMENT(TThreeSecDelayAndPostToSelf, NetStateMachine::MStateTransition, DummyCPRStates::TContext)
+void TThreeSecDelayAndPostToSelf::DoL()
+ {
+ CDelayTimer* delay = CDelayTimer::NewL(iContext.Node().ControlProvider(), iContext.NodeId(), iContext.iMessage.MessageId() );
+ delay->Start(KDestroyDelay);
+ }
+
DEFINE_SMELEMENT(TAwaitingStart, NetStateMachine::MState, DummyCPRStates::TContext)
TBool TAwaitingStart::Accept()
{
@@ -101,6 +159,24 @@
}
return EFalse;
}
+
+DEFINE_SMELEMENT(TAwaitingDestroy, NetStateMachine::MState, DummyCPRStates::TContext)
+TBool TAwaitingDestroy::Accept()
+ {
+ const TLayerSelectionInfo* selectionInfo = static_cast<const TLayerSelectionInfo*>(
+ iContext.Node().AccessPointConfig().FindExtension(TLayerSelectionInfo::TypeId()));
+ ASSERT(selectionInfo); // should always be there
+
+ if (iContext.iMessage.IsMessage<TEChild::TDestroy>() &&
+ TCprConfigModifier::Is(selectionInfo->CprConfig(), TCprConfigModifier::ECPRWaitOnThreeSecDestroy)
+ && iContext.iNode.CountActivities(ECFActivityDummyCprDestroy) == 0 ) // only accept the first destroy which will subsequently be reposted to self after 3 second
+ {
+ static_cast<ESock::CMMCommsProviderBase&>(iContext.iNode).MarkMeForDeletion();
+ return ETrue;
+ }
+ return EFalse;
+ }
+
}
//-================================================
@@ -138,14 +214,26 @@
}
// Activity Map For test-code ridden cpr
+namespace DummyCprDestroyActivity
+{
+DECLARE_DEFINE_NODEACTIVITY(ECFActivityDummyCprDestroy, DummyCprDestroy, TEChild::TDestroy)
+ FIRST_NODEACTIVITY_ENTRY(DummyCPRStates::TAwaitingDestroy, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(KNoTag, DummyCPRStates::TThreeSecDelayAndPostToSelf, MeshMachine::TAwaitingMessageState<Messages::TEChild::TLeft>, MeshMachine::TTag<PRStates::KContinue>)
+ LAST_NODEACTIVITY_ENTRY(PRStates::KContinue, MeshMachine::TDoNothing)
+NODEACTIVITY_END()
+}
+
+// Activity Map
namespace DummyCPRStates
{
DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
ACTIVITY_MAP_ENTRY(DummyCprBinderRequestActivity, DummyCprBinderRequest)
ACTIVITY_MAP_ENTRY(DummyCprStartActivity, DummyCPrStart)
+ ACTIVITY_MAP_ENTRY(DummyCprDestroyActivity, DummyCprDestroy)
ACTIVITY_MAP_END_BASE(MobilityCprActivities, mobilityCprActivities)
}
+
// Activity Map For vanilla cpr
namespace VanillaDummyCPRStates
{
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp Mon May 24 18:44:15 2010 +0100
@@ -30,6 +30,7 @@
#include "dummypr_metaconnprov.h"
#include "dummypr_tiermanager.h"
#include "dummypr_network_flow.h"
+#include "dummypr_flow.h"
#include <comms-infras/ss_msgintercept.h>
@@ -44,8 +45,6 @@
using namespace ESock;
-const TInt KProtocolInetDummy = 253;
-
const TInt KDummyMajorVersionNumber = 0;
const TInt KDummyMinorVersionNumber = 1;
const TInt KDummyBuildVersionNumber = 1;
@@ -68,7 +67,7 @@
IMPLEMENTATION_PROXY_ENTRY(CDummyExtendedSubConnectionProviderFactory::iUid, CDummyExtendedSubConnectionProviderFactory::NewL),
// Flow and flow description
- IMPLEMENTATION_PROXY_ENTRY(CDummyNetworkFlowFactory::iUid, CDummyNetworkFlowFactory::NewL),
+ IMPLEMENTATION_PROXY_ENTRY(CDummyFlowFactory::iUid, CDummyFlowFactory::NewL),
};
/**
@@ -299,35 +298,35 @@
//-=========================================================
//
-// CDummyNetworkFlowFactory methods
+// CDummyFlowFactory methods
//
//-=========================================================
-CDummyNetworkFlowFactory* CDummyNetworkFlowFactory::NewL(TAny* aConstructionParameters)
+CDummyFlowFactory* CDummyFlowFactory::NewL(TAny* aConstructionParameters)
{
- CDummyNetworkFlowFactory* fact = new (ELeave) CDummyNetworkFlowFactory(
+ CDummyFlowFactory* fact = new (ELeave) CDummyFlowFactory(
TUid::Uid(iUid),
*(reinterpret_cast<CSubConnectionFlowFactoryContainer*>(aConstructionParameters)));
return fact;
}
-CDummyNetworkFlowFactory::CDummyNetworkFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
+CDummyFlowFactory::CDummyFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
: CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer)
{
- //LOG_NODE_CREATE(KESockDataFactTag, CDummyNetworkFlowFactory)
+ //LOG_NODE_CREATE(KESockDataFactTag, CDummyFlowFactory)
}
-CDummyNetworkFlowFactory::~CDummyNetworkFlowFactory()
+CDummyFlowFactory::~CDummyFlowFactory()
{
- //LOG_NODE_DESTROY(KESockDataFactTag, CDummyNetworkFlowFactory)
+ //LOG_NODE_DESTROY(KESockDataFactTag, CDummyFlowFactory)
}
-CSubConnectionFlowBase* CDummyNetworkFlowFactory::DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, TFactoryQueryBase& aQuery)
+CSubConnectionFlowBase* CDummyFlowFactory::DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, TFactoryQueryBase& aQuery)
{
const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
return CDummyNetworkFlow::NewL(*this, query.iSCprId, aProtocolIntf);
}
-ACommsFactoryNodeId* CDummyNetworkFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery)
+ACommsFactoryNodeId* CDummyFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery)
{
const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
if(query.iMessageId != TCFServiceProvider::TCommsBinderRequest::Id())
@@ -341,7 +340,7 @@
CProtocolIntfBase* protocolInterface = SockManGlobals::Get()->iProtocolIntfFactories->FindOrCreateProtocolIntfL(Uid(), queryProto);
if (protocolInterface == NULL)
{
- LOG( ESockLog::Printf(KESockDataFactTag, _L8("CDummyNetworkFlowFactory %08x:\tCreateFlowL(protocolId '%08x') Cannot find protocol interface, bailing out"), this, Uid()) );
+ LOG( ESockLog::Printf(KESockDataFactTag, _L8("CDummyFlowFactory %08x:\tCreateFlowL(protocolId '%08x') Cannot find protocol interface, bailing out"), this, Uid()) );
User::Leave(KErrNotFound);
}
@@ -349,10 +348,14 @@
CSubConnectionFlowBase* flow = NULL;
switch(query.iProtocolType)
{
- case KProtocolInetDummy:
+ case CDummyNetworkFlow::EProtocolId:
flow = CDummyNetworkFlow::NewL(*this, query.iSCprId, protocolInterface);
break;
+ case CDummyFlow::EProtocolId:
+ flow = CDummyFlow::NewL(*this, query.iSCprId, protocolInterface);
+ break;
+
default:
User::Leave(KErrNotFound);
break;
@@ -360,7 +363,7 @@
LOG( ESockLog::Printf(
KESockDataFactTag,
- _L8("CDummyNetworkFlowFactory %08x:\tCreateFlowL(protocolId '%08x'): flow %08x"),
+ _L8("CDummyFlowFactory %08x:\tCreateFlowL(protocolId '%08x'): flow %08x"),
this,
Uid(),
&flow));
@@ -376,32 +379,53 @@
/**
Description of the protocol this factory creates
*/
-TServerProtocolDesc* CDummyNetworkFlowFactory::DoCreateFlowDescriptionL(TInt aProtocol)
+TServerProtocolDesc* CDummyFlowFactory::DoCreateFlowDescriptionL(TInt aProtocol)
{
TServerProtocolDesc* protocolDescription = new(ELeave) TServerProtocolDesc();
// Poached from udp and modified to represent an rtp like protocol
switch(aProtocol)
{
- case KProtocolInetDummy:
- protocolDescription->iName = KDummyProtocolName;
- protocolDescription->iAddrFamily = KAfInet;
- protocolDescription->iSockType = KSockDatagram;
- protocolDescription->iProtocol = KProtocolInetDummy;
- protocolDescription->iVersion = TVersion(KDummyMajorVersionNumber,
- KDummyMinorVersionNumber,
- KDummyBuildVersionNumber);
- protocolDescription->iByteOrder = EBigEndian;
- protocolDescription->iServiceInfo = KSIConnectionLess | KSIDatagram |
- KSIGracefulClose | KSIPeekData |
- KSIRequiresOwnerInfo;
- protocolDescription->iNamingServices = KNSNameResolution | KNSRequiresConnectionStartup;
- protocolDescription->iSecurity = KSocketNoSecurity;
- protocolDescription->iMessageSize = 65536-128; /*KSocketMessageSizeUndefined;*/
- protocolDescription->iServiceTypeInfo = ESocketSupport | ETransport |
- EPreferMBufChains | ENeedMBufs |
- EUseCanSend;
- protocolDescription->iNumSockets = KUnlimitedSockets;
+ case CDummyNetworkFlow::EProtocolId:
+ protocolDescription->iName = KDummyProtocolName;
+ protocolDescription->iAddrFamily = KAfInet;
+ protocolDescription->iSockType = KSockDatagram;
+ protocolDescription->iProtocol = CDummyNetworkFlow::EProtocolId;
+ protocolDescription->iVersion = TVersion(KDummyMajorVersionNumber,
+ KDummyMinorVersionNumber,
+ KDummyBuildVersionNumber);
+ protocolDescription->iByteOrder = EBigEndian;
+ protocolDescription->iServiceInfo = KSIConnectionLess | KSIDatagram |
+ KSIGracefulClose | KSIPeekData |
+ KSIRequiresOwnerInfo;
+ protocolDescription->iNamingServices= KNSNameResolution | KNSRequiresConnectionStartup;
+ protocolDescription->iSecurity = KSocketNoSecurity;
+ protocolDescription->iMessageSize = 65536-128; /*KSocketMessageSizeUndefined;*/
+ protocolDescription->iServiceTypeInfo= ESocketSupport | ETransport |
+ EPreferMBufChains | ENeedMBufs |
+ EUseCanSend;
+ protocolDescription->iNumSockets = KUnlimitedSockets;
+ break;
+
+ case CDummyFlow::EProtocolId:
+ protocolDescription->iName = KDummyProtocolName;
+ protocolDescription->iAddrFamily = CDummyTierManagerFactory::iUid;
+ protocolDescription->iSockType = KSockDatagram;
+ protocolDescription->iProtocol = CDummyFlow::EProtocolId;
+ protocolDescription->iVersion = TVersion(KDummyMajorVersionNumber,
+ KDummyMinorVersionNumber,
+ KDummyBuildVersionNumber);
+ protocolDescription->iByteOrder = EBigEndian;
+ protocolDescription->iServiceInfo = KSIConnectionLess | KSIDatagram |
+ KSIGracefulClose | KSIPeekData |
+ KSIRequiresOwnerInfo;
+ protocolDescription->iNamingServices = KNSNameResolution | KNSRequiresConnectionStartup;
+ protocolDescription->iSecurity = KSocketNoSecurity;
+ protocolDescription->iMessageSize = 65536-128; /*KSocketMessageSizeUndefined;*/
+ protocolDescription->iServiceTypeInfo= ESocketSupport | ETransport |
+ EPreferMBufChains | ENeedMBufs |
+ EUseCanSend;
+ protocolDescription->iNumSockets = KUnlimitedSockets;
break;
default:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_flow.cpp Mon May 24 18:44:15 2010 +0100
@@ -0,0 +1,439 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Dummy implementation file for network tier flow
+//
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#include <ss_std.h>
+#include <comms-infras/ss_log.h>
+#include <ss_pman.h>
+#include <comms-infras/ss_nodemessages_internal_esock.h>
+#include <comms-infras/ss_protocolparameterset.h>
+#include "dummypr_flow.h"
+
+
+#ifdef _DEBUG
+// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
+// (if it could happen through user error then you should give it an explicit, documented, category + code)
+_LIT(KSpecAssert_ESockTestdmyprnt, "ESockTestdmyprnt");
+#endif
+
+using namespace ESock;
+using namespace Messages;
+
+
+
+
+// Construction
+//-------------
+CDummyFlow* CDummyFlow::NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf)
+ {
+ CDummyFlow* self = new (ELeave) CDummyFlow(aFactory, aSubConn, aProtocolIntf);
+ return self;
+ }
+
+CDummyFlow::CDummyFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf)
+: CSubConnectionFlowBase(aFactory, aSubConn, aProtocolIntf)
+ {
+ LOG_NODE_CREATE(KESockFlowTag, CDummyFlow)
+ }
+
+CDummyFlow::~CDummyFlow()
+ {
+ LOG_NODE_DESTROY(KESockFlowTag, CDummyFlow)
+ }
+
+MSessionControl* CDummyFlow::GetControlL(
+ TInt /*aSessionType*/,
+ MSessionControlNotify& aSessionControlNotify)
+ {
+ // Apply binding locally
+ __ASSERT_DEBUG(iSessionControlNotify == NULL, User::Panic(KSpecAssert_ESockTestdmyprnt, 1));
+ iSessionControlNotify = &aSessionControlNotify;
+
+ return this;
+ }
+
+MSessionData* CDummyFlow::BindL(MSessionDataNotify& aNotify)
+ {
+ LOG( ESockLog::Printf(_L8("CDummyFlow %08x:\tBindL(aNotify 0x%08x)"), this, &aNotify) );
+
+ // Apply binding locally
+ __ASSERT_DEBUG(iSessionDataNotify == NULL, User::Panic(KSpecAssert_ESockTestdmyprnt, 3));
+ iSessionDataNotify = &aNotify;
+ iSubConnectionProvider.RNodeInterface::PostMessage(
+ Id(),
+ TCFControlProvider::TActive().CRef());
+ return this;
+ }
+
+void CDummyFlow::Unbind()
+ {
+ LOG( ESockLog::Printf(_L8("CDummyFlow %08x:\tUnbind()"), this) );
+ ASSERT(iSessionDataNotify); //who else is it calling then?
+
+ iSessionControlNotify = NULL;
+ iSessionDataNotify = NULL;
+
+ ASSERT(iSubConnectionProvider.IsOpen());
+ iSubConnectionProvider.RNodeInterface::PostMessage(
+ Id(),
+ TCFControlProvider::TIdle().CRef()
+ );
+ }
+
+ESock::CSubConnectionFlowBase& CDummyFlow::CloneFlowL()
+ {
+ TDefaultFlowFactoryQuery query (iProtocolIntf->ControlProviderId(), iSubConnectionProvider.RecipientId());
+
+ ESock::CSubConnectionFlowBase& flow = static_cast<ESock::CSubConnectionFlowBase&>(*(Factory().CreateObjectL(query)));
+
+ // Have the new flow become a data client of our subconnection too
+ __ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockTestdmyprnt, 6));
+ TCFPeer::TJoinRequest msg(
+ flow.Id(),
+ TCFClientType(TCFClientType::EData, TCFClientType::EActive)
+ );
+
+ iSubConnectionProvider.PostMessage(Id(), msg);
+
+ return flow;
+ }
+
+CSubConnectionFlowBase* CDummyFlow::Flow()
+ {
+ return this;
+ }
+
+
+// MSessionControl
+//----------------
+void CDummyFlow::Start()
+ {/*__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 7)); return iLowerFlowControl->Start()*/;}
+
+void CDummyFlow::LocalName(TSockAddr& anAddr) const
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 8)); return iLowerFlowControl->LocalName(anAddr);}
+
+void CDummyFlow::SetLocalName(TSockAddr& /*anAddr*/)
+ {
+ // Fetch the current flow parameters (those that were sent to us) and create a new set for the flow we want
+ TFlowParams flowParams;
+ flowParams.iProtocol = CDummyFlow::EProtocolId;
+ flowParams.iSocketType = KSockDatagram;
+
+ // Create and load a parameter set with the flow parameters that form our binder request
+ CFlowRequestParameters* paramSet = CFlowRequestParameters::NewL();
+ CleanupStack::PushL(paramSet);
+ paramSet->SetFlowParams(flowParams);
+ RCFParameterFamilyBundle flowParamsBundle;
+ flowParamsBundle.CreateL();
+ RParameterFamily family = flowParamsBundle.CreateFamilyL(KFlowParametersFamily);
+ family.AddParameterSetL(paramSet, RParameterFamily::ERequested);
+
+ iParamBundle.Open(flowParamsBundle);
+ // Construct and send the message
+ iSubConnectionProvider.RNodeInterface::PostMessage(
+ Id(),
+ TCFControlProvider::TNoBearer(iParamBundle).CRef()
+ );
+
+ CleanupStack::Pop(paramSet);
+ }
+
+void CDummyFlow::RemName(TSockAddr& anAddr) const
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 10)); iLowerFlowControl->RemName(anAddr);}
+
+TInt CDummyFlow::SetRemName(TSockAddr& anAddr)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 11)); return iLowerFlowControl->SetRemName(anAddr);}
+
+const TInt KDummyNetworkFlowOptionLevel = CDummyFlowFactory::iUid;
+const TInt KFlowProtocolName = 1;
+
+TInt CDummyFlow::GetOption(TUint aLevel, TUint aName, TDes8& anOption) const
+ {
+ __ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 12));
+
+ if(aLevel == KDummyNetworkFlowOptionLevel && aName == KFlowProtocolName)
+ {
+ anOption.Copy(KDummyProtocolName);
+ return KErrNone;
+ }
+ else
+ {
+ return iLowerFlowControl->GetOption(aLevel, aName, anOption);
+ }
+ }
+
+void CDummyFlow::Ioctl(TUint aLevel, TUint aName, TDes8* anOption)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 13)); iLowerFlowControl->Ioctl(aLevel, aName, anOption);}
+
+void CDummyFlow::CancelIoctl(TUint aLevel, TUint aName)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 14)); iLowerFlowControl->CancelIoctl(aLevel, aName);}
+
+TInt CDummyFlow::SetOption(TUint /*aLevel*/, TUint /*aName*/, const TDesC8 &/*anOption*/)
+ { return KErrNone; }
+
+void CDummyFlow::ActiveOpen()
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 16)); iLowerFlowControl->ActiveOpen();}
+
+void CDummyFlow::ActiveOpen(const TDesC8& aConnectionData)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 17)); iLowerFlowControl->ActiveOpen(aConnectionData);}
+
+TInt CDummyFlow::PassiveOpen(TUint aQueueSize)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 18)); return iLowerFlowControl->PassiveOpen(aQueueSize);}
+
+TInt CDummyFlow::PassiveOpen(TUint aQueueSize, const TDesC8& aConnectionData)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 19)); return iLowerFlowControl->PassiveOpen(aQueueSize, aConnectionData);}
+
+void CDummyFlow::Shutdown(MSessionControl::TCloseType aOption)
+ {
+ if (iLowerFlowControl)
+ {
+ iLowerFlowControl->Shutdown(aOption);
+ }
+ else
+ {
+ iSessionControlNotify->CanClose(MSessionControlNotify::EDelete);
+ }
+ }
+
+void CDummyFlow::Shutdown(MSessionControl::TCloseType aOption, const TDesC8& aDisconnectionData)
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 21)); iLowerFlowControl->Shutdown(aOption, aDisconnectionData);}
+
+void CDummyFlow::AutoBind()
+ {__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 22)); iLowerFlowControl->AutoBind();}
+
+TInt CDummyFlow::SecurityCheck(MProvdSecurityChecker* /*aChecker*/)
+ { return KErrNone;}
+
+
+// MSessionData
+//-------------
+TUint CDummyFlow::Write(const TDesC8& aDesc, TUint aOptions, TSockAddr* anAddr)
+ {__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 24)); return iLowerFlowData->Write(aDesc, aOptions, anAddr);}
+
+TInt CDummyFlow::Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr)
+ {__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 25)); return iLowerFlowData->Write(aData, aOptions, anAddr);}
+
+void CDummyFlow::GetData(TDes8& aDesc, TUint aOptions, TSockAddr* anAddr)
+ {__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 26)); iLowerFlowData->GetData(aDesc, aOptions, anAddr);}
+
+TInt CDummyFlow::GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr)
+ {__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 27)); return iLowerFlowData->GetData(aData, aLength, aOptions, anAddr);}
+
+
+// MSessionControlNotify
+//----------------------
+void CDummyFlow::ConnectComplete()
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 28)); iSessionControlNotify->ConnectComplete();}
+
+void CDummyFlow::ConnectComplete(const TDesC8& aConnectData)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 29)); iSessionControlNotify->ConnectComplete(aConnectData);}
+
+void CDummyFlow::ConnectComplete(CSubConnectionFlowBase& anSSP)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 30)); iSessionControlNotify->ConnectComplete(anSSP);}
+
+void CDummyFlow::ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 31)); iSessionControlNotify->ConnectComplete(anSSP, aConnectData);}
+
+void CDummyFlow::CanClose(MSessionControlNotify::TDelete aDelete)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 32)); iSessionControlNotify->CanClose(aDelete);}
+
+void CDummyFlow::CanClose(
+ const TDesC8& aDisconnectData,
+ MSessionControlNotify::TDelete aDelete)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 33)); iSessionControlNotify->CanClose(aDisconnectData, aDelete);}
+
+TInt CDummyFlow::Error(TInt anError,TUint anOperationMask)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 34)); return iSessionControlNotify->Error(anError, anOperationMask);}
+
+void CDummyFlow::Disconnect()
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 35)); iSessionControlNotify->Disconnect();}
+
+void CDummyFlow::Disconnect(TDesC8& aDisconnectData)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 36)); iSessionControlNotify->Disconnect(aDisconnectData);}
+
+void CDummyFlow::IoctlComplete(TDesC8* aBuf)
+ {__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 37)); iSessionControlNotify->IoctlComplete(aBuf);}
+
+void CDummyFlow::DisconnectFromListener(CSubConnectionFlowBase& aSSP)
+ {
+ __ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 53));
+ iSessionControlNotify->DisconnectFromListener(aSSP);
+ }
+void CDummyFlow::SetLocalNameComplete()
+ {
+ __ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 52));
+ iSessionControlNotify->SetLocalNameComplete();
+ }
+
+// MSessionDataNotify
+//-------------------
+void CDummyFlow::NewData(TUint aCount)
+ {__ASSERT_DEBUG(iSessionDataNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 39)); iSessionDataNotify->NewData(aCount);}
+
+void CDummyFlow::CanSend()
+ {__ASSERT_DEBUG(iSessionDataNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 40)); iSessionDataNotify->CanSend();}
+
+MFlowBinderControl* CDummyFlow::DoGetBinderControlL()
+ {
+ return this;
+ }
+
+
+// Node stuff
+//-----------
+void CDummyFlow::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
+ {
+ CSubConnectionFlowBase::ReceivedL(aSender, aRecipient, aMessage);
+ TInt err = KErrNone;
+
+ if ( aMessage.IsMessage<TEBase::TError>() )
+ {
+ ASSERT(EFalse); //To be implemented
+ }
+ else if ( aMessage.IsMessage<TCFControlProvider::TBearer>() )
+ {
+ }
+ else if (aMessage.IsMessage<TCFInternalEsock::TFlowProvision>())
+ {
+ }
+ else if (TEChild::ERealmId == aMessage.MessageId().Realm())
+ {
+ switch (aMessage.MessageId().MessageId())
+ {
+ case TEChild::TDestroy::EId :
+ DeleteThisFlow();
+ break;
+ default:
+ __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 41)); //For debug configurations
+ User::Leave(KErrNotSupported); //For release configurations
+ }
+ }
+ else if (TCFDataClient::ERealmId == aMessage.MessageId().Realm())
+ {
+ switch (aMessage.MessageId().MessageId())
+ {
+ case TCFDataClient::TStart::EId :
+ iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStarted().CRef());
+ break;
+ case TCFDataClient::TStop::EId :
+ iParamBundle.Close(); //[RZ] There is a problem with RCFParameterBundle. Nominally this should be cleared (closed) on TBeaer
+ //but that means that this thread (which constructed the bundle) will call Close before the recipient
+ //refcounting will mean that it's the recipient that would then dealocate and crash against different heap.
+ //Best if RCFParameterBundle were changed. Alternativelly, CNoBearer could get rid of the params
+ //earlier.
+
+ if (iLowerFlowBinderControl)
+ {
+ iLowerFlowBinderControl->Unbind(NULL,NULL);
+ iLowerFlowBinderControl->Unbind();
+ iLowerFlowBinderControl = NULL;
+ iLowerFlowControl = NULL;
+ iLowerFlowData = NULL;
+ }
+
+ iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStopped(
+ message_cast<TCFDataClient::TStop>(aMessage).iValue).CRef());
+ break;
+ case TCFDataClient::TProvisionConfig::EId:
+ break;
+ case TCFDataClient::TBindTo::EId:
+ {
+ TCFDataClient::TBindTo& bindToMsg(static_cast<TCFDataClient::TBindTo&>(aMessage));
+ TRAP(err, BindToL(bindToMsg));
+
+ if(err == KErrNone)
+ {
+ RClientInterface::OpenPostMessageClose(Id(), aSender, TCFDataClient::TBindToComplete().CRef());
+ }
+ else
+ {
+ RClientInterface::OpenPostMessageClose(Id(), aSender, TEBase::TError(aMessage.MessageId(), err).CRef());
+ }
+
+ if (iSessionControlNotify && !iParamBundle.IsNull())
+ {
+ iSessionControlNotify->SetLocalNameComplete();
+ }
+ }
+ break;
+ default:
+ __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 42)); //For debug configurations
+ User::Leave(KErrNotSupported); //For release configurations
+ }
+ }
+ else
+ {
+ __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 45)); //For debug configurations
+ User::Leave(KErrNotSupported); //For release configurations
+ }
+ }
+
+void CDummyFlow::BindToL(TCFDataClient::TBindTo& aBindTo)
+/**
+Request from control side (at network layer) to indicate that the SubConnection is
+up and running and that we should bind to a Flow below.
+
+@param aLowerFlow Flow below to bind to.
+*/
+ {
+ //provisioning message must come before bindto in case we didn't get it after we've joined
+ //the sub-connection
+ if (aBindTo.iNodeId == Messages::TNodeId::NullId())
+ {
+ return;
+ }
+ NM_LOG((KESockServerTag, _L8("CDummyFlow %08x:\tSynchronous call: From=%08x To=%08x Func=BindToL"),
+ this, static_cast<Messages::ANode*>(this), &aBindTo.iNodeId.Node()) )
+
+ const TNodeId& commsId = aBindTo.iNodeId;
+
+#if defined(__GCCXML__)
+ CSubConnectionFlowBase* flow = reinterpret_cast<CSubConnectionFlowBase*>(&commsId.Node());
+#else
+ CSubConnectionFlowBase* flow = Messages::mnode_cast<CSubConnectionFlowBase>(&commsId.Node());
+#endif
+
+ // Flows can only be directly bound when running in the same thread
+ __ASSERT_DEBUG(commsId.Thread() == Id().Thread(), User::Panic(KSpecAssert_ESockTestdmyprnt, 47));
+
+ if (iLowerFlowBinderControl && iLowerFlowBinderControl->Flow() != flow )
+ {
+ // Already bound to something else so unbind first
+ iLowerFlowBinderControl->Unbind(NULL,NULL);
+ iLowerFlowBinderControl = NULL;
+
+ iLowerFlowBinderControl->Unbind();
+ iLowerFlowControl = NULL;
+ iLowerFlowData = NULL;
+ }
+
+ if (iLowerFlowBinderControl == NULL)
+ {
+ // Protocol binding
+ iLowerFlowBinderControl = flow->GetBinderControlL();
+ iLowerFlowControl = iLowerFlowBinderControl->GetControlL(KSockDatagram, *this);
+ iLowerFlowData = iLowerFlowBinderControl->BindL(*this);
+ }
+ }
+
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp Mon May 24 18:44:15 2010 +0100
@@ -165,7 +165,7 @@
TInt CDummyNetworkFlow::SetRemName(TSockAddr& anAddr)
{__ASSERT_DEBUG(iFlowShim, User::Panic(KSpecAssert_ESockTestdmyprnt, 11)); return iFlowShim->SetRemName(anAddr);}
-const TInt KDummyNetworkFlowOptionLevel = CDummyNetworkFlowFactory::iUid;
+const TInt KDummyNetworkFlowOptionLevel = CDummyFlowFactory::iUid;
const TInt KFlowProtocolName = 1;
TInt CDummyNetworkFlow::GetOption(TUint aLevel, TUint aName, TDes8& anOption) const
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Mon May 24 18:44:15 2010 +0100
@@ -93,8 +93,46 @@
return (iContext.iMessage.IsMessage<TCFDataClient::TStart>() &&
TCprConfigModifier::Is(selectionInfo->CprConfig(), TCprConfigModifier::ESCPRHangOnStart));
}
+
+DEFINE_SMELEMENT(TCancelPreviousSelfRequest, NetStateMachine::MStateTransition, DummySCPRStates::TContext)
+void TCancelPreviousSelfRequest::DoL()
+ {
+ iContext.iNodeActivity->PostRequestTo(iContext.Node().Id(), Messages::TEBase::TCancel().CRef());
+ }
+
+DEFINE_SMELEMENT(TRebindSelf, NetStateMachine::MStateTransition, DummySCPRStates::TContext)
+void TRebindSelf::DoL()
+ {
+ iContext.iNodeActivity->PostRequestTo(iContext.Node().Id(), TCFDataClient::TBindTo(Messages::TNodeId::NullId()).CRef());
+ }
+
+
+
+
+CrazyIdle::~CrazyIdle()
+ {
+ ASSERT(PostedToNodeId()==Messages::TNodeId::NullId());
+ }
+
+MeshMachine::CNodeActivityBase* CrazyIdle::NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+ {
+ return new(ELeave)CrazyIdle(aActivitySig, aNode);
+ }
+
+DEFINE_SMELEMENT(CrazyIdle::TAwaitingCancelled, NetStateMachine::MState, DummySCPRStates::TContext)
+TBool CrazyIdle::TAwaitingCancelled::Accept()
+ {
+ if (iContext.iMessage.IsMessage<Messages::TEBase::TError>())
+ {
+ ASSERT(iContext.iNodeActivity);
+ iContext.iNodeActivity->SetPostedTo(iContext.iNodeActivity->SoleOriginator().Peer().RecipientId());
+ }
+ return EFalse;
+ }
}
+
+
namespace DummySCprParamsRequest
{
#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
@@ -134,6 +172,41 @@
NODEACTIVITY_END()
}
+namespace CrazyIdleActivity
+{
+//CrazyIdleActivity is used to test yet another angle of the meshmachine cancelling behaviour.
+//What it does is:
+//(1) responds to TIdle with an attempt to bind the sender, then, without waiting for the bind to complete
+//(2) responds to TIdle normally (by deleting the sender)
+//(3) cancells the bind request
+//What it tests is:
+//For two related nodes and upon the teardown of their relation there is an obligation to synchronise the activities
+//running on the nodes and awaiting responses from each other. This obligation is put on the requestee, i.e.: a node that perfomes
+//an activity on behalf of a leaving node should gracefully terminate that activity (by having the activity respond to the requestor.
+//That obligation therefore doesn't rest on the requestor (someone, but not everyone, needs to do something).
+//There's trivial race condition arising from this distribution of responsibility, i.e.: the requestor activity may decide to
+//cancel when the relation is being terminated and TCancel may hit void. Activities must be resilient to this and not send
+//TCancels to disappearing nodes. CrazyIdleActivity tests precislely this: it initaites an activity (TBindTo), then tears down the
+//relation and cancels the previously initiated activity (TBindTo). CrazyIdleActivity must wrap up gracefully.
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityDataClientIdle, crazyIdle, TCFControlProvider::TIdle, DummySCPRStates::CrazyIdle::NewL)
+ FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientIdle, MeshMachine::TNoTag)
+ //Issue TBindTo to self (this will then bind the data client reporting TIdle). Wait for BindTo activity to start before
+ //telling the dataclient to go away (TDestroy) as otherwise TBindTo won't make it in sending TBindTo to the dataclient.
+ THROUGH_NODEACTIVITY_ENTRY(KNoTag, DummySCPRStates::TRebindSelf, DummySCPRStates::TNoTagWaitForBindTo)
+ THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::THandleDataClientIdle, MeshMachine::TNoTag)
+ //There's an additional test peformed by DummySCPRStates::CrazyIdle::TAwaitingCancelled. The state sets the postedto of CrazyIdle
+ //to point at the dataclient and CrazyIdle::~CrazyIdle asserts that that postedto is cleared. Currently PostedTo isn't cleared automatically - some people
+ //argued that it shouldn't and that activities should clear postedto whenever it's good for them. Unfortunatelly some activities are
+ //a bit lousy doing this and in result they can store a postedto pointing a node that has responded to the request a long time ago
+ //and above all a node that may have a long time ago left. A facility has been added to meshmachine to clear postedto when the node pointed
+ //at it actually leaves. This facility is tested collectivelly by DummySCPRStates::CrazyIdle::TAwaitingCancelled and CrazyIdle::~CrazyIdle
+ NODEACTIVITY_ENTRY(KNoTag, DummySCPRStates::TCancelPreviousSelfRequest, DummySCPRStates::CrazyIdle::TAwaitingCancelled, DummySCPRStates::TNoTagWaitNoDataClients)
+ LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
+NODEACTIVITY_END()
+}
+
+
+
// Activity Map For test-code ridden scpr
namespace DummySCPRStates
{
@@ -141,7 +214,8 @@
ACTIVITY_MAP_ENTRY(DummySCprParamsRequest, dummySCprParamRequest)
ACTIVITY_MAP_ENTRY(DummyBindToActivity, dummyBindTo)
ACTIVITY_MAP_ENTRY(DummyBreakStartActivity, dummyBreakSCPrStart)
- ACTIVITY_MAP_ENTRY(DummyStartActivity, dummySCPrStart)
+ ACTIVITY_MAP_ENTRY(DummyStartActivity, dummySCPrStart)
+ ACTIVITY_MAP_ENTRY(CrazyIdleActivity, crazyIdle)
ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
}
@@ -228,3 +302,5 @@
+
+
--- a/datacommsserver/networkingdialogapi/inc/AgentDialog.h Mon May 24 18:38:45 2010 +0100
+++ b/datacommsserver/networkingdialogapi/inc/AgentDialog.h Mon May 24 18:44:15 2010 +0100
@@ -1,5 +1,5 @@
/**
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,7 @@
/**
@file
@publishedAll
- @released
+ @deprecated
*/
#ifndef __AGENTDIALOG_H__
@@ -37,7 +37,7 @@
/**
Server name in EKA2 case
@publishedAll
-@released
+@deprecated
*/
_LIT(KCommsDialogServerName, "!NetDialDialogServer");
@@ -50,7 +50,7 @@
Specifies the rank and desired direction of the connection and bearer.
@publishedAll
-@released
+@deprecated
*/
{
public:
@@ -64,7 +64,7 @@
Specifies the Connection Names for ISP.
@publishedAll
-@released
+@deprecated
*/
{
public:
@@ -80,7 +80,7 @@
Specifies the Authentication for the User Name and Password.
@publishedAll
-@released
+@deprecated
*/
{
public:
@@ -93,7 +93,7 @@
Allows the user to see the login script running, see what is sent and received, and allows the user to type responses.
@publishedAll
-@released
+@deprecated
*/
{
public:
@@ -105,7 +105,7 @@
Specifies Connection Preference for the New IAP.
@publishedAll
-@released
+@deprecated
*/
{
public:
@@ -123,7 +123,7 @@
implementation.
@publishedAll
-@released
+@deprecated
*/
{
public :
@@ -139,7 +139,7 @@
have to implement the API as a client server mechanism.
@publishedAll
-@released
+@deprecated
*/
{
public: