OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.9
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 // Forward declarations
41 class TcpDirectStack;
42 namespace AdHoc { struct SessionHelper; };
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  * Breaks the connection non-gracefully.
137  * \return This session.
138  */
139  Session& breakConnection();
140 
141  /**
142  * Breaks the connection non-gracefully asynchronously.
143  */
144  Threading::SharedFuture<void> breakConnectionAsync();
145 
146  /**
147  * Sends the message.
148  *
149  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
150  * \param msg The message to be sent.
151  *
152  * \note This call is thread-safe, except for the TCPDirect mode.
153  *
154  * \return This session.
155  */
156  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
157  Session& send(
158  Messaging::MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg,
159  Messaging::Timestamp sendingTime = UtcWatch::now());
160 
161 #if defined (ONIXS_ILINK3_CXX11)
162 
163  /**
164  * Sends the message.
165  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
166  * \param msg The message to be sent.
167  *
168  * \note This call is thread-safe, except for the TCPDirect mode.
169  *
170  * \return This session.
171  */
172  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
173  Session& send(
175  Messaging::Timestamp sendingTime = UtcWatch::now());
176 
177 #endif
178 
179  /// CME states: Packet size maximum behavior based on MTU (Maximum Transmission Unit) - 1420 bytes, as defined on our network.
180  static const size_t CmeMaxPacketSize = 1420;
181 
182 #if defined (ONIXS_ILINK3_CXX11)
183 
184  /**
185  * Sends messages.
186  *
187  * \note This call is thread-safe.
188  *
189  * \param msgs Message batch to send.
190  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together.
191  * This parameter could be used to reduce the probability that the operating system will fragment the message across multiple TCP packets.
192  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
193  *
194  * \note The maxPacketSize parameter should not be less than any message size in the batch.
195  * Otherwise, the method call can produce an error, and the session can close the connection.
196  *
197  * \return This session.
198  */
199  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
200  Session& send(
202  Messaging::Timestamp sendingTime = UtcWatch::now(),
203  size_t maxPacketSize = CmeMaxPacketSize);
204 
205  /**
206  * Sends messages.
207  *
208  * \note This call is thread-safe.
209  *
210  * \param msgs Message batch combiner to send.
211  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together.
212  * This parameter could be used to reduce the probability that the operating system will fragment the message across multiple TCP packets.
213  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
214  *
215  * \note The maxPacketSize parameter should not be less than any message size in the batch.
216  * Otherwise, the method call can produce an error, and the session can close the connection.
217  *
218  * \return This session.
219  */
220  Session& send(
221  MessageBatchCombiner & msgs,
222  Messaging::Timestamp sendingTime = UtcWatch::now(),
223  size_t maxPacketSize = CmeMaxPacketSize);
224 
225 #endif
226 
227  /**
228  * Send the Sequence message.
229  *
230  * \note The session sends Sequence messages automatically per the CME iLink protocol.
231  * This method should be used only if an ad hoc Sequence message is required
232  * and the connection is established.
233  *
234  * \param keepAliveLapsed Indicates whether one Keep Alive interval has lapsed without any message received.
235  *
236  * \return This session.
237  */
238  Session& sendSequenceMessage(Messaging::KeepAliveLapsed::Enum keepAliveLapsed = Messaging::KeepAliveLapsed::Lapsed);
239 
240  /**
241  * Warms up the sending path.
242  *
243  * \param msg SBE message to warm up the sending path.
244  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
245  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
246  *
247  * \note This call is thread-safe, except for the TCPDirect mode.
248  *
249  * \return This session.
250  */
251  template <typename SbeMessageType, size_t MaxMessageSize>
252  Session& warmUp(
254  Messaging::Timestamp sendingTime = UtcWatch::now(),
255  int warmupFlags = 0);
256 
257 
258 #if defined (ONIXS_ILINK3_CXX11)
259 
260  /**
261  * Warms up the sending path.
262  *
263  * \note This call is thread-safe.
264  *
265  * \param msgs Message batch to send.
266  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together during the subsequent `send` call.
267  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
268  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
269  *
270  * \note The maxPacketSize parameter should not be less than any message size in the batch.
271  * Otherwise, the method call can produce an error, and the session can close the connection.
272  *
273  * \return This session.
274  */
275  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
276  Session& warmUp(
278  Messaging::Timestamp sendingTime = UtcWatch::now(),
279  size_t maxPacketSize = CmeMaxPacketSize,
280  int warmupFlags = 0);
281 
282  /**
283  * Warms up the sending path.
284  *
285  * \note This call is thread-safe.
286  *
287  * \param msgs Message batch combiner to send.
288  * \param maxPacketSize The maximum number of bytes written to the socket's send buffer together during the subsequent `send` call.
289  * \param sendingTime The time value to be used for a `sendingTimeEpoch` field of the message(s) being sent.
290  * \param warmupFlags Specific flags which can be used to turn on the warmup feature for a specific NIC.
291  *
292  * \note The maxPacketSize parameter should not be less than any message size in the batch.
293  * Otherwise, the method call can produce an error, and the session can close the connection.
294  *
295  * \return This session.
296  */
297  Session& warmUp(
299  size_t maxPacketSize = CmeMaxPacketSize, int warmupFlags = 0);
300 #endif
301 
302  /**
303  * Performs the throttling of a session that must be called before each send function call.
304  * If the count of messages per time unit exceeds the throttling limit, the function will be blocked until the given time interval is passed.
305  *
306  * \note This call is thread-safe.
307  */
308  Session& throttle();
309 
310  /**
311  * Checks the throttling of a session that must be called before each send function call.
312  * 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.
313  *
314  * \note This call is thread-safe.
315  */
316  size_t tryThrottle();
317 
318  /**
319  * Sets throttling limit parameters.
320  *
321  * \param messagesCount Message limit per time unit.
322  * \param intervalInMs Time interval to limit messages.
323  *
324  * \note This call is thread-safe.
325  */
326  Session & throttlingLimit(size_t messagesCount, size_t intervalInMs = 1000);
327 
328  /// \return the host name the session is connected to.
329  std::string remoteHost() const;
330 
331  /// \return the IP address the session is connected to.
332  std::string remoteIpAddress() const;
333 
334  /// \return the port number the session is connected to.
335  Port remotePort() const;
336 
337  /// \return the local port range
338  std::pair<Port, Port> localPortRange() const ONIXS_ILINK3_NOTHROW;
339 
340  /// Sets the local port range
341  Session& localPortRange(std::pair<Port, Port> portRange);
342 
343  /// \return the IP Address or name of the local network interface.
344  std::string localNetworkInterface() const;
345 
346  /// Sets the IP Address or name of the local network interface.
347  Session& localNetworkInterface(const std::string &value);
348 
349  /// \return the local network port number.
350  Port localPort() const;
351 
352  /// \return the value of the `TCP_NODELAY` option (improve latency at the expense of message throughput).
353  bool tcpNoDelayOption() const;
354 
355  /// Sets the `TCP_NODELAY` option (improve latency at the expense of message throughput).
356  Session& tcpNoDelayOption(bool value);
357 
358  /// \return Socket options.
359  const SocketOptions &socketOptions() const;
360 
361  /// Sets socket options.
362  Session& socketOptions(const SocketOptions &options);
363 
364  static const int UndefinedAffinity = -1;
365 
366  /// Sets the receiving thread CPU affinity.
367  Session& receivingThreadAffinity(CpuIndex cpuIndex);
368 
369  /// \return the receiving thread CPU affinity.
370  Session& receivingThreadAffinity(const CpuIndexes &cpuIndexes);
371 
372  /// Sets the receiving thread CPU affinity.
373  const CpuIndexes &receivingThreadAffinity() const;
374 
375  /// Sets the sending thread CPU affinity.
376  Session& sendingThreadAffinity(CpuIndex cpuIndex);
377 
378  /// Sets the sending thread CPU affinity.
379  Session& sendingThreadAffinity(const CpuIndexes &cpuIndexes);
380 
381  /// \return the auxiliary sending thread CPU affinity.
382  const CpuIndexes &sendingThreadAffinity() const;
383 
384  /// \return the scheduling priority of the receiving thread.
385  int receivingThreadPriority() const;
386 
387  /// Sets the scheduling priority of the receiving thread.
388  Session& receivingThreadPriority(int priority);
389 
390  /// \return the scheduling priority of the sending thread.
391  int sendingThreadPriority() const;
392 
393  /// \return the scheduling priority of the sending thread.
394  Session& sendingThreadPriority(int priority);
395 
396  /// \return the receiving thread policy.
397  int receivingThreadPolicy() const;
398 
399  /// Sets the receiving thread policy.
400  Session& receivingThreadPolicy(int policy);
401 
402  /// Sets the sending thread policy.
403  int sendingThreadPolicy() const;
404 
405  /// \return the sending thread policy.
406  Session& sendingThreadPolicy(int policy);
407 
408  /// \return the receive spinning timeout value (in microseconds).
409  unsigned receiveSpinningTimeout() const ONIXS_ILINK3_NOTHROW;
410 
411  /// Sets the receive spinning timeout value (in microseconds).
412  Session& receiveSpinningTimeout(unsigned timeoutInUs);
413 
414  /// \return the send spinning timeout value (in microseconds).
415  unsigned sendSpinningTimeout() const ONIXS_ILINK3_NOTHROW;
416 
417  /// Sets the send spinning timeout value (in microseconds).
418  Session& sendSpinningTimeout(unsigned timeoutInUs);
419 
420  /// \return `true` if new messages are reported even when the message gap is detected,
421  /// and the reply on the [Retransmit Request](https://www.cmegroup.com/confluence/display/EPICSANDBOX/Retransmit+Request)
422  /// message is expected; otherwise - `false`.
423  bool reportNewMessagesWhileWaitingForMissedMessages() const;
424 
425  /// Sets the option to report new messages even when the message gap is detected,
426  /// and the reply on the [Retransmit Request](https://www.cmegroup.com/confluence/display/EPICSANDBOX/Retransmit+Request)
427  /// message is expected.
428  Session& reportNewMessagesWhileWaitingForMissedMessages(bool value);
429 
430  /// \return the number of messages to be sent together.
431  unsigned messageGrouping() const ONIXS_ILINK3_NOTHROW;
432 
433  /**
434  * Sets the number of messages to be sent together.
435  *
436  * \param numberOfMessagesToGroup If the parameter is zero (by default) or one, the Handler tries to send
437  * an outgoing application-level message in the context of the thread that calls the OnixS::CME::iLink3::Session::send method.
438  * If the message cannot be sent immediately, it is stored in the queue for the subsequent sending by the sending thread.
439  * If this parameter is larger than one, the Handler stores outgoing SBE messages in the queue for the subsequent sending by the sending thread.
440  *
441  * \return This session.
442  */
443  Session& messageGrouping(unsigned numberOfMessagesToGroup);
444 
445  /// \return Session storage type.
446  SessionStorageType::Enum storageType() const ONIXS_ILINK3_NOTHROW;
447 
448  /// \return Session storage ID.
449  const std::string &storageId() const ONIXS_ILINK3_NOTHROW;
450 
451  /// \return the sequence number of the next outgoing message.
452  SeqNumber outSeqNum() const ONIXS_ILINK3_NOTHROW;
453 
454  /// Sets the sequence number of the next outgoing message.
455  Session& outSeqNum(SeqNumber nextOutSeqNum);
456 
457  /// \return the expected sequence number of the next inbound message.
458  SeqNumber inSeqNum() const;
459 
460  /// Sets the expected sequence number of the next inbound message.
461  Session& inSeqNum(SeqNumber nextExpectedInSeqNum);
462 
463  /**
464  * \return the sequence number of the last business message published by CME with the PreviousUUID.
465  *
466  * If no business message was published, the value is zero.
467  */
468  SeqNumber previousSeqNo() const ONIXS_ILINK3_NOTHROW;
469 
470  /// Sets the sequence number of the last business message published by CME with the PreviousUUID.
471  Session& previousSeqNo(SeqNumber value);
472 
473  /**
474  * \return The UUID from the previously established session.
475  *
476  * - 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.
477  * - This can be the last UUID used by the customer from the previously established session.
478  */
479  Messaging::UInt64 previousUuid() const ONIXS_ILINK3_NOTHROW;
480 
481  /// Sets the UUID from the previously Established session.
482  Session& previousUuid(Messaging::UInt64 value);
483 
484  /**
485  * Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
486  *
487  * \warning Can be called only when the session is disconnected.
488  *
489  * \param startOfWeek if `true` then the PreviousUUID and PreviousSeqNum are reset to 0.
490  *
491  * \return This session.
492  */
493  Session& reset(bool startOfWeek = false);
494 
495  /// \return Session's current state.
496  SessionStateId::Enum state() const;
497 
498  /// \return the time when the session was created or the last reset operation was performed.
499  Messaging::Timestamp creationTime() const ONIXS_ILINK3_NOTHROW;
500 
501  /// Flushes all internal buffers of the session storage.
502  void flushSessionStorage();
503 
504  /// \return the maximum number of tries to restore the telecommunications link.
505  unsigned reconnectAttempts() const;
506 
507  /// Sets the maximum number of tries to restore the telecommunications link.
508  Session& reconnectAttempts(unsigned reconnectAttempts);
509 
510  /// \return the time interval between retries to restore the telecommunications link (seconds).
511  unsigned reconnectInterval() const;
512 
513  /// Sets the time interval between retries to restore the telecommunications link (seconds).
514  Session& reconnectInterval(unsigned seconds);
515 
516  /// \return the usage of local time in Handler events and logs files.
517  bool localTimeUsage() const;
518 
519  /// Specifies the usage of local time in Handler events and logs files.
520  Session& localTimeUsage(bool useLocalTime);
521 
522  /// \return The session storage directory.
523  const std::string &storageDirectory() const;
524 
525  /// \return `true` if logging of an outgoing message to the session storage is performed before sending it to the wire; otherwise - `false`.
526  bool logBeforeSending() const;
527 
528  /// Sets the option to log an outgoing message to the session storage before sending it to the wire.
529  Session& logBeforeSending(bool value);
530 
531  /// \return the maximum size of the message queue used during message gap recovery.
532  size_t incomingMessageGapQueueMaximumSize() const;
533 
534  /// Sets the maximum size of the message queue used during message gap recovery.
535  Session& incomingMessageGapQueueMaximumSize(size_t value);
536 
537  /// Write the given user's message to the Handler's log file using the session formatted Id.
538  const Session& log(const std::string &message) const;
539 
540  /// \return the human-friendly description.
541  std::string toString() const;
542 
543  /// \return the license expiration date.
544  Messaging::Timestamp licenseExpirationDate() const;
545 
546  /// \return the version of the message schema.
547  Messaging::SchemaVersion messagingVersion() const ONIXS_ILINK3_NOTHROW;
548 
549  /// \return the value of the option to detect the message gap for the previous UUID.
550  bool detectMessageGapForPreviousUuid() const;
551 
552  /// Sets the value of the option to detect the message gap for the previous UUID.
553  Session& detectMessageGapForPreviousUuid(bool detectGap);
554 
555  /// Represents invalid value of socket handle.
556  static const Handle InvalidSocketHandle;
557 
558  /// Returns the socket handle which the session uses to transmit data.
559  ///
560  /// \note The TCPDirect mode does not support this method, so it always returns the `InvalidSocketHandle` value.
561  Handle socketHandle();
562 
563  /// Returns the total number of bytes in the outbound queue.
564  size_t outboundQueueBytes();
565 
566  /// Gets information about the underlying TCP connection.
567  ///
568  /// \return `true` when success; otherwise - `false`.
569  /// \note Available on Linux only.
570  /// \note Not available for the TcpDirect mode.
571  bool getTcpInfo(TcpInfo&);
572 
573  /// \return the version of the library.
574  static const std::string& version() ONIXS_ILINK3_NOTHROW;
575 
576 private:
577  Session(const Session& );
578  Session& operator=(const Session& );
579 
580  void send(NetworkMessage msg, Messaging::Timestamp ts);
581  void send(NetMessages& msgs, size_t maxPacketSize, Messaging::Timestamp ts);
582  void warmUp(NetworkMessage msg, int warmupFlags, Messaging::Timestamp ts);
583  void warmUp(NetMessages& msgs, size_t maxPacketSize, int warmupFlags, Messaging::Timestamp ts);
584 
585  template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
586  void validate(const Messaging::MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
587 
588  void validateVersion(Messaging::SchemaVersion version) const;
589 
590  Session& sendRetransmitRequest(UInt64 uuid, SeqNumber from, SeqNumber to);
591 
592  struct Impl;
593  Impl *const impl_;
594 
595 friend struct AdHoc::SessionHelper;
596 };
597 
598 /**
599 * An iLink 3 Session for CME Convenience Gateways (CGW).
600 */
601 class ONIXS_ILINK3_EXPORTED CgwSession : public Session
602 {
603 public:
604  /**
605  * Constructor.
606  *
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(const SessionSettings &settings,
616  SessionStorage *storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
617 
618  /**
619  * Constructor.
620  *
621  * \param stack Externally provided reactor.
622  * \param settings Session settings.
623  * \param listener Session listener.
624  * \param storageType Session storage type.
625  * \param storage Session storage.
626  * \param uuid Universally Unique Identifier (UUID).
627  * \param customKey Custom key that could be used to distinguish sessions with the same UUID, Session ID and FirmId values.
628  */
629  CgwSession(SessionReactor & stack, const SessionSettings & settings,
631  SessionStorage * storage = ONIXS_ILINK3_NULLPTR, UInt64 uuid = UndefinedUuid, const std::string &customKey = "");
632 
633 private:
634  int marketSegmentId() const ONIXS_ILINK3_NOTHROW;
635  static const int marketSegmentId_ = INT_MAX;
636 };
637 
638 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
641 {
642  assert(ts != Messaging::Timestamp());
643 
644 #ifndef NDEBUG
645  validate(msg);
646 #endif
647 
648  send(msg.toNetworkMessage(), ts);
649 
650  return *this;
651 }
652 
653 template <typename SbeMessageType, size_t MaxMessageSize>
657  Messaging::Timestamp sendingTime,
658  int warmupFlags)
659 {
660  warmUp(msg.toNetworkMessage(), warmupFlags, sendingTime);
661 
662  return *this;
663 }
664 
665 #if defined (ONIXS_ILINK3_CXX11)
666 
667 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
670 {
671  assert(ts != Messaging::Timestamp());
672 
673  send(msg, ts);
674  return *this;
675 }
676 
677 #endif
678 
679 #if defined (ONIXS_ILINK3_CXX11)
680 
681 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
686  size_t maxPacketSize)
687 {
688  assert(ts != Messaging::Timestamp());
689 
690  send(msgs.netMsgs_, maxPacketSize, ts);
691  return *this;
692 }
693 
694 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
698  Messaging::Timestamp ts, size_t maxPacketSize, int flags)
699 {
700  assert(ts != Messaging::Timestamp());
701 
702  warmUp(msgs.netMsgs_, maxPacketSize, flags, ts);
703  return *this;
704 }
705 
706 #endif
707 
708 template <typename SbeMessageType, size_t MaxMessageSize, typename MessageInitializer>
710 {
711  Messaging::validate(holder);
712  validateVersion(holder->version());
713 }
714 
715 }
716 }
717 }
#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:640
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:601
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:655
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