1 /*
2 * Copyright (c) 2007 - 2015 Joseph Gaeddert
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23 //
24 // FEC, none/pass
25 //
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include "liquid.internal.h"
31
fec_pass_create(void * _opts)32 fec fec_pass_create(void * _opts)
33 {
34 fec q = (fec) malloc(sizeof(struct fec_s));
35
36 q->scheme = LIQUID_FEC_NONE;
37 q->rate = fec_get_rate(q->scheme);
38
39 q->encode_func = &fec_pass_encode;
40 q->decode_func = &fec_pass_decode;
41 q->decode_soft_func = NULL;
42
43 return q;
44 }
45
fec_pass_destroy(fec _q)46 void fec_pass_destroy(fec _q)
47 {
48 free(_q);
49 }
50
fec_pass_print(fec _q)51 void fec_pass_print(fec _q)
52 {
53 printf("fec_pass [r: %3.2f]\n", _q->rate);
54 }
55
fec_pass_encode(fec _q,unsigned int _dec_msg_len,unsigned char * _msg_dec,unsigned char * _msg_enc)56 void fec_pass_encode(fec _q, unsigned int _dec_msg_len, unsigned char *_msg_dec, unsigned char *_msg_enc)
57 {
58 memmove(_msg_enc, _msg_dec, _dec_msg_len);
59 }
60
fec_pass_decode(fec _q,unsigned int _dec_msg_len,unsigned char * _msg_enc,unsigned char * _msg_dec)61 void fec_pass_decode(fec _q, unsigned int _dec_msg_len, unsigned char *_msg_enc, unsigned char *_msg_dec)
62 {
63 memmove(_msg_dec, _msg_enc, _dec_msg_len);
64 }
65
66