24 #if defined(ONIXS_CONFLATEDTCP_HAS_GATEWAY_EMULATOR) 28 #include <OnixS/CME/ConflatedTCP/testing/ClientMessageListener.h> 34 namespace ConflatedTCP {
44 Message::blockLength(Message::Schema::Version)
46 + Message::getMinimalVariableFieldsSize(Message::Schema::Version);
67 Gateway(
int port,
const char* host =
"127.0.0.1",
const std::chrono::seconds& timeout = std::chrono::seconds(10));
93 Terminate203Ptr waitUntilTerminate(ClientMessageListener* listener =
nullptr);
100 int port()
const noexcept;
103 Gateway& enableLogger(
const std::string& logFileName);
106 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
110 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
114 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
118 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
124 template <
typename TMsg>
131 Gateway& run(ClientMessageListener& listener);
148 Gateway& tcpNoDelayOption(
bool noDelay);
154 bool tcpNoDelayOption()
const;
160 int socketReceiveBufferSize()
const;
166 Gateway& socketReceiveBufferSize(
int bufferSize);
172 int socketSendBufferSize()
const;
178 Gateway& socketSendBufferSize(
int bufferSize);
183 bool isConnectionClosed(
const std::chrono::seconds& timeout)
const;
188 bool isConnectionClosed()
const;
231 template <
typename TRequestMsg>
235 template <
typename TRequestMsg>
248 Gateway& sendData(
const void* data,
size_t size);
254 template<
typename MessageType>
255 void invokeCallback(
void(ClientMessageListener::*Callback)(
const MessageType &,
Gateway *), ClientMessageListener * listener,
const MessageBasePtr & msg)
258 (listener->*Callback)(cast<MessageType>(msg),
this);
265 template <
typename TRequestMsg>
271 .setReqId(request->reqId())
272 .setSubscriptionReqType(request->subscriptionReqType())
278 template <
typename TRequestMsg>
284 .setReqId(request->reqId())
290 template <
typename TMsg>
293 return cast<TMsg>(receive());
296 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
299 const auto messageSize = msg.
setHeader();
300 auto*
const header = msg.
header();
306 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
312 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
319 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
Gateway & send(ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg)
Sends the given message.
Requested subscription scope is fully acknowledged .
RequestReject207Container createRequestReject(const TRequestMsg &request)
Creates a RequestReject207 message.
MessageType & message() noexcept
RequestAck206Container createRequestAck(const TRequestMsg &request)
Creates a RequestAck206 message.
Messaging::UInt32 SeqNumber
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
#define ONIXS_CONFLATEDTCP_EXPORTED
Unexpected request, see Reason field for details.
CME Conflated TCP Gateway Emulator.
UInt64 uuid() const noexcept
constexpr UInt16 calculateNegotiationResponse202MaxSize()
#define ONIXS_CONFLATEDTCP_NODISCARD
MessageSize setHeader() noexcept
Calculates the binary size of the message and updates the Simple Open Framing Header accordingly...
const SimpleOpenFramingHeader * header() const noexcept
MessagePtr< TMsg > receiveTypedMessage()
Receives the message of the particular type.