summaryrefslogtreecommitdiffstats
path: root/avahi-core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-02 23:57:07 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-02 23:57:07 +0000
commitf43187377e0c89ba02ca23e88efa01bbb255e037 (patch)
tree92dba5140c3932bf0debf2362a82f4f3b5d92bad /avahi-core
parent1a912326734243e57a461c48131c1a0402318b5a (diff)
* replace guchar and gint by AvahiProtocol, AvahiIfIndex at many places where it make sense
* change avahi_add_{service,txt}_strlst() to copy the string list * gcc warning fixes from Ikke * limit number of DBUS connections * limit objects created by a DBUS client * limit number of clients * limit number of entries a client may create * add legal blurb to avahi-discover * remove some obsolete import prototypes from avahi-discover * don't include config.h in dbus.h * add string definitions for DBUS errors git-svn-id: file:///home/lennart/svn/public/avahi/trunk@212 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core')
-rw-r--r--avahi-core/avahi-test.c16
-rw-r--r--avahi-core/browse-dns-server.c14
-rw-r--r--avahi-core/browse-domain.c4
-rw-r--r--avahi-core/browse-service-type.c4
-rw-r--r--avahi-core/browse-service.c4
-rw-r--r--avahi-core/browse.c6
-rw-r--r--avahi-core/core.h4
-rw-r--r--avahi-core/resolve-address.c6
-rw-r--r--avahi-core/resolve-host-name.c6
-rw-r--r--avahi-core/resolve-service.c10
-rw-r--r--avahi-core/server.c88
-rw-r--r--avahi-core/server.h6
12 files changed, 98 insertions, 70 deletions
diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
index f966659..d91e698 100644
--- a/avahi-core/avahi-test.c
+++ b/avahi-core/avahi-test.c
@@ -51,7 +51,7 @@ static gboolean dump_timeout(gpointer data) {
return TRUE;
}
-static void record_browser_callback(AvahiRecordBrowser *r, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
gchar *t;
g_assert(r);
@@ -150,7 +150,7 @@ fail:
group = NULL;
}
-static void hnr_callback(AvahiHostNameResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *hostname, const AvahiAddress *a, gpointer userdata) {
+static void hnr_callback(AvahiHostNameResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *hostname, const AvahiAddress *a, gpointer userdata) {
gchar t[64];
if (a)
@@ -159,7 +159,7 @@ static void hnr_callback(AvahiHostNameResolver *r, gint iface, guchar protocol,
avahi_log_debug("HNR: (%i.%i) <%s> -> %s [%s]", iface, protocol, hostname, a ? t : "n/a", event == AVAHI_RESOLVER_FOUND ? "found" : "timeout");
}
-static void ar_callback(AvahiAddressResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const AvahiAddress *a, const gchar *hostname, gpointer userdata) {
+static void ar_callback(AvahiAddressResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const AvahiAddress *a, const gchar *hostname, gpointer userdata) {
gchar t[64];
avahi_address_snprint(t, sizeof(t), a);
@@ -167,21 +167,21 @@ static void ar_callback(AvahiAddressResolver *r, gint iface, guchar protocol, Av
avahi_log_debug("AR: (%i.%i) %s -> <%s> [%s]", iface, protocol, t, hostname ? hostname : "n/a", event == AVAHI_RESOLVER_FOUND ? "found" : "timeout");
}
-static void db_callback(AvahiDomainBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *domain, gpointer userdata) {
+static void db_callback(AvahiDomainBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *domain, gpointer userdata) {
avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove");
}
-static void stb_callback(AvahiServiceTypeBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *service_type, const gchar *domain, gpointer userdata) {
+static void stb_callback(AvahiServiceTypeBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *service_type, const gchar *domain, gpointer userdata) {
avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove");
}
-static void sb_callback(AvahiServiceBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *name, const gchar *service_type, const gchar *domain, gpointer userdata) {
+static void sb_callback(AvahiServiceBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *name, const gchar *service_type, const gchar *domain, gpointer userdata) {
avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove");
}
-static void sr_callback(AvahiServiceResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *name, const gchar*service_type, const gchar*domain_name, const gchar*hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt, gpointer userdata) {
+static void sr_callback(AvahiServiceResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *name, const gchar*service_type, const gchar*domain_name, const gchar*hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt, gpointer userdata) {
if (event == AVAHI_RESOLVER_TIMEOUT)
avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s> [timeout]", iface, protocol, name, service_type, domain_name);
@@ -196,7 +196,7 @@ static void sr_callback(AvahiServiceResolver *r, gint iface, guchar protocol, Av
}
}
-static void dsb_callback(AvahiDNSServerBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar*hostname, const AvahiAddress *a, guint16 port, gpointer userdata) {
+static void dsb_callback(AvahiDNSServerBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar*hostname, const AvahiAddress *a, guint16 port, gpointer userdata) {
gchar t[64];
avahi_address_snprint(t, sizeof(t), a);
avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, event == AVAHI_BROWSER_NEW ? "new" : "remove");
diff --git a/avahi-core/browse-dns-server.c b/avahi-core/browse-dns-server.c
index 9dd4798..f8e8f30 100644
--- a/avahi-core/browse-dns-server.c
+++ b/avahi-core/browse-dns-server.c
@@ -35,8 +35,8 @@ typedef struct AvahiDNSServerInfo AvahiDNSServerInfo;
struct AvahiDNSServerInfo {
AvahiDNSServerBrowser *browser;
- gint interface;
- guchar protocol;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
AvahiRecord *srv_record;
AvahiHostNameResolver *host_name_resolver;
AvahiAddress address;
@@ -51,7 +51,7 @@ struct AvahiDNSServerBrowser {
AvahiRecordBrowser *record_browser;
AvahiDNSServerBrowserCallback callback;
gpointer userdata;
- guchar aprotocol;
+ AvahiProtocol aprotocol;
guint n_info;
@@ -59,7 +59,7 @@ struct AvahiDNSServerBrowser {
AVAHI_LLIST_HEAD(AvahiDNSServerInfo, info);
};
-static AvahiDNSServerInfo* get_server_info(AvahiDNSServerBrowser *b, gint interface, guchar protocol, AvahiRecord *r) {
+static AvahiDNSServerInfo* get_server_info(AvahiDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) {
AvahiDNSServerInfo *i;
g_assert(b);
@@ -90,7 +90,7 @@ static void server_info_free(AvahiDNSServerBrowser *b, AvahiDNSServerInfo *i) {
g_free(i);
}
-static void host_name_resolver_callback(AvahiHostNameResolver *r, gint interface, guchar protocol, AvahiResolverEvent event, const gchar *host_name, const AvahiAddress *a, gpointer userdata) {
+static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar *host_name, const AvahiAddress *a, gpointer userdata) {
AvahiDNSServerInfo *i = userdata;
g_assert(r);
@@ -107,7 +107,7 @@ static void host_name_resolver_callback(AvahiHostNameResolver *r, gint interface
i->host_name_resolver = NULL;
}
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiDNSServerBrowser *b = userdata;
g_assert(rr);
@@ -148,7 +148,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, gucha
}
}
-AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *domain, AvahiDNSServerType type, guchar aprotocol, AvahiDNSServerBrowserCallback callback, gpointer userdata) {
+AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *domain, AvahiDNSServerType type, AvahiProtocol aprotocol, AvahiDNSServerBrowserCallback callback, gpointer userdata) {
AvahiDNSServerBrowser *b;
AvahiKey *k;
gchar *n = NULL;
diff --git a/avahi-core/browse-domain.c b/avahi-core/browse-domain.c
index 30745f6..c6331b4 100644
--- a/avahi-core/browse-domain.c
+++ b/avahi-core/browse-domain.c
@@ -38,7 +38,7 @@ struct AvahiDomainBrowser {
AVAHI_LLIST_FIELDS(AvahiDomainBrowser, browser);
};
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiDomainBrowser *b = userdata;
gchar *n;
@@ -53,7 +53,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, gucha
g_free(n);
}
-AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *domain, AvahiDomainBrowserType type, AvahiDomainBrowserCallback callback, gpointer userdata) {
+AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *domain, AvahiDomainBrowserType type, AvahiDomainBrowserCallback callback, gpointer userdata) {
AvahiDomainBrowser *b;
AvahiKey *k;
gchar *n = NULL;
diff --git a/avahi-core/browse-service-type.c b/avahi-core/browse-service-type.c
index bc0e0fc..7cd6cf7 100644
--- a/avahi-core/browse-service-type.c
+++ b/avahi-core/browse-service-type.c
@@ -41,7 +41,7 @@ struct AvahiServiceTypeBrowser {
AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, browser);
};
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiServiceTypeBrowser *b = userdata;
gchar *n, *e, *c;
@@ -82,7 +82,7 @@ fail:
g_free(n);
}
-AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *domain, AvahiServiceTypeBrowserCallback callback, gpointer userdata) {
+AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, gint interface, AvahiProtocol protocol, const gchar *domain, AvahiServiceTypeBrowserCallback callback, gpointer userdata) {
AvahiServiceTypeBrowser *b;
AvahiKey *k;
gchar *n = NULL;
diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c
index 500ec31..f72ce6c 100644
--- a/avahi-core/browse-service.c
+++ b/avahi-core/browse-service.c
@@ -42,7 +42,7 @@ struct AvahiServiceBrowser {
AVAHI_LLIST_FIELDS(AvahiServiceBrowser, browser);
};
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiServiceBrowser *b = userdata;
gchar *n, *e, *c, *s;
gchar service[128];
@@ -84,7 +84,7 @@ fail:
g_free(n);
}
-AvahiServiceBrowser *avahi_service_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *service_type, const gchar *domain, AvahiServiceBrowserCallback callback, gpointer userdata) {
+AvahiServiceBrowser *avahi_service_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *service_type, const gchar *domain, AvahiServiceBrowserCallback callback, gpointer userdata) {
AvahiServiceBrowser *b;
AvahiKey *k;
gchar *n = NULL;
diff --git a/avahi-core/browse.c b/avahi-core/browse.c
index 897cb2b..5f4d216 100644
--- a/avahi-core/browse.c
+++ b/avahi-core/browse.c
@@ -32,8 +32,8 @@ struct AvahiRecordBrowser {
AvahiServer *server;
AvahiKey *key;
- gint interface;
- guchar protocol;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
guint sec_delay;
AvahiTimeEvent *time_event;
@@ -116,7 +116,7 @@ static gboolean scan_idle_callback(gpointer data) {
return FALSE;
}
-AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, gint interface, guchar protocol, AvahiKey *key, AvahiRecordBrowserCallback callback, gpointer userdata) {
+AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key, AvahiRecordBrowserCallback callback, gpointer userdata) {
AvahiRecordBrowser *b, *t;
GTimeVal tv;
diff --git a/avahi-core/core.h b/avahi-core/core.h
index c09aec4..bacb97e 100644
--- a/avahi-core/core.h
+++ b/avahi-core/core.h
@@ -253,7 +253,7 @@ gint avahi_server_add_txt_strlst(
AvahiEntryFlags flags,
guint32 ttl,
const gchar *name,
- AvahiStringList *strlst /**< TXT decord data as a AvahiString. Only the pointer to the object and not the object itself is copied into the RR. Therefore you should not free the strlst object yourself, this will be done by the library. If you want to add multiple records with the same RR data you MUST copy the strlst object prior to calling this function with avahi_strlst_copy(). */ );
+ AvahiStringList *strlst /**< TXT decord data as a AvahiString. This routine makes a deep copy of this object. */ );
/** Add an IP address mapping to the server. This will add both the
* host-name-to-address and the reverse mapping to the server. See
@@ -302,7 +302,7 @@ gint avahi_server_add_service_va(
guint16 port,
va_list va);
-/** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records. The AvahiStringList object is not copied. You need to make a copy if this object if you want to reuse it. The object is freed if the RR is removed from the server. */
+/** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records. The AvahiStringList object is copied. */
gint avahi_server_add_service_strlst(
AvahiServer *s,
AvahiEntryGroup *g,
diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
index a4ed594..d315ac9 100644
--- a/avahi-core/resolve-address.c
+++ b/avahi-core/resolve-address.c
@@ -40,7 +40,7 @@ struct AvahiAddressResolver {
AVAHI_LLIST_FIELDS(AvahiAddressResolver, resolver);
};
-static void finish(AvahiAddressResolver *r, gint interface, guchar protocol, AvahiResolverEvent event, AvahiRecord *record) {
+static void finish(AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) {
g_assert(r);
avahi_record_browser_free(r->record_browser);
@@ -54,7 +54,7 @@ static void finish(AvahiAddressResolver *r, gint interface, guchar protocol, Ava
r->callback(r, interface, protocol, event, &r->address, record ? record->data.ptr.name : NULL, r->userdata);
}
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiAddressResolver *r = userdata;
g_assert(rr);
@@ -78,7 +78,7 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
finish(r, -1, AVAHI_PROTO_UNSPEC, AVAHI_RESOLVER_TIMEOUT, NULL);
}
-AvahiAddressResolver *avahi_address_resolver_new(AvahiServer *server, gint interface, guchar protocol, const AvahiAddress *address, AvahiAddressResolverCallback callback, gpointer userdata) {
+AvahiAddressResolver *avahi_address_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const AvahiAddress *address, AvahiAddressResolverCallback callback, gpointer userdata) {
AvahiAddressResolver *r;
AvahiKey *k;
gchar *n;
diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c
index fadfc85..0ab2e73 100644
--- a/avahi-core/resolve-host-name.c
+++ b/avahi-core/resolve-host-name.c
@@ -41,7 +41,7 @@ struct AvahiHostNameResolver {
AVAHI_LLIST_FIELDS(AvahiHostNameResolver, resolver);
};
-static void finish(AvahiHostNameResolver *r, gint interface, guchar protocol, AvahiResolverEvent event, AvahiRecord *record) {
+static void finish(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) {
AvahiAddress a;
g_assert(r);
@@ -81,7 +81,7 @@ static void finish(AvahiHostNameResolver *r, gint interface, guchar protocol, Av
r->callback(r, interface, protocol, event, record ? record->key->name : r->host_name, record ? &a : NULL, r->userdata);
}
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiHostNameResolver *r = userdata;
g_assert(rr);
@@ -104,7 +104,7 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
finish(r, -1, AVAHI_PROTO_UNSPEC, AVAHI_RESOLVER_TIMEOUT, NULL);
}
-AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, gint interface, guchar protocol, const gchar *host_name, guchar aprotocol, AvahiHostNameResolverCallback callback, gpointer userdata) {
+AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *host_name, guchar aprotocol, AvahiHostNameResolverCallback callback, gpointer userdata) {
AvahiHostNameResolver *r;
AvahiKey *k;
GTimeVal tv;
diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c
index cf07d91..b15af4f 100644
--- a/avahi-core/resolve-service.c
+++ b/avahi-core/resolve-service.c
@@ -33,10 +33,10 @@ struct AvahiServiceResolver {
gchar *service_name;
gchar *service_type;
gchar *domain_name;
- guchar address_protocol;
+ AvahiProtocol address_protocol;
- gint interface;
- guchar protocol;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
AvahiRecordBrowser *record_browser_srv;
AvahiRecordBrowser *record_browser_txt;
@@ -121,7 +121,7 @@ static void finish(AvahiServiceResolver *r, AvahiResolverEvent event) {
}
}
-static void record_browser_callback(AvahiRecordBrowser*rr, gint interface, guchar protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
+static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, gpointer userdata) {
AvahiServiceResolver *r = userdata;
g_assert(rr);
@@ -192,7 +192,7 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
finish(r, AVAHI_RESOLVER_TIMEOUT);
}
-AvahiServiceResolver *avahi_service_resolver_new(AvahiServer *server, gint interface, guchar protocol, const gchar *name, const gchar *type, const gchar *domain, guchar aprotocol, AvahiServiceResolverCallback callback, gpointer userdata) {
+AvahiServiceResolver *avahi_service_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const gchar *name, const gchar *type, const gchar *domain, AvahiProtocol aprotocol, AvahiServiceResolverCallback callback, gpointer userdata) {
AvahiServiceResolver *r;
AvahiKey *k;
GTimeVal tv;
diff --git a/avahi-core/server.c b/avahi-core/server.c
index bd4f536..4507aea 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -1435,7 +1435,7 @@ void avahi_server_free(AvahiServer* s) {
g_free(s);
}
-static gint check_record_conflict(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *r, AvahiEntryFlags flags) {
+static gint check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiEntryFlags flags) {
AvahiEntry *e;
g_assert(s);
@@ -1468,8 +1468,8 @@ static gint check_record_conflict(AvahiServer *s, gint interface, guchar protoco
gint avahi_server_add(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
AvahiRecord *r) {
@@ -1559,8 +1559,8 @@ void avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, gpointer user
gint avahi_server_add_ptr(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
guint32 ttl,
const gchar *name,
@@ -1581,8 +1581,8 @@ gint avahi_server_add_ptr(
gint avahi_server_add_address(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
const gchar *name,
AvahiAddress *a) {
@@ -1630,11 +1630,11 @@ gint avahi_server_add_address(
return ret;
}
-gint avahi_server_add_txt_strlst(
+static gint server_add_txt_strlst_nocopy(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
guint32 ttl,
const gchar *name,
@@ -1653,26 +1653,39 @@ gint avahi_server_add_txt_strlst(
return ret;
}
+gint avahi_server_add_txt_strlst(
+ AvahiServer *s,
+ AvahiEntryGroup *g,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiEntryFlags flags,
+ guint32 ttl,
+ const gchar *name,
+ AvahiStringList *strlst) {
+
+ return server_add_txt_strlst_nocopy(s, g, interface, protocol, flags, ttl, name, avahi_string_list_copy(strlst));
+}
+
gint avahi_server_add_txt_va(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
guint32 ttl,
const gchar *name,
va_list va) {
-
+
g_assert(s);
- return avahi_server_add_txt_strlst(s, g, interface, protocol, flags, ttl, name, avahi_string_list_new_va(va));
+ return server_add_txt_strlst_nocopy(s, g, interface, protocol, flags, ttl, name, avahi_string_list_new_va(va));
}
gint avahi_server_add_txt(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
AvahiEntryFlags flags,
guint32 ttl,
const gchar *name,
@@ -1712,11 +1725,11 @@ static void escape_service_name(gchar *d, guint size, const gchar *s) {
*(d++) = 0;
}
-gint avahi_server_add_service_strlst(
+static gint server_add_service_strlst_nocopy(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
const gchar *name,
const gchar *type,
const gchar *domain,
@@ -1760,7 +1773,7 @@ gint avahi_server_add_service_strlst(
ret |= avahi_server_add(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, r);
avahi_record_unref(r);
- ret |= avahi_server_add_txt_strlst(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
+ ret |= server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
g_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);
@@ -1771,11 +1784,26 @@ gint avahi_server_add_service_strlst(
return ret;
}
+gint avahi_server_add_service_strlst(
+ AvahiServer *s,
+ AvahiEntryGroup *g,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar *name,
+ const gchar *type,
+ const gchar *domain,
+ const gchar *host,
+ guint16 port,
+ AvahiStringList *strlst) {
+
+ return server_add_service_strlst_nocopy(s, g, interface, protocol, name, type, domain, host, port, avahi_string_list_copy(strlst));
+}
+
gint avahi_server_add_service_va(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
const gchar *name,
const gchar *type,
const gchar *domain,
@@ -1787,14 +1815,14 @@ gint avahi_server_add_service_va(
g_assert(type);
g_assert(name);
- return avahi_server_add_service_strlst(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, name, type, domain, host, port, avahi_string_list_new_va(va));
}
gint avahi_server_add_service(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
const gchar *name,
const gchar *type,
const gchar *domain,
@@ -1840,8 +1868,8 @@ static void hexstring(gchar *s, size_t sl, const void *p, size_t pl) {
gint avahi_server_add_dns_server_address(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
const gchar *domain,
AvahiDNSServerType type,
const AvahiAddress *address,
@@ -1877,8 +1905,8 @@ gint avahi_server_add_dns_server_address(
gint avahi_server_add_dns_server_name(
AvahiServer *s,
AvahiEntryGroup *g,
- gint interface,
- guchar protocol,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
const gchar *domain,
AvahiDNSServerType type,
const gchar *name,
@@ -1923,7 +1951,7 @@ static void post_query_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, gpo
avahi_interface_post_query(i, k, FALSE);
}
-void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key) {
+void avahi_server_post_query(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key) {
g_assert(s);
g_assert(key);
diff --git a/avahi-core/server.h b/avahi-core/server.h
index 9a1fca3..97febc5 100644
--- a/avahi-core/server.h
+++ b/avahi-core/server.h
@@ -55,8 +55,8 @@ struct AvahiEntry {
AvahiEntryFlags flags;
AvahiRecord *record;
- gint interface;
- guchar protocol;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
AVAHI_LLIST_FIELDS(AvahiEntry, entries);
AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
@@ -133,7 +133,7 @@ struct AvahiServer {
gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i);
-void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key);
+void avahi_server_post_query(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key);
void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, gboolean unicast_response, gboolean auxiliary);
void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, gboolean unicast_response);