OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.2
API Documentation
Session.h
Go to the documentation of this file.
1 /*
2  * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3  *
4  * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5  * and international copyright treaties.
6  *
7  * Access to and use of the software is governed by the terms of the applicable OnixS Software
8  * Services Agreement (the Agreement) and Customer end user license agreements granting
9  * a non-assignable, non-transferable and non-exclusive license to use the software
10  * for it's own data processing purposes under the terms defined in the Agreement.
11  *
12  * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13  * of this source code or associated reference material to any other location for further reproduction
14  * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15  *
16  * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17  * the terms of the Agreement is a violation of copyright law.
18  */
19 
20 #pragma once
21 
22 #include <limits.h>
23 
24 #include <OnixS/CME/iLink3/ABI.h>
33 
34 namespace OnixS
35 {
36 namespace CME
37 {
38 namespace iLink3
39 {
40 
41 // Forward declarations
42 class TcpDirectStack;
43 
44 /**
45 * An iLink 3 Session.
46 */
48 {
49 public:
50  static const UInt64 UndefinedUuid = 0;
51 
52  /**
53  * Constructor.
54  *
55  * \param settings Session settings.
56  * \param marketSegmentId Market segment ID.
57  * \param listener Session listener.
58  * \param storageType Session storage type.
59  * \param storage Session storage.
60  * \param uuid Universally Unique Identifier (UUID).
61  * \param customKey Custom key that could be used to distinguish sessions with the same UUID, Session ID, FirmId, and Market Segment ID values.
62  */
63  Session(const SessionSettings &settings, int marketSegmentId,
65  SessionStorage *storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
66 
67  Session(SessionReactor & stack, const SessionSettings & settings, int marketSegmentId,
69  SessionStorage * storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
70 
71  ~Session();
72 
73  /// \return the Universally Unique Identifier (UUID).
74  UInt64 uuid() const ONIXS_ILINK3_NOTHROW;
75 
76  /// \return Session ID (assigned by the exchange).
77  std::string id() const;
78 
79  /// \return Market Segment ID.
80  int marketSegmentId() const ONIXS_ILINK3_NOTHROW;
81 
82  /// \return Custom key that could be used to distinguish sessions with the same UUID, Session ID, FirmId, and Market Segment ID values.
83  std::string customKey() const;
84 
85  /// \return `true` if the session is negotiated (the Negotiation Response message has been received in reply to the Negotiation message); otherwise - `false`.
86  bool negotiated() const;
87 
88  /// Sets the "negotiated" status.
89  ///
90  /// The session is negotiated when the Negotiation Response message has been received in reply to the Negotiation message.
91  Session& negotiated(bool negotiated);
92 
93  /// \return the Fault Tolerance Indicator (whether the connection is the primary or backup).
94  Messaging::FTI::Enum faultToleranceIndicator() const;
95 
96  /// Sets the Fault Tolerance Indicator (whether the connection is the primary or backup).
97  Session& faultToleranceIndicator(Messaging::FTI::Enum value);
98 
99  /**
100  * Establishes the connection.
101  *
102  * \param host Market Segment Gateway host.
103  * \param port Market Segment Gateway port.
104  *
105  * \return This session.
106  */
107  Session& connect(const std::string &host, Port port);
108 
109  /**
110  * Establishes the connection asynchronously.
111  *
112  * \param host Market Segment Gateway host.
113  * \param port Market Segment Gateway port.
114  */
115  Threading::SharedFuture<void> connectAsync(const std::string & host, Port port);
116 
117  /**
118  * Terminates the connection.
119  *
120  * \param reason Terminate reason details.
121  *
122  * \note Method blocks until the Terminate message is received in reply, or the timeout is elapsed.
123  *
124  * \return This session.
125  */
126  Session& disconnect(const std::string &reason = "");
127 
128  /**
129  * Terminates the connection asynchronously.
130  *
131  * \param reason Terminate reason details.
132  */
133  Threading::SharedFuture<void> disconnectAsync(const std::string & reason = "");
134 
135  /**
136  * Sends the message.
137  *
138  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
139  * \param msg The message to be sent.
140  *
141  * \note This call is thread-safe, except for the TCPDirect mode.
142  *
143  * \return This session.
144  */
145  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
146  Session& send(
147  Messaging::MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg,
148  Messaging::Timestamp sendingTime = UtcWatch::now());
149 
150 #if defined (ONIXS_ILINK3_CXX11)
151 
152  /**
153  * Sends the message.
154  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
155  * \param msg The message to be sent.
156  *
157  * \note This call is thread-safe, except for the TCPDirect mode.
158  *
159  * \return This session.
160  */
161  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
162  Session& send(
164  Messaging::Timestamp sendingTime = UtcWatch::now());
165 
166 #endif
167 
168  /// CME states: Packet size maximum behavior based on MTU (Maximum Transmission Unit) - 1420 bytes, as defined on our network.
169  static const size_t CmeMaxPacketSize = 1420;
170 
171 #if defined (ONIXS_ILINK3_CXX11)
172 
173  /**
174  * Sends messages.
175  *
176  * \note This call is thread-safe.
177  *
178  * \param msgs Message batch to send.
179  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together.
180  * This parameter could be used to reduce the probability that the operating system will fragment the message across multiple TCP packets.
181  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
182  *
183  * \note The maxPacketSize parameter should not be less than any message size in the batch.
184  * Otherwise, the method call can produce an error, and the session can close the connection.
185  *
186  * \return This session.
187  */
188  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
189  Session& send(
191  Messaging::Timestamp sendingTime = UtcWatch::now(),
192  size_t maxPacketSize = CmeMaxPacketSize);
193 
194  /**
195  * Sends messages.
196  *
197  * \note This call is thread-safe.
198  *
199  * \param msgs Message batch combiner to send.
200  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together.
201  * This parameter could be used to reduce the probability that the operating system will fragment the message across multiple TCP packets.
202  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
203  *
204  * \note The maxPacketSize parameter should not be less than any message size in the batch.
205  * Otherwise, the method call can produce an error, and the session can close the connection.
206  *
207  * \return This session.
208  */
209  Session& send(
210  MessageBatchCombiner & msgs,
211  Messaging::Timestamp sendingTime = UtcWatch::now(),
212  size_t maxPacketSize = CmeMaxPacketSize);
213 
214 #endif
215 
216  /**
217  * Send the Sequence message.
218  *
219  * \note The session sends Sequence messages automatically per the CME iLink protocol.
220  * This method should be used only if an ad hoc Sequence message is required
221  * and the connection is established.
222  *
223  * \param keepAliveLapsed Indicates whether one Keep Alive interval has lapsed without any message received.
224  *
225  * \return This session.
226  */
227  Session& sendSequenceMessage(Messaging::KeepAliveLapsed::Enum keepAliveLapsed = Messaging::KeepAliveLapsed::Lapsed);
228 
229  /**
230  * Warms up the sending path.
231  *
232  * \param msg SBE message to warm up the sending path.
233  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
234  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
235  *
236  * \note This call is thread-safe, except for the TCPDirect mode.
237  *
238  * \return This session.
239  */
240  template <typename SbeMessageType, size_t MaxMessageSize>
241  Session& warmUp(
243  Messaging::Timestamp sendingTime = UtcWatch::now(),
244  int warmupFlags = 0);
245 
246 
247 #if defined (ONIXS_ILINK3_CXX11)
248 
249  /**
250  * Warms up the sending path.
251  *
252  * \note This call is thread-safe.
253  *
254  * \param msgs Message batch to send.
255  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together during the subsequent `send` call.
256  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
257  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
258  *
259  * \note The maxPacketSize parameter should not be less than any message size in the batch.
260  * Otherwise, the method call can produce an error, and the session can close the connection.
261  *
262  * \return This session.
263  */
264  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
265  Session& warmUp(
267  Messaging::Timestamp sendingTime = UtcWatch::now(),
268  size_t maxPacketSize = CmeMaxPacketSize,
269  int warmupFlags = 0);
270 
271  /**
272  * Warms up the sending path.
273  *
274  * \note This call is thread-safe.
275  *
276  * \param msgs Message batch combiner to send.
277  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together during the subsequent `send` call.
278  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
279  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
280  *
281  * \note The maxPacketSize parameter should not be less than any message size in the batch.
282  * Otherwise, the method call can produce an error, and the session can close the connection.
283  *
284  * \return This session.
285  */
286  Session& warmUp(
288  size_t maxPacketSize = CmeMaxPacketSize, int warmupFlags = 0);
289 #endif
290 
291  /**
292  * Performs the throttling of a session that must be called before each send function call.
293  * If the count of messages per time unit exceeds the throttling limit, the function will be blocked until the given time interval is passed.
294  *
295  * \note This call is thread-safe.
296  */
297  Session& throttle();
298 
299  /**
300  * Checks the throttling of a session that must be called before each send function call.
301  * If the count of messages per time unit exceeds the throttling limit, the function returns the delay (in milliseconds) until the sending becomes possible. Otherwise, it returns 0.
302  *
303  * \note This call is thread-safe.
304  */
305  size_t tryThrottle();
306 
307  /**
308  * Sets throttling limit parameters.
309  *
310  * \param messagesCount Message limit per time unit.
311  * \param intervalInMs Time interval to limit messages.
312  *
313  * \note This call is thread-safe.
314  */
315  Session & throttlingLimit(size_t messagesCount, size_t intervalInMs = 1000);
316 
317  /// \return the host name the session is connected to.
318  std::string remoteHost() const;
319 
320  /// \return the IP address the session is connected to.
321  std::string remoteIpAddress() const;
322 
323  /// \return the port number the session is connected to.
324  Port remotePort() const;
325 
326  /// \return the local port range
327  std::pair<Port, Port> localPortRange() const ONIXS_ILINK3_NOTHROW;
328 
329  /// Sets the local port range
330  Session& localPortRange(std::pair<Port, Port> portRange);
331 
332  /// \return the IP Address or name of the local network interface.
333  std::string localNetworkInterface() const;
334 
335  /// Sets the IP Address or name of the local network interface.
336  Session& localNetworkInterface(const std::string &value);
337 
338  /// \return the local network port number.
339  Port localPort() const;
340 
341  /// \return the value of the `TCP_NODELAY` option (improve latency at the expense of message throughput).
342  bool tcpNoDelayOption() const;
343 
344  /// Sets the `TCP_NODELAY` option (improve latency at the expense of message throughput).
345  Session& tcpNoDelayOption(bool value);
346 
347  /// \return Socket options.
348  const SocketOptions &socketOptions() const;
349 
350  /// Sets socket options.
351  Session& socketOptions(const SocketOptions &options);
352 
353  static const int UndefinedAffinity = -1;
354 
355  /// Sets the receiving thread CPU affinity.
356  Session& receivingThreadAffinity(CpuIndex cpuIndex);
357 
358  /// \return the receiving thread CPU affinity.
359  Session& receivingThreadAffinity(const CpuIndexes &cpuIndexes);
360 
361  /// Sets the receiving thread CPU affinity.
362  const CpuIndexes &receivingThreadAffinity() const;
363 
364  /// Sets the sending thread CPU affinity.
365  Session& sendingThreadAffinity(CpuIndex cpuIndex);
366 
367  /// Sets the sending thread CPU affinity.
368  Session& sendingThreadAffinity(const CpuIndexes &cpuIndexes);
369 
370  /// \return the auxiliary sending thread CPU affinity.
371  const CpuIndexes &sendingThreadAffinity() const;
372 
373  /// \return the scheduling priority of the receiving thread.
374  int receivingThreadPriority() const;
375 
376  /// Sets the scheduling priority of the receiving thread.
377  Session& receivingThreadPriority(int priority);
378 
379  /// \return the scheduling priority of the sending thread.
380  int sendingThreadPriority() const;
381 
382  /// \return the scheduling priority of the sending thread.
383  Session& sendingThreadPriority(int priority);
384 
385  /// \return the receiving thread policy.
386  int receivingThreadPolicy() const;
387 
388  /// Sets the receiving thread policy.
389  Session& receivingThreadPolicy(int policy);
390 
391  /// Sets the sending thread policy.
392  int sendingThreadPolicy() const;
393 
394  /// \return the sending thread policy.
395  Session& sendingThreadPolicy(int policy);
396 
397  /// \return the receive spinning timeout value (in microseconds).
398  unsigned receiveSpinningTimeout() const ONIXS_ILINK3_NOTHROW;
399 
400  /// Sets the receive spinning timeout value (in microseconds).
401  Session& receiveSpinningTimeout(unsigned timeoutInUs);
402 
403  /// \return the send spinning timeout value (in microseconds).
404  unsigned sendSpinningTimeout() const ONIXS_ILINK3_NOTHROW;
405 
406  /// Sets the send spinning timeout value (in microseconds).
407  Session& sendSpinningTimeout(unsigned timeoutInUs);
408 
409  /// \return `true` if new messages are reported even when the message gap is detected,
410  /// and the reply on the [Retransmit Request](https://www.cmegroup.com/confluence/display/EPICSANDBOX/Retransmit+Request)
411  /// message is expected; otherwise - `false`.
412  bool reportNewMessagesWhileWaitingForMissedMessages() const;
413 
414  /// Sets the option to report new messages even when the message gap is detected,
415  /// and the reply on the [Retransmit Request](https://www.cmegroup.com/confluence/display/EPICSANDBOX/Retransmit+Request)
416  /// message is expected.
417  Session& reportNewMessagesWhileWaitingForMissedMessages(bool value);
418 
419  /// \return the number of messages to be sent together.
420  unsigned messageGrouping() const ONIXS_ILINK3_NOTHROW;
421 
422  /**
423  * Sets the number of messages to be sent together.
424  *
425  * \param numberOfMessagesToGroup If the parameter is zero (by default) or one, the Handler tries to send
426  * an outgoing application-level message in the context of the thread that calls the OnixS::CME::iLink3::Session::send method.
427  * If the message cannot be sent immediately, it is stored in the queue for the subsequent sending by the sending thread.
428  * If this parameter is larger than one, the Handler stores outgoing SBE messages in the queue for the subsequent sending by the sending thread.
429  *
430  * \return This session.
431  */
432  Session& messageGrouping(unsigned numberOfMessagesToGroup);
433 
434  /// \return Session storage type.
435  SessionStorageType::Enum storageType() const ONIXS_ILINK3_NOTHROW;
436 
437  /// \return Session storage ID.
438  const std::string &storageId() const ONIXS_ILINK3_NOTHROW;
439 
440  /// \return the sequence number of the next outgoing message.
441  SeqNumber outSeqNum() const ONIXS_ILINK3_NOTHROW;
442 
443  /// Sets the sequence number of the next outgoing message.
444  Session& outSeqNum(SeqNumber nextOutSeqNum);
445 
446  /// \return the expected sequence number of the next inbound message.
447  SeqNumber inSeqNum() const;
448 
449  /// Sets the expected sequence number of the next inbound message.
450  Session& inSeqNum(SeqNumber nextExpectedInSeqNum);
451 
452  /**
453  * \return the sequence number of the last business message published by CME with the PreviousUUID.
454  *
455  * If no business message was published, the value is zero.
456  */
457  SeqNumber previousSeqNo() const ONIXS_ILINK3_NOTHROW;
458 
459  /// Sets the sequence number of the last business message published by CME with the PreviousUUID.
460  Session& previousSeqNo(SeqNumber value);
461 
462  /**
463  * \return The UUID from the previously established session.
464  *
465  * - This can be the CME-assigned default UUID=0 for messages published by CME before the first Negotiation of the customer at the beginning of the week.
466  * - This can be the last UUID used by the customer from the previously established session.
467  */
468  Messaging::UInt64 previousUuid() const ONIXS_ILINK3_NOTHROW;
469 
470  /// Sets the UUID from the previously Established session.
471  Session& previousUuid(Messaging::UInt64 value);
472 
473  /**
474  * Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
475  *
476  * \warning Can be called only when the session is disconnected.
477  *
478  * \param startOfWeek if `true` then the PreviousUUID and PreviousSeqNum are reset to 0.
479  *
480  * \return This session.
481  */
482  Session& reset(bool startOfWeek = false);
483 
484  /// \return Session's current state.
485  SessionStateId::Enum state() const;
486 
487  /// \return the time when the session was created or the last reset operation was performed.
488  Messaging::Timestamp creationTime() const ONIXS_ILINK3_NOTHROW;
489 
490  /// Flushes all internal buffers of the session storage.
491  void flushSessionStorage();
492 
493  /// \return the maximum number of tries to restore the telecommunications link.
494  unsigned reconnectAttempts() const;
495 
496  /// Sets the maximum number of tries to restore the telecommunications link.
497  Session& reconnectAttempts(unsigned reconnectAttempts);
498 
499  /// \return the time interval between retries to restore the telecommunications link (seconds).
500  unsigned reconnectInterval() const;
501 
502  /// Sets the time interval between retries to restore the telecommunications link (seconds).
503  Session& reconnectInterval(unsigned seconds);
504 
505  /// \return the usage of local time in Handler events and logs files.
506  bool localTimeUsage() const;
507 
508  /// Specifies the usage of local time in Handler events and logs files.
509  Session& localTimeUsage(bool useLocalTime);
510 
511  /// \return The session storage directory.
512  const std::string &storageDirectory() const;
513 
514  /// \return `true` if logging of an outgoing message to the session storage is performed before sending it to the wire; otherwise - `false`.
515  bool logBeforeSending() const;
516 
517  /// Sets the option to log an outgoing message to the session storage before sending it to the wire.
518  Session& logBeforeSending(bool value);
519 
520  /// \return the maximum size of the message queue used during message gap recovery.
521  size_t incomingMessageGapQueueMaximumSize() const;
522 
523  /// Sets the maximum size of the message queue used during message gap recovery.
524  Session& incomingMessageGapQueueMaximumSize(size_t value);
525 
526  /// Write the given user's message to the Handler's log file using the session formatted Id.
527  const Session& log(const std::string &message) const;
528 
529  /// \return the human-friendly description.
530  std::string toString() const;
531 
532  /// \return the license expiration date.
533  Messaging::Timestamp licenseExpirationDate() const;
534 
535  /// \return the version of the message schema.
536  Messaging::SchemaVersion messagingVersion() const ONIXS_ILINK3_NOTHROW;
537 
538  /// \return the value of the option to detect the message gap for the previous UUID.
539  bool detectMessageGapForPreviousUuid() const;
540 
541  /// Sets the value of the option to detect the message gap for the previous UUID.
542  Session& detectMessageGapForPreviousUuid(bool detectGap);
543 
544  /// Represents invalid value of socket handle.
545  static const Handle InvalidSocketHandle;
546 
547  /// Returns the socket handle which the session uses to transmit data.
548  ///
549  /// \note The TCPDirect mode does not support this method, so it always returns the `InvalidSocketHandle` value.
550  Handle socketHandle();
551 
552  /// Returns the total number of bytes in the outbound queue.
553  size_t outboundQueueBytes();
554 
555  /// Gets information about the underlying TCP connection.
556  ///
557  /// \return `true` when success; otherwise - `false`.
558  /// \note Available on Linux only.
559  /// \note Not available for the TcpDirect mode.
560  bool getTcpInfo(TcpInfo&);
561 
562  /// \return the version of the library.
563  static const std::string& version() ONIXS_ILINK3_NOTHROW;
564 
565 private:
566  Session(const Session& );
567  Session& operator=(const Session& );
568 
569  void send(NetworkMessage msg, Messaging::Timestamp ts);
570  void send(NetMessages& msgs, size_t maxPacketSize, Messaging::Timestamp ts);
571  void warmUp(NetworkMessage msg, int warmupFlags, Messaging::Timestamp ts);
572  void warmUp(NetMessages& msgs, size_t maxPacketSize, int warmupFlags, Messaging::Timestamp ts);
573 
574  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
575  void validate(const Messaging::MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
576 
577  void validateVersion(Messaging::SchemaVersion version) const;
578 
579  struct Impl;
580  Impl *const impl_;
581 };
582 
583 /**
584 * An iLink 3 Session for CME Convenience Gateways (CGW).
585 */
586 class ONIXS_ILINK3_EXPORTED CgwSession : public Session
587 {
588 public:
589  /**
590  * Constructor.
591  *
592  * \param settings Session settings.
593  * \param listener Session listener.
594  * \param storageType Session storage type.
595  * \param storage Session storage.
596  * \param uuid Universally Unique Identifier (UUID).
597  * \param customKey Custom key that could be used to distinguish sessions with the same UUID, Session ID and FirmId values.
598  */
599  CgwSession(const SessionSettings &settings,
601  SessionStorage *storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
602 
603  /**
604  * Constructor.
605  *
606  * \param stack Externally provided reactor.
607  * \param settings Session settings.
608  * \param listener Session listener.
609  * \param storageType Session storage type.
610  * \param storage Session storage.
611  * \param uuid Universally Unique Identifier (UUID).
612  * \param customKey Custom key that could be used to distinguish sessions with the same UUID, Session ID and FirmId values.
613  */
614  CgwSession(SessionReactor & stack, const SessionSettings & settings,
616  SessionStorage * storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
617 
618 private:
619  int marketSegmentId() const ONIXS_ILINK3_NOTHROW;
620  static const int marketSegmentId_ = INT_MAX;
621 };
622 
623 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
626 {
627  assert(ts != Messaging::Timestamp());
628 
629 #ifndef NDEBUG
630  validate(msg);
631 #endif
632 
633  send(msg.toNetworkMessage(), ts);
634 
635  return *this;
636 }
637 
638 template <typename SbeMessageType, size_t MaxMessageSize>
642  Messaging::Timestamp sendingTime,
643  int warmupFlags)
644 {
645  warmUp(msg.toNetworkMessage(), warmupFlags, sendingTime);
646 
647  return *this;
648 }
649 
650 #if defined (ONIXS_ILINK3_CXX11)
651 
652 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
655 {
656  assert(ts != Messaging::Timestamp());
657 
658  send(msg, ts);
659  return *this;
660 }
661 
662 #endif
663 
664 #if defined (ONIXS_ILINK3_CXX11)
665 
666 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
671  size_t maxPacketSize)
672 {
673  assert(ts != Messaging::Timestamp());
674 
675  send(msgs.netMsgs_, maxPacketSize, ts);
676  return *this;
677 }
678 
679 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
683  Messaging::Timestamp ts, size_t maxPacketSize, int flags)
684 {
685  assert(ts != Messaging::Timestamp());
686 
687  warmUp(msgs.netMsgs_, maxPacketSize, flags, ts);
688  return *this;
689 }
690 
691 #endif
692 
693 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
695 {
696  Messaging::validate(holder);
697  validateVersion(holder->version());
698 }
699 
700 }
701 }
702 }
#define ONIXS_ILINK3_NULLPTR
Definition: Compiler.h:182
An iLink 3 Session.
Definition: Session.h:47
std::vector< NetworkMessage > NetMessages
Definition: MessageBatch.h:42
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
Session&#39;s network stack reactor interface.
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, Messaging::Timestamp sendingTime=UtcWatch::now())
Sends the message.
Definition: Session.h:625
Messaging::UInt32 SeqNumber
Definition: Messaging.h:60
void validate(const Message &)
Definition: Validation.h:32
TCP state information.
Definition: TcpInfo.h:30
unsigned short Port
Definition: Defines.h:44
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
Definition: SchemaTraits.h:30
STL namespace.
std::set< CpuIndex > CpuIndexes
Definition: Defines.h:73
Definition: Defines.h:40
An iLink 3 Session for CME Convenience Gateways (CGW).
Definition: Session.h:586
size_t CpuIndex
Definition: Defines.h:72
int Handle
Type alias for socket handle.
Definition: Defines.h:56
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:175
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg, Messaging::Timestamp sendingTime=UtcWatch::now(), int warmupFlags=0)
Warms up the sending path.
Definition: Session.h:640
UInt64 UInt64
uInt64.
Definition: Fields.h:308
The class can be used to combine messages with different types to the batch for sending.
Definition: MessageBatch.h:139
std::vector< SocketOption > SocketOptions
Socket options.
Definition: Defines.h:77
#define ONIXS_ILINK3_HOTPATH
Definition: Compiler.h:187
The time point without the time-zone information.
Definition: Time.h:467
#define ONIXS_ILINK3_NOTHROW
Definition: Compiler.h:176
NetworkMessage toNetworkMessage() noexcept