1 use async_trait::async_trait;
2 use num_enum::TryFromPrimitive;
3 use std::{borrow::Cow, fmt::Debug, io};
5 pub const PROTO_ID: u32 = 0x4f457403;
6 pub const UDP_PKT_SIZE: usize = 512;
7 pub const NUM_CHANS: usize = 3;
8 pub const REL_BUFFER: usize = 0x8000;
9 pub const INIT_SEQNUM: u16 = 65500;
10 pub const TIMEOUT: u64 = 30;
11 pub const PING_TIMEOUT: u64 = 5;
14 pub trait UdpSender: Send + Sync {
15 async fn send(&self, data: &[u8]) -> io::Result<()>;
19 pub trait UdpReceiver: Send {
20 async fn recv(&mut self) -> io::Result<Vec<u8>>;
23 #[derive(Debug, Copy, Clone, PartialEq)]
31 #[derive(Debug, Copy, Clone, PartialEq, TryFromPrimitive)]
40 #[derive(Debug, Copy, Clone, PartialEq, TryFromPrimitive)]
53 pub data: Cow<'a, [u8]>,