fix8  version 1.4.0
Open Source C++ FIX Framework
hf_session_client Class Reference

Example client session. Derives from FIX8::Session. More...

#include <hftest.hpp>

Inheritance diagram for hf_session_client:
FIX8::Session

Public Member Functions

 hf_session_client (const FIX8::F8MetaCntx &ctx, const FIX8::SessionID &sid, FIX8::Persister *persist=nullptr, FIX8::Logger *logger=nullptr, FIX8::Logger *plogger=nullptr)
 
bool handle_application (const unsigned seqnum, const FIX8::Message *&msg)
 
void push (FIX8::TEX::NewOrderSingle *nos)
 
FIX8::TEX::NewOrderSinglepop ()
 
bool cached () const
 
int size () const
 
- Public Member Functions inherited from FIX8::Session
F8API Session (const F8MetaCntx &ctx, const SessionID &sid, Persister *persist=nullptr, Logger *logger=nullptr, Logger *plogger=nullptr)
 
F8API Session (const F8MetaCntx &ctx, const sender_comp_id &sci=sender_comp_id(), Persister *persist=nullptr, Logger *logger=nullptr, Logger *plogger=nullptr)
 
virtual F8API ~Session ()
 Dtor. More...
 
F8API int start (Connection *connection, bool wait=true, const unsigned send_seqnum=0, const unsigned recv_seqnum=0, const f8String davi=f8String())
 
void clear_connection (const Connection *connection)
 
virtual F8API bool process (const f8String &from)
 
virtual F8API bool retrans_callback (const SequencePair &with, RetransmissionContext &rctx)
 
virtual F8API bool send (Message *msg, bool destroy=true, const unsigned custom_seqnum=0, const bool no_increment=false)
 
virtual F8API bool send (Message &msg, const unsigned custom_seqnum=0, const bool no_increment=false)
 
virtual F8API size_t send_batch (const std::vector< Message * > &msgs, bool destroy=true)
 
F8API bool send_process (Message *msg)
 
virtual F8API int modify_header (MessageBase *msg)
 
F8API void update_persist_seqnums ()
 Force persister to sync next send/receive seqnums. More...
 
F8API void stop ()
 stop the session. More...
 
Connectionget_connection ()
 
Timer< Session > & get_timer ()
 
const F8MetaCntxget_ctx () const
 
bool is_loggable (Logger::Level level) const
 
bool enqueue (const std::string &what, Logger::Level lev, const char *fl=nullptr, unsigned value=0) const
 
bool log (const std::string &what, Logger::Level lev, const char *fl=nullptr, unsigned value=0) const
 
bool plog (const std::string &what, Logger::Level lev, const unsigned direction=0) const
 
const Tickvalget_last_received () const
 
const Tickvalget_last_sent () const
 
void update_sent ()
 Update the last sent time. More...
 
void update_received ()
 Update the last received time. More...
 
F8API void compid_check (const unsigned seqnum, const Message *msg, const SessionID &id) const
 
F8API bool sequence_check (const unsigned seqnum, const Message *msg)
 
virtual bool activation_check (const unsigned seqnum, const Message *msg)
 
F8API bool enforce (const unsigned seqnum, const Message *msg)
 
const SessionIDget_sid () const
 
unsigned get_next_send_seq () const
 
void set_login_parameters (const LoginParameters &loginParamaters)
 
void get_login_parameters (LoginParameters &loginParamaters) const
 
const LoginParametersget_login_parameters () const
 
void set_reset_sequence_numbers_flag (bool flag)
 
void set_persister (Persister *pst)
 
Controlcontrol ()
 
bool is_shutdown ()
 
void set_session_config (struct SessionConfig *sf)
 
virtual F8API Messagegenerate_logout (const char *msgstr=nullptr)
 
virtual F8API Messagegenerate_heartbeat (const f8String &testReqID)
 
virtual F8API Messagegenerate_resend_request (const unsigned begin, const unsigned end=0)
 
virtual F8API Messagegenerate_sequence_reset (const unsigned newseqnum, const bool gapfillflag=false)
 
virtual F8API Messagegenerate_test_request (const f8String &testReqID)
 
virtual F8API Messagegenerate_reject (const unsigned seqnum, const char *what, const char *msgtype=nullptr)
 
virtual F8API Messagegenerate_business_reject (const unsigned seqnum, const Message *msg, const int reason, const char *what)
 
void do_state_change (const States::SessionStates new_state)
 
States::SessionStates get_session_state () const
 

Private Types

using Nos_queue = std::queue< FIX8::TEX::NewOrderSingle * >
 

Private Attributes

tex_router_client _router
 
Nos_queue _nos_queue
 

Additional Inherited Members

- Public Types inherited from FIX8::Session
enum  SessionControl {
  shutdown, print, printnohb, debug,
  count
}
 
using Control = ebitset_r< SessionControl >
 
using SequencePair = std::pair< const unsigned, const f8String >
 
- Static Public Member Functions inherited from FIX8::Session
static const Messagedetach (const Message *&msg)
 
static const f8Stringget_session_state_string (const States::SessionStates state)
 
static F8API const f8String copyright_string ()
 
- Protected Member Functions inherited from FIX8::Session
F8API bool heartbeat_service ()
 Heartbeat generation service thread method. More...
 
F8API bool activation_service ()
 Session start/stop service thread method. More...
 
virtual F8API bool handle_logon (const unsigned seqnum, const Message *msg)
 
virtual F8API Messagegenerate_logon (const unsigned heartbeat_interval, const f8String davi=f8String())
 
