commit de25493840571f57e687f52debf2e8f596e70206
parent 1f10f50402eaae36c81db3eef4cadff73e96a36f
Author: Daniel Barlow <dan@telent.net>
Date: Fri, 26 Dec 2025 00:13:27 +0000
add RData::Ptr
Diffstat:
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/ecu-esp32/src/wifi.rs b/ecu-esp32/src/wifi.rs
@@ -68,7 +68,8 @@ const CACHE_FLUSH : u16 = 1<<15;
enum RData {
Raw(Vec<u8>),
- Srv { target: String, port: u16, priority: u16, weight: u16 }
+ Srv { target: String, port: u16, priority: u16, weight: u16 },
+ Ptr(String)
}
impl RData {
@@ -93,6 +94,19 @@ impl RData {
out[6+i] = *l;
}
&out[..(6 + label.len())]
+ },
+ RData::Ptr(name) => {
+ let mut offset = 0;
+ for l in name.split('.') {
+ out[offset] = (l.len() & 0xff) as u8;
+ offset += 1;
+ for c in l.as_bytes().iter() {
+ out[offset] = *c;
+ offset += 1;
+ }
+ }
+ out[offset] = 0;
+ &out[..offset+1]
}
}
}
@@ -156,12 +170,12 @@ impl DnsResource {
Self::new(
"_keihin._udp.local",
ResourceType::Ptr,
- RData::Raw(alloc_ptr_data(&["Bike", "_keihin", "_udp", "local"]))
+ RData::Ptr("Bike._keihin._udp.local".into())
),
Self::new(
"_services._dns-sd._udp.local",
ResourceType::Ptr,
- RData::Raw(alloc_ptr_data(&["_keihin", "_udp", "local"]))
+ RData::Ptr("_keihin._udp.local".into())
)
];
Vec::from(static_records)