![]() |
00001 /* -*- C++ -*- */ 00002 00003 /**************************************************************************** 00004 ** Copyright (c) quickfixengine.org All rights reserved. 00005 ** 00006 ** This file is part of the QuickFIX FIX Engine 00007 ** 00008 ** This file may be distributed under the terms of the quickfixengine.org 00009 ** license as defined by quickfixengine.org and appearing in the file 00010 ** LICENSE included in the packaging of this file. 00011 ** 00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 ** 00015 ** See http://www.quickfixengine.org/LICENSE for licensing information. 00016 ** 00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are 00018 ** not clear to you. 00019 ** 00020 ****************************************************************************/ 00021 00022 #ifndef FIX_SESSIONSETTINGS_H 00023 #define FIX_SESSIONSETTINGS_H 00024 00025 #ifdef _MSC_VER 00026 #pragma warning( disable : 4503 4355 4786 4290 ) 00027 #endif 00028 00029 #include "Dictionary.h" 00030 #include "SessionID.h" 00031 #include "Exceptions.h" 00032 #include <map> 00033 #include <set> 00034 00035 namespace FIX 00036 { 00037 const char BEGINSTRING[] = "BeginString"; 00038 const char SENDERCOMPID[] = "SenderCompID"; 00039 const char TARGETCOMPID[] = "TargetCompID"; 00040 const char SESSION_QUALIFIER[] = "SessionQualifier"; 00041 const char DEFAULT_APPLVERID[] = "DefaultApplVerID"; 00042 const char CONNECTION_TYPE[] = "ConnectionType"; 00043 const char USE_DATA_DICTIONARY[] = "UseDataDictionary"; 00044 const char SEND_RESETSEQNUMFLAG[] = "SendResetSeqNumFlag"; 00045 const char SEND_REDUNDANT_RESENDREQUESTS[] = "SendRedundantResendRequests"; 00046 const char DATA_DICTIONARY[] = "DataDictionary"; 00047 const char TRANSPORT_DATA_DICTIONARY[] = "TransportDataDictionary"; 00048 const char APP_DATA_DICTIONARY[] = "AppDataDictionary"; 00049 const char USE_LOCAL_TIME[] = "UseLocalTime"; 00050 const char START_TIME[] = "StartTime"; 00051 const char END_TIME[] = "EndTime"; 00052 const char START_DAY[] = "StartDay"; 00053 const char END_DAY[] = "EndDay"; 00054 const char LOGON_TIME[] = "LogonTime"; 00055 const char LOGOUT_TIME[] = "LogoutTime"; 00056 const char LOGON_DAY[] = "LogonDay"; 00057 const char LOGOUT_DAY[] = "LogoutDay"; 00058 const char CHECK_COMPID[] = "CheckCompID"; 00059 const char CHECK_LATENCY[] = "CheckLatency"; 00060 const char MAX_LATENCY[] = "MaxLatency"; 00061 const char HEARTBTINT[] = "HeartBtInt"; 00062 const char SOCKET_ACCEPT_PORT[] = "SocketAcceptPort"; 00063 const char SOCKET_REUSE_ADDRESS[] = "SocketReuseAddress"; 00064 const char SOCKET_CONNECT_HOST[] = "SocketConnectHost"; 00065 const char SOCKET_CONNECT_PORT[] = "SocketConnectPort"; 00066 const char SOCKET_NODELAY[] = "SocketNodelay"; 00067 const char SOCKET_SEND_BUFFER_SIZE[] = "SendBufferSize"; 00068 const char SOCKET_RECEIVE_BUFFER_SIZE[] = "ReceiveBufferSize"; 00069 const char RECONNECT_INTERVAL[] = "ReconnectInterval"; 00070 const char VALIDATE_FIELDS_OUT_OF_ORDER[] = "ValidateFieldsOutOfOrder"; 00071 const char VALIDATE_FIELDS_HAVE_VALUES[] = "ValidateFieldsHaveValues"; 00072 const char VALIDATE_USER_DEFINED_FIELDS[] = "ValidateUserDefinedFields"; 00073 const char LOGON_TIMEOUT[] = "LogonTimeout"; 00074 const char LOGOUT_TIMEOUT[] = "LogoutTimeout"; 00075 const char FILE_STORE_PATH[] = "FileStorePath"; 00076 const char MYSQL_STORE_USECONNECTIONPOOL[] = "MySQLStoreUseConnectionPool"; 00077 const char MYSQL_STORE_DATABASE[] = "MySQLStoreDatabase"; 00078 const char MYSQL_STORE_USER[] = "MySQLStoreUser"; 00079 const char MYSQL_STORE_PASSWORD[] = "MySQLStorePassword"; 00080 const char MYSQL_STORE_HOST[] = "MySQLStoreHost"; 00081 const char MYSQL_STORE_PORT[] = "MySQLStorePort"; 00082 const char POSTGRESQL_STORE_USECONNECTIONPOOL[] = "PostgreSQLStoreUseConnectionPool"; 00083 const char POSTGRESQL_STORE_DATABASE[] = "PostgreSQLStoreDatabase"; 00084 const char POSTGRESQL_STORE_USER[] = "PostgreSQLStoreUser"; 00085 const char POSTGRESQL_STORE_PASSWORD[] = "PostgreSQLStorePassword"; 00086 const char POSTGRESQL_STORE_HOST[] = "PostgreSQLStoreHost"; 00087 const char POSTGRESQL_STORE_PORT[] = "PostgreSQLStorePort"; 00088 const char ODBC_STORE_USER[] = "OdbcStoreUser"; 00089 const char ODBC_STORE_PASSWORD[] = "OdbcStorePassword"; 00090 const char ODBC_STORE_CONNECTION_STRING[] = "OdbcStoreConnectionString"; 00091 const char FILE_LOG_PATH[] = "FileLogPath"; 00092 const char FILE_LOG_BACKUP_PATH[] = "FileLogBackupPath"; 00093 const char SCREEN_LOG_SHOW_INCOMING[] = "ScreenLogShowIncoming"; 00094 const char SCREEN_LOG_SHOW_OUTGOING[] = "ScreenLogShowOutgoing"; 00095 const char SCREEN_LOG_SHOW_EVENTS[] = "ScreenLogShowEvents"; 00096 const char MYSQL_LOG_USECONNECTIONPOOL[] = "MySQLLogUseConnectionPool"; 00097 const char MYSQL_LOG_DATABASE[] = "MySQLLogDatabase"; 00098 const char MYSQL_LOG_USER[] = "MySQLLogUser"; 00099 const char MYSQL_LOG_PASSWORD[] = "MySQLLogPassword"; 00100 const char MYSQL_LOG_HOST[] = "MySQLLogHost"; 00101 const char MYSQL_LOG_PORT[] = "MySQLLogPort"; 00102 const char MYSQL_LOG_INCOMING_TABLE[] = "MySQLLogIncomingTable"; 00103 const char MYSQL_LOG_OUTGOING_TABLE[] = "MySQLLogOutgoingTable"; 00104 const char MYSQL_LOG_EVENT_TABLE[] = "MySQLLogEventTable"; 00105 const char POSTGRESQL_LOG_USECONNECTIONPOOL[] = "PostgreSQLLogUseConnectionPool"; 00106 const char POSTGRESQL_LOG_DATABASE[] = "PostgreSQLLogDatabase"; 00107 const char POSTGRESQL_LOG_USER[] = "PostgreSQLLogUser"; 00108 const char POSTGRESQL_LOG_PASSWORD[] = "PostgreSQLLogPassword"; 00109 const char POSTGRESQL_LOG_HOST[] = "PostgreSQLLogHost"; 00110 const char POSTGRESQL_LOG_PORT[] = "PostgreSQLLogPort"; 00111 const char POSTGRESQL_LOG_INCOMING_TABLE[] = "PostgreSQLLogIncomingTable"; 00112 const char POSTGRESQL_LOG_OUTGOING_TABLE[] = "PostgreSQLLogOutgoingTable"; 00113 const char POSTGRESQL_LOG_EVENT_TABLE[] = "PostgreSQLLogEventTable"; 00114 const char ODBC_LOG_USER[] = "OdbcLogUser"; 00115 const char ODBC_LOG_PASSWORD[] = "OdbcLogPassword"; 00116 const char ODBC_LOG_CONNECTION_STRING[] = "OdbcLogConnectionString"; 00117 const char ODBC_LOG_INCOMING_TABLE[] = "OdbcLogIncomingTable"; 00118 const char ODBC_LOG_OUTGOING_TABLE[] = "OdbcLogOutgoingTable"; 00119 const char ODBC_LOG_EVENT_TABLE[] = "OdbcLogEventTable"; 00120 const char RESET_ON_LOGON[] = "ResetOnLogon"; 00121 const char RESET_ON_LOGOUT[] = "ResetOnLogout"; 00122 const char RESET_ON_DISCONNECT[] = "ResetOnDisconnect"; 00123 const char REFRESH_ON_LOGON[] = "RefreshOnLogon"; 00124 const char MILLISECONDS_IN_TIMESTAMP[] = "MillisecondsInTimeStamp"; 00125 const char HTTP_ACCEPT_PORT[] = "HttpAcceptPort"; 00126 const char PERSIST_MESSAGES[] = "PersistMessages"; 00127 00129 class SessionSettings 00130 { 00131 public: 00132 SessionSettings() {} 00133 SessionSettings( std::istream& stream ) throw( ConfigError ); 00134 SessionSettings( const std::string& file ) throw( ConfigError ); 00135 00137 const bool has( const SessionID& ) const; 00138 00140 const Dictionary& get( const SessionID& ) const throw( ConfigError ); 00142 void set( const SessionID&, Dictionary ) throw( ConfigError ); 00143 00145 const Dictionary& get() const { return m_defaults; } 00147 void set( const Dictionary& defaults ) throw( ConfigError ); 00148 00150 int size() const { return m_settings.size(); } 00151 00152 typedef std::map < SessionID, Dictionary > Dictionaries; 00153 std::set < SessionID > getSessions() const; 00154 00155 private: 00156 void validate( const Dictionary& ) const throw( ConfigError ); 00157 00158 Dictionaries m_settings; 00159 Dictionary m_defaults; 00160 00161 friend std::ostream& operator<<( std::ostream&, const SessionSettings& ); 00162 }; 00165 std::istream& operator>>( std::istream&, SessionSettings& ) 00166 throw( ConfigError ); 00167 std::ostream& operator<<( std::ostream&, const SessionSettings& ); 00168 } 00169 00170 #endif //FIX_SESSIONSETTINGS_H