FAST tools: Server and client code unification

FAST server and client code is organized in the same
way as for FIX server and client respectively. The
fact is that both client and server might operate
in several modes. At the moment FAST client and
server can operate in a 'script' mode only but this
functionality is to be extended in the future

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
FIX server: code cleanups

Use a general structure to pass arguments to the
FIX server different mode functions

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
FAST encoding bug: pmap bit increment

It does not matter whether pmap bit is actually set
or not. If operation requires pmap bit inside a PMAP
structure we should increment pmap bit. Otherwise,
PMAP will be corrupted if another field when being
encoded sets the wrong pmap bit.

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
FAST tools: Ping-Pong mode introduced

The patch introduces a simple ping-pong mode:
A client sends (pings) a message to server.
A server receives a message from the client,
decodes it and sends (pongs) a message to the
client. Such a scenario allows to estimate
RTT (round-trip-time) of a particular message.
In other words, the time spent by the client
encoding a message, the server decoding it,
then encoding a message a sending it back to
the client and finally the client decoding
the received message.

$ ./tools/fast/fast_server -m pong -n 100 -p 9000 -t ./tools/fast/scripts/PingPong.xml
FAST server is listening to port 9000...

$ ./tools/fast/fast_client -m ping -n 100 -h localhost -p 9000 -t ./tools/fast/scripts/PingPong.xml
Messages sent: 100
Round-trip time: min/avg/max = 40.0/76.6/238.0 μs

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
FAST: switch to sendmsg()

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
FAST: Use non-blocking recv()

Switch to non-blocking recv() in FAST receive path

Running the FAST engine latency tests:

$ while true; do tools/fast/fast_server -m pong -n 100000 -p 9000 -t tools/fast/scripts/PingPong.xml; done

$ while true; do tools/fast/fast_client -m ping -n 100000 -h localhost -p 9000 -t tools/fast/scripts/PingPong.xml; done

Shows 85% reduction in round-trip times:

Before:
Messages sent: 100000
Round-trip time: min/avg/max = 22.0/71.9/3618.0 μs
Round-trip time: min/avg/max = 39.0/76.0/1492.0 μs
Round-trip time: min/avg/max = 38.0/86.8/1148.0 μs
Round-trip time: min/avg/max = 25.0/80.3/241.0 μs
Round-trip time: min/avg/max = 38.0/71.0/240.0 μs
Round-trip time: min/avg/max = 39.0/76.2/1062.0 μs
Round-trip time: min/avg/max = 22.0/62.6/250.0 μs
Round-trip time: min/avg/max = 37.0/90.1/1135.0 μs
Round-trip time: min/avg/max = 39.0/71.4/1138.0 μs
Round-trip time: min/avg/max = 38.0/88.8/1079.0 μs

After:
Messages sent: 100000
Round-trip time: min/avg/max = 10.0/11.2/177.0 μs
Round-trip time: min/avg/max = 10.0/11.1/153.0 μs
Round-trip time: min/avg/max = 10.0/11.1/150.0 μs
Round-trip time: min/avg/max = 10.0/11.0/975.0 μs
Round-trip time: min/avg/max = 10.0/11.2/238.0 μs
Round-trip time: min/avg/max = 10.0/11.0/179.0 μs
Round-trip time: min/avg/max = 10.0/11.2/312.0 μs
Round-trip time: min/avg/max = 10.0/11.1/174.0 μs
Round-trip time: min/avg/max = 10.0/11.0/142.0 μs
Round-trip time: min/avg/max = 10.0/11.1/970.0 μs

Signed-off-by: Marat Stanichenko <mstanichenko@gmail.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
Add FAST round-trip times to README

Signed-off-by: Pekka Enberg <penberg@iki.fi>