Commit 584e98b9 authored by W. Michael Petullo's avatar W. Michael Petullo

Drop support for ancient Avahi version

parent a2dd977b
Pipeline #194160 passed with stage
in 14 minutes and 2 seconds
......@@ -221,23 +221,9 @@ PKG_CHECK_MODULES(
AVAHI,
avahi-client >= 0.6
avahi-glib >= 0.6,
HAVE_AVAHI_06=yes,
HAVE_AVAHI_06=no
)
if test x$HAVE_AVAHI_06 != xyes; then
PKG_CHECK_MODULES(
AVAHI,
avahi-client >= 0.5
avahi-glib >= 0.5,
HAVE_AVAHI_05=yes,
HAVE_AVAHI_05=no
)
fi
if test x$HAVE_AVAHI_06 = xyes || test x$HAVE_AVAHI_05 = xyes; then
HAVE_AVAHI=yes
else
HAVE_AVAHI=yes,
HAVE_AVAHI=no
fi
)
AC_CHECK_HEADERS(dns_sd.h, HAVE_DNS_SD=yes)
if test x"$HAVE_DNS_SD" = xyes; then
......@@ -266,17 +252,11 @@ if test x"$WITH_MDNS" = xauto; then
)
USE_AVAHI=yes
AC_MSG_NOTICE([Detected Avahi; using it for mDNS/DNS-SD])
if test x$HAVE_AVAHI_06 = xyes; then
if test x$HAVE_AVAHI = xyes; then
AC_DEFINE(
HAVE_AVAHI_0_6,
HAVE_AVAHI,
1,
[Define if mDNS/DNS-SD implementation uses Avahi 0.6]
)
else
AC_DEFINE(
HAVE_AVAHI_0_5,
1,
[Define if mDNS/DNS-SD implementation uses Avahi 0.5]
[Define if mDNS/DNS-SD implementation uses Avahi]
)
fi
......@@ -297,10 +277,8 @@ if test x"$WITH_MDNS" = xavahi; then
USE_AVAHI=yes
AC_MSG_NOTICE([Using Avahi for mDNS/DNS-SD])
if test x$HAVE_AVAHI_06 = xyes; then
AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
else
AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
if test x$HAVE_AVAHI = xyes; then
AC_DEFINE(HAVE_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
fi
HAVE_MDNS=yes
......
......@@ -33,10 +33,8 @@
#include <glib/gi18n.h>
#include <glib-object.h>
#ifdef HAVE_AVAHI_0_6
#include <avahi-client/lookup.h>
#include <avahi-client/publish.h>
#endif
#include <avahi-client/client.h>
#include <avahi-common/error.h>
#include <avahi-glib/glib-malloc.h>
......@@ -59,10 +57,6 @@ enum
LAST_SIGNAL
};
#ifdef HAVE_AVAHI_0_5
#define AVAHI_ADDRESS_STR_MAX (40) /* IPv6 Max = 4*8 + 7 + 1 for NUL */
#endif
static void dmap_mdns_browser_class_init (DmapMdnsBrowserClass * klass);
static void dmap_mdns_browser_init (DmapMdnsBrowser * browser);
static void _dispose (GObject * object);
......@@ -78,9 +72,7 @@ static void _resolve_cb (AvahiServiceResolver * service_resolver,
const gchar * host_name,
const AvahiAddress * address,
uint16_t port, AvahiStringList * text,
#ifdef HAVE_AVAHI_0_6
AvahiLookupResultFlags flags,
#endif
DmapMdnsBrowser * browser);
static gboolean _resolve (DmapMdnsBrowser * browser,
const gchar * name,
......@@ -97,9 +89,7 @@ static void _browse_cb (AvahiServiceBrowser * service_browser,
const gchar * name,
const gchar * type,
const gchar * domain,
#ifdef HAVE_AVAHI_0_6
AvahiLookupResultFlags flags,
#endif
DmapMdnsBrowser * browser);
static guint _signals[LAST_SIGNAL] = { 0, };
......@@ -242,9 +232,7 @@ dmap_mdns_browser_start (DmapMdnsBrowser * browser, GError ** error)
_service_type_name[browser->
priv->service_type],
NULL,
#ifdef HAVE_AVAHI_0_6
0,
#endif
(AvahiServiceBrowserCallback)
_browse_cb, browser);
if (browser->priv->service_browser == NULL) {
......@@ -306,12 +294,10 @@ _client_cb (AvahiClient * client,
/* Called whenever the client or server state changes */
switch (state) {
#ifdef HAVE_AVAHI_0_6
case AVAHI_CLIENT_FAILURE:
g_warning ("Client failure: %s",
avahi_strerror (avahi_client_errno (client)));
break;
#endif
default:
break;
}
......@@ -321,6 +307,7 @@ static void
_client_init (DmapMdnsBrowser * browser)
{
gint error = 0;
AvahiClientFlags flags = 0;
avahi_set_allocator (avahi_glib_allocator ());
......@@ -329,23 +316,12 @@ _client_init (DmapMdnsBrowser * browser)
if (!browser->priv->poll) {
g_debug ("Unable to create AvahiGlibPoll object for mDNS");
}
#ifdef HAVE_AVAHI_0_5
browser->priv->client =
avahi_client_new (avahi_glib_poll_get (browser->priv->poll),
(AvahiClientCallback) _client_cb, browser,
&error);
#endif
#ifdef HAVE_AVAHI_0_6
{
AvahiClientFlags flags = 0;
browser->priv->client =
avahi_client_new (avahi_glib_poll_get
(browser->priv->poll), flags,
(AvahiClientCallback) _client_cb,
browser, &error);
}
#endif
avahi_client_new (avahi_glib_poll_get
(browser->priv->poll), flags,
(AvahiClientCallback) _client_cb,
browser, &error);
}
static void
......@@ -359,9 +335,7 @@ _resolve_cb (AvahiServiceResolver * service_resolver,
G_GNUC_UNUSED const gchar * host_name,
const AvahiAddress * address,
uint16_t port, AvahiStringList * text,
#ifdef HAVE_AVAHI_0_6
G_GNUC_UNUSED AvahiLookupResultFlags flags,
#endif
DmapMdnsBrowser * browser)
{
gchar *name = NULL;
......@@ -483,9 +457,7 @@ _resolve (DmapMdnsBrowser * browser,
[browser->priv->service_type],
domain,
AVAHI_PROTO_UNSPEC,
#ifdef HAVE_AVAHI_0_6
0,
#endif
(AvahiServiceResolverCallback) _resolve_cb, browser);
if (service_resolver == NULL) {
g_debug ("Error starting mDNS resolving using AvahiServiceResolver");
......@@ -524,21 +496,13 @@ _browse_cb (G_GNUC_UNUSED AvahiServiceBrowser * service_browser,
const gchar * name,
G_GNUC_UNUSED const gchar * type,
const gchar * domain,
#ifdef HAVE_AVAHI_0_6
AvahiLookupResultFlags flags,
#endif
DmapMdnsBrowser * browser)
{
gboolean local;
#ifdef HAVE_AVAHI_0_5
local = avahi_client_is_service_local (browser->priv->client,
interface, protocol, name,
type, domain);
#endif
#ifdef HAVE_AVAHI_0_6
local = ((flags & AVAHI_LOOKUP_RESULT_LOCAL) != 0);
#endif
if (local && getenv ("LIBDMAPSHARING_ENABLE_LOCAL") == NULL) {
g_debug ("Ignoring local service %s", name);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment