1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! `hick-embassy` — async mDNS / DNS-SD for the embassy runtime.
//!
//! Builds on `hick-smoltcp`'s runtime-agnostic engine: it supplies an
//! embassy-net [`UdpIo`](hick_smoltcp::UdpIo) transport, the `embassy-time`
//! clock bridge, and an async driver future you spawn as an embassy task.
//!
//! `no_std` + `alloc`.
//!
//! # Usage
//!
//! Share one [`MdnsState`] between the driver task and the application (via
//! `Rc` or a `&'static` `StaticCell`):
//!
//! ```ignore
//! use hick_embassy::MdnsState;
//! use mdns_proto::{EndpointConfig, Name, ServiceRecords, ServiceSpec};
//!
//! let state: &'static MdnsState<_> = make_static!(MdnsState::new(EndpointConfig::new(), rng));
//!
//! // Advertise a service.
//! let mut records = ServiceRecords::new(
//! Name::try_from_str("_http._tcp.local.").unwrap(),
//! Name::try_from_str("My Device._http._tcp.local.").unwrap(),
//! Name::try_from_str("mydevice.local.").unwrap(),
//! 80,
//! 120,
//! );
//! records.add_a(my_ipv4_addr);
//! state.register_service(ServiceSpec::new(records)).unwrap();
//!
//! // Bind v4/v6 sockets to :5353 and join the mDNS group(s), then spawn the driver
//! // (it enforces the §11 egress hop-limit 255 itself — pass the sockets by &mut):
//! spawner.must_spawn(mdns_task(state, v4_socket, v6_socket, scratch));
//!
//! #[embassy_executor::task]
//! async fn mdns_task(
//! state: &'static MdnsState<MyRng>,
//! v4: &'static mut UdpSocket<'static>,
//! v6: &'static mut UdpSocket<'static>,
//! scratch: &'static mut [u8],
//! ) -> ! {
//! state.run(Some(v4), Some(v6), scratch).await
//! }
//! ```
extern crate alloc;
pub use run;
pub use DualUdp;
pub use MdnsState;
pub use EmbassyInstant;