56 using Timeout = std::chrono::milliseconds;
93 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>
145 template <typename TMsg>
293 std::unique_ptr<Impl> impl_;
300template <
typename TMsg>
306template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
309 const auto messageSize = msg.
setHeader();
310 auto*
const header = msg.
header();
316template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
322template <
typename Holder>
323typename std::enable_if<std::is_base_of<TagBased::Message, typename Holder::MessageType>::value>::type
326 throw std::runtime_error(
"Not implemented.");
329template <
typename Holder>
330typename std::enable_if<!std::is_base_of<TagBased::Message, typename Holder::MessageType>::value>::type
333 msg->sequenceId(num);
336template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
343template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
350template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
354 for(
auto seqNum : numbers)
362template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
366 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).
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.
Gateway(const Gateway &)=delete
Deleted.
std::chrono::milliseconds Timeout
Timeout alias.
int socketReceiveBufferSize() const noexcept
Gateway & send(Messaging::SbeMessage, Messaging::SimpleOpenFramingHeader &)
Sends the given message.
friend class ClientSessionMessageListener
LogoutRequestPtr receiveLogoutRequest()
Receive the LogoutRequest 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.
static IPReportContainer createIpReport(StrRef userId, StrRef host, Int16NULL port, StrRef ipSessionToken, Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Creates a IPReport message.
LogoutRequestPtr waitUntilTerminate(ClientMessageListener *listener=nullptr, ClientSessionMessageListener *sessionMessageListener=nullptr, std::atomic< bool > *stopRequested=nullptr)
Waits until the LogoutRequest message is received.
Gateway & sendData(const void *data, size_t size)
Sends the given data.
bool isConnectionClosed() const
Checks whether the connection is closed by the counterparty using the default timeout (provided in th...
SeqNumber outSeqNum() const noexcept
friend class ClientMessageListener
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.
LogonReportContainer createLogonReport(Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Creates a LogonReport message.
Gateway & enableLogger(const std::string &logFileName, unsigned int logLevel=3)
Enables logging.
Gateway & close()
Close the listening socket.
Gateway & disconnect()
Closes the accepted connection.
Gateway(Gateway &&) noexcept
Move semantic.
LogonRequestPtr receiveLogonRequest()
Receives the LogonRequest message.
static HeartBeatContainer createHeartBeat()
Creates a Heartbeat message.
static TraderLogoutReportContainer createTraderLogoutReport(StrRef traderId, Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Creates a TraderLogoutReport message.
Gateway & sendSequence()
Sends the HeartBeat message.
LogoutRequestPtr acceptLogoutRequest()
Receive the LogoutRequest message and responds with the LogoutReport message.
static Timeout defaultTimeout()
Default timeout.
static LogoutReportContainer createLogoutReport(StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Creates a LogoutReport 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.
static TraderLogonReportContainer createTraderLogonReport(StrRef traderId, int clientId, Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Creates a TraderLogonReport message.
Gateway & send(MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg)
Sends the given message.
LogoutRequestPtr terminate(StrRef userId)
Sends the LogoutReport 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...
Gateway & sendLogoutRequest(StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), std::string text={})
Sends the LogoutReport message.
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
decltype(std::declval< const Messaging::SbeMessage & >().sequenceId()) SeqNumber