OnixS Eurex ETI Handler C++ library  9.20.0
API documentation
HandlerSettings.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
13  * part of this source code or associated reference material to any other location for further
14  * reproduction or redistribution, and any amendments to this copyright notice, are expressly
15  * prohibited.
16  *
17  * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18  * the terms of the Agreement is a violation of copyright law.
19  */
20 
21 #pragma once
22 
23 #include "OnixS/Eurex/Trading/Export.h"
25 
26 #include <set>
27 
28 namespace OnixS { namespace Eurex { namespace Trading {
29 
30 /// Connection retries settings.
31 struct ONIXS_EUREX_ETI_EXPORT ConnectionRetries
32 {
33  /// Default constructor.
35  : number(0)
36  , interval(0)
37  {
38  }
39 
40  /// Copy constructor.
42  : number(other.number)
43  , interval(other.interval)
44  {
45  }
46 
47  /// Constructor.
48  ConnectionRetries(int inNumber, unsigned inInterval)
49  : number(inNumber)
50  , interval(inInterval)
51  {
52  }
53 
54  /// Number of attempts to restore the telecommunication link.
55  /// -1 - unlimited
56  /// 0 - never (default)
57  /// >0 - the number of attempts
58  int number;
59 
60  /// The time interval between the attempts to restore the telecommunication link (in seconds).
61  ///
62  /// \note The default value is 0 (zero).
63  unsigned int interval;
64 
65  /// Returns the string representation.
66  std::string toString() const;
67 };
68 
69 ONIXS_EUREX_ETI_EXPORT std::ostream& operator<<(std::ostream&, const ConnectionRetries&);
70 
71 /// Logical processors that a thread is allowed to run on (first logical CPU has index 0).
72 typedef std::set<size_t> CpuIndexes;
73 
74 /// Audit trail mode.
75 struct ONIXS_EUREX_ETI_EXPORT AuditTrailMode
76 {
77  /// \copydoc AuditTrailMode
78  enum Enum
79  {
80  /// Human-readable text representation.
82 
83  /// Compact form for further processing using
84  /// \link OnixS::Eurex::Trading::AuditTrail::Reader Reader\endlink.
86  };
87 };
88 
89 /// Returns string representation.
90 ONIXS_EUREX_ETI_EXPORT std::string enumToString(AuditTrailMode::Enum);
91 
92 /// Handler settings.
93 struct ONIXS_EUREX_ETI_EXPORT HandlerSettings
94 {
95  /// Constructor.
97 
98  /// Copy constructor.
99  HandlerSettings(const HandlerSettings&);
100 
101  /**
102  * Content of the license file as a string.
103  *
104  * \note Default value is empty string.
105  * \note The Handler checks this license first.
106  */
107  std::string licenseString;
108 
109  /// Path to the license directory.
110  ///
111  /// \note The default value is empty string (means current directory).
112  std::string licenseDirectory;
113 
114  /// Log files are stored in this directory.
115  ///
116  /// \note The default value is "logs".
117  std::string logDirectory;
118 
119  /// Template of log file name without extension.
120  ///
121  /// \note The default value is "EurexEtiTradingHandlerCpp".
122  std::string logFileNamePrefix;
123 
124  /// Combine LogSettings enum values to configure the logger.
125  ///
126  /// \note The default value is LogSettings::Default.
128 
129  /// Log verbosity.
130  ///
131  /// \note The default value is LogLevel::Info.
133 
134  /// Receiving timeout in milliseconds.
135  ///
136  /// \note The default value is 2 seconds (2000 ms).
138 
139  /// Sending timeout in milliseconds.
140  ///
141  /// \note The default value is 2 seconds (2000 ms).
143 
144  /// CPU affinity of the receiving thread.
146 
147  /// CPU affinity of the receiving thread.
149 
150  /// CPU affinity of the audit-trail thread.
152 
153  /// Connection retries configuration settings.
154  ///
155  /// \see ConnectionRetries.
157 
158  /// Audit Trail files are stored in this directory.
159  ///
160  /// \note The default value is empty string.
161  std::string auditTrailDirectory;
162 
163  /// \deprecated Please use \link
164  /// OnixS::Eurex::Trading::HandlerSettings::auditTrailFileNamePrefix
165  /// auditTrailFileNamePrefix\endlink instead of this deprecated field.
166  std::string auditTrailFile;
167 
168  /// Template of Audit Trail file name without extension.
169  ///
170  /// Creates Audit Trail file that contains all messages that Handler sent or received (in the
171  /// chronological order).
172  ///
173  /// \note The default value is empty string (means no audit trail files required).
175 
176  /// Audit Trail mode.
177  ///
178  /// \note By default it's Text.
180 
181  /// Throttle message margin. Transaction limit will be reduced by this value.
182  ///
183  /// For example, if Eurex notify that transaction limit is 20 messages and
184  /// this Handler's setting isn't changed (by default value is 3), then
185  /// transaction limit for Handler is 20 - 3 = 17 messages.
186  ///
187  /// \note By default it's 3.
189 
190  /// This flag is used to control the Handler's
191  /// behavior when a connection is not able to
192  /// receive data from a network.
193  ///
194  /// Absence of data could be caused by network or
195  /// exchange issues. If server stopped sending
196  /// data due to internal issues but underlying
197  /// TCP connection is not broken, it could make
198  /// sense to switch to manual control and use
199  /// this option.
200  ///
201  /// By default, the Handler will call error
202  /// callback and restart the connection.
203  /// If this flag is set to \c true, only
204  /// warning callback will be called and
205  /// the Handler continue to work.
206  ///
207  /// \note By default it's \c false.
209 
210  /// This flag is used to control the Handler's
211  /// behavior whether to scramble passwords in
212  /// the log and audit files.
213  ///
214  /// \note By default it's \c false.
216 
217  /// Reasonable transmission time.
218  /// This option controls the percentage from the heartbeat interval.
219  ///
220  /// \note By default it's 20.
222 
223  /// Is SSL enabled for the connection to exchange?
224  ///
225  /// \note By default it's \c false.
227 
228  /// Returns the string representation.
229  std::string toString() const;
230 };
231 
232 ONIXS_EUREX_ETI_EXPORT std::ostream& operator<<(std::ostream&, const HandlerSettings&);
233 
234 }}} // namespace OnixS::Eurex::Trading
Human-readable text representation.
CpuIndexes receivingThreadAffinity
CPU affinity of the receiving thread.
ConnectionRetries(int inNumber, unsigned inInterval)
Constructor.
CpuIndexes auditTrailThreadAffinity
CPU affinity of the audit-trail thread.
Connection retries settings.
std::set< size_t > CpuIndexes
Logical processors that a thread is allowed to run on (first logical CPU has index 0)...
std::ostream & operator<<(std::ostream &, const ConnectionStateChange &)
Make it printable to formatted C++ I/O streams.
ConnectionRetries(const ConnectionRetries &other)
Copy constructor.
std::string enumToString(ConnectionState::Enum)
Returns string representation of ConnectionState value.
CpuIndexes sendingThreadAffinity
CPU affinity of the receiving thread.