quickfix_ruby 1.14.3.1 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/ext/quickfix/Acceptor.h +2 -0
  3. data/ext/quickfix/AtomicCount.h +82 -12
  4. data/ext/quickfix/DOMDocument.h +9 -7
  5. data/ext/quickfix/DataDictionary.cpp +77 -14
  6. data/ext/quickfix/DataDictionary.h +90 -16
  7. data/ext/quickfix/Dictionary.cpp +1 -2
  8. data/ext/quickfix/Exceptions.h +3 -5
  9. data/ext/quickfix/Field.h +83 -32
  10. data/ext/quickfix/FieldConvertors.cpp +93 -0
  11. data/ext/quickfix/FieldConvertors.h +129 -275
  12. data/ext/quickfix/FieldMap.cpp +53 -13
  13. data/ext/quickfix/FieldMap.h +200 -62
  14. data/ext/quickfix/FieldTypes.cpp +10 -10
  15. data/ext/quickfix/FieldTypes.h +293 -44
  16. data/ext/quickfix/FileLog.cpp +6 -10
  17. data/ext/quickfix/FileLog.h +4 -10
  18. data/ext/quickfix/FileStore.cpp +19 -6
  19. data/ext/quickfix/FileStore.h +4 -0
  20. data/ext/quickfix/FixFieldNumbers.h +1462 -1461
  21. data/ext/quickfix/FixFields.h +1462 -1461
  22. data/ext/quickfix/FixValues.h +3230 -3227
  23. data/ext/quickfix/HttpConnection.cpp +1 -1
  24. data/ext/quickfix/Initiator.cpp +7 -1
  25. data/ext/quickfix/Initiator.h +2 -0
  26. data/ext/quickfix/Log.h +6 -12
  27. data/ext/quickfix/Message.cpp +186 -57
  28. data/ext/quickfix/Message.h +109 -47
  29. data/ext/quickfix/MySQLConnection.h +1 -1
  30. data/ext/quickfix/PostgreSQLConnection.h +1 -1
  31. data/ext/quickfix/QuickfixRuby.cpp +79141 -77959
  32. data/ext/quickfix/QuickfixRuby.h +1 -1
  33. data/ext/quickfix/SSLSocketAcceptor.cpp +410 -0
  34. data/ext/quickfix/SSLSocketAcceptor.h +185 -0
  35. data/ext/quickfix/SSLSocketConnection.cpp +427 -0
  36. data/ext/quickfix/SSLSocketConnection.h +206 -0
  37. data/ext/quickfix/SSLSocketInitiator.cpp +485 -0
  38. data/ext/quickfix/SSLSocketInitiator.h +196 -0
  39. data/ext/quickfix/Session.cpp +113 -20
  40. data/ext/quickfix/Session.h +18 -4
  41. data/ext/quickfix/SessionFactory.cpp +10 -3
  42. data/ext/quickfix/SessionSettings.cpp +5 -3
  43. data/ext/quickfix/SessionSettings.h +97 -5
  44. data/ext/quickfix/Settings.cpp +72 -2
  45. data/ext/quickfix/Settings.h +3 -0
  46. data/ext/quickfix/SharedArray.h +140 -6
  47. data/ext/quickfix/SocketConnection.cpp +2 -2
  48. data/ext/quickfix/SocketConnector.cpp +5 -2
  49. data/ext/quickfix/SocketConnector.h +3 -2
  50. data/ext/quickfix/SocketInitiator.cpp +28 -4
  51. data/ext/quickfix/SocketInitiator.h +1 -1
  52. data/ext/quickfix/SocketMonitor.cpp +5 -5
  53. data/ext/quickfix/ThreadedSSLSocketAcceptor.cpp +455 -0
  54. data/ext/quickfix/ThreadedSSLSocketAcceptor.h +217 -0
  55. data/ext/quickfix/ThreadedSSLSocketConnection.cpp +404 -0
  56. data/ext/quickfix/ThreadedSSLSocketConnection.h +189 -0
  57. data/ext/quickfix/ThreadedSSLSocketInitiator.cpp +469 -0
  58. data/ext/quickfix/ThreadedSSLSocketInitiator.h +201 -0
  59. data/ext/quickfix/ThreadedSocketAcceptor.cpp +5 -1
  60. data/ext/quickfix/ThreadedSocketConnection.cpp +8 -2
  61. data/ext/quickfix/ThreadedSocketConnection.h +4 -1
  62. data/ext/quickfix/ThreadedSocketInitiator.cpp +24 -4
  63. data/ext/quickfix/ThreadedSocketInitiator.h +1 -1
  64. data/ext/quickfix/Utility.cpp +23 -1
  65. data/ext/quickfix/Utility.h +28 -2
  66. data/ext/quickfix/UtilitySSL.cpp +1733 -0
  67. data/ext/quickfix/UtilitySSL.h +277 -0
  68. data/ext/quickfix/config-all.h +10 -0
  69. data/ext/quickfix/dirent_windows.h +838 -0
  70. data/ext/quickfix/double-conversion/bignum-dtoa.cc +641 -0
  71. data/ext/quickfix/double-conversion/bignum-dtoa.h +84 -0
  72. data/ext/quickfix/double-conversion/bignum.cc +766 -0
  73. data/ext/quickfix/double-conversion/bignum.h +144 -0
  74. data/ext/quickfix/double-conversion/cached-powers.cc +176 -0
  75. data/ext/quickfix/double-conversion/cached-powers.h +64 -0
  76. data/ext/quickfix/double-conversion/diy-fp.cc +57 -0
  77. data/ext/quickfix/double-conversion/diy-fp.h +118 -0
  78. data/ext/quickfix/double-conversion/double-conversion.cc +994 -0
  79. data/ext/quickfix/double-conversion/double-conversion.h +543 -0
  80. data/ext/quickfix/double-conversion/fast-dtoa.cc +665 -0
  81. data/ext/quickfix/double-conversion/fast-dtoa.h +88 -0
  82. data/ext/quickfix/double-conversion/fixed-dtoa.cc +404 -0
  83. data/ext/quickfix/double-conversion/fixed-dtoa.h +56 -0
  84. data/ext/quickfix/double-conversion/ieee.h +402 -0
  85. data/ext/quickfix/double-conversion/strtod.cc +557 -0
  86. data/ext/quickfix/double-conversion/strtod.h +45 -0
  87. data/ext/quickfix/double-conversion/utils.h +372 -0
  88. data/ext/quickfix/stdint_msvc.h +254 -0
  89. data/lib/quickfix44.rb +3329 -10
  90. data/lib/quickfix50.rb +6649 -81
  91. data/lib/quickfix50sp1.rb +8054 -142
  92. data/lib/quickfix50sp2.rb +10900 -234
  93. data/lib/quickfix_fields.rb +7662 -7649
  94. data/spec/FIX40.xml +28 -28
  95. data/spec/FIX41.xml +29 -29
  96. data/spec/FIX42.xml +47 -47
  97. data/spec/FIX43.xml +148 -148
  98. data/spec/FIX44.xml +1078 -1081
  99. data/spec/FIX50.xml +1292 -1289
  100. data/spec/FIX50SP1.xml +1811 -1802
  101. data/spec/FIX50SP2.xml +1948 -1939
  102. data/spec/FIXT11.xml +5 -8
  103. data/test/test_FieldBaseTestCase.rb +1 -1
  104. data/test/test_MessageTestCase.rb +2 -2
  105. metadata +42 -6
