//****************************************************************************** // RCF - Remote Call Framework // Copyright (c) 2005 - 2007. All rights reserved. // Consult your license for conditions of use. // Developed by Jarl Lindrud. // Contact: jlindrud@hotmail.com . //****************************************************************************** #ifndef INCLUDE_RCF_RCFSESSION_HPP #define INCLUDE_RCF_RCFSESSION_HPP #include #include #include #include #include #include #include #include namespace RCF { class Filter; typedef boost::shared_ptr FilterPtr; class RcfSession; typedef boost::shared_ptr RcfSessionPtr; class RcfSession : public I_Session { public: RcfSession(); ~RcfSession(); typedef boost::function1 OnWriteCompletedCallback; typedef boost::function1 OnWriteInitiatedCallback; typedef boost::function1 OnDestroyCallback; //******************************* // callback tables - synchronized // may well be called on a different thread than the one that executed the remote call void addOnWriteCompletedCallback( const OnWriteCompletedCallback &onWriteCompletedCallback); void extractOnWriteCompletedCallbacks( std::vector &onWriteCompletedCallbacks); // called on same thread that executed the remote call void addOnWriteInitiatedCallback( const OnWriteInitiatedCallback &onWriteInitiatedCallback); void extractOnWriteInitiatedCallbacks( std::vector &onWriteInitiatedCallbacks); void setOnDestroyCallback(OnDestroyCallback onDestroyCallback); //******************************* const RCF::I_RemoteAddress &getRemoteAddress(); bool hasDefaultServerStub(); StubEntryPtr getDefaultStubEntryPtr(); void setDefaultStubEntryPtr(const StubEntryPtr &stubEntryPtr); void setCachedStubEntryPtr(const StubEntryPtr &stubEntryPtr); // protocol-opaque serialization SerializationProtocolIn mIn; SerializationProtocolOut mOut; // payload filters std::vector mFilters; bool mFiltered; /// Enables pointer tracking for outbound SF serialization on this session. /// \parameter Whether to enable or not. void enableSfSerializationPointerTracking(bool enable); MethodInvocationRequest mRequest; int getRcfRuntimeVersion(); void setRcfRuntimeVersion(int version); void setUserData(boost::any userData); boost::any getUserData(); private: StubEntryPtr mDefaultStubEntryPtr; StubEntryPtr mCachedStubEntryPtr; Mutex mMutex; std::vector mOnWriteCompletedCallbacks; std::vector mOnWriteInitiatedCallbacks; OnDestroyCallback mOnDestroyCallback; int mRcfRuntimeVersion; boost::any mUserData; public: Mutex mStopCallInProgressMutex; bool mStopCallInProgress; public: const std::vector &getMessageFilters(); const std::vector &getTransportFilters(); }; } // namespace RCF #endif // ! INCLUDE_RCF_RCFSESSION_HPP