LC_SEND(3)

NAME
lc_sendtree, lc_sendchunk - send data over multicast

LIBRARY
Librecast library (liblibrecast, -llibrecast)

SYNOPSIS
#include <librecast/sync.h>

ssize_t lc_sendtree(lc_ctx_t *lctx, unsigned char *hash, const mtree_t *tree,
        lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_sendchunk(lc_ctx_t *lctx, unsigned char *hash, const void *data,
        const size_t len, lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_senddir(lc_ctx_t *lctx, unsigned char *hash, net_tree_t *dir,
        lc_stat_t *stats, lc_sync_options_t *opt, int flags);

Compile and link with -llibrecast.

DESCRIPTION
Each of these functions sends data over multicast on the librecast channel formed from the supplied hash. LCRQ (RaptorQ) encoding is used when sending. Trees, for which the length is not known by the receiver, include an OTI header (RaptorQ FEC Object Transmission Information header - see RFC 6330) with each packet.

Sending continues in a loop until the calling thread is cancelled.

The lc_sendtree function sends the merkle tree structure tree on channel hash. The lc_sendchunk function sends len bytes of data.

The lc_senddir function is a wrapper for lc_sendtree(3) which sends a directory object and adjusts the sending size to account for the directory data.

If stats is not NULL, transfer statistics will be returned in this structure.

opt is not used, at present, and must be NULL for compatibility with future versions.

The flags argument is the bitwise OR of zero of more of the following flags:

LC_SHARE_LOOPBACK
    Set the loopback option IPV6_MULTICAST_LOOP on the sending socket.

RETURN VALUE
These calls return the number of bytes received, or -1 if an error occurred. In the event of an error, errno is set to indicate the error.

ERRORS

EINVAL
    Invalid argument.

ENOMEM Not enough space/cannot allocate memory (POSIX.1-2001).

SEE ALSO
lc_ctx_new(3), lc_share(3), lc_sendtree(3), lc_sendchunk(3)