Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi/src/p2/udp.rs
1692 views
1
use crate::sockets::{SocketAddrCheck, SocketAddressFamily};
2
use std::net::SocketAddr;
3
use std::sync::Arc;
4
5
pub 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
12
pub 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
27
pub(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
}
37
38