typedef enum {
AVAHI_PUBLISH_NULL = 0,
AVAHI_PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
- AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
- AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
- AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
+ AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
+ AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
+ AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
AVAHI_PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
- AVAHI_PUBLISH_NO_COOKIE = 32 /**< For service records: do not implicitly add the local service cookie to TXT data */
+ AVAHI_PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
+ AVAHI_PUBLISH_IS_PROXY = 64 /**< For service records: this is a proxy for another host. This modifies behaviour of avahi_server_is_service_local() */
} AvahiPublishFlags;
/** Some flags for lookup functions */
AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been send */
AVAHI_BROWSER_ALL_FOR_NOW, /**< One-time event, to notify the user that more records will probably not show up in the near future, i.e. all cache entries have been read and all static servers been queried */
- AVAHI_BROWSER_NOT_FOUND, /**< Issued when using wide area DNS-SD to inform that a record is not existing */
+ AVAHI_BROWSER_NOT_FOUND, /**< Issued when using wide area DNS-SD to inform that a record is not existing */
AVAHI_BROWSER_FAILURE /**< Issued when using wide area DNS-SD to inform about server failures */
} AvahiBrowserEvent;
if (!AVAHI_PROTO_VALID(protocol))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
- if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_ANNOUNCE|AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_UNIQUE|AVAHI_PUBLISH_ALLOW_MULTIPLE))
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_ANNOUNCE|AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_UNIQUE|AVAHI_PUBLISH_ALLOW_MULTIPLE|AVAHI_PUBLISH_IS_PROXY))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
if (!avahi_is_valid_domain_name(r->key->name))
if (!AVAHI_PROTO_VALID(protocol))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
- if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_COOKIE))
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_COOKIE|AVAHI_PUBLISH_IS_PROXY))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
if (!avahi_is_valid_service_name(name))
snprintf(ptr_name, sizeof(ptr_name), "%s.%s", t, d);
snprintf(svc_name, sizeof(svc_name), "%s.%s.%s", ename, t, d);
- if ((ret = avahi_server_add_ptr(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name)) < 0)
+ if ((ret = avahi_server_add_ptr(s, g, interface, protocol, flags & AVAHI_PUBLISH_IS_PROXY, AVAHI_DEFAULT_TTL, ptr_name, svc_name)) < 0)
goto fail;
if (!(r = avahi_record_new_full(svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
r->data.srv.port = port;
r->data.srv.name = h;
h = NULL;
- ret = avahi_server_add(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, r);
+ ret = avahi_server_add(s, g, interface, protocol, (flags & AVAHI_PUBLISH_IS_PROXY) | AVAHI_PUBLISH_UNIQUE, r);
avahi_record_unref(r);
if (ret < 0)
if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
strlst = add_magic_cookie(s, strlst);
- ret = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
+ ret = server_add_txt_strlst_nocopy(s, g, interface, protocol, (flags & AVAHI_PUBLISH_IS_PROXY) | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
strlst = NULL;
if (ret < 0)
goto fail;
snprintf(enum_ptr, sizeof(enum_ptr), "_services._dns-sd._udp.%s", d);
- ret = avahi_server_add_ptr(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name);
+ ret = avahi_server_add_ptr(s, g, interface, protocol, (flags & AVAHI_PUBLISH_IS_PROXY), AVAHI_DEFAULT_TTL, enum_ptr, ptr_name);
fail:
for (e = avahi_hashmap_lookup(s->entries_by_key, key); e; e = e->by_key_next) {
if ((e->interface == interface || e->interface <= 0 || interface <= 0) &&
- (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC)) {
+ (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC) &&
+ !(e->flags & AVAHI_PUBLISH_IS_PROXY)) {
ret = 1;
break;
}