commit 35c7d34b8dfd997093a7158d5a82abac8166f41c
parent 182ea81d2c19c17cb24849045fe1a6e13ae8ae96
Author: Daniel Barlow <dan@telent.net>
Date: Sun, 21 Dec 2025 15:20:40 +0000
note
Diffstat:
| M | notes.md | | | 134 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- |
1 file changed, 132 insertions(+), 2 deletions(-)
diff --git a/notes.md b/notes.md
@@ -127,8 +127,7 @@ table 0 is "ecmid"
## exporting
-we're going to use wifi instead of ble, it's a lot faster and
-it makes remote dev simpler
+we're going to stream data using udp over wifi
https://docs.espressif.com/projects/rust/no_std-training/03_6_http_client.html
@@ -139,6 +138,137 @@ is available
https://lib.rs/crates/esp-hal-mdns
+
+probably we should do the dns-sd thing instead of just publishing an A record.
+
+This means that
+
+```
+1) in response to
+ _services._dns-sd._udp.local: type PTR, class IN, "QM" question
+we send
+ _services._dns-sd._udp.local: type PTR, class IN, _keihin._udp.local
+
+2) in response to
+ _keihin._udp.local: type PTR, class IN, "QM" question
+we send the response
+ _keihin._udp.local: type PTR, class IN, Honda Motorbike._keihin._udp.local
+with additional records
+Honda Motorbike._keihin._udp.local SRV priority 0, weight 0, port 5000, target honda.local
+Honda Motorbike._keihin._udp.local TXT (empty)
+honda.local type A class IN 192.168.8.5
+
+```
+
+we need a collection of records any of which which we can send in
+response to a query for that record, and some logic for which
+addl records are to be sent with it.
+
+this might be easier if we named each record (variable name, I mean)
+
+let my_instance_ptr = (
+ query(" _keihin._udp.local", PTR), // query
+ my_instance_ptr_rr, // response
+ [my_instance_srv_rr, my_instance_txt, my_instance_a]
+)
+
+
+
+
+3) in response to a direct query for any of the SRV/TXT/A we send that record
+as th Answer and the other two records as Additional
+
+4) at startup it should do Probe and Announce for "all those resource
+records that a Multicast DNS responder desires to be unique on the local link"
+so that would be `Honda Motorbike._keihin._udp.local` TXT and SRV,
+but not honda.local A because the fact we got it using dhcp means
+we already know it's unique
+
+"Probe" means send packets as QU (unicast response) containing ANY requests for each name: 3 packets with 250ms between them
+
+"Announce" means send 2 <= n <= 8 packets one second apart, containing
+all the records we
+
+
+I think the easiest approach is to start with two arrays of RRs for
+"answers" and "additional", then iterate through every known RR and
+say "should we send this in response to any question in the current
+query packet". Then we can (hopefully) use array slices to copy
+only the needed records into the Message
+
+---
+
+most of the RRs are static data that we could initialise at compile
+time, the exception is our A record which we don't know until after
+DHCP has succeeded. we could have a static array of almost all the RRs,
+but that one needs to be stack-allocated.
+
+maybe use a stack-allocated array of RR references, which mostly
+points to the static data except for that one record.
+
+
+
+
+
+
+
+
+
+
+```
+
+then the responders respond
+
+ > _airplay._tcp.local: type PTR, class IN, Sky Q 2TB Box7448._airplay._tcp.local
+
+with additional records
+
+
+a client sends query
+ > _services._dns-sd._udp.local: type PTR, class IN, "QM" question
+
+responders send responses e.g.
+
+ > _services._dns-sd._udp.local: type PTR, class IN, _hue._tcp.local
+ > _services._dns-sd._udp.local: type PTR, class IN, _http._tcp.local
+ > _services._dns-sd._udp.local: type PTR, class IN, _airplay._tcp.local
+
+then the querier sends followups, e.g.
+
+ > _airplay._tcp.local: type PTR, class IN, "QM" question
+
+then the responders respond
+
+ > _airplay._tcp.local: type PTR, class IN, Sky Q 2TB Box7448._airplay._tcp.local
+
+with additional records
+
+Sky Q 2TB Box7448._airplay._tcp.local: type TXT, class IN, cache flush
+Sky Q 2TB Box7448._airplay._tcp.local: type SRV, class IN, cache flush, priority 0, weight 0, port 5000, target skyq.local
+skyq.local: type A, class IN, cache flush, addr 192.168.8.24
+Sky Q 2TB Box7448._airplay._tcp.local: type NSEC, class IN, cache flush, next domain name Sky Q 2TB Box7448._airplay._tcp.local
+skyq.local: type NSEC, class IN, cache flush, next domain name skyq.local
+
+
+
+
+
+
+
+_ecutables._udp.local PTR 123abcd._ecutables._udp.local.
+
+123abcd._ecutables._udp.local SRV
+ priority = 0, weight = 0, port = nnn, host = eculogical.local
+
+123abcd._ecutables._udp.local TXT (required but may be empty)
+
+
+
+
+
+
+
+
* start a udp server, and stream the tables to anyone who sends a message to it
* udp is connectionless. if we get a second message from a different address,