quickfix_ruby_ud 2.0.7-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/ext/quickfix/Acceptor.cpp +257 -0
  3. data/ext/quickfix/Acceptor.h +127 -0
  4. data/ext/quickfix/Allocator.h +9 -0
  5. data/ext/quickfix/Application.h +137 -0
  6. data/ext/quickfix/DOMDocument.h +70 -0
  7. data/ext/quickfix/DataDictionary.cpp +679 -0
  8. data/ext/quickfix/DataDictionary.h +607 -0
  9. data/ext/quickfix/DataDictionaryProvider.cpp +66 -0
  10. data/ext/quickfix/DataDictionaryProvider.h +67 -0
  11. data/ext/quickfix/DatabaseConnectionID.h +98 -0
  12. data/ext/quickfix/DatabaseConnectionPool.h +84 -0
  13. data/ext/quickfix/Dictionary.cpp +157 -0
  14. data/ext/quickfix/Dictionary.h +89 -0
  15. data/ext/quickfix/Event.h +89 -0
  16. data/ext/quickfix/Except.h +39 -0
  17. data/ext/quickfix/Exceptions.h +257 -0
  18. data/ext/quickfix/Field.h +654 -0
  19. data/ext/quickfix/FieldConvertors.cpp +86 -0
  20. data/ext/quickfix/FieldConvertors.h +800 -0
  21. data/ext/quickfix/FieldMap.cpp +254 -0
  22. data/ext/quickfix/FieldMap.h +327 -0
  23. data/ext/quickfix/FieldNumbers.h +44 -0
  24. data/ext/quickfix/FieldTypes.cpp +62 -0
  25. data/ext/quickfix/FieldTypes.h +817 -0
  26. data/ext/quickfix/Fields.h +30 -0
  27. data/ext/quickfix/FileLog.cpp +176 -0
  28. data/ext/quickfix/FileLog.h +110 -0
  29. data/ext/quickfix/FileStore.cpp +369 -0
  30. data/ext/quickfix/FileStore.h +131 -0
  31. data/ext/quickfix/FixCommonFields.h +13 -0
  32. data/ext/quickfix/FixFieldNumbers.h +6132 -0
  33. data/ext/quickfix/FixFields.h +6133 -0
  34. data/ext/quickfix/FixValues.h +5790 -0
  35. data/ext/quickfix/Group.cpp +44 -0
  36. data/ext/quickfix/Group.h +78 -0
  37. data/ext/quickfix/HostDetailsProvider.cpp +79 -0
  38. data/ext/quickfix/HostDetailsProvider.h +44 -0
  39. data/ext/quickfix/HtmlBuilder.h +178 -0
  40. data/ext/quickfix/HttpConnection.cpp +914 -0
  41. data/ext/quickfix/HttpConnection.h +74 -0
  42. data/ext/quickfix/HttpMessage.cpp +229 -0
  43. data/ext/quickfix/HttpMessage.h +112 -0
  44. data/ext/quickfix/HttpParser.cpp +49 -0
  45. data/ext/quickfix/HttpParser.h +49 -0
  46. data/ext/quickfix/HttpServer.cpp +152 -0
  47. data/ext/quickfix/HttpServer.h +76 -0
  48. data/ext/quickfix/Initiator.cpp +310 -0
  49. data/ext/quickfix/Initiator.h +151 -0
  50. data/ext/quickfix/Log.cpp +71 -0
  51. data/ext/quickfix/Log.h +254 -0
  52. data/ext/quickfix/Message.cpp +617 -0
  53. data/ext/quickfix/Message.h +419 -0
  54. data/ext/quickfix/MessageCracker.h +171 -0
  55. data/ext/quickfix/MessageSorters.cpp +101 -0
  56. data/ext/quickfix/MessageSorters.h +185 -0
  57. data/ext/quickfix/MessageStore.cpp +182 -0
  58. data/ext/quickfix/MessageStore.h +164 -0
  59. data/ext/quickfix/Mutex.h +120 -0
  60. data/ext/quickfix/MySQLConnection.h +187 -0
  61. data/ext/quickfix/MySQLLog.cpp +262 -0
  62. data/ext/quickfix/MySQLLog.h +158 -0
  63. data/ext/quickfix/MySQLStore.cpp +323 -0
  64. data/ext/quickfix/MySQLStore.h +161 -0
  65. data/ext/quickfix/MySQLStubs.h +203 -0
  66. data/ext/quickfix/NullStore.cpp +40 -0
  67. data/ext/quickfix/NullStore.h +89 -0
  68. data/ext/quickfix/OdbcConnection.h +241 -0
  69. data/ext/quickfix/OdbcLog.cpp +230 -0
  70. data/ext/quickfix/OdbcLog.h +109 -0
  71. data/ext/quickfix/OdbcStore.cpp +313 -0
  72. data/ext/quickfix/OdbcStore.h +124 -0
  73. data/ext/quickfix/PUGIXML_DOMDocument.cpp +112 -0
  74. data/ext/quickfix/PUGIXML_DOMDocument.h +81 -0
  75. data/ext/quickfix/Parser.cpp +111 -0
  76. data/ext/quickfix/Parser.h +50 -0
  77. data/ext/quickfix/PostgreSQLConnection.h +163 -0
  78. data/ext/quickfix/PostgreSQLLog.cpp +263 -0
  79. data/ext/quickfix/PostgreSQLLog.h +157 -0
  80. data/ext/quickfix/PostgreSQLStore.cpp +327 -0
  81. data/ext/quickfix/PostgreSQLStore.h +160 -0
  82. data/ext/quickfix/PostgreSQLStubs.h +203 -0
  83. data/ext/quickfix/Queue.h +66 -0
  84. data/ext/quickfix/QuickfixRuby.cpp +131900 -0
  85. data/ext/quickfix/QuickfixRuby.h +56 -0
  86. data/ext/quickfix/Responder.h +41 -0
  87. data/ext/quickfix/SSLSocketAcceptor.cpp +409 -0
  88. data/ext/quickfix/SSLSocketAcceptor.h +186 -0
  89. data/ext/quickfix/SSLSocketConnection.cpp +434 -0
  90. data/ext/quickfix/SSLSocketConnection.h +221 -0
  91. data/ext/quickfix/SSLSocketInitiator.cpp +558 -0
  92. data/ext/quickfix/SSLSocketInitiator.h +203 -0
  93. data/ext/quickfix/SSLStubs.h +129 -0
  94. data/ext/quickfix/Session.cpp +1437 -0
  95. data/ext/quickfix/Session.h +343 -0
  96. data/ext/quickfix/SessionFactory.cpp +314 -0
  97. data/ext/quickfix/SessionFactory.h +84 -0
  98. data/ext/quickfix/SessionID.h +136 -0
  99. data/ext/quickfix/SessionSettings.cpp +165 -0
  100. data/ext/quickfix/SessionSettings.h +283 -0
  101. data/ext/quickfix/SessionState.h +260 -0
  102. data/ext/quickfix/Settings.cpp +160 -0
  103. data/ext/quickfix/Settings.h +56 -0
  104. data/ext/quickfix/SharedArray.h +274 -0
  105. data/ext/quickfix/SocketAcceptor.cpp +216 -0
  106. data/ext/quickfix/SocketAcceptor.h +77 -0
  107. data/ext/quickfix/SocketConnection.cpp +256 -0
  108. data/ext/quickfix/SocketConnection.h +102 -0
  109. data/ext/quickfix/SocketConnector.cpp +112 -0
  110. data/ext/quickfix/SocketConnector.h +76 -0
  111. data/ext/quickfix/SocketInitiator.cpp +241 -0
  112. data/ext/quickfix/SocketInitiator.h +76 -0
  113. data/ext/quickfix/SocketMonitor.h +26 -0
  114. data/ext/quickfix/SocketMonitor_UNIX.cpp +238 -0
  115. data/ext/quickfix/SocketMonitor_UNIX.h +101 -0
  116. data/ext/quickfix/SocketMonitor_WIN32.cpp +248 -0
  117. data/ext/quickfix/SocketMonitor_WIN32.h +99 -0
  118. data/ext/quickfix/SocketServer.cpp +163 -0
  119. data/ext/quickfix/SocketServer.h +100 -0
  120. data/ext/quickfix/ThreadedSSLSocketAcceptor.cpp +436 -0
  121. data/ext/quickfix/ThreadedSSLSocketAcceptor.h +209 -0
  122. data/ext/quickfix/ThreadedSSLSocketConnection.cpp +364 -0
  123. data/ext/quickfix/ThreadedSSLSocketConnection.h +191 -0
  124. data/ext/quickfix/ThreadedSSLSocketInitiator.cpp +434 -0
  125. data/ext/quickfix/ThreadedSSLSocketInitiator.h +193 -0
  126. data/ext/quickfix/ThreadedSocketAcceptor.cpp +242 -0
  127. data/ext/quickfix/ThreadedSocketAcceptor.h +95 -0
  128. data/ext/quickfix/ThreadedSocketConnection.cpp +227 -0
  129. data/ext/quickfix/ThreadedSocketConnection.h +89 -0
  130. data/ext/quickfix/ThreadedSocketInitiator.cpp +238 -0
  131. data/ext/quickfix/ThreadedSocketInitiator.h +78 -0
  132. data/ext/quickfix/TimeRange.cpp +227 -0
  133. data/ext/quickfix/TimeRange.h +215 -0
  134. data/ext/quickfix/Utility.cpp +639 -0
  135. data/ext/quickfix/Utility.h +255 -0
  136. data/ext/quickfix/UtilitySSL.cpp +1612 -0
  137. data/ext/quickfix/UtilitySSL.h +274 -0
  138. data/ext/quickfix/Values.h +63 -0
  139. data/ext/quickfix/config-all.h +10 -0
  140. data/ext/quickfix/config.h +10 -0
  141. data/ext/quickfix/config_unix.h +178 -0
  142. data/ext/quickfix/config_windows.h +0 -0
  143. data/ext/quickfix/dirent_windows.h +838 -0
  144. data/ext/quickfix/double-conversion/bignum-dtoa.cc +641 -0
  145. data/ext/quickfix/double-conversion/bignum-dtoa.h +84 -0
  146. data/ext/quickfix/double-conversion/bignum.cc +766 -0
  147. data/ext/quickfix/double-conversion/bignum.h +144 -0
  148. data/ext/quickfix/double-conversion/cached-powers.cc +176 -0
  149. data/ext/quickfix/double-conversion/cached-powers.h +64 -0
  150. data/ext/quickfix/double-conversion/diy-fp.cc +57 -0
  151. data/ext/quickfix/double-conversion/diy-fp.h +118 -0
  152. data/ext/quickfix/double-conversion/double-conversion.cc +994 -0
  153. data/ext/quickfix/double-conversion/double-conversion.h +543 -0
  154. data/ext/quickfix/double-conversion/fast-dtoa.cc +665 -0
  155. data/ext/quickfix/double-conversion/fast-dtoa.h +88 -0
  156. data/ext/quickfix/double-conversion/fixed-dtoa.cc +404 -0
  157. data/ext/quickfix/double-conversion/fixed-dtoa.h +56 -0
  158. data/ext/quickfix/double-conversion/ieee.h +402 -0
  159. data/ext/quickfix/double-conversion/strtod.cc +557 -0
  160. data/ext/quickfix/double-conversion/strtod.h +45 -0
  161. data/ext/quickfix/double-conversion/utils.h +374 -0
  162. data/ext/quickfix/extconf.rb +76 -0
  163. data/ext/quickfix/index.h +37 -0
  164. data/ext/quickfix/pugiconfig.hpp +77 -0
  165. data/ext/quickfix/pugixml.cpp +13237 -0
  166. data/ext/quickfix/pugixml.hpp +1516 -0
  167. data/ext/quickfix/scope_guard.hpp +215 -0
  168. data/ext/quickfix/stdint_msvc.h +254 -0
  169. data/ext/quickfix/strptime.h +7 -0
  170. data/lib/2.4/quickfix.so +0 -0
  171. data/lib/2.5/quickfix.so +0 -0
  172. data/lib/2.6/quickfix.so +0 -0
  173. data/lib/2.7/quickfix.so +0 -0
  174. data/lib/3.0/quickfix.so +0 -0
  175. data/lib/3.1/quickfix.so +0 -0
  176. data/lib/3.2/quickfix.so +0 -0
  177. data/lib/3.3/quickfix.so +0 -0
  178. data/lib/3.4/quickfix.so +0 -0
  179. data/lib/quickfix40.rb +274 -0
  180. data/lib/quickfix41.rb +351 -0
  181. data/lib/quickfix42.rb +1184 -0
  182. data/lib/quickfix43.rb +3504 -0
  183. data/lib/quickfix44.rb +14040 -0
  184. data/lib/quickfix50.rb +20051 -0
  185. data/lib/quickfix50sp1.rb +23596 -0
  186. data/lib/quickfix50sp2.rb +412444 -0
  187. data/lib/quickfix_fields.rb +79393 -0
  188. data/lib/quickfix_ruby.rb +82 -0
  189. data/lib/quickfixt11.rb +65 -0
  190. data/spec/FIX40.xml +862 -0
  191. data/spec/FIX41.xml +1282 -0
  192. data/spec/FIX42.xml +2743 -0
  193. data/spec/FIX43.xml +4230 -0
  194. data/spec/FIX44.xml +6600 -0
  195. data/spec/FIX50.xml +8142 -0
  196. data/spec/FIX50SP1.xml +9506 -0
  197. data/spec/FIX50SP2.xml +26069 -0
  198. data/spec/FIXT11.xml +252 -0
  199. data/test/DataDictionaryTestCase.rb +268 -0
  200. data/test/DictionaryTestCase.rb +112 -0
  201. data/test/FieldBaseTestCase.rb +24 -0
  202. data/test/MessageStoreTestCase.rb +19 -0
  203. data/test/MessageTestCase.rb +368 -0
  204. data/test/SessionSettingsTestCase.rb +41 -0
  205. metadata +247 -0
@@ -0,0 +1,419 @@
1
+ /* -*- C++ -*- */
2
+
3
+ /****************************************************************************
4
+ ** Copyright (c) 2001-2014
5
+ **
6
+ ** This file is part of the QuickFIX FIX Engine
7
+ **
8
+ ** This file may be distributed under the terms of the quickfixengine.org
9
+ ** license as defined by quickfixengine.org and appearing in the file
10
+ ** LICENSE included in the packaging of this file.
11
+ **
12
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14
+ **
15
+ ** See http://www.quickfixengine.org/LICENSE for licensing information.
16
+ **
17
+ ** Contact ask@quickfixengine.org if any conditions of this licensing are
18
+ ** not clear to you.
19
+ **
20
+ ****************************************************************************/
21
+
22
+ #ifndef FIX_MESSAGE
23
+ #define FIX_MESSAGE
24
+
25
+ #ifdef _MSC_VER
26
+ #pragma warning(disable : 4786)
27
+ #endif
28
+
29
+ #include "DataDictionary.h"
30
+ #include "FieldMap.h"
31
+ #include "Fields.h"
32
+ #include "Group.h"
33
+ #include "SessionID.h"
34
+ #include "Values.h"
35
+
36
+ #include <memory>
37
+ #include <vector>
38
+
39
+ namespace FIX {
40
+
41
+ class Header : public FieldMap {
42
+ enum {
43
+ REQUIRED_FIELDS = 8
44
+ };
45
+
46
+ public:
47
+ Header()
48
+ : FieldMap(message_order(message_order::header), REQUIRED_FIELDS) {}
49
+
50
+ Header(const message_order &order)
51
+ : FieldMap(order) {}
52
+
53
+ void addGroup(const FIX::Group &group) { FieldMap::addGroup(group.field(), group); }
54
+
55
+ void replaceGroup(unsigned num, const FIX::Group &group) { FieldMap::replaceGroup(num, group.field(), group); }
56
+
57
+ Group &getGroup(unsigned num, FIX::Group &group) const EXCEPT(FieldNotFound) {
58
+ group.clear();
59
+ return static_cast<Group &>(FieldMap::getGroup(num, group.field(), group));
60
+ }
61
+
62
+ void removeGroup(unsigned num, const FIX::Group &group) { FieldMap::removeGroup(num, group.field()); }
63
+ void removeGroup(const FIX::Group &group) { FieldMap::removeGroup(group.field()); }
64
+
65
+ bool hasGroup(const FIX::Group &group) const { return FieldMap::hasGroup(group.field()); }
66
+ bool hasGroup(unsigned num, const FIX::Group &group) const { return FieldMap::hasGroup(num, group.field()); }
67
+ };
68
+
69
+ class Trailer : public FieldMap {
70
+ enum {
71
+ REQUIRED_FIELDS = 1
72
+ };
73
+
74
+ public:
75
+ Trailer()
76
+ : FieldMap(message_order(message_order::trailer), REQUIRED_FIELDS) {}
77
+
78
+ Trailer(const message_order &order)
79
+ : FieldMap(order) {}
80
+
81
+ void addGroup(const FIX::Group &group) { FieldMap::addGroup(group.field(), group); }
82
+
83
+ void replaceGroup(unsigned num, const FIX::Group &group) { FieldMap::replaceGroup(num, group.field(), group); }
84
+
85
+ Group &getGroup(unsigned num, FIX::Group &group) const EXCEPT(FieldNotFound) {
86
+ group.clear();
87
+ return static_cast<Group &>(FieldMap::getGroup(num, group.field(), group));
88
+ }
89
+
90
+ void removeGroup(unsigned num, const FIX::Group &group) { FieldMap::removeGroup(num, group.field()); }
91
+ void removeGroup(const FIX::Group &group) { FieldMap::removeGroup(group.field()); }
92
+
93
+ bool hasGroup(const FIX::Group &group) const { return FieldMap::hasGroup(group.field()); }
94
+ bool hasGroup(unsigned num, const FIX::Group &group) const { return FieldMap::hasGroup(num, group.field()); }
95
+ };
96
+
97
+ /**
98
+ * Base class for all %FIX messages.
99
+ *
100
+ * A message consists of three field maps. One for the header, the body,
101
+ * and the trailer.
102
+ */
103
+ class Message : public FieldMap {
104
+ friend class DataDictionary;
105
+ friend class Session;
106
+
107
+ enum field_type {
108
+ header,
109
+ body,
110
+ trailer
111
+ };
112
+
113
+ public:
114
+ Message();
115
+
116
+ /// Construct message with a specified order of fields
117
+ Message(const message_order &hdrOrder, const message_order &trlOrder, const message_order &order);
118
+
119
+ /// Construct a message from a string
120
+ Message(const std::string &string, bool validate = true) EXCEPT(InvalidMessage);
121
+
122
+ /// Construct a message from a string using a data dictionary
123
+ Message(const std::string &string, const FIX::DataDictionary &dataDictionary, bool validate = true)
124
+ EXCEPT(InvalidMessage);
125
+
126
+ /// Construct a message from a string using a session and application data dictionary
127
+ Message(
128
+ const std::string &string,
129
+ const FIX::DataDictionary &sessionDataDictionary,
130
+ const FIX::DataDictionary &applicationDataDictionary,
131
+ bool validate = true) EXCEPT(InvalidMessage);
132
+
133
+ /// Construct a message from a string using a data dictionary
134
+ Message(
135
+ const message_order &headerOrder,
136
+ const message_order &trailerOrder,
137
+ const message_order &order,
138
+ const std::string &string,
139
+ const FIX::DataDictionary &dataDictionary,
140
+ bool validate = true) EXCEPT(InvalidMessage);
141
+
142
+ /// Construct a message from a string using a session and application data dictionary
143
+ Message(
144
+ const message_order &headerOrder,
145
+ const message_order &trailerOrder,
146
+ const message_order &order,
147
+ const std::string &string,
148
+ const FIX::DataDictionary &sessionDataDictionary,
149
+ const FIX::DataDictionary &applicationDataDictionary,
150
+ bool validate = true) EXCEPT(InvalidMessage);
151
+
152
+ Message(const Message &) = default;
153
+ Message(Message &&) = default;
154
+
155
+ ~Message();
156
+
157
+ Message &operator=(const Message &) = default;
158
+ Message &operator=(Message &&) = default;
159
+
160
+ /// Set global data dictionary for encoding messages into XML
161
+ static bool InitializeXML(const std::string &string);
162
+
163
+ void addGroup(const FIX::Group &group) { FieldMap::addGroup(group.field(), group); }
164
+
165
+ void replaceGroup(unsigned num, const FIX::Group &group) { FieldMap::replaceGroup(num, group.field(), group); }
166
+
167
+ Group &getGroup(unsigned num, FIX::Group &group) const EXCEPT(FieldNotFound) {
168
+ group.clear();
169
+ return static_cast<Group &>(FieldMap::getGroup(num, group.field(), group));
170
+ }
171
+
172
+ void removeGroup(unsigned num, const FIX::Group &group) { FieldMap::removeGroup(num, group.field()); }
173
+ void removeGroup(const FIX::Group &group) { FieldMap::removeGroup(group.field()); }
174
+
175
+ bool hasGroup(const FIX::Group &group) const { return FieldMap::hasGroup(group.field()); }
176
+ bool hasGroup(unsigned num, const FIX::Group &group) const { return FieldMap::hasGroup(num, group.field()); }
177
+
178
+ protected:
179
+ // Constructor for derived classes
180
+ Message(const BeginString &beginString, const MsgType &msgType);
181
+
182
+ public:
183
+ /// Get a string representation of the message
184
+ std::string toString(
185
+ int beginStringField = FIELD::BeginString,
186
+ int bodyLengthField = FIELD::BodyLength,
187
+ int checkSumField = FIELD::CheckSum) const;
188
+ /// Get a string representation without making a copy
189
+ std::string &toString(
190
+ std::string &,
191
+ int beginStringField = FIELD::BeginString,
192
+ int bodyLengthField = FIELD::BodyLength,
193
+ int checkSumField = FIELD::CheckSum) const;
194
+ /// Get a XML representation of the message
195
+ std::string toXML() const;
196
+ /// Get a XML representation without making a copy
197
+ std::string &toXML(std::string &) const;
198
+
199
+ /**
200
+ * Add header informations depending on a source message.
201
+ * This can be used to add routing informations like OnBehalfOfCompID
202
+ * and DeliverToCompID to a message.
203
+ */
204
+ void reverseRoute(const Header &);
205
+
206
+ /**
207
+ * Set a message based on a string representation
208
+ * This will fill in the fields on the message by parsing out the string
209
+ * that is passed in. It will return true on success and false
210
+ * on failure.
211
+ */
212
+ void setString(const std::string &string) EXCEPT(InvalidMessage) { setString(string, true); }
213
+ void setString(const std::string &string, bool validate) EXCEPT(InvalidMessage) { setString(string, validate, 0); }
214
+ void setString(const std::string &string, bool validate, const FIX::DataDictionary *pDataDictionary)
215
+ EXCEPT(InvalidMessage) {
216
+ setString(string, validate, pDataDictionary, pDataDictionary);
217
+ }
218
+
219
+ void setString(
220
+ const std::string &string,
221
+ bool validate,
222
+ const FIX::DataDictionary *pSessionDataDictionary,
223
+ const FIX::DataDictionary *pApplicationDataDictionary) EXCEPT(InvalidMessage);
224
+
225
+ void setGroup(
226
+ const std::string &msg,
227
+ const FieldBase &field,
228
+ const std::string &string,
229
+ std::string::size_type &pos,
230
+ FieldMap &map,
231
+ const DataDictionary &dataDictionary);
232
+
233
+ /**
234
+ * Set a messages header from a string
235
+ * This is an optimization that can be used to get useful information
236
+ * from the header of a FIX string without parsing the whole thing.
237
+ */
238
+ bool setStringHeader(const std::string &string);
239
+
240
+ /// Getter for the message header
241
+ const Header &getHeader() const { return m_header; }
242
+ /// Mutable getter for the message header
243
+ Header &getHeader() { return m_header; }
244
+ /// Getter for the message trailer
245
+ const Trailer &getTrailer() const { return m_trailer; }
246
+ /// Mutable getter for the message trailer
247
+ Trailer &getTrailer() { return m_trailer; }
248
+
249
+ bool hasValidStructure(int &tag) const {
250
+ tag = m_tag;
251
+ return m_validStructure;
252
+ }
253
+
254
+ int bodyLength(
255
+ int beginStringField = FIELD::BeginString,
256
+ int bodyLengthField = FIELD::BodyLength,
257
+ int checkSumField = FIELD::CheckSum) const {
258
+ return m_header.calculateLength(beginStringField, bodyLengthField, checkSumField)
259
+ + calculateLength(beginStringField, bodyLengthField, checkSumField)
260
+ + m_trailer.calculateLength(beginStringField, bodyLengthField, checkSumField);
261
+ }
262
+
263
+ int checkSum(int checkSumField = FIELD::CheckSum) const {
264
+ return (m_header.calculateTotal(checkSumField) + calculateTotal(checkSumField)
265
+ + m_trailer.calculateTotal(checkSumField))
266
+ % 256;
267
+ }
268
+
269
+ bool isAdmin() const {
270
+ MsgType msgType;
271
+ if (m_header.getFieldIfSet(msgType)) {
272
+ return isAdminMsgType(msgType);
273
+ }
274
+ return false;
275
+ }
276
+
277
+ bool isApp() const {
278
+ MsgType msgType;
279
+ if (m_header.getFieldIfSet(msgType)) {
280
+ return !isAdminMsgType(msgType);
281
+ }
282
+ return false;
283
+ }
284
+
285
+ bool isEmpty() { return m_header.isEmpty() && FieldMap::isEmpty() && m_trailer.isEmpty(); }
286
+
287
+ void clear() {
288
+ m_tag = 0;
289
+ m_validStructure = true;
290
+ m_header.clear();
291
+ FieldMap::clear();
292
+ m_trailer.clear();
293
+ }
294
+
295
+ static bool isAdminMsgType(const MsgType &msgType) {
296
+ if (msgType.getValue().length() != 1) {
297
+ return false;
298
+ }
299
+ return strchr("0A12345", msgType.getValue().c_str()[0]) != 0;
300
+ }
301
+
302
+ static ApplVerID toApplVerID(const BeginString &value) {
303
+ if (value == BeginString_FIX40) {
304
+ return ApplVerID(ApplVerID_FIX40);
305
+ }
306
+ if (value == BeginString_FIX41) {
307
+ return ApplVerID(ApplVerID_FIX41);
308
+ }
309
+ if (value == BeginString_FIX42) {
310
+ return ApplVerID(ApplVerID_FIX42);
311
+ }
312
+ if (value == BeginString_FIX43) {
313
+ return ApplVerID(ApplVerID_FIX43);
314
+ }
315
+ if (value == BeginString_FIX44) {
316
+ return ApplVerID(ApplVerID_FIX44);
317
+ }
318
+ if (value == BeginString_FIX50) {
319
+ return ApplVerID(ApplVerID_FIX50);
320
+ }
321
+ if (value == "FIX.5.0SP1") {
322
+ return ApplVerID(ApplVerID_FIX50_SP1);
323
+ }
324
+ if (value == "FIX.5.0SP2") {
325
+ return ApplVerID(ApplVerID_FIX50_SP2);
326
+ }
327
+ return ApplVerID(ApplVerID(value));
328
+ }
329
+
330
+ static BeginString toBeginString(const ApplVerID &applVerID) {
331
+ if (applVerID == ApplVerID_FIX40) {
332
+ return BeginString(BeginString_FIX40);
333
+ } else if (applVerID == ApplVerID_FIX41) {
334
+ return BeginString(BeginString_FIX41);
335
+ } else if (applVerID == ApplVerID_FIX42) {
336
+ return BeginString(BeginString_FIX42);
337
+ } else if (applVerID == ApplVerID_FIX43) {
338
+ return BeginString(BeginString_FIX43);
339
+ } else if (applVerID == ApplVerID_FIX44) {
340
+ return BeginString(BeginString_FIX44);
341
+ } else if (applVerID == ApplVerID_FIX50) {
342
+ return BeginString(BeginString_FIX50);
343
+ } else if (applVerID == ApplVerID_FIX50_SP1) {
344
+ return BeginString(BeginString_FIX50);
345
+ } else if (applVerID == ApplVerID_FIX50_SP2) {
346
+ return BeginString(BeginString_FIX50);
347
+ } else {
348
+ return BeginString("");
349
+ }
350
+ }
351
+
352
+ static bool isHeaderField(int field);
353
+ static bool isHeaderField(const FieldBase &field, const DataDictionary *pD = 0);
354
+ static bool isHeaderField(int field, const DataDictionary *pD);
355
+
356
+ static bool isTrailerField(int field);
357
+ static bool isTrailerField(const FieldBase &field, const DataDictionary *pD = 0);
358
+ static bool isTrailerField(int field, const DataDictionary *pD);
359
+
360
+ /// Returns the session ID of the intended recipient
361
+ SessionID getSessionID(const std::string &qualifier = "") const EXCEPT(FieldNotFound);
362
+ /// Sets the session ID of the intended recipient
363
+ void setSessionID(const SessionID &sessionID);
364
+
365
+ private:
366
+ FieldBase extractField(
367
+ const std::string &string,
368
+ std::string::size_type &pos,
369
+ const DataDictionary *pSessionDD = 0,
370
+ const DataDictionary *pAppDD = 0,
371
+ const Group *pGroup = 0) const;
372
+
373
+ static bool IsDataField(int field, const DataDictionary *pSessionDD, const DataDictionary *pAppDD) {
374
+ if ((pSessionDD && pSessionDD->isDataField(field))
375
+ || (pAppDD && pAppDD != pSessionDD && pAppDD->isDataField(field))) {
376
+ return true;
377
+ }
378
+
379
+ return false;
380
+ }
381
+
382
+ void validate() const;
383
+ std::string toXMLFields(const FieldMap &fields, int space) const;
384
+
385
+ protected:
386
+ mutable Header m_header;
387
+ mutable Trailer m_trailer;
388
+ bool m_validStructure;
389
+ int m_tag;
390
+ static std::unique_ptr<DataDictionary> s_dataDictionary;
391
+ };
392
+ /*! @} */
393
+
394
+ inline std::ostream &operator<<(std::ostream &stream, const Message &message) {
395
+ std::string str;
396
+ stream << message.toString(str);
397
+ return stream;
398
+ }
399
+
400
+ /// Parse the type of a message from a string.
401
+ inline MsgType identifyType(const std::string &message) EXCEPT(MessageParseError) {
402
+ std::string::size_type pos = message.find("\001"
403
+ "35=");
404
+ if (pos == std::string::npos) {
405
+ throw MessageParseError();
406
+ }
407
+
408
+ std::string::size_type startValue = pos + 4;
409
+ std::string::size_type soh = message.find_first_of('\001', startValue);
410
+ if (soh == std::string::npos) {
411
+ throw MessageParseError();
412
+ }
413
+
414
+ std::string value = message.substr(startValue, soh - startValue);
415
+ return MsgType(value);
416
+ }
417
+ } // namespace FIX
418
+
419
+ #endif // FIX_MESSAGE
@@ -0,0 +1,171 @@
1
+ /* -*- C++ -*- */
2
+
3
+ /****************************************************************************
4
+ ** Copyright (c) 2001-2014
5
+ **
6
+ ** This file is part of the QuickFIX FIX Engine
7
+ **
8
+ ** This file may be distributed under the terms of the quickfixengine.org
9
+ ** license as defined by quickfixengine.org and appearing in the file
10
+ ** LICENSE included in the packaging of this file.
11
+ **
12
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14
+ **
15
+ ** See http://www.quickfixengine.org/LICENSE for licensing information.
16
+ **
17
+ ** Contact ask@quickfixengine.org if any conditions of this licensing are
18
+ ** not clear to you.
19
+ **
20
+ ****************************************************************************/
21
+
22
+ #ifndef FIX_MESSAGECRACKER_H
23
+ #define FIX_MESSAGECRACKER_H
24
+
25
+ #include "Session.h"
26
+ #include "Values.h"
27
+ #include "fix40/MessageCracker.h"
28
+ #include "fix41/MessageCracker.h"
29
+ #include "fix42/MessageCracker.h"
30
+ #include "fix43/MessageCracker.h"
31
+ #include "fix44/MessageCracker.h"
32
+ #include "fix50/MessageCracker.h"
33
+ #include "fix50sp1/MessageCracker.h"
34
+ #include "fix50sp2/MessageCracker.h"
35
+ #include "fixt11/MessageCracker.h"
36
+
37
+ namespace FIX {
38
+ /** Takes in a generic Message and produces an object that represents
39
+ * its specific version and message type.
40
+ */
41
+ class MessageCracker : public FIX40::MessageCracker,
42
+ public FIX41::MessageCracker,
43
+ public FIX42::MessageCracker,
44
+ public FIX43::MessageCracker,
45
+ public FIX44::MessageCracker,
46
+ public FIX50::MessageCracker,
47
+ public FIX50SP1::MessageCracker,
48
+ public FIX50SP2::MessageCracker,
49
+ public FIXT11::MessageCracker {
50
+ public:
51
+ void crack(const Message &message, const SessionID &sessionID) {
52
+ const FIX::BeginString &beginString = FIELD_GET_REF(message.getHeader(), BeginString);
53
+
54
+ crack(message, sessionID, beginString);
55
+ }
56
+
57
+ void crack(const Message &message, const SessionID &sessionID, const BeginString &beginString) {
58
+ if (beginString == BeginString_FIX40) {
59
+ ((FIX40::MessageCracker &)(*this)).crack((const FIX40::Message &)message, sessionID);
60
+ } else if (beginString == BeginString_FIX41) {
61
+ ((FIX41::MessageCracker &)(*this)).crack((const FIX41::Message &)message, sessionID);
62
+ } else if (beginString == BeginString_FIX42) {
63
+ ((FIX42::MessageCracker &)(*this)).crack((const FIX42::Message &)message, sessionID);
64
+ } else if (beginString == BeginString_FIX43) {
65
+ ((FIX43::MessageCracker &)(*this)).crack((const FIX43::Message &)message, sessionID);
66
+ } else if (beginString == BeginString_FIX44) {
67
+ ((FIX44::MessageCracker &)(*this)).crack((const FIX44::Message &)message, sessionID);
68
+ } else if (beginString == BeginString_FIXT11) {
69
+ if (message.isAdmin()) {
70
+ ((FIXT11::MessageCracker &)(*this)).crack((const FIXT11::Message &)message, sessionID);
71
+ } else {
72
+ ApplVerID applVerID;
73
+ if (!message.getHeader().getFieldIfSet(applVerID)) {
74
+ Session *pSession = Session::lookupSession(sessionID);
75
+ applVerID = pSession->getSenderDefaultApplVerID();
76
+ }
77
+
78
+ crack(message, sessionID, applVerID);
79
+ }
80
+ }
81
+ }
82
+
83
+ void crack(const Message &message, const SessionID &sessionID, const ApplVerID &applVerID) {
84
+ if (applVerID == ApplVerID_FIX40) {
85
+ ((FIX40::MessageCracker &)(*this)).crack((const FIX40::Message &)message, sessionID);
86
+ }
87
+ if (applVerID == ApplVerID_FIX41) {
88
+ ((FIX41::MessageCracker &)(*this)).crack((const FIX41::Message &)message, sessionID);
89
+ }
90
+ if (applVerID == ApplVerID_FIX42) {
91
+ ((FIX42::MessageCracker &)(*this)).crack((const FIX42::Message &)message, sessionID);
92
+ }
93
+ if (applVerID == ApplVerID_FIX43) {
94
+ ((FIX43::MessageCracker &)(*this)).crack((const FIX43::Message &)message, sessionID);
95
+ }
96
+ if (applVerID == ApplVerID_FIX44) {
97
+ ((FIX44::MessageCracker &)(*this)).crack((const FIX44::Message &)message, sessionID);
98
+ }
99
+ if (applVerID == ApplVerID_FIX50) {
100
+ ((FIX50::MessageCracker &)(*this)).crack((const FIX50::Message &)message, sessionID);
101
+ }
102
+ if (applVerID == ApplVerID_FIX50_SP1) {
103
+ ((FIX50SP1::MessageCracker &)(*this)).crack((const FIX50SP1::Message &)message, sessionID);
104
+ }
105
+ if (applVerID == ApplVerID_FIX50_SP2) {
106
+ ((FIX50SP2::MessageCracker &)(*this)).crack((const FIX50SP2::Message &)message, sessionID);
107
+ }
108
+ }
109
+
110
+ void crack(Message &message, const SessionID &sessionID) {
111
+ const FIX::BeginString &beginString = FIELD_GET_REF(message.getHeader(), BeginString);
112
+
113
+ crack(message, sessionID, beginString);
114
+ }
115
+
116
+ void crack(Message &message, const SessionID &sessionID, const BeginString &beginString) {
117
+ if (beginString == BeginString_FIX40) {
118
+ ((FIX40::MessageCracker &)(*this)).crack((FIX40::Message &)message, sessionID);
119
+ } else if (beginString == BeginString_FIX41) {
120
+ ((FIX41::MessageCracker &)(*this)).crack((FIX41::Message &)message, sessionID);
121
+ } else if (beginString == BeginString_FIX42) {
122
+ ((FIX42::MessageCracker &)(*this)).crack((FIX42::Message &)message, sessionID);
123
+ } else if (beginString == BeginString_FIX43) {
124
+ ((FIX43::MessageCracker &)(*this)).crack((FIX43::Message &)message, sessionID);
125
+ } else if (beginString == BeginString_FIX44) {
126
+ ((FIX44::MessageCracker &)(*this)).crack((FIX44::Message &)message, sessionID);
127
+ } else if (beginString == BeginString_FIXT11) {
128
+ if (message.isAdmin()) {
129
+ ((FIXT11::MessageCracker &)(*this)).crack((FIXT11::Message &)message, sessionID);
130
+ } else {
131
+ ApplVerID applVerID;
132
+ if (!message.getHeader().getFieldIfSet(applVerID)) {
133
+ Session *pSession = Session::lookupSession(sessionID);
134
+ applVerID = pSession->getSenderDefaultApplVerID();
135
+ }
136
+
137
+ crack(message, sessionID, applVerID);
138
+ }
139
+ }
140
+ }
141
+
142
+ void crack(Message &message, const SessionID &sessionID, const ApplVerID &applVerID) {
143
+ if (applVerID == ApplVerID_FIX40) {
144
+ ((FIX40::MessageCracker &)(*this)).crack((FIX40::Message &)message, sessionID);
145
+ }
146
+ if (applVerID == ApplVerID_FIX41) {
147
+ ((FIX41::MessageCracker &)(*this)).crack((FIX41::Message &)message, sessionID);
148
+ }
149
+ if (applVerID == ApplVerID_FIX42) {
150
+ ((FIX42::MessageCracker &)(*this)).crack((FIX42::Message &)message, sessionID);
151
+ }
152
+ if (applVerID == ApplVerID_FIX43) {
153
+ ((FIX43::MessageCracker &)(*this)).crack((FIX43::Message &)message, sessionID);
154
+ }
155
+ if (applVerID == ApplVerID_FIX44) {
156
+ ((FIX44::MessageCracker &)(*this)).crack((FIX44::Message &)message, sessionID);
157
+ }
158
+ if (applVerID == ApplVerID_FIX50) {
159
+ ((FIX50::MessageCracker &)(*this)).crack((FIX50::Message &)message, sessionID);
160
+ }
161
+ if (applVerID == ApplVerID_FIX50_SP1) {
162
+ ((FIX50SP1::MessageCracker &)(*this)).crack((FIX50SP1::Message &)message, sessionID);
163
+ }
164
+ if (applVerID == ApplVerID_FIX50_SP2) {
165
+ ((FIX50SP2::MessageCracker &)(*this)).crack((FIX50SP2::Message &)message, sessionID);
166
+ }
167
+ }
168
+ };
169
+ } // namespace FIX
170
+
171
+ #endif // FIX_MESSAGECRACKER_H
@@ -0,0 +1,101 @@
1
+ /****************************************************************************
2
+ ** Copyright (c) 2001-2014
3
+ **
4
+ ** This file is part of the QuickFIX FIX Engine
5
+ **
6
+ ** This file may be distributed under the terms of the quickfixengine.org
7
+ ** license as defined by quickfixengine.org and appearing in the file
8
+ ** LICENSE included in the packaging of this file.
9
+ **
10
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12
+ **
13
+ ** See http://www.quickfixengine.org/LICENSE for licensing information.
14
+ **
15
+ ** Contact ask@quickfixengine.org if any conditions of this licensing are
16
+ ** not clear to you.
17
+ **
18
+ ****************************************************************************/
19
+
20
+ #ifdef _MSC_VER
21
+ #include "stdafx.h"
22
+ #else
23
+ #include "config.h"
24
+ #endif
25
+
26
+ #include "MessageSorters.h"
27
+
28
+ #include <string.h>
29
+
30
+ namespace FIX {
31
+ message_order::message_order(int first, ...)
32
+ : m_mode(group),
33
+ m_delim(0),
34
+ m_largest(0) {
35
+ int field = first;
36
+ int size = 0;
37
+ m_largest = m_delim = first;
38
+
39
+ va_list arguments;
40
+ va_start(arguments, first);
41
+ while (field != 0) {
42
+ m_largest = m_largest > field ? m_largest : field;
43
+
44
+ size++;
45
+ field = va_arg(arguments, int);
46
+ }
47
+
48
+ if (size) {
49
+ m_groupOrder = shared_array<int>::create(m_largest + 1);
50
+
51
+ va_start(arguments, first);
52
+ field = first;
53
+ int i = 0;
54
+ while (field != 0) {
55
+ m_groupOrder[field] = ++i;
56
+ field = va_arg(arguments, int);
57
+ }
58
+ } else {
59
+ m_largest = 0;
60
+ m_delim = 0;
61
+ }
62
+
63
+ va_end(arguments);
64
+ }
65
+
66
+ message_order::message_order(const int order[])
67
+ : m_mode(group),
68
+ m_delim(0),
69
+ m_largest(0) {
70
+ int size = 0;
71
+ while (order[size] != 0) {
72
+ ++size;
73
+ }
74
+ setOrder(order, size);
75
+ }
76
+
77
+ message_order::message_order(const int order[], int size)
78
+ : m_mode(group),
79
+ m_delim(0),
80
+ m_largest(0) {
81
+ setOrder(order, size);
82
+ }
83
+
84
+ void message_order::setOrder(const int order[], int size) {
85
+ if (size < 1) {
86
+ return;
87
+ }
88
+ m_largest = m_delim = order[0];
89
+
90
+ // collect all fields and find the largest field number
91
+ for (int i = 1; i < size; ++i) {
92
+ int field = order[i];
93
+ m_largest = m_largest > field ? m_largest : field;
94
+ }
95
+
96
+ m_groupOrder = shared_array<int>::create(m_largest + 1);
97
+ for (int i = 0; i < size; ++i) {
98
+ m_groupOrder[order[i]] = i + 1;
99
+ }
100
+ }
101
+ } // namespace FIX