18 #ifndef INCLUDE_RCF_CLIENTTRANSPORT_HPP 19 #define INCLUDE_RCF_CLIENTTRANSPORT_HPP 26 #include <RCF/AsioFwd.hpp> 27 #include <RCF/Export.hpp> 35 typedef std::shared_ptr<OverlappedAmi> OverlappedAmiPtr;
39 typedef std::weak_ptr<RcfSession> RcfSessionWeakPtr;
44 typedef std::shared_ptr<Filter> FilterPtr;
47 typedef std::shared_ptr<ClientProgress> ClientProgressPtr;
49 class RCF_EXPORT ClientTransportCallback
52 ClientTransportCallback() : mpAsyncDispatcher() {}
53 virtual ~ClientTransportCallback() {}
54 virtual void onConnectCompleted(
bool alreadyConnected =
false) = 0;
55 virtual void onSendCompleted() = 0;
56 virtual void onReceiveCompleted() = 0;
57 virtual void onTimerExpired() = 0;
58 virtual void onError(
const std::exception &e) = 0;
60 void setAsyncDispatcher(RcfServer & server);
61 RcfServer * getAsyncDispatcher();
63 virtual bool isClientStub()
const {
return false; }
66 RcfServer * mpAsyncDispatcher;
90 void setMaxIncomingMessageLength(std::size_t maxMessageLength);
93 std::size_t getMaxIncomingMessageLength()
const;
97 void setMaxOutgoingMessageLength(std::size_t maxMessageLength);
100 std::size_t getMaxOutgoingMessageLength()
const;
103 std::size_t getLastRequestSize();
106 std::size_t getLastResponseSize();
109 std::uint64_t getRunningTotalBytesSent();
112 std::uint64_t getRunningTotalBytesReceived();
115 void resetRunningTotals();
119 void setClientProgressPtr(ClientProgressPtr clientProgressPtr);
122 std::unique_ptr<ClientTransport> clone()
const = 0;
129 ClientTransportCallback & clientStub,
130 const std::vector<ByteBuffer> & data,
131 unsigned int timeoutMs) = 0;
135 ClientTransportCallback & clientStub,
137 unsigned int timeoutMs) = 0;
140 bool isConnected() = 0;
144 ClientTransportCallback & clientStub,
145 unsigned int timeoutMs) = 0;
149 unsigned int timeoutMs = 0) = 0;
152 void setTransportFilters(
153 const std::vector<FilterPtr> & filters) = 0;
156 void getTransportFilters(
157 std::vector<FilterPtr> & filters) = 0;
161 std::vector<FilterPtr> & filters);
163 RcfSessionWeakPtr getRcfSession();
164 void setRcfSession(RcfSessionWeakPtr rcfSessionWeakPtr);
166 void setAsync(
bool async);
168 virtual void cancel();
170 virtual void setTimer(
171 std::uint32_t timeoutMs,
172 ClientTransportCallback * pClientStub = NULL) = 0;
174 virtual void associateWithIoService(AsioIoService & ioService);
175 virtual bool isAssociatedWithIoService();
177 virtual bool supportsTransportFilters();
182 std::size_t mMaxMessageLength;
183 std::size_t mMaxOutgoingMessageLength;
184 RcfSessionWeakPtr mRcfSessionWeakPtr;
187 std::size_t mLastRequestSize;
188 std::size_t mLastResponseSize;
190 std::uint64_t mRunningTotalBytesSent;
191 std::uint64_t mRunningTotalBytesReceived;
193 ClientProgressPtr mClientProgressPtr;
203 #endif // ! INCLUDE_RCF_CLIENTTRANSPORT_HPP
Describes the status of a remote call while in progress. See RCF::ClientStub::setRemoteCallProgressCa...
Definition: ClientProgress.hpp:31
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:82
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:117
Base class for all client transports.
Definition: ClientTransport.hpp:74
Definition: ByteBuffer.hpp:39
Definition: AmiIoHandler.hpp:23
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:33