OnixS C++ Euronext Optiq MDG Handler  1.3.1
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 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 <sstream>
27 #include <string>
28 #include <set>
29 #include <vector>
30 
31 namespace OnixS
32 {
33  namespace Euronext
34  {
35  namespace MarketData
36  {
37  namespace OptiqMdg
38  {
39  /// Service endpoint description
41  {
42  ///
44  : port (0)
45  {}
46 
47  ///
48  ServiceDescriptor (const std::string& a, unsigned int port)
49  : address (a)
50  , port (port)
51  {}
52 
53  /// Ip address
54  std::string address;
55 
56  /// Port number
57  unsigned port;
58 
59  /// Compares with another instance.
60  bool operator == (const ServiceDescriptor& other) const
61  {
62  return address == other.address && port == other.port;
63  }
64 
65  /// Compares with another instance.
66  bool operator != (const ServiceDescriptor& other) const
67  {
68  return !operator==(other);
69  }
70 
71  /// Returns true if the descriptor points to valid ip address
72  bool valid() const
73  {
74  return !address.empty() && port > 0;
75  }
76  };
77 
78  ONIXS_EURONEXT_OPTIQMDG_API std::ostream& operator << (std::ostream& stream, const ServiceDescriptor& descriptor);
79 
80  /// Feed descriptor
82  {
83  /// Service A
85 
86  /// Service B
88 
89  /// Compares with another instance.
90  bool operator == (const FeedDescriptor& other) const
91  {
92  return serviceA == other.serviceA && serviceB == other.serviceB;
93  }
94 
95  /// Compares with another instance.
96  bool operator != (const FeedDescriptor& other) const
97  {
98  return !operator==(other);
99  }
100  };
101 
102  ONIXS_EURONEXT_OPTIQMDG_API std::ostream& operator << (std::ostream& stream, const FeedDescriptor& descriptor);
103 
104  /// Alias for symbol list
105  typedef std::set<std::string> Symbols;
106 
107  struct HandlerSettings;
108 
109  ONIXS_EURONEXT_OPTIQMDG_API std::ostream& operator << (std::ostream& stream, const HandlerSettings& settings);
110 
111  /// Handler configuration settings.
113  {
114  /// Constructor.
116  : licenseString("")
117  , licenseDirectory("")
118  , logDirectory("logs")
119  , logFileNamePrefix("EuronextOptiqMdg")
120  , logSettings(LogSettings::Default)
121  , logLevel(LogLevel::Info)
122  , logFilePermissions(LogFilePermission::Default)
123  , heartbeatInterval(3)
124  , outOfOrderPacketMaxInterval(3)
125  , lostPacketWaitTime(100000)
126  , useFeedA(true)
127  , useFeedB(true)
128  , maxPacketSize(1400)
129  {}
130 
131  /// License string.
132  std::string licenseString;
133 
134  /// Path to the license directory.
135  std::string licenseDirectory;
136 
137  /// Log files are stored in this directory.
138  std::string logDirectory;
139 
140  /// Template of log file name without extension.
141  std::string logFileNamePrefix ;
142 
143  /// Combine LogSettings enum values to configure the logger.
145 
146  /// Log verbosity.
147  ///
148  /// @note The default value is LogLevel::Info
150 
151  /// Log file permissions.
152  ///
153  /// @note The default value is ReadAll | WriteOwnerOnly
155 
156  /**
157  * Specifies one or more network interfaces to use while joining the multicast group; use semi-colon delimited list if more than one.
158  *
159  * On Linux the network interfaces is specified by its name, on Windows - by IP address.
160  *
161  * @note If the value is empty or absent then the default networking interface is used.
162  */
163  std::string networkInterface;
164 
165  /**
166  * Specifies one or more network interfaces to use while joining the multicast group A; use semi-colon delimited list if more than one.
167  *
168  * On Linux the network interfaces is specified by its name, on Windows - by IP address.
169  *
170  * @note If the value is empty or absent then the networkInterface_ filled value is used.
171  */
172  std::string networkInterfaceA;
173 
174  /**
175  * Specifies one or more network interfaces to use while joining the multicast group B; use semi-colon delimited list if more than one.
176  *
177  * On Linux the network interfaces is specified by its name, on Windows - by IP address.
178  *
179  * @note If the value is empty or absent then the networkInterface_ filled value is used.
180  */
181  std::string networkInterfaceB;
182 
183  /// Specifies maximal time interval between two
184  /// network packets. If no data is received during
185  /// specified time frame, corresponding warning is raised.
186  ///
187  /// Interval is measured in seconds.
188  ///
189  /// @note The default value is '3'.
191 
192  /// Defines value of threshold used by Handler to differ
193  /// out-of-order packets from gaps.
194  ///
195  /// Due to unreliable nature of multicast, packets transmitted by exchange
196  /// may be received in the order different to original. To differ the
197  /// case when Handler received out-of-order packets from the case when
198  /// some of packets were completely lost, Handler uses given parameter.
199  /// It defines size of interval for incoming packets starting from the
200  /// last received. Packet is considered as out-of-order if its sequence
201  /// number fits into interval [seqNumberOfLastReceivedPacket,
202  /// seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval].
203  /// In that case Handler waits for other packets to fulfill the incoming
204  /// sequence. If received packet has greater sequence number than
205  /// 'seqNumberOfLastReceivedPacket + outOfOrderPacketsMaxInterval',
206  /// then Handler makes a decision on packets lost and gap is reported.
207  ///
208  /// @note When out-of-order packet is received, Handler makes a decision
209  /// on data loss if either waiting time is over or if newly received packet
210  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
211  /// outOfOrderPacketMaxInterval'.
212  ///
213  /// @see 'lostPacketWaitTime' parameter for more information.
214  ///
215  /// @note The default value is '3'.
217 
218  /// Indicates for how long Handler should wait for
219  /// the packet before it's considered as totally lost.
220  ///
221  /// Due to unreliable nature of multicast, data transmitted by MDP
222  /// may come in order other than original or be completely lost. When
223  /// Handler receives packet with sequence number greater than expected,
224  /// it considers received data as out-of-order. If for a certain time
225  /// interval Handler receives missing data, Handler resumes normal data
226  /// processing. However, if no data is received for predefined time frame,
227  /// Handler considers missing data as lost and raises packet gap event.
228  /// Given parameter defines size of time interval Handler waits for missing
229  /// data.
230  ///
231  /// @note When out-of-order packet is received, Handler makes a decision
232  /// on data loss if either waiting time is over or if newly received packet
233  /// has sequence number greater than 'seqNumberOfLastReceivedPacket +
234  /// outOfOrderPacketMaxInterval'.
235  ///
236  /// @see 'outOfOrderPacketMaxInterval' parameter for more information.
237  ///
238  /// Time interval is measured in microseconds (uSec).
239  ///
240  /// @note The default value is '100000' (100 milliseconds).
242 
243  /// Option to use feed A.
244  ///
245  /// @note The default value is 'true'.
246  bool useFeedA;
247 
248  /// Option to use feed B.
249  ///
250  /// @note The default value is 'true'.
251  bool useFeedB;
252 
253  /// Realtime feed
255 
256  /// Snapshot feed
258 
259  /// Max size for network packet transmitted by Euronext Optiq MDG.
260  ///
261  /// @note The default value is 1400 bytes.
262  unsigned short maxPacketSize;
263 
264  /// Returns the string representation.
265  std::string toString() const
266  {
267  std::ostringstream out;
268  out << *this;
269  return out.str();
270  }
271  };
272  }
273  }
274  }
275 }
ServiceDescriptor(const std::string &a, unsigned int port)
std::string networkInterfaceB
Specifies one or more network interfaces to use while joining the multicast group B; use semi-colon d...
bool valid() const
Returns true if the descriptor points to valid ip address.
std::string networkInterfaceA
Specifies one or more network interfaces to use while joining the multicast group A; use semi-colon d...
bool operator!=(const ServiceDescriptor &other) const
Compares with another instance.
LogFilePermission::Enum logFilePermissions
Log file permissions.
UInt32 lostPacketWaitTime
Indicates for how long Handler should wait for the packet before it&#39;s considered as totally lost...
UInt32 heartbeatInterval
Specifies maximal time interval between two network packets.
LogSettings::Enum logSettings
Combine LogSettings enum values to configure the logger.
UInt32 outOfOrderPacketMaxInterval
Defines value of threshold used by Handler to differ out-of-order packets from gaps.
Definition: Handler.h:26
std::string networkInterface
Specifies one or more network interfaces to use while joining the multicast group; use semi-colon del...
std::string logFileNamePrefix
Template of log file name without extension.
std::string toString() const
Returns the string representation.
std::set< std::string > Symbols
Alias for symbol list.
unsigned short maxPacketSize
Max size for network packet transmitted by Euronext Optiq MDG.
std::string licenseDirectory
Path to the license directory.
std::string logDirectory
Log files are stored in this directory.
ONIXS_EURONEXT_OPTIQMDG_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
bool operator==(const ServiceDescriptor &other) const
Compares with another instance.