/* * Copyright (c) 2015, Luca Fulchir, All rights reserved. * * This file is part of "libRaptorQ". * * libRaptorQ is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * libRaptorQ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * and a copy of the GNU Lesser General Public License * along with libRaptorQ. If not, see . */ #ifndef RAPTORQ_C_H #define RAPTORQ_C_H #include #include #include #ifdef __cplusplus extern "C" { #endif typedef uint64_t RaptorQ_OTI_Common_Data; typedef uint32_t RaptorQ_OTI_Scheme_Specific_Data; typedef enum { NONE = 0, ENC_8 = 1, ENC_16 = 2, ENC_32 = 3, ENC_64 = 4, DEC_8 = 5, DEC_16 = 6, DEC_32 = 7, DEC_64 = 8} RaptorQ_type; struct RaptorQ_ptr { #ifdef __cplusplus RaptorQ_ptr (const RaptorQ_type _type) :type (_type) {} #endif void *ptr; const RaptorQ_type type; }; struct RaptorQ_ptr *RaptorQ_Enc (const RaptorQ_type type, void *data, const uint64_t size, const uint16_t min_subsymbol_size, const uint16_t symbol_size, const size_t max_memory); struct RaptorQ_ptr *RaptorQ_Dec (const RaptorQ_type type, const RaptorQ_OTI_Common_Data common, const RaptorQ_OTI_Scheme_Specific_Data scheme); /////////// // Encoding /////////// RaptorQ_OTI_Common_Data RaptorQ_OTI_Common (struct RaptorQ_ptr *enc); RaptorQ_OTI_Scheme_Specific_Data RaptorQ_OTI_Scheme (struct RaptorQ_ptr *enc); uint16_t RaptorQ_symbol_size (struct RaptorQ_ptr *ptr); uint8_t RaptorQ_blocks (struct RaptorQ_ptr *ptr); uint32_t RaptorQ_block_size (struct RaptorQ_ptr *ptr, const uint8_t sbn); uint16_t RaptorQ_symbols (struct RaptorQ_ptr *ptr, const uint8_t sbn); uint32_t RaptorQ_max_repair (RaptorQ_ptr *enc, const uint8_t sbn); size_t RaptorQ_precompute_max_memory (struct RaptorQ_ptr *enc); void RaptorQ_precompute (struct RaptorQ_ptr *enc, const uint8_t threads, const bool background); uint64_t RaptorQ_encode_id (struct RaptorQ_ptr *enc, void **data, const uint64_t size, const uint32_t id); uint64_t RaptorQ_encode (struct RaptorQ_ptr *enc, void **data, const uint64_t size, const uint32_t esi, const uint8_t sbn); /////////// // Decoding /////////// uint32_t RaptorQ_decode (struct RaptorQ_ptr *dec, void **data, const size_t size); uint32_t RaptorQ_decode_sbn (struct RaptorQ_ptr *dec, void **data, const size_t size, const uint8_t sbn); bool RaptorQ_add_symbol_id (struct RaptorQ_ptr *dec, void **data, const uint32_t size, const uint32_t id); bool RaptorQ_add_symbol (struct RaptorQ_ptr *dec, void **data, const uint32_t size, const uint32_t esi, const uint8_t sbn); /////////////////////// // General: free memory /////////////////////// void RaptorQ_free (struct RaptorQ_ptr **ptr); void RaptorQ_free_block (struct RaptorQ_ptr *ptr, const uint8_t sbn); #ifdef __cplusplus } // extern "C" #endif #endif