19 #ifndef INCLUDE_RCF_CLIENTTRANSPORT_HPP 20 #define INCLUDE_RCF_CLIENTTRANSPORT_HPP 27 #include <RCF/AsioFwd.hpp> 28 #include <RCF/Export.hpp> 36 typedef std::shared_ptr<OverlappedAmi> OverlappedAmiPtr;
40 typedef std::weak_ptr<RcfSession> RcfSessionWeakPtr;
45 typedef std::shared_ptr<Filter> FilterPtr;
48 typedef std::shared_ptr<ClientProgress> ClientProgressPtr;
50 class RCF_EXPORT ClientTransportCallback
53 ClientTransportCallback() : mpAsyncDispatcher() {}
54 virtual ~ClientTransportCallback() {}
55 virtual void onConnectCompleted(
bool alreadyConnected =
false) = 0;
56 virtual void onSendCompleted() = 0;
57 virtual void onReceiveCompleted() = 0;
58 virtual void onTimerExpired() = 0;
59 virtual void onError(
const std::exception &e) = 0;
61 void setAsyncDispatcher(RcfServer & server);
62 RcfServer * getAsyncDispatcher();
64 virtual bool isClientStub()
const {
return false; }
67 RcfServer * mpAsyncDispatcher;
91 void setMaxIncomingMessageLength(std::size_t maxMessageLength);
94 std::size_t getMaxIncomingMessageLength()
const;
98 void setMaxOutgoingMessageLength(std::size_t maxMessageLength);
101 std::size_t getMaxOutgoingMessageLength()
const;
104 std::size_t getLastRequestSize();
107 std::size_t getLastResponseSize();
110 std::uint64_t getRunningTotalBytesSent();
113 std::uint64_t getRunningTotalBytesReceived();
116 void resetRunningTotals();
120 void setClientProgressPtr(ClientProgressPtr clientProgressPtr);
123 std::unique_ptr<ClientTransport> clone()
const = 0;
130 ClientTransportCallback & clientStub,
131 const std::vector<ByteBuffer> & data,
132 unsigned int timeoutMs) = 0;
136 ClientTransportCallback & clientStub,
138 unsigned int timeoutMs) = 0;
141 bool isConnected() = 0;
145 ClientTransportCallback & clientStub,
146 unsigned int timeoutMs) = 0;
150 unsigned int timeoutMs = 0) = 0;
153 void setTransportFilters(
154 const std::vector<FilterPtr> & filters) = 0;
157 void getTransportFilters(
158 std::vector<FilterPtr> & filters) = 0;
162 std::vector<FilterPtr> & filters);
164 RcfSessionWeakPtr getRcfSession();
165 void setRcfSession(RcfSessionWeakPtr rcfSessionWeakPtr);
167 void setAsync(
bool async);
169 virtual void cancel();
171 virtual void setTimer(
172 std::uint32_t timeoutMs,
173 ClientTransportCallback * pClientStub = NULL) = 0;
175 virtual void associateWithIoService(AsioIoService & ioService);
176 virtual bool isAssociatedWithIoService();
178 virtual bool supportsTransportFilters();
183 std::size_t mMaxMessageLength;
184 std::size_t mMaxOutgoingMessageLength;
185 RcfSessionWeakPtr mRcfSessionWeakPtr;
188 std::size_t mLastRequestSize;
189 std::size_t mLastResponseSize;
191 std::uint64_t mRunningTotalBytesSent;
192 std::uint64_t mRunningTotalBytesReceived;
194 ClientProgressPtr mClientProgressPtr;
204 #endif // ! INCLUDE_RCF_CLIENTTRANSPORT_HPP
Describes the status of a remote call while in progress. See RCF::ClientStub::setRemoteCallProgressCa...
Definition: ClientProgress.hpp:32
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:83
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:118
Base class for all client transports.
Definition: ClientTransport.hpp:75
Definition: ByteBuffer.hpp:40
Definition: AmiIoHandler.hpp:24
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:34