alfred: Guarantee monotonic times

The times returned by time(..) and gettimeofday(...) are not monotonic and
therefore the time can jump backwards or forwards. This can happen during after
a settime system call or when the local timezone was changed.

Jumps forward are not problematic and only cause early processing of some
data/more data in the network, but warping back in time can result in hangs and
publishing of outdated data.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
alfred: Send a tx end packet after data was pushed

The transaction for a transfer must be checked before the receiver can move the
data to the own data hash. The basic check will use the amount of data
transferred. The sender uses a txend packet including the necessary
information.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
alfred: Import the linux kernel list implementation

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
alfred: Only apply changes after txend status was received

A transaction has to be handled in a atomic way. Either the complete data was
received or it wasn't. The simplest method is to use a buffer to hold all
unconfirmed data instead of using a redo/undo log. All data in this transaction
buffer will be written after the transaction was confirmed or in case of an
failure just dropped.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
alfred: Report errors for request data back to client

The client must be able whether there was an error in requesting data or there
is just no data to return. The server will check whether the complete data was
returned and when not it will send an error status packet to the client.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
alfred: Only send txend when requested

The synchronization (master <-> master, local -> master) without data doesn't
require a txend because the remote would not have opened a transaction for it.
Therefore, sending a txend would only increase the network requirements.

Signed-off-by: Sven Eckelmann <sven@open-mesh.com>