From ff09d9a4f9885b8160577c79e6349bfee05452f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 10 May 2017 12:47:33 +0200 Subject: [PATCH] Rename service_name function to the service_instance_name MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This name matches what is really returned by the function according to the RFC 6763. Also document it while at it. Signed-off-by: Rafał Miłecki --- service.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/service.c b/service.c index 8e0e493..c8187de 100644 --- a/service.c +++ b/service.c @@ -67,12 +67,21 @@ static struct blob_buf b; static VLIST_TREE(services, avl_strcmp, service_update, false, false); static int service_init_announce; +/** + * service_instance_name - construct Service Instance Name as in RFC 6763 + * + * RFC 6763 specifies Service Instance Names in the following way: + * + * Service Instance Name = . . + * + * @service_domain: service name (a pair of labels) with domain name appended + */ static const char * -service_name(const char *domain) +service_instance_name(const char *service_domain) { static char buffer[256]; - snprintf(buffer, sizeof(buffer), "%s.%s", umdns_host_label, domain); + snprintf(buffer, sizeof(buffer), "%s.%s", umdns_host_label, service_domain); return buffer; } @@ -118,7 +127,7 @@ service_timeout(struct service *s) static void service_reply_single(struct interface *iface, struct sockaddr *to, struct service *s, int ttl, int force) { - const char *host = service_name(s->service); + const char *host = service_instance_name(s->service); char *service = strstr(host, "._"); time_t t = service_timeout(s); @@ -131,7 +140,7 @@ service_reply_single(struct interface *iface, struct sockaddr *to, struct servic s->t = t; dns_init_answer(); - service_add_ptr(service_name(s->service), ttl); + service_add_ptr(service_instance_name(s->service), ttl); dns_send_answer(iface, to, service); dns_init_answer(); -- 2.25.1