wasmtime_wasi/p2/
udp.rs

1use crate::sockets::{SocketAddrCheck, SocketAddressFamily};
2use std::net::SocketAddr;
3use std::sync::Arc;
4
5pub struct IncomingDatagramStream {
6    pub(crate) inner: Arc<tokio::net::UdpSocket>,
7
8    /// If this has a value, the stream is "connected".
9    pub(crate) remote_address: Option<SocketAddr>,
10}
11
12pub struct OutgoingDatagramStream {
13    pub(crate) inner: Arc<tokio::net::UdpSocket>,
14
15    /// If this has a value, the stream is "connected".
16    pub(crate) remote_address: Option<SocketAddr>,
17
18    /// Socket address family.
19    pub(crate) family: SocketAddressFamily,
20
21    pub(crate) send_state: SendState,
22
23    /// The check of allowed addresses
24    pub(crate) socket_addr_check: Option<SocketAddrCheck>,
25}
26
27pub(crate) enum SendState {
28    /// Waiting for the API consumer to call `check-send`.
29    Idle,
30
31    /// Ready to send up to x datagrams.
32    Permitted(usize),
33
34    /// Waiting for the OS.
35    Waiting,
36}