19 #ifndef INCLUDE_RCF_METHODINVOCATION_HPP
20 #define INCLUDE_RCF_METHODINVOCATION_HPP
25 #include <boost/shared_ptr.hpp>
27 #include <RCF/Filter.hpp>
28 #include <RCF/ByteBuffer.hpp>
29 #include <RCF/Export.hpp>
30 #include <RCF/Exception.hpp>
31 #include <RCF/SerializationProtocol_Base.hpp>
32 #include <RCF/Token.hpp>
39 typedef boost::shared_ptr<StubEntry> StubEntryPtr;
41 typedef boost::shared_ptr<RcfSession> RcfSessionPtr;
42 class SerializationProtocolIn;
43 class SerializationProtocolOut;
45 class MethodInvocationResponse;
46 class MethodInvocationRequest;
49 static const int Descriptor_Error = 0;
50 static const int Descriptor_Request = 1;
51 static const int Descriptor_Response = 2;
52 static const int Descriptor_FilteredPayload = 3;
54 void encodeServerError(RcfServer & server, ByteBuffer & byteBuffer,
int error);
55 void encodeServerError(RcfServer & server, ByteBuffer & byteBuffer,
int error,
int arg0,
int arg1);
59 class RemoteCallRequest
63 RemoteCallRequest(
const MethodInvocationRequest & req);
65 std::string mServantBindingName;
66 std::string mInterfaceName;
69 SerializationProtocol mSerializationProtocol;
72 boost::uint32_t mPingBackIntervalMs;
73 bool mUseNativeWstringSerialization;
74 bool mEnableSfPointerTracking;
78 class RCF_EXPORT MethodInvocationRequest : boost::noncopyable
81 MethodInvocationRequest();
87 const MethodInvocationRequest & rhs);
91 const std::string & service,
92 const std::string & subInterface,
94 SerializationProtocol serializationProtocol,
95 MarshalingProtocol marshalingProtocol,
99 bool ignoreRuntimeVersion,
100 boost::uint32_t pingBackIntervalMs,
102 bool useNativeWstringSerialization,
103 bool enableSfPointerTracking);
105 Token getToken()
const;
106 const std::string & getSubInterface()
const;
108 bool getOneway()
const;
109 bool getClose()
const;
110 const std::string & getService()
const;
111 void setService(
const std::string &service);
112 int getPingBackIntervalMs();
114 ByteBuffer encodeRequestHeader();
117 const std::vector<ByteBuffer> & buffers,
118 std::vector<ByteBuffer> & message,
119 const std::vector<FilterPtr> & filters);
122 const ByteBuffer & message,
123 ByteBuffer & messageBody,
124 RcfSessionPtr rcfSessionPtr,
125 RcfServer & rcfServer);
128 const RemoteException * pRe,
130 bool enableSfPointerTracking);
133 const ByteBuffer & message,
135 MethodInvocationResponse & response,
136 const std::vector<FilterPtr> & filters);
138 StubEntryPtr locateStubEntryPtr(
139 RcfServer & rcfServer);
143 friend class RcfSession;
144 friend class ClientStub;
145 friend class RemoteCallRequest;
147 void decodeFromMessage(
148 const ByteBuffer & message,
150 RcfServer * pRcfServer,
151 RcfSessionPtr rcfSessionPtr,
152 const std::vector<FilterPtr> & existingFilters);
154 void encodeToMessage(
155 std::vector<ByteBuffer> & message,
156 const std::vector<ByteBuffer> & buffers,
157 const std::vector<FilterPtr> & filters);
160 std::string mSubInterface;
162 SerializationProtocol mSerializationProtocol;
163 MarshalingProtocol mMarshalingProtocol;
166 std::string mService;
167 boost::uint32_t mRuntimeVersion;
168 bool mIgnoreRuntimeVersion;
169 int mPingBackIntervalMs;
170 boost::uint32_t mArchiveVersion;
171 ByteBuffer mRequestUserData;
172 ByteBuffer mResponseUserData;
173 bool mUseNativeWstringSerialization;
174 bool mEnableSfPointerTracking;
176 boost::shared_ptr<std::vector<char> > mVecPtr;
179 friend std::ostream& operator<<(std::ostream& os,
const MethodInvocationRequest& r)
182 << NAMEVALUE(r.mToken)
183 << NAMEVALUE(r.mSubInterface)
184 << NAMEVALUE(r.mFnId)
185 << NAMEVALUE(r.mSerializationProtocol)
186 << NAMEVALUE(r.mMarshalingProtocol)
187 << NAMEVALUE(r.mOneway)
188 << NAMEVALUE(r.mClose)
189 << NAMEVALUE(r.mService)
190 << NAMEVALUE(r.mRuntimeVersion)
191 << NAMEVALUE(r.mPingBackIntervalMs)
192 << NAMEVALUE(r.mArchiveVersion);
198 class RCF_EXPORT MethodInvocationResponse
201 MethodInvocationResponse();
203 bool isException()
const;
204 bool isError()
const;
205 int getError()
const;
208 bool getEnableSfPointerTracking()
const;
210 std::auto_ptr<RemoteException> getExceptionPtr();
213 friend class MethodInvocationRequest;
216 typedef std::auto_ptr<RemoteException> RemoteExceptionPtr;
219 RemoteExceptionPtr mExceptionPtr;
224 bool mEnableSfPointerTracking;
226 friend std::ostream& operator<<(std::ostream& os,
const MethodInvocationResponse& r)
228 os << NAMEVALUE(r.mException);
229 if (r.mExceptionPtr.get())
231 os << NAMEVALUE(*r.mExceptionPtr);
234 os << NAMEVALUE(r.mError);
237 os << NAMEVALUE(r.mErrorCode);
238 os << NAMEVALUE(r.mArg0);
239 os << NAMEVALUE(r.mArg1);
248 #endif // ! INCLUDE_RCF_METHODINVOCATION_HPP