SessionSettings.h
Go to the documentation of this file.
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
35namespace FIX
36{
37const char BEGINSTRING[] = "BeginString";
38const char SENDERCOMPID[] = "SenderCompID";
39const char TARGETCOMPID[] = "TargetCompID";
40const char SESSION_QUALIFIER[] = "SessionQualifier";
41const char DEFAULT_APPLVERID[] = "DefaultApplVerID";
42const char CONNECTION_TYPE[] = "ConnectionType";
43const char USE_DATA_DICTIONARY[] = "UseDataDictionary";
44const char SEND_RESETSEQNUMFLAG[] = "SendResetSeqNumFlag";
45const char SEND_REDUNDANT_RESENDREQUESTS[] = "SendRedundantResendRequests";
46const char DATA_DICTIONARY[] = "DataDictionary";
47const char TRANSPORT_DATA_DICTIONARY[] = "TransportDataDictionary";
48const char APP_DATA_DICTIONARY[] = "AppDataDictionary";
49const char USE_LOCAL_TIME[] = "UseLocalTime";
50const char START_TIME[] = "StartTime";
51const char END_TIME[] = "EndTime";
52const char START_DAY[] = "StartDay";
53const char END_DAY[] = "EndDay";
54const char LOGON_TIME[] = "LogonTime";
55const char LOGOUT_TIME[] = "LogoutTime";
56const char LOGON_DAY[] = "LogonDay";
57const char LOGOUT_DAY[] = "LogoutDay";
58const char CHECK_COMPID[] = "CheckCompID";
59const char CHECK_LATENCY[] = "CheckLatency";
60const char MAX_LATENCY[] = "MaxLatency";
61const char HEARTBTINT[] = "HeartBtInt";
62const char SOCKET_ACCEPT_PORT[] = "SocketAcceptPort";
63const char SOCKET_REUSE_ADDRESS[] = "SocketReuseAddress";
64const char SOCKET_CONNECT_HOST[] = "SocketConnectHost";
65const char SOCKET_CONNECT_PORT[] = "SocketConnectPort";
66const char SOCKET_CONNECT_SOURCE_HOST[] = "SocketConnectSourceHost";
67const char SOCKET_CONNECT_SOURCE_PORT[] = "SocketConnectSourcePort";
68const char SOCKET_NODELAY[] = "SocketNodelay";
69const char SOCKET_SEND_BUFFER_SIZE[] = "SocketSendBufferSize";
70const char SOCKET_RECEIVE_BUFFER_SIZE[] = "SocketReceiveBufferSize";
71const char RECONNECT_INTERVAL[] = "ReconnectInterval";
72const char VALIDATE_LENGTH_AND_CHECKSUM[] = "ValidateLengthAndChecksum";
73const char VALIDATE_FIELDS_OUT_OF_ORDER[] = "ValidateFieldsOutOfOrder";
74const char VALIDATE_FIELDS_HAVE_VALUES[] = "ValidateFieldsHaveValues";
75const char VALIDATE_USER_DEFINED_FIELDS[] = "ValidateUserDefinedFields";
76const char ALLOW_UNKNOWN_MSG_FIELDS[] = "AllowUnknownMsgFields";
77const char PRESERVE_MESSAGE_FIELDS_ORDER[] = "PreserveMessageFieldsOrder";
78const char LOGON_TIMEOUT[] = "LogonTimeout";
79const char LOGOUT_TIMEOUT[] = "LogoutTimeout";
80const char FILE_STORE_PATH[] = "FileStorePath";
81const char MYSQL_STORE_USECONNECTIONPOOL[] = "MySQLStoreUseConnectionPool";
82const char MYSQL_STORE_DATABASE[] = "MySQLStoreDatabase";
83const char MYSQL_STORE_USER[] = "MySQLStoreUser";
84const char MYSQL_STORE_PASSWORD[] = "MySQLStorePassword";
85const char MYSQL_STORE_HOST[] = "MySQLStoreHost";
86const char MYSQL_STORE_PORT[] = "MySQLStorePort";
87const char POSTGRESQL_STORE_USECONNECTIONPOOL[] = "PostgreSQLStoreUseConnectionPool";
88const char POSTGRESQL_STORE_DATABASE[] = "PostgreSQLStoreDatabase";
89const char POSTGRESQL_STORE_USER[] = "PostgreSQLStoreUser";
90const char POSTGRESQL_STORE_PASSWORD[] = "PostgreSQLStorePassword";
91const char POSTGRESQL_STORE_HOST[] = "PostgreSQLStoreHost";
92const char POSTGRESQL_STORE_PORT[] = "PostgreSQLStorePort";
93const char ODBC_STORE_USER[] = "OdbcStoreUser";
94const char ODBC_STORE_PASSWORD[] = "OdbcStorePassword";
95const char ODBC_STORE_CONNECTION_STRING[] = "OdbcStoreConnectionString";
96const char FILE_LOG_PATH[] = "FileLogPath";
97const char FILE_LOG_BACKUP_PATH[] = "FileLogBackupPath";
98const char SCREEN_LOG_SHOW_INCOMING[] = "ScreenLogShowIncoming";
99const char SCREEN_LOG_SHOW_OUTGOING[] = "ScreenLogShowOutgoing";
100const char SCREEN_LOG_SHOW_EVENTS[] = "ScreenLogShowEvents";
101const char MYSQL_LOG_USECONNECTIONPOOL[] = "MySQLLogUseConnectionPool";
102const char MYSQL_LOG_DATABASE[] = "MySQLLogDatabase";
103const char MYSQL_LOG_USER[] = "MySQLLogUser";
104const char MYSQL_LOG_PASSWORD[] = "MySQLLogPassword";
105const char MYSQL_LOG_HOST[] = "MySQLLogHost";
106const char MYSQL_LOG_PORT[] = "MySQLLogPort";
107const char MYSQL_LOG_INCOMING_TABLE[] = "MySQLLogIncomingTable";
108const char MYSQL_LOG_OUTGOING_TABLE[] = "MySQLLogOutgoingTable";
109const char MYSQL_LOG_EVENT_TABLE[] = "MySQLLogEventTable";
110const char POSTGRESQL_LOG_USECONNECTIONPOOL[] = "PostgreSQLLogUseConnectionPool";
111const char POSTGRESQL_LOG_DATABASE[] = "PostgreSQLLogDatabase";
112const char POSTGRESQL_LOG_USER[] = "PostgreSQLLogUser";
113const char POSTGRESQL_LOG_PASSWORD[] = "PostgreSQLLogPassword";
114const char POSTGRESQL_LOG_HOST[] = "PostgreSQLLogHost";
115const char POSTGRESQL_LOG_PORT[] = "PostgreSQLLogPort";
116const char POSTGRESQL_LOG_INCOMING_TABLE[] = "PostgreSQLLogIncomingTable";
117const char POSTGRESQL_LOG_OUTGOING_TABLE[] = "PostgreSQLLogOutgoingTable";
118const char POSTGRESQL_LOG_EVENT_TABLE[] = "PostgreSQLLogEventTable";
119const char ODBC_LOG_USER[] = "OdbcLogUser";
120const char ODBC_LOG_PASSWORD[] = "OdbcLogPassword";
121const char ODBC_LOG_CONNECTION_STRING[] = "OdbcLogConnectionString";
122const char ODBC_LOG_INCOMING_TABLE[] = "OdbcLogIncomingTable";
123const char ODBC_LOG_OUTGOING_TABLE[] = "OdbcLogOutgoingTable";
124const char ODBC_LOG_EVENT_TABLE[] = "OdbcLogEventTable";
125const char RESET_ON_LOGON[] = "ResetOnLogon";
126const char RESET_ON_LOGOUT[] = "ResetOnLogout";
127const char RESET_ON_DISCONNECT[] = "ResetOnDisconnect";
128const char REFRESH_ON_LOGON[] = "RefreshOnLogon";
129const char MILLISECONDS_IN_TIMESTAMP[] = "MillisecondsInTimeStamp";
130const char TIMESTAMP_PRECISION[] = "TimestampPrecision";
131const char HTTP_ACCEPT_PORT[] = "HttpAcceptPort";
132const char PERSIST_MESSAGES[] = "PersistMessages";
133const char SERVER_CERT_FILE[] = "ServerCertificateFile";
134const char SERVER_CERT_KEY_FILE[] = "ServerCertificateKeyFile";
135const char CLIENT_CERT_FILE[] = "ClientCertificateFile";
136const char CLIENT_CERT_KEY_FILE[] = "ClientCertificateKeyFile";
137const char CERT_AUTH_FILE[] = "CertificationAuthoritiesFile";
138const char CERT_AUTH_DIR[] = "CertificationAuthoritiesDirectory";
139const char CRL_FILE[] = "CertificateRevocationListFile";
140const char CRL_DIR[] = "CertificateRevocationListDirectory";
141const char VERIFY_LEVEL[] = "CertificateVerifyLevel";
142/*
143# This directive can be used to control the SSL protocol flavors the application
144# should use when establishing its environment.
145#
146# The available (case-insensitive) protocols are:
147#
148# SSLv2
149#
150# This is the Secure Sockets Layer (SSL) protocol, version 2.0. It is the
151# original SSL protocol as designed by Netscape Corporation.
152#
153# SSLv3
154#
155# This is the Secure Sockets Layer (SSL) protocol, version 3.0. It is the
156# successor to SSLv2 and the currently (as of February 1999) de-facto
157# standardized SSL protocol from Netscape Corporation. It's supported by
158# almost all popular browsers.
159#
160# TLSv1
161#
162# This is the Transport Layer Security (TLS) protocol, version 1.0.
163#
164# TLSv1_1
165#
166# This is the Transport Layer Security (TLS) protocol, version 1.1.
167#
168# TLSv1_2
169#
170# This is the Transport Layer Security (TLS) protocol, version 1.2.
171#
172# all
173#
174# This is a shortcut for `+SSLv2 +SSLv3 +TLSv1 +TLSv1_1 +TLSv1_2' and a convenient way for
175# enabling all protocols except one when used in combination with the minus
176# sign on a protocol as the example above shows.
177#
178# Example:
179#
180# enable all but not SSLv2
181# SSL_PROTOCOL = all -SSLv2
182#
183# `all -SSLv2` is the default value when the parameter is not specified.
184
185*/
186const char SSL_PROTOCOL[] = "SSLProtocol";
187/*
188# This complex directive uses a colon-separated cipher-spec string consisting
189# of OpenSSL cipher specifications to configure the Cipher Suite the client is
190# permitted to negotiate in the SSL handshake phase. Notice that this directive
191# can be used both in per-server and per-directory context. In per-server
192# context it applies to the standard SSL handshake when a connection is
193# established. In per-directory context it forces a SSL renegotation with the
194# reconfigured Cipher Suite after the HTTP request was read but before the HTTP
195# response is sent.
196#
197# An SSL cipher specification in cipher-spec is composed of 4 major attributes
198# plus a few extra minor ones:
199#
200# Key Exchange Algorithm:
201# RSA or Diffie-Hellman variants.
202#
203# Authentication Algorithm:
204# RSA, Diffie-Hellman, DSS or none.
205#
206# Cipher/Encryption Algorithm:
207# DES, Triple-DES, RC4, RC2, IDEA or none.
208#
209# MAC Digest Algorithm:
210# MD5, SHA or SHA1.
211#
212# For more details refer to mod_ssl documentation.
213#
214# Example: RC4+RSA:+HIGH:
215*/
216const char SSL_CIPHER_SUITE[] = "SSLCipherSuite";
217
218
221{
222public:
224 SessionSettings( std::istream& stream, bool resolveEnvVars = false ) throw( ConfigError );
226
228 const bool has( const SessionID& ) const;
229
234
236 const Dictionary& get() const { return m_defaults; }
238 void set( const Dictionary& defaults ) throw( ConfigError );
239
241 size_t size() const { return m_settings.size(); }
242
243 typedef std::map < SessionID, Dictionary > Dictionaries;
244 std::set < SessionID > getSessions() const;
245
246private:
247 void validate( const Dictionary& ) const throw( ConfigError );
248
251 bool m_resolveEnvVars; // while reading, replace $var, $(var) and ${var} by environment variable var
252
253 friend std::istream& operator>>( std::istream&, SessionSettings& ) throw( ConfigError );
254 friend std::ostream& operator<<( std::ostream&, const SessionSettings& );
255};
258std::istream& operator>>( std::istream&, SessionSettings& )
259throw( ConfigError );
260std::ostream& operator<<( std::ostream&, const SessionSettings& );
261}
262
263#endif //FIX_SESSIONSETTINGS_H
For storage and retrieval of key/value pairs.
Definition Dictionary.h:37
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition SessionID.h:31
Container for setting dictionaries mapped to sessions.
friend std::ostream & operator<<(std::ostream &, const SessionSettings &)
const Dictionary & get() const
Get global default settings.
void validate(const Dictionary &) const
void set(const SessionID &, Dictionary)
Set a dictionary for a session.
std::set< SessionID > getSessions() const
const bool has(const SessionID &) const
Check if session setings are present.
friend std::istream & operator>>(std::istream &, SessionSettings &)
size_t size() const
Number of session settings.
std::map< SessionID, Dictionary > Dictionaries
const char LOGOUT_TIMEOUT[]
const char POSTGRESQL_STORE_PASSWORD[]
const char SOCKET_CONNECT_PORT[]
const char ODBC_LOG_EVENT_TABLE[]
const char SOCKET_SEND_BUFFER_SIZE[]
const char ODBC_LOG_CONNECTION_STRING[]
const char MYSQL_STORE_PASSWORD[]
const char SOCKET_ACCEPT_PORT[]
const char MYSQL_STORE_PORT[]
const char USE_LOCAL_TIME[]
const char SERVER_CERT_KEY_FILE[]
const char ODBC_LOG_INCOMING_TABLE[]
const char SSL_PROTOCOL[]
const char LOGON_TIMEOUT[]
const char SEND_REDUNDANT_RESENDREQUESTS[]
const char APP_DATA_DICTIONARY[]
const char POSTGRESQL_STORE_USECONNECTIONPOOL[]
const char CLIENT_CERT_FILE[]
std::ostream & operator<<(std::ostream &stream, const FieldBase &field)
Definition Field.h:243
const char SCREEN_LOG_SHOW_EVENTS[]
const char POSTGRESQL_LOG_HOST[]
const char POSTGRESQL_LOG_OUTGOING_TABLE[]
const char CHECK_COMPID[]
const char POSTGRESQL_LOG_PORT[]
const char SOCKET_REUSE_ADDRESS[]
const char CONNECTION_TYPE[]
const char MYSQL_LOG_PORT[]
const char POSTGRESQL_LOG_USER[]
const char MYSQL_STORE_HOST[]
const char CLIENT_CERT_KEY_FILE[]
const char ALLOW_UNKNOWN_MSG_FIELDS[]
const char POSTGRESQL_LOG_EVENT_TABLE[]
const char MYSQL_LOG_USER[]
const char SCREEN_LOG_SHOW_OUTGOING[]
const char CERT_AUTH_DIR[]
const char SENDERCOMPID[]
const char POSTGRESQL_LOG_DATABASE[]
const char SESSION_QUALIFIER[]
const char ODBC_STORE_CONNECTION_STRING[]
std::string resolveEnvVars(const std::string &str)
Definition Settings.cpp:65
const char BEGINSTRING[]
const char MYSQL_LOG_DATABASE[]
const char ODBC_LOG_USER[]
const char ODBC_STORE_USER[]
const char POSTGRESQL_LOG_USECONNECTIONPOOL[]
const char MYSQL_LOG_EVENT_TABLE[]
const char TARGETCOMPID[]
const char POSTGRESQL_LOG_INCOMING_TABLE[]
const char HEARTBTINT[]
const char MYSQL_LOG_INCOMING_TABLE[]
const char MYSQL_STORE_USECONNECTIONPOOL[]
const char PRESERVE_MESSAGE_FIELDS_ORDER[]
const char END_DAY[]
const char REFRESH_ON_LOGON[]
const char DATA_DICTIONARY[]
const char MYSQL_LOG_PASSWORD[]
const char USE_DATA_DICTIONARY[]
const char RESET_ON_LOGOUT[]
const char SCREEN_LOG_SHOW_INCOMING[]
const char ODBC_LOG_OUTGOING_TABLE[]
const char MYSQL_STORE_USER[]
const char VALIDATE_USER_DEFINED_FIELDS[]
const char HTTP_ACCEPT_PORT[]
const char SOCKET_NODELAY[]
const char ODBC_LOG_PASSWORD[]
const char CHECK_LATENCY[]
const char LOGOUT_DAY[]
const char MYSQL_LOG_USECONNECTIONPOOL[]
std::istream & operator>>(std::istream &stream, SessionID &sessionID)
Definition SessionID.h:160
const char LOGON_DAY[]
const char POSTGRESQL_STORE_PORT[]
const char TRANSPORT_DATA_DICTIONARY[]
const char VALIDATE_FIELDS_HAVE_VALUES[]
const char VALIDATE_FIELDS_OUT_OF_ORDER[]
const char POSTGRESQL_STORE_HOST[]
const char MYSQL_STORE_DATABASE[]
const char SSL_CIPHER_SUITE[]
const char SOCKET_RECEIVE_BUFFER_SIZE[]
const char START_TIME[]
const char RECONNECT_INTERVAL[]
const char VERIFY_LEVEL[]
const char CERT_AUTH_FILE[]
const char LOGOUT_TIME[]
const char LOGON_TIME[]
const char RESET_ON_LOGON[]
const char VALIDATE_LENGTH_AND_CHECKSUM[]
const char MYSQL_LOG_OUTGOING_TABLE[]
const char DEFAULT_APPLVERID[]
const char CRL_FILE[]
const char END_TIME[]
const char PERSIST_MESSAGES[]
const char CRL_DIR[]
const char SOCKET_CONNECT_HOST[]
const char RESET_ON_DISCONNECT[]
const char MYSQL_LOG_HOST[]
const char ODBC_STORE_PASSWORD[]
const char FILE_STORE_PATH[]
const char SERVER_CERT_FILE[]
const char MAX_LATENCY[]
const char SOCKET_CONNECT_SOURCE_PORT[]
const char SEND_RESETSEQNUMFLAG[]
const char POSTGRESQL_STORE_USER[]
const char SOCKET_CONNECT_SOURCE_HOST[]
const char POSTGRESQL_LOG_PASSWORD[]
const char START_DAY[]
const char FILE_LOG_PATH[]
const char MILLISECONDS_IN_TIMESTAMP[]
const char FILE_LOG_BACKUP_PATH[]
const char POSTGRESQL_STORE_DATABASE[]
const char TIMESTAMP_PRECISION[]
Application is not configured correctly
Definition Exceptions.h:88

Generated on Thu Feb 29 2024 22:38:19 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001