@@ -0,0 +1,196 @@
1
+ /* -*- C++ -*- */
2
+
3
+ /* ====================================================================
4
+ * Copyright (c) 1998-2006 Ralf S. Engelschall. All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ *
10
+ * 1. Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ *
13
+ * 2. Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials
16
+ * provided with the distribution.
17
+ *
18
+ * 3. All advertising materials mentioning features or use of this
19
+ * software must display the following acknowledgment:
20
+ * "This product includes software developed by
21
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
22
+ * mod_ssl project (http://www.modssl.org/)."
23
+ *
24
+ * 4. The names "mod_ssl" must not be used to endorse or promote
25
+ * products derived from this software without prior written
26
+ * permission. For written permission, please contact
27
+ * rse@engelschall.com.
28
+ *
29
+ * 5. Products derived from this software may not be called "mod_ssl"
30
+ * nor may "mod_ssl" appear in their names without prior
31
+ * written permission of Ralf S. Engelschall.
32
+ *
33
+ * 6. Redistributions of any form whatsoever must retain the following
34
+ * acknowledgment:
35
+ * "This product includes software developed by
36
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
37
+ * mod_ssl project (http://www.modssl.org/)."
38
+ *
39
+ * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY
40
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR
43
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
51
+ * ====================================================================
52
+ */
53
+
54
+ /* ====================================================================
55
+ * Copyright (c) 1995-1999 Ben Laurie. All rights reserved.
56
+ *
57
+ * Redistribution and use in source and binary forms, with or without
58
+ * modification, are permitted provided that the following conditions
59
+ * are met:
60
+ *
61
+ * 1. Redistributions of source code must retain the above copyright
62
+ * notice, this list of conditions and the following disclaimer.
63
+ *
64
+ * 2. Redistributions in binary form must reproduce the above copyright
65
+ * notice, this list of conditions and the following disclaimer in
66
+ * the documentation and/or other materials provided with the
67
+ * distribution.
68
+ *
69
+ * 3. All advertising materials mentioning features or use of this
70
+ * software must display the following acknowledgment:
71
+ * "This product includes software developed by Ben Laurie
72
+ * for use in the Apache-SSL HTTP server project."
73
+ *
74
+ * 4. The name "Apache-SSL Server" must not be used to
75
+ * endorse or promote products derived from this software without
76
+ * prior written permission.
77
+ *
78
+ * 5. Redistributions of any form whatsoever must retain the following
79
+ * acknowledgment:
80
+ * "This product includes software developed by Ben Laurie
81
+ * for use in the Apache-SSL HTTP server project."
82
+ *
83
+ * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY
84
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
85
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
86
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR
87
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
88
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
89
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
90
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
92
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
93
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
94
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
95
+ * ====================================================================
96
+ */
97
+
98
+ /****************************************************************************
99
+ ** Copyright (c) 2001-2014
100
+ **
101
+ ** This file is part of the QuickFIX FIX Engine
102
+ **
103
+ ** This file may be distributed under the terms of the quickfixengine.org
104
+ ** license as defined by quickfixengine.org and appearing in the file
105
+ ** LICENSE included in the packaging of this file.
106
+ **
107
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
108
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
109
+ **
110
+ ** See http://www.quickfixengine.org/LICENSE for licensing information.
111
+ **
112
+ ** Contact ask@quickfixengine.org if any conditions of this licensing are
113
+ ** not clear to you.
114
+ **
115
+ ****************************************************************************/
116
+
117
+ #ifndef FIX_SSLSOCKETINITIATOR_H
118
+ #define FIX_SSLSOCKETINITIATOR_H
119
+
120
+ #if (HAVE_SSL > 0)
121
+
122
+ #ifdef _MSC_VER
123
+ #pragma warning( disable : 4503 4355 4786 4290 )
124
+ #endif
125
+
126
+ #include "Initiator.h"
127
+ #include "SocketConnector.h"
128
+ #include "SSLSocketConnection.h"
129
+
130
+ namespace FIX
131
+ {
132
+ /// Socket implementation of Initiator.
133
+ class SSLSocketInitiator : public Initiator, SocketConnector::Strategy
134
+ {
135
+ public:
136
+ SSLSocketInitiator( Application&, MessageStoreFactory&,
137
+ const SessionSettings& ) throw( ConfigError );
138
+ SSLSocketInitiator( Application&, MessageStoreFactory&,
139
+ const SessionSettings&, LogFactory& ) throw( ConfigError );
140
+
141
+ virtual ~SSLSocketInitiator();
142
+
143
+ void setPassword(const std::string &pwd) { m_password.assign(pwd); }
144
+
145
+ void setCertAndKey(X509 *cert, RSA *key)
146
+ {
147
+ m_cert = cert;
148
+ m_key = key;
149
+ }
150
+
151
+ int passwordHandleCallback(char *buf, size_t bufsize, int verify, void *job);
152
+
153
+ static int passwordHandleCB(char *buf, int bufsize, int verify, void *job);
154
+
155
+ private:
156
+ typedef std::map < int, SSLSocketConnection* > SocketConnections;
157
+ typedef std::map < SessionID, int > SessionToHostNum;
158
+
159
+ void onConfigure( const SessionSettings& ) throw ( ConfigError );
160
+ void onInitialize( const SessionSettings& ) throw ( RuntimeError );
161
+
162
+ void onStart();
163
+ bool onPoll( double timeout );
164
+ void onStop();
165
+
166
+ void doConnect( const SessionID&, const Dictionary& d );
167
+ void onConnect( SocketConnector&, int );
168
+ void onWrite( SocketConnector&, int );
169
+ bool onData( SocketConnector&, int );
170
+ void onDisconnect( SocketConnector&, int );
171
+ void onError( SocketConnector& );
172
+ void onTimeout( SocketConnector& );
173
+
174
+ void getHost( const SessionID&, const Dictionary&, std::string&, short&, std::string&, short& );
175
+
176
+ SessionToHostNum m_sessionToHostNum;
177
+ SocketConnector m_connector;
178
+ SocketConnections m_pendingConnections;
179
+ SocketConnections m_connections;
180
+ time_t m_lastConnect;
181
+ int m_reconnectInterval;
182
+ bool m_noDelay;
183
+ int m_sendBufSize;
184
+ int m_rcvBufSize;
185
+ bool m_sslInit;
186
+ SSL_CTX *m_ctx;
187
+ std::string m_password;
188
+ X509 *m_cert;
189
+ RSA *m_key;
190
+ };
191
+ /*! @} */
192
+ }
193
+
194
+ #endif
195
+
196
+ #endif //FIX_SSLSOCKETINITIATOR_H
@@ -58,7 +58,7 @@ Session::Session( Application& application,
58
58
  m_resetOnLogout( false ),
59
59
  m_resetOnDisconnect( false ),
60
60
  m_refreshOnLogon( false ),
61
- m_millisecondsInTimeStamp( true ),
61
+ m_timestampPrecision( 3 ),
62
62
  m_persistMessages( true ),
63
63
  m_validateLengthAndChecksum( true ),
64
64
  m_dataDictionaryProvider( dataDictionaryProvider ),
@@ -97,7 +97,7 @@ void Session::insertSendingTime( Header& header )
97
97
  else
98
98
  showMilliseconds = m_sessionID.getBeginString() >= BeginString_FIX42;
99
99
 
100
- header.setField( SendingTime(now, showMilliseconds && m_millisecondsInTimeStamp) );
100
+ header.setField( SendingTime(now, showMilliseconds ? m_timestampPrecision : 0) );
101
101
  }
