Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
MDNS
[Applications]
RFC 6762 - Multicast DNS
RFC 6763 - DNS-Based Service Discovery
.
More...
Modules | |
Options | |
Functions | |
err_t | mdns_resp_add_netif (struct netif *netif, const char *hostname, u32_t dns_ttl) |
Activate MDNS responder for a network interface. | |
err_t | mdns_resp_remove_netif (struct netif *netif) |
Stop responding to MDNS queries on this interface, leave multicast groups, and free the helper structure and any of its services. | |
err_t | mdns_resp_rename_netif (struct netif *netif, const char *hostname) |
Update MDNS hostname for a network interface. | |
s8_t | mdns_resp_add_service (struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, u32_t dns_ttl, service_get_txt_fn_t txt_fn, void *txt_data) |
Add a service to the selected network interface. | |
err_t | mdns_resp_del_service (struct netif *netif, s8_t slot) |
Delete a service on the selected network interface. | |
err_t | mdns_resp_rename_service (struct netif *netif, s8_t slot, const char *name) |
Update name for an MDNS service. | |
err_t | mdns_resp_add_service_txtitem (struct mdns_service *service, const char *txt, u8_t txt_len) |
Call this function from inside the service_get_txt_fn_t callback to add text data. | |
void | mdns_resp_announce (struct netif *netif) |
Send unsolicited answer containing all our known data. | |
void | mdns_resp_restart (struct netif *netif) |
Restart mdns responder. | |
void | mdns_resp_init (void) |
Initiate MDNS responder. |
Detailed Description
RFC 6762 - Multicast DNS
RFC 6763 - DNS-Based Service Discovery
.
Things left to implement: -------------------------
- Tiebreaking for simultaneous probing
- Sending goodbye messages (zero ttl) - shutdown, DHCP lease about to expire, DHCP turned off...
- Checking that source address of unicast requests are on the same network
- Limiting multicast responses to 1 per second per resource record
- Fragmenting replies if required
- Handling multi-packet known answers
- Individual known answer detection for all local IPv6 addresses
- Dynamic size of outgoing packet
Function Documentation
Activate MDNS responder for a network interface.
- Parameters:
-
netif The network interface to activate. hostname Name to use. Queries for <hostname>.local will be answered with the IP addresses of the netif. The hostname will be copied, the given pointer can be on the stack. dns_ttl Validity time in seconds to send out for IP address data in DNS replies
- Returns:
- ERR_OK if netif was added, an err_t otherwise
Definition at line 2060 of file lwip_mdns.c.
s8_t mdns_resp_add_service | ( | struct netif * | netif, |
const char * | name, | ||
const char * | service, | ||
enum mdns_sd_proto | proto, | ||
u16_t | port, | ||
u32_t | dns_ttl, | ||
service_get_txt_fn_t | txt_fn, | ||
void * | txt_data | ||
) |
Add a service to the selected network interface.
- Parameters:
-
netif The network interface to publish this service on name The name of the service service The service type, like "_http" proto The service protocol, DNSSD_PROTO_TCP for TCP ("_tcp") and DNSSD_PROTO_UDP for others ("_udp") port The port the service listens to dns_ttl Validity time in seconds to send out for service data in DNS replies txt_fn Callback to get TXT data. Will be called each time a TXT reply is created to allow dynamic replies. txt_data Userdata pointer for txt_fn
- Returns:
- service_id if the service was added to the netif, an err_t otherwise
Definition at line 2192 of file lwip_mdns.c.
err_t mdns_resp_add_service_txtitem | ( | struct mdns_service * | service, |
const char * | txt, | ||
u8_t | txt_len | ||
) |
Call this function from inside the service_get_txt_fn_t callback to add text data.
Buffer for TXT data is 256 bytes, and each field is prefixed with a length byte.
- Parameters:
-
service The service provided to the get_txt callback txt String to add to the TXT field. txt_len Length of string
- Returns:
- ERR_OK if the string was added to the reply, an err_t otherwise
Definition at line 2302 of file lwip_mdns.c.
void mdns_resp_announce | ( | struct netif * | netif ) |
Send unsolicited answer containing all our known data.
- Parameters:
-
netif The network interface to send on
Definition at line 2317 of file lwip_mdns.c.
Delete a service on the selected network interface.
- Parameters:
-
netif The network interface on which service should be removed slot The service slot number returned by mdns_resp_add_service
- Returns:
- ERR_OK if the service was removed from the netif, an err_t otherwise
Definition at line 2242 of file lwip_mdns.c.
void mdns_resp_init | ( | void | ) |
Initiate MDNS responder.
Will open UDP sockets on port 5353
Definition at line 2381 of file lwip_mdns.c.
Stop responding to MDNS queries on this interface, leave multicast groups, and free the helper structure and any of its services.
- Parameters:
-
netif The network interface to remove.
- Returns:
- ERR_OK if netif was removed, an err_t otherwise
Definition at line 2112 of file lwip_mdns.c.
Update MDNS hostname for a network interface.
- Parameters:
-
netif The network interface to activate. hostname Name to use. Queries for <hostname>.local will be answered with the IP addresses of the netif. The hostname will be copied, the given pointer can be on the stack.
- Returns:
- ERR_OK if name could be set on netif, an err_t otherwise
Definition at line 2156 of file lwip_mdns.c.
Update name for an MDNS service.
- Parameters:
-
netif The network interface to activate. slot The service slot number returned by mdns_resp_add_service name The new name for the service
- Returns:
- ERR_OK if name could be set on service, an err_t otherwise
Definition at line 2267 of file lwip_mdns.c.
void mdns_resp_restart | ( | struct netif * | netif ) |
Restart mdns responder.
Call this when cable is connected after being disconnected or administrative interface is set up after being down
- Parameters:
-
netif The network interface to send on
Definition at line 2356 of file lwip_mdns.c.
Generated on Tue Jul 12 2022 13:55:22 by
