⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

MdnsResponder

Struct MdnsResponder 

Source
pub struct MdnsResponder { /* private fields */ }
Expand description

Core mDNS responder managing registered services and cached records

Implementations§

Source§

impl MdnsResponder

Source

pub fn new(hostname: &str, ticks_per_sec: u64) -> Self

Create a new mDNS responder

Source

pub fn set_ipv4(&mut self, addr: [u8; 4])

Set the host IPv4 address

Source

pub fn set_ipv6(&mut self, addr: [u8; 16])

Set the host IPv6 address

Source

pub fn fqdn(&self) -> String

Get our fully-qualified hostname (hostname.local)

Source

pub fn register_service( &mut self, svc: ServiceInstance, ) -> Result<(), MdnsError>

Register a new service instance

Source

pub fn deregister_service(&mut self, instance_name: &str) -> Vec<MdnsRecord>

Deregister a service by instance name, returning goodbye records

Source

pub fn browse_services(&self, service_type: &str) -> Vec<&ServiceInstance>

Browse for services of a given type in our cache

Source

pub fn lookup_service(&self, full_name: &str) -> Option<&ServiceInstance>

Look up a service instance by full name

Source

pub fn start_probe(&mut self, name: &str, current_tick: u64)

Start probing for a name at the given tick

Source

pub fn tick_probes(&mut self, current_tick: u64) -> Vec<(String, ProbeState)>

Advance probe/announce state machine; returns names that need packets sent

Source

pub fn mark_conflict(&mut self, name: &str)

Mark a name as conflicted

Source

pub fn has_answer(&self, question: &MdnsQuestion) -> bool

Check if a question matches any of our registered records

Source

pub fn answer(&self, question: &MdnsQuestion) -> Vec<MdnsRecord>

Generate answer records for a given question

Source

pub fn suppress_known_answers( &self, answers: &mut Vec<MdnsRecord>, known_answers: &[MdnsRecord], )

Filter out answers that the querier already knows (known-answer suppression) Per RFC 6762 section 7.1: if the querier includes a known answer with TTL >= 50% of our TTL, we suppress that answer.

Source

pub fn detect_conflict(&self, record: &MdnsRecord) -> bool

Check if an incoming record conflicts with any of our registrations

Source

pub fn cache_insert( &mut self, record: MdnsRecord, current_tick: u64, ) -> Result<(), MdnsError>

Insert a record into the cache

Source

pub fn cache_remove(&mut self, name: &str, rtype: MdnsRecordType)

Remove records from cache by name and type

Source

pub fn cache_lookup( &self, name: &str, rtype: MdnsRecordType, current_tick: u64, ) -> Vec<&CacheEntry>

Look up cached records by name and type

Source

pub fn cache_evict_expired(&mut self, current_tick: u64)

Evict expired entries from the cache

Source

pub fn cache_size(&self) -> usize

Get the number of cached entries

Auto Trait Implementations§

§

impl Freeze for MdnsResponder

§

impl RefUnwindSafe for MdnsResponder

§

impl Send for MdnsResponder

§

impl Sync for MdnsResponder

§

impl Unpin for MdnsResponder

§

impl UnwindSafe for MdnsResponder

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.