37 #ifndef FIX8_CONFIGURATION_HPP_
38 #define FIX8_CONFIGURATION_HPP_
40 #ifdef FIX8_HAVE_OPENSSL
41 #include <openssl/ssl.h>
43 #define SSL_VERIFY_PEER 0
58 Server(
const std::string& hostname,
unsigned max_retries,
const Poco::Net::SocketAddress& addr,
bool reset_sequence_numbers)
59 : _hostname(hostname), _max_retries(max_retries), _retries(), _addr(addr), _reset_sequence_numbers(reset_sequence_numbers) {}
80 SslContext(
const std::string& private_key_file=
"",
const std::string& certificate_file=
"",
const std::string& ca_location=
"",
82 const std::string& cipher_list=
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH")
83 : _private_key_file(private_key_file), _certificate_file(certificate_file), _ca_location(ca_location),
84 _verification_mode(verification_mode), _verification_depth(
verification_depth), _load_default_cas(load_default_cas),
85 _cipher_list(cipher_list), _valid()
97 using ConfigMap = std::map<const std::string, const XmlElement *>;
106 { ConfigMap::const_iterator itr(from.find(tag));
return itr != from.
end() ? itr->second :
nullptr; }
130 {
return (from && from->
GetAttr(tag, target)) || (_default && _default->
GetAttr(tag, target)); }
154 std::string time_str;
155 return from && from->
GetAttr(tag, time_str) && time_str.size() == 8
173 return _default->
FindAttr(tag, def);
187 if (_root->
find(tag, slist))
189 for(
const auto *pp : slist)
192 if (pp->GetAttr(
"name", name) && is_session ? pp->FindAttr(
"active",
false) :
true)
194 map_name.insert({name, pp});
196 _allsessions.push_back(pp);
201 return static_cast<unsigned>(map_name.size());
212 _default(_root ? _root->find(
"fix8/default") : nullptr),
226 _default(_root ? _root->find(
"fix8/default") : nullptr),
244 {
return num < _allsessions.size() ? _allsessions[num] :
nullptr; }
275 T
get_logflags(
const std::string& tag,
const std::vector<std::string>& names,
453 #ifdef FIX8_HAVE_OPENSSL
509 #endif // FIX8_CONFIGURATION_HPP_
const XmlElement * _default
bool _reset_sequence_numbers
bool get_permissive_mode_flag(const XmlElement *from, const bool def=false) const
T FindAttr(const std::string &what, const T defValue) const
f8_thread delegated async logging class
std::string _certificate_file
bool get_reset_sequence_number_flag(const XmlElement *from, const bool def=false) const
unsigned get_tcp_sendbuf_sz(const XmlElement *from, const unsigned def=0) const
F8API std::string & get_logname(const XmlElement *from, std::string &to, const SessionID *sid=nullptr) const
POSIX regex wrapper class.
int _verification_mode
are used (see loadDefaultCAs).
Configuration(std::istream &istr, bool do_process=false)
bool get_silent_disconnect(const XmlElement *from, const bool def=false) const
T & get_string_field(const XmlElement *from, const std::string &tag, T &to) const
std::string _cipher_list
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
static const ticks & errorticks()
Base (ABC) Persister class.
Class to hold server settings for failoverable sessions.
bool _load_default_cas
false
bool get_tcp_nodelay(const XmlElement *from, const bool def=true) const
F8API Schedule create_schedule(const XmlElement *from) const
bool get_tcp_keepalive(const XmlElement *from, const bool def=false) const
F8API Poco::Net::SocketAddress get_address(const XmlElement *from) const
unsigned get_tcp_recvbuf_sz(const XmlElement *from, const unsigned def=0) const
unsigned get_retry_interval(const XmlElement *from, const unsigned def=defaults::retry_interval) const
Role
Roles: acceptor, initiator or unknown.
Quickfix style sessionid.
T find_or_default(const XmlElement *from, const std::string &tag, const T def) const
std::unordered_map< f8String, Client > Clients
ProcessModel
Supported session process models.
F8API Persister * create_persister(const XmlElement *from, const SessionID *sid=nullptr, bool flag=false) const
F8API size_t get_addresses(const XmlElement *from, std::vector< Server > &target) 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
std::vector< int > LogPositions
A simple xml parser with Xpath style lookup.
An bad or missing configuration parameter.
default_appl_ver_id get_default_appl_ver_id(const XmlElement *from) const
Tickval::ticks time_parse(const char *ptr, size_t len, bool timeonly=false)
F8API unsigned get_all_sessions(std::vector< const XmlElement * > &target, const Connection::Role role=Connection::cn_unknown) const
unsigned get_heartbeat_interval(const XmlElement *from, const unsigned def=defaults::hb_interval) const
F8API Connection::Role get_role(const XmlElement *from) const
unsigned get_connect_timeout(const XmlElement *from, const unsigned def=defaults::connect_timeout) const
unsigned get_tabsize(const XmlElement *from, const unsigned def=defaults::tabsize) const
Tickval::ticks get_time_field(const XmlElement *from, const std::string &tag, bool timeonly=false) const
Server(const std::string &hostname, unsigned max_retries, const Poco::Net::SocketAddress &addr, bool reset_sequence_numbers)
std::set< const XmlElement *, EntityOrderComp > XmlSet
std::string _private_key_file
decltype(f8_time_point::min().time_since_epoch().count()) ticks
Class to encapsulate a Fix8 configuration.
const XmlElement * get_root() const
F8API bool GetAttr(const std::string &what, std::string &target) const
Poco::Net::SocketAddress _addr
unsigned load_map(const std::string &tag, ConfigMap &map_name, const bool is_session=false)
F8API Session_Schedule * create_session_schedule(const XmlElement *from) const
unsigned get_version(const XmlElement *from, const unsigned def=0) const
F8API Poco::Net::IPAddress get_ip(const XmlElement *from) const
virtual ~Configuration()
Dtor.
T get_logflags(const std::string &tag, const std::vector< std::string > &names, const XmlElement *from, Logger::LogPositions *positions=nullptr) const
unsigned get_logfile_rotation(const XmlElement *from, const unsigned def=defaults::log_rotation) const
unsigned get_retry_count(const XmlElement *from, const int def=defaults::login_retries) const
std::vector< const XmlElement * > _allsessions
const XmlElement * find_element(const std::string &tag, const ConfigMap &from) const
sender_comp_id get_sender_comp_id(const XmlElement *from) const
bool get_ignore_logon_sequence_check_flag(const XmlElement *from, const bool def=false) const
std::map< const std::string, const XmlElement * > ConfigMap
F8API Schedule create_login_schedule(const XmlElement *from) const
bool get_enforce_compids_flag(const XmlElement *from, const bool def=true) const
F8API Clients create_clients(const XmlElement *from) const
const XmlElement * get_session(const unsigned num) const
Configuration(const std::string &xmlfile, bool do_process=false)
bool HasAttr(const std::string &what) const
Class to hold SSL context for failoverable sessions.
std::vector< ConfigMap > _groups
F8API Logger * create_logger(const XmlElement *from, const Logtype ltype, const SessionID *sid=nullptr) const
SslContext(const std::string &private_key_file="", const std::string &certificate_file="", const std::string &ca_location="", int verification_mode=SSL_VERIFY_PEER, int verification_depth=9, bool load_default_cas=false, const std::string &cipher_list="ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH")
target_comp_id get_target_comp_id(const XmlElement *from) const
F8API ProcessModel get_process_model(const XmlElement *from) const
bool get_always_seqnum_assign(const XmlElement *from, const bool def=false) const
bool exist(const std::string &fname)
F8API const XmlElement * find(const std::string &what, const std::string *atag=nullptr, const std::string *aval=nullptr, const char delim='/') const
bool get_no_chksum_flag(const XmlElement *from, const bool def=false) const
const XmlElement * find_group(group_types type, const std::string &tag) const
bool from_or_default(const XmlElement *from, const f8String &tag, f8String &target) const
XmlSet::const_iterator end() const