DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_interface, i_protocol, i_flags, bt;
+ int32_t i_interface, i_protocol, bt;
+ uint32_t u_flags;
assert(client);
assert(callback);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
bt = btype;
if (!(dbus_message_append_args(
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &bt,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
DBusError error;
const char *path;
char *domain = NULL;
- int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC;
+ uint32_t flags = 0;
assert(client);
assert(message);
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) ||
dbus_error_is_set (&error)) {
fprintf(stderr, "Failed to parse browser event.\n");
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_interface, i_protocol, i_flags;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(client);
assert(callback);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
if (!dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_interface,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID)) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
DBusError error;
const char *path;
char *domain = NULL, *type = NULL;
- int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC;
+ uint32_t flags = 0;
assert(client);
assert(message);
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) ||
dbus_error_is_set(&error)) {
fprintf(stderr, "Failed to parse browser event.\n");
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
- int32_t i_protocol, i_interface, i_flags;
+ int32_t i_protocol, i_interface;
+ uint32_t u_flags;
assert(client);
assert(type);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
if (!dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID)) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
DBusError error;
const char *path;
char *name = NULL, *type = NULL, *domain = NULL;
- int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC, flags = 0;
+ int32_t interface = AVAHI_IF_UNSPEC, protocol = AVAHI_PROTO_UNSPEC;
+ uint32_t flags = 0;
dbus_error_init (&error);
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) ||
dbus_error_is_set(&error)) {
fprintf(stderr, "Failed to parse browser event.\n");
printf ("Resetting entry group\n");
avahi_entry_group_reset (g);
- avahi_entry_group_add_service (g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar2", NULL);
+ avahi_entry_group_add_service (g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar2", NULL);
avahi_entry_group_commit (g);
}
printf("Sucessfully created entry group %p\n", (void*) group);
- avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL);
+ avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL);
avahi_entry_group_commit (group);
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
DBusError error;
AvahiClient *client;
int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(group);
assert(name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
+ u_flags = (uint32_t) flags;
if (!dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_interface,
DBUS_TYPE_INT32, &i_protocol,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(group);
va_start(va, port);
- r = avahi_entry_group_add_service_va(group, interface, protocol, name, type, domain, host, port, va);
+ r = avahi_entry_group_add_service_va(group, interface, protocol, flags, name, type, domain, host, port, va);
va_end(va);
return r;
}
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(group);
txt = avahi_string_list_new_va(va);
- r = avahi_entry_group_add_service_strlst(group, interface, protocol, name, type, domain, host, port, txt);
+ r = avahi_entry_group_add_service_strlst(group, interface, protocol, flags, name, type, domain, host, port, txt);
avahi_string_list_free(txt);
return r;
if (event == AVAHI_RESOLVER_FOUND) {
int j;
- int32_t interface, flags, protocol, aprotocol;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name, *type, *domain, *host, *address;
uint16_t port;
DBusMessageIter iter, sub;
dbus_message_iter_next(&iter);
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) {
- fprintf(stderr, "Failed to parse resolver event. XXX %i\n", dbus_message_iter_get_arg_type(&iter));
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) {
+ fprintf(stderr, "Failed to parse resolver event.\n");
goto fail;
}
DBusError error;
AvahiServiceResolver *r;
DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
char *path;
assert(client);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) aprotocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
if (!(dbus_message_append_args(
message,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
goto fail;
if (event == AVAHI_RESOLVER_FOUND) {
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name, *address;
AvahiAddress a;
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INT32, &aprotocol,
DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) ||
dbus_error_is_set (&error)) {
fprintf(stderr, "Failed to parse resolver event.\n");
goto fail;
}
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, &a, flags, r->userdata);
+ r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, &a, (AvahiLookupResultFlags) flags, r->userdata);
} else
r->callback(r, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, NULL, NULL, 0, r->userdata);
DBusError error;
AvahiHostNameResolver *r;
DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
char *path;
assert(client);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) aprotocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
if (!(dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
goto fail;
if (event == AVAHI_RESOLVER_FOUND) {
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name, *address;
AvahiAddress a;
DBUS_TYPE_INT32, &aprotocol,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) ||
dbus_error_is_set (&error)) {
fprintf(stderr, "Failed to parse resolver event.\n");
DBusError error;
AvahiAddressResolver *r;
DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_flags;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
char *path;
assert(client);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
if (!(dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_interface,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
AVAHI_DOMAIN_BROWSER_MAX
} AvahiDomainBrowserType;
+/** Some flags for publishing functions */
+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_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 */
+} AvahiPublishFlags;
+
/** Some flags for lookup functions */
typedef enum {
AVAHI_LOOKUP_NULL = 0,
} else if (a->state == AVAHI_ANNOUNCING) {
- if (a->entry->flags & AVAHI_ENTRY_UNIQUE)
+ if (a->entry->flags & AVAHI_PUBLISH_UNIQUE)
/* Send the whole rrset at once */
avahi_server_prepare_matching_responses(a->server, a->interface, a->entry->record->key, 0);
else
assert(a);
e = a->entry;
- if ((e->flags & AVAHI_ENTRY_UNIQUE) && !(e->flags & AVAHI_ENTRY_NOPROBE))
+ if ((e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE))
a->state = AVAHI_PROBING;
- else if (!(e->flags & AVAHI_ENTRY_NOANNOUNCE)) {
+ else if (!(e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)) {
if (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED)
a->state = AVAHI_ANNOUNCING;
return
a->state == AVAHI_ANNOUNCING ||
a->state == AVAHI_ESTABLISHED ||
- (a->state == AVAHI_WAITING && !(e->flags & AVAHI_ENTRY_UNIQUE));
+ (a->state == AVAHI_WAITING && !(e->flags & AVAHI_PUBLISH_UNIQUE));
}
int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
return
a->state == AVAHI_PROBING ||
- (a->state == AVAHI_WAITING && (e->flags & AVAHI_ENTRY_UNIQUE));
+ (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
}
void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
if (!avahi_interface_match(i, e->interface, e->protocol))
return;
- if (e->flags & AVAHI_ENTRY_NOANNOUNCE)
+ if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
return;
if (!avahi_entry_is_registered(m->server, e, i))
if (!(g = make_goodbye_record(e->record)))
return; /* OOM */
- avahi_interface_post_response(i, g, e->flags & AVAHI_ENTRY_UNIQUE, NULL, 1);
+ avahi_interface_post_response(i, g, e->flags & AVAHI_PUBLISH_UNIQUE, NULL, 1);
avahi_record_unref(g);
}
service_name = n;
}
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, service_name, "_http._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
+ if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_http._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
avahi_log_error("Failed to add HTTP service");
goto fail;
}
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, service_name, "_ftp._tcp", NULL, NULL, 21, "foo", NULL) < 0) {
+ if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_ftp._tcp", NULL, NULL, 21, "foo", NULL) < 0) {
avahi_log_error("Failed to add FTP service");
goto fail;
}
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, service_name, "_webdav._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
+ if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0,service_name, "_webdav._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
avahi_log_error("Failed to add WEBDAV service");
goto fail;
}
- if (avahi_server_add_dns_server_address(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &a), 53) < 0) {
+ if (avahi_server_add_dns_server_address(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &a), 53) < 0) {
avahi_log_error("Failed to add new DNS Server address");
goto fail;
}
if (!domain)
domain = server->domain_name;
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
if (!domain)
domain = server->domain_name;
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
if (!domain)
domain = server->domain_name;
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
if (!domain)
domain = server->domain_name;
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
CHECK_VALIDITY_RETURN_NULL(server, !avahi_key_is_pattern(key), AVAHI_ERR_IS_PATTERN);
CHECK_VALIDITY_RETURN_NULL(server, avahi_key_is_valid(key), AVAHI_ERR_INVALID_KEY);
- CHECK_VALIDITY_RETURN_NULL(server, AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
+ CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
if (!(b = avahi_new(AvahiSRecordBrowser, 1))) {
void avahi_s_record_browser_restart(AvahiSRecordBrowser *b);
void avahi_s_record_browser_cancel(AvahiSRecordBrowser *b);
-#define AVAHI_VALID_FLAGS(flags, max) (!((flags) & ~(max)))
-
#endif
else
group = avahi_s_entry_group_new(avahi, entry_group_callback, NULL);
- avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
+ avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
avahi_s_entry_group_commit(group);
try++;
/** Maximum number of defined DNS servers for wide area DNS */
#define AVAHI_MAX_WIDE_AREA_SERVERS 4
-/** Flags for server entries */
-typedef enum {
- AVAHI_ENTRY_NULL = 0, /**< No special flags */
- AVAHI_ENTRY_UNIQUE = 1, /**< The RRset is intended to be unique */
- AVAHI_ENTRY_NOPROBE = 2, /**< Though the RRset is intended to be unique no probes shall be sent */
- AVAHI_ENTRY_NOANNOUNCE = 4, /**< Do not announce this RR to other hosts */
- AVAHI_ENTRY_ALLOWMUTIPLE = 8 /**< Allow multiple local records of this type, even if they are intended to be unique */
-} AvahiEntryFlags;
-
/** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, void* userdata);
if (!name)
return; /* OOM */
- if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) {
- avahi_log_warn(__FILE__": avahi_server_add_service() failed.");
+ if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, 0, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) {
+ avahi_log_warn(__FILE__": avahi_server_add_service() failed: %s", avahi_strerror(m->server->error));
avahi_s_entry_group_free(hw->entry_group);
hw->entry_group = NULL;
} else
AvahiSEntryGroup *g, /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */
AvahiIfIndex interface, /**< A numeric index of a network interface to attach this record to, or AVAHI_IF_UNSPEC to attach this record to all interfaces */
AvahiProtocol protocol, /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */
- AvahiEntryFlags flags, /**< Special flags for this record */
- AvahiRecord *r /**< The record to add. This function increases the reference counter of this object. */ );
+ AvahiPublishFlags flags, /**< Special flags for this record */
+ AvahiRecord *r /**< The record to add. This function increases the reference counter of this object. */);
+
/** Add a PTR RR to the server. See avahi_server_add() for more information. */
int avahi_server_add_ptr(
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl, /**< DNS TTL for this record */
const char *name, /**< PTR record name */
const char *dest /**< pointer destination */ );
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl, /**< DNS TTL for this record */
const char *name, /**< TXT record name */
... /**< Text record data, terminated by NULL */) AVAHI_GCC_SENTINEL;
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
va_list va);
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
AvahiStringList *strlst /**< TXT decord data as a AvahiString. This routine makes a deep copy of this object. */ );
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
const char *name,
AvahiAddress *a);
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name, /**< Service name, e.g. "Lennart's Files" */
const char *type, /**< DNS-SD type, e.g. "_http._tcp" */
const char *domain,
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *domain,
AvahiDNSServerType type,
const AvahiAddress *address,
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *domain,
AvahiDNSServerType type,
const char *name,
return NULL;
}
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
return NULL;
}
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
if (!domain)
domain = server->domain_name;
- if (!AVAHI_VALID_FLAGS(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS)) {
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS)) {
avahi_server_set_errno(server, AVAHI_ERR_INVALID_FLAGS);
return NULL;
}
for (e = avahi_hashmap_lookup(s->entries_by_key, k); e; e = e->by_key_next)
if (!e->dead && avahi_entry_is_registered(s, e, i))
- callback(s, e->record, e->flags & AVAHI_ENTRY_UNIQUE, userdata);
+ callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);
avahi_key_unref(k);
}
assert(i);
assert(e);
- avahi_record_list_push(s->record_list, e->record, e->flags & AVAHI_ENTRY_UNIQUE, unicast_response, auxiliary);
+ avahi_record_list_push(s->record_list, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, unicast_response, auxiliary);
}
void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response) {
continue;
}
- if (!(e->flags & AVAHI_ENTRY_UNIQUE) && !unique)
+ if (!(e->flags & AVAHI_PUBLISH_UNIQUE) && !unique)
continue;
/* Either our entry or the other is intended to be unique, so let's check */
r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine));
r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname));
- if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_ENTRY_UNIQUE, r) < 0) {
+ if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) {
avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));
return;
}
/* Add localhost entries */
avahi_address_parse("127.0.0.1", AVAHI_PROTO_INET, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_ENTRY_NOPROBE|AVAHI_ENTRY_NOANNOUNCE, "localhost", &a);
+ avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "localhost", &a);
avahi_address_parse("::1", AVAHI_PROTO_INET6, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_ENTRY_NOPROBE|AVAHI_ENTRY_NOANNOUNCE, "ip6-localhost", &a);
+ avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "ip6-localhost", &a);
}
static void register_browse_domain(AvahiServer *s) {
s->legacy_unicast_reflect_slots = NULL;
s->legacy_unicast_reflect_id = 0;
-
if (s->config.enable_wide_area) {
s->wide_area_lookup_engine = avahi_wide_area_engine_new(s);
avahi_wide_area_set_servers(s->wide_area_lookup_engine, s->config.wide_area_servers, s->config.n_wide_area_servers);
avahi_free(s);
}
-static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiEntryFlags flags) {
+static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiPublishFlags flags) {
AvahiEntry *e;
assert(s);
if (e->dead)
continue;
- if (!(flags & AVAHI_ENTRY_UNIQUE) && !(e->flags & AVAHI_ENTRY_UNIQUE))
+ if (!(flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_UNIQUE))
continue;
- if ((flags & AVAHI_ENTRY_ALLOWMUTIPLE) && (e->flags & AVAHI_ENTRY_ALLOWMUTIPLE) )
+ if ((flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) && (e->flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) )
continue;
if ((interface <= 0 ||
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
AvahiRecord *r) {
AvahiEntry *e, *t;
assert(s);
assert(r);
+ if (!AVAHI_IF_VALID(interface))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_INTERFACE);
+
+ 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))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
+
+ if (!avahi_is_valid_domain_name(r->key->name))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
+
if (r->ttl == 0)
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_TTL);
return avahi_server_set_errno(s, AVAHI_ERR_LOCAL_COLLISION);
if (!(e = avahi_new(AvahiEntry, 1)))
- return avahi_server_set_errno(s, AVAHI_ERR_NO_NETWORK);
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
e->server = s;
e->record = avahi_record_ref(r);
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
const char *dest) {
assert(s);
assert(dest);
- if (!(r = avahi_record_new_full(name ? name : s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR, ttl)))
+ if ((name && !avahi_is_valid_domain_name(name)) || !avahi_is_valid_domain_name(dest))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
+
+ if (!name)
+ name = s->host_name_fqdn;
+
+ if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR, ttl)))
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
r->data.ptr.name = avahi_normalize_name(dest);
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
const char *name,
AvahiAddress *a) {
char *n = NULL;
int ret = AVAHI_OK;
+
assert(s);
assert(a);
- if (name) {
+ if (!AVAHI_IF_VALID(interface))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_INTERFACE);
+
+ if (!AVAHI_PROTO_VALID(protocol) || !AVAHI_PROTO_VALID(a->proto))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
+
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_REVERSE|AVAHI_PUBLISH_NO_ANNOUNCE|AVAHI_PUBLISH_NO_PROBE))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
+
+ if (name && !avahi_is_valid_domain_name(name))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
+
+ if (!name)
+ name = s->host_name_fqdn;
+ else {
if (!(n = avahi_normalize_name(name)))
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
name = n;
- } else
- name = s->host_name_fqdn;
-
- if (!avahi_is_valid_domain_name(name)) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
- goto fail;
}
if (a->proto == AVAHI_PROTO_INET) {
- char *reverse;
AvahiRecord *r;
if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME))) {
}
r->data.a.address = a->data.ipv4;
- ret = avahi_server_add(s, g, interface, protocol, flags | AVAHI_ENTRY_UNIQUE | AVAHI_ENTRY_ALLOWMUTIPLE, r);
+ ret = avahi_server_add(s, g, interface, protocol, (flags & ~ AVAHI_PUBLISH_NO_REVERSE) | AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
avahi_record_unref(r);
if (ret < 0)
goto fail;
-
- if (!(reverse = avahi_reverse_lookup_name_ipv4(&a->data.ipv4))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
- avahi_free(reverse);
+ if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
+ char *reverse;
+
+ if (!(reverse = avahi_reverse_lookup_name_ipv4(&a->data.ipv4))) {
+ ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
+ avahi_free(reverse);
+ }
+
} else {
- char *reverse;
AvahiRecord *r;
assert(a->proto == AVAHI_PROTO_INET6);
}
r->data.aaaa.address = a->data.ipv6;
- ret = avahi_server_add(s, g, interface, protocol, flags | AVAHI_ENTRY_UNIQUE | AVAHI_ENTRY_ALLOWMUTIPLE, r);
+ ret = avahi_server_add(s, g, interface, protocol, (flags & ~ AVAHI_PUBLISH_NO_REVERSE) | AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
avahi_record_unref(r);
if (ret < 0)
goto fail;
- if (!(reverse = avahi_reverse_lookup_name_ipv6_arpa(&a->data.ipv6))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
- avahi_free(reverse);
+ if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
+ char *reverse;
- if (ret < 0)
- goto fail;
-
- if (!(reverse = avahi_reverse_lookup_name_ipv6_int(&a->data.ipv6))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
+ if (!(reverse = avahi_reverse_lookup_name_ipv6_arpa(&a->data.ipv6))) {
+ ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
+ avahi_free(reverse);
+
+ if (ret < 0)
+ goto fail;
+
+ if (!(reverse = avahi_reverse_lookup_name_ipv6_int(&a->data.ipv6))) {
+ ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
+ avahi_free(reverse);
}
-
- ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
- avahi_free(reverse);
}
fail:
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
AvahiStringList *strlst) {
int ret;
assert(s);
-
+
if (!(r = avahi_record_new_full(name ? name : s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT, ttl)))
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
AvahiStringList *strlst) {
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
va_list va) {
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
- AvahiEntryFlags flags,
+ AvahiPublishFlags flags,
uint32_t ttl,
const char *name,
...) {
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(type);
assert(name);
+ if (!AVAHI_IF_VALID(interface))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_INTERFACE);
+
+ if (!AVAHI_PROTO_VALID(protocol))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
+
+ if (!AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_NO_COOKIE))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
+
if (!avahi_is_valid_service_name(name))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_SERVICE_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, AVAHI_ENTRY_NULL, AVAHI_DEFAULT_TTL, ptr_name, svc_name)) < 0)
+ if ((ret = avahi_server_add_ptr(s, g, interface, protocol, 0, 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_ENTRY_UNIQUE, r);
+ ret = avahi_server_add(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, r);
avahi_record_unref(r);
if (ret < 0)
goto fail;
- strlst = add_magic_cookie(s, strlst);
+ if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
+ strlst = add_magic_cookie(s, strlst);
- ret = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
+ ret = server_add_txt_strlst_nocopy(s, g, interface, protocol, 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, AVAHI_ENTRY_NULL, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name);
+ ret = avahi_server_add_ptr(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name);
fail:
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(type);
assert(name);
- return server_add_service_strlst_nocopy(s, g, interface, protocol, name, type, domain, host, port, avahi_string_list_copy(strlst));
+ return server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_copy(strlst));
}
int avahi_server_add_service_va(
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(type);
assert(name);
- return server_add_service_strlst_nocopy(s, g, interface, protocol, name, type, domain, host, port, avahi_string_list_new_va(va));
+ return server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_new_va(va));
}
int avahi_server_add_service(
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
assert(name);
va_start(va, port);
- ret = avahi_server_add_service_va(s, g, interface, protocol, name, type, domain, host, port, va);
+ ret = avahi_server_add_service_va(s, g, interface, protocol, flags, name, type, domain, host, port, va);
va_end(va);
return ret;
}
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *domain,
AvahiDNSServerType type,
const AvahiAddress *address,
assert(s);
assert(address);
- assert(type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE);
- assert(address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6);
+ if (!AVAHI_IF_VALID(interface))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_INTERFACE);
+
+ if (!AVAHI_PROTO_VALID(protocol) || !AVAHI_PROTO_VALID(address->proto))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
+
+ if (!AVAHI_FLAGS_VALID(flags, 0) || (type != AVAHI_DNS_SERVER_UPDATE && type != AVAHI_DNS_SERVER_RESOLVE))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
+
if (port == 0)
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PORT);
if (domain && !avahi_is_valid_domain_name(domain))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
+ if (!domain)
+ domain = s->domain_name;
+
if (address->proto == AVAHI_PROTO_INET) {
hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv4Address));
- snprintf(n, sizeof(n), "ip-%s.%s", h, s->domain_name);
+ snprintf(n, sizeof(n), "ip-%s.%s", h, domain);
r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME);
r->data.a.address = address->data.ipv4;
} else {
hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv6Address));
- snprintf(n, sizeof(n), "ip6-%s.%s", h, s->domain_name);
+ snprintf(n, sizeof(n), "ip6-%s.%s", h, domain);
r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME);
r->data.aaaa.address = address->data.ipv6;
}
if (!r)
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- ret = avahi_server_add(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE | AVAHI_ENTRY_ALLOWMUTIPLE, r);
+ ret = avahi_server_add(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
avahi_record_unref(r);
if (ret < 0)
return ret;
- return avahi_server_add_dns_server_name(s, g, interface, protocol, domain, type, n, port);
+ return avahi_server_add_dns_server_name(s, g, interface, protocol, flags, domain, type, n, port);
}
int avahi_server_add_dns_server_name(
AvahiSEntryGroup *g,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *domain,
AvahiDNSServerType type,
const char *name,
assert(s);
assert(name);
- assert(type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE);
+ if (!AVAHI_IF_VALID(interface))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_INTERFACE);
+
+ if (!AVAHI_PROTO_VALID(protocol))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PROTOCOL);
+
+ if (!AVAHI_FLAGS_VALID(flags, 0) || (type != AVAHI_DNS_SERVER_UPDATE && type != AVAHI_DNS_SERVER_RESOLVE))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_FLAGS);
+
if (port == 0)
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PORT);
if (domain && !avahi_is_valid_domain_name(domain))
return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
-
if (!domain)
domain = s->domain_name;
r->data.srv.weight = 0;
r->data.srv.port = port;
r->data.srv.name = n;
- ret = avahi_server_add(s, g, interface, protocol, AVAHI_ENTRY_NULL, r);
+ ret = avahi_server_add(s, g, interface, protocol, AVAHI_PUBLISH_NULL, r);
avahi_record_unref(r);
return ret;
#define AVAHI_MAX_LEGACY_UNICAST_REFLECT_SLOTS 100
+#define AVAHI_FLAGS_VALID(flags, max) (!((flags) & ~(max)))
+
typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
struct AvahiLegacyUnicastReflectSlot {
int dead;
- AvahiEntryFlags flags;
+ AvahiPublishFlags flags;
AvahiRecord *record;
AvahiIfIndex interface;
AvahiProtocol protocol;
<arg name="aprotocol" type="i" direction="out"/>
<arg name="address" type="s" direction="out"/>
<arg name="name" type="s" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</signal>
<signal name="Timeout"/>
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="ItemRemove">
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="Failure"/>
<method name="AddService">
<arg name="interface" type="i" direction="in"/>
<arg name="protocol" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="type" type="s" direction="in"/>
<arg name="domain" type="s" direction="in"/>
<method name="AddAddress">
<arg name="interface" type="i" direction="in"/>
<arg name="protocol" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="address" type="s" direction="in"/>
</method>
<arg name="name" type="s" direction="out"/>
<arg name="aprotocol" type="i" direction="out"/>
<arg name="address" type="s" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</signal>
<signal name="Timeout"/>
<arg name="protocol" type="i" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="interface" type="i" direction="out"/>
<arg name="protocol" type="i" direction="out"/>
<arg name="name" type="s" direction="out"/>
<arg name="aprotocol" type="i" direction="out"/>
<arg name="address" type="s" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</method>
<method name="ResolveAddress">
<arg name="interface" type="i" direction="in"/>
<arg name="protocol" type="i" direction="in"/>
<arg name="address" type="s" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="interface" type="i" direction="out"/>
<arg name="protocol" type="i" direction="out"/>
<arg name="aprotocol" type="i" direction="out"/>
<arg name="address" type="s" direction="out"/>
<arg name="name" type="s" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</method>
<method name="ResolveService">
<arg name="type" type="s" direction="in"/>
<arg name="domain" type="s" direction="in"/>
<arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="interface" type="i" direction="out"/>
<arg name="protocol" type="i" direction="out"/>
<arg name="address" type="s" direction="out"/>
<arg name="port" type="q" direction="out"/>
<arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</method>
<method name="IsServiceLocal">
<arg name="protocol" type="i" direction="in"/>
<arg name="domain" type="s" direction="in"/>
<arg name="btype" type="i" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="interface" type="i" direction="in"/>
<arg name="protocol" type="i" direction="in"/>
<arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="protocol" type="i" direction="in"/>
<arg name="type" type="s" direction="in"/>
<arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="type" type="s" direction="in"/>
<arg name="domain" type="s" direction="in"/>
<arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="protocol" type="i" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="interface" type="i" direction="in"/>
<arg name="protocol" type="i" direction="in"/>
<arg name="address" type="s" direction="in"/>
- <arg name="flags" type="i" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method>
<arg name="name" type="s"/>
<arg name="type" type="s"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="ItemRemove">
<arg name="name" type="s"/>
<arg name="type" type="s"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="Failure"/>
<arg name="address" type="s" direction="out"/>
<arg name="port" type="q" direction="out"/>
<arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="i" direction="out"/>
+ <arg name="flags" type="u" direction="out"/>
</signal>
<signal name="Timeout"/>
<arg name="protocol" type="i"/>
<arg name="type" type="s"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="ItemRemove">
<arg name="protocol" type="i"/>
<arg name="type" type="s"/>
<arg name="domain" type="s"/>
- <arg name="flags" type="i"/>
+ <arg name="flags" type="u"/>
</signal>
<signal name="Failure"/>
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService")) {
int32_t interface, protocol;
+ uint32_t flags;
char *type, *name, *domain, *host;
uint16_t port;
AvahiStringList *strlst;
m, &error,
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
dbus_message_iter_init(m, &iter);
- for (j = 0; j < 7; j++)
+ for (j = 0; j < 8; j++)
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
if (host && !*host)
host = NULL;
- if (avahi_server_add_service_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, host, port, strlst) < 0) {
+ if (avahi_server_add_service_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, host, port, strlst) < 0) {
avahi_string_list_free(strlst);
return respond_error(c, m, avahi_server_errno(avahi_server), NULL);
} else
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddAddress")) {
int32_t interface, protocol;
+ uint32_t flags;
char *name, *address;
AvahiAddress a;
m, &error,
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_INVALID) || !name || !address) {
return respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
}
- if (avahi_server_add_address(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, 0, name, &a) < 0)
+ if (avahi_server_add_address(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, &a) < 0)
return respond_error(c, m, avahi_server_errno(avahi_server), NULL);
else
i->n_entries ++;
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
DBusMessage *reply;
assert(a);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) a->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
reply = dbus_message_new_method_return(i->message);
dbus_message_append_args(
DBUS_TYPE_STRING, &host_name,
DBUS_TYPE_INT32, &i_aprotocol,
DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
dbus_connection_send(server->bus, reply, NULL);
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
DBusMessage *reply;
assert(host_name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) address->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
reply = dbus_message_new_method_return(i->message);
dbus_message_append_args(
DBUS_TYPE_INT32, &i_aprotocol,
DBUS_TYPE_STRING, &pt,
DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
dbus_connection_send(server->bus, reply, NULL);
static void domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
DomainBrowserInfo *i = userdata;
DBusMessage *m;
- int32_t i_interface, i_protocol, i_flags;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(b);
assert(i);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, map_browse_signal_name(event));
DBUS_TYPE_INT32, &i_interface,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
static void service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
ServiceTypeBrowserInfo *i = userdata;
DBusMessage *m;
- int32_t i_interface, i_protocol, i_flags;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(b);
assert(i);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, map_browse_signal_name(event));
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
static void service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
ServiceBrowserInfo *i = userdata;
DBusMessage *m;
- int32_t i_interface, i_protocol, i_flags;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(b);
assert(i);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, map_browse_signal_name(event));
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
DBusMessage *reply;
assert(host_name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) a->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
reply = dbus_message_new_method_return(i->message);
dbus_message_append_args(
dbus_message_append_args(
reply,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
dbus_connection_send(server->bus, reply, NULL);
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
assert(address);
assert(host_name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) address->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
dbus_message_append_args(
reply,
DBUS_TYPE_INT32, &i_aprotocol,
DBUS_TYPE_STRING, &pt,
DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
assert(a);
assert(host_name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) a->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
dbus_message_append_args(
reply,
DBUS_TYPE_STRING, &host_name,
DBUS_TYPE_INT32, &i_aprotocol,
DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
if (event == AVAHI_RESOLVER_FOUND) {
char t[256], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol, i_flags;
+ int32_t i_interface, i_protocol, i_aprotocol;
+ uint32_t u_flags;
assert(host_name);
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
i_aprotocol = (int32_t) a->proto;
- i_flags = (int32_t) flags;
+ u_flags = (uint32_t) flags;
dbus_message_append_args(
reply,
dbus_message_append_args(
reply,
- DBUS_TYPE_INT32, &i_flags,
+ DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID);
}
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveHostName")) {
Client *client;
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name;
SyncHostNameResolverInfo *i;
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !name) {
avahi_log_warn("Error parsing Server::ResolveHostName message");
goto fail;
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveAddress")) {
Client *client;
- int32_t interface, protocol, flags;
+ int32_t interface, protocol;
+ uint32_t flags;
char *address;
SyncAddressResolverInfo *i;
AvahiAddress a;
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !address) {
avahi_log_warn("Error parsing Server::ResolveAddress message");
goto fail;
NULL,
NULL
};
- int32_t interface, protocol, type, flags;
+ int32_t interface, protocol, type;
+ uint32_t flags;
char *domain;
if (!dbus_message_get_args(
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &type,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || type < 0 || type >= AVAHI_DOMAIN_BROWSER_MAX) {
avahi_log_warn("Error parsing Server::DomainBrowserNew message");
goto fail;
NULL,
NULL
};
- int32_t interface, protocol, flags;
+ int32_t interface, protocol;
+ uint32_t flags;
char *domain;
if (!dbus_message_get_args(
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing Server::ServiceTypeBrowserNew message");
goto fail;
NULL,
NULL
};
- int32_t interface, protocol, flags;
+ int32_t interface, protocol;
+ uint32_t flags;
char *domain, *type;
if (!dbus_message_get_args(
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !type) {
avahi_log_warn("Error parsing Server::ServiceBrowserNew message");
goto fail;
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveService")) {
Client *client;
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name, *type, *domain;
SyncServiceResolverInfo *i;
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !type) {
avahi_log_warn("Error parsing Server::ResolveService message");
goto fail;
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceResolverNew")) {
Client *client;
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name, *type, *domain;
AsyncServiceResolverInfo *i;
static const DBusObjectPathVTable vtable = {
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !type) {
avahi_log_warn("Error parsing Server::ServiceResolverNew message");
goto fail;
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "HostNameResolverNew")) {
Client *client;
- int32_t interface, protocol, aprotocol, flags;
+ int32_t interface, protocol, aprotocol;
+ uint32_t flags;
char *name;
AsyncHostNameResolverInfo *i;
static const DBusObjectPathVTable vtable = {
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !name) {
avahi_log_warn("Error parsing Server::HostNameResolverNew message");
goto fail;
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew")) {
Client *client;
- int32_t interface, protocol, flags;
+ int32_t interface, protocol;
+ uint32_t flags;
char *address;
AsyncAddressResolverInfo *i;
AvahiAddress a;
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INT32, &flags,
+ DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID) || !address) {
avahi_log_warn("Error parsing Server::AddressResolverNew message");
goto fail;
if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a))
avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
else
- if (avahi_server_add_dns_server_address(s, g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, &a, 53) < 0) {
+ if (avahi_server_add_dns_server_address(s, g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, &a, 53) < 0) {
avahi_s_entry_group_free(g);
avahi_log_error("Failed to add DNS server address: %s", avahi_strerror(avahi_server_errno(s)));
return NULL;
if (avahi_server_add_service_strlst(
avahi_server,
g->entry_group,
- -1, s->protocol,
+ AVAHI_IF_UNSPEC, s->protocol,
+ 0,
g->chosen_name, s->type,
s->domain_name, s->host_name, s->port,
s->txt_records) < 0) {
snprintf(r, sizeof(r), "random=%i", rand());
/* Add the service for IPP */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
+ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
goto fail;
}
/* Add the same service for BSD LPR */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
+ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
goto fail;
}
snprintf(r, sizeof(r), "random=%i", rand());
/* Add the service for IPP */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
+ if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
goto fail;
}
/* Add the same service for BSD LPR */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
+ if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
goto fail;
}