Rtos API example
MDNS
[Applications]
RFC 6762 - Multicast DNS
RFC 6763 - DNS-Based Service Discovery
.
More...
Modules | |
Options | |
Functions | |
void | mdns_resp_init (void) |
Initiate MDNS responder. | |
void | mdns_resp_netif_settings_changed (struct netif *netif) |
Announce IP settings have changed on netif. | |
err_t | mdns_resp_add_netif (struct netif *netif, const char *hostname, u32_t dns_ttl) |
Activate MDNS responder for a network interface and send announce packets. | |
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_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_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. |
Detailed Description
RFC 6762 - Multicast DNS
RFC 6763 - DNS-Based Service Discovery
.
Things left to implement: -------------------------
- Probing/conflict resolution
- 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
- Subscribe to netif address/link change events and act on them (currently needs to be done manually)
- 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 and send announce packets.
- 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 1867 of file lwip_mdns.c.
err_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:
- ERR_OK if the service was added to the netif, an err_t otherwise
Definition at line 1961 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 2020 of file lwip_mdns.c.
void mdns_resp_init | ( | void | ) |
Initiate MDNS responder.
Will open UDP sockets on port 5353
Definition at line 1811 of file lwip_mdns.c.
void mdns_resp_netif_settings_changed | ( | struct netif * | netif ) |
Announce IP settings have changed on netif.
Call this in your callback registered by netif_set_status_callback(). This function may go away in the future when netif supports registering multiple callback functions.
- Parameters:
-
netif The network interface where settings have changed.
Definition at line 1839 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 1916 of file lwip_mdns.c.
Generated on Sun Jul 17 2022 08:25:36 by 1.7.2