/*
 * xlru_serial_over_udp.h
 *
 *  Created on: 13/giu/2019
 *      Author: chessaa
 */

#ifndef XLRU_SERIAL_OVER_UDP_H_
#define XLRU_SERIAL_OVER_UDP_H_

#include <stdint.h>

namespace xlru
{

struct xlru_udp_packet_t
{
	enum { k_marker=0x12345678};
	uint32_t marker;

	uint32_t master_slave;
	uint32_t override_enable;

	unsigned char payload[1000];
};

struct xlru_udp_data_t
{
	uint32_t source;
	uint32_t len;
	char data[1];
};

struct xlru_udp_unit_stat_t
{
	int link_ok;
	unsigned int garbage;
	unsigned int good;
	unsigned int discarded;
	unsigned int checksum_error;

	unsigned int spare[4];
};

struct xlru_udp_stat_t
{
	xlru_udp_unit_stat_t stat[3];
};

struct xlru_udp_master_t
{
	enum { k_marker=0x87654321};
	uint32_t marker;

	xlru_udp_stat_t stat;

	unsigned int payload_size;

	unsigned char payload[1000];
	unsigned int end;
};

struct xlru_udp_slave_t
{
	enum { k_marker=0x12345678};
	uint32_t marker;

	uint32_t override_enable_mask;

	unsigned int payload_size;

	unsigned char payload[1000];
};

}  //namespace



#endif /* XLRU_SERIAL_OVER_UDP_H_ */
