fix8
version 1.4.0
Open Source C++ FIX Framework
|
Complete Fix connection (reader and writer). More...
#include <connection.hpp>
Public Types | |
enum | Role { cn_acceptor, cn_initiator, cn_unknown } |
Roles: acceptor, initiator or unknown. More... | |
Public Member Functions | |
Connection (Poco::Net::StreamSocket *sock, Poco::Net::SocketAddress &addr, Session &session, Role role, const ProcessModel pmodel, unsigned hb_interval, bool secured) | |
virtual | ~Connection () |
Dtor. More... | |
Role | get_role () const |
ProcessModel | get_pmodel () const |
bool | is_secure () const |
F8API void | start () |
Start the reader and writer threads. More... | |
F8API void | stop () |
Stop the reader and writer threads. More... | |
virtual bool | connect () |
bool | is_connected () const |
virtual bool | write (Message *from, bool destroy=true) |
virtual bool | write (Message &from) |
size_t | write_batch (const std::vector< Message * > &msgs, bool destroy) |
int | send (const char *from, size_t sz) |
int | send (const f8String &from) |
void | set_hb_interval (const unsigned hb_interval) |
unsigned | get_hb_interval () const |
unsigned | get_hb_interval20pc () const |
Poco::Net::SocketAddress | get_peer_socket_address () const |
const Poco::Net::SocketAddress & | get_socket_address () const |
int | join () |
bool | is_socket_error () const |
void | set_recv_buf_sz (const unsigned sz) const |
void | set_send_buf_sz (const unsigned sz) const |
void | set_tcp_cork_flag (bool way) const |
Session & | get_session () |
int | reader_execute () |
bool | reader_poll (const Poco::Timespan &ts=Poco::Timespan()) const |
int | writer_execute () |
bool | writer_poll (const Poco::Timespan &ts=Poco::Timespan()) const |
Static Public Member Functions | |
static void | set_recv_buf_sz (const unsigned sz, Poco::Net::Socket *sock) |
static void | set_send_buf_sz (const unsigned sz, Poco::Net::Socket *sock) |
Protected Attributes | |
Poco::Net::StreamSocket * | _sock |
Poco::Net::SocketAddress | _addr |
f8_atomic< bool > | _connected |
Session & | _session |
Role | _role |
ProcessModel | _pmodel |
unsigned | _hb_interval |
unsigned | _hb_interval20pc |
FIXReader | _reader |
FIXWriter | _writer |
bool | _secured |
Complete Fix connection (reader and writer).
Definition at line 508 of file connection.hpp.
Roles: acceptor, initiator or unknown.
Enumerator | |
---|---|
cn_acceptor | |
cn_initiator | |
cn_unknown |
Definition at line 512 of file connection.hpp.
|
inline |
Ctor.
sock | connected socket |
addr | sock address structure |
session | session |
role | connection role |
pmodel | process model |
hb_interval | heartbeat interval |
secured | true for ssl connection |
Definition at line 537 of file connection.hpp.
|
inlinevirtual |
Dtor.
Definition at line 545 of file connection.hpp.
References FIX8::Session::clear_connection(), and stop().
|
inlinevirtual |
Get the connection state.
Reimplemented in FIX8::ClientConnection.
Definition at line 567 of file connection.hpp.
References _connected.
Referenced by FIX8::Session::start().
|
inline |
Get the heartbeat interval for this connection.
Definition at line 608 of file connection.hpp.
References _hb_interval.
Referenced by FIX8::Session::handle_logon(), FIX8::Session::heartbeat_service(), and FIX8::Session::start().
|
inline |
Get the heartbeat interval + %20 for this connection.
Definition at line 612 of file connection.hpp.
References _hb_interval20pc.
Referenced by FIX8::Session::heartbeat_service().
|
inline |
Get the peer socket address
Definition at line 616 of file connection.hpp.
Referenced by FIX8::Session::handle_logon().
|
inline |
Get the process model
Definition at line 553 of file connection.hpp.
References _pmodel.
Referenced by FIX8::Session::handle_logon(), FIX8::Session::recover_seqnums(), FIX8::Session::send_process(), FIX8::Session::stop(), and FIX8::Session::update_persist_seqnums().
|
inline |
Get the role for this connection.
Definition at line 549 of file connection.hpp.
References _role.
Referenced by FIX8::Session::handle_logon(), FIX8::Session::start(), FIX8::Session::stop(), and FIX8::Session::~Session().
|
inline |
Get the session associated with this connection.
Definition at line 670 of file connection.hpp.
References _session.
|
inline |
Get the socket address
Definition at line 620 of file connection.hpp.
References _addr.
|
inline |
Determine if this session is actually connected
Definition at line 571 of file connection.hpp.
References _connected.
Referenced by FIX8::Session::activation_service(), and FIX8::Session::heartbeat_service().
|
inline |
Check if this connection is secure
Definition at line 557 of file connection.hpp.
References _secured.
|
inline |
Check to see if the socket is in error
Definition at line 628 of file connection.hpp.
References FIX8::FIXReader::is_socket_error().
|
inline |
Wait till reader thead has finished.
Definition at line 624 of file connection.hpp.
References FIX8::FIXReader::join().
Referenced by FIX8::Session::start().
|
inline |
Call the FIXreader method
Definition at line 674 of file connection.hpp.
References FIX8::AsyncSocket< T >::cancellation_token(), and FIX8::FIXReader::execute().
|
inline |
Check if the reader will block
ts | timeout |
Definition at line 679 of file connection.hpp.
References FIX8::FIXReader::poll().
|
inline |
Write a string message to the underlying socket.
from | Message (string) to write |
sz | number bytes to send |
Definition at line 594 of file connection.hpp.
References FIX8::FIXWriter::send().
Referenced by FIX8::Session::send_process().
|
inline |
Write a string message to the underlying socket.
from | Message (string) to write |
Definition at line 599 of file connection.hpp.
References FIX8::FIXWriter::send().
|
inline |
Set the heartbeat interval for this connection.
hb_interval | heartbeat interval |
Definition at line 603 of file connection.hpp.
References FIX8::defaults::hb_interval.
Referenced by FIX8::Session::handle_logon().
|
inlinestatic |
Set the socket recv buffer sz
sock | socket to operate on |
sz | new size |
Definition at line 633 of file connection.hpp.
References glout_info.
Referenced by FIX8::ServerSession< T >::ServerSession().
|
inline |
Set the socket recv buffer sz
sz | new size |
Definition at line 653 of file connection.hpp.
References set_recv_buf_sz().
Referenced by set_recv_buf_sz().
|
inlinestatic |
Set the socket send buffer sz
sock | socket to operate on |
sz | new size |
Definition at line 644 of file connection.hpp.
References glout_info.
Referenced by FIX8::ServerSession< T >::ServerSession().
|
inline |
Set the socket send buffer sz
sz | new size |
Definition at line 657 of file connection.hpp.
References set_send_buf_sz().
Referenced by set_send_buf_sz().
|
inline |
Set the tcp_cork flag
way | boolean true (on) or false(clear) |
Definition at line 661 of file connection.hpp.
Referenced by MyMenu::send_all_preloaded().
void Connection::start | ( | ) |
Start the reader and writer threads.
Definition at line 315 of file connection.cpp.
Referenced by FIX8::ReliableClientSession< T >::operator()(), and FIX8::Session::start().
void Connection::stop | ( | ) |
Stop the reader and writer threads.
Definition at line 322 of file connection.cpp.
References scout_debug.
Referenced by FIX8::Session::stop(), ~Connection(), and FIX8::SessionInstance< T >::~SessionInstance().
|
inlinevirtual |
Write a message to the underlying socket.
from | Message to write |
destroy | if true delete after send |
Definition at line 577 of file connection.hpp.
References FIX8::FIXWriter::write().
Referenced by FIX8::Session::send().
|
inlinevirtual |
Write a message to the underlying socket. Non-pipelined version.
from | Message to write |
Definition at line 582 of file connection.hpp.
References FIX8::FIXWriter::write().
|
inline |
Write messages to the underlying socket as a single batch.
msgs | vector of Message to write |
destroy | if true delete after send |
Definition at line 588 of file connection.hpp.
References FIX8::FIXWriter::write_batch().
Referenced by FIX8::Session::send_batch().
|
inline |
Call the FIXreader method
Definition at line 683 of file connection.hpp.
References FIX8::AsyncSocket< T >::cancellation_token(), and FIX8::FIXWriter::execute().
|
inline |
Check if the writer will block
ts | timeout |
Definition at line 688 of file connection.hpp.
References FIX8::FIXWriter::poll().
Referenced by MyMenu::send_all_preloaded().
|
protected |
Definition at line 516 of file connection.hpp.
Referenced by get_socket_address().
|
protected |
Definition at line 517 of file connection.hpp.
Referenced by connect(), and is_connected().
|
protected |
Definition at line 521 of file connection.hpp.
Referenced by get_hb_interval().
|
protected |
Definition at line 521 of file connection.hpp.
Referenced by get_hb_interval20pc().
|
protected |
Definition at line 520 of file connection.hpp.
Referenced by get_pmodel().
|
protected |
Definition at line 523 of file connection.hpp.
|
protected |
Definition at line 519 of file connection.hpp.
Referenced by get_role().
|
protected |
Definition at line 525 of file connection.hpp.
Referenced by is_secure().
|
protected |
Definition at line 518 of file connection.hpp.
Referenced by get_session().
|
protected |
Definition at line 515 of file connection.hpp.
|
protected |
Definition at line 524 of file connection.hpp.