break;
case TYPE_PTR:
- service_announce_services(iface, name, announce_ttl);
+ if (!strcmp(name, sdudp))
+ service_announce_services(iface, 0, announce_ttl);
+ else if (!strcmp(name, sdtcp))
+ service_announce_services(iface, 1, announce_ttl);
service_reply(iface, name, announce_ttl);
break;
static struct blob_buf b;
static VLIST_TREE(services, avl_strcmp, service_update, false, false);
-static char *sdudp = "_services._dns-sd._udp.local";
-static char *sdtcp = "_services._dns-sd._tcp.local";
+char *sdudp = "_services._dns-sd._udp.local";
+char *sdtcp = "_services._dns-sd._tcp.local";
static int service_init_announce;
static const char *
}
void
-service_announce_services(struct interface *iface, const char *service, int ttl)
+service_announce_services(struct interface *iface, int tcp, int ttl)
{
struct service *s;
- int tcp = 1;
-
- if (!strcmp(service, sdudp))
- tcp = 0;
- else if (strcmp(service, sdtcp))
- return;
vlist_for_each_element(&services, s, node) {
if (!strstr(s->service, "._tcp") && tcp)
void
service_announce(struct interface *iface, int ttl)
{
- service_announce_services(iface, sdudp, ttl);
- service_announce_services(iface, sdtcp, ttl);
+ service_announce_services(iface, 0, ttl);
+ service_announce_services(iface, 1, ttl);
}
static void
#ifndef _SERVICE_H__
#define _SERVICE_H__
+extern char *sdudp;
+extern char *sdtcp;
extern void service_init(int announce);
extern void service_cleanup(void);
extern void service_announce(struct interface *iface, int ttl);
-extern void service_announce_services(struct interface *iface, const char *service, int ttl);
extern void service_reply(struct interface *iface, const char *match, int ttl);
+extern void service_announce_services(struct interface *iface, int tcp, int ttl);
#endif