#include #include #include typedef _Float64 float64_t; enum packet_type { PACKET_TYPE__TIME_START = 0x2112858517, PACKET_TYPE__TIME_STOP = 0xdf75d3f8, PACKET_TYPE__RTT_DELAY = 0xc7065931, PACKET_TYPE__ACK = 0xfde7959f, }; struct time_stop_data { uint32_t integer_value; uint32_t fraction_value; uint16_t integer_digits; uint16_t fraction_digits; } __attribute__((__packed__)); static_assert((sizeof (struct time_stop_data)) == 4 * 3); struct rtt_delay_data { float64_t offset; } __attribute__((__packed__)); struct ack_data { uint64_t seq; } __attribute__((__packed__)); static_assert((sizeof (struct rtt_delay_data)) == 8); struct timing_packet { uint32_t type; union { struct time_stop_data time_stop; struct rtt_delay_data rtt_delay; struct ack_data ack; }; } __attribute__((__packed__)); static_assert((sizeof (struct timing_packet)) == 4 * 4);