102
102
 
103
103
  void Session::insertOrigSendingTime( Header& header, const UtcTimeStamp& when )
@@ -108,7 +108,7 @@ void Session::insertOrigSendingTime( Header& header, const UtcTimeStamp& when )
108
108
  else
109
109
  showMilliseconds = m_sessionID.getBeginString() >= BeginString_FIX42;
110
110
 
111
- header.setField( OrigSendingTime(when, showMilliseconds && m_millisecondsInTimeStamp) );
111
+ header.setField( OrigSendingTime(when, showMilliseconds ? m_timestampPrecision : 0) );
112
112
  }
113
113
 
114
114
  void Session::fill( Header& header )
@@ -381,29 +381,69 @@ void Session::nextResendRequest( const Message& resendRequest, const UtcTimeStam
381
381
  int begin = 0;
382
382
  int current = beginSeqNo;
383
383
  std::string messageString;
384
- Message msg;
385
384
 
386
385
  for ( i = messages.begin(); i != messages.end(); ++i )
387
386
  {
388
- const DataDictionary& sessionDD =
387
+ SmartPtr<FIX::Message> pMsg;
388
+ std::string strMsgType;
389
+ const DataDictionary& sessionDD =
389
390
  m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
391
+ if (sessionDD.isMessageFieldsOrderPreserved())
392
+ {
393
+ std::string::size_type equalSign = (*i).find("\00135=");
394
+ equalSign += 4;
395
+ std::string::size_type soh = (*i).find_first_of('\001', equalSign);
396
+ strMsgType = (*i).substr(equalSign, soh - equalSign);
397
+ #ifdef HAVE_EMX
398
+ if (FIX::Message::isAdminMsgType(strMsgType) == false)
399
+ {
400
+ equalSign = (*i).find("\0019426=", soh);
401
+ if (equalSign == std::string::npos)
402
+ throw FIX::IOException("EMX message type (9426) not found");
403
+
404
+ equalSign += 6;
405
+ soh = (*i).find_first_of('\001', equalSign);
406
+ if (soh == std::string::npos)
407
+ throw FIX::IOException("EMX message type (9426) soh char not found");
408
+ strMsgType.assign((*i).substr(equalSign, soh - equalSign));
409
+ }
410
+ #endif
411
+ }
390
412
 
391
413
  if( m_sessionID.isFIXT() )
392
414
  {
415
+ Message msg;
393
416
  msg.setStringHeader(*i);
394
417
  ApplVerID applVerID;
395
418
  if( !msg.getHeader().getFieldIfSet(applVerID) )
396
419
  applVerID = m_senderDefaultApplVerID;
397
420
 
398
421
  const DataDictionary& applicationDD =
399
- m_dataDictionaryProvider.getApplicationDataDictionary(applVerID);
400
- msg = Message( *i, sessionDD, applicationDD, m_validateLengthAndChecksum );
422
+ m_dataDictionaryProvider.getApplicationDataDictionary(applVerID);
423
+ if (strMsgType.empty())
424
+ pMsg.reset( new Message( *i, sessionDD, applicationDD, m_validateLengthAndChecksum ));
425
+ else
426
+ {
427
+ const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
428
+ const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
429
+ const message_order & msgOrder = applicationDD.getMessageOrderedFields(strMsgType);
430
+ pMsg.reset( new Message( hdrOrder, trlOrder, msgOrder, *i, sessionDD, applicationDD, m_validateLengthAndChecksum ));
431
+ }
401
432
  }
402
433
  else
403
434
  {
404
- msg = Message( *i, sessionDD, m_validateLengthAndChecksum );
435
+ if (strMsgType.empty())
436
+ pMsg.reset( new Message( *i, sessionDD, m_validateLengthAndChecksum ));
437
+ else
438
+ {
439
+ const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
440
+ const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
441
+ const message_order & msgOrder = sessionDD.getMessageOrderedFields(strMsgType);
442
+ pMsg.reset(new Message(hdrOrder, trlOrder, msgOrder, *i, sessionDD, m_validateLengthAndChecksum ));
443
+ }
405
444
  }
406
445
 
446
+ Message & msg = *pMsg;
407
447
 
408
448
  msg.getHeader().getField( msgSeqNum );
409
449
  msg.getHeader().getField( msgType );
@@ -449,6 +489,37 @@ void Session::nextResendRequest( const Message& resendRequest, const UtcTimeStam
449
489
  m_state.incrNextTargetMsgSeqNum();
450
490
  }
451
491
 
492
+ Message * Session::newMessage(const std::string & msgType) const
493
+ {
494
+ Message * msg = 0;
495
+
496
+ const DataDictionary& sessionDD =
497
+ m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
498
+ if (!sessionDD.isMessageFieldsOrderPreserved())
499
+ {
500
+ msg = new Message();
501
+ }
502
+ else
503
+ {
504
+ const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
505
+ const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
506
+ if (!m_sessionID.isFIXT() || Message::isAdminMsgType(msgType) )
507
+ {
508
+ const message_order & msgOrder = sessionDD.getMessageOrderedFields(msgType);
509
+ msg = new Message(hdrOrder, trlOrder, msgOrder);
510
+ }
511
+ else
512
+ {
513
+ const DataDictionary& applicationDD =
514
+ m_dataDictionaryProvider.getApplicationDataDictionary(m_senderDefaultApplVerID);
515
+ const message_order & msgOrder = applicationDD.getMessageOrderedFields(msgType);
516
+ msg = new Message(hdrOrder, trlOrder, msgOrder);
517
+ }
518
+ }
519
+
520
+ return msg;
521
+ }
522
+
452
523
  bool Session::send( Message& message )
453
524
  {
454
525
  message.getHeader().removeField( FIELD::PossDupFlag );
@@ -601,7 +672,9 @@ throw ( IOException )
601
672
 
602
673
  void Session::generateLogon()
603
674
  {
604
- Message logon;
675
+ SmartPtr<Message> pMsg(newMessage("A"));
676
+ Message & logon = *pMsg;
677
+
605
678
  logon.getHeader().setField( MsgType( "A" ) );
606
679
  logon.setField( EncryptMethod( 0 ) );
607
680
  logon.setField( m_state.heartBtInt() );
@@ -624,7 +697,9 @@ void Session::generateLogon()
624
697
 
625
698
  void Session::generateLogon( const Message& aLogon )
626
699
  {
627
- Message logon;
700
+ SmartPtr<Message> pMsg(newMessage("A"));
701
+ Message & logon = *pMsg;
702
+
628
703
  EncryptMethod encryptMethod;
629
704
  HeartBtInt heartBtInt;
630
705
  logon.setField( EncryptMethod( 0 ) );
@@ -642,7 +717,9 @@ void Session::generateLogon( const Message& aLogon )
642
717
 
643
718
  void Session::generateResendRequest( const BeginString& beginString, const MsgSeqNum& msgSeqNum )
644
719
  {
645
- Message resendRequest;
720
+ SmartPtr<Message> pMsg(newMessage("2"));
721
+ Message & resendRequest = *pMsg;
722
+
646
723
  BeginSeqNo beginSeqNo( ( int ) getExpectedTargetNum() );
647
724
  EndSeqNo endSeqNo( msgSeqNum - 1 );
648
725
  if ( beginString >= FIX::BeginString_FIX42 )
@@ -665,7 +742,9 @@ void Session::generateResendRequest( const BeginString& beginString, const MsgSe
665
742
  void Session::generateSequenceReset
666
743
  ( int beginSeqNo, int endSeqNo )
667
744
  {
668
- Message sequenceReset;
745
+ SmartPtr<Message> pMsg(newMessage("4"));
746
+ Message & sequenceReset = *pMsg;
747
+
669
748
  NewSeqNo newSeqNo( endSeqNo );
670
749
  sequenceReset.getHeader().setField( MsgType( "4" ) );
671
750
  sequenceReset.getHeader().setField( PossDupFlag( true ) );
@@ -684,7 +763,9 @@ void Session::generateSequenceReset
684
763
 
685
764
  void Session::generateHeartbeat()
686
765
  {
687
- Message heartbeat;
766
+ SmartPtr<Message> pMsg(newMessage("0"));
767
+ Message & heartbeat = *pMsg;
768
+
688
769
  heartbeat.getHeader().setField( MsgType( "0" ) );
689
770
  fill( heartbeat.getHeader() );
690
771
  sendRaw( heartbeat );
@@ -692,7 +773,9 @@ void Session::generateHeartbeat()
692
773
 
693
774
  void Session::generateHeartbeat( const Message& testRequest )
694
775
  {
695
- Message heartbeat;
776
+ SmartPtr<Message> pMsg(newMessage("0"));
777
+ Message & heartbeat = *pMsg;
778
+
696
779
  heartbeat.getHeader().setField( MsgType( "0" ) );
697
780
  fill( heartbeat.getHeader() );
698
781
  try
@@ -708,7 +791,9 @@ void Session::generateHeartbeat( const Message& testRequest )
708
791
 
709
792
  void Session::generateTestRequest( const std::string& id )
710
793
  {
711
- Message testRequest;
794
+ SmartPtr<Message> pMsg(newMessage("1"));
795
+ Message & testRequest = *pMsg;
796
+
712
797
  testRequest.getHeader().setField( MsgType( "1" ) );
713
798
  fill( testRequest.getHeader() );
714
799
  TestReqID testReqID( id );
@@ -721,7 +806,9 @@ void Session::generateReject( const Message& message, int err, int field )
721
806
  {
722
807
  std::string beginString = m_sessionID.getBeginString();
723
808
 
724
- Message reject;
809
+ SmartPtr<Message> pMsg(newMessage("3"));
810
+ Message & reject = *pMsg;
811
+
725
812
  reject.getHeader().setField( MsgType( "3" ) );
726
813
  reject.reverseRoute( message.getHeader() );
727
814
  fill( reject.getHeader() );
@@ -816,7 +903,9 @@ void Session::generateReject( const Message& message, const std::string& str )
816
903
  {
817
904
  std::string beginString = m_sessionID.getBeginString();
818
905
 
819
- Message reject;
906
+ SmartPtr<Message> pMsg(newMessage("3"));
907
+ Message & reject = *pMsg;
908
+
820
909
  reject.getHeader().setField( MsgType( "3" ) );
821
910
  reject.reverseRoute( message.getHeader() );
822
911
  fill( reject.getHeader() );
@@ -841,7 +930,9 @@ void Session::generateReject( const Message& message, const std::string& str )
841
930
 
842
931
  void Session::generateBusinessReject( const Message& message, int err, int field )
843
932
  {
844
- Message reject;
933
+ SmartPtr<Message> pMsg(newMessage("j"));
934
+ Message & reject = *pMsg;
935
+
845
936
  reject.getHeader().setField( MsgType( MsgType_BusinessMessageReject ) );
846
937
  if( m_sessionID.isFIXT() )
847
938
  reject.setField( DefaultApplVerID(m_senderDefaultApplVerID) );
@@ -904,7 +995,9 @@ void Session::generateBusinessReject( const Message& message, int err, int field
904
995
 
905
996
  void Session::generateLogout( const std::string& text )
906
997
  {
907
- Message logout;
998
+ SmartPtr<Message> pMsg(newMessage("5"));
999
+ Message & logout = *pMsg;
1000
+
908
1001
  logout.getHeader().setField( MsgType( MsgType_Logout ) );
909
1002
  fill( logout.getHeader() );
910
1003
  if ( text.length() )
@@ -1076,7 +1169,7 @@ bool Session::doPossDup( const Message& msg )
1076
1169
  {
1077
1170
  if ( !header.getFieldIfSet( origSendingTime ) )
1078
1171
  {
1079
- generateReject( msg, SessionRejectReason_REQUIRED_TAG_MISSING, origSendingTime.getField() );
1172
+ generateReject( msg, SessionRejectReason_REQUIRED_TAG_MISSING, origSendingTime.getTag() );
1080
1173
  return false;
1081
1174
  }
1082
1175