FIX: configuration structure is introduced

Keep all session configuration parameters under a single structure.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
fix: Introduce fix_timestamp_now() helper function

Signed-off-by: Pekka Enberg <penberg@kernel.org>
fix: Simplify fix_session_process()

Signed-off-by: Pekka Enberg <penberg@kernel.org>
fix: Simplify rest_of_message()

Add a fix_tag_type() helper function and use that to simplify
rest_of_message() implementation. This makes the current implementation
more robust and makes it easier to eventually support FIX dialects that
have conflicting tag types.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
FAST: Keep parser active until signal is sent

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Fix buffer read and write API naming

The letter 'x' in buffer_xread/buffer_xwrite attributes to xread/xwrite
functions being used inside

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add non-restarting buffer read and write API

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: Use non-blocking reads for RX

xread function blocks the caller even if the underlying file descriptor
associated with the buffer is a non-blocking.  This patch makes FIX
receving engine be able to handle non-blocing file descriptors.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FAST: Use non-blocking reads for RX

xread function blocks the caller even if the underlying
file descriptor associated with the buffer is a non-blocking.
This patch makes FAST receving engine be able to handle
non-blocing file descriptors.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: Make HeartBtInt configurable

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: Update timestamps of the last transmitted and received messages

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: Administrative level messages treatment

The patch consists of two parts:

* fix_session_admin() function is introduced. It both handles a subset
  of the administrative messages and keeps track of the incoming message
  sequence numbers. The function returns 0 if it was able to process a
  message, a user should not process the message further, 1 - if the
  function was not able to handle a message, a user should decide on
  what to do further

* fix_session_keepalive() function s introduced. Its purpose is to
  maintain connection status by generating activity if nothing was
  received/transmitted in a specified time. Further details can be read
  in FIX specification, namely: conditions on which HeartBeats and
  TestRequests are issued

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
[ penberg@kernel.org: Use LDFLAGS for -lrt to fix 64-bit Fedora issue. ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Use verbose build on Travis CI

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Makefile: Move "-lrt" from LDFLAGS to EXTRA_LIBS

Move "-lrt" from LDFLAGS to EXTRA_LIBS to fix link breakage with GCC.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Makefile: Move '-lxm2' from LIBS to EXTRA_LIBS

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Initial LSE ITCH support

This patch adds initial support for London Stock Exchange ("LSE") Level
2-ITCH market data protocol.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
FAST: Do not block ourselves while decoding incoming messages

At the moment whenever we exhaust the buffer, we block ourselves
util new portion of data is received. This is done for all sort
of underlying sockets: both blocking and non-blocking. To benefit
from non-blocking operations, we should return immediately once
faced with difficulties retrieving the data. In this case NULL is
returned and the user is free to call fix_session_recv() again.
Subsequent calls will result in decoding only those fields that
were not decoded previously.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: a couple of cleanups

* eliminate redundancy: there is no need to manipulate
with buffer's start inside fix_session_recv() as fix_message_parse()
moves buffer's start pointer back if a message was partially received

* it's a valid behaviour when fix_session_recv() returns NULL, no need
to perform more than one attempt to parse a message. A user is free
to call fix_session_recv() once more

* user should retry receiving a message whenever fix_session_recv()
returns NULL. A few places are affected: fix_session_logon(),
fix_session_logout(), fix_client and fix_server

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FAST: there is no need to store pmap pointer in fast_message structure

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
FIX: meet necessary conditions during Logon

According to FIX spec:

* If MsgSeqNum is too high then Resend Request is to be sent
* If any message other than Logon is received, Logout message
with Text "First message not a logon" has to be sent

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>