======================================
 packetizer
======================================

The liquid packetizer is a structure for abstracting multi-level forward
error-correction from the user.
The packetizer accepts a buffer of uncoded data bytes and adds a
cyclic redundancy check (crc) before applying two levels of forward error-
correction and bit-level interleaving.  The user may choose any two 
supported FEC schemes (including none) and the packetizer object will
handle buffering and data management internally, providing a truly abstract
interface.  The same is true for the packet decoder which accepts an array
of possibly corrupt data and attempts to recover the original message using
the FEC schemes provided.  The packet decoder returns the validity of the
resulting CRC as well as its best effort of decoding the message.

The packetizer also allows for re-structuring if the user wishes to change
error-correction schemes or data lengths.  This is accomplished with the
packetier_recreate() method.

Here is a minimal example demonstrating the packetizer's most basic
functionality:

    #include <liquid/liquid.h>
    ...
    {
        // set up the options
        unsigned int n=16;                      // uncoded data length
        crc_scheme check = LIQUID_CRC_32;       // data integrity check
        fec_scheme fec0 = LIQUID_FEC_HAMMING74; // inner code
        fec_scheme fec1 = LIQUID_FEC_REP3;      // outer code

        // compute resulting packet length
        unsigned int k = packetizer_compute_enc_msg_len(n,fec0,fec1);

        // set up the arrays
        unsigned char msg[n];               // original message
        unsigned char packet[k];            // encoded message
        unsigned char msg_dec[n];           // decoded message
        int crc_pass;                       // decoder validity check

        // create the packetizer object
        packetizer p = packetizer_create(n,check,fec0,fec1);

        // initialize msg here
        unsigned int i;
        for (i=0; i<n; i++) msg[i] = i & 0xff;

        // encode the packet
        packetizer_encode(p,msg,packet);

        // decode the packet, returning validity
        crc_pass = packetizer_decode(p,packet,msg_dec);

        // destroy the packetizer object
        packetizer_destroy(p);
    }

