mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-28 23:00:50 +00:00
mdns : Add mdns_build_subtype_service_domain() function that build a domain name of subtype service
This commit is contained in:
parent
9ba785ab3d
commit
2355f4bb24
@ -632,4 +632,30 @@ mdns_write_domain(struct mdns_outpacket *outpkt, struct mdns_domain *domain)
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build domain name for a subtype service
|
||||
* @param domain Where to write the domain name
|
||||
* @param service The service struct, containing service name, type and protocol
|
||||
* @param include_name Whether to include the service name in the domain
|
||||
* @return ERR_OK if domain was written. If service name is included,
|
||||
* \<subType\>.\<_sub\>.\<type\>.\<proto\>.local. will be written, otherwise \<type\>.\<proto\>.local.
|
||||
* An err_t is returned on error.
|
||||
*/
|
||||
err_t
|
||||
mdns_build_subtype_service_domain(struct mdns_domain *domain, struct mdns_service *service, int subTypes_index)
|
||||
{
|
||||
err_t res;
|
||||
LWIP_UNUSED_ARG(res);
|
||||
memset(domain, 0, sizeof(struct mdns_domain));
|
||||
res = mdns_domain_add_label(domain, service->subTypes[subTypes_index], strlen(service->subTypes[subTypes_index]));
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, "_sub", 4);
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, service->service, (u8_t)strlen(service->service));
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, dnssd_protos[service->proto], (u8_t)strlen(dnssd_protos[service->proto]));
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
return mdns_add_dotlocal(domain);
|
||||
}
|
||||
|
||||
#endif /* LWIP_MDNS_RESPONDER */
|
||||
|
@ -112,7 +112,7 @@ err_t mdns_resp_remove_netif(struct netif *netif);
|
||||
err_t mdns_resp_rename_netif(struct netif *netif, const char *hostname);
|
||||
int mdns_resp_netif_active(struct netif *netif);
|
||||
|
||||
s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, service_get_txt_fn_t txt_fn, void *txt_data, char **subTypes, u8_t subtypes_nbr )
|
||||
s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, service_get_txt_fn_t txt_fn, void *txt_data, char **subTypes, u8_t subtypes_nbr );
|
||||
err_t mdns_resp_del_service(struct netif *netif, u8_t slot);
|
||||
err_t mdns_resp_rename_service(struct netif *netif, u8_t slot, const char *name);
|
||||
|
||||
|
@ -70,7 +70,7 @@ err_t mdns_build_request_domain(struct mdns_domain *domain, struct mdns_request
|
||||
#endif
|
||||
u16_t mdns_compress_domain(struct pbuf *pbuf, u16_t *offset, struct mdns_domain *domain);
|
||||
err_t mdns_write_domain(struct mdns_outpacket *outpkt, struct mdns_domain *domain);
|
||||
|
||||
err_t mdns_build_subtype_service_domain(struct mdns_domain *domain, struct mdns_service *service, int subTypes_index);
|
||||
#endif /* LWIP_MDNS_RESPONDER */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user