fix8
version 1.4.0
Open Source C++ FIX Framework
|
Reliable Client wrapper. This client attempts to recover from disconnects and login rejects. More...
#include <sessionwrapper.hpp>
Public Types | |
enum | { no_servers_configured =0xffff } |
using | ReliableClientSession_ptr = std::unique_ptr< ReliableClientSession< T >> |
Convenient scoped pointer for your session. More... | |
Public Types inherited from FIX8::ClientSession< T > | |
using | ClientSession_ptr = std::unique_ptr< ClientSession< T >> |
Convenient scoped pointer for your session. More... | |
using | session_type = T |
Public Types inherited from FIX8::Configuration | |
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 | |
ReliableClientSession (const F8MetaCntx &ctx, const std::string &conf_file, const std::string &session_name) | |
Ctor. Prepares session for connection as an initiator. More... | |
bool | has_given_up () const |
virtual | ~ReliableClientSession () |
Dtor. More... | |
virtual void | start (bool wait, unsigned send_seqnum=0, unsigned recv_seqnum=0, const f8String davi=f8String()) |
size_t | get_attempts_cnt () const |
size_t | get_server_cnt () const |
const Server * | get_server (unsigned idx=no_servers_configured) const |
int | operator() () |
f8_thread_cancellation_token & | cancellation_token () |
Public Member Functions inherited from FIX8::ClientSession< T > | |
ClientSession (const F8MetaCntx &ctx, const std::string &conf_file, const std::string &session_name, bool init_con_later=false) | |
Ctor. Prepares session for connection as an initiator. More... | |
virtual | ~ClientSession () |
Dtor. More... | |
T * | session_ptr () |
Public Member Functions inherited from FIX8::ClientSessionBase | |
ClientSessionBase (const F8MetaCntx &ctx, const std::string &conf_file, const std::string &session_name) | |
virtual | ~ClientSessionBase () |
Dtor. More... | |
Public Member Functions inherited from FIX8::SessionConfig | |
SessionConfig (const F8MetaCntx &ctx, const std::string &conf_file, const std::string &session_name) | |
Ctor. Loads configuration, obtains session details, sets up logfile flags. More... | |
virtual | ~SessionConfig () |
Dtor. More... | |
const XmlElement * | get_session_element () const |
Public Member Functions inherited from FIX8::Configuration | |
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 |
Private Attributes | |
f8_thread< ReliableClientSession< T > > | _thread |
unsigned | _send_seqnum = 0 |
unsigned | _recv_seqnum = 0 |
unsigned | _current = 0 |
unsigned | _attempts = 0 |
f8_atomic< bool > | _giving_up |
std::vector< Server > | _servers |
const size_t | _failover_cnt |
f8_thread_cancellation_token | _cancellation_token |
Additional Inherited Members | |
Public Attributes inherited from FIX8::SessionConfig | |
const F8MetaCntx & | _ctx |
const XmlElement * | _ses |
LoginParameters | _loginParameters |
const std::string | _session_name |
Protected Member Functions inherited from FIX8::Configuration | |
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 |
Protected Attributes inherited from FIX8::ClientSession< T > | |
sender_comp_id | _sci |
target_comp_id | _tci |
const SessionID | _id |
Logger * | _log |
Logger * | _plog |
Persister * | _persist |
T * | _session |
Poco::Net::StreamSocket * | _sock = nullptr |
Poco::Net::SocketAddress | _addr |
ClientConnection * | _cc = nullptr |
Reliable Client wrapper. This client attempts to recover from disconnects and login rejects.
T | specialised with your derived session class |
Definition at line 283 of file sessionwrapper.hpp.
using FIX8::ReliableClientSession< T >::ReliableClientSession_ptr = std::unique_ptr<ReliableClientSession<T>> |
Convenient scoped pointer for your session.
Definition at line 491 of file sessionwrapper.hpp.
anonymous enum |
|
inline |
Ctor. Prepares session for connection as an initiator.
Definition at line 294 of file sessionwrapper.hpp.
References FIX8::SessionConfig::_loginParameters, and FIX8::LoginParameters::_reliable.
|
inlinevirtual |
Dtor.
Definition at line 309 of file sessionwrapper.hpp.
References FIX8::_f8_threadcore::join(), and FIX8::f8_thread< T >::request_stop().
|
inline |
Definition at line 488 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_cancellation_token.
|
inline |
Get the number of attempts made so far
Definition at line 332 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_attempts.
|
inline |
Get the Server object for a given server index
idx | of server desired, if not given return current |
Definition at line 341 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_current, and FIX8::ReliableClientSession< T >::no_servers_configured.
|
inline |
Get the number of configured failover servers
Definition at line 336 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_failover_cnt.
|
inlinevirtual |
If reliable, determine if the maximum no. of reties has been reached
Reimplemented from FIX8::ClientSessionBase.
Definition at line 306 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_giving_up.
|
inline |
The reliability thread entry point.
Definition at line 349 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_attempts, FIX8::ClientSession< T >::_cc, FIX8::ReliableClientSession< T >::_current, FIX8::LoginParameters::_davi, FIX8::ReliableClientSession< T >::_failover_cnt, FIX8::LoginParameters::_hb_int, FIX8::LoginParameters::_login_retries, FIX8::LoginParameters::_login_retry_interval, FIX8::SessionConfig::_loginParameters, FIX8::ReliableClientSession< T >::_recv_seqnum, FIX8::LoginParameters::_reset_sequence_numbers, FIX8::ClientSession< T >::_sock, FIX8::Logger::Error, FIX8::hypersleep< h_milliseconds >(), FIX8::Connection::start(), FIX8::Logger::Warn, and FIX8::f8Exception::what().
|
inlinevirtual |
Start the session - initiate the connection, logon and start heartbeating.
wait | if true wait till session finishes before returning |
send_seqnum | next send seqnum |
recv_seqnum | next recv seqnum |
davi | default appl version id (FIXT) |
Reimplemented from FIX8::ClientSession< T >.
Definition at line 320 of file sessionwrapper.hpp.
References FIX8::ReliableClientSession< T >::_recv_seqnum, and FIX8::f8_thread< T >::start().
|
private |
Definition at line 286 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::get_attempts_cnt(), and FIX8::ReliableClientSession< T >::operator()().
|
private |
Definition at line 290 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::cancellation_token().
|
private |
Definition at line 286 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::get_server(), and FIX8::ReliableClientSession< T >::operator()().
|
private |
Definition at line 289 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::get_server_cnt(), and FIX8::ReliableClientSession< T >::operator()().
|
private |
Definition at line 287 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::has_given_up().
|
private |
Definition at line 286 of file sessionwrapper.hpp.
Referenced by FIX8::ReliableClientSession< T >::operator()(), and FIX8::ReliableClientSession< T >::start().
|
private |
Definition at line 286 of file sessionwrapper.hpp.
|
private |
Definition at line 288 of file sessionwrapper.hpp.
|
private |
Definition at line 285 of file sessionwrapper.hpp.