42namespace AdHoc {
struct SessionHelper; }
77 std::
string id() const;
156 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
161#if defined (ONIXS_ILINK3_CXX11)
172 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
182#if defined (ONIXS_ILINK3_CXX11)
199 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
291 template <
typename SbeMessageType,
size_t MaxMessageSize>
295 int warmupFlags = 0);
298#if defined (ONIXS_ILINK3_CXX11)
315 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
320 int warmupFlags = 0);
360 size_t maxPacketSize =
CmeMaxPacketSize,
int warmupFlags = 0) ONIXS_ILINK3_NONULL;
668 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
669 void validate(const
Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
717 int marketSegmentId() const noexcept;
718 static const
int marketSegmentId_ = INT_MAX;
721template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
731 send(msg.toNetworkMessage(), ts);
736template <
typename SbeMessageType,
size_t MaxMessageSize>
747#if defined (ONIXS_ILINK3_CXX11)
749template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
761#if defined (ONIXS_ILINK3_CXX11)
763template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
768 size_t maxPacketSize)
779 send(begin, end, maxPacketSize, ts);
783template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
799 warmUp(begin, end, maxPacketSize, flags, ts);
805template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
809 validateVersion(holder->version());
#define ONIXS_ILINK3_UNLIKELY(cond)
#define ONIXS_ILINK3_HOTPATH
#define ONIXS_ILINK3_EXPORTED
CgwSession(SessionReactor &stack, const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
CgwSession(const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
The class can be used to combine messages with different types to the batch for sending.
The message batch wrapper.
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
NetworkMessage toNetworkMessage() noexcept
A network iLink3 message.
The time point without the time-zone information.
Session's network stack reactor interface.
static const UInt64 UndefinedUuid
bool localTimeUsage() const
Messaging::Timestamp licenseExpirationDate() const
unsigned messageGrouping() const noexcept
std::string localNetworkInterface() const
std::string customKey() const
Threading::SharedFuture< void > breakConnectionAsync()
Breaks the connection non-gracefully asynchronously.
friend struct AdHoc::SessionHelper
static const int UndefinedAffinity
static const size_t CmeMaxPacketSize
CME states: Packet size maximum behavior based on MTU (Maximum Transmission Unit) - 1420 bytes,...
std::string remoteIpAddress() const
Session & throttle()
Performs the throttling of a session that must be called before each send function call.
Session(SessionReactor &stack, const SessionSettings &settings, int marketSegmentId, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
std::string toString() const
Session & send(NetworkMessage *begin, NetworkMessage *end, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize) ONIXS_ILINK3_NONULL
Sends messages.
Session & breakConnection()
Breaks the connection non-gracefully.
std::string remoteHost() const
const SocketOptions & socketOptions() const
unsigned reconnectAttempts() const
bool reportNewMessagesWhileWaitingForMissedMessages() const
Session & throttlingLimit(size_t messagesCount, size_t intervalInMs=1000)
Sets throttling limit parameters.
Messaging::FTI::Enum faultToleranceIndicator() const
SeqNumber outSeqNum() const noexcept
Messaging::SchemaVersion messagingVersion() const noexcept
std::pair< Port, Port > localPortRange() const noexcept
const std::string & storageDirectory() const
int receivingThreadPolicy() const
Session & send(NetMessagesRange range, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize)
Sends messages.
size_t incomingMessageGapQueueMaximumSize() const
bool getTcpInfo(TcpInfo &)
Gets information about the underlying TCP connection.
bool detectMessageGapForPreviousUuid() const
Session & sendSequenceMessage(Messaging::KeepAliveLapsed::Enum keepAliveLapsed=Messaging::KeepAliveLapsed::Lapsed)
Send the Sequence message.
unsigned receiveSpinningTimeout() const noexcept
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg, Messaging::Timestamp sendingTime=UtcWatch::now(), int warmupFlags=0)
Warms up the sending path.
Handle socketHandle()
Returns the socket handle which the session uses to transmit data.
Session & receivingThreadAffinity(CpuIndex cpuIndex)
Sets the receiving thread CPU affinity.
int marketSegmentId() const noexcept
Session & warmUp(NetworkMessage *begin, NetworkMessage *end, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize, int warmupFlags=0) ONIXS_ILINK3_NONULL
Warms up the sending path.
ThreadingModel::Enum threadingModel() const
unsigned reconnectInterval() const
SessionStorageType::Enum storageType() const noexcept
Messaging::UInt64 previousUuid() const noexcept
int sendingThreadPriority() const
UInt64 uuid() const noexcept
size_t outboundQueueBytes()
Returns the total number of bytes in the outbound queue.
const std::string & storageId() const noexcept
Session & send(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize)
Sends messages.
static std::string version()
size_t tryThrottle()
Checks the throttling of a session that must be called before each send function call.
static const Handle InvalidSocketHandle
Represents invalid value of socket handle.
bool logBeforeSending() const
Session & disconnect(const std::string &reason="")
Terminates the connection.
Messaging::Timestamp creationTime() const noexcept
Session & reset(bool startOfWeek=false)
Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
SessionStateId::Enum state() const
void flushSessionStorage()
Flushes all internal buffers of the session storage.
SeqNumber inSeqNum() const
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, Messaging::Timestamp sendingTime=UtcWatch::now())
Sends the message.
int receivingThreadPriority() const
const Session & log(const std::string &message) const
Write the given user's message to the Handler's log file using the session formatted Id.
Session & sendingThreadAffinity(CpuIndex cpuIndex)
Sets the sending thread CPU affinity.
Session & connect(const std::string &host, Port port)
Establishes the connection.
SeqNumber previousSeqNo() const noexcept
Session & warmUp(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize, int warmupFlags=0)
Warms up the sending path.
unsigned sendSpinningTimeout() const noexcept
Session(const SessionSettings &settings, int marketSegmentId, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
int sendingThreadPolicy() const
Sets the sending thread policy.
Threading::SharedFuture< void > disconnectAsync(const std::string &reason="")
Terminates the connection asynchronously.
bool tcpNoDelayOption() const
Threading::SharedFuture< void > connectAsync(const std::string &host, Port port)
Establishes the connection asynchronously.
A high-level wrapper over the TCPDirect network stack.
void validate(const Message &)
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
std::pair< NetworkMessage *, NetworkMessage * > NetMessagesRange
std::vector< SocketOption > SocketOptions
Socket options.
int Handle
Type alias for socket handle.
std::set< CpuIndex > CpuIndexes
Messaging::UInt32 SeqNumber
@ FileBased
File-based Session Storage.