quickfix_ruby 1.14.3
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.
- checksums.yaml +7 -0
- data/ext/quickfix/Acceptor.cpp +248 -0
- data/ext/quickfix/Acceptor.h +127 -0
- data/ext/quickfix/Allocator.h +9 -0
- data/ext/quickfix/Application.h +127 -0
- data/ext/quickfix/AtomicCount.h +109 -0
- data/ext/quickfix/DOMDocument.h +74 -0
- data/ext/quickfix/DataDictionary.cpp +618 -0
- data/ext/quickfix/DataDictionary.h +539 -0
- data/ext/quickfix/DataDictionaryProvider.cpp +71 -0
- data/ext/quickfix/DataDictionaryProvider.h +70 -0
- data/ext/quickfix/DatabaseConnectionID.h +105 -0
- data/ext/quickfix/DatabaseConnectionPool.h +91 -0
- data/ext/quickfix/Dictionary.cpp +162 -0
- data/ext/quickfix/Dictionary.h +94 -0
- data/ext/quickfix/Event.h +95 -0
- data/ext/quickfix/Exceptions.h +299 -0
- data/ext/quickfix/Field.h +672 -0
- data/ext/quickfix/FieldConvertors.h +863 -0
- data/ext/quickfix/FieldMap.cpp +238 -0
- data/ext/quickfix/FieldMap.h +244 -0
- data/ext/quickfix/FieldNumbers.h +46 -0
- data/ext/quickfix/FieldTypes.cpp +64 -0
- data/ext/quickfix/FieldTypes.h +698 -0
- data/ext/quickfix/Fields.h +31 -0
- data/ext/quickfix/FileLog.cpp +200 -0
- data/ext/quickfix/FileLog.h +112 -0
- data/ext/quickfix/FileStore.cpp +332 -0
- data/ext/quickfix/FileStore.h +129 -0
- data/ext/quickfix/FixFieldNumbers.h +1537 -0
- data/ext/quickfix/FixFields.h +1538 -0
- data/ext/quickfix/FixValues.h +3281 -0
- data/ext/quickfix/FlexLexer.h +188 -0
- data/ext/quickfix/Group.cpp +64 -0
- data/ext/quickfix/Group.h +73 -0
- data/ext/quickfix/HtmlBuilder.h +186 -0
- data/ext/quickfix/HttpConnection.cpp +739 -0
- data/ext/quickfix/HttpConnection.h +78 -0
- data/ext/quickfix/HttpMessage.cpp +149 -0
- data/ext/quickfix/HttpMessage.h +133 -0
- data/ext/quickfix/HttpParser.cpp +49 -0
- data/ext/quickfix/HttpParser.h +54 -0
- data/ext/quickfix/HttpServer.cpp +169 -0
- data/ext/quickfix/HttpServer.h +78 -0
- data/ext/quickfix/Initiator.cpp +289 -0
- data/ext/quickfix/Initiator.h +149 -0
- data/ext/quickfix/Log.cpp +77 -0
- data/ext/quickfix/Log.h +179 -0
- data/ext/quickfix/Message.cpp +580 -0
- data/ext/quickfix/Message.h +370 -0
- data/ext/quickfix/MessageCracker.h +188 -0
- data/ext/quickfix/MessageSorters.cpp +105 -0
- data/ext/quickfix/MessageSorters.h +156 -0
- data/ext/quickfix/MessageStore.cpp +146 -0
- data/ext/quickfix/MessageStore.h +174 -0
- data/ext/quickfix/Mutex.h +131 -0
- data/ext/quickfix/MySQLConnection.h +194 -0
- data/ext/quickfix/MySQLLog.cpp +275 -0
- data/ext/quickfix/MySQLLog.h +145 -0
- data/ext/quickfix/MySQLStore.cpp +331 -0
- data/ext/quickfix/MySQLStore.h +142 -0
- data/ext/quickfix/NullStore.cpp +54 -0
- data/ext/quickfix/NullStore.h +99 -0
- data/ext/quickfix/OdbcConnection.h +266 -0
- data/ext/quickfix/OdbcLog.cpp +252 -0
- data/ext/quickfix/OdbcLog.h +117 -0
- data/ext/quickfix/OdbcStore.cpp +338 -0
- data/ext/quickfix/OdbcStore.h +113 -0
- data/ext/quickfix/PUGIXML_DOMDocument.cpp +112 -0
- data/ext/quickfix/PUGIXML_DOMDocument.h +81 -0
- data/ext/quickfix/Parser.cpp +103 -0
- data/ext/quickfix/Parser.h +57 -0
- data/ext/quickfix/PostgreSQLConnection.h +176 -0
- data/ext/quickfix/PostgreSQLLog.cpp +276 -0
- data/ext/quickfix/PostgreSQLLog.h +144 -0
- data/ext/quickfix/PostgreSQLStore.cpp +334 -0
- data/ext/quickfix/PostgreSQLStore.h +141 -0
- data/ext/quickfix/Queue.h +75 -0
- data/ext/quickfix/QuickfixRuby.cpp +252066 -0
- data/ext/quickfix/QuickfixRuby.h +34 -0
- data/ext/quickfix/Responder.h +43 -0
- data/ext/quickfix/Session.cpp +1487 -0
- data/ext/quickfix/Session.h +335 -0
- data/ext/quickfix/SessionFactory.cpp +274 -0
- data/ext/quickfix/SessionFactory.h +86 -0
- data/ext/quickfix/SessionID.h +170 -0
- data/ext/quickfix/SessionSettings.cpp +189 -0
- data/ext/quickfix/SessionSettings.h +171 -0
- data/ext/quickfix/SessionState.h +231 -0
- data/ext/quickfix/Settings.cpp +100 -0
- data/ext/quickfix/Settings.h +53 -0
- data/ext/quickfix/SharedArray.h +150 -0
- data/ext/quickfix/SocketAcceptor.cpp +222 -0
- data/ext/quickfix/SocketAcceptor.h +75 -0
- data/ext/quickfix/SocketConnection.cpp +238 -0
- data/ext/quickfix/SocketConnection.h +103 -0
- data/ext/quickfix/SocketConnector.cpp +116 -0
- data/ext/quickfix/SocketConnector.h +67 -0
- data/ext/quickfix/SocketInitiator.cpp +260 -0
- data/ext/quickfix/SocketInitiator.h +81 -0
- data/ext/quickfix/SocketMonitor.cpp +335 -0
- data/ext/quickfix/SocketMonitor.h +111 -0
- data/ext/quickfix/SocketServer.cpp +177 -0
- data/ext/quickfix/SocketServer.h +100 -0
- data/ext/quickfix/ThreadedSocketAcceptor.cpp +258 -0
- data/ext/quickfix/ThreadedSocketAcceptor.h +98 -0
- data/ext/quickfix/ThreadedSocketConnection.cpp +209 -0
- data/ext/quickfix/ThreadedSocketConnection.h +82 -0
- data/ext/quickfix/ThreadedSocketInitiator.cpp +268 -0
- data/ext/quickfix/ThreadedSocketInitiator.h +84 -0
- data/ext/quickfix/TimeRange.cpp +173 -0
- data/ext/quickfix/TimeRange.h +258 -0
- data/ext/quickfix/Utility.cpp +537 -0
- data/ext/quickfix/Utility.h +219 -0
- data/ext/quickfix/Values.h +62 -0
- data/ext/quickfix/config.h +0 -0
- data/ext/quickfix/config_windows.h +0 -0
- data/ext/quickfix/extconf.rb +12 -0
- data/ext/quickfix/index.h +37 -0
- data/ext/quickfix/pugiconfig.hpp +72 -0
- data/ext/quickfix/pugixml.cpp +10765 -0
- data/ext/quickfix/pugixml.hpp +1341 -0
- data/ext/quickfix/strptime.h +7 -0
- data/lib/quickfix40.rb +274 -0
- data/lib/quickfix41.rb +351 -0
- data/lib/quickfix42.rb +1184 -0
- data/lib/quickfix43.rb +3504 -0
- data/lib/quickfix44.rb +10721 -0
- data/lib/quickfix50.rb +13426 -0
- data/lib/quickfix50sp1.rb +15629 -0
- data/lib/quickfix50sp2.rb +17068 -0
- data/lib/quickfix_fields.rb +19853 -0
- data/lib/quickfix_ruby.rb +82 -0
- data/lib/quickfixt11.rb +70 -0
- data/spec/FIX40.xml +862 -0
- data/spec/FIX41.xml +1285 -0
- data/spec/FIX42.xml +2746 -0
- data/spec/FIX43.xml +4229 -0
- data/spec/FIX44.xml +6596 -0
- data/spec/FIX50.xml +8137 -0
- data/spec/FIX50SP1.xml +9496 -0
- data/spec/FIX50SP2.xml +10011 -0
- data/spec/FIXT11.xml +313 -0
- data/test/test_DataDictionaryTestCase.rb +268 -0
- data/test/test_DictionaryTestCase.rb +112 -0
- data/test/test_FieldBaseTestCase.rb +24 -0
- data/test/test_MessageTestCase.rb +368 -0
- data/test/test_SessionSettingsTestCase.rb +41 -0
- metadata +193 -0
|
@@ -0,0 +1,170 @@
|
|
|
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_SESSIONID_H
|
|
23
|
+
#define FIX_SESSIONID_H
|
|
24
|
+
|
|
25
|
+
#include "Fields.h"
|
|
26
|
+
|
|
27
|
+
namespace FIX
|
|
28
|
+
{
|
|
29
|
+
/// Unique session id consists of BeginString, SenderCompID and TargetCompID.
|
|
30
|
+
class SessionID
|
|
31
|
+
{
|
|
32
|
+
public:
|
|
33
|
+
SessionID()
|
|
34
|
+
{
|
|
35
|
+
toString(m_frozenString);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
SessionID( const std::string& beginString,
|
|
39
|
+
const std::string& senderCompID,
|
|
40
|
+
const std::string& targetCompID,
|
|
41
|
+
const std::string& sessionQualifier = "" )
|
|
42
|
+
: m_beginString( BeginString(beginString) ),
|
|
43
|
+
m_senderCompID( SenderCompID(senderCompID) ),
|
|
44
|
+
m_targetCompID( TargetCompID(targetCompID) ),
|
|
45
|
+
m_sessionQualifier( sessionQualifier ),
|
|
46
|
+
m_isFIXT(false)
|
|
47
|
+
{
|
|
48
|
+
toString(m_frozenString);
|
|
49
|
+
if( beginString.substr(0, 4) == "FIXT" )
|
|
50
|
+
m_isFIXT = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const BeginString& getBeginString() const
|
|
54
|
+
{ return m_beginString; }
|
|
55
|
+
const SenderCompID& getSenderCompID() const
|
|
56
|
+
{ return m_senderCompID; }
|
|
57
|
+
const TargetCompID& getTargetCompID() const
|
|
58
|
+
{ return m_targetCompID; }
|
|
59
|
+
const std::string& getSessionQualifier() const
|
|
60
|
+
{ return m_sessionQualifier; }
|
|
61
|
+
const bool isFIXT() const
|
|
62
|
+
{ return m_isFIXT; }
|
|
63
|
+
|
|
64
|
+
/// Get a string representation of the SessionID
|
|
65
|
+
std::string toString() const
|
|
66
|
+
{
|
|
67
|
+
return m_frozenString;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Return a reference for a high-performance scenario
|
|
71
|
+
const std::string& toStringFrozen() const
|
|
72
|
+
{
|
|
73
|
+
return m_frozenString;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Build from string representation of SessionID
|
|
77
|
+
void fromString( const std::string& str )
|
|
78
|
+
{
|
|
79
|
+
std::string::size_type first =
|
|
80
|
+
str.find_first_of(':');
|
|
81
|
+
std::string::size_type second =
|
|
82
|
+
str.find("->");
|
|
83
|
+
std::string::size_type third =
|
|
84
|
+
str.find_last_of(':');
|
|
85
|
+
if( first == std::string::npos )
|
|
86
|
+
return;
|
|
87
|
+
if( second == std::string::npos )
|
|
88
|
+
return;
|
|
89
|
+
m_beginString = str.substr(0, first);
|
|
90
|
+
m_senderCompID = str.substr(first+1, second - first - 1);
|
|
91
|
+
if( first == third )
|
|
92
|
+
{
|
|
93
|
+
m_targetCompID = str.substr(second+2);
|
|
94
|
+
m_sessionQualifier = "";
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
{
|
|
98
|
+
m_targetCompID = str.substr(second+2, third - second - 2);
|
|
99
|
+
m_sessionQualifier = str.substr(third+1);
|
|
100
|
+
}
|
|
101
|
+
toString(m_frozenString);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// Get a string representation without making a copy
|
|
105
|
+
std::string& toString( std::string& str ) const
|
|
106
|
+
{
|
|
107
|
+
str = getBeginString().getValue() + ":" +
|
|
108
|
+
getSenderCompID().getValue() + "->" +
|
|
109
|
+
getTargetCompID().getValue();
|
|
110
|
+
if( m_sessionQualifier.size() )
|
|
111
|
+
str += ":" + m_sessionQualifier;
|
|
112
|
+
return str;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
friend bool operator<( const SessionID&, const SessionID& );
|
|
116
|
+
friend bool operator==( const SessionID&, const SessionID& );
|
|
117
|
+
friend bool operator!=( const SessionID&, const SessionID& );
|
|
118
|
+
friend std::ostream& operator<<( std::ostream&, const SessionID& );
|
|
119
|
+
friend std::ostream& operator>>( std::ostream&, const SessionID& );
|
|
120
|
+
|
|
121
|
+
SessionID operator~() const
|
|
122
|
+
{
|
|
123
|
+
return SessionID( m_beginString, SenderCompID( m_targetCompID ),
|
|
124
|
+
TargetCompID( m_senderCompID ), m_sessionQualifier );
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private:
|
|
128
|
+
BeginString m_beginString;
|
|
129
|
+
SenderCompID m_senderCompID;
|
|
130
|
+
TargetCompID m_targetCompID;
|
|
131
|
+
std::string m_sessionQualifier;
|
|
132
|
+
bool m_isFIXT;
|
|
133
|
+
std::string m_frozenString;
|
|
134
|
+
};
|
|
135
|
+
/*! @} */
|
|
136
|
+
|
|
137
|
+
inline bool operator<( const SessionID& lhs, const SessionID& rhs )
|
|
138
|
+
{
|
|
139
|
+
return lhs.toStringFrozen() < rhs.toStringFrozen();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
inline bool operator==( const SessionID& lhs, const SessionID& rhs )
|
|
143
|
+
{
|
|
144
|
+
return lhs.toStringFrozen() == rhs.toStringFrozen();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
inline bool operator!=( const SessionID& lhs, const SessionID& rhs )
|
|
148
|
+
{
|
|
149
|
+
return !( lhs == rhs );
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
inline std::ostream& operator<<
|
|
153
|
+
( std::ostream& stream, const SessionID& sessionID )
|
|
154
|
+
{
|
|
155
|
+
stream << sessionID.toStringFrozen();
|
|
156
|
+
return stream;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
inline std::istream& operator>>
|
|
160
|
+
( std::istream& stream, SessionID& sessionID )
|
|
161
|
+
{
|
|
162
|
+
std::string str;
|
|
163
|
+
stream >> str;
|
|
164
|
+
sessionID.fromString( str );
|
|
165
|
+
return stream;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
#endif //FIX_SESSIONID_H
|
|
170
|
+
|
|
@@ -0,0 +1,189 @@
|
|
|
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 "SessionSettings.h"
|
|
27
|
+
#include "Settings.h"
|
|
28
|
+
#include "Values.h"
|
|
29
|
+
#include <fstream>
|
|
30
|
+
|
|
31
|
+
namespace FIX
|
|
32
|
+
{
|
|
33
|
+
SessionSettings::SessionSettings( std::istream& stream )
|
|
34
|
+
throw( ConfigError )
|
|
35
|
+
{
|
|
36
|
+
stream >> *this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
SessionSettings::SessionSettings( const std::string& file )
|
|
40
|
+
throw( ConfigError )
|
|
41
|
+
{
|
|
42
|
+
std::ifstream fstream( file.c_str() );
|
|
43
|
+
if ( !fstream.is_open() )
|
|
44
|
+
throw ConfigError( ( "File " + file + " not found" ).c_str() );
|
|
45
|
+
fstream >> *this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
std::istream& operator>>( std::istream& stream, SessionSettings& s )
|
|
49
|
+
throw( ConfigError )
|
|
50
|
+
{
|
|
51
|
+
Settings settings;
|
|
52
|
+
stream >> settings;
|
|
53
|
+
|
|
54
|
+
Settings::Sections section;
|
|
55
|
+
|
|
56
|
+
section = settings.get( "DEFAULT" );
|
|
57
|
+
Dictionary def;
|
|
58
|
+
if ( section.size() )
|
|
59
|
+
def = section[ 0 ];
|
|
60
|
+
s.set( def );
|
|
61
|
+
|
|
62
|
+
section = settings.get( "SESSION" );
|
|
63
|
+
Settings::Sections::size_type session;
|
|
64
|
+
Dictionary dict;
|
|
65
|
+
|
|
66
|
+
for ( session = 0; session < section.size(); ++session )
|
|
67
|
+
{
|
|
68
|
+
dict = section[ session ];
|
|
69
|
+
dict.merge( def );
|
|
70
|
+
|
|
71
|
+
BeginString beginString
|
|
72
|
+
( dict.getString( BEGINSTRING ) );
|
|
73
|
+
SenderCompID senderCompID
|
|
74
|
+
( dict.getString( SENDERCOMPID ) );
|
|
75
|
+
TargetCompID targetCompID
|
|
76
|
+
( dict.getString( TARGETCOMPID ) );
|
|
77
|
+
|
|
78
|
+
std::string sessionQualifier;
|
|
79
|
+
if( dict.has( SESSION_QUALIFIER ) )
|
|
80
|
+
sessionQualifier = dict.getString( SESSION_QUALIFIER );
|
|
81
|
+
SessionID sessionID( beginString, senderCompID, targetCompID, sessionQualifier );
|
|
82
|
+
s.set( sessionID, dict );
|
|
83
|
+
}
|
|
84
|
+
return stream;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
std::ostream& operator<<( std::ostream& stream, const SessionSettings& s )
|
|
88
|
+
{
|
|
89
|
+
const Dictionary& defaults = s.m_defaults;
|
|
90
|
+
if( defaults.size() )
|
|
91
|
+
{
|
|
92
|
+
stream << "[DEFAULT]" << std::endl;
|
|
93
|
+
Dictionary::iterator i;
|
|
94
|
+
for( i = defaults.begin(); i != defaults.end(); ++i )
|
|
95
|
+
stream << i->first << "=" << i->second << std::endl;
|
|
96
|
+
stream << std::endl;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
std::set<SessionID> sessions = s.getSessions();
|
|
100
|
+
std::set<SessionID>::iterator i;
|
|
101
|
+
for( i = sessions.begin(); i != sessions.end(); ++i )
|
|
102
|
+
{
|
|
103
|
+
stream << "[SESSION]" << std::endl;
|
|
104
|
+
const Dictionary& section = s.get( *i );
|
|
105
|
+
if( !section.size() ) continue;
|
|
106
|
+
|
|
107
|
+
Dictionary::iterator i;
|
|
108
|
+
for( i = section.begin(); i != section.end(); ++i )
|
|
109
|
+
{
|
|
110
|
+
if( defaults.has(i->first) && defaults.getString(i->first) == i->second )
|
|
111
|
+
continue;
|
|
112
|
+
stream << i->first << "=" << i->second << std::endl;
|
|
113
|
+
}
|
|
114
|
+
stream << std::endl;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return stream;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const bool SessionSettings::has( const SessionID& sessionID ) const
|
|
121
|
+
{
|
|
122
|
+
return m_settings.find( sessionID ) != m_settings.end();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const Dictionary& SessionSettings::get( const SessionID& sessionID ) const
|
|
126
|
+
throw( ConfigError )
|
|
127
|
+
{
|
|
128
|
+
Dictionaries::const_iterator i;
|
|
129
|
+
i = m_settings.find( sessionID );
|
|
130
|
+
if ( i == m_settings.end() ) throw ConfigError( "Session not found" );
|
|
131
|
+
return i->second;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void SessionSettings::set( const SessionID& sessionID,
|
|
135
|
+
Dictionary settings )
|
|
136
|
+
throw( ConfigError )
|
|
137
|
+
{
|
|
138
|
+
if( has(sessionID) )
|
|
139
|
+
throw ConfigError( "Duplicate Session " + sessionID.toString() );
|
|
140
|
+
|
|
141
|
+
settings.setString( BEGINSTRING, sessionID.getBeginString() );
|
|
142
|
+
settings.setString( SENDERCOMPID, sessionID.getSenderCompID() );
|
|
143
|
+
settings.setString( TARGETCOMPID, sessionID.getTargetCompID() );
|
|
144
|
+
|
|
145
|
+
settings.merge( m_defaults );
|
|
146
|
+
validate( settings );
|
|
147
|
+
m_settings[ sessionID ] = settings;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
void SessionSettings::set( const Dictionary& defaults ) throw( ConfigError )
|
|
151
|
+
{
|
|
152
|
+
m_defaults = defaults;
|
|
153
|
+
Dictionaries::iterator i = m_settings.begin();
|
|
154
|
+
for( i = m_settings.begin(); i != m_settings.end(); ++i )
|
|
155
|
+
i->second.merge( defaults );
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
std::set < SessionID > SessionSettings::getSessions() const
|
|
159
|
+
{
|
|
160
|
+
std::set < SessionID > result;
|
|
161
|
+
Dictionaries::const_iterator i;
|
|
162
|
+
for ( i = m_settings.begin(); i != m_settings.end(); ++i )
|
|
163
|
+
result.insert( i->first );
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
void SessionSettings::validate( const Dictionary& dictionary ) const
|
|
168
|
+
throw( ConfigError )
|
|
169
|
+
{
|
|
170
|
+
std::string beginString = dictionary.getString( BEGINSTRING );
|
|
171
|
+
if( beginString != BeginString_FIX40 &&
|
|
172
|
+
beginString != BeginString_FIX41 &&
|
|
173
|
+
beginString != BeginString_FIX42 &&
|
|
174
|
+
beginString != BeginString_FIX43 &&
|
|
175
|
+
beginString != BeginString_FIX44 &&
|
|
176
|
+
beginString != BeginString_FIXT11 )
|
|
177
|
+
{
|
|
178
|
+
throw ConfigError( std::string(BEGINSTRING) + " must be FIX.4.0 to FIX.4.4 or FIXT.1.1" );
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
std::string connectionType = dictionary.getString( CONNECTION_TYPE );
|
|
182
|
+
if( connectionType != "initiator" &&
|
|
183
|
+
connectionType != "acceptor" )
|
|
184
|
+
{
|
|
185
|
+
throw ConfigError( std::string(CONNECTION_TYPE) + " must be 'initiator' or 'acceptor'" );
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
@@ -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_SESSIONSETTINGS_H
|
|
23
|
+
#define FIX_SESSIONSETTINGS_H
|
|
24
|
+
|
|
25
|
+
#ifdef _MSC_VER
|
|
26
|
+
#pragma warning( disable : 4503 4355 4786 4290 )
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#include "Dictionary.h"
|
|
30
|
+
#include "SessionID.h"
|
|
31
|
+
#include "Exceptions.h"
|
|
32
|
+
#include <map>
|
|
33
|
+
#include <set>
|
|
34
|
+
|
|
35
|
+
namespace FIX
|
|
36
|
+
{
|
|
37
|
+
const char BEGINSTRING[] = "BeginString";
|
|
38
|
+
const char SENDERCOMPID[] = "SenderCompID";
|
|
39
|
+
const char TARGETCOMPID[] = "TargetCompID";
|
|
40
|
+
const char SESSION_QUALIFIER[] = "SessionQualifier";
|
|
41
|
+
const char DEFAULT_APPLVERID[] = "DefaultApplVerID";
|
|
42
|
+
const char CONNECTION_TYPE[] = "ConnectionType";
|
|
43
|
+
const char USE_DATA_DICTIONARY[] = "UseDataDictionary";
|
|
44
|
+
const char SEND_RESETSEQNUMFLAG[] = "SendResetSeqNumFlag";
|
|
45
|
+
const char SEND_REDUNDANT_RESENDREQUESTS[] = "SendRedundantResendRequests";
|
|
46
|
+
const char DATA_DICTIONARY[] = "DataDictionary";
|
|
47
|
+
const char TRANSPORT_DATA_DICTIONARY[] = "TransportDataDictionary";
|
|
48
|
+
const char APP_DATA_DICTIONARY[] = "AppDataDictionary";
|
|
49
|
+
const char USE_LOCAL_TIME[] = "UseLocalTime";
|
|
50
|
+
const char START_TIME[] = "StartTime";
|
|
51
|
+
const char END_TIME[] = "EndTime";
|
|
52
|
+
const char START_DAY[] = "StartDay";
|
|
53
|
+
const char END_DAY[] = "EndDay";
|
|
54
|
+
const char LOGON_TIME[] = "LogonTime";
|
|
55
|
+
const char LOGOUT_TIME[] = "LogoutTime";
|
|
56
|
+
const char LOGON_DAY[] = "LogonDay";
|
|
57
|
+
const char LOGOUT_DAY[] = "LogoutDay";
|
|
58
|
+
const char CHECK_COMPID[] = "CheckCompID";
|
|
59
|
+
const char CHECK_LATENCY[] = "CheckLatency";
|
|
60
|
+
const char MAX_LATENCY[] = "MaxLatency";
|
|
61
|
+
const char HEARTBTINT[] = "HeartBtInt";
|
|
62
|
+
const char SOCKET_ACCEPT_PORT[] = "SocketAcceptPort";
|
|
63
|
+
const char SOCKET_REUSE_ADDRESS[] = "SocketReuseAddress";
|
|
64
|
+
const char SOCKET_CONNECT_HOST[] = "SocketConnectHost";
|
|
65
|
+
const char SOCKET_CONNECT_PORT[] = "SocketConnectPort";
|
|
66
|
+
const char SOCKET_NODELAY[] = "SocketNodelay";
|
|
67
|
+
const char SOCKET_SEND_BUFFER_SIZE[] = "SendBufferSize";
|
|
68
|
+
const char SOCKET_RECEIVE_BUFFER_SIZE[] = "ReceiveBufferSize";
|
|
69
|
+
const char RECONNECT_INTERVAL[] = "ReconnectInterval";
|
|
70
|
+
const char VALIDATE_LENGTH_AND_CHECKSUM[] = "ValidateLengthAndChecksum";
|
|
71
|
+
const char VALIDATE_FIELDS_OUT_OF_ORDER[] = "ValidateFieldsOutOfOrder";
|
|
72
|
+
const char VALIDATE_FIELDS_HAVE_VALUES[] = "ValidateFieldsHaveValues";
|
|
73
|
+
const char VALIDATE_USER_DEFINED_FIELDS[] = "ValidateUserDefinedFields";
|
|
74
|
+
const char LOGON_TIMEOUT[] = "LogonTimeout";
|
|
75
|
+
const char LOGOUT_TIMEOUT[] = "LogoutTimeout";
|
|
76
|
+
const char FILE_STORE_PATH[] = "FileStorePath";
|
|
77
|
+
const char MYSQL_STORE_USECONNECTIONPOOL[] = "MySQLStoreUseConnectionPool";
|
|
78
|
+
const char MYSQL_STORE_DATABASE[] = "MySQLStoreDatabase";
|
|
79
|
+
const char MYSQL_STORE_USER[] = "MySQLStoreUser";
|
|
80
|
+
const char MYSQL_STORE_PASSWORD[] = "MySQLStorePassword";
|
|
81
|
+
const char MYSQL_STORE_HOST[] = "MySQLStoreHost";
|
|
82
|
+
const char MYSQL_STORE_PORT[] = "MySQLStorePort";
|
|
83
|
+
const char POSTGRESQL_STORE_USECONNECTIONPOOL[] = "PostgreSQLStoreUseConnectionPool";
|
|
84
|
+
const char POSTGRESQL_STORE_DATABASE[] = "PostgreSQLStoreDatabase";
|
|
85
|
+
const char POSTGRESQL_STORE_USER[] = "PostgreSQLStoreUser";
|
|
86
|
+
const char POSTGRESQL_STORE_PASSWORD[] = "PostgreSQLStorePassword";
|
|
87
|
+
const char POSTGRESQL_STORE_HOST[] = "PostgreSQLStoreHost";
|
|
88
|
+
const char POSTGRESQL_STORE_PORT[] = "PostgreSQLStorePort";
|
|
89
|
+
const char ODBC_STORE_USER[] = "OdbcStoreUser";
|
|
90
|
+
const char ODBC_STORE_PASSWORD[] = "OdbcStorePassword";
|
|
91
|
+
const char ODBC_STORE_CONNECTION_STRING[] = "OdbcStoreConnectionString";
|
|
92
|
+
const char FILE_LOG_PATH[] = "FileLogPath";
|
|
93
|
+
const char FILE_LOG_BACKUP_PATH[] = "FileLogBackupPath";
|
|
94
|
+
const char SCREEN_LOG_SHOW_INCOMING[] = "ScreenLogShowIncoming";
|
|
95
|
+
const char SCREEN_LOG_SHOW_OUTGOING[] = "ScreenLogShowOutgoing";
|
|
96
|
+
const char SCREEN_LOG_SHOW_EVENTS[] = "ScreenLogShowEvents";
|
|
97
|
+
const char MYSQL_LOG_USECONNECTIONPOOL[] = "MySQLLogUseConnectionPool";
|
|
98
|
+
const char MYSQL_LOG_DATABASE[] = "MySQLLogDatabase";
|
|
99
|
+
const char MYSQL_LOG_USER[] = "MySQLLogUser";
|
|
100
|
+
const char MYSQL_LOG_PASSWORD[] = "MySQLLogPassword";
|
|
101
|
+
const char MYSQL_LOG_HOST[] = "MySQLLogHost";
|
|
102
|
+
const char MYSQL_LOG_PORT[] = "MySQLLogPort";
|
|
103
|
+
const char MYSQL_LOG_INCOMING_TABLE[] = "MySQLLogIncomingTable";
|
|
104
|
+
const char MYSQL_LOG_OUTGOING_TABLE[] = "MySQLLogOutgoingTable";
|
|
105
|
+
const char MYSQL_LOG_EVENT_TABLE[] = "MySQLLogEventTable";
|
|
106
|
+
const char POSTGRESQL_LOG_USECONNECTIONPOOL[] = "PostgreSQLLogUseConnectionPool";
|
|
107
|
+
const char POSTGRESQL_LOG_DATABASE[] = "PostgreSQLLogDatabase";
|
|
108
|
+
const char POSTGRESQL_LOG_USER[] = "PostgreSQLLogUser";
|
|
109
|
+
const char POSTGRESQL_LOG_PASSWORD[] = "PostgreSQLLogPassword";
|
|
110
|
+
const char POSTGRESQL_LOG_HOST[] = "PostgreSQLLogHost";
|
|
111
|
+
const char POSTGRESQL_LOG_PORT[] = "PostgreSQLLogPort";
|
|
112
|
+
const char POSTGRESQL_LOG_INCOMING_TABLE[] = "PostgreSQLLogIncomingTable";
|
|
113
|
+
const char POSTGRESQL_LOG_OUTGOING_TABLE[] = "PostgreSQLLogOutgoingTable";
|
|
114
|
+
const char POSTGRESQL_LOG_EVENT_TABLE[] = "PostgreSQLLogEventTable";
|
|
115
|
+
const char ODBC_LOG_USER[] = "OdbcLogUser";
|
|
116
|
+
const char ODBC_LOG_PASSWORD[] = "OdbcLogPassword";
|
|
117
|
+
const char ODBC_LOG_CONNECTION_STRING[] = "OdbcLogConnectionString";
|
|
118
|
+
const char ODBC_LOG_INCOMING_TABLE[] = "OdbcLogIncomingTable";
|
|
119
|
+
const char ODBC_LOG_OUTGOING_TABLE[] = "OdbcLogOutgoingTable";
|
|
120
|
+
const char ODBC_LOG_EVENT_TABLE[] = "OdbcLogEventTable";
|
|
121
|
+
const char RESET_ON_LOGON[] = "ResetOnLogon";
|
|
122
|
+
const char RESET_ON_LOGOUT[] = "ResetOnLogout";
|
|
123
|
+
const char RESET_ON_DISCONNECT[] = "ResetOnDisconnect";
|
|
124
|
+
const char REFRESH_ON_LOGON[] = "RefreshOnLogon";
|
|
125
|
+
const char MILLISECONDS_IN_TIMESTAMP[] = "MillisecondsInTimeStamp";
|
|
126
|
+
const char HTTP_ACCEPT_PORT[] = "HttpAcceptPort";
|
|
127
|
+
const char PERSIST_MESSAGES[] = "PersistMessages";
|
|
128
|
+
|
|
129
|
+
/// Container for setting dictionaries mapped to sessions.
|
|
130
|
+
class SessionSettings
|
|
131
|
+
{
|
|
132
|
+
public:
|
|
133
|
+
SessionSettings() {}
|
|
134
|
+
SessionSettings( std::istream& stream ) throw( ConfigError );
|
|
135
|
+
SessionSettings( const std::string& file ) throw( ConfigError );
|
|
136
|
+
|
|
137
|
+
/// Check if session setings are present
|
|
138
|
+
const bool has( const SessionID& ) const;
|
|
139
|
+
|
|
140
|
+
/// Get a dictionary for a session.
|
|
141
|
+
const Dictionary& get( const SessionID& ) const throw( ConfigError );
|
|
142
|
+
/// Set a dictionary for a session
|
|
143
|
+
void set( const SessionID&, Dictionary ) throw( ConfigError );
|
|
144
|
+
|
|
145
|
+
/// Get global default settings
|
|
146
|
+
const Dictionary& get() const { return m_defaults; }
|
|
147
|
+
/// Set global default settings
|
|
148
|
+
void set( const Dictionary& defaults ) throw( ConfigError );
|
|
149
|
+
|
|
150
|
+
/// Number of session settings
|
|
151
|
+
size_t size() const { return m_settings.size(); }
|
|
152
|
+
|
|
153
|
+
typedef std::map < SessionID, Dictionary > Dictionaries;
|
|
154
|
+
std::set < SessionID > getSessions() const;
|
|
155
|
+
|
|
156
|
+
private:
|
|
157
|
+
void validate( const Dictionary& ) const throw( ConfigError );
|
|
158
|
+
|
|
159
|
+
Dictionaries m_settings;
|
|
160
|
+
Dictionary m_defaults;
|
|
161
|
+
|
|
162
|
+
friend std::ostream& operator<<( std::ostream&, const SessionSettings& );
|
|
163
|
+
};
|
|
164
|
+
/*! @} */
|
|
165
|
+
|
|
166
|
+
std::istream& operator>>( std::istream&, SessionSettings& )
|
|
167
|
+
throw( ConfigError );
|
|
168
|
+
std::ostream& operator<<( std::ostream&, const SessionSettings& );
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#endif //FIX_SESSIONSETTINGS_H
|