1 /** \file alc_hdr.h \brief ALC header
2  *
3  *  $Author: peltotal $ $Date: 2007/02/26 13:48:19 $ $Revision: 1.20 $
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 _ALC_HDR_H_
35 #define _ALC_HDR_H_
36 
37 #include "defines.h"
38 #include "lct_hdr.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * This function adds FEC Payload ID header for FEC Encoding IDs 2 and 128 to the FLUTE header.
46  *
47  * @param def_lct_hdr pointer to the default LCT header structure
48  * @param hdrlen current length of the FLUTE header
49  * @param sbn source block number
50  * @param es_id encoding symbol identifier
51  *
52  * @return number of bytes added to the FLUTE's header
53  *
54  */
55 
56 /*
57  *  0                   1                   2                   3
58  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
59  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60  * |                   Source Block Number                         |
61  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62  * |                   Encoding Symbol ID                          |
63  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
64  *
65  */
66 
67 int add_alc_fpi_2_128(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn, unsigned int es_id);
68 
69 /**
70  * This function adds FEC Payload ID header for FEC Encoding ID 129 to the FLUTE header.
71  *
72  * @param def_lct_hdr pointer to the default LCT header structure
73  * @param hdrlen current length of the FLUTE header
74  * @param sbn source block number
75  * @param sbl source block length
76  * @param es_id encoding symbol identifier
77  *
78  * @return number of bytes added to the FLUTE's header
79  *
80  */
81 
82 /*
83  *  0                   1                   2                   3
84  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
85  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
86  * |                   Source Block Number                         |
87  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
88  * |     Source Block Length       |      Encoding Symbol ID       |
89  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
90  *
91  */
92 
93 int add_alc_fpi_129(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn,
94 					unsigned short sbl, unsigned short es_id);
95 
96 /**
97  * This function adds FEC Payload ID header for FEC Encoding IDs 0 and 130 to the FLUTE header.
98  *
99  * @param def_lct_hdr pointer to the default LCT header structure
100  * @param hdrlen current length of the FLUTE header
101  * @param sbn source block number
102  * @param es_id encoding symbol identifier
103  *
104  * @return number of bytes added to the FLUTE's header
105  *
106  */
107 
108 /*
109  *  0                   1                   2                   3
110  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
111  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
112  * |     Source Block Number       |    Encoding Symbol ID         |
113  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
114  *
115  */
116 
117 int add_alc_fpi_0_130(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned short sbn, unsigned short es_id);
118 
119 /**
120  * This function adds FEC Payload ID header for FEC Encoding ID 3 to the FLUTE header.
121  *
122  * @param def_lct_hdr pointer to the default LCT header structure
123  * @param hdrlen current length of the FLUTE header
124  * @param sbn source block number
125  * @param es_id encoding symbol identifier
126  * @param m finite field parameter (default for m is 8)
127  *
128  * @return number of bytes added to the FLUTE's header
129  *
130  */
131 
132 /*
133  *  0                   1                   2                   3
134  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
135  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
136  * |Source Block Number (32-m bits)| Encoding Symbol ID (m bits)   |
137  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
138  *
139  */
140 
141 int add_alc_fpi_3(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn, unsigned int es_id,
142 		  unsigned char m);
143 
144 #ifdef __cplusplus
145 }; //extern "C"
146 #endif
147 
148 #endif
149 
150