virtual F8API bool handle_logout (const unsigned seqnum, const Message *msg)
 
virtual F8API bool handle_heartbeat (const unsigned seqnum, const Message *msg)
 
virtual F8API bool handle_resend_request (const unsigned seqnum, const Message *msg)
 
virtual F8API bool handle_sequence_reset (const unsigned seqnum, const Message *msg)
 
virtual F8API bool handle_test_request (const unsigned seqnum, const Message *msg)
 
virtual bool handle_reject (const unsigned seqnum, const Message *msg)
 
virtual bool handle_admin (const unsigned seqnum, const Message *msg)
 
virtual F8API bool handle_outbound_reject (const unsigned seqnum, const Message *msg, const char *errstr)
 
virtual void state_change (const States::SessionStates before, const States::SessionStates after)
 
virtual void modify_outbound (Message *msg)
 
virtual bool authenticate (SessionID &id, const Message *msg)
 
virtual F8API void recover_seqnums ()
 Recover next expected and next to send sequence numbers from persitence layer. More...
 
Messagecreate_msg (const f8String &msg_type) const
 
void set_scheduler (int priority)
 
void set_affinity (int core_id)
 
- Protected Attributes inherited from FIX8::Session
Control _control
 
f8_atomic< unsigned > _next_send_seq
 
f8_atomic< unsigned > _next_receive_seq
 
f8_atomic< States::SessionStates_state
 
f8_atomic< bool > _active
 
Tickval _last_sent
 
Tickval _last_received
 
const F8MetaCntx_ctx
 
sender_comp_id _sci
 
Connection_connection
 
unsigned _req_next_send_seq
 
unsigned _req_next_receive_seq
 
SessionID _sid
 
struct SessionConfig_sf
 
LoginParameters _loginParameters
 
f8_spin_lock _per_spl
 
Persister_persist
 
Logger_logger
 
Logger_plogger
 
Timer< Session_timer
 
TimerEvent< Session_hb_processor
 
TimerEvent< Session_session_scheduler
 
std::string _batchmsgs_buffer
 
Session_Schedule_schedule
 
- Static Protected Attributes inherited from FIX8::Session
static F8API const std::vector< f8String_state_names
 string representation of Sessionstates More...
 

Detailed Description

Example client session. Derives from FIX8::Session.

Your application must define a class similar to this in order to create and connect a client. You must also implement handle_application in order to receive application messages from the framework.

Definition at line 64 of file hftest.hpp.

Member Typedef Documentation

Definition at line 67 of file hftest.hpp.

Constructor & Destructor Documentation

hf_session_client::hf_session_client ( const FIX8::F8MetaCntx ctx,
const FIX8::SessionID sid,
FIX8::Persister persist = nullptr,
FIX8::Logger logger = nullptr,
FIX8::Logger plogger = nullptr 
)
inline

Ctor. Initiator.

Parameters
ctxreference to generated metadata
sidsessionid of connecting session
persistpersister for this session
loggerlogger for this session
ploggerprotocol logger for this session

Definition at line 77 of file hftest.hpp.

78  : Session(ctx, sid, persist, logger, plogger), _router(*this) {}
F8API Session(const F8MetaCntx &ctx, const SessionID &sid, Persister *persist=nullptr, Logger *logger=nullptr, Logger *plogger=nullptr)
Definition: session.cpp:105
tex_router_client _router
Definition: hftest.hpp:66

Member Function Documentation

bool hf_session_client::cached ( ) const
inline

Definition at line 98 of file hftest.hpp.

98 { return !_nos_queue.empty(); }
Nos_queue _nos_queue
Definition: hftest.hpp:68
bool hf_session_client::handle_application ( const unsigned  seqnum,
const FIX8::Message *&  msg 
)
virtual

Application message callback. This method is called by the framework when an application message has been received and decoded. You should implement this method and call the supplied Message::process.

Parameters
seqnumFix sequence number of the message
msgMesage decoded (base ptr)
Returns
true on success

Implements FIX8::Session.

Definition at line 579 of file hftest.cpp.

References FIX8::Message::process().

580 {
581  return enforce(seqnum, msg) || msg->process(_router);
582 }
virtual bool process(Router &rt) const
Definition: message.hpp:1147
F8API bool enforce(const unsigned seqnum, const Message *msg)
Definition: session.cpp:252
tex_router_client _router
Definition: hftest.hpp:66
FIX8::TEX::NewOrderSingle* hf_session_client::pop ( )
inline

Definition at line 89 of file hftest.hpp.

90  {
91  if (_nos_queue.empty())
92  return 0;
94  _nos_queue.pop();
95  return nos;
96  }
NewOrderSingle (D), application, 243 fields, 11 groups.
Nos_queue _nos_queue
Definition: hftest.hpp:68
void hf_session_client::push ( FIX8::TEX::NewOrderSingle nos)
inline

Definition at line 88 of file hftest.hpp.

88 { _nos_queue.push(nos); }
Nos_queue _nos_queue
Definition: hftest.hpp:68
int hf_session_client::size ( ) const
inline

Definition at line 99 of file hftest.hpp.

99 { return static_cast<int>(_nos_queue.size()); }
Nos_queue _nos_queue
Definition: hftest.hpp:68

Member Data Documentation

Nos_queue hf_session_client::_nos_queue
private

Definition at line 68 of file hftest.hpp.

tex_router_client hf_session_client::_router
private

Definition at line 66 of file hftest.hpp.


The documentation for this class was generated from the following files: