Send indexes in streaming mode

To write an index on disk, we need to know all the fields sent by the
RELAY_SEND_INDEX command as well as the offset of the data in the
tracefile.

Since the control and data connection are not synchronized, this process
happens in two separate steps synchronized by an HT indexed by the
index_handle and the net_seq_num.

When we receive data and when we receive an index, we lookup in the HT
if an entry already exists. If it does, it means that we only need to
fill the fields we just received and write the index on disk, otherwise,
we allocate a new index, set the fields we know and store it in the HT.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
basic handling of live_timer, for now just a printf

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Create relayd session from the sessiond

Move the relayd session creation from the consumer to the relayd. No
change in behaviour expected here, just prepare for the next patch to
allow the sessiond to pass additionnal parameters in the relayd session
creation required for live tracing (hostname, session name, flags, etc).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Create relayd session with live parameters

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Relay listen on 2 additionnal ports

Copy the structure of the threads management of the main relayd for the
live viewer.
So we have 3 new threads live_listener, live_dispatcher, live_worker. It
maybe is a lot of duplicated code, but it is too early in the dev to
identify precisely the code that could be merged.
For now we don't do anything useful on these ports, but that's the next
step.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Cleanup line-wrap, add lttng-viewer.h

Viewer command VIEWER_VERSION working (tested with separate test program
using only lttng-viewer.h as "internal" header).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Viewer list sessions

Add a session_list HT in the relayd and allow the viewer to list the
sessions.
Introduce a relay_local_data struct to have a simple way to share data
between threads.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Attach session + list streams

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
fix post-merge

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix close index_fd if not created

If we never received any data during the session, we never opened an
index file, so we don't need to close it.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>