fec.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * fec.c -- forward error correction based on Vandermonde matrices
  3. * 980614
  4. * (C) 1997-98 Luigi Rizzo ([email protected])
  5. *
  6. * Portions derived from code by Phil Karn ([email protected]),
  7. * Robert Morelos-Zaragoza ([email protected]) and Hari
  8. * Thirumoorthy ([email protected]), Aug 1995
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
  21. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  23. * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS
  24. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  25. * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  26. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  27. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  29. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  30. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  31. * OF SUCH DAMAGE.
  32. */
  33. /*
  34. * The following parameter defines how many bits are used for
  35. * field elements. The code supports any value from 2 to 16
  36. * but fastest operation is achieved with 8 bit elements
  37. * This is the only parameter you may want to change.
  38. */
  39. #ifndef GF_BITS
  40. #define GF_BITS 8 /* code over GF(2**GF_BITS) - change to suit */
  41. #endif
  42. #define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */
  43. void fec_free(void *p) ;
  44. void * fec_new(int k, int n) ;//n>=k
  45. void init_fec() ; //if you never called this,it will be automatically called in fec_new()
  46. void fec_encode(void *code, void *src[], void *dst, int index, int sz) ;
  47. int fec_decode(void *code, void *pkt[], int index[], int sz) ;
  48. int get_k(void *code);
  49. int get_n(void *code);
  50. /* end of file */