diff --git a/services/net/src/api.rs b/services/net/src/api.rs index f0a94b13e..461f678bd 100644 --- a/services/net/src/api.rs +++ b/services/net/src/api.rs @@ -1,7 +1,3 @@ -pub(crate) mod udp; -// needed to keep hosted mode quiet, since the Udp implementation is a bodge -#[allow(unused_imports)] -pub(crate) use udp::*; pub(crate) mod ping; pub(crate) use ping::*; pub(crate) mod tcp; diff --git a/services/net/src/api/udp.rs b/services/net/src/api/udp.rs deleted file mode 100644 index 88ab30b10..000000000 --- a/services/net/src/api/udp.rs +++ /dev/null @@ -1,53 +0,0 @@ -use rkyv::{Archive, Deserialize, Serialize}; -use crate::api::*; - -//////// Intra-crate UDP structures -pub(crate) const UDP_RESPONSE_MAX_LEN: usize = 1800; -/// The data field for a UDP response is limited to less than the theoretical -/// size of 64k. While UDP allows for a 64k packet, it seems no protoctols -/// in practice utilize such a length (about 512 bytes is the biggest), due -/// to MTU limitations downstream. Within Xous, memory is shared on a page-basis, -/// which is 4096 bytes, so the cost to share a page is almost the same regardless -/// of its size, as long as it is smaller than 4096 bytes. Hence, the number -/// 1800 bytes is picked to be a bit larger than our wifi MTU, but small -/// enough to fit in a page of RAM. Why not make it even bigger? Mainly to save -/// on the cost to repeatedly zeroize parts of RAM that are never used. -#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)] -pub(crate) struct NetUdpResponse { - pub endpoint_ip_addr: NetIpAddr, - pub len: u16, - pub endpoint_port: u16, - pub data: [u8; UDP_RESPONSE_MAX_LEN], -} - -#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)] -pub(crate) struct NetUdpTransmit { - pub dest_socket: Option, - /// local_port is the identifier for the socket handle, it must be specified - pub local_port: u16, - pub len: u16, - pub data: [u8; UDP_RESPONSE_MAX_LEN], -} - -/* not used as the connect state is kept on the caller's side -#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)] -pub(crate) struct NetUdpConnect { - pub dest_socket: NetSocketAddr, - /// local_port is the identifier for the socket handle, it must be specified - pub local_port: u16, -}*/ - -#[derive(Debug, Archive, Serialize, Deserialize, Copy, Clone)] -pub(crate) struct NetUdpBind { - pub(crate) cb_sid: [u32; 4], - pub(crate) ip_addr: NetIpAddr, - pub(crate) port: u16, - pub(crate) max_payload: Option, // defaults to MTU if not specified -} - -#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)] -pub(crate) enum NetUdpCallback { - RxData, - Drop, -} -