libfec.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef LIBFEC_H
  2. #define LIBFEC_H
  3. struct fec_parms;
  4. /* k - number of actual data packets
  5. * n - total number of packets including data and redundant packets
  6. * (actual packet size isn't relevant here) */
  7. struct fec_parms *fec_new(int k, int n);
  8. void fec_free(struct fec_parms *p);
  9. /* src - array of (n) pointers to data packets
  10. * fec - buffer for packet to be generated
  11. * index - index of packet to be generated (0 <= index < n)
  12. * sz - data packet size
  13. *
  14. * _linear version just takes a pointer to the raw data; no
  15. * mucking about with packet pointers.
  16. */
  17. void fec_encode(struct fec_parms *code, unsigned char *src[],
  18. unsigned char *fec, int index, int sz);
  19. void fec_encode_linear(struct fec_parms *code, unsigned char *src,
  20. unsigned char *fec, int index, int sz);
  21. /* data - array of (k) pointers to data packets, in arbitrary order (see i)
  22. * i - indices of (data) packets
  23. * sz - data packet size
  24. *
  25. * Will never fail as long as you give it (k) individual data packets.
  26. * Will re-order the (data) pointers but not the indices -- data packets
  27. * are ordered on return.
  28. */
  29. int fec_decode(struct fec_parms *code, unsigned char *data[],
  30. int i[], int sz);
  31. #endif /* LIBFEC_H */