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
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.2
3
+ * Version 3.0.10
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -0,0 +1,410 @@
1
+ /* ====================================================================
2
+ * Copyright (c) 1998-2006 Ralf S. Engelschall. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following
13
+ * disclaimer in the documentation and/or other materials
14
+ * provided with the distribution.
15
+ *
16
+ * 3. All advertising materials mentioning features or use of this
17
+ * software must display the following acknowledgment:
18
+ * "This product includes software developed by
19
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
20
+ * mod_ssl project (http://www.modssl.org/)."
21
+ *
22
+ * 4. The names "mod_ssl" must not be used to endorse or promote
23
+ * products derived from this software without prior written
24
+ * permission. For written permission, please contact
25
+ * rse@engelschall.com.
26
+ *
27
+ * 5. Products derived from this software may not be called "mod_ssl"
28
+ * nor may "mod_ssl" appear in their names without prior
29
+ * written permission of Ralf S. Engelschall.
30
+ *
31
+ * 6. Redistributions of any form whatsoever must retain the following
32
+ * acknowledgment:
33
+ * "This product includes software developed by
34
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
35
+ * mod_ssl project (http://www.modssl.org/)."
36
+ *
37
+ * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY
38
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR
41
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
48
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
49
+ * ====================================================================
50
+ */
51
+
52
+ /* ====================================================================
53
+ * Copyright (c) 1995-1999 Ben Laurie. All rights reserved.
54
+ *
55
+ * Redistribution and use in source and binary forms, with or without
56
+ * modification, are permitted provided that the following conditions
57
+ * are met:
58
+ *
59
+ * 1. Redistributions of source code must retain the above copyright
60
+ * notice, this list of conditions and the following disclaimer.
61
+ *
62
+ * 2. Redistributions in binary form must reproduce the above copyright
63
+ * notice, this list of conditions and the following disclaimer in
64
+ * the documentation and/or other materials provided with the
65
+ * distribution.
66
+ *
67
+ * 3. All advertising materials mentioning features or use of this
68
+ * software must display the following acknowledgment:
69
+ * "This product includes software developed by Ben Laurie
70
+ * for use in the Apache-SSL HTTP server project."
71
+ *
72
+ * 4. The name "Apache-SSL Server" must not be used to
73
+ * endorse or promote products derived from this software without
74
+ * prior written permission.
75
+ *
76
+ * 5. Redistributions of any form whatsoever must retain the following
77
+ * acknowledgment:
78
+ * "This product includes software developed by Ben Laurie
79
+ * for use in the Apache-SSL HTTP server project."
80
+ *
81
+ * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY
82
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
83
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
84
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR
85
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
86
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
87
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
88
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
89
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
90
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
91
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
92
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
93
+ * ====================================================================
94
+ */
95
+
96
+ /****************************************************************************
97
+ ** Copyright (c) 2001-2014
98
+ **
99
+ ** This file is part of the QuickFIX FIX Engine
100
+ **
101
+ ** This file may be distributed under the terms of the quickfixengine.org
102
+ ** license as defined by quickfixengine.org and appearing in the file
103
+ ** LICENSE included in the packaging of this file.
104
+ **
105
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
106
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
107
+ **
108
+ ** See http://www.quickfixengine.org/LICENSE for licensing information.
109
+ **
110
+ ** Contact ask@quickfixengine.org if any conditions of this licensing are
111
+ ** not clear to you.
112
+ **
113
+ ****************************************************************************/
114
+
115
+ #ifdef _MSC_VER
116
+ #include "stdafx.h"
117
+ #else
118
+ #include "config.h"
119
+ #endif
120
+
121
+ #if (HAVE_SSL > 0)
122
+
123
+ #include "SSLSocketAcceptor.h"
124
+ #include "Session.h"
125
+ #include "Settings.h"
126
+ #include "Utility.h"
127
+ #include "Exceptions.h"
128
+
129
+ namespace FIX
130
+ {
131
+
132
+ FIX::SSLSocketAcceptor *acceptObj = 0;
133
+
134
+ int SSLSocketAcceptor::passPhraseHandleCB(char *buf, int bufsize, int verify, void *job)
135
+ {
136
+ return acceptObj->passwordHandleCallback(buf, bufsize, verify, job);
137
+ }
138
+
139
+ SSLSocketAcceptor::SSLSocketAcceptor( Application& application,
140
+ MessageStoreFactory& factory,
141
+ const SessionSettings& settings ) throw( ConfigError )
142
+ : Acceptor( application, factory, settings ),
143
+ m_pServer( 0 ), m_sslInit(false),
144
+ m_verify(SSL_CLIENT_VERIFY_NOTSET), m_ctx(0), m_revocationStore(0)
145
+ {
146
+ acceptObj = this;
147
+ }
148
+
149
+ SSLSocketAcceptor::SSLSocketAcceptor( Application& application,
150
+ MessageStoreFactory& factory,
151
+ const SessionSettings& settings,
152
+ LogFactory& logFactory ) throw( ConfigError )
153
+ : Acceptor( application, factory, settings, logFactory ),
154
+ m_pServer( 0 ), m_sslInit(false),
155
+ m_verify(SSL_CLIENT_VERIFY_NOTSET), m_ctx(0), m_revocationStore(0)
156
+ {
157
+ acceptObj = this;
158
+ }
159
+
160
+ SSLSocketAcceptor::~SSLSocketAcceptor()
161
+ {
162
+ SocketConnections::iterator iter;
163
+ for ( iter = m_connections.begin(); iter != m_connections.end(); ++iter )
164
+ delete iter->second;
165
+
166
+ if (m_sslInit)
167
+ {
168
+ SSL_CTX_free(m_ctx);
169
+ m_ctx = 0;
170
+ ssl_term();
171
+ }
172
+ }
173
+
174
+ void SSLSocketAcceptor::onConfigure( const SessionSettings& s )
175
+ throw ( ConfigError )
176
+ {
177
+ std::set<SessionID> sessions = s.getSessions();
178
+ std::set<SessionID>::iterator i;
179
+ for( i = sessions.begin(); i != sessions.end(); ++i )
180
+ {
181
+ const Dictionary& settings = s.get( *i );
182
+ settings.getInt( SOCKET_ACCEPT_PORT );
183
+ if( settings.has(SOCKET_REUSE_ADDRESS) )
184
+ settings.getBool( SOCKET_REUSE_ADDRESS );
185
+ if( settings.has(SOCKET_NODELAY) )
186
+ settings.getBool( SOCKET_NODELAY );
187
+ }
188
+ }
189
+
190
+ void SSLSocketAcceptor::onInitialize( const SessionSettings& s )
191
+ throw ( RuntimeError )
192
+ {
193
+ if (!m_sslInit)
194
+ {
195
+
196
+ ssl_init();
197
+
198
+ std::string errStr;
199
+
200
+ /* set up the application context */
201
+ if ((m_ctx = createSSLContext(true, m_settings, errStr)) == 0)
202
+ {
203
+ ssl_term();
204
+ throw RuntimeError(errStr);
205
+ }
206
+
207
+ if (!loadSSLCert(m_ctx, true, m_settings, getLog(), SSLSocketAcceptor::passPhraseHandleCB, errStr))
208
+ {
209
+ ssl_term();
210
+ throw RuntimeError(errStr);
211
+ }
212
+
213
+ if (!loadCAInfo(m_ctx, true, m_settings, getLog(), errStr, m_verify))
214
+ {
215
+ ssl_term();
216
+ throw RuntimeError(errStr);
217
+ }
218
+
219
+ m_revocationStore = loadCRLInfo(m_ctx, m_settings, getLog(), errStr);
220
+ if (!m_revocationStore && !errStr.empty())
221
+ {
222
+ ssl_term();
223
+ throw RuntimeError(errStr);
224
+ }
225
+
226
+ m_sslInit = true;
227
+ }
228
+
229
+ short port = 0;
230
+
231
+ try
232
+ {
233
+ m_pServer = new SocketServer( 1 );
234
+
235
+ std::set<SessionID> sessions = s.getSessions();
236
+ std::set<SessionID>::iterator i = sessions.begin();
237
+ for( ; i != sessions.end(); ++i )
238
+ {
239
+ const Dictionary& settings = s.get( *i );
240
+ port = (short)settings.getInt( SOCKET_ACCEPT_PORT );
241
+
242
+ const bool reuseAddress = settings.has( SOCKET_REUSE_ADDRESS ) ?
243
+ settings.getBool( SOCKET_REUSE_ADDRESS ) : true;
244
+
245
+ const bool noDelay = settings.has( SOCKET_NODELAY ) ?
246
+ settings.getBool( SOCKET_NODELAY ) : false;
247
+
248
+ const int sendBufSize = settings.has( SOCKET_SEND_BUFFER_SIZE ) ?
249
+ settings.getInt( SOCKET_SEND_BUFFER_SIZE ) : 0;
250
+
251
+ const int rcvBufSize = settings.has( SOCKET_RECEIVE_BUFFER_SIZE ) ?
252
+ settings.getInt( SOCKET_RECEIVE_BUFFER_SIZE ) : 0;
253
+
254
+ m_portToSessions[port].insert( *i );
255
+ m_pServer->add( port, reuseAddress, noDelay, sendBufSize, rcvBufSize );
256
+ }
257
+ }
258
+ catch( SocketException& e )
259
+ {
260
+ throw RuntimeError( "Unable to create, bind, or listen to port "
261
+ + IntConvertor::convert( (unsigned short)port ) + " (" + e.what() + ")" );
262
+ }
263
+ }
264
+
265
+ void SSLSocketAcceptor::onStart()
266
+ {
267
+ while ( !isStopped() && m_pServer && m_pServer->block( *this ) ) {}
268
+
269
+ if( !m_pServer )
270
+ return;
271
+
272
+ time_t start = 0;
273
+ time_t now = 0;
274
+
275
+ ::time( &start );
276
+ while ( isLoggedOn() )
277
+ {
278
+ m_pServer->block( *this );
279
+ if( ::time(&now) -5 >= start )
280
+ break;
281
+ }
282
+
283
+ m_pServer->close();
284
+ delete m_pServer;
285
+ m_pServer = 0;
286
+ }
287
+
288
+ bool SSLSocketAcceptor::onPoll( double timeout )
289
+ {
290
+ if( !m_pServer )
291
+ return false;
292
+
293
+ time_t start = 0;
294
+ time_t now = 0;
295
+
296
+ if( isStopped() )
297
+ {
298
+ if( start == 0 )
299
+ ::time( &start );
300
+ if( !isLoggedOn() )
301
+ {
302
+ start = 0;
303
+ return false;
304
+ }
305
+ if( ::time(&now) - 5 >= start )
306
+ {
307
+ start = 0;
308
+ return false;
309
+ }
310
+ }
311
+
312
+ m_pServer->block( *this, true, timeout );
313
+ return true;
314
+ }
315
+
316
+ void SSLSocketAcceptor::onStop()
317
+ {
318
+ }
319
+
320
+ void SSLSocketAcceptor::onConnect( SocketServer& server, int a, int s )
321
+ {
322
+ if ( !socket_isValid( s ) ) return;
323
+ SocketConnections::iterator i = m_connections.find( s );
324
+ if ( i != m_connections.end() ) return;
325
+ int port = server.socketToPort( a );
326
+ Sessions sessions = m_portToSessions[port];
327
+
328
+ SSL *ssl = SSL_new(m_ctx);
329
+ SSL_clear(ssl);
330
+ BIO *sBio = BIO_new_socket(s, BIO_CLOSE);
331
+ SSL_set_bio(ssl, sBio, sBio);
332
+ // TODO - check this
333
+ SSL_set_app_data(ssl, m_revocationStore);
334
+ SSL_set_verify_result(ssl, X509_V_OK);
335
+
336
+ SSLSocketConnection * sconn = new SSLSocketConnection( s, ssl, sessions, &server.getMonitor() );
337
+ // SSL accept
338
+ if (acceptSSLConnection(sconn->getSocket(), sconn->sslObject(), getLog(), m_verify) != 0)
339
+ {
340
+ std::stringstream stream;
341
+ stream << "Failed to accept SSL connection from " << socket_peername( s ) << " on port " << port;
342
+ if( getLog() )
343
+ getLog()->onEvent( stream.str() );
344
+
345
+ delete sconn;
346
+ return;
347
+ }
348
+
349
+ m_connections[ s ] = sconn;
350
+
351
+ std::stringstream stream;
352
+ stream << "Accepted SSL connection from " << socket_peername( s ) << " on port " << port;
353
+
354
+ if( getLog() )
355
+ getLog()->onEvent( stream.str() );
356
+ }
357
+
358
+ void SSLSocketAcceptor::onWrite( SocketServer& server, int s )
359
+ {
360
+ SocketConnections::iterator i = m_connections.find( s );
361
+ if ( i == m_connections.end() ) return ;
362
+ SSLSocketConnection* pSocketConnection = i->second;
363
+ if( pSocketConnection->processQueue() )
364
+ pSocketConnection->unsignal();
365
+ }
366
+
367
+ bool SSLSocketAcceptor::onData( SocketServer& server, int s )
368
+ {
369
+ SocketConnections::iterator i = m_connections.find( s );
370
+ if ( i == m_connections.end() ) return false;
371
+ SSLSocketConnection* pSocketConnection = i->second;
372
+ return pSocketConnection->read( *this, server );
373
+ }
374
+
375
+ void SSLSocketAcceptor::onDisconnect( SocketServer&, int s )
376
+ {
377
+ SocketConnections::iterator i = m_connections.find( s );
378
+ if ( i == m_connections.end() ) return ;
379
+ SSLSocketConnection* pSocketConnection = i->second;
380
+
381
+ Session* pSession = pSocketConnection->getSession();
382
+ if ( pSession ) pSession->disconnect();
383
+
384
+ delete pSocketConnection;
385
+ m_connections.erase( s );
386
+ }
387
+
388
+ void SSLSocketAcceptor::onError( SocketServer& )
389
+ {
390
+ }
391
+
392
+ void SSLSocketAcceptor::onTimeout( SocketServer& )
393
+ {
394
+ SocketConnections::iterator i;
395
+ for ( i = m_connections.begin(); i != m_connections.end(); ++i )
396
+ i->second->onTimeout();
397
+ }
398
+
399
+ int SSLSocketAcceptor::passwordHandleCallback(char *buf, size_t bufsize,
400
+ int verify, void *job)
401
+ {
402
+ if (m_password.length() > bufsize)
403
+ return -1;
404
+
405
+ std::strcpy(buf, m_password.c_str());
406
+ return m_password.length();
407
+ }
408
+ }
409
+
410
+ #endif
@@ -0,0 +1,185 @@
1
+ /* ====================================================================
2
+ * Copyright (c) 1998-2006 Ralf S. Engelschall. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following
13
+ * disclaimer in the documentation and/or other materials
14
+ * provided with the distribution.
15
+ *
16
+ * 3. All advertising materials mentioning features or use of this
17
+ * software must display the following acknowledgment:
18
+ * "This product includes software developed by
19
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
20
+ * mod_ssl project (http://www.modssl.org/)."
21
+ *
22
+ * 4. The names "mod_ssl" must not be used to endorse or promote
23
+ * products derived from this software without prior written
24
+ * permission. For written permission, please contact
25
+ * rse@engelschall.com.
26
+ *
27
+ * 5. Products derived from this software may not be called "mod_ssl"
28
+ * nor may "mod_ssl" appear in their names without prior
29
+ * written permission of Ralf S. Engelschall.
30
+ *
31
+ * 6. Redistributions of any form whatsoever must retain the following
32
+ * acknowledgment:
33
+ * "This product includes software developed by
34
+ * Ralf S. Engelschall <rse@engelschall.com> for use in the
35
+ * mod_ssl project (http://www.modssl.org/)."
36
+ *
37
+ * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY
38
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR
41
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
48
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
49
+ * ====================================================================
50
+ */
51
+
52
+ /* ====================================================================
53
+ * Copyright (c) 1995-1999 Ben Laurie. All rights reserved.
54
+ *
55
+ * Redistribution and use in source and binary forms, with or without
56
+ * modification, are permitted provided that the following conditions
57
+ * are met:
58
+ *
59
+ * 1. Redistributions of source code must retain the above copyright
60
+ * notice, this list of conditions and the following disclaimer.
61
+ *
62
+ * 2. Redistributions in binary form must reproduce the above copyright
63
+ * notice, this list of conditions and the following disclaimer in
64
+ * the documentation and/or other materials provided with the
65
+ * distribution.
66
+ *
67
+ * 3. All advertising materials mentioning features or use of this
68
+ * software must display the following acknowledgment:
69
+ * "This product includes software developed by Ben Laurie
70
+ * for use in the Apache-SSL HTTP server project."
71
+ *
72
+ * 4. The name "Apache-SSL Server" must not be used to
73
+ * endorse or promote products derived from this software without
74
+ * prior written permission.
75
+ *
76
+ * 5. Redistributions of any form whatsoever must retain the following
77
+ * acknowledgment:
78
+ * "This product includes software developed by Ben Laurie
79
+ * for use in the Apache-SSL HTTP server project."
80
+ *
81
+ * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY
82
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
83
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
84
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR
85
+ * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
86
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
87
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
88
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
89
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
90
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
91
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
92
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
93
+ * ====================================================================
94
+ */
95
+
96
+ /* -*- C++ -*- */
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_SSLSOCKETACCEPTOR_H
118
+ #define FIX_SSLSOCKETACCEPTOR_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 "Acceptor.h"
127
+ #include "SocketServer.h"
128
+ #include "SSLSocketConnection.h"
129
+
130
+ namespace FIX
131
+ {
132
+ /// Socket implementation of Acceptor.
133
+ class SSLSocketAcceptor : public Acceptor, SocketServer::Strategy
134
+ {
135
+ friend class SSLSocketConnection;
136
+ public:
137
+ SSLSocketAcceptor( Application&, MessageStoreFactory&,
138
+ const SessionSettings& ) throw( ConfigError );
139
+ SSLSocketAcceptor( Application&, MessageStoreFactory&,
140
+ const SessionSettings&, LogFactory& ) throw( ConfigError );
141
+
142
+ virtual ~SSLSocketAcceptor();
143
+
144
+ void setPassword(const std::string &pwd) { m_password.assign(pwd); }
145
+
146
+ int passwordHandleCallback(char *buf, size_t bufsize, int verify, void *job);
147
+
148
+ static int passPhraseHandleCB(char *buf, int bufsize, int verify, void *job);
149
+
150
+ private:
151
+ bool readSettings( const SessionSettings& );
152
+
153
+ typedef std::set < SessionID > Sessions;
154
+ typedef std::map < int, Sessions > PortToSessions;
155
+ typedef std::map < int, SSLSocketConnection* > SocketConnections;
156
+
157
+ void onConfigure( const SessionSettings& ) throw ( ConfigError );
158
+ void onInitialize( const SessionSettings& ) throw ( RuntimeError );
159
+
160
+ void onStart();
161
+ bool onPoll( double timeout );
162
+ void onStop();
163
+
164
+ void onConnect( SocketServer&, int, int );
165
+ void onWrite( SocketServer&, int );
166
+ bool onData( SocketServer&, int );
167
+ void onDisconnect( SocketServer&, int );
168
+ void onError( SocketServer& );
169
+ void onTimeout( SocketServer& );
170
+
171
+ SocketServer* m_pServer;
172
+ PortToSessions m_portToSessions;
173
+ SocketConnections m_connections;
174
+
175
+ bool m_sslInit;
176
+ int m_verify;
177
+ SSL_CTX *m_ctx;
178
+ X509_STORE *m_revocationStore;
179
+ std::string m_password;
180
+ };
181
+ /*! @} */
182
+ }
183
+
184
+ #endif
185
+ #endif //FIX_SSLSOCKETACCEPTOR_H