pub struct MdnsResponder { /* private fields */ }Expand description
Core mDNS responder managing registered services and cached records
Implementations§
Source§impl MdnsResponder
impl MdnsResponder
Sourcepub fn register_service(
&mut self,
svc: ServiceInstance,
) -> Result<(), MdnsError>
pub fn register_service( &mut self, svc: ServiceInstance, ) -> Result<(), MdnsError>
Register a new service instance
Sourcepub fn deregister_service(&mut self, instance_name: &str) -> Vec<MdnsRecord>
pub fn deregister_service(&mut self, instance_name: &str) -> Vec<MdnsRecord>
Deregister a service by instance name, returning goodbye records
Sourcepub fn browse_services(&self, service_type: &str) -> Vec<&ServiceInstance>
pub fn browse_services(&self, service_type: &str) -> Vec<&ServiceInstance>
Browse for services of a given type in our cache
Sourcepub fn lookup_service(&self, full_name: &str) -> Option<&ServiceInstance>
pub fn lookup_service(&self, full_name: &str) -> Option<&ServiceInstance>
Look up a service instance by full name
Sourcepub fn start_probe(&mut self, name: &str, current_tick: u64)
pub fn start_probe(&mut self, name: &str, current_tick: u64)
Start probing for a name at the given tick
Sourcepub fn tick_probes(&mut self, current_tick: u64) -> Vec<(String, ProbeState)>
pub fn tick_probes(&mut self, current_tick: u64) -> Vec<(String, ProbeState)>
Advance probe/announce state machine; returns names that need packets sent
Sourcepub fn mark_conflict(&mut self, name: &str)
pub fn mark_conflict(&mut self, name: &str)
Mark a name as conflicted
Sourcepub fn has_answer(&self, question: &MdnsQuestion) -> bool
pub fn has_answer(&self, question: &MdnsQuestion) -> bool
Check if a question matches any of our registered records
Sourcepub fn answer(&self, question: &MdnsQuestion) -> Vec<MdnsRecord>
pub fn answer(&self, question: &MdnsQuestion) -> Vec<MdnsRecord>
Generate answer records for a given question
Sourcepub fn suppress_known_answers(
&self,
answers: &mut Vec<MdnsRecord>,
known_answers: &[MdnsRecord],
)
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.
Sourcepub fn detect_conflict(&self, record: &MdnsRecord) -> bool
pub fn detect_conflict(&self, record: &MdnsRecord) -> bool
Check if an incoming record conflicts with any of our registrations
Sourcepub fn cache_insert(
&mut self,
record: MdnsRecord,
current_tick: u64,
) -> Result<(), MdnsError>
pub fn cache_insert( &mut self, record: MdnsRecord, current_tick: u64, ) -> Result<(), MdnsError>
Insert a record into the cache
Sourcepub fn cache_remove(&mut self, name: &str, rtype: MdnsRecordType)
pub fn cache_remove(&mut self, name: &str, rtype: MdnsRecordType)
Remove records from cache by name and type
Sourcepub fn cache_lookup(
&self,
name: &str,
rtype: MdnsRecordType,
current_tick: u64,
) -> Vec<&CacheEntry>
pub fn cache_lookup( &self, name: &str, rtype: MdnsRecordType, current_tick: u64, ) -> Vec<&CacheEntry>
Look up cached records by name and type
Sourcepub fn cache_evict_expired(&mut self, current_tick: u64)
pub fn cache_evict_expired(&mut self, current_tick: u64)
Evict expired entries from the cache
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get the number of cached entries