fix8
version 1.4.0
Open Source C++ FIX Framework
|
Fix message reader. More...
#include <connection.hpp>
Public Member Functions | |
FIXReader (Poco::Net::StreamSocket *sock, Session &session, const ProcessModel pmodel=pm_pipeline) | |
virtual | ~FIXReader () |
Dtor. More... | |
virtual void | start () |
Start the processing threads. More... | |
virtual void | quit () |
Stop the processing threads and quit. More... | |
virtual void | stop () |
Send a message to the processing method instructing it to quit. More... | |
virtual F8API int | execute (f8_thread_cancellation_token &cancellation_token) |
int | join () |
F8API void | set_preamble_sz () |
Calculate the length of the Fix message preamble, e.g. "8=FIX.4.4^A9=". More... | |
bool | is_socket_error () const |
bool | poll (const Poco::Timespan &ts=Poco::Timespan()) const |
f8_thread_cancellation_token & | callback_cancellation_token () |
Public Member Functions inherited from FIX8::AsyncSocket< f8String > | |
AsyncSocket (Poco::Net::StreamSocket *sock, Session &session, const ProcessModel pmodel=pm_pipeline) | |
virtual | ~AsyncSocket ()=default |
Dtor. More... | |
size_t | queued () const |
bool | started () const |
int | operator() () |
virtual void | request_stop () |
Start the processing thread. More... | |
Poco::Net::StreamSocket * | socket () |
int | join () |
f8_thread_cancellation_token & | cancellation_token () |
Private Types | |
enum | { _max_msg_len = FIX8_MAX_MSG_LENGTH, _chksum_sz = 7 } |
Private Member Functions | |
F8API int | callback_processor () |
bool | read (f8String &to) |
int | sockRead (char *where, const size_t sz) |
Private Attributes | |
f8_atomic< bool > | _socket_error |
f8_thread< FIXReader > | _callback_thread |
f8_thread_cancellation_token | _callback_cancellation_token |
size_t | _bg_sz |
Additional Inherited Members | |
Protected Attributes inherited from FIX8::AsyncSocket< f8String > | |
coroutine | _coro |
Poco::Net::StreamSocket * | _sock |
f8_concurrent_queue< f8String > | _msg_queue |
Session & | _session |
ProcessModel | _pmodel |
f8_thread_cancellation_token | _cancellation_token |
volatile bool | _started |
f8_mutex | _start_mutex |
Fix message reader.
Definition at line 134 of file connection.hpp.
|
private |
Enumerator | |
---|---|
_max_msg_len | |
_chksum_sz |
Definition at line 136 of file connection.hpp.
|
inline |
Ctor.
sock | connected socket |
session | session |
pmodel | process model |
Definition at line 245 of file connection.hpp.
References set_preamble_sz().
|
inlinevirtual |
Dtor.
Definition at line 256 of file connection.hpp.
References join(), and stop().
|
inline |
Definition at line 335 of file connection.hpp.
References _callback_cancellation_token.
|
private |
Process messages from inbound queue, calls session process method.
Definition at line 164 of file connection.cpp.
References scout_info, and scout_warn.
|
virtual |
Reader thread method. Reads messages and places them on the queue for processing. Supports pipelined, threaded and coroutine process models.
Reimplemented from FIX8::AsyncSocket< f8String >.
Definition at line 45 of file connection.cpp.
References coro_yield, FIX8::pm_coro, FIX8::pm_pipeline, reenter, scout_error, scout_info, scout_warn, FIX8::States::st_session_terminated, and FIX8::f8Exception::what().
Referenced by FIX8::Connection::reader_execute().
|
inline |
Check to see if the socket is in error
Definition at line 325 of file connection.hpp.
References _socket_error.
Referenced by FIX8::Connection::is_socket_error().
|
inline |
Wait till writer thread has finished.
Definition at line 318 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_pmodel, FIX8::AsyncSocket< T >::join(), and FIX8::pm_coro.
Referenced by FIX8::Connection::join(), and ~FIXReader().
|
inline |
Check to see if there is any data waiting to be read
ts | timeout |
Definition at line 330 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_sock.
Referenced by FIX8::Connection::reader_poll().
|
inlinevirtual |
Stop the processing threads and quit.
Reimplemented from FIX8::AsyncSocket< f8String >.
Definition at line 276 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_pmodel, FIX8::_f8_threadcore::join(), FIX8::pm_coro, FIX8::pm_pipeline, FIX8::AsyncSocket< T >::quit(), and FIX8::f8_thread< T >::request_stop().
|
private |
Read a Fix message. Throws InvalidBodyLength, IllegalMessage.
to | string to place message in |
Definition at line 207 of file connection.cpp.
References FIX8::default_field_separator(), FIX8::MessageBase::extract_element(), FILE_LINE, FIX8_MAX_FLD_LENGTH, and FIX8::MAX_MSGTYPE_FIELD_LEN().
void FIXReader::set_preamble_sz | ( | ) |
Calculate the length of the Fix message preamble, e.g. "8=FIX.4.4^A9=".
Definition at line 201 of file connection.cpp.
Referenced by FIXReader().
|
inlineprivate |
Read bytes from the socket layer, throws PeerResetConnection.
where | buffer to place bytes in |
sz | number of bytes to read |
Definition at line 217 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_sock.
|
inlinevirtual |
Start the processing threads.
Reimplemented from FIX8::AsyncSocket< f8String >.
Definition at line 263 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_pmodel, FIX8::pm_coro, FIX8::pm_pipeline, FIX8::AsyncSocket< T >::start(), and FIX8::f8_thread< T >::start().
|
inlinevirtual |
Send a message to the processing method instructing it to quit.
Definition at line 288 of file connection.hpp.
References FIX8::AsyncSocket< f8String >::_msg_queue, FIX8::AsyncSocket< f8String >::_pmodel, FIX8::AsyncSocket< f8String >::_start_mutex, FIX8::AsyncSocket< f8String >::_started, glout_warn, FIX8::pm_coro, FIX8::pm_pipeline, FIX8::AsyncSocket< T >::request_stop(), and FIX8::f8_thread< T >::request_stop().
Referenced by ~FIXReader().
|
private |
Definition at line 151 of file connection.hpp.
|
private |
Definition at line 140 of file connection.hpp.
Referenced by callback_cancellation_token().
Definition at line 139 of file connection.hpp.
|
private |
Definition at line 137 of file connection.hpp.
Referenced by is_socket_error().