OnixS C++ FIX Engine 4.14.0
Users' manual and API documentation
Loading...
Searching...
No Matches
ISessionListener.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 <string>
23
28
29namespace OnixS {
30namespace FIX {
34
64
87
91{
92public:
93
94 enum Source
95 {
98
101
104 };
105
106 ReceivedDataTimestamp():timestamp_(), source_(Source::None) { }
107
109
111 const Timestamp & timestamp() const
112 {
113 return timestamp_;
114 }
115
118 {
119 return source_;
120 }
121
123 std::string toString() const
124 {
125 const std::string TimeStr = timestamp_.toString();
126 std::string str = "ReceivedDataTimestamp [source = ";
127
128 if(source_ == ReceivedDataTimestamp::None)
129 str += "None";
130 else if(source_ == ReceivedDataTimestamp::Software)
131 str += "Software, time = " + TimeStr;
132 else if (source_ == ReceivedDataTimestamp::Hardware)
133 str += "Hardware, time = " + TimeStr;
134 else
135 str += "Unknown";
136
137 str += "]";
138 return str;
139 }
140
141private:
142
144 Timestamp timestamp_;
145 Source source_;
146};
147
150{
151public:
153 virtual ~ISessionListener() = default;
154
158 virtual void onInboundApplicationMsg(Message & message, Session * session) = 0;
159
164
167 virtual void onInboundSessionMsg(Message & , Session * ) {}
168
172
185
197 virtual void onOutboundSessionMsg(Message & , Session * ) {}
198
200 virtual void onReceivedBytes(const char * , size_t , const ReceivedDataTimestamp & , Session* ) {}
201
208 virtual void onMessageSending(SequenceNumber , char * , size_t , Session * ) {}
209
212
223 virtual bool onResendRequest(Message & , Session * ) { return false; }
224
235 virtual bool onResendRequest(FlatMessage & , Session * ) { return false; }
236
238 virtual void onResendingStarted(SequenceNumber /*beginSeqNo*/, SequenceNumber /*endSeqNo*/, Session* ) {}
239
241 virtual void onResendingFinished(SequenceNumber /*beginSeqNo*/, SequenceNumber /*endSeqNo*/, Session* ) {}
242
249 virtual void onError(ErrorReason::Enum , const std::string & , Session * ) {}
250
256 virtual void onWarning(WarningReason::Enum , const std::string & , Session * ) {}
257};
258}
259}
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
Receives synchronous session callbacks; see Callback Safety for restrictions and data lifetime.
virtual void onInboundApplicationMsg(FlatMessage &, Session *)
virtual void onError(ErrorReason::Enum, const std::string &, Session *)
virtual ~ISessionListener()=default
virtual bool onResendRequest(FlatMessage &, Session *)
virtual void onReceivedBytes(const char *, size_t, const ReceivedDataTimestamp &, Session *)
Is called as soon as bytes are received from the wire.
virtual void onOutboundApplicationMsg(Message &, Session *)
virtual void onInboundSessionMsg(FlatMessage &, Session *)
virtual void onMessageSending(SequenceNumber, char *, size_t, Session *)
virtual void onStateChange(SessionState::Enum, SessionState::Enum, Session *)
Is called when the session changes its state.
virtual void onOutboundSessionMsg(Message &, Session *)
virtual void onResendingStarted(SequenceNumber, SequenceNumber, Session *)
Is called when the ResendRequest<2> message is received and the session is about to start to resend m...
virtual void onInboundSessionMsg(Message &, Session *)
virtual void onWarning(WarningReason::Enum, const std::string &, Session *)
virtual void onInboundApplicationMsg(Message &message, Session *session)=0
virtual void onResendingFinished(SequenceNumber, SequenceNumber, Session *)
Is called when the resending process is completed.
virtual bool onResendRequest(Message &, Session *)
@ Software
Timestamp provided by the OS kernel / user-level network stack.
@ Hardware
Timestamp provided by the network card.
@ None
No timestamp available.
std::string toString() const
Returns a human-readable presentation.
ReceivedDataTimestamp(const Timestamp &timestamp, Source source)
const Timestamp & timestamp() const
Returns the received data timestamp.
Source source() const
Returns the source of the received data timestamp.
The timestamps related functionality.
Definition Timestamp.h:92
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
unsigned int SequenceNumber
Alias for the sequence number.
@ SetSocketOptionError
Socket options cannot be set.
@ ExceptionInEventHandler
An exception was thrown in the client event handler implementation.
@ CannotRestoreConnection
The FIX Connection cannot be restored.
@ GeneralError
The general system-related error.
@ FirstMessageNotALogon
The first message received is not a Logon message.
@ InvalidIncomingMessage
The FIX message received is not valid.
@ ExceptionDuringProcessingOfIncomingMessage
An exception was thrown during processing of the incoming message.
@ SeqGapIsDetected
The sequence gap in the incoming messages is detected.
@ ResendTimeout
The ResendTimeout is elapsed.
@ CannotConnect
Cannot re-establish the FIX Connection after the reconnect attempt.
@ GarbledMessageReceived
A garbled message is received.
@ LinkError
The telecommunication link error is detected.
@ GeneralWarning
The general system-related warning.