Skip to content
README.md 6.04 KiB
Newer Older
Luker's avatar
Luker committed
# RaptorQ #
Luker's avatar
Luker committed

Luker's avatar
Luker committed
[![build status](https://www.fenrirproject.org/Luker/libRaptorQ/badges/master/build.svg)](https://www.fenrirproject.org/Luker/libRaptorQ/commits/master)  
Luker's avatar
Luker committed
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=79L8P7TXWFQK4)
[![Donate](https://img.shields.io/badge/Donate-Patreon-orange.svg)](https://patreon.com/Luker)  
Luker's avatar
Luker committed
[Homepage](https://www.fenrirproject.org/Luker/libRaptorQ/wikis/home)

Luker's avatar
Luker committed

Luker's avatar
Luker committed
stable  release: **v0.1.10**  
> Note: v0.1.10 is not compatible with prefivous versions, which were not RFC compliant!
Luker's avatar
Luker committed

current release: **v1.0.0-rc1**  
Luker's avatar
Luker committed
RaptorQ is a **Forward Error Correction** algorithm designed to deliver your data
Luker's avatar
Luker committed
efficiently and without retransmissions for lost packets.

After sending K packets of your data as-is, RaptorQ generates as many repair
symbols as you need. Once the receiver has at least K symbols, be it the source
symbols, repair symbols or any combination of the two, it can reconstruct the
whole input it was meant to receive.

This is called a Fountain code, and RaptorQ is the latest and most efficient
code in this category.


Luker's avatar
Luker committed
**libRaptorQ** implements **RFC6330**, which specifies the RaptorQ algorithm.  
Luker's avatar
Luker committed
Since the RFC is really complex, there is also a simpler (and maybe slightly faster)
RAW API that you can use.  The RFC API is not recommended due to the RFC complexity.
Luker's avatar
Luker committed
libRaptorQ is a header-only library written in *C++11*, and uses eigen to handle matrix
manipulation.  
Although header-only, the library can be compiled to create shared and static libraries
with both C and C++98 compatibility.
Luker's avatar
Luker committed


Currently it's only been tested under Linux, but should work well under
*BSD and MacOSX, too.

Luker's avatar
Luker committed
Unfortunately Windows is not supported. support for <future> is broken,
so you can not compile it with Visual Studio 2015.
Luker's avatar
Luker committed
## Features

- RFC6330 API (complex, not recommended)
- RAW API (simpler, recommended)
- multi language:
  - header only C++11
  - compiled, C
  - compiled, C++98
- cached precomputations (configurable)

Luker's avatar
Luker committed
## Developers ##
Luker's avatar
Luker committed

Luker's avatar
Luker committed
See the [CONTRIBUTING](CONTRIBUTING.md) file.
Luker's avatar
Luker committed
## The Source Code ##
Luker's avatar
Luker committed

Although things seems to work, no stable release has been released yet.

This means you can only check this out with git.

to check out the repository:

Luker's avatar
Luker committed
``$ git clone https://github.com/LucaFulchir/libRaptorQ.git``
Luker's avatar
Luker committed

you can also get it from our main server:

Luker's avatar
Luker committed
``$ git clone https://www.fenrirproject.org/Luker/libRaptorQ.git``

Luker's avatar
Luker committed
### GPG source check ###
Luker's avatar
Luker committed
Once you have cloned it, it's always a good thing to check the repository gpg
Luker's avatar
Luker committed
signatures, so you can import my key with:

Luker's avatar
Luker committed
new long term key: **7393 DAD2 55BE B575 1DBD A04A B11C D823 BA27 8C85**  
``$ gpg --keyserver pgp.mit.edu --recv-key 7393DAD255BEB5751DBDA04AB11CD823BA278C85``  
Luker's avatar
Luker committed
2016 key:  
``$ gpg --keyserver pgp.mit.edu --recv-key F61F6137``  
2015 key:  
``$ gpg --keyserver pgp.mit.edu --recv-key D42DDF0A``  
Luker's avatar
Luker committed
please check the full fingerprint.
Luker's avatar
Luker committed

Now you have the source, and the key, it's enough to check the signature of the
last commit:

Luker's avatar
Luker committed
``$ git log -n 1 --show-signature``
Luker's avatar
Luker committed
As long as you got the right key, and you find the "gpg: Goog signature",
Luker's avatar
Luker committed
you can be sure you have the right code.


Luker's avatar
Luker committed
## Install ##
Luker's avatar
Luker committed
#### Dependencies ####
Luker's avatar
Luker committed
libRaptorQ depends from **Eigen3** and **LZ4**  
In case your system does not have Eigen3, Eigenv3.2.8 is included
in the source files, so you do not need it.  
LZ4 is included as a git submodule, so if you do not have it, run:  
```git submodule init```  
```git submodule update```  
To get the library, which will be statically linked and **NOT INSTALLED**
on your system.
Luker's avatar
Luker committed
#### Building ####
Luker's avatar
Luker committed

The build system uses CMake. So enter the source directory and we'll create a
directory and build everything there:

Luker's avatar
Luker committed
```bash
Luker's avatar
Luker committed
$ mkdir build
$ cd build

$ cmake -DCMAKE_BUILD_TYPE=Release ../

$ make -j 4
Luker's avatar
Luker committed
```
Luker's avatar
Luker committed
Optional targets are available:  
``$ make tests examples docs``  
where:  
* tests: benchmarks, rfc tests.
* examples: C/C++ examples
* docs: LATEX documentation.
Luker's avatar
Luker committed

Luker's avatar
Luker committed
or simply:  
``$ make -j 4 everything``
Luker's avatar
Luker committed

Luker's avatar
Luker committed
finally, install everything  
``$ make install``
Luker's avatar
Luker committed
libRaptorQ uses **deterministic (reproducible) builds**,
Luker's avatar
Luker committed
so if you compile it twice, or on two different computers
(but with the same compiler), the hash of the resulting
libraries will be the same.

Luker's avatar
Luker committed
_There are combinations of compiler and LTO/Profiling that
break deterministic builds, so check the cmake warnings._
Luker's avatar
Luker committed

Luker's avatar
Luker committed
You can customize the CMake build with the following variables:

```
Luker's avatar
Luker committed
PROFILING   ON/OFF: Default:ON. Activate or deactivate profiling.
                Profiling compiles everything, then runs a test to see
                which code paths are more used. Then it recompiles everything
                but optimizing for for those code paths.
                Only for gcc/clang.
LTO         ON/OFF: Default:ON. Activate or deactivate Link time Optimization
                Makes the library smaller and better optimized.
                Only for gcc/clang.
Luker's avatar
Luker committed
CLANG_STDLIB ON/OFF: Default:OFF. use clang's libc++
Luker's avatar
Luker committed
                Note: only clang can use its standard library
Luker's avatar
Luker committed
USE_LZ4     ON/OFF: use the lz4 compression for caching precomputations.
                Default: ON
CLI         ON/OFF Build Command Line Interface tools.
Luker's avatar
Luker committed
CMAKE_C_COMPILER    gcc, clang...
CMAKE_CXX_COMPILER  choose between g++ or clang++.
Luker's avatar
Luker committed
RQ_LINKER   gold/ld/bsd Choose your linker. Default:autodetect.
Luker's avatar
Luker committed
CMAKE_BUILD_TYPE    Debug,MinSizeRel,Release,RelWithDebInfo
Luker's avatar
Luker committed
CMAKE_INSTALL_PREFIX Default: /usr/local
Luker's avatar
Luker committed
```
Luker's avatar
Luker committed
## Using libRaptorQ ##
Luker's avatar
Luker committed
For the C++11, header-only version, you can include:
 - "RaptorQ/RaptorQ_v1_hdr.hpp"
 - "RaptorQ/RFC6330_v1_hdr.hpp"

For the linked, C+98/C++11 API:
 - "RaptorQ/RaptorQ_v1.hpp"
 - "RaptorQ/RFC6330_v1.hpp"

For the linked, C API:
 - "RaptorQ/RaptorQ.h"
 - "RaptorQ/RFC6330.h"


The C++ api is completely in sync between the linked and header-only version,
so you can switch between the two just by changing the included header file.
Luker's avatar
Luker committed

Luker's avatar
Luker committed
You can compile a PDF of the documentation by doing:  
``$ make docs``
Luker's avatar
Luker committed
Or you can simply visit the [wiki](https://www.fenrirproject.org/Luker/libRaptorQ/wikis/libRaptorQ.pdf)
Luker's avatar
Luker committed
for the full up-to-date documentation.