48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
|
|
#include "timer.h"
|
|
|
|
#define EVENT_TYPE__INVALID 0x00000000
|
|
#define EVENT_TYPE__TIME_START 0x12858517
|
|
#define EVENT_TYPE__TIME_STOP 0xdf75d3f8
|
|
#define EVENT_TYPE__RTT_DELAY 0xc7065931
|
|
#define EVENT_TYPE__PING 0x0ba0d4c2
|
|
#define EVENT_TYPE__ACK 0xfde7959f
|
|
|
|
static_assert((sizeof (struct timespec)) == 8 + 8);
|
|
|
|
struct event {
|
|
uint32_t type;
|
|
uint32_t sequence;
|
|
};
|
|
|
|
struct packet_stopwatch {
|
|
struct event event;
|
|
struct stopwatch_time stopwatch_time;
|
|
};
|
|
|
|
static_assert((sizeof (struct packet_stopwatch)) ==
|
|
(sizeof (struct event)) + (sizeof (struct stopwatch_time)));
|
|
|
|
struct packet_start {
|
|
struct event event;
|
|
};
|
|
|
|
static_assert((sizeof (struct packet_start)) == (sizeof (struct event)));
|
|
|
|
struct packet_ack {
|
|
struct event event;
|
|
};
|
|
|
|
static_assert((sizeof (struct packet_ack)) == (sizeof (struct event)));
|
|
|
|
struct packet_rtt_delay {
|
|
struct event event;
|
|
struct timespec offset;
|
|
};
|
|
|
|
static_assert((sizeof (struct packet_rtt_delay)) == (sizeof (struct event)) + (sizeof (struct timespec)));
|