summaryrefslogtreecommitdiffstats
path: root/avahi-client
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-09-29 01:51:53 +0000
committerLennart Poettering <lennart@poettering.net>2005-09-29 01:51:53 +0000
commit424aefe8a431b79496672799dc4f4430fa935252 (patch)
tree0975ca5ba0321a21119f5313834bc20ff6144241 /avahi-client
parent6b3876eb3740666e9f3e036d49efc7b3b3ee5b45 (diff)
* make all flags parameters UINT32 when marshalling for DBUS
* rename AvahiEntryFlags to AvahiPublishFlags * add flags parameter to add_service() and friends * validity checking of flags, interface and protocol parameters of add_service() and friends * make AVAHI_VALID_FLAGS a global macro * add new flag AVAHI_PUBLISH_NO_REVERSE, if set address records will no be created with matching reverse lookup PTR RRs * add new flag AVAHI_PUBLISH_NO_COOKIE, for not implicitly adding the service cookie to TXT records * minor cleanups Yes, this will break the mono bindings. More breakages to come. NO_REVERSE and NO_COOKIE needs testing. Lathiat, I guess the new flag NO_REVERSE makes the immediate need to add a client side API to add arbitrary RRs obsolete for now. You might consider moving it in the TODO list to "later". git-svn-id: file:///home/lennart/svn/public/avahi/trunk@648 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client')
-rw-r--r--avahi-client/browser.c36
-rw-r--r--avahi-client/client-test.c4
-rw-r--r--avahi-client/client.h3
-rw-r--r--avahi-client/entrygroup.c10
-rw-r--r--avahi-client/resolver.c40
5 files changed, 57 insertions, 36 deletions
diff --git a/avahi-client/browser.c b/avahi-client/browser.c
index 1aaae8c..a83aa69 100644
--- a/avahi-client/browser.c
+++ b/avahi-client/browser.c
@@ -52,7 +52,8 @@ AvahiDomainBrowser* avahi_domain_browser_new(
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);
@@ -86,7 +87,7 @@ AvahiDomainBrowser* avahi_domain_browser_new(
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(
@@ -95,7 +96,7 @@ AvahiDomainBrowser* avahi_domain_browser_new(
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;
@@ -175,7 +176,8 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
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);
@@ -198,7 +200,7 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
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");
@@ -229,7 +231,8 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new(
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);
@@ -263,14 +266,14 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new(
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;
@@ -349,7 +352,8 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
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);
@@ -373,7 +377,7 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
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");
@@ -406,7 +410,8 @@ AvahiServiceBrowser* avahi_service_browser_new(
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);
@@ -441,7 +446,7 @@ AvahiServiceBrowser* avahi_service_browser_new(
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,
@@ -449,7 +454,7 @@ AvahiServiceBrowser* avahi_service_browser_new(
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;
@@ -528,7 +533,8 @@ DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowser
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);
@@ -550,7 +556,7 @@ DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowser
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");
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c
index 24576dd..15af93f 100644
--- a/avahi-client/client-test.c
+++ b/avahi-client/client-test.c
@@ -189,7 +189,7 @@ static void test_entry_group_reset (AvahiTimeout *timeout, void* userdata)
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);
}
@@ -243,7 +243,7 @@ int main (int argc, char *argv[]) {
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);
diff --git a/avahi-client/client.h b/avahi-client/client.h
index 4a915ac..31997cf 100644
--- a/avahi-client/client.h
+++ b/avahi-client/client.h
@@ -185,6 +185,7 @@ int avahi_entry_group_add_service(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
@@ -197,6 +198,7 @@ int avahi_entry_group_add_service_strlst(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
@@ -209,6 +211,7 @@ int avahi_entry_group_add_service_va(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
index dc0994a..2dffcf6 100644
--- a/avahi-client/entrygroup.c
+++ b/avahi-client/entrygroup.c
@@ -334,6 +334,7 @@ int avahi_entry_group_add_service_strlst(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
@@ -348,6 +349,7 @@ int avahi_entry_group_add_service_strlst(
DBusError error;
AvahiClient *client;
int32_t i_interface, i_protocol;
+ uint32_t u_flags;
assert(group);
assert(name);
@@ -373,11 +375,13 @@ int avahi_entry_group_add_service_strlst(
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,
@@ -460,6 +464,7 @@ int avahi_entry_group_add_service(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
@@ -473,7 +478,7 @@ int avahi_entry_group_add_service(
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;
}
@@ -482,6 +487,7 @@ int avahi_entry_group_add_service_va(
AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
+ AvahiPublishFlags flags,
const char *name,
const char *type,
const char *domain,
@@ -495,7 +501,7 @@ int avahi_entry_group_add_service_va(
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;
diff --git a/avahi-client/resolver.c b/avahi-client/resolver.c
index f08ce77..d054ae7 100644
--- a/avahi-client/resolver.c
+++ b/avahi-client/resolver.c
@@ -63,7 +63,8 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
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;
@@ -130,8 +131,8 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
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;
}
@@ -175,7 +176,8 @@ AvahiServiceResolver * avahi_service_resolver_new(
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);
@@ -214,7 +216,7 @@ AvahiServiceResolver * avahi_service_resolver_new(
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,
@@ -224,7 +226,7 @@ AvahiServiceResolver * avahi_service_resolver_new(
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;
@@ -324,7 +326,8 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
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;
@@ -335,7 +338,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
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");
@@ -348,7 +351,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
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);
@@ -374,7 +377,8 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
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);
@@ -407,7 +411,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
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,
@@ -415,7 +419,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
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;
@@ -514,7 +518,8 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
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;
@@ -525,7 +530,7 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
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");
@@ -585,7 +590,8 @@ AvahiAddressResolver * avahi_address_resolver_new(
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);
@@ -616,14 +622,14 @@ AvahiAddressResolver * avahi_address_resolver_new(
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;