56 using Timeout = std::chrono::milliseconds;
94 std::atomic<
bool>* stopRequested =
nullptr);
114 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
119 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
124 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
129 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
134 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
139 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
146 template <typename TMsg>
284template <
typename TMsg>
290template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
293 const auto messageSize = msg.
setHeader();
294 auto*
const header = msg.
header();
300template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
306template <
typename Holder>
307typename std::enable_if<std::is_base_of<TagBased::Message, typename Holder::MessageType>::value>::type
310 throw std::runtime_error(
"");
314template <
typename Holder>
315typename std::enable_if<!std::is_base_of<TagBased::Message, typename Holder::MessageType>::value>::type
318 msg->sequenceId(num);
321template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
328template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
335template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
339 for(
auto seqNum : numbers)
347template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
351 for(
auto seqNum : numbers)
#define ONIXS_ICEBOE_NAMESPACE_BEGIN
#define ONIXS_ICEBOE_NAMESPACE_END
#define ONIXS_ICEBOE_EXPORTED
#define ONIXS_ICEBOE_NODISCARD
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
const SimpleOpenFramingHeader * header() const noexcept
MessageSize setHeader() noexcept
Calculates the binary size of the message and updates the Simple Open Framing Header accordingly.
std::vector< std::string > LicenseStores
Folders that contain license file(s).
Client's messages Listener.
Client's session messages Listener.
int socketReceiveBufferSize() const
int socketSendBufferSize() const noexcept
Gateway & acceptConnection(const Timeout &acceptTimeout=defaultTimeout())
Accepts an incoming connection.
Gateway(const SessionSettings::LicenseStores &licenseStores, int port, const char *host="127.0.0.1", const Timeout &acceptTimeout=defaultTimeout(), const Timeout &sendReceiveTimeout=defaultTimeout())
bool tryAcceptConnection(const Timeout &acceptTimeout=defaultTimeout())
Accepts an incoming connection.
MessageBasePtr receive() const
Receives a message.
static TraderLogoutReportContainer createTraderLogoutReport(StrRef traderId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Creates a TraderLogoutReport message.
Gateway(const Gateway &)=delete
Deleted.
std::chrono::milliseconds Timeout
Timeout alias.
Gateway & send(Messaging::SbeMessage, Messaging::SimpleOpenFramingHeader &)
Sends the given message.
LogoutRequestPtr receiveLogoutRequest()
Receive the LogoutRequest message.
static LogoutReportContainer createLogoutReport(StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Creates a LogoutReport message.
LogonRequestPtr acceptLogonRequest(UInt32 sequenceId)
Receives the LogonRequest and responds with the LogonReport message.
int port() const noexcept
Gateway & acceptSession(SeqNumber outgoingSequenceNumber=1)
Accepts an incoming session.
LogonReportContainer createNegotiationResponse(Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Creates a NegotiationResponse501 message.
LogoutRequestPtr waitUntilTerminate(ClientMessageListener *listener=nullptr, ClientSessionMessageListener *sessionMessageListener=nullptr, std::atomic< bool > *stopRequested=nullptr)
Waits until the Terminate507 message is received.
Gateway & sendData(const void *data, size_t size)
Sends the given data.
SeqNumber outSeqNum() const noexcept
Gateway & run(ClientMessageListener &listener, std::atomic< bool > *stopRequested=nullptr)
Accepts an incoming connection and establishes the session.
Gateway & operator=(const Gateway &)=delete
MessageBasePtr tryReceive(const std::chrono::microseconds &timeout=defaultTimeout()) const
Receives a message using the provided timeout.
Gateway & enableLogger(const std::string &logFileName, unsigned int logLevel=3)
Enables logging.
Gateway & close()
Close the listening socket.
Gateway & disconnect()
Closes the accepted connection.
static IPReportContainer createIpReport(StrRef userId, StrRef host, Int16NULL port, StrRef ipSessionToken, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Creates a IPReport message.
Gateway(Gateway &&) noexcept
Move semantic.
static TraderLogonReportContainer createTraderLogonReport(StrRef traderId, int clientId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Creates a TraderLogonReport message.
LogonRequestPtr receiveNegotiate()
Receives the LogonRequest message.
Gateway & sendSequence()
Sends the Sequence506 message.
static Timeout defaultTimeout()
Default timeout.
Gateway & sendTerminate(StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={})
Sends the Terminate507 message.
static HeartBeatContainer createSequence()
Creates a Heartbeat message.
bool isConnectionClosed(const Timeout &timeout) const
Checks whether the connection is closed by the counterparty.
MessagePtr< TMsg > receiveTypedMessage()
Receives the message of the particular type.
void swap(Gateway &) noexcept
Swap with other.
LogoutRequestPtr acceptTerminate()
Receive the LogoutRequest message and responds with the LogoutReport message.
Gateway & send(MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg)
Sends the given message.
LogoutRequestPtr terminate(StrRef userId)
Sends the Terminate507 message and waits until the response is received.
Gateway & tcpNoDelayOption(bool noDelay)
Sets the value of the option to improve latency at the expense of message throughput (the TCP_NODELAY...
IntegralConstant< Int32, -2147483647-1 > NullInt32NULL
Null value for an optional Int32NULL field.
constexpr std::enable_if<!details::HasMemberTraits< Value >::value, size_t >::type size() noexcept
Int32 Int32NULL
int32NULL.
Int16 Int16NULL
int16NULL.
std::basic_string_view< Char > StrRef
MessagePtr< LogonRequest > LogonRequestPtr
MessagePtr< IPRequest > IPRequestPtr
MessageHolder< HeartBeat > HeartBeatContainer
MessagePtr< TraderLogonRequest > TraderLogonRequestPtr
MessageHolder< IPReport > IPReportContainer
MessagePtr< TraderLogoutRequest > TraderLogoutRequestPtr
MessageHolder< TraderLogonReport > TraderLogonReportContainer
MessagePtr< HeartBeat > HeartBeatPtr
MessagePtr< LogoutRequest > LogoutRequestPtr
std::enable_if< std::is_base_of< TagBased::Message, typenameHolder::MessageType >::value >::type setSeqNum(Holder &, SeqNumber)
MessageHolder< LogoutReport > LogoutReportContainer
MessageHolder< TraderLogoutReport > TraderLogoutReportContainer
MessageHolder< LogonReport > LogonReportContainer
MessagePtr< AnotherType > cast(const MessagePtr< BaseType > &ptr)
Tries to cast to another type.
MessagePtr< SbeMessage > MessageBasePtr
Messaging::UInt32 SeqNumber