udplite

Crates.ioudplite
lib.rsudplite
version0.1.0
sourcesrc
created_at2021-02-12 22:44:23.35054
updated_at2021-02-12 22:44:23.35054
descriptionAn idiomatic UDP-Lite wrapper, with optional mio integration
homepage
repositoryhttps://github.com/tormol/udplite
max_upload_size
id354397
size53,097
Torbjørn Birch Moltu (tormol)

documentation

README

udplite

A Rust library for using UDP-Lite sockets. (RFC 3828)

crates.io License Documentation

extern crate udplite;

let socket = udplite::UdpLiteSocket::bind("[::]:0").expect("Create UDP-Lite socket");
socket.set_send_checksum_coverage(Some(0)).expect("disable checksum coverage for payload");
socket.connect("localhost:7").expect("set destination");
socket.send(b"Hello UDP-Lite").expect("send datagram");

This crate is a work in progress.

Supported operating systems

UDP-Lite is only implemented by Linux and FreeBSD. Whether Android supports it I'm not sure about: The kernel has the constants, but some of them are missing from bionic (the Android libc). (only IPPROTO_UDPLITE is present)

The FreeBSD implementation also behaves strangely: sent packets that are not entirely covered completely by the checksum (UDPLITE_SEND_CSCOV) seems to be discarded by the OS. (meanwhile such packets sent from Linux are received)

mio integration

Like UDP sockets, UDP-Lite sockets can be registered with epoll / kqueue, and therefore used with mio. This feature is not enabled by default; enable it in Cargo.toml with:

[dependencies]
udplite = {version="0.1.0", features=["mio_07"]}

Also remember to enable nonblocking mode for the sockets. (UdpLiteSocket.set_nonblocking(true))

Minimum supported Rust version

The minimum supported Rust version is 1.36. Older versions might currently work, but I plan to use std::io::IoSlice.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 19

cargo fmt