Public Member Functions | |
Gateway (int port, const char *host="127.0.0.1", const std::chrono::seconds &timeout=std::chrono::seconds(10)) | |
virtual | ~Gateway () |
Gateway (const Gateway &)=delete | |
Gateway & | operator= (const Gateway &)=delete |
Gateway (Gateway &&) noexcept | |
Gateway & | operator= (Gateway &&) noexcept |
void | swap (Gateway &) noexcept |
Gateway & | acceptConnection () |
Gateway & | acceptSession (SeqNumber outgoingSequenceNumber=1, UInt64 previousUuid=0, UInt32 previousSeqNo=0) |
Terminate203Ptr | waitUntilTerminate (ClientMessageListener *listener=nullptr) |
Gateway & | disconnect () |
int | port () const noexcept |
Gateway & | enableLogger (const std::string &logFileName) |
template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
Gateway & | send (ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg) |
template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
Gateway & | send (ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg) |
template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
Gateway & | send (ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, SeqNumber num) |
template<typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer> | |
Gateway & | send (ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg, SeqNumber num) |
template<typename TMsg> | |
MessagePtr< TMsg > | receiveTypedMessage () |
Gateway & | run (ClientMessageListener &listener) |
SeqNumber | outSeqNum () const |
Gateway & | outSeqNum (SeqNumber nextOutSeqNum) |
UInt64 | uuid () const noexcept |
Gateway & | tcpNoDelayOption (bool noDelay) |
bool | tcpNoDelayOption () const |
int | socketReceiveBufferSize () const |
Gateway & | socketReceiveBufferSize (int bufferSize) |
int | socketSendBufferSize () const |
Gateway & | socketSendBufferSize (int bufferSize) |
Protected Attributes | |
UInt64 | uId_ {0} |
|
explicit |
|
virtual |
Gateway & acceptConnection | ( | ) |
Accepts an incoming connection.
|
protected |
Receives the Negotiate200 and responds with the NegotiationResponse202 message.
std::logic_error | if an unexpected type is received. |
Gateway & acceptSession | ( | SeqNumber | outgoingSequenceNumber = 1, |
UInt64 | previousUuid = 0, | ||
UInt32 | previousSeqNo = 0 ) |
Accepts an incoming Conflated TCP session.
|
protected |
Receive the Terminate203 message and responds with the Terminate203 message.
std::logic_error | if an unexpected type is received. |
|
protected |
Creates a NegotiationReject201 message.
|
protected |
Creates a NegotiationResponse202 message.
|
protected |
Creates a RequestAck206 message.
|
protected |
Creates a RequestReject207 message.
|
protected |
Creates a Terminate203 message.
|
protected |
Creates a Terminate203 message.
Gateway & disconnect | ( | ) |
Closes the accepted connection.
Gateway & enableLogger | ( | const std::string & | logFileName | ) |
Enables logging.
|
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.
SeqNumber outSeqNum | ( | ) | const |
Sets the sequence number of the next outgoing message.
|
noexcept |
|
protected |
Receives a message.
|
protected |
Receives the Negotiate200 message.
std::logic_error | if an unexpected type is received. |
|
protected |
Receive the Terminate203 message.
std::logic_error | if an unexpected type is received. |
MessagePtr< TMsg > receiveTypedMessage | ( | ) |
|
protected |
Receives the Negotiate200 message and responds with the NegotiationReject201 message.
std::logic_error | if an unexpected type is received. |
Gateway & run | ( | ClientMessageListener & | listener | ) |
Accepts an incoming connection and establishes the session.
Gateway & send | ( | ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg | ) |
Gateway & send | ( | ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg, |
SeqNumber | num ) |
Gateway & send | ( | ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg | ) |
Gateway & send | ( | ConflatedTCP::Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg, |
SeqNumber | num ) |
|
protected |
Sends the given message.
|
protected |
Sends the given data.
|
protected |
Sends the Terminate203 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. |
int socketSendBufferSize | ( | ) | const |
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.
bool tcpNoDelayOption | ( | ) | const |
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 Terminate203 meassage and waist until the response is received.
Terminate203Ptr waitUntilTerminate | ( | ClientMessageListener * | listener = nullptr | ) |
Waits until the Terminate203 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.