1 /** \file null_fec.h \brief Compact No-Code FEC
2  *
3  *  $Author: peltotal $ $Date: 2007/02/26 13:48:19 $ $Revision: 1.19 $
4  *
5  *  MAD-ALCLIB: Implementation of ALC/LCT protocols, Compact No-Code FEC,
6  *  Simple XOR FEC, Reed-Solomon FEC, and RLC Congestion Control protocol.
7  *  Copyright (c) 2003-2007 TUT - Tampere University of Technology
8  *  main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23  *
24  *  In addition, as a special exception, TUT - Tampere University of Technology
25  *  gives permission to link the code of this program with the OpenSSL library (or
26  *  with modified versions of OpenSSL that use the same license as OpenSSL), and
27  *  distribute linked combinations including the two. You must obey the GNU
28  *  General Public License in all respects for all of the code used other than
29  *  OpenSSL. If you modify this file, you may extend this exception to your version
30  *  of the file, but you are not obligated to do so. If you do not wish to do so,
31  *  delete this exception statement from your version.
32  */
33 
34 #ifndef _NULL_FEC_H_
35 #define _NULL_FEC_H_
36 
37 #include "defines.h"
38 #include "transport.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * This function encodes source block data to transport block using Null-FEC.
46  *
47  * @param data pointer to data string to be segmented
48  * @param len length of data string
49  * @param sbn source block number
50  * @param es_len encoding symbol length
51  *
52  * @return pointer to transport block, NULL in error cases
53  *
54  */
55 
56 trans_block_t* null_fec_encode_src_block(char *data, unsigned long long len,
57 										 unsigned int sbn, unsigned short es_len);
58 
59 /**
60  * This function decodes source block data to buffer using Null-FEC.
61  *
62  * @param tr_block pointer to the source block
63  * @param block_len stores the length of block
64  * @param es_len encoding symbol length for this block
65  *
66  * @return pointer to buffer which contains block's data, NULL when memory
67  * could not be allocated
68  *
69  */
70 
71 char *null_fec_decode_src_block(trans_block_t *tr_block, unsigned long long *block_len,
72 								unsigned short es_len);
73 
74 /**
75  * This function decodes object to buffer using Null-FEC.
76  *
77  * @param to pointer to the object
78  * @param data_len stores the length of object
79  * @param s pointer to session
80  *
81  * @return pointer to buffer which contains object's data, NULL: when memory
82  * could not be allocated
83  *
84  */
85 
86 char *null_fec_decode_object(trans_obj_t *to, unsigned long long *data_len, alc_session_t *s);
87 
88 #ifdef __cplusplus
89 }; //extern "C"
90 #endif
91 
92 #endif
93