# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274785239 -10800 # Node ID 9644881fedd01d4b1b4579d9be08ee3dadb78401 # Parent 9ddb1d67ebafdbe6bad718ca06731dd2c44c6a4e Revision: 201021 Kit: 2010121 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/commsfw/inc/cftransport.h --- a/commsfwsupport/commselements/commsfw/inc/cftransport.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/commsfw/inc/cftransport.h Tue May 25 14:00:39 2010 +0300 @@ -262,9 +262,6 @@ IMPORT_C void RegisterAddress(Messages::TRuntimeCtxId& aCookie); IMPORT_C void DeregisterAddress(Messages::TRuntimeCtxId& aCookie); - // From MTransportSender - IMPORT_C void PostMessage(const Messages::TRuntimeCtxId& aPostFrom, const Messages::TRuntimeCtxId& aPostTo, const Meta::SMetaData& aMessage); - // TCFMessage + legacy IMPORT_C void RegisterLegacyInterface(MLegacyMessageReceiver* aLegacyInterface); IMPORT_C void PostMessage(const TCFMessage& aMessage); diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def --- a/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def Tue May 25 14:00:39 2010 +0300 @@ -45,7 +45,7 @@ ?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTRuntimeCtxId@Messages@@@Z @ 44 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TRuntimeCtxId const &) const ?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTNodePeerId@Messages@@@Z @ 45 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TNodePeerId const &) const ?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVRNodeInterface@Messages@@@Z @ 46 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::RNodeInterface const &) const - ?GetNextActivityCountL@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCountL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &) + ?GetNextActivityCount@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCount(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &) ?GetVTablePtr@TAwaitingAny@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 48 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingAny::GetVTablePtr(class TDesC8 &, void *) ?GetVTablePtr@TAwaitingCancel@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 49 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingCancel::GetVTablePtr(class TDesC8 &, void *) ?GetVTablePtr@TAwaitingClientLeavingRequest@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 50 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingClientLeavingRequest::GetVTablePtr(class TDesC8 &, void *) @@ -135,5 +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 - diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def --- a/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def Tue May 25 14:00:39 2010 +0300 @@ -81,7 +81,7 @@ _ZN11MeshMachine19TRaiseActivityError3DoLEv @ 80 NONAME _ZN11MeshMachine22TAwaitingLeaveComplete12GetVTablePtrER6TDesC8Pv @ 81 NONAME _ZN11MeshMachine22TAwaitingLeaveComplete6AcceptEv @ 82 NONAME - _ZN11MeshMachine25CNodeParallelActivityBase21GetNextActivityCountLERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME + _ZN11MeshMachine25CNodeParallelActivityBase20GetNextActivityCountERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME _ZN11MeshMachine25CNodeParallelActivityBase4NewLERKNS_13TNodeActivityERNS_11AMMNodeBaseE @ 84 NONAME _ZN11MeshMachine25CNodeParallelActivityBaseC1ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 85 NONAME _ZN11MeshMachine25CNodeParallelActivityBaseC2ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 86 NONAME @@ -203,5 +203,7 @@ _ZTIN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 202 NONAME _ZTVN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 203 NONAME _ZN11MeshMachine37CNodeParallelMessageStoreActivityBase6StartLERNS_16TNodeContextBaseERKN8Messages11XNodePeerIdERKN15NetStateMachine12TStateTripleE @ 204 NONAME + _ZN11MeshMachine17CNodeActivityBase11SetPostedToERKN8Messages14RNodeInterfaceE @ 205 NONAME + _ZNK11MeshMachine17CNodeActivityBase12PostedToPeerEv @ 206 NONAME + _ZNK11MeshMachine17CNodeActivityBase14PostedToNodeIdEv @ 207 NONAME - diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/inc/mm_activities.h --- a/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Tue May 25 14:00:39 2010 +0300 @@ -91,7 +91,7 @@ #define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \ EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \ - const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \ DEFINE_TRIPLES_TABLE( name :: iData ) /** @@ -110,7 +110,7 @@ @see CNodeActivityBase */ #define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ - const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \ DEFINE_TRIPLES_TABLE( name :: iData ) #else @@ -128,7 +128,7 @@ #define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \ EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \ - const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \ DEFINE_TRIPLES_TABLE( name :: iData ) /** @@ -147,7 +147,7 @@ @see CNodeActivityBase */ #define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ - const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \ DEFINE_TRIPLES_TABLE( name :: iData ) #endif @@ -417,6 +417,126 @@ }; /** +RESERVED MACROS NOT TO BE USED. +The following are new macro definitions allowing the context to be passed as a parameter rather than the node. +In time the ability to pass context rather than node will be placed in the original macros. For the meantime, +only critical commsFw activities which must have the context passed instead of the node should use these macros. +All other activities should continue to use original macros declared above. +*/ +/** +Declare and export a node activity. + +@param name The name of the activity, which will be used to put it into the node's activity map + +@see DECLARE_NODEACTIVITY +*/ +#define DECLARE_RESERVED_EXPORT_NODEACTIVITY( name ) \ + struct name \ + { \ + IMPORT_C static const MeshMachine::TNodeActivity& Self(); \ + IMPORT_C static const NetStateMachine::TStateTriple& FirstTriple(); \ + static const MeshMachine::TNodeActivity iSelf; \ + static const NetStateMachine::TStateTriple iData[]; \ + }; + +/** +Declares a node activity. A node activity is a state machine. It contains multiple nodeactivity +entries, which respresent the states, transitions and forks of the state machine. + +@param name The name of the activity, which will be used to put it into the node's activity map + +@see DEFINE_NODEACTIVITY +@see NODEACTIVITY_ENTRY +*/ +#define DECLARE_RESERVED_NODEACTIVITY( name ) \ + struct name \ + { \ + inline static const MeshMachine::TNodeActivity& Self() {return iSelf;} \ + inline static const NetStateMachine::TStateTriple& FirstTriple() {return iData[1];} \ + static const MeshMachine::TNodeActivity iSelf; \ + static const NetStateMachine::TStateTriple iData[]; \ + }; + +#ifdef SYMBIAN_TRACE_ENABLE + +/** +Define a custom node activity. A custom node activity is a node activity which defines its own +node activity class. This is used, for example, if the activity wishes to share some custom context +information between the states and transition in the activity. + +Node activity class must derive from CNodeActivityBase. + +@param id Identifier for the activity +@param name The name of the activity +@param msgtype Message which will kickoff this activity +@param ctor Constructor for the custom activity class + +@see DEFINE_RESERVED_NODEACTIVITY +@see CNodeActivityBase + +*/ + #define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \ + DEFINE_TRIPLES_TABLE( name :: iData ) + +#else + +/** +Define and export a custom node activity. + +@param id Identifier for the activity +@param name The name of the activity +@param msgtype Message which will kickoff this activity +@param ctor Constructor for the custom activity class + +@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY +*/ + #define DEFINE_RESERVED_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ + EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \ + EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \ + DEFINE_TRIPLES_TABLE( name :: iData ) + +/** +Define a custom node activity. A custom node activity is a node activity which defines its own +node activity class. This is used, for example, if the activity wishes to share some custom context +information between the states and transition in the activity. + +Node activity class must derive from CNodeActivityBase. + +@param id Identifier for the activity +@param name The name of the activity +@param msgtype Message which will kickoff this activity +@param ctor Constructor for the custom activity class + +@see DEFINE_RESERVED_NODEACTIVITY +@see CNodeActivityBase +*/ + #define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ + const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \ + DEFINE_TRIPLES_TABLE( name :: iData ) + +#endif + +/** +Define and declare a custom node activity + +@param id Identifier for the activity +@param name The name of the activity +@param msgtype Message which will kickoff this activity +@param ctor Constructor for the custom activity class + +@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY +*/ +#define DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \ + DECLARE_RESERVED_NODEACTIVITY( name ) \ + DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) + +/** +END OF RESERVED MACROS +*/ + +/** Mark the end of an activity map. This macro should be used for an activity map based on other activity maps. @@ -432,6 +552,7 @@ namespace MeshMachine { + /** Base class for all node activity objects. Non custom node activities will use this by default. **/ @@ -516,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. @@ -576,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 @@ -809,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(&iBuf[0]); + } + + const TPeerType* _Peer() const + { + return reinterpret_cast(&iBuf[0]); + } + + Messages::TNodeId* _Node() + { + return reinterpret_cast(&iBuf[0]); + } + + const Messages::TNodeId* _Node() const + { + return reinterpret_cast(&iBuf[0]); + } + TUint8 iBuf[__Align8(sizeof(Messages::TNodeId))]; + } iPostedToId; }; @@ -846,7 +1029,14 @@ @param aNode The node to which this activity will belong. @return Generated unique component of activity id */ - IMPORT_C static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ); + static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ); + /** + For use by custom activity News to generate the unique part of the activity id. + @param aActivitySig Context information about how the activity is to be started + @param aNode The node to which this activity will belong. + @return Generated unique component of activity id + */ + IMPORT_C static TUint GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ); /** Constructor for CNodeParallelActivityBase @@ -1387,6 +1577,13 @@ static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode); }; + +inline TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ) + { + //Historical. Method ceased to leave, but must keep the old, L-ending overload. + return GetNextActivityCount(aActivitySig, aNode); + } + } //namespace MeshMachine #endif //SYMBIAN_MM_ACTIVITIES_H diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h --- a/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h Tue May 25 14:00:39 2010 +0300 @@ -46,15 +46,29 @@ /** */ { + enum TNodeActivityFlags + { + EContextCtor = 1 + }; + + /*There are now two types of activity c'tors (hence TAny iCtor supported: + (1) The legacy ctor based on AMMNodeBase that must be supported for source backwards compatibility + (2) The new ctor based on TNodeContextBase that is desired because TNodeContextBase gives access to AMMNodeBase as well as the message + and peer and it is therefore more powerful. This new ctor has been introduced to aid leave activities to be infallible + by allowing access to the peer, which stores the space preallocated for the activity + Ideally this once fixed to only leave (2) especially since differentiating (1) from (2) is rather obscure. iCtor is a pointer + to a pointer to a ctor function and the distinction is based on where iCtor points (see AMMNodeBase::StartActivityL) */ typedef CNodeActivityBase* (*TStaticActivityCtor)(const TNodeActivity& aActivitySig, AMMNodeBase& aNode); + typedef CNodeActivityBase* (*TStaticActivityContextCtor)(const TNodeActivity& aActivitySig, TNodeContextBase& aCtx); const TUint8 iId; + const TUint8 iFlags; //Message starting the activity (state in iFirstTriple is waiting for), //used by error handling, could be NULL for "single triple" activities because //than the current message associated with context is used. const TUint16 iKickOffMessageId; const TUint32 iKickOffMessageRealm; const NetStateMachine::TStateTriple& iFirstTriple; - const TStaticActivityCtor iCtor; + const TAny* iCtor; const TText8* iName; }; diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/src/mm_activities.cpp --- a/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Tue May 25 14:00:39 2010 +0300 @@ -45,7 +45,9 @@ enum { EPanicCorruptedContext = 1, - EPanicNoPreallocatedSpace = 2 + EPanicNoPreallocatedSpace = 2, + EPanicOutOfActivities = 3, + EPanicOutOfBounds }; //-========================================================= @@ -167,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(&aContext.iRecipient); TBool activity = (recipient == NULL || ActivityId() == recipient->NodeCtx()); @@ -181,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--) @@ -317,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 { @@ -352,8 +355,8 @@ if (PostToOriginator(iOriginators[n], aMessage)) { ++msgSendCount; - iOriginators[n].Peer().SetFlags(aFlagsToSet); - iOriginators[n].Peer().ClearFlags(aFlagsToClear); + iOriginators[n].SetFlags(aFlagsToSet); + iOriginators[n].ClearFlags(aFlagsToClear); }; } return msgSendCount; @@ -361,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) @@ -374,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) @@ -383,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 @@ -417,6 +460,49 @@ } } + + + +//-========================================================= +// +//CNodeActivityBase::RPostedToNodeOrPeer +// +//-========================================================= +CNodeActivityBase::RPostedToNodeOrPeer::RPostedToNodeOrPeer() + { + Close(); + } + +void CNodeActivityBase::RPostedToNodeOrPeer::Open(const Messages::RNodeInterface& aPeer) + { + Close(); + *_Peer() = const_cast(&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 @@ -461,20 +547,80 @@ aInterface = this; } +// BitMap utility used only by CNodeParallelActivityBase::GetNextActivityCount +template +class TBitmap { +public: + static const TInt iSize = sizeof(TUint32) * 8; + static const TUint32 iSizeMask = iSize - 1; + static const TUint32 iFull = ~0; + static const TInt iCount = (SIZE + iSizeMask) / iSize; + TBitmap(); + void SetBit(TUint aBitNum); + TInt GetFreeBit() const; + +private: + TUint32 iBits[iCount]; +}; + +template +TBitmap::TBitmap() +{ + for (TInt i = 0 ; i < iCount ; ++i) + { + iBits[i] = 0; + } +} + +template +void TBitmap::SetBit(TUint aBitNum) + { + const TInt index = aBitNum / iSize; + __ASSERT_ALWAYS(index < iCount,User::Panic(KMMActivityPanic,EPanicOutOfBounds)); + + iBits[index] |= 1 << (aBitNum & iSizeMask); + } + +template +TInt TBitmap::GetFreeBit() const + { + for (TInt i = 0 ; i < iCount ; ++i) + { + const TUint32 bits = iBits[i]; + if (bits != iFull) + { + // Bitmap represents list of activity IDs. Activity ID 1 is a reserved value. + // In order to mirror this fact the first bit of the bitmap is also always reserved + TUint32 mask = 2; + for (TInt bitIndex = 1 ; bitIndex < iSize ; ++bitIndex) + { + if ((bits & mask) == 0) + { + return (i * iSize) + bitIndex; + } + mask <<= 1; + } + } + } + return KErrNotFound; + } + + //-========================================================= // //CNodeParallelActivityBase // //-========================================================= -// For custom activities to implement NewL -EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ) + + +// For custom activities to implement New +EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode ) { - TInt c = 1, i = 0; + TInt c = 1; const RPointerArray& activities = aNode.Activities(); - RArray activityids; - CleanupClosePushL(activityids); - + + TBitmap<256> activityids; // collect the currently used ids for (TInt i = 0; i < activities.Count(); i++) { @@ -482,23 +628,12 @@ if ((id&0xff) == aActivitySig.iId) { TInt8 uniqueid = id >> 8; - activityids.InsertInOrderL(uniqueid); + activityids.SetBit(uniqueid); } } - - // find first available. - while (i < activityids.Count() - && activityids[i] == c) - { - ++i; - ++c; - } - CleanupStack::PopAndDestroy(&activityids); - - if(c > KActivityParallelRangeMax>>8) - { - User::Leave(KErrInUse); - } + c = activityids.GetFreeBit(); + + __ASSERT_ALWAYS(c>=0,User::Panic(KMMActivityPanic,EPanicOutOfActivities)); return c; } diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/meshmachine/src/mm_node.cpp --- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Tue May 25 14:00:39 2010 +0300 @@ -26,7 +26,6 @@ #include #include - #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) @@ -232,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())) @@ -430,6 +429,7 @@ } } + EXPORT_C void AMMNodeBase::AbortActivitiesOriginatedBy(TNodeContextBase& aContext, const TNodeId& aCommsId, TBool aIsNodeBeingDestroyed) { CNodeActivityBase* caller = aContext.iNodeActivity; @@ -438,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()) @@ -622,21 +636,36 @@ void AMMNodeBase::StartActivityL(TNodeContextBase& aContext, const TNodeActivity& aActivitySig, const NetStateMachine::TStateTriple& aFirst) { - CNodeActivityBase* a = aActivitySig.iCtor(aActivitySig,*this); - if (iActivities.Find(a)==KErrNotFound) + CNodeActivityBase* nodeActivity; + // Activity is based on one of 2 declarations. One of which has an extra member. In the case of the instance + // with a second member the activities Ctor will point to this second member. Since the first member is a TNodeActivity + // We can compare the activities Ctor pointer to the address of the second member to assess which type of declarations + // this is. + + if (aActivitySig.iFlags & TNodeActivity::EContextCtor) + { // TNodeActivity's iCtor is a pointer to Activity Ctor + nodeActivity = ((TNodeActivity::TStaticActivityContextCtor)aActivitySig.iCtor)(aActivitySig,aContext); + } + else + { // TNodeActivity's iCtor is a pointer to activity constructor + nodeActivity = ((TNodeActivity::TStaticActivityCtor)aActivitySig.iCtor)(aActivitySig,*this); + } + + if (iActivities.Find(nodeActivity)==KErrNotFound) { //The activity did not add itself to the list in any special way, append it here - CleanupStack::PushL(a); - a->AppendActivityL(); - CleanupStack::Pop(a); + CleanupStack::PushL(nodeActivity); + nodeActivity->AppendActivityL(); + CleanupStack::Pop(nodeActivity); } + //assign only after the activity is successfully appended - aContext.iNodeActivity = a; + aContext.iNodeActivity = nodeActivity; //if StartL leaves the "a" will be removed from the array and deleted in ::PostReceived //since it will be idle XNodePeerId originator(aContext.iSender, aContext.iPeer); - a->StartL(aContext, originator, aFirst); + nodeActivity->StartL(aContext, originator, aFirst); } void AMMNodeBase::PreallocateSpaceL(TUint aSize) diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def --- a/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def Tue May 25 14:00:39 2010 +0300 @@ -37,7 +37,7 @@ ??8TNodeIdRemainder@Messages@@QBEHABVTRuntimeCtxId@1@@Z @ 36 NONAME ; int Messages::TNodeIdRemainder::operator==(class Messages::TRuntimeCtxId const &) const ??8TRuntimeCtxId@Messages@@QBEHABV01@@Z @ 37 NONAME ; int Messages::TRuntimeCtxId::operator==(class Messages::TRuntimeCtxId const &) const ??ATClientIterBase@Messages@@QAEPAVRNodeInterface@1@H@Z @ 38 NONAME ; class Messages::RNodeInterface * Messages::TClientIterBase::operator[](int) - ?AddClientL@ANodeBase@Messages@@QAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *) + ?AddClientL@ANodeBase@Messages@@UAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *) ?AddPersistentItf@CGlobals@Messages@@QAEXABVTNodeId@2@@Z @ 40 NONAME ABSENT ; void Messages::CGlobals::AddPersistentItf(class Messages::TNodeId const &) ?Close@RClientInterface@Messages@@QAEXXZ @ 41 NONAME ; void Messages::RClientInterface::Close(void) ?Close@RNodeInterface@Messages@@QAEXXZ @ 42 NONAME ; void Messages::RNodeInterface::Close(void) @@ -201,5 +201,8 @@ ?GetVDataTableStatic@TSigNodeIdNumberNumberNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 200 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigNodeIdNumberNumberNumber::GetVDataTableStatic(void) ?GetVDataTableStatic@TSigTypeId@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 201 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeId::GetVDataTableStatic(void) ?GetVDataTableStatic@TSigTypeIdAnyNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 202 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeIdAnyNumber::GetVDataTableStatic(void) + ??1RNodeInterface@Messages@@UAE@XZ @ 203 NONAME ; Messages::RNodeInterface::~RNodeInterface(void) + ?PreAllocL@RNodeInterface@Messages@@AAEXI@Z @ 204 NONAME ; void Messages::RNodeInterface::PreAllocL(unsigned int) + ??0RNodeInterface@Messages@@QAE@XZ @ 205 NONAME ; Messages::RNodeInterface::RNodeInterface(void) + ?ClaimPreallocatedSpace@RNodeInterface@Messages@@AAEPAXI@Z @ 206 NONAME ; void * Messages::RNodeInterface::ClaimPreallocatedSpace(unsigned int) - diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def --- a/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def Tue May 25 14:00:39 2010 +0300 @@ -331,5 +331,13 @@ _ZTVN8Messages13TSigMessageIdE @ 330 NONAME _ZTVN8Messages19TSigTypeIdAnyNumberE @ 331 NONAME _ZTVN8Messages28TSigNodeIdNumberNumberNumberE @ 332 NONAME + _ZN8Messages14RNodeInterface22ClaimPreallocatedSpaceEj @ 333 NONAME + _ZN8Messages14RNodeInterface9PreAllocLEj @ 334 NONAME + _ZN8Messages14RNodeInterfaceC1Ev @ 335 NONAME + _ZN8Messages14RNodeInterfaceC2Ev @ 336 NONAME + _ZN8Messages14RNodeInterfaceD0Ev @ 337 NONAME + _ZN8Messages14RNodeInterfaceD1Ev @ 338 NONAME + _ZN8Messages14RNodeInterfaceD2Ev @ 339 NONAME + _ZTIN8Messages14RNodeInterfaceE @ 340 NONAME + _ZTVN8Messages14RNodeInterfaceE @ 341 NONAME - diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h --- a/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h Tue May 25 14:00:39 2010 +0300 @@ -33,6 +33,17 @@ _LIT(KSpecAssert_ElemNodeMessIntH, "ElemNodeMessIntH"); #endif +// Forward declarations to be used with RNodeInterface to allow for friend assignment +namespace ESock + { + class CMMCommsProviderBase; + } + +namespace CprClientLeaveActivity + { + class CClientLeaveActivity; + } + namespace Messages { @@ -288,7 +299,16 @@ { friend class TClientIterBase; + // Friend classes needed to allow access to memory preallocation functionality + // This friend funtionality is to be removed when the preallocation functionality is revisited + // These friends are not to be used for any further functionality + friend class ESock::CMMCommsProviderBase; + friend class CprClientLeaveActivity::CClientLeaveActivity; + public: + IMPORT_C RNodeInterface(); + IMPORT_C virtual ~RNodeInterface(); + IMPORT_C void Open(TNodeId aPostTo, const TClientType& aClientType = TClientType::NullType(), MTransportSender* aSender = NULL); IMPORT_C void Close(); IMPORT_C TBool operator==(const RNodeInterface& aRHS) const; @@ -367,8 +387,40 @@ #endif } +// Handling of preallocating memory to be used by the Leave activity +private: + IMPORT_C void PreAllocL(TUint aAllocSize); + + /** + Claim some preallocated memory from the RNodeInterface. This preallocated memory is used for activities that + absolutely cannot fail in any scenario, such as for Leaving the node. For this reason, when the + RNodeInterface is created, some memory is allocated so that a leaving activity can't even fail in an out + of memory situation. + + This method is static as the memory must be claimed before the activity object is constructed. + + @param aNode The node that owns the preallocated space. This must be the node that the activity runs on. + @param aSize Size of buffer to allocate. + + @return A pointer to the allocated block of memory + */ + IMPORT_C TAny* ClaimPreallocatedSpace(TUint aSize); + protected: TClientType iClientType; +private: + struct TPreAllocStore + { + TPreAllocStore() + { + iPreAllocSize=0; + iPreAllocatedActivityChunk=NULL; + } + TUint iPreAllocSize; + TAny* iPreAllocatedActivityChunk; + }; + + TPreAllocStore* iPreAlloc; }; class RRequestOriginator diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/nodemessages/inc/nm_node.h --- a/commsfwsupport/commselements/nodemessages/inc/nm_node.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/nodemessages/inc/nm_node.h Tue May 25 14:00:39 2010 +0300 @@ -127,7 +127,7 @@ public: IMPORT_C virtual RNodeInterface* NewClientInterfaceL(const TClientType& aClientType, TAny* aClientInfo = NULL); - IMPORT_C RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL); + IMPORT_C virtual RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL); IMPORT_C void RemoveClient(RNodeInterface& aClient); IMPORT_C void RemoveClient(TInt aIndex); inline const TNodeId& Id() const diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp --- a/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp Tue May 25 14:00:39 2010 +0300 @@ -115,6 +115,15 @@ * * *******************************************************************************************************/ + +EXPORT_C RNodeInterface::RNodeInterface() : iPreAlloc(NULL) + {} + +EXPORT_C RNodeInterface::~RNodeInterface() + { + __ASSERT_DEBUG(iPreAlloc == NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 1)); + } + EXPORT_C void RNodeInterface::Open(TNodeId aPostTo, const TClientType& aClientType, MTransportSender* aSender) /* Opens 'this'. @@ -129,9 +138,14 @@ { RClientInterface::Close(); iClientType = TClientType::NullType(); + if(iPreAlloc!=NULL) + { + delete iPreAlloc->iPreAllocatedActivityChunk; + } + delete iPreAlloc; + iPreAlloc = NULL; } - EXPORT_C void RNodeInterface::PostMessage(const TRuntimeCtxId& aPostFrom, const TNodeId::TRemainder& aPostTo, const TSignalBase& aMessage) const { TUint8 postTo[__Align8(TRuntimeCtxId::KMaxInlineAddressSize)]; @@ -149,6 +163,40 @@ return RecipientId() == aRHS.RecipientId(); } +EXPORT_C void RNodeInterface::PreAllocL(TUint aAllocSize) +/** Pre-allocates memory and stores the pointer and its size +@param size of memory space to prealloc +*/ + { + if(iPreAlloc!=NULL) + // Memory already allocated for this client + { + __ASSERT_DEBUG(iPreAlloc->iPreAllocatedActivityChunk != NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 5)); + return; + } + iPreAlloc = new (ELeave) TPreAllocStore(); + iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aAllocSize); + iPreAlloc->iPreAllocSize = aAllocSize; + } + +EXPORT_C TAny* RNodeInterface::ClaimPreallocatedSpace(TUint aSize) +/** Finds a pointer of the requested size from the preallocation array (see PreallocActivitySpaceL) and returns it +@param size of memory space requested +@return pointer to memory allocation or NULL if no preallocation and allocation here fails +*/ + { + if(!(iPreAlloc && aSize <= iPreAlloc->iPreAllocSize)) + { + // By this stage the PreAllocL must have been triggered and memory space must have been allocated. + __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ElemNodeMessIntC, 3)); + delete iPreAlloc->iPreAllocatedActivityChunk; + iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aSize); + } + TAny* preallocatedSpace = (RNodeInterface*)iPreAlloc->iPreAllocatedActivityChunk; + iPreAlloc->iPreAllocatedActivityChunk=NULL; + return preallocatedSpace; + } + /****************************************************************************************************** * * @@ -204,7 +252,7 @@ EXPORT_C void RRequestOriginator::Open(RRequestOriginator& aOriginalRequest) { - __ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 1)); + __ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 4)); iNode = aOriginalRequest.iNode; iRemainder = aOriginalRequest.iRemainder; aOriginalRequest.Close(); diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/svg/parse.ini --- a/commsfwtools/commstools/svg/parse.ini Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/svg/parse.ini Tue May 25 14:00:39 2010 +0300 @@ -119,6 +119,11 @@ TPolicyCheckRequest iParams.iProcessId_Lo iParams.iThreadId_Lo iParams.iPlatSecResult ReJoinDataClientRequest iNodeId1.iPtr:node iNodeId2.iPtr:node SubSess iValue +SimpleSelect iSelectionPrefs.iSelectionParams iSelectionPrefs.iSubSessionUniqueId +TApiExtMsgDispatcher iResponseMsg.iMessage.iHandle:x iClientId +TOpenExtensionInterface iMessage.iHandle:x iClientId iInterfaceId +TDataMonitoringNotification iValue1 iValue2 +TConnFlowRequest iSubSessionUniqueId:x iFlowParams.iAddrFamily iFlowParams.iProtocol iFlowParams.iSocketType iFlowParams.iFlowRequestType iSession:x iHandle:x [ObjectNameTruncateAndOrder] # Note: the order that entries appear in this section is important as string substitutions occur in the order specified TransportFlowShim TranFlowShim 2 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/svg/parselog.pl --- a/commsfwtools/commstools/svg/parselog.pl Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/svg/parselog.pl Tue May 25 14:00:39 2010 +0300 @@ -38,12 +38,13 @@ # 4 include ESOCK session creation # 8 display activity name along with each tuple line (e.g. "(IpCprNoBearer) (CoreNetStates::TSendBindTo, CoreNetStates::TAwaitingBindToComplete)") # 16 display AddClient/RemoveClient operations +# -o Write HTML and SVG output files into directory use strict; require 'getopts.pl'; -my $version = "2.1 (24/02/09)"; +my $version = "2.2 (16/04/10)"; # # Internal Options @@ -53,12 +54,13 @@ my $globalIndex = 1; my $lifeStage = 0; # 0 = not running or shutting down, 1 = during boot, 2 = main phase +my $outputPath = ""; # path to output directory specified by "-o" +our($opt_p,$opt_s,$opt_x,$opt_X, $opt_o); -our($opt_p,$opt_s,$opt_x,$opt_X); +Getopts("ps:x:X:o:"); -Getopts("ps:x:X:"); - +$outputPath = processPathArgument($opt_o); ### to get 1st line of latest log: type log.txt | perl -e "while(<>){if(/^#Logging started/){$a=$.;print $a.' '}};print $a" @@ -83,7 +85,8 @@ use constant ArgumentSignedDecimal => 0; use constant ArgumentNode => 1; -my %argumentFormatToConstant = ( "node" => ArgumentNode ); # used to have several other options +use constant ArgumentHex => 2; +my %argumentFormatToConstant = ( "node" => ArgumentNode, "x" => ArgumentHex ); # used to have several other options my %arguments; # Support for AddClient/RemoveClient @@ -317,13 +320,14 @@ } elsif (($opt_s & 2) && (/CWorkerSubSession\(.{8}\):\s*CompleteMessage\((.{8})\) with (.+), session .{8}/ || + /~CESockClientActivityBase..{8}.\s*RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || + /RSafeMessage\(.{8}\)::Complete\((.{8})\) with ([-\d]+)/)) + { # /ProcessMessageL, session=.{8}, RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || - /~CESockClientActivityBase..{8}.\s*RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || - /RSafeMessage\((.{8})\)::Complete\((\d+)\) - session .{8}/)) - { # W6: CPlayer: ProcessMessageL, session=0be839a8, RMessage2::Complete (00de5538) with 0. # W0: CWorkerSubSession(0c941bc4): CompleteMessage(00de1a6c) with -3, session 0be839a8. # W6: ~CESockClientActivityBase=0c941f8c, RMessage2::Complete (00de5538) with 0. + # RSafeMessage(00e01590)::Complete(cd21cb80) with -36 my $msgAddr = $1; my $ret = $2; @@ -792,7 +796,11 @@ if ($value =~ m/^0x/) { $value = hex($value); } - $buf .= sprintf "%d", $value; + if ($format == ArgumentHex) { + $buf .= sprintf "0x%x", $value; + } else { + $buf .= sprintf "%d", $value; + } } else { $buf .= $value; } @@ -934,12 +942,19 @@ my ($exeName) = @_; $exeName =~ s/\.exe$//; $exeName =~ s/\.EXE$//; + $exeName =~ s/ /_/g; return $exeName; } sub outputSymbols() { - open SYM, ">logsym.html" || die "Cannot open logsym.html for writing\n"; + # Should have already created $outputPath directory, create html/ subdirectory. + my $path = $outputPath . "html"; + if (! -d $path) { + mkdir $path; + } + $path .= "/logsym.html"; + open SYM, ">$path" || die "Cannot open $path for writing\n"; print SYM "\n\n"; my @keys = sort keys %symtab; for my $i (@keys) { @@ -1145,4 +1160,32 @@ if (defined $activityName{$actAddr}) { delete $activityName{$actAddr}; } -} \ No newline at end of file +} + +sub processPathArgument($) +{ + my $path = $_[0]; + if ($path) { + # ensure "/" at the end + if ($path !~ /\/$/) { + $path .= "/"; + } + mkdirp($path); + return $path; + } else { + return ""; + } +} + +sub mkdirp($) +{ + my $dirName = @_[0]; + if ($dirName =~ m/^(.*)\//i) { + if ($1 ne "") { + mkdirp($1); + } + } + if (! -d $dirName) { + mkdir($dirName); + } +} diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/svg/parseseq.pl --- a/commsfwtools/commstools/svg/parseseq.pl Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/svg/parseseq.pl Tue May 25 14:00:39 2010 +0300 @@ -56,8 +56,10 @@ my $version = "2.2 (27/02/08)"; -getopts("MHpx:N:A:vVr:R:hnf"); -our($opt_M, $opt_H, $opt_p, $opt_x, $opt_N, $opt_A, $opt_v, $opt_V, $opt_r, $opt_R, $opt_h, $opt_n, $opt_f); +getopts("MHpx:N:A:vVr:R:hnfo:"); +our($opt_M, $opt_H, $opt_p, $opt_x, $opt_N, $opt_A, $opt_v, $opt_V, $opt_r, $opt_R, $opt_h, $opt_n, $opt_f, $opt_o); + +my $outputPath = processPathArgument($opt_o); if ($opt_h) { @@ -122,8 +124,10 @@ [6] AgentSCPr :: AgentSCprStart Select activity to draw: ... - - -h This help message + +-o Place all output files into /html/ directory (including log.html). + +-h This help message HELP exit (0); } @@ -307,6 +311,7 @@ my $rowsPerView = int(($rowsToDisplay + $viewsToDisplay - 1) / $viewsToDisplay); my $viewNumber = 0; createViewMap(); + createIpcMap(); while ($beginRow < $totalRows) { $endRow = $beginRow + $rowsPerView - 1; if ($endRow >= $totalRows) { @@ -318,6 +323,7 @@ $beginRow = $endRow + 1; } closeViewMap($viewNumber); + closeIpcMap($viewNumber); } print "\n" if ($opt_V); @@ -353,19 +359,22 @@ $fileName .= $viewNumber; } - open SVG, ">html/${fileName}.svg" || die "Cannot open html/${fileName}.svg for writing\n"; + my $path = $outputPath . "html/${fileName}.svg"; + open SVG, ">$path" || die "Cannot open $path for writing\n"; #open RTTTL, ">html/${fileName}.rtttlpre" || die "Cannot open html/${fileName}.rttlpre for writing\n"; outputDocHeader($screenWidth, $screenHeight); - drawObjectNames(0); updateObjectViewList($viewNumber); drawObjectLifelines($beginRow, $endRow, $screenHeight); + drawObjectNames(0); drawActivities($beginRow, $endRow, $screenHeight, $viewNumber); my @labelsOnPage = (); my @objectsDestroyed = (); my @objectsCreated = (); - drawSequences($beginRow, $endRow, 1, \@labelsOnPage, \@objectsCreated, \@objectsDestroyed); + my @ipc = (); + drawSequences($beginRow, $endRow, 1, \@labelsOnPage, \@objectsCreated, \@objectsDestroyed, \@ipc); outputViewMap($viewNumber, $lastViewNumber, \@labelsOnPage, \@objectsCreated, \@objectsDestroyed); + outputIpcMap($viewNumber, $lastViewNumber, \@ipc); outputDocFooter(); close SVG; @@ -379,9 +388,11 @@ resetForNextView(); } -sub createSubDir() { - if (! -d html) { - mkdir "html" || die "Cannot create 'html' subdirectory\n"; +sub createSubDir() +{ + my $path = $outputPath . "html"; + if (! -d $path) { + mkdir $path || die "Cannot create $path subdirectory\n"; } } sub resetForNextView() { @@ -946,11 +957,12 @@ { if ($i->{Order} == 0) { - $colour = ""; + $colour = "!"; } else { $colour = (($i->{Order} % 2) == 0) ? $objectNameColour1 : $objectNameColour2; + $colour = "!" . $colour; } } my $name = $i->{Name}; @@ -967,10 +979,11 @@ } else { - outputText($i->{X}, $name, $currentY, "middle", $colour, qq{id="$name" onclick="debugEvent(evt)"}); + my $stagger = ($i->{colno} & 1); + outputText($i->{X}, $name, $currentY + ($stagger * $incrementY), "middle", $colour, qq{id="$name" onclick="debugEvent(evt)"}); } } - incrementY(); + incrementY(2); } # @@ -1137,7 +1150,7 @@ sub drawSequences($$$$$$) { - my ($startRow, $endRow, $drawFlag, $labelsOnPageRef, $objectsCreatedRef, $objectsDestroyedRef) = @_; + my ($startRow, $endRow, $drawFlag, $labelsOnPageRef, $objectsCreatedRef, $objectsDestroyedRef, $ipcRef) = @_; my $nextLabel = ""; # startRow/endRow = start/end row of displayed area (inclusive) @@ -1150,7 +1163,6 @@ my $drawDone = 0; my $inRange = 0; my $lastPopupText = ""; # text of last "pn" action - foreach my $ref (@sequences) { my $action = $ref->{Action}; @@ -1169,7 +1181,8 @@ $colour .= "rgb($1)"; $text = $2; } - my $attrs = generatePopupAttrs(\$lastPopupText, qq{id="$ref->{Object}->{Name}"}); + my $name = $ref->{Object}->{Name}; + my $attrs = generatePopupAttrs(\$lastPopupText, qq{id="$name"}); outputText($objX + $lifelineTextLeftMargin, $text, $currentY, "begin", $colour, $attrs); $drawDone = 1; # support for putting threads into the view map @@ -1181,6 +1194,9 @@ push @{$objectsDestroyedRef}, $1; } } + if ($name =~ s/^!//) { + push @{$ipcRef}, $ref; + } } else { fakeUpCreationDeletionIfRequired($ref->{Object}, $absoluteRow); } @@ -1384,16 +1400,16 @@ $inRange = IsInRangeInclusive($absoluteRow, $startRow, $endRow); if ($inRange) { - # drawObjectNames() increments Y once, and we increment Y once for - # spacing, so we occupy two rows here. - $rows += 2; + # drawObjectNames() increments Y twice (for stagger), and we increment Y once for + # spacing, so we occupy three rows here. + $rows += 3; if ($drawFlag == 1) { drawObjectNames(1); incrementY(); } } - $absoluteRow += 2; + $absoluteRow += 3; # 2 + 1 for stagger } } return $rows; @@ -1699,7 +1715,8 @@ sub createViewMap() { - open MAP, ">logmap.html" || die "Cannot open logmap.html for writing\n"; + my $path = $outputPath . "html/logmap.html"; + open MAP, ">$path" || die "Cannot open $path for writing\n"; print MAP "\n\n"; # Begin page label/time table @@ -1830,6 +1847,84 @@ } } +sub createIpcMap() +{ + my $path = $outputPath . "html/ipcmap.html"; + open IPC, ">$path" || die "Cannot open $path for writing\n"; + print IPC "\n"; + print IPC qq{\n"; + + # Begin page label/time table + print IPC qq { \n }; + print IPC qq { \n }; +} + +sub closeIpcMap() +{ + print IPC "
PageEXEs...
\n"; + close IPC; +} + +my @IpcExeColumns = (); + +sub addToArrayUniquely($$) +{ + my ($arrRef, $element) = @_; + foreach my $i ( @{$arrRef} ) { + if ($i eq $element) { + return; + } + } + push @{$arrRef}, $element; +} + +sub outputIpcMap($$$) +{ + my ($viewNumber, $lastViewNumber, $ipcRef) = @_; + my %ipcExeUsed = (); + my $exe; + my $ipc; + foreach $ipc (@{$ipcRef}) { + $exe = $ipc->{Object}->{Name}; + addToArrayUniquely(\@IpcExeColumns, $exe); + $ipcExeUsed{$exe} = 1; + } + + # Page number in first column (two rows) + #my $style = qq{style="text-align: left; font-family: courier new; white-space: nowrap ; font-size: smaller"}; + print IPC qq {$viewNumber\n}; + + # Second and subsequent columns showing the exe names + foreach $exe ( @IpcExeColumns ) { + my $exe2 = $exe; # why do things go wrong if I operate directly on $exe??? + $exe2 =~ s/^!//; + if (!defined($ipcExeUsed{$exe})) { + print IPC qq{$exe2}; + } else { + print IPC qq{$exe2}; + } + } + + # next row + print IPC qq{\n}; + # for each exe there is column... + my $rr; + foreach $rr ( @IpcExeColumns ) { + print IPC qq{}; + # ...showing the IPCs + foreach my $ref ( @{$ipcRef} ) { + if ($ref->{Object}->{Name} eq $rr) { + print IPC qq{$ref->{Text}
}; + } else { + print IPC qq{
}; + } + } + print IPC qq{}; + } + print IPC qq {\n}; +} # # Output the "0 1 2 3 4 ..." anchors representing the different views @@ -1850,6 +1945,34 @@ } } +sub processPathArgument($) +{ + my $path = $_[0]; + if ($path) { + # ensure "/" at the end + if ($path !~ /\/$/) { + $path .= "/"; + } + mkdirp($path); + return $path; + } else { + return ""; + } +} + +sub mkdirp($) +{ + my $dirName = @_[0]; + if ($dirName =~ m/^(.*)\//i) { + if ($1 ne "") { + mkdirp($1); + } + } + if (! -d $dirName) { + mkdir($dirName); + } +} + sub outputHTMLEmbedder($$$$$) { my ($width, $height, $viewNumber, $lastViewNumber, $fileName) = @_; @@ -1874,7 +1997,8 @@ $svgPathInHtmlFile = "html/" . $fileName; $mainPath = ""; } - open HTML, ">${htmlPath}.html" || die "Cannot open ${htmlPath}.html for writing\n"; + my $path = $outputPath . $htmlPath . ".html"; + open HTML, ">$path" || die "Cannot open $path for writing\n"; if (! $opt_f) { # DOCTYPE needed for "position: fixed" to work in IE @@ -1917,6 +2041,7 @@ print HTML qq{\n}; print HTML qq{\n}; print HTML qq{\n}; + print HTML qq{\n}; print HTML qq{ Zoom%\n\n}; if ($opt_f) { @@ -2010,16 +2135,20 @@ // function popupSymbols() { - symbols = window.open(mainPath + "logsym.html", "_blank", "width=400,resizable=yes,scrollbars=yes"); + symbols = window.open(mainPath + "html/logsym.html", "_blank", "width=400,resizable=yes,scrollbars=yes"); } function popupRelations() { - relations = window.open(mainPath + "relations.html", "_blank", "resizable=yes,scrollbars=yes,status=yes"); + relations = window.open(mainPath + "html/relations.html", "_blank", "resizable=yes,scrollbars=yes,status=yes"); relationsDefined = 1; } function popupMap() { - relations = window.open(mainPath + "logmap.html", "_blank", "resizable=yes,scrollbars=yes,status=yes"); + relations = window.open(mainPath + "html/logmap.html", "_blank", "resizable=yes,scrollbars=yes,status=yes"); +} + +function popupIpcMap() { + relations = window.open(mainPath + "html/ipcmap.html", "_blank", "resizable=yes,scrollbars=yes,status=yes"); } // diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/svg/relations.pl --- a/commsfwtools/commstools/svg/relations.pl Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/svg/relations.pl Tue May 25 14:00:39 2010 +0300 @@ -154,9 +154,12 @@ my $tabToFontAdjustTopY = 2; my $tabToFontAdjustBottomY = 1; my $tabLineLengthY = 5; +my $outputPath = ""; # output path as specified by "-o " argument +our($opt_x,$opt_v,$opt_V, $opt_o); +Getopts("x:vVo:"); -our($opt_x,$opt_v,$opt_V); -Getopts("x:vV"); +$outputPath = processPathArgument($opt_o); + readRelationshipFile(); print "Reading sequences\n" if ($opt_V); @@ -225,9 +228,15 @@ outputRelationsHTMLEmbedder($width, $height); sub createOutputFile() - { - open SVG, ">relations.svg" || die "Cannot open relations.svg for writing\n"; +{ + # Have already created the directory $outputPath, just create the "html" subdirectory + my $path = $outputPath . "html"; + if (! -d $path) { + mkdir $path; } + $path .= "/relations.svg"; + open SVG, ">$path" || die "Cannot open $path for writing\n"; +} sub closeOutputFile() { @@ -835,7 +844,9 @@ sub outputRelationsHTMLEmbedder($$) { my ($width,$height) = @_; - open HTML, ">relations.html" || die "Cannot open relations.html for writing\n"; + # Should have already created $outputPath/html directory. + my $path = $outputPath . "html/relations.html"; + open HTML, ">$path" || die "Cannot open $path for writing\n"; print HTML qq{\n\n}; print HTML qq{\n}; print HTML qq{\n}; @@ -875,7 +886,13 @@ # sub outputAnimateHTML() { - open HTML, ">animate.html" || die "Cannot open animate.html for writing\n"; + # Should have already created $outputPath directory, create html/ subdirectory. + my $path = $outputPath . "html"; + if (! -d $path) { + mkdir $path; + } + $path .= "/animate.html"; + open HTML, ">$path" || die "Cannot open $path for writing\n"; ################################# # Begin Interpolated Text... # ################################# @@ -2096,3 +2113,31 @@ { print SVG ");\n\n"; } + +sub processPathArgument($) +{ + my $path = $_[0]; + if ($path) { + # ensure "/" at the end + if ($path !~ /\/$/) { + $path .= "/"; + } + mkdirp($path); + return $path; + } else { + return ""; + } +} + +sub mkdirp($) +{ + my $dirName = @_[0]; + if ($dirName =~ m/^(.*)\//i) { + if ($1 ne "") { + mkdirp($1); + } + } + if (! -d $dirName) { + mkdir($dirName); + } +} diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/utracedecoder/data/esockmessages.definition.txt --- a/commsfwtools/commstools/utracedecoder/data/esockmessages.definition.txt Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/utracedecoder/data/esockmessages.definition.txt Tue May 25 14:00:39 2010 +0300 @@ -58,6 +58,7 @@ ImplicitFlow = 112 ConnectionFlow = 113 SubConnectionFlow = 114 + ActivityDestroyOrphans = 115 GetParamLength = 116 GetParam = 117 ActivitySubConnectionCreate = 118 @@ -405,27 +406,28 @@ // EGetOrSetParameters = 100 EMCprGetConnectionSetting = 101 - ECprRetrieveProgress = 102 - ECprRetrieveLastProgressError = 103 -// ECprRequestServiceNotification = 104 + ECprRetrieveProgress = 201 + ECprRetrieveLastProgressError = 202 +// ECprRequestServiceNotification = 203 -// ECprSendIoctl = 105 -// ECprAllSubConnectionNotificationEnable = 106 -// ECprEnumerateConnections = 107 +// ECprSendIoctl = 204 +// ECprAllSubConnectionNotificationEnable = 205 +// ECprEnumerateConnections = 206 -// ELegacyDataMonitoringTransferredRequest = 108 - ELegacyDataMonitoringNotificationRequest = 109 + ELegacyDataMonitoringTransferredRequest = 207 + ELegacyDataMonitoringNotificationRequest = 208 - ELegacySubConnectionActiveRequest = 110 + ELegacySubConnectionActiveRequest = 209 - ELegacyEnumerateSubConnections = 111 + ELegacyEnumerateSubConnections = 210 - ELegacyControlMessage = 112 - ELegacyConnEnumMessage = 113 + ELegacyControlMessage = 211 + ELegacyConnEnumMessage = 212 - ESignatureRMessage2Response = 114 + ESignatureRMessage2Response = 213 - ELegacyGetSubConnectionInfo = 115 + ELegacyGetSubConnectionInfo = 214 + END ENUM ENUM TDataMonitoringDirection : UINT32 @@ -438,6 +440,16 @@ RMessage2 iMessage END SIGNATURE +SIGNATURE TLegacyDataMonitoringTransferredRequest : TCFSigLegacyRMessage2Ext + TYPEID = KTCFLegacyMessageRealmId:ELegacyDataMonitoringTransferredRequest + UINT32 iClientId +END SIGNATURE + +MESSAGE LegacyDataMonitoringTransferredRequest + SIGNATURE = TLegacyDataMonitoringTransferredRequest + MESSAGEID = KTCFLegacyMessageRealmId:ELegacyDataMonitoringTransferredRequest +END MESSAGE + SIGNATURE TLegacyDataMonitoringNotificationRequest : TCFSigLegacyRMessage2Ext TYPEID = KTCFLegacyMessageRealmId:ELegacyDataMonitoringNotificationRequest TDataMonitoringDirection iDirection @@ -519,6 +531,17 @@ MESSAGEID = KTCFLegacyMessageRealmId:EMCprGetConnectionSetting END MESSAGE +SIGNATURE TLegacyConnectionEnumRequest : TSignalBase + TYPEID = KTCFLegacyMessageRealmId:ELegacyConnEnumMessage + UINT32 iSCPRCandidates + UINT32 iClientType +END SIGNATURE + +MESSAGE LegacyConnectionEnumRequest + SIGNATURE = TLegacyConnectionEnumRequest + MESSAGEID = KTCFLegacyMessageRealmId:ELegacyConnEnumMessage +END MESSAGE + SIGNATURE TLegacyControlMessage : TCFSigLegacyRMessage2Ext TYPEID = KTCFLegacyMessageRealmId:ELegacyControlMessage END SIGNATURE @@ -530,6 +553,7 @@ SIGNATURE TLegacyGetSubConnectionInfo : TCFSigLegacyRMessage2Ext TYPEID = KTCFLegacyMessageRealmId:ELegacyGetSubConnectionInfo + UINT32 iClientId // TSubSessionUniqueId TSubConnectionInfo iSubConnectionInfo END SIGNATURE @@ -544,6 +568,7 @@ ECFSubConnDataTransferred = 94 EStateChange = 95 ECFTransportNotification = 100 + ECFDestroyOrphans = 102 END ENUM MESSAGE SubConnDataTransferred @@ -561,6 +586,11 @@ MESSAGEID = KTCFMessageRealmId:ECFTransportNotification END MESSAGE +MESSAGE DestroyOrphans + SIGNATURE = TSigVoid + MESSAGEID = KTCFMessageRealmId:ECFDestroyOrphans +END MESSAGE + // ss_nodemessages_availability_control_client.h CONST KAvailablityControlClientRealmId = 0x10285F3D ENUM AvailCC_MessageId : UINT16 @@ -604,6 +634,7 @@ CONST KControlClientRealmId = 0x10285F3F ENUM ControlClient_MessageID : UINT16 ECFGoneDown = 1 + ECFGoneUp = 2 END ENUM MESSAGE GoneDown @@ -611,6 +642,11 @@ MESSAGEID = KControlClientRealmId:ECFGoneDown END MESSAGE +MESSAGE TGoneUp + SIGNATURE = TSigVoid + MESSAGEID = KControlClientRealmId:ECFGoneUp +END MESSAGE + // ss_nodemessages_controlprovider.h CONST KControlProviderRealmId = 0x10285F40 ENUM ControlProvider_MessageID : UINT16 @@ -1217,3 +1253,32 @@ SIGNATURE = TSigNumberNumber MESSAGEID = TCFDataMonitoringNotificationRealmId:ECFDataMonitoringNotification END MESSAGE + +// ss_apiext_messages.h + +CONST KExtItfMsgImplementationUid = 0x102822F7 + +ENUM EExtItfMessageId : UINT32 + EApiExtMsgDispatcher = 0 + EOpenExtensionInterface = 1 + ECloseExtensionInterface = 2 + ECancelAndCloseAllClientExtItf = 3 +END ENUM + +SIGNATURE TApiExtMsgDispatcher : TSignalBase + TYPEID = KExtItfMsgImplementationUid:EApiExtMsgDispatcher + UINT32 iClientId + RResponseMsg iResponseMsg +END SIGNATURE + +SIGNATURE TOpenExtensionInterface : TCFSigRMessage2Ext + TYPEID = KExtItfMsgImplementationUid:EOpenExtensionInterface + UINT32 iClientId + UINT32 iInterfaceId +END SIGNATURE + +SIGNATURE TCancelAndCloseAllClientExtItf : TSignalBase + TYPEID = KExtItfMsgImplementationUid:ECancelAndCloseAllClientExtItf + UINT32 iClientId +END SIGNATURE + diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/utracedecoder/data/ipmessages.definition.txt --- a/commsfwtools/commstools/utracedecoder/data/ipmessages.definition.txt Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/utracedecoder/data/ipmessages.definition.txt Tue May 25 14:00:39 2010 +0300 @@ -71,7 +71,7 @@ ECprGetConnectionSetting = 10 - ELegacyDataMonitoringTransferredRequest = 11 +// ELegacyDataMonitoringTransferredRequest = 11 // ELegacyDataMonitoringNotificationRequest = 12 ELegacyDataMonitoringNotificationCancel = 13 @@ -146,16 +146,6 @@ MESSAGEID = KESockCprLinkExtMessages:ECprEnumerateConnections END MESSAGE -SIGNATURE TLegacyDataMonitoringTransferredRequest : TCFSigRMessage2Ext - TYPEID = KESockCprLinkExtMessages:ELegacyDataMonitoringTransferredRequest - UINT32 iClientId -END SIGNATURE - -MESSAGE LegacyDataMonitoringTransferredRequest - SIGNATURE = TLegacyDataMonitoringTransferredRequest - MESSAGEID = KESockCprLinkExtMessages:ELegacyDataMonitoringTransferredRequest -END MESSAGE - MESSAGE LegacyDataMonitoringNotificationRequest SIGNATURE = TLegacyDataMonitoringNotificationRequest MESSAGEID = KESockCprLinkExtMessages:ELegacyDataMonitoringNotificationRequest @@ -186,19 +176,6 @@ MESSAGEID = KESockCprLinkExtMessages:ELegacyCancelSubConnectionActive END MESSAGE -// - -CONST KExtItfMsgImplementationUid = 0x102822F7 - -ENUM EExtItfMessageId : UINT32 - ECancelAndCloseAllClientExtItf = 3 -END ENUM - -SIGNATURE TCancelAndCloseAllClientExtItf : TSignalBase - TYPEID = KExtItfMsgImplementationUid:ECancelAndCloseAllClientExtItf - UINT32 iClientId -END SIGNATURE - CONST KQoSIpSCprMessagesRealmId = 0x10204307 ENUM EQoSIpSCprMessagesId : UINT32 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwtools/commstools/utracedecoder/data/nodemessages.definition.txt --- a/commsfwtools/commstools/utracedecoder/data/nodemessages.definition.txt Tue May 11 17:20:19 2010 +0300 +++ b/commsfwtools/commstools/utracedecoder/data/nodemessages.definition.txt Tue May 25 14:00:39 2010 +0300 @@ -452,5 +452,11 @@ // MESSAGEID = KPeerRealmId:EJoinRequest //END MESSAGE +STRUCT RResponseMsg + RMessage2 iMessage + PAD 24 // iInterfaceId + UINT8 iRequestMsgParam + UINT8 iResponseMsgParam + PAD 2 +END STRUCT - diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp --- a/commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp Tue May 25 14:00:39 2010 +0300 @@ -61,6 +61,8 @@ { return EFail; } + TBool forceSmallBuf = EFalse; + bRet = GetIntFromConfig(_L("MBufMgrTest06"), _L("ForceSmallBuf"), forceSmallBuf); Log(_L(" ------- Chain & Desc LENGTH = %d --"), aLength); Log(_L(" ------- OFFSET where to Split = %d --"), aOffset); if ( (aLength > 1000) ||(aLength <0) || @@ -79,7 +81,36 @@ Log(_L(" 01 Creating CMBufManager and installing active scheduler:")); CleanupStack::PushL( iActSch = new(ELeave) CActiveScheduler ); CActiveScheduler::Install(iActSch); - CreateInstanceMBufMgrL(KMBufDefaultHeapSize); + + enum { KBigBuf = 256, KSmallBuf = 128 }; + if(forceSmallBuf) + { + RArray createInfoArray; + + TCommsBufPoolCreateInfo createInfo; + createInfo.iBufSize = KSmallBuf; + createInfo.iInitialBufs = 128; + createInfo.iGrowByBufs = 64; + createInfo.iMinFreeBufs = 40; + createInfo.iCeiling = 410; + createInfoArray.AppendL(createInfo); + + createInfo.iBufSize = KBigBuf; + createInfo.iInitialBufs = 3; + createInfo.iGrowByBufs = 1; + createInfo.iMinFreeBufs = 1; + createInfo.iCeiling = 3; + createInfoArray.AppendL(createInfo); + + CreateInstanceMBufMgrL(createInfoArray); + + createInfoArray.Close(); + } + else + { + CreateInstanceMBufMgrL(KMBufDefaultHeapSize); + } + CleanupClosePushL(iBufPond); //-------------- substep 2 -------------------- @@ -111,6 +142,18 @@ #endif User::Leave(EFail); } + + if(forceSmallBuf) + { + for(RMBuf* buf = aChain1.First(); buf; buf = buf->Next()) + { + if(buf->Size() != KBigBuf) + { + Log(_L("-- initial chain should be composed of %d buf, found %d buf"), KBigBuf, buf->Size()); + User::Leave(EFail); + } + } + } //-------------- substep 6 -------------------- Log(_L(" 06 Copy in Des1 into Chain1:")); @@ -158,6 +201,16 @@ #endif User::Leave(EFail); } + + if(forceSmallBuf) + { + if(!aChain2.First() || aChain2.First()->Size() != KSmallBuf || + !aChain2.First()->Next() || aChain2.First()->Next()->Size() != KSmallBuf) + { + Log(_L("-- split chain should start with two %d buf"), KSmallBuf); + User::Leave(EFail); + } + } //-------------- substep 9 -------------------- Log(_L(" 09 Copy out Chain1 into Des2:")); @@ -184,7 +237,7 @@ //-------------- substep 12 -------------------- Log(_L(" 12 Copy out the whole Chain2 into Des2 at offset = OFFSET")); TPtr8 dest((TUint8*)aDes2->Ptr() + aOffset, aLength-aOffset, aLength - aOffset); - aChain1.CopyOut(dest); + aChain2.CopyOut(dest); //-------------- substep 13 -------------------- Log(_L(" 13 Compare the content of Des1 & Des2:")); diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini --- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini Tue May 25 14:00:39 2010 +0300 @@ -1,3 +1,4 @@ [MBufMgrTest06] Length=100 Offset=60 +ForceSmallBuf=0 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini --- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini Tue May 25 14:00:39 2010 +0300 @@ -1,3 +1,4 @@ [MBufMgrTest06] Length=200 Offset=129 +ForceSmallBuf=0 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini --- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini Tue May 25 14:00:39 2010 +0300 @@ -1,3 +1,4 @@ [MBufMgrTest06] Length=300 Offset=160 +ForceSmallBuf=0 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script --- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script Tue May 25 14:00:39 2010 +0300 @@ -125,6 +125,17 @@ PRINT END_TESTCASE COMINF-MBUFMGR-0602 +START_TESTCASE COMINF-MBUFMGR-0603 +//! @SYMTestCaseID COMINF-MBUFMGR-0603 +PRINT Test 06: Split a chain of big bufs when only small reamaining +HANDLES_MARK +RUN_TEST_STEP 10000, TS_CTMBufMgr, MBufMgrTest06 ,z:\testdata\configs\MBufTest06-4th.ini +TEST_COMPLETE +HANDLES_CHECK +PRINT ------------------------------ +PRINT +END_TESTCASE COMINF-MBUFMGR-0603 + START_TESTCASE COMINF-MBUFMGR-0700 //! @SYMTestCaseID COMINF-MBUFMGR-0700 PRINT Test 07: TrimStart the chain on the first and only RMBuf diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest06-4th.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest06-4th.ini Tue May 25 14:00:39 2010 +0300 @@ -0,0 +1,4 @@ +[MBufMgrTest06] +Length=700 +Offset=260 +ForceSmallBuf=1 diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/group/bld.inf --- a/commsfwutils/commsbufs/group/bld.inf Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/group/bld.inf Tue May 25 14:00:39 2010 +0300 @@ -59,44 +59,26 @@ PRJ_TESTEXPORTS //MBuf ComponentTest scripts & configs -../TS_mbufmgr/scriptfiles/mbuftest.script /epoc32/release/wins/udeb/z/testdata/scripts/mbuftest.script -../TS_mbufmgr/scriptfiles/mbuftest.script /epoc32/release/winscw/udeb/z/testdata/scripts/mbuftest.script -../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest05-copyin.ini -../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest05-copyin.ini -../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest05-copyout.ini -../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest05-copyout.ini -../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-2nd.ini -../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-3rd.ini -../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-4th.ini -../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-4th.ini -../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-5th.ini -../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-5th.ini -../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest10-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest10-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest13-1st.ini -../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest13-1st.ini +../TS_mbufmgr/scriptfiles/mbuftest.script z:/testdata/scripts/mbuftest.script +../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini z:/testdata/configs/mbuftest05-copyin.ini +../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini z:/testdata/configs/mbuftest05-copyout.ini +../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini z:/testdata/configs/mbuftest06-1st.ini +../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini z:/testdata/configs/mbuftest06-2nd.ini +../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini z:/testdata/configs/mbuftest06-3rd.ini +../TS_mbufmgr/scriptfiles/MBufTest06-4th.ini z:/testdata/configs/mbuftest06-4th.ini +../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini z:/testdata/configs/mbuftest07-1st.ini +../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini z:/testdata/configs/mbuftest07-2nd.ini +../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini z:/testdata/configs/mbuftest07-3rd.ini +../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini z:/testdata/configs/mbuftest08-1st.ini +../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini z:/testdata/configs/mbuftest08-2nd.ini +../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini z:/testdata/configs/mbuftest08-3rd.ini +../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini z:/testdata/configs/mbuftest09-1st.ini +../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini z:/testdata/configs/mbuftest09-2nd.ini +../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini z:/testdata/configs/mbuftest09-3rd.ini +../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini z:/testdata/configs/mbuftest09-4th.ini +../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini z:/testdata/configs/mbuftest09-5th.ini +../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini z:/testdata/configs/mbuftest10-1st.ini +../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini z:/testdata/configs/mbuftest13-1st.ini testmbuf.iby /epoc32/rom/include/testmbuf.iby PRJ_MMPFILES diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/group/testmbuf.iby --- a/commsfwutils/commsbufs/group/testmbuf.iby Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/group/testmbuf.iby Tue May 25 14:00:39 2010 +0300 @@ -22,25 +22,26 @@ #include file=ABI_DIR\DEBUG_DIR\TS_CTMBUFMGR.DLL \System\libs\TS_CTMBUFMGR.DLL -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script \testdata\scripts\mbuftest.script -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script \testdata\scripts\mbuftest_zc.script -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyIn.ini \testdata\configs\MBufTest05-CopyIn.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyOut.ini \testdata\configs\MBufTest05-CopyOut.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-1st.ini \testdata\configs\MBufTest06-1st.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-2nd.ini \testdata\configs\MBufTest06-2nd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-3rd.ini \testdata\configs\MBufTest06-3rd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-1st.ini \testdata\configs\MBufTest07-1st.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-2nd.ini \testdata\configs\MBufTest07-2nd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-3rd.ini \testdata\configs\MBufTest07-3rd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-1st.ini \testdata\configs\MBufTest08-1st.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-2nd.ini \testdata\configs\MBufTest08-2nd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-3rd.ini \testdata\configs\MBufTest08-3rd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-1st.ini \testdata\configs\MBufTest09-1st.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-2nd.ini \testdata\configs\MBufTest09-2nd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-3rd.ini \testdata\configs\MBufTest09-3rd.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-4th.ini \testdata\configs\MBufTest09-4th.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-5th.ini \testdata\configs\MBufTest09-5th.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest10-1st.ini \testdata\configs\MBufTest10-1st.ini -data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest13-1st.ini \testdata\configs\MBufTest13-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\scripts\mbuftest.script \testdata\scripts\mbuftest.script +data=EPOCROOT##epoc32\data\z\TestData\scripts\mbuftest.script \testdata\scripts\mbuftest_zc.script +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest05-CopyIn.ini \testdata\configs\MBufTest05-CopyIn.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest05-CopyOut.ini \testdata\configs\MBufTest05-CopyOut.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-1st.ini \testdata\configs\MBufTest06-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-2nd.ini \testdata\configs\MBufTest06-2nd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-3rd.ini \testdata\configs\MBufTest06-3rd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-4th.ini \testdata\configs\MBufTest06-4th.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-1st.ini \testdata\configs\MBufTest07-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-2nd.ini \testdata\configs\MBufTest07-2nd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-3rd.ini \testdata\configs\MBufTest07-3rd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-1st.ini \testdata\configs\MBufTest08-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-2nd.ini \testdata\configs\MBufTest08-2nd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-3rd.ini \testdata\configs\MBufTest08-3rd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-1st.ini \testdata\configs\MBufTest09-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-2nd.ini \testdata\configs\MBufTest09-2nd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-3rd.ini \testdata\configs\MBufTest09-3rd.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-4th.ini \testdata\configs\MBufTest09-4th.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-5th.ini \testdata\configs\MBufTest09-5th.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest10-1st.ini \testdata\configs\MBufTest10-1st.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest13-1st.ini \testdata\configs\MBufTest13-1st.ini #endif diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h --- a/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h Tue May 25 14:00:39 2010 +0300 @@ -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__ diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h --- a/commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h Tue May 25 14:00:39 2010 +0300 @@ -46,7 +46,6 @@ */ { public: - IMPORT_C RMBufCell(RMBufCell* aPktHdr); IMPORT_C static TAny* operator new(TUint aSize, TLeave aLeave, TUint aExtra); IMPORT_C static TAny* operator new(TUint aSize, TUint aExtra) __NO_THROW; IMPORT_C static void operator delete(TAny*); diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp --- a/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp Tue May 25 14:00:39 2010 +0300 @@ -272,7 +272,23 @@ len = Min(aLen, len); } - TInt err = newChain.Alloc(len + aHdrReserve, *this); +// Suppress the "follow-the-leader" behaviour of preserving the buffer sizing of the +// existing chain. The goal of preserving buffer characteristics remains desirable but +// not at the cost of having TCP use unnecessarily small buffers - this area needs +// rework once the Comms stack really adopts buffer pools and zero copy +// TInt err = newChain.Alloc(len + aHdrReserve, *this); + TInt err; + if(First()) + { + newChain.iNext = First()->Pool()->Pond().Alloc(len + aHdrReserve, 0, KMaxTInt); + err = iNext ? KErrNone : KErrNoMBufs; + } + else + { + RMBufAllocator allocator; + err = newChain.Alloc(aLen + aHdrReserve, allocator); + } + if(err != KErrNone) { return err; @@ -532,10 +548,10 @@ @param newChain The result chain */ { - User::LeaveIfError(RCommsBufChain::Split(anOffset, newChain)); + User::LeaveIfError(Split(anOffset, newChain)); } -EXPORT_C TInt RMBufChain::Split(TInt anOffset, RMBufChain& newChain) +EXPORT_C TInt RMBufChain::Split(TInt aOffset, RMBufChain& aNewChain) /** Split a chain into two new chains Original chain gets the 1st half newChain gets the other half. @@ -544,8 +560,63 @@ @param newChain The result chain */ { - return RCommsBufChain::Split(anOffset, newChain); - } + // RCommsBuf::Split() will not allocate a smaller buffer size than the current, as part of its approach of (trying to) + // support zero-copy transfer by respecting the buffer pool in use. This work is incomplete (needs support throughout + // the stack and probably a cleverer idea of what constitutes an acceptable buffer than simply size), so in the meantime + // having MBufMgr reflect this behaviour by refusing to Split() a big buf into smaller bufs is unnecessarily purist. + // Hence the functionality is implemented directly here + + __ASSERT_ALWAYS(iNext!=NULL, CommsBuf::Panic(EMBuf_EmptyChain)); + __ASSERT_ALWAYS(aOffset>=0, CommsBuf::Panic(EMBuf_NegativeOffset)); + + // For testing post-conditions +#ifdef _DEBUG + TInt origLen = Length(); +#endif + TInt splitBufOffset; + TInt splitBufRemainder; + RMBuf* splitBuf; + RMBuf* splitBufPrev; + + if(!Goto(aOffset, splitBuf, splitBufOffset, splitBufRemainder, splitBufPrev)) + { + aNewChain.Init(); + return KErrNone; + } + + if(splitBufOffset != splitBuf->Offset()) // Not on an mbuf boundary + { + // Copy tail of splitBuf out to a new chain (hopefully a single buf, but needn't be) + TInt splitDataOffset = splitBufOffset - splitBuf->Offset(); + TInt err = RMBufChain(splitBuf).Copy(aNewChain, splitDataOffset, splitBufRemainder); + if(err != KErrNone) + { + return err; + } + splitBuf->AdjustDataEnd(-splitBufRemainder); + RMBufChain splitTail(splitBuf->Next()); + aNewChain.Append(splitTail); + splitBuf->SetNext(NULL); + } + else + { + // Split cleaves chain between bufs + aNewChain = splitBuf; + if(splitBufPrev) + { + splitBufPrev->Unlink(); + } + } + + // Check post-conditions +#ifdef _DEBUG + TInt frag1Len = Length(); + TInt frag2Len = aNewChain.Length(); + ASSERT(origLen == frag1Len + frag2Len); + ASSERT(frag1Len == aOffset); +#endif + return KErrNone; + } // overloading for TLS EXPORT_C TInt RMBufChain::Split(TInt anOffset, RMBufChain& newChain, RMBufAllocator& /* aRMBufAllocator */) diff -r 9ddb1d67ebaf -r 9644881fedd0 commsfwutils/commsbufs/src/commsbufasyncrequest.cpp --- a/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp Tue May 11 17:20:19 2010 +0300 +++ b/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp Tue May 25 14:00:39 2010 +0300 @@ -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); } diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF --- a/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF Tue May 25 14:00:39 2010 +0300 @@ -193,7 +193,7 @@ ?TransitionTag@TAddClientOrUpdatePriority@CControlClientJoinActivity@CprControlClientJoinActivity@@UAEHXZ @ 192 NONAME ; int CprControlClientJoinActivity::CControlClientJoinActivity::TAddClientOrUpdatePriority::TransitionTag(void) ?DoL@TSendLeaveCompleteIfRequest@CClientLeaveActivity@CprClientLeaveActivity@@UAEXXZ @ 193 NONAME ; void CprClientLeaveActivity::CClientLeaveActivity::TSendLeaveCompleteIfRequest::DoL(void) ?DoL@TAddControlClient@CprStates@@UAEXXZ @ 194 NONAME ; void CprStates::TAddControlClient::DoL(void) - ?NewL@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVAMMNodeBase@4@@Z @ 195 NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::NewL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &) + ?New@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVTNodeContextBase@4@@Z @ 195 NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::New(struct MeshMachine::TNodeActivity const &, class MeshMachine::TNodeContextBase &) ??1CControlClientJoinActivity@CprControlClientJoinActivity@@UAE@XZ @ 196 NONAME ; CprControlClientJoinActivity::CControlClientJoinActivity::~CControlClientJoinActivity(void) ?GetVTablePtr@TProcessDataClientRejoin@MCprStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 197 NONAME ; class NetStateMachine::MStateTransition * MCprStates::TProcessDataClientRejoin::GetVTablePtr(class TDesC8 &, void *) ??0CContentionManager@@QAE@ABVCTierManagerBase@ESock@@@Z @ 198 NONAME ; CContentionManager::CContentionManager(class ESock::CTierManagerBase const &) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF --- a/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF Tue May 25 14:00:39 2010 +0300 @@ -413,7 +413,7 @@ _ZN22CprClientLeaveActivity20CClientLeaveActivity21TSaveLeaveMessageData3DoLEv @ 412 NONAME _ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest12GetVTablePtrER6TDesC8Pv @ 413 NONAME _ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest3DoLEv @ 414 NONAME - _ZN22CprClientLeaveActivity20CClientLeaveActivity4NewLERKN11MeshMachine13TNodeActivityERNS1_11AMMNodeBaseE @ 415 NONAME + _ZN22CprClientLeaveActivity20CClientLeaveActivity3NewERKN11MeshMachine13TNodeActivityERNS1_16TNodeContextBaseE @ 415 NONAME _ZN22CprClientLeaveActivity20CClientLeaveActivityD0Ev @ 416 NONAME _ZN22CprClientLeaveActivity20CClientLeaveActivityD1Ev @ 417 NONAME _ZN22CprClientLeaveActivity20CClientLeaveActivityD2Ev @ 418 NONAME diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h --- a/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h Tue May 25 14:00:39 2010 +0300 @@ -165,7 +165,7 @@ class CClientLeaveActivity : public CprPriorityUpdateActivity::CPriorityUpdateActivity { public: - IMPORT_C static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode); + IMPORT_C static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext); IMPORT_C virtual ~CClientLeaveActivity(); public: diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp --- a/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp Tue May 25 14:00:39 2010 +0300 @@ -43,7 +43,16 @@ using namespace MeshMachine; using namespace Messages; - +//-========================================================= +// +//Panics +// +//-========================================================= +_LIT (KCoreCPRActivityPanic,"CoreCPRActivityPanic"); +enum + { + EPanicNoPrealloc = 1 + }; //-========================================================= // @@ -202,8 +211,8 @@ namespace CprClientLeaveActivity { -DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TNodeSignal::TNullMessageId, CClientLeaveActivity::NewL) - FIRST_NODEACTIVITY_ENTRY(CoreStates::TAwaitingClientLeave, MeshMachine::TNoTag) +DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TCFServiceProvider::TLeaveRequest, CClientLeaveActivity::New) + FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState, MeshMachine::TNoTag) THROUGH_NODEACTIVITY_ENTRY(KNoTag, CClientLeaveActivity::TRemoveClientAndDestroyOrphanedDataClients, CClientLeaveActivity::TNoTagOrSendPriorityToCtrlProvider) NODEACTIVITY_ENTRY(CprStates::KSendPriorityToCtrlProvider, CClientLeaveActivity::TUpdatePriorityForControlProvider, CoreStates::TAwaitingJoinComplete, CClientLeaveActivity::TNoTagOrSendPriorityToServProvider) NODEACTIVITY_ENTRY(CprStates::KSendPriorityToServProvider, CClientLeaveActivity::TUpdatePriorityForServiceProviders, CoreStates::TAwaitingJoinComplete, MeshMachine::TNoTag) @@ -286,10 +295,16 @@ namespace CprClientLeaveActivity { -EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode ) +EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::New( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext ) { - TUint c = GetNextActivityCountL(aActivitySig,aNode); - return new(ELeave)CClientLeaveActivity(aActivitySig, aNode, c); + TUint c = GetNextActivityCount(aActivitySig,aContext.Node()); + + // Instantiate using memory preallocated and stored in the RCFNodeInterface + TAny* preallocatedSpace = aContext.iPeer->ClaimPreallocatedSpace(sizeof(CClientLeaveActivity)); + __ASSERT_ALWAYS(preallocatedSpace != NULL,User::Panic(KCoreCPRActivityPanic,EPanicNoPrealloc)); + + CClientLeaveActivity* self = new(preallocatedSpace)CClientLeaveActivity(aActivitySig, aContext.Node(), c); + return self; } CClientLeaveActivity::CClientLeaveActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aActivitiesCount) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/CoreProviders/src/corescpr.cpp --- a/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp Tue May 25 14:00:39 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). + // Copyright (c) 2006-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" @@ -41,9 +41,9 @@ //We reserve space for two preallocated activities that may start concurrently on the SCPR //node: destroy and data client stop. -static const TUint KDefaultMaxPreallocatedActivityCount = 2; +static const TUint KSCPRDefaultMaxPreallocatedActivityCount = 2; static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); -static const TUint KSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; +static const TUint KSCPRPreallocatedActivityBufferSize = KSCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; EXPORT_C CCoreSubConnectionProvider::CCoreSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def --- a/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def Tue May 25 14:00:39 2010 +0300 @@ -52,15 +52,14 @@ _ZThn140_N27CMobilityConnectionProviderD0Ev @ 51 NONAME ABSENT _ZThn140_N27CMobilityConnectionProviderD1Ev @ 52 NONAME ABSENT _ZThn20_N27CMobilityConnectionProvider9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 53 NONAME - _ZThn152_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME - _ZThn152_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME - _ZThn152_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME - _ZThn152_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME - _ZThn152_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME - _ZThn152_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME - _ZThn152_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME - _ZThn152_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME - _ZThn152_N27CMobilityConnectionProviderD0Ev @ 62 NONAME - _ZThn152_N27CMobilityConnectionProviderD1Ev @ 63 NONAME + _ZThn156_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME + _ZThn156_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME + _ZThn156_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME + _ZThn156_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME + _ZThn156_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME + _ZThn156_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME + _ZThn156_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME + _ZThn156_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME + _ZThn156_N27CMobilityConnectionProviderD0Ev @ 62 NONAME + _ZThn156_N27CMobilityConnectionProviderD1Ev @ 63 NONAME - diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp --- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp Tue May 25 14:00:39 2010 +0300 @@ -48,9 +48,9 @@ //We reserve space for two preallocated activities that may start concurrently on the CPR //node: destroy and data client stop. -static const TUint KDefaultMaxPreallocatedActivityCount = 2; +static const TUint KMobilityCPRDefaultMaxPreallocatedActivityCount = 2; static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); -static const TUint KMobilityCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; +static const TUint KMobilityCPRPreallocatedActivityBufferSize = KMobilityCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; //-========================================================= // diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp --- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp Tue May 25 14:00:39 2010 +0300 @@ -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()); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/bwins/esocksvrU.DEF --- a/datacommsserver/esockserver/bwins/esocksvrU.DEF Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF Tue May 25 14:00:39 2010 +0300 @@ -1053,4 +1053,5 @@ ??0TTierTypeIdFactoryQuery@ESock@@QAE@XZ @ 1052 NONAME ; ESock::TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery(void) ?Match@TTierTypeIdFactoryQuery@ESock@@MAE?AW4TMatchResult@MFactoryQuery@Factories@@AAUTFactoryObjectInfo@5@@Z @ 1053 NONAME ; enum Factories::MFactoryQuery::TMatchResult ESock::TTierTypeIdFactoryQuery::Match(struct Factories::TFactoryObjectInfo &) ?GetVDataTableStatic@TTierTypeIdFactoryQuery@ESock@@SAPBUSVDataTableEntry@Meta@@XZ @ 1054 NONAME ; struct Meta::SVDataTableEntry const * ESock::TTierTypeIdFactoryQuery::GetVDataTableStatic(void) + ?AddClientL@CMMCommsProviderBase@ESock@@UAEPAVRNodeInterface@Messages@@ABVTNodeId@4@ABVTClientType@4@PAX@Z @ 1055 NONAME ; class Messages::RNodeInterface * ESock::CMMCommsProviderBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/core_states/ss_corepractivities.cpp --- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Tue May 25 14:00:39 2010 +0300 @@ -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( + /*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( + /*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) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/core_states/ss_coreprstates.h --- a/datacommsserver/esockserver/core_states/ss_coreprstates.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/core_states/ss_coreprstates.h Tue May 25 14:00:39 2010 +0300 @@ -402,7 +402,7 @@ DECLARE_SMELEMENT_FOOTER( TAwaitingBinderRequest ) EXPORT_DECLARE_SMELEMENT_HEADER( TAwaitingStop, MeshMachine::TState, NetStateMachine::MState, TContext ) - IMPORT_C virtual TBool Accept(); + IMPORT_C virtual TBool Accept(); DECLARE_SMELEMENT_FOOTER( TAwaitingStop ) EXPORT_DECLARE_SMELEMENT_HEADER( TAwaitingProviderStatusChangeOrDataClientStatusChange, MeshMachine::TState, NetStateMachine::MState, TContext ) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/eabi/esocksvrU.DEF --- a/datacommsserver/esockserver/eabi/esocksvrU.DEF Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF Tue May 25 14:00:39 2010 +0300 @@ -1031,7 +1031,7 @@ _ZN5ESock25RCFParameterFamilyBundleC4OpenEv @ 1030 NONAME _ZN17CConnDataTransfer31DataReceivedNotificationRequestEjj @ 1031 NONAME _ZThn20_N5ESock22CSubConnectionFlowBase26FetchNodeInterfaceControlLEi @ 1032 NONAME - _ZThn136_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME + _ZThn140_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME _ZN5ESock30TDefaultConnectionFactoryQuery19GetVDataTableStaticEv @ 1034 NONAME _ZN5ESock30TDefaultConnectionFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1035 NONAME _ZN5ESock30TDefaultConnectionFactoryQueryC1ERKN8Messages7TNodeIdE @ 1036 NONAME @@ -1959,4 +1959,6 @@ _ZTIN5ESock23TTierTypeIdFactoryQueryE @ 1958 NONAME _ZTVN5ESock23TTierTypeIdFactoryQueryE @ 1959 NONAME _ZThn4_N5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1960 NONAME + _ZN5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1961 NONAME + _ZThn36_N5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1962 NONAME diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/inc/ss_mmcommsprov.h --- a/datacommsserver/esockserver/inc/ss_mmcommsprov.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/inc/ss_mmcommsprov.h Tue May 25 14:00:39 2010 +0300 @@ -71,10 +71,13 @@ friend class IpCprStates::TSendParamsToSelf; friend class IpCprStates::TUpdateNetMCPR; friend class PRStates::TRespondWithRetrievedParams; - + public: typedef ITFHIERARCHY_LINK_1(CMMCommsProviderBase, MeshMachine::AMMNodeBase, MAccessPointConfigApi) TIfStaticFetcherNearestInHierarchy; IMPORT_C void ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface); + + IMPORT_C virtual Messages::RNodeInterface* AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo = NULL); + void DestroyOrphanedDataClients(); IMPORT_C void SetParametersL(const RCFParameterFamilyBundleC& aParameterBundle); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/ssock/ss_connstates.cpp --- a/datacommsserver/esockserver/ssock/ss_connstates.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp Tue May 25 14:00:39 2010 +0300 @@ -259,7 +259,8 @@ __ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider)); TCFDataClient::TBindTo& bt = message_cast(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(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(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(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()); } diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp --- a/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Tue May 25 14:00:39 2010 +0300 @@ -19,7 +19,8 @@ #include "ss_mmcommsprov.h" #include -#include +#include +#include #include "ss_nodemessages_internal.h" #include "ss_internal_activities.h" @@ -32,6 +33,10 @@ using namespace ESock; using namespace Messages; +//We reserve space for two preallocated activities that may start concurrently on the connection +//node: destroy (connection close) and connection stop. +static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); + CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap) : ACommsFactoryNodeId(aFactory), @@ -112,6 +117,23 @@ aInterface = this; } +EXPORT_C RNodeInterface* CMMCommsProviderBase::AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo) + { + RNodeInterface* nodeInterface = ANodeBase::AddClientL(aClientId, aClientType, aClientInfo); + + if(aClientType.Type() == TCFClientType::ECtrl) + { + TRAPD(err, nodeInterface->PreAllocL(KMaxPreallocatedActivitySize)); + if(err!=KErrNone) + { + RemoveClient(nodeInterface->RecipientId()); + User::Leave(err); + } + } + + return nodeInterface; + } + void CMMCommsProviderBase::DestroyOrphanedDataClients() { // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_008.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_008.ini Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_009.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_009.ini Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_ip.tcpip.esk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_ip.tcpip.esk Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg --- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby --- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Tue May 25 14:00:39 2010 +0300 @@ -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__ diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf --- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Tue May 25 14:00:39 2010 +0300 @@ -28,6 +28,10 @@ ../scripts/te_dummyprovider_004.script z:/testdata/scripts/te_dummyprovider_004.script ../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_009.script z:/testdata/scripts/te_dummyprovider_009.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 @@ -37,4 +41,8 @@ ../configs/te_dummyprovider_004.ini z:/testdata/configs/te_dummyprovider_004.ini ../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_009.ini z:/testdata/configs/te_dummyprovider_009.ini +../configs/TE_DummyProvider_ip.tcpip.esk z:/testdata/configs/TE_DummyProvider_ip.tcpip.esk + +../configs/te_dummyprovider_008.ini z:/testdata/configs/te_dummyprovider_008.ini diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script --- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_008.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_008.script Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_009.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_009.script Tue May 25 14:00:39 2010 +0300 @@ -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 + diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Tue May 25 14:00:39 2010 +0300 @@ -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); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h Tue May 25 14:00:39 2010 +0300 @@ -25,7 +25,7 @@ #include #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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Tue May 25 14:00:39 2010 +0300 @@ -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) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp Tue May 25 14:00:39 2010 +0300 @@ -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); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Tue May 25 14:00:39 2010 +0300 @@ -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) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini --- a/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp --- a/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Tue May 25 14:00:39 2010 +0300 @@ -26,7 +26,7 @@ #include #include - +#include #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, NetStateMachine::MState, DummyCPRStates::TContext ) + virtual TBool Accept(); +DECLARE_SMELEMENT_FOOTER( TAwaitingDestroy ) + +DECLARE_SMELEMENT_HEADER( TThreeSecDelayAndPostToSelf, MeshMachine::TStateTransition, NetStateMachine::MStateTransition, DummyCPRStates::TContext ) + virtual void DoL(); +DECLARE_SMELEMENT_FOOTER( TThreeSecDelayAndPostToSelf ) } // namespace DummyCPRStates diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h Tue May 25 14:00:39 2010 +0300 @@ -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); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h Tue May 25 14:00:39 2010 +0300 @@ -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 +#include +#include +#include + +#include +#include + + +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__ + diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Tue May 25 14:00:39 2010 +0300 @@ -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) diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h Tue May 25 14:00:39 2010 +0300 @@ -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); diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h Tue May 25 14:00:39 2010 +0300 @@ -158,6 +158,64 @@ virtual TBool Accept(); DECLARE_SMELEMENT_FOOTER( TAwaitingBrokenStart ) +DECLARE_SMELEMENT_HEADER( TRebindSelf, MeshMachine::TStateTransition, 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::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, NetStateMachine::MStateTransition, DummySCPRStates::TContext ) + virtual void DoL(); +DECLARE_SMELEMENT_FOOTER( TCancelPreviousSelfRequest ) + +class CrazyIdle : public MeshMachine::CNodeRetryActivity + { +public: + DECLARE_SMELEMENT_HEADER( TAwaitingCancelled, MeshMachine::TState, 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__ diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Tue May 25 14:00:39 2010 +0300 @@ -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( + iContext.Node().AccessPointConfig().FindExtension(TLayerSelectionInfo::TypeId())); + ASSERT(selectionInfo); // should always be there + + if (iContext.iMessage.IsMessage() && + 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(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, MeshMachine::TTag) + 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 { diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp Tue May 25 14:00:39 2010 +0300 @@ -30,6 +30,7 @@ #include "dummypr_metaconnprov.h" #include "dummypr_tiermanager.h" #include "dummypr_network_flow.h" +#include "dummypr_flow.h" #include @@ -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(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(aQuery); return CDummyNetworkFlow::NewL(*this, query.iSCprId, aProtocolIntf); } -ACommsFactoryNodeId* CDummyNetworkFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery) +ACommsFactoryNodeId* CDummyFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery) { const TDefaultFlowFactoryQuery& query = static_cast(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: diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/src/dummypr_flow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_flow.cpp Tue May 25 14:00:39 2010 +0300 @@ -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 +#include +#include +#include +#include +#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(*(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() ) + { + ASSERT(EFalse); //To be implemented + } + else if ( aMessage.IsMessage() ) + { + } + else if (aMessage.IsMessage()) + { + } + 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(aMessage).iValue).CRef()); + break; + case TCFDataClient::TProvisionConfig::EId: + break; + case TCFDataClient::TBindTo::EId: + { + TCFDataClient::TBindTo& bindToMsg(static_cast(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(this), &aBindTo.iNodeId.Node()) ) + + const TNodeId& commsId = aBindTo.iNodeId; + +#if defined(__GCCXML__) + CSubConnectionFlowBase* flow = reinterpret_cast(&commsId.Node()); +#else + CSubConnectionFlowBase* flow = Messages::mnode_cast(&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); + } + } + + + diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp Tue May 25 14:00:39 2010 +0300 @@ -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 diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Tue May 25 14:00:39 2010 +0300 @@ -93,8 +93,46 @@ return (iContext.iMessage.IsMessage() && 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()) + { + 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 @@ + + diff -r 9ddb1d67ebaf -r 9644881fedd0 datacommsserver/networkingdialogapi/inc/AgentDialog.h --- a/datacommsserver/networkingdialogapi/inc/AgentDialog.h Tue May 11 17:20:19 2010 +0300 +++ b/datacommsserver/networkingdialogapi/inc/AgentDialog.h Tue May 25 14:00:39 2010 +0300 @@ -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: