OnixS C++ CME MDP Conflated TCP Handler  1.3.6
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 
25 
26 #include <string>
27 
28 namespace OnixS {
29 namespace CME {
30 namespace ConflatedTCP {
31 
32 ONIXS_CONFLATEDTCP_API_DECL(class, Session);
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 unsupported message type.
61  };
62 };
63 
64 /**
65  * Session Error Reason.
66  */
68 {
69  enum Enum
70  {
71  /// A general session-related error.
73 
74  /// First message received is not the <i>NegotiationResponse</i> or <i>EstablishmentAck</i> message.
76 
77  /// The <i>Negotiation Reject</i> message is received in reply to the <i>Negotiation</i> message.
79 
80  /// The <i>Establishment Reject</i> message is received in reply to the <i>Establish</i> message.
82 
83  /// The <i>Retransmit Reject</i> message is received in reply to the <i>Retransmit Request</i> message.
85 
86  /// The <i>Terminate</i> message is received in reply to the <i>Establish</i> message.
88 
89  /// The incoming message has a sequence number less than expected and the <i>PossDupFlag</i> is not
90  /// set, it indicates a serious error.
91  /// The incoming message has a sequence number less than expected and the <i>PossDupFlag</i> is not set, it
92  /// indicates a serious error. It is strongly recommended that the session be terminated and manual intervention
93  /// be initiated.
95 
96  /// Connection cannot be restored.
98 
99  /// Connection cannot be established.
101 
102  /// Exception during processing of an incoming message.
104 
105  /// Received an invalid incoming message.
107 
108  /// Exception was thrown from user's event handler.
110 
111  /// A response has not been received during the specified timeout.
113 
114  /// When two times the `KeepAliveInterval` has expired and no keep alive
115  /// message is received then the session is terminated ungracefully and will need to be re-established.
117 
118  /// Telecommunication link error is detected.
120 
121  /// After sending the initial Negotiate or Establish message the telecommunication link error is detected.
123 
124  /// Received an unexpected `NextSeqNo` value.
126 
127  /// The program is finishing its execution.
129 
130  /// The Exchange sent the initial Terminate message.
131  ExchangeInitiatedTerminateMessage
132  };
133 };
134 
135 /// Session's Listener.
137 {
138 public:
139  virtual void onNegotiationReject(const Messaging::NegotiationReject201 & /*msg*/, Session * /*sn*/) {}
140  virtual void onNegotiationResponse(const Messaging::NegotiationResponse202& /*msg*/, Session* /*sn*/) {}
141  virtual void onTerminate(const Messaging::Terminate203& /*msg*/, Session* /*sn*/) {}
142  virtual void onRequestAck(const Messaging::RequestAck206& /*msg*/, Session* /*sn*/) {}
143  virtual void onRequestReject(const Messaging::RequestReject207& /*msg*/, Session* /*sn*/) {}
144 
145  /// Called when the application-level message is sent to the counterparty.
146  virtual void onOutboundApplicationMsg(const Messaging::SbeMessage& /*msg*/, Session* /*sn*/) {}
147 
148  /// Called when the session-level message is sent to the counterparty.
149  virtual void onOutboundSessionMsg(const Messaging::SbeMessage& /*msg*/, Session * /*sn*/) {}
150 
151  /// Called as soon as bytes are received from the wire.
152  virtual void onReceivedBytes(const char * /*bytes*/, size_t /*size*/, Session * /*sn*/) {}
153 
154  /// Called when the SBE message is about to be sent to the wire.
155  virtual void onMessageSending(char * /*bytes*/, size_t /*size*/, Session * /*sn*/) {}
156 
157  /// Called when the session changes its state.
158  virtual void onStateChange(SessionStateId::Enum /*newState*/, SessionStateId::Enum /*prevState*/, Session * /*sn*/) {}
159 
160  /// Called when an error condition is detected.
161  virtual void onError(SessionErrorReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/) {}
162 
163  /// Called when a warning condition is detected.
164  virtual void onWarning(SessionWarningReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/) {}
165 
166  protected:
167  virtual ~SessionListener() = 0;
168 };
169 
170 }
171 }
172 }
virtual void onError(SessionErrorReason::Enum, const std::string &, Session *)
Called when an error condition is detected.
Unexpected SBE Schema version is received from CME.
The incoming message has a sequence number less than expected and the PossDupFlag is not set...
An Conflated TCP Session.
Definition: Session.h:38
virtual void onWarning(SessionWarningReason::Enum, const std::string &, Session *)
Called when a warning condition is detected.
virtual void onReceivedBytes(const char *, size_t, Session *)
Called as soon as bytes are received from the wire.
The Establishment Reject message is received in reply to the Establish message.
#define ONIXS_CONFLATEDTCP_API_DECL(typeKind, typeName)
Definition: ABI.h:29
virtual void onOutboundApplicationMsg(const Messaging::SbeMessage &, Session *)
Called when the application-level message is sent to the counterparty.
virtual void onMessageSending(char *, size_t, Session *)
Called when the SBE message is about to be sent to the wire.
#define ONIXS_CONFLATEDTCP_EXPORTED
Definition: Compiler.h:175
virtual void onOutboundSessionMsg(const Messaging::SbeMessage &, Session *)
Called when the session-level message is sent to the counterparty.
The value of the PreviousUUID field in the received Establishment Acknowledgment message does not mat...
Definition: Defines.h:40
virtual void onNegotiationReject(const Messaging::NegotiationReject201 &, Session *)
When two times the KeepAliveInterval has expired and no keep alive message is received then the sessi...
A response has not been received during the specified timeout.
virtual void onStateChange(SessionStateId::Enum, SessionStateId::Enum, Session *)
Called when the session changes its state.
virtual void onRequestReject(const Messaging::RequestReject207 &, Session *)
After sending the initial Negotiate or Establish message the telecommunication link error is detected...
Exception was thrown from user&#39;s event handler.
virtual void onNegotiationResponse(const Messaging::NegotiationResponse202 &, Session *)
virtual void onRequestAck(const Messaging::RequestAck206 &, Session *)
The Negotiation Reject message is received in reply to the Negotiation message.
virtual void onTerminate(const Messaging::Terminate203 &, Session *)
The Terminate message is received in reply to the Establish message.
First message received is not the NegotiationResponse or EstablishmentAck message.
Received the Sequence message with the Lapsed value of the KeepAliveIntervalLapsed field...
The Retransmit Reject message is received in reply to the Retransmit Request message.