time_t t;
const char *id;
+ const char *instance;
const char *service;
const uint8_t *txt;
int txt_len;
*
* Service Instance Name = <Instance> . <Service> . <Domain>
*
- * @service_domain: service name (a pair of labels) with domain name appended
+ * @s: service to generate service instance name for
*/
static const char *
-service_instance_name(const char *service_domain)
+service_instance_name(struct service *s)
{
static char buffer[256];
- snprintf(buffer, sizeof(buffer), "%s.%s", umdns_host_label, service_domain);
+ snprintf(buffer, sizeof(buffer), "%s.%s", s->instance, s->service);
return buffer;
}
static void
service_reply_single(struct interface *iface, struct sockaddr *to, struct service *s, int ttl, int force)
{
- const char *host = service_instance_name(s->service);
+ const char *host = service_instance_name(s);
char *service = strstr(host, "._");
time_t t = service_timeout(s);
s->t = t;
dns_init_answer();
- service_add_ptr(service_instance_name(s->service), ttl);
+ service_add_ptr(service_instance_name(s), ttl);
dns_send_answer(iface, to, service);
dns_init_answer();
s->port = blobmsg_get_u32(_tb[SERVICE_PORT]);
s->id = strcpy(d_id, blobmsg_name(b));
+ s->instance = umdns_host_label;
s->service = strcpy(d_service, blobmsg_get_string(_tb[SERVICE_SERVICE]));
s->active = 1;
s->t = 0;