OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.9
API Documentation
SessionListener.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 <OnixS/CME/iLink3/ABI.h>
25 
26 #include <string>
27 
28 namespace OnixS {
29 namespace CME {
30 namespace iLink3 {
31 
33 
34 /**
35  * Session Warning Reason.
36  */
38 {
39  enum Enum
40  {
41  /// General session-related warning.
43 
44  /// Incoming message sequence gap is detected.
46 
47  /// Received the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Sequence">Sequence</a> message with
48  /// the `Lapsed` value of the `KeepAliveIntervalLapsed` field.
50 
51  /// Unexpected SBE Schema version is received from CME.
53 
54  /// The value of the `PreviousUUID` field in the received
55  /// <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Establishment+Acknowledgment">Establishment Acknowledgment</a>
56  /// message does not match to the local value.
58 
59  /// Received an unexpected `NextSeqNo` value.
61 
62  /// Received an unsupported message type.
64 
65  /// The incoming message has a sequence number is out of the expected range and the <i>PossRetransFlag</i> is
66  /// set, it indicates a warning. It is strongly recommended that the session be terminated and manual intervention
67  /// be initiated.
69 
70  /// Received a message with an unexpected uuid
72 
73  /// Raised when the `KeepAliveInterval` has expired and no keep alive message is received.
75 
76  /// Exception was thrown from user's event handler.
78 
79  /// An exception is thrown from the user-provided Session Storage
81 
82  /// Session state cannot be restored.
84 
85  /// Raised when the AsyncFileBasedStorage queue exceeded `SessionSettings::asyncFileBasedStorageQueueMaxSize`
87 
88  /// Raised when the license will expire in less than `SessionSettings::licenseAlertingDaysBeforeExpiration`
90 
91  /// A response message with unexpected `requestTimestamp` field value is received
93 
94  /// The <i>Retransmit Reject</i> message is received in reply to the <i>Retransmit Request</i> message.
96 
97  /// Telecommunication link error is detected.
99 
100  /// After sending the initial Negotiate or Establish message the telecommunication link error is detected.
102 
103  /// Error setting socket option
105 
106  /// Cannot backup the file.
108 
109  /// Session state cannot be restored.
111  };
112 
113  ONIXS_ILINK3_EXPORTED static const char* toString(Enum type) ONIXS_ILINK3_NOTHROW;
114 };
115 
116 /**
117  * Session Error Reason.
118  */
120 {
121  enum Enum
122  {
123  /// Internal error
125 
126  /// A general session-related error.
128 
129  /// First message received is not the <i>NegotiationResponse</i> or <i>EstablishmentAck</i> message.
131 
132  /// The <i>Negotiation Reject</i> message is received in reply to the <i>Negotiation</i> message.
134 
135  /// The <i>Establishment Reject</i> message is received in reply to the <i>Establish</i> message.
137 
138  /// The <i>Terminate</i> message is received in reply to the <i>Establish</i> message.
140 
141  /// The incoming message has a sequence number less than expected and the <i>PossRetransFlag</i> is not
142  /// set, it indicates a serious error.
143  /// The incoming message has a sequence number less than expected and the <i>PossRetransFlag</i> is not set, it
144  /// indicates a serious error. It is strongly recommended that the session be terminated and manual intervention
145  /// be initiated.
147 
148  /// Connection cannot be restored.
150 
151  /// Connection cannot be established.
153 
154  /// Exception during processing of an incoming message.
156 
157  /// Received an invalid incoming message.
159 
160  /// When two times the `KeepAliveInterval` has expired and no keep alive
161  /// message is received then the session is terminated ungracefully and will need to be re-established.
163 
164  /// Telecommunication link error is detected.
166 
167  /// After sending the initial Negotiate or Establish message the telecommunication link error is detected.
169 
170  /// The Exchange sent the initial Terminate message.
172 
173  /// The maximum size of the incoming message gap queue is exceeded.
175 
176  /// An exception is thrown from the user-provided Session Storage
178 
179  /// A message with unexpected UUID is received.
181 
182  /// Session state cannot be restored.
184  };
185 
186  ONIXS_ILINK3_EXPORTED static const char* toString(Enum type) ONIXS_ILINK3_NOTHROW;
187 };
188 
189 /// Action to be taken when the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Not+Applied">NotApplied message</a> is received from the exchange.
191 {
192  /// Action to be taken when the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Not+Applied">NotApplied message</a> is received from the exchange.
193  enum Enum
194  {
195  /// No messages are sent in reply.
197 
198  /// Send the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Sequence">Sequence</a> message.
200 
201  /// The default action.
202  Default = DoNothing
203  };
204 };
205 
206 /// Represents a timestamp of the received data.
207 /// If the source is `None`, no timestamp is available.
209 {
210  enum Source
211  {
212  /// No timestamp available.
214 
215  /// Timestamp provided by the OS kernel / user-level network stack.
217 
218  /// Timestamp provided by the network card.
219  Hardware
220  };
221 
222  /// The timestamp.
225 
226  /// \return a human-readable presentation.
227  ONIXS_ILINK3_EXPORTED std::string toString() const;
228 };
229 
230 
231 /// Session's Listener.
233 {
234 public:
235  virtual void onNegotiationResponse(const Messaging::NegotiationResponse501 & /*msg*/, Session * /*sn*/) {}
236  virtual void onNegotiationReject(const Messaging::NegotiationReject502 & /*msg*/, Session * /*sn*/) {}
237  virtual void onEstablishmentAck(const Messaging::EstablishmentAck504 & /*msg*/, Session * /*sn*/) {}
238  virtual void onEstablishmentReject(const Messaging::EstablishmentReject505 & /*msg*/, Session * /*sn*/) {}
239  virtual void onSequence(const Messaging::Sequence506 & /*msg*/, Session * /*sn*/) {}
240  virtual void onTerminate(const Messaging::Terminate507 & /*msg*/, Session * /*sn*/) {}
241  virtual void onRetransmitReject(const Messaging::RetransmitReject510 & /*msg*/, Session * /*sn*/) {}
242  virtual void onRetransmission(const Messaging::Retransmission509 & /*msg*/, Session * /*sn*/) {}
243  virtual void onFailover(Messaging::FTI::Enum /*faultToleranceIndicator*/, Session * /*sn*/) {}
244 
247  }
248 
249  virtual void onBusinessReject(const Messaging::BusinessReject521 & /*msg*/, Session * /*sn*/) {}
250  virtual void onExecutionReportNew(const Messaging::ExecutionReportNew522 & /*msg*/, Session * /*sn*/) {}
251  virtual void onExecutionReportModify(const Messaging::ExecutionReportModify531 & /*msg*/, Session * /*sn*/) {}
252  virtual void onExecutionReportCancel(const Messaging::ExecutionReportCancel534 & /*msg*/, Session * /*sn*/) {}
253  virtual void onExecutionReportStatus(const Messaging::ExecutionReportStatus532 & /*msg*/, Session * /*sn*/) {}
258  virtual void onExecutionReportReject(const Messaging::ExecutionReportReject523 & /*msg*/, Session * /*sn*/) {}
262  virtual void onOrderCancelReject(const Messaging::OrderCancelReject535 & /*msg*/, Session * /*sn*/) {}
265  virtual void onMassQuoteAck(const Messaging::MassQuoteAck545 & /*msg*/, Session * /*sn*/) {}
266  virtual void onRequestForQuoteAck(const Messaging::RequestForQuoteAck546 & /*msg*/, Session * /*sn*/) {}
267  virtual void onQuoteCancelAck(const Messaging::QuoteCancelAck563& /*msg*/, Session* /*sn*/) {}
268  virtual void onOrderMassActionReport(const Messaging::OrderMassActionReport562& /*msg*/, Session* /*sn*/) {}
270  virtual void onPartyDetailsListReport(const Messaging::PartyDetailsListReport538 & /*msg*/, Session * /*sn*/) {}
273 
274  /// Called as soon as bytes are received from the wire.
275  virtual void onReceivedBytes(const char * /*bytes*/, size_t /*size*/, const ReceivedDataTimestamp& /*timestamp*/, Session * /*sn*/) {}
276 
277  /// Called when the SBE message is about to be sent to the wire.
278  virtual void onMessageSending(char * /*bytes*/, size_t /*size*/, Session * /*sn*/) {}
279 
280  /// Called when the session changes its state.
281  virtual void onStateChange(SessionStateId::Enum /*newState*/, SessionStateId::Enum /*prevState*/, Session * /*sn*/) {}
282 
283  /// Called when an error condition is detected.
284  /// \note the message argument provided is a message which caused the problem, must be checked to be valid before usage
285  virtual void onError(SessionErrorReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/, Messaging::SbeMessage) {}
286 
287  /// Called when a warning condition is detected.
288  /// \note the message argument provided is a message which caused the problem, must be checked to be valid before usage
289  virtual void onWarning(SessionWarningReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/, Messaging::SbeMessage) {}
290 
291 protected:
292  virtual ~SessionListener() = 0;
293 };
294 
295 }
296 }
297 }
static const char * toString(Enum type) noexcept
An iLink 3 Session.
Definition: Session.h:47
Raised when the license will expire in less than SessionSettings::licenseAlertingDaysBeforeExpiration...
virtual void onOrderMassActionReport(const Messaging::OrderMassActionReport562 &, Session *)
virtual void onExecutionReportPendingCancel(const Messaging::ExecutionReportPendingCancel564 &, Session *)
virtual void onNegotiationResponse(const Messaging::NegotiationResponse501 &, Session *)
Messaging::Timestamp time_
The timestamp.
Action to be taken when the NotApplied message is received from the exchange.
virtual void onEstablishmentAck(const Messaging::EstablishmentAck504 &, Session *)
virtual void onEstablishmentReject(const Messaging::EstablishmentReject505 &, Session *)
Timestamp provided by the OS kernel / user-level network stack.
virtual void onExecutionReportCancel(const Messaging::ExecutionReportCancel534 &, Session *)
Enum
Action to be taken when the NotApplied message is received from the exchange.
virtual void onBusinessReject(const Messaging::BusinessReject521 &, Session *)
After sending the initial Negotiate or Establish message the telecommunication link error is detected...
After sending the initial Negotiate or Establish message the telecommunication link error is detected...
virtual void onExecutionReportNew(const Messaging::ExecutionReportNew522 &, Session *)
A response message with unexpected requestTimestamp field value is received.
virtual void onExecutionReportTradeAddendumOutright(const Messaging::ExecutionReportTradeAddendumOutright548 &, Session *)
Received the Sequence message with the Lapsed value of the KeepAliveIntervalLapsed field...
virtual void onQuoteCancelAck(const Messaging::QuoteCancelAck563 &, Session *)
virtual void onSequence(const Messaging::Sequence506 &, Session *)
The Establishment Reject message is received in reply to the Establish message.
virtual void onExecutionReportTradeOutright(const Messaging::ExecutionReportTradeOutright525 &, Session *)
virtual void onExecutionReportTradeAddendumSpread(const Messaging::ExecutionReportTradeAddendumSpread549 &, Session *)
When two times the KeepAliveInterval has expired and no keep alive message is received then the sessi...
virtual void onReceivedBytes(const char *, size_t, const ReceivedDataTimestamp &, Session *)
Called as soon as bytes are received from the wire.
virtual void onWarning(SessionWarningReason::Enum, const std::string &, Session *, Messaging::SbeMessage)
Called when a warning condition is detected.
virtual void onExecutionReportPendingReplace(const Messaging::ExecutionReportPendingReplace565 &, Session *)
virtual void onRequestForQuoteAck(const Messaging::RequestForQuoteAck546 &, Session *)
virtual void onExecutionReportTradeAddendumSpreadLeg(const Messaging::ExecutionReportTradeAddendumSpreadLeg550 &, Session *)
virtual void onPartyDetailsListReport(const Messaging::PartyDetailsListReport538 &, Session *)
virtual void onFailover(Messaging::FTI::Enum, Session *)
virtual void onRetransmitReject(const Messaging::RetransmitReject510 &, Session *)
The maximum size of the incoming message gap queue is exceeded.
virtual void onExecutionReportTradeSpreadLeg(const Messaging::ExecutionReportTradeSpreadLeg527 &, Session *)
The incoming message has a sequence number is out of the expected range and the PossRetransFlag is se...
Definition: Defines.h:40
virtual void onMassQuoteAck(const Messaging::MassQuoteAck545 &, Session *)
virtual void onRetransmission(const Messaging::Retransmission509 &, Session *)
The Terminate message is received in reply to the Establish message.
Telecommunication link error is detected.
Received a message with an unexpected uuid.
#define ONIXS_ILINK3_API_DECL(typeKind, typeName)
Definition: ABI.h:29
virtual void onPartyDetailsDefinitionRequestAck(const Messaging::PartyDetailsDefinitionRequestAck519 &, Session *)
virtual void onSecurityDefinitionResponse(const Messaging::SecurityDefinitionResponse561 &, Session *)
The incoming message has a sequence number less than expected and the PossRetransFlag is not set...
Raised when the AsyncFileBasedStorage queue exceeded SessionSettings::asyncFileBasedStorageQueueMaxSi...
virtual void onOrderCancelReplaceReject(const Messaging::OrderCancelReplaceReject536 &, Session *)
First message received is not the NegotiationResponse or EstablishmentAck message.
virtual void onNegotiationReject(const Messaging::NegotiationReject502 &, Session *)
virtual void onMessageSending(char *, size_t, Session *)
Called when the SBE message is about to be sent to the wire.
virtual void onExecutionReportReject(const Messaging::ExecutionReportReject523 &, Session *)
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:175
virtual void onTerminate(const Messaging::Terminate507 &, Session *)
A message with unexpected UUID is received.
Represents a timestamp of the received data.
The value of the PreviousUUID field in the received Establishment Acknowledgment message does not mat...
virtual void onExecutionReportModify(const Messaging::ExecutionReportModify531 &, Session *)
virtual void onExecutionReportElimination(const Messaging::ExecutionReportElimination524 &, Session *)
virtual void onError(SessionErrorReason::Enum, const std::string &, Session *, Messaging::SbeMessage)
Called when an error condition is detected.
An exception is thrown from the user-provided Session Storage.
virtual void onOrderCancelReject(const Messaging::OrderCancelReject535 &, Session *)
virtual NotAppliedAction::Enum onNotApplied(const Messaging::NotApplied513 &, Session *)
Unexpected SBE Schema version is received from CME.
An exception is thrown from the user-provided Session Storage.
Raised when the KeepAliveInterval has expired and no keep alive message is received.
Exception was thrown from user&#39;s event handler.
Received an invalid incoming message.
The time point without the time-zone information.
Definition: Time.h:467
virtual void onExecutionReportTradeSpread(const Messaging::ExecutionReportTradeSpread526 &, Session *)
#define ONIXS_ILINK3_NOTHROW
Definition: Compiler.h:176
virtual void onExecutionReportStatus(const Messaging::ExecutionReportStatus532 &, Session *)
Telecommunication link error is detected.
The Negotiation Reject message is received in reply to the Negotiation message.
virtual void onStateChange(SessionStateId::Enum, SessionStateId::Enum, Session *)
Called when the session changes its state.
The Retransmit Reject message is received in reply to the Retransmit Request message.