Public Types | |
| using | Timeout = std::chrono::milliseconds |
Public Member Functions | |
| Gateway (const SessionSettings::LicenseStores &licenseStores, int port, const char *host="127.0.0.1", const Timeout &acceptTimeout=defaultTimeout(), const Timeout &sendReceiveTimeout=defaultTimeout()) | |
| virtual | ~Gateway () |
| Gateway (const Gateway &)=delete | |
| Gateway & | operator= (const Gateway &)=delete |
| Gateway (Gateway &&) noexcept | |
| Gateway & | operator= (Gateway &&) noexcept |
| void | swap (Gateway &) noexcept |
| Gateway & | acceptConnection (const Timeout &acceptTimeout=defaultTimeout()) |
| bool | tryAcceptConnection (const Timeout &acceptTimeout=defaultTimeout()) |
| Gateway & | acceptSession (SeqNumber outgoingSequenceNumber=1) |
| LogoutRequestPtr | waitUntilTerminate (ClientMessageListener *listener=nullptr, ClientSessionMessageListener *sessionMessageListener=nullptr, std::atomic< bool > *stopRequested=nullptr) |
| Gateway & | sendSequence () |
| Gateway & | disconnect () |
| std::string | host () const |
| int | port () const noexcept |
| Gateway & | enableLogger (const std::string &logFileName, unsigned int logLevel=3) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, SeqNumber num) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg, SeqNumber num) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, std::initializer_list< SeqNumber > numbers) |
| template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
| Gateway & | send (MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg, std::initializer_list< SeqNumber > numbers) |
| template<typename TMsg> | |
| MessagePtr< TMsg > | receiveTypedMessage () |
| Gateway & | run (ClientMessageListener &listener, std::atomic< bool > *stopRequested=nullptr) |
| Gateway & | run (ClientMessageListener &appMsgListener, ClientSessionMessageListener &sessionMsgListener, std::atomic< bool > *stopRequested=nullptr) |
| SeqNumber | outSeqNum () const noexcept |
| Gateway & | outSeqNum (SeqNumber nextOutSeqNum) noexcept |
| Gateway & | tcpNoDelayOption (bool noDelay) |
| bool | tcpNoDelayOption () const noexcept |
| int | socketReceiveBufferSize () const |
| Gateway & | socketReceiveBufferSize (int bufferSize) |
| int | socketSendBufferSize () const noexcept |
| Gateway & | socketSendBufferSize (int bufferSize) |
Protected Member Functions | |
| bool | isConnectionClosed (const Timeout &timeout) const |
| bool | isConnectionClosed () const |
| MessageBasePtr | receive () const |
| MessageBasePtr | tryReceive (const std::chrono::microseconds &timeout=defaultTimeout()) const |
| LogonRequestPtr | receiveNegotiate () |
| LogonRequestPtr | acceptLogonRequest (UInt32 sequenceId) |
| LogoutRequestPtr | receiveLogoutRequest () |
| LogoutRequestPtr | acceptTerminate () |
| Gateway & | sendTerminate (StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| LogoutRequestPtr | terminate (StrRef userId) |
| LogonReportContainer | createNegotiationResponse (Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| Gateway & | send (Messaging::SbeMessage, Messaging::SimpleOpenFramingHeader &) |
| Gateway & | sendData (const void *data, size_t size) |
| Gateway & | close () |
Static Protected Member Functions | |
| static IPReportContainer | createIpReport (StrRef userId, StrRef host, Int16NULL port, StrRef ipSessionToken, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| static TraderLogonReportContainer | createTraderLogonReport (StrRef traderId, int clientId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| static TraderLogoutReportContainer | createTraderLogoutReport (StrRef traderId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| static LogoutReportContainer | createLogoutReport (StrRef userId, Int32NULL exchangeCode=NullInt32NULL(), const std::string &text={}) |
| static HeartBeatContainer | createSequence () |
| static Timeout | defaultTimeout () |
| Gateway | ( | const SessionSettings::LicenseStores & | licenseStores, |
| int | port, | ||
| const char * | host = "127.0.0.1", | ||
| const Timeout & | acceptTimeout = defaultTimeout(), | ||
| const Timeout & | sendReceiveTimeout = defaultTimeout() ) |
|
virtual |
| Gateway & acceptConnection | ( | const Timeout & | acceptTimeout = defaultTimeout() | ) |
Accepts an incoming connection.
If the acceptTimeout is zero, the acceptTimeout provided in the constructor is used.
|
protected |
Receives the LogonRequest and responds with the LogonReport message.
| std::logic_error | if an unexpected type is received. |
|
protected |
Receive the LogoutRequest message and responds with the LogoutReport message.
| std::logic_error | if an unexpected type is received. |
|
protected |
Close the listening socket.
|
staticprotected |
Creates a IPReport message.
|
staticprotected |
Creates a LogoutReport message.
|
protected |
Creates a NegotiationResponse501 message.
|
staticprotected |
Creates a Heartbeat message.
|
staticprotected |
Creates a TraderLogonReport message.
|
staticprotected |
Creates a TraderLogoutReport message.
|
inlinestaticprotected |
| Gateway & disconnect | ( | ) |
Closes the accepted connection.
| Gateway & enableLogger | ( | const std::string & | logFileName, |
| unsigned int | logLevel = 3 ) |
Enables logging.
| std::string host | ( | ) | const |
|
protected |
Checks whether the connection is closed by the counterparty using the default timeout (provided in the constructor).
|
protected |
Checks whether the connection is closed by the counterparty.
|
noexcept |
Sets the sequence number of the next outgoing message.
|
noexcept |
|
protected |
Receives a message.
|
protected |
Receive the LogoutRequest message.
| std::logic_error | if an unexpected type is received. |
|
protected |
Receives the LogonRequest message.
| std::logic_error | if an unexpected type is received. |
| MessagePtr< TMsg > receiveTypedMessage | ( | ) |
| Gateway & run | ( | ClientMessageListener & | appMsgListener, |
| ClientSessionMessageListener & | sessionMsgListener, | ||
| std::atomic< bool > * | stopRequested = nullptr ) |
Accepts an incoming connection and establishes the session.
| Gateway & run | ( | ClientMessageListener & | listener, |
| std::atomic< bool > * | stopRequested = nullptr ) |
Accepts an incoming connection and establishes the session.
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg | ) |
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg, |
| SeqNumber | num ) |
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg, |
| std::initializer_list< SeqNumber > | numbers ) |
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg | ) |
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg, |
| SeqNumber | num ) |
| Gateway & send | ( | MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg, |
| std::initializer_list< SeqNumber > | numbers ) |
|
protected |
Sends the given message.
|
protected |
Sends the given data.
| Gateway & sendSequence | ( | ) |
Sends the Sequence506 message.
|
protected |
Sends the Terminate507 message.
| int socketReceiveBufferSize | ( | ) | const |
The default value is SessionSettings::Default::SocketReceiveBufferSize.
| Gateway & socketReceiveBufferSize | ( | int | bufferSize | ) |
Sets the socket receive buffer size.
| bufferSize | the size of the socket receive buffer size. If SessionSettings::UseOsDefaultSocketBufferSize then the default operating system value is used. |
|
noexcept |
The default value is SessionSettings::Default::SocketSedndBufferSize.
| Gateway & socketSendBufferSize | ( | int | bufferSize | ) |
Sets the size of the socket send buffer size.
| bufferSize | the size of the socket send buffer size. If SessionSettings::UseOsDefaultSocketBufferSize then the default operating system value is used. |
|
noexcept |
Swap with other.
|
noexcept |
The default value is SessionSettings::Default::TcpNoDelayOption.
| Gateway & tcpNoDelayOption | ( | bool | noDelay | ) |
Sets the value of the option to improve latency at the expense of message throughput (the TCP_NODELAY socket option).
|
protected |
Sends the Terminate507 message and waits until the response is received.
| bool tryAcceptConnection | ( | const Timeout & | acceptTimeout = defaultTimeout() | ) |
Accepts an incoming connection.
If the operation is timed out, false is returned.
|
protected |
Receives a message using the provided timeout.
If the operation is timed out, an empty message is returned.
| LogoutRequestPtr waitUntilTerminate | ( | ClientMessageListener * | listener = nullptr, |
| ClientSessionMessageListener * | sessionMessageListener = nullptr, | ||
| std::atomic< bool > * | stopRequested = nullptr ) |
Waits until the Terminate507 message is received.
If the listener is provided, then receives and reports application-level messages via the corresponding callback. Responds to the Sequence506 message if received.