Crate udp
Available on crate features
std and udp only.Expand description
Protocol-neutral UDP module for Rama.
Applications use the reexported Tokio UdpSocket and the simple bind
helpers. Packet-oriented protocols use the runtime-neutral
DatagramSocket and DatagramSender traits, with UdpPacketSocket
as the Tokio-backed implementation. test_utils provides a deterministic
in-memory backend when its feature is enabled.
This crate reports socket implementation limits and ancillary capabilities. It does not infer a path MTU or provide congestion control, retransmission, or other upper-transport behavior.
§Rama
Crate used by the end-user rama crate and rama crate authors alike.
Learn more about rama:
- Github: https://github.com/plabayo/rama
- Book: https://ramaproxy.org/book/
Modules§
- test_
utils test-utils - Utilities for testing datagram protocols without operating-system sockets.
Structs§
- Connected
UdpFramed - A unified
StreamandSinkof frames over a connectedUdpSocket. - Datagram
Capabilities - UDP implementation and ancillary-I/O capabilities of a socket.
- Datagram
Metadata - Metadata associated with one receive buffer.
- Send
Datagram - Borrowed description of one outgoing datagram or segmented datagram group.
- UdpFramed
- A unified
StreamandSinkinterface to an underlyingUdpSocket, using theEncoderandDecodertraits to encode and decode frames. - UdpPacket
Sender - Send handle for a
UdpPacketSocket. - UdpPacket
Socket - Packet-oriented Tokio UDP socket with portable ancillary metadata.
- UdpSocket
net - A UDP socket.
- UdpSocket
Config - Configuration shared by UDP packet-socket factories.
- UdpSocket
Factory - Rama service/factory for configured
UdpPacketSocketinstances.
Enums§
- Datagram
Error - Error from a packet-oriented datagram operation.
- Datagram
Feature - Datagram feature that can be unavailable on a platform or socket provider.
- EcnCodepoint
- Explicit Congestion Notification codepoint from the low two IP traffic-class bits.
- Receive
Timestamp - Receive time together with the clock domain used by its producer.
- Send
Failure - Coarse classification of a failed send.
Constants§
- MAX_
UDP_ PAYLOAD_ IPV4 - Largest UDP payload representable by ordinary IPv4.
- MAX_
UDP_ PAYLOAD_ IPV6 - Largest UDP payload representable by ordinary IPv6 without jumbograms.
Traits§
- Datagram
Sender - Independently wakeable send side of a
DatagramSocket. - Datagram
Sender Ext - Async convenience methods for
DatagramSender. - Datagram
Socket - Receive side of an asynchronous packet-oriented datagram socket.
- Datagram
Socket Ext - Async convenience methods for
DatagramSocket.
Functions§
- bind_
udp_ socket_ with_ connect - Bind a
UdpSocketto the local interface and connect to the given IP host and port. - bind_
udp_ with_ address - Creates a new
UdpSocket, which will be bound to the specified address. - bind_
udp_ with_ device Android or Fuchsia or Linux - Creates a new
UdpSocket, which will be bound to the specified (interface) device name). - bind_
udp_ with_ socket target_family=unixor Windows - Creates a new
UdpSocket, which will be bound to the specified socket.