fix8
version 1.4.0
Open Source C++ FIX Framework
|
Class to encapsulate a Fix8 configuration. More...
#include <configuration.hpp>
Public Types | |
enum | group_types { g_sessions, g_persisters, g_loggers, g_server_group, g_ssl_context, g_schedules, g_logins, g_client_group, g_count } |
enum | Logtype { session_log, protocol_log } |
Public Member Functions | |
const XmlElement * | find_group (group_types type, const std::string &tag) const |
Configuration (const std::string &xmlfile, bool do_process=false) | |
Configuration (std::istream &istr, bool do_process=false) | |
virtual | ~Configuration () |
Dtor. More... | |
F8API int | process () |
const XmlElement * | get_session (const unsigned num) const |
F8API Connection::Role | get_role (const XmlElement *from) const |
F8API size_t | get_addresses (const XmlElement *from, std::vector< Server > &target) const |
F8API Poco::Net::SocketAddress | get_address (const XmlElement *from) const |
F8API Poco::Net::IPAddress | get_ip (const XmlElement *from) const |
template<typename T > | |
T | get_logflags (const std::string &tag, const std::vector< std::string > &names, const XmlElement *from, Logger::LogPositions *positions=nullptr) const |
F8API std::string & | get_logname (const XmlElement *from, std::string &to, const SessionID *sid=nullptr) const |
unsigned | get_connect_timeout (const XmlElement *from, const unsigned def=defaults::connect_timeout) const |
unsigned | get_retry_interval (const XmlElement *from, const unsigned def=defaults::retry_interval) const |
unsigned | get_retry_count (const XmlElement *from, const int def=defaults::login_retries) const |
unsigned | get_tcp_recvbuf_sz (const XmlElement *from, const unsigned def=0) const |
unsigned | get_tcp_sendbuf_sz (const XmlElement *from, const unsigned def=0) const |
unsigned | get_version (const XmlElement *from, const unsigned def=0) const |
unsigned | get_tabsize (const XmlElement *from, const unsigned def=defaults::tabsize) const |
unsigned | get_logfile_rotation (const XmlElement *from, const unsigned def=defaults::log_rotation) const |
unsigned | get_heartbeat_interval (const XmlElement *from, const unsigned def=defaults::hb_interval) const |
bool | get_tcp_nodelay (const XmlElement *from, const bool def=true) const |
bool | get_tcp_keepalive (const XmlElement *from, const bool def=false) const |
bool | get_tcp_reuseaddr (const XmlElement *from, const bool def=false) const |
int | get_tcp_linger (const XmlElement *from, const int def=-1) const |
bool | get_silent_disconnect (const XmlElement *from, const bool def=false) const |
bool | get_enforce_compids_flag (const XmlElement *from, const bool def=true) const |
bool | get_ignore_logon_sequence_check_flag (const XmlElement *from, const bool def=false) const |
bool | get_no_chksum_flag (const XmlElement *from, const bool def=false) const |
bool | get_permissive_mode_flag (const XmlElement *from, const bool def=false) const |
bool | get_reset_sequence_number_flag (const XmlElement *from, const bool def=false) const |
bool | get_always_seqnum_assign (const XmlElement *from, const bool def=false) const |
F8API ProcessModel | get_process_model (const XmlElement *from) const |
default_appl_ver_id | get_default_appl_ver_id (const XmlElement *from) const |
sender_comp_id | get_sender_comp_id (const XmlElement *from) const |
target_comp_id | get_target_comp_id (const XmlElement *from) const |
F8API Persister * | create_persister (const XmlElement *from, const SessionID *sid=nullptr, bool flag=false) const |
F8API Logger * | create_logger (const XmlElement *from, const Logtype ltype, const SessionID *sid=nullptr) const |
F8API Schedule | create_schedule (const XmlElement *from) const |
F8API Clients | create_clients (const XmlElement *from) const |
F8API Schedule | create_login_schedule (const XmlElement *from) const |
F8API Session_Schedule * | create_session_schedule (const XmlElement *from) const |
F8API unsigned | get_all_sessions (std::vector< const XmlElement * > &target, const Connection::Role role=Connection::cn_unknown) const |
const XmlElement * | get_root () const |
template<typename T > | |
T | get_logflags (const string &tag, const vector< string > &names, const XmlElement *from, Logger::LogPositions *positions) const |
Protected Member Functions | |
bool | from_or_default (const XmlElement *from, const f8String &tag, f8String &target) const |
template<typename T > | |
T & | get_string_field (const XmlElement *from, const std::string &tag, T &to) const |
Tickval::ticks | get_time_field (const XmlElement *from, const std::string &tag, bool timeonly=false) const |
template<typename T > | |
T | find_or_default (const XmlElement *from, const std::string &tag, const T def) const |
Private Types | |
using | ConfigMap = std::map< const std::string, const XmlElement * > |
Private Member Functions | |
const XmlElement * | find_element (const std::string &tag, const ConfigMap &from) const |
unsigned | load_map (const std::string &tag, ConfigMap &map_name, const bool is_session=false) |
Private Attributes | |
const XmlElement * | _root |
const XmlElement * | _default |
std::vector< ConfigMap > | _groups |
std::vector< const XmlElement * > | _allsessions |
Static Private Attributes | |
static RegExp | _ipexp |
Class to encapsulate a Fix8 configuration.
Definition at line 92 of file configuration.hpp.
|
private |
Definition at line 97 of file configuration.hpp.
Enumerator | |
---|---|
g_sessions | |
g_persisters | |
g_loggers | |
g_server_group | |
g_ssl_context | |
g_schedules | |
g_logins | |
g_client_group | |
g_count |
Definition at line 109 of file configuration.hpp.
|
inline |
Ctor.
xmlfile | xml config filename. |
do_process | if true, process the file on construction |
Definition at line 210 of file configuration.hpp.
References FIX8::exist(), and process().
|
inline |
Ctor.
istr | xml stream |
do_process | if true, process the stream on construction |
Definition at line 224 of file configuration.hpp.
References process().
|
inlinevirtual |
Clients Configuration::create_clients | ( | const XmlElement * | from | ) | const |
Create clients object from a session entity.
from | xml entity to search |
Definition at line 313 of file configuration.cpp.
References XmlElement::find(), and find_group().
Referenced by FIX8::SessionConfig::SessionConfig().
Logger * Configuration::create_logger | ( | const XmlElement * | from, |
const Logtype | ltype, | ||
const SessionID * | sid = nullptr |
||
) | const |
Create a new logger object from a session entity.
from | xml entity to search |
ltype | log type |
sid | optional session id to build name from |
Definition at line 256 of file configuration.cpp.
References FIX8::Logger::_bit_names, FIX8::Logger::_level_names, FIX8::Logger::All, find_group(), XmlElement::FindAttrRef(), XmlElement::GetAttr(), XmlElement::HasAttr(), FIX8::Logger::None, FIX8::Logger::StdFlags, FIX8::trim(), and FIX8::Logger::xml.
Referenced by FIX8::Session::handle_logon().
Schedule Configuration::create_login_schedule | ( | const XmlElement * | from | ) | const |
Create login schedule object from a session entity.
from | xml entity to search |
Definition at line 177 of file configuration.cpp.
References find_group().
Referenced by FIX8::SessionConfig::SessionConfig().
Persister * Configuration::create_persister | ( | const XmlElement * | from, |
const SessionID * | sid = nullptr , |
||
bool | flag = false |
||
) | const |
Create a new persister object from a session entity.
from | xml entity to search |
sid | optional session id to build name from |
flag | additional flag for persister use |
Definition at line 186 of file configuration.cpp.
References FIX8::defaults::connect_timeout, find_group(), XmlElement::FindAttr(), FIX8::SessionID::get_senderCompID(), FIX8::SessionID::get_targetCompID(), and XmlElement::GetAttr().
Referenced by FIX8::Session::handle_logon().
Schedule Configuration::create_schedule | ( | const XmlElement * | from | ) | const |
Create schedule object from a session entity.
from | xml entity to search |
Definition at line 131 of file configuration.cpp.
References FIX8::decode_dow(), XmlElement::FindAttr(), FIX8::Tickval::get_ticks(), XmlElement::GetAttr(), FIX8::Tickval::is_errorval(), and FIX8::Tickval::minute.
Session_Schedule * Configuration::create_session_schedule | ( | const XmlElement * | from | ) | const |
Create a new session schedule object from a session entity.
from | xml entity to search |
Definition at line 160 of file configuration.cpp.
References find_group(), XmlElement::FindAttr(), and XmlElement::GetAttr().
Referenced by FIX8::Session::start().
|
inlineprivate |
Find an xml entity by tag in the supplied map.
tag | the tag to find |
from | the map to search |
Definition at line 105 of file configuration.hpp.
References XmlElement::end().
Referenced by find_group().
|
inline |
Find an element in a specified group.
type | group type enum |
tag | the tag to find |
Definition at line 120 of file configuration.hpp.
References find_element().
|
inlineprotected |
Find an attribute in the given XmlElement
default | type |
from | the xml entity to search |
tag | the tag to find |
def | the default value if not found |
Definition at line 166 of file configuration.hpp.
References XmlElement::FindAttr(), and XmlElement::HasAttr().
Referenced by get_always_seqnum_assign(), get_connect_timeout(), get_enforce_compids_flag(), get_heartbeat_interval(), get_ignore_logon_sequence_check_flag(), get_logfile_rotation(), get_no_chksum_flag(), get_permissive_mode_flag(), get_reset_sequence_number_flag(), get_retry_count(), get_retry_interval(), get_silent_disconnect(), get_tabsize(), get_tcp_keepalive(), get_tcp_linger(), get_tcp_nodelay(), get_tcp_recvbuf_sz(), get_tcp_reuseaddr(), get_tcp_sendbuf_sz(), and get_version().
|
inlineprotected |
Search the given element for a tag or look in the default element
from | the xml entity to search |
tag | the tag to find |
target | place to put the resul |
Definition at line 129 of file configuration.hpp.
References XmlElement::GetAttr().
Referenced by get_string_field().
Poco::Net::SocketAddress Configuration::get_address | ( | const XmlElement * | from | ) | const |
Extract the ip address and port from a session entity.
from | xml entity to search |
Definition at line 83 of file configuration.cpp.
size_t Configuration::get_addresses | ( | const XmlElement * | from, |
std::vector< Server > & | target | ||
) | const |
Extract the ip addresses from a server_group entity.
from | xml entity to search |
target | target vector of Server to store addresses |
Definition at line 105 of file configuration.cpp.
References XmlElement::find(), find_group(), and FIX8::defaults::login_retries.
unsigned Configuration::get_all_sessions | ( | std::vector< const XmlElement * > & | target, |
const Connection::Role | role = Connection::cn_unknown |
||
) | const |
Get all active sessions that have been read; filter by role if desired.
target | vector to place results |
role | role to filter (cn_unknown means all) |
Definition at line 372 of file configuration.cpp.
References FIX8::Connection::cn_unknown.
|
inline |
Extract the always_seqnum_assign flag from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 427 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the connect_timeout interval (sec) from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 289 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract default_appl_ver_id from a session entity.
from | xml entity to search |
Definition at line 438 of file configuration.hpp.
References get_string_field().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the enforce_compids flag. When false, compids are not checked.
from | xml entity to search |
def | default value if not found |
Definition at line 392 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the heartbeat interval from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 350 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the ignore_logon_sequence_check flag from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 399 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::Session::sequence_check().
Poco::Net::IPAddress Configuration::get_ip | ( | const XmlElement * | from | ) | const |
Extract the ip address from a session entity.
from | xml entity to search |
Definition at line 94 of file configuration.cpp.
|
inline |
Extract the logfile rotation count.
from | xml entity to search |
def | default value if not found |
Definition at line 343 of file configuration.hpp.
References find_or_default().
T FIX8::Configuration::get_logflags | ( | const std::string & | tag, |
const std::vector< std::string > & | names, | ||
const XmlElement * | from, | ||
Logger::LogPositions * | positions = nullptr |
||
) | const |
Extract the logflags from the flags attribute in a log entity.
T | ebitset type |
tag | attribute tag to search for |
names | vector of names for each enumeration |
from | xml entity to search |
positions | vector to place enumeration position in |
T FIX8::Configuration::get_logflags | ( | const string & | tag, |
const vector< string > & | names, | ||
const XmlElement * | from, | ||
Logger::LogPositions * | positions | ||
) | const |
Definition at line 351 of file configuration.cpp.
References XmlElement::GetAttr(), and FIX8::trim().
string & Configuration::get_logname | ( | const XmlElement * | from, |
std::string & | to, | ||
const SessionID * | sid = nullptr |
||
) | const |
Extract the session log filename address from a session entity.
from | xml entity to search |
to | target logfile string |
sid | optional session id to build name from |
Definition at line 339 of file configuration.cpp.
References XmlElement::FindAttr(), FIX8::SessionID::get_senderCompID(), and FIX8::SessionID::get_targetCompID().
|
inline |
Extract the get_no_chksum_flag flag from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 406 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the get_permissive_mode_flag flag from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 413 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
ProcessModel Configuration::get_process_model | ( | const XmlElement * | from | ) | const |
Extract process model.
from | xml entity to search |
Definition at line 381 of file configuration.cpp.
References FIX8::enum_str_get(), FIX8::pm_pipeline, and FIX8::pm_thread.
Referenced by FIX8::ClientSession< T >::ClientSession(), and server_process().
|
inline |
Extract the reset_sequence_number flag from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 420 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the login retry count from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 303 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the login retry wait interval (ms) from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 296 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
Connection::Role Configuration::get_role | ( | const XmlElement * | from | ) | const |
Extract the role from a session entity.
from | xml entity to search |
Definition at line 74 of file configuration.cpp.
References FIX8::Connection::cn_acceptor, FIX8::Connection::cn_initiator, and FIX8::Connection::cn_unknown.
|
inline |
Return ptr to the root XmlElement
Definition at line 502 of file configuration.hpp.
References _root.
|
inline |
Extract sendercompid from a session entity.
from | xml entity to search |
Definition at line 444 of file configuration.hpp.
References get_string_field().
|
inline |
Find a session entity by index.
num | index of session |
Definition at line 243 of file configuration.hpp.
|
inline |
Extract the silent disconnect flag.
from | xml entity to search |
def | default value if not found |
Definition at line 385 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inlineprotected |
Find a fix8 field typed value by tag from an xml entity.
location | type |
from | the xml entity to search |
tag | the tag to find |
to | location to store target |
Definition at line 139 of file configuration.hpp.
References from_or_default().
Referenced by get_default_appl_ver_id(), get_sender_comp_id(), and get_target_comp_id().
|
inline |
Extract the Message printer tabsize from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 336 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract targetcompid from a session entity.
from | xml entity to search |
Definition at line 450 of file configuration.hpp.
References get_string_field().
|
inline |
Extract the tcp keepalive flag.
from | xml entity to search |
def | default value if not found |
Definition at line 364 of file configuration.hpp.
References find_or_default().
|
inline |
Extract the socket linger setting from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 378 of file configuration.hpp.
References find_or_default().
|
inline |
Extract the tcp nodelay flag.
from | xml entity to search |
def | default value if not found |
Definition at line 357 of file configuration.hpp.
References find_or_default().
|
inline |
Extract the tcp recv buffer size
from | xml entity to search |
def | default value if not found |
Definition at line 315 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inline |
Extract the tcp reuseaddr flag.
from | xml entity to search |
def | default value if not found |
Definition at line 371 of file configuration.hpp.
References find_or_default().
|
inline |
Extract the tcp send buffer size
from | xml entity to search |
def | default value if not found |
Definition at line 322 of file configuration.hpp.
References find_or_default().
Referenced by FIX8::SessionConfig::SessionConfig().
|
inlineprotected |
Find a session time field by tag from an xml entity.
from | the xml entity to search |
tag | the tag to find |
timeonly | if true, only use the time part |
Definition at line 152 of file configuration.hpp.
References FIX8::Tickval::errorticks(), XmlElement::GetAttr(), and FIX8::time_parse().
|
inline |
Extract the FIX version from a session entity.
from | xml entity to search |
def | default value if not found |
Definition at line 329 of file configuration.hpp.
References find_or_default().
|
inlineprivate |
Load a repeating group into a supplied map.
tag | the tag to find |
map_name | the target map |
is_session | if true, special case for session map |
Definition at line 184 of file configuration.hpp.
References XmlElement::find().
int Configuration::process | ( | ) |
Process the config file.
Definition at line 52 of file configuration.cpp.
Referenced by Configuration().
|
private |
Definition at line 99 of file configuration.hpp.
|
private |
Definition at line 96 of file configuration.hpp.
|
private |
Definition at line 98 of file configuration.hpp.
|
staticprivate |
Definition at line 94 of file configuration.hpp.
|
private |
Definition at line 96 of file configuration.hpp.
Referenced by get_root().