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;
97 std::size_t getLastRequestSize();
100 std::size_t getLastResponseSize();
103 std::uint64_t getRunningTotalBytesSent();
106 std::uint64_t getRunningTotalBytesReceived();
109 void resetRunningTotals();
113 void setClientProgressPtr(ClientProgressPtr clientProgressPtr);
116 std::unique_ptr<ClientTransport> clone()
const = 0;
123 ClientTransportCallback & clientStub,
124 const std::vector<ByteBuffer> & data,
125 unsigned int timeoutMs) = 0;
129 ClientTransportCallback & clientStub,
131 unsigned int timeoutMs) = 0;
134 bool isConnected() = 0;
138 ClientTransportCallback & clientStub,
139 unsigned int timeoutMs) = 0;
143 unsigned int timeoutMs = 0) = 0;
146 void setTransportFilters(
147 const std::vector<FilterPtr> & filters) = 0;
150 void getTransportFilters(
151 std::vector<FilterPtr> & filters) = 0;
155 std::vector<FilterPtr> & filters);
157 RcfSessionWeakPtr getRcfSession();
158 void setRcfSession(RcfSessionWeakPtr rcfSessionWeakPtr);
160 void setAsync(
bool async);
162 virtual void cancel();
164 virtual void setTimer(
165 std::uint32_t timeoutMs,
166 ClientTransportCallback * pClientStub = NULL) = 0;
168 virtual void associateWithIoService(AsioIoService & ioService);
169 virtual bool isAssociatedWithIoService();
171 virtual bool supportsTransportFilters()
177 std::size_t mMaxMessageLength;
178 RcfSessionWeakPtr mRcfSessionWeakPtr;
181 std::size_t mLastRequestSize;
182 std::size_t mLastResponseSize;
184 std::uint64_t mRunningTotalBytesSent;
185 std::uint64_t mRunningTotalBytesReceived;
187 ClientProgressPtr mClientProgressPtr;
197 #endif // ! INCLUDE_RCF_CLIENTTRANSPORT_HPP
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:69
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:117
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