]> www.infradead.org Git - mtd-utils.git/commitdiff
Move libfec declarations to public header in global include directory
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 22 Jun 2017 11:39:31 +0000 (13:39 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 28 Jun 2017 08:27:24 +0000 (10:27 +0200)
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
include/libfec.h [new file with mode: 0644]
lib/libfec.c
misc-utils/fectest.c
misc-utils/mcast_image.h
misc-utils/recv_image.c
misc-utils/serve_image.c

diff --git a/include/libfec.h b/include/libfec.h
new file mode 100644 (file)
index 0000000..356ac28
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef LIBFEC_H
+#define LIBFEC_H
+
+struct fec_parms;
+
+/* k - number of actual data packets
+ * n - total number of packets including data and redundant packets
+ *   (actual packet size isn't relevant here) */
+struct fec_parms *fec_new(int k, int n);
+void fec_free(struct fec_parms *p);
+
+/* src   - array of (n) pointers to data packets
+ * fec   - buffer for packet to be generated
+ * index - index of packet to be generated (0 <= index < n)
+ * sz    - data packet size
+ *
+ * _linear version just takes a pointer to the raw data; no
+ * mucking about with packet pointers.
+ */
+void fec_encode(struct fec_parms *code, unsigned char *src[],
+               unsigned char *fec, int index, int sz);
+void fec_encode_linear(struct fec_parms *code, unsigned char *src,
+                      unsigned char *fec, int index, int sz);
+
+/* data  - array of (k) pointers to data packets, in arbitrary order (see i)
+ * i     - indices of (data) packets
+ * sz    - data packet size
+ *
+ * Will never fail as long as you give it (k) individual data packets.
+ * Will re-order the (data) pointers but not the indices -- data packets
+ * are ordered on return.
+ */
+int fec_decode(struct fec_parms *code, unsigned char *data[],
+              int i[], int sz);
+
+#endif /* LIBFEC_H */
+
index bf683811494bd405477631bcc832c22701aaee46..0d8056a15014734cef67833aded2689f6b50e650 100644 (file)
@@ -45,6 +45,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "libfec.h"
 
 /*
  * stuff used for testing purposes only
index fd577f33069e76ec52dd4b403c3ee0239c777f0f..fcba513e1d24268786d9f5c1151b4d495d2df1c9 100644 (file)
@@ -8,6 +8,7 @@
 #include <sys/stat.h>
 
 #include "mcast_image.h"
+#include "libfec.h"
 #include <crc32.h>
 
 #define ERASE_SIZE 131072
index 8e94ffa4204cb370b995c984f29f7961ceb6c7cc..5264659b8cf5c25bb8e3d5cbf7baec3c7d23c86c 100644 (file)
@@ -20,35 +20,3 @@ struct image_pkt {
        struct image_pkt_hdr hdr;
        unsigned char data[PKT_SIZE];
 };
-
-struct fec_parms;
-
-/* k - number of actual data packets
- * n - total number of packets including data and redundant packets
- *   (actual packet size isn't relevant here) */
-struct fec_parms *fec_new(int k, int n);
-void fec_free(struct fec_parms *p);
-
-/* src   - array of (n) pointers to data packets
- * fec   - buffer for packet to be generated
- * index - index of packet to be generated (0 <= index < n)
- * sz    - data packet size
- *
- * _linear version just takes a pointer to the raw data; no
- * mucking about with packet pointers.
- */
-void fec_encode(struct fec_parms *code, unsigned char *src[],
-               unsigned char *fec, int index, int sz);
-void fec_encode_linear(struct fec_parms *code, unsigned char *src,
-                      unsigned char *fec, int index, int sz);
-
-/* data  - array of (k) pointers to data packets, in arbitrary order (see i)
- * i     - indices of (data) packets
- * sz    - data packet size
- *
- * Will never fail as long as you give it (k) individual data packets.
- * Will re-order the (data) pointers but not the indices -- data packets
- * are ordered on return.
- */
-int fec_decode(struct fec_parms *code, unsigned char *data[],
-              int i[], int sz);
index 8bd73560d8795e5e4d26663531b846279e603525..7f6662b38d601497cee94e4767fcc835ba0ee1b2 100644 (file)
@@ -20,6 +20,7 @@
 #include <crc32.h>
 #include "mtd/mtd-user.h"
 #include "mcast_image.h"
+#include "libfec.h"
 
 #include "common.h"
 
index 26632e39a69826168437d31c4fc2069af3d7016b..f2475d6d1efa5d477928cab82c5e24fc4df00466 100644 (file)
@@ -21,6 +21,7 @@
 #include <common.h>
 
 #include "mcast_image.h"
+#include "libfec.h"
 
 int tx_rate = 80000;
 int pkt_delay;