OnixS C++ FIX Engine  4.12.0
API Documentation
IEngineListener.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 
24 #include <OnixS/FIXEngine/ABI.h>
26 
27 namespace OnixS {
28 namespace FIX {
29 ONIXS_FIXENGINE_API_DECL(class, FlatMessage);
30 ONIXS_FIXENGINE_API_DECL(class, Session);
31 
32 /// The warning reason.
34  enum Enum {
35  /// The general system-related warning.
37 
38  /// The first message cannot be received during the timeout.
40 
41  /// A garbled message is received.
43 
44  /// The session state cannot be changed.
46 
47  /// The license expiration warning.
49  };
50 };
51 
52 /// The error reason.
54  enum Enum {
55  /// Cannot backup the file.
57 
58  /// An exception was thrown during the reading of the sent message.
60 
61  /// The general system-related error.
63 
64  /// The internal error, please contact support@onixs.biz to investigate the issue.
66 
67  /// The session state cannot be restored.
69 
70  /// Socket options cannot be set.
71  SetSocketOptionError
72  };
73 };
74 
75 /// The Engine's Listener.
77 {
78 public:
79  /// @note The FIX Engine does NOT manage the lifetime of this listener.
81 
82  /// Called when an unknown incoming FIX connection is detected.
83  ///
84  /// To accept the connection, a dynamic new session may be created in scope of this callback with an appropriate
85  /// TargetCompID, SenderCompID and FIX version/dialect.
86  /// This dynamically created session should be logon as an acceptor otherwise the incoming connection will be rejected.
87  ///
88  /// If the dynamic session will not be created, the incoming FIX connection will be rejected, and the rejectReason could be specified then the Logout(5) message will be sent to the counterparty.
89  ///
90  /// @param[in] incomingLogon The incoming Logon message. In general it is needed to examine the content and properties of this message
91  /// to create an appropriate acceptor.
92  ///
93  /// @param[in] listenPort The listen port.
94  ///
95  /// @param[in] counterpartyPort The counterparty port.
96  ///
97  /// @param[in] counterpartyIpAddress The counterparty IP address.
98  ///
99  /// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
100  virtual void onUnknownIncomingConnection(const FlatMessage & incomingLogon, const int listenPort,
101  const int counterpartyPort, const std::string & counterpartyIpAddress,
102  std::string * rejectReason) = 0;
103 
104  /// Called when an incoming FIX connection is detected.
105  ///
106  /// If the rejectReason is set, the incoming FIX connection will be rejected, and the Logout(5) message will be sent to the counterparty.
107  ///
108  /// @param[in] incomingLogon The incoming Logon message.
109  ///
110  /// @param[in] listenPort The listen port.
111  ///
112  /// @param[in] counterpartyPort The counterparty port.
113  ///
114  /// @param[in] counterpartyIpAddress The counterparty IP address.
115  ///
116  /// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
117  virtual void onIncomingConnection(ONIXS_FIXENGINE_UNUSED const FlatMessage & incomingLogon, ONIXS_FIXENGINE_UNUSED const int listenPort,
118  ONIXS_FIXENGINE_UNUSED const int counterpartyPort, ONIXS_FIXENGINE_UNUSED const std::string & counterpartyIpAddress,
119  ONIXS_FIXENGINE_UNUSED std::string * rejectReason) {};
120 
121  /// Called when an incoming TCP connection is detected.
122  ///
123  /// If the rejectReason is set, the incoming TCP connection will be rejected.
124  ///
125  /// @param[in] listenPort The listen port.
126  ///
127  /// @param[in] counterpartyPort The counterparty port.
128  ///
129  /// @param[in] counterpartyIpAddress The counterparty IP address.
130  ///
131  /// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
132  virtual void onIncomingTelecommunicationLink(ONIXS_FIXENGINE_UNUSED const int listenPort, ONIXS_FIXENGINE_UNUSED const int counterpartyPort,
133  ONIXS_FIXENGINE_UNUSED const std::string & counterpartyIpAddress, ONIXS_FIXENGINE_UNUSED std::string * rejectReason) {};
134 
135  /// Called when an error is detected.
136  ///
137  /// @param[in] reason The error reason.
138  ///
139  /// @param[in] description The error description.
140  virtual void onError(EngineErrorReason::Enum reason, const std::string & description) = 0;
141 
142  /// Called when a warning is detected.
143  ///
144  /// @param[in] reason The warning reason.
145  ///
146  /// @param[in] description The warning description.
147  virtual void onWarning(EngineWarningReason::Enum reason, const std::string & description) = 0;
148 };
149 }
150 }
The session state cannot be restored.
The general system-related warning.
The general system-related error.
The Engine&#39;s Listener.
virtual void onIncomingTelecommunicationLink(ONIXS_FIXENGINE_UNUSED const int listenPort, ONIXS_FIXENGINE_UNUSED const int counterpartyPort, ONIXS_FIXENGINE_UNUSED const std::string &counterpartyIpAddress, ONIXS_FIXENGINE_UNUSED std::string *rejectReason)
Called when an incoming TCP connection is detected.
#define ONIXS_FIXENGINE_DEFAULT
Definition: Compiler.h:176
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
An exception was thrown during the reading of the sent message.
#define ONIXS_FIXENGINE_UNUSED
Definition: Compiler.h:128
Provides an access to FIX fields from a flat (tag=value) message.
Definition: FlatMessage.h:109
The first message cannot be received during the timeout.
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
The internal error, please contact support@onixs.biz to investigate the issue.
virtual void onIncomingConnection(ONIXS_FIXENGINE_UNUSED const FlatMessage &incomingLogon, ONIXS_FIXENGINE_UNUSED const int listenPort, ONIXS_FIXENGINE_UNUSED const int counterpartyPort, ONIXS_FIXENGINE_UNUSED const std::string &counterpartyIpAddress, ONIXS_FIXENGINE_UNUSED std::string *rejectReason)
Called when an incoming FIX connection is detected.