This will allow sending replies more flexibly.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
case TYPE_ANY:
if (!strcmp(name, mdns_hostname_local)) {
dns_reply_a(iface, to, announce_ttl);
- service_reply(iface, to, NULL, announce_ttl);
+ service_reply(iface, to, NULL, NULL, announce_ttl);
}
break;
/* Make sure it's query for the instance name we use */
if (len && len == strlen(umdns_host_label) &&
!strncmp(name, umdns_host_label, len))
- service_reply(iface, to, dot + 1, announce_ttl);
+ service_reply(iface, to, NULL, dot + 1, announce_ttl);
}
break;
}
void
-service_reply(struct interface *iface, struct sockaddr *to, const char *match, int ttl)
+service_reply(struct interface *iface, struct sockaddr *to, const char *instance, const char *service_domain, int ttl)
{
struct service *s;
vlist_for_each_element(&services, s, node) {
- if (!match || !strcmp(s->service, match))
- service_reply_single(iface, to, s, ttl, 0);
+ if (instance && strcmp(s->instance, instance))
+ continue;
+ if (service_domain && strcmp(s->service, service_domain))
+ continue;
+ service_reply_single(iface, to, s, ttl, 0);
}
}
extern void service_init(int announce);
extern void service_cleanup(void);
-extern void service_reply(struct interface *iface, struct sockaddr *to, const char *match, int ttl);
+extern void service_reply(struct interface *iface, struct sockaddr *to, const char *instance, const char *service_domain, int ttl);
extern void service_announce_services(struct interface *iface, struct sockaddr *to, int ttl);
#endif