21 #include <OnixS/CboeCFE/Trading/BOE/Compiler.h> 23 #if ONIXS_BATS_BOE_HAS_GATEWAY_EMULATOR 37 class ONIXS_CBOE_CFE_BOE_API Gateway
40 explicit Gateway(
int port,
const char* host =
"127.0.0.1",
const std::chrono::seconds& acceptTimeout = std::chrono::seconds(10),
41 const std::chrono::seconds& sendReceiveTimeout = std::chrono::seconds(10));
47 Gateway(
const Gateway&) =
delete;
48 Gateway& operator=(
const Gateway&) =
delete;
51 Gateway(Gateway&&) noexcept;
52 Gateway& operator=(Gateway&&) noexcept;
55 void swap(Gateway&) noexcept;
58 const
char * host() const noexcept;
61 int port() const noexcept;
65 Gateway& acceptConnection(const
std::chrono::seconds& acceptTimeout =
std::chrono::seconds(0));
68 Gateway& sendApplicationMessage(const OutgoingMessage& msg,
SeqNumber seqNumber = SeqNumberTraits::InvalidValue);
72 template <BOE::MessageType::Enum Type>
73 MessagePtr<typename MessageTypeTraits<Type>::MessageType> receiveTypedMessage() const;
82 LogoutRequestPtr waitUntilLogoutRequested(
83 ClientMessageListener* listener =
nullptr, ClientSessionMessageListener* sessionMessageListener =
nullptr);
89 Gateway& run(ClientMessageListener& listener);
95 Gateway& run(ClientMessageListener& appMsgListener, ClientSessionMessageListener& sessionMsgListener);
99 bool isConnectionClosed(const
std::chrono::seconds& timeout) const;
103 bool isConnectionClosed() const;
109 Gateway& disconnect();
112 MessageBasePtr receive() const;
115 MessageBasePtr receive(PacketContainer && container,
MessageSize containerSize);
118 Gateway& sendData(const
void* data,
size_t size);
121 Gateway& sendSessionMessage(const OutgoingMessage& msg);
126 LoginRequestPtr receiveLoginRequest();
131 LogoutRequestPtr receiveLogoutRequest();
136 ClientHeartbeatPtr receiveClientHeartbeat();
141 LoginRequestPtr acceptLogin(
SeqNumber clientSequence = 1);
146 LoginRequestPtr rejectLogin();
151 LogoutRequestPtr acceptLogout();
156 LoginRequestPtr acceptSession(
SeqNumber clientSequence = 1);
159 void sendLogout(LogoutResponseReason::Enum reason);
162 void sendReplayComplete();
169 template <BOE::MessageType::Enum Type>
170 MessagePtr<typename MessageTypeTraits<Type>::MessageType> Gateway::receiveTypedMessage()
const 172 return cast<Type>(receive());
Binary2 MessageSize
Aliases message length type.