#include <algorithm>
using namespace std;
+
+RSEncoder::RSEncoder(Sender *sender)
+ : sender(sender)
+{
+ rs = init_rs_char(RS_SYM_SIZE, RS_GF_POLY, 1, 1, RS_PARITY_SIZE, RS_PAD);
+}
void RSEncoder::send_packet(uint16_t proto, const std::string &data, int incoming_seq)
{
for (int j = 0; j < packet_history.size(); ++j) {
data[j] = packet_history[j].data[i];
}
- encode_rs_8(reinterpret_cast<unsigned char *>(&data[0]),
- reinterpret_cast<unsigned char *>(&parity[0]),
- RS_PAD);
+ encode_rs_char(rs,
+ reinterpret_cast<unsigned char *>(&data[0]),
+ reinterpret_cast<unsigned char *>(&parity[0]));
for (int j = 0; j < RS_PARITY_SIZE; ++j) {
rs_packets[j][i] = parity[j];
}