aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-08-01 17:42:51 -0600
committerEric Blake <eblake@redhat.com>2012-08-02 13:35:21 -0600
commit1f6f723ce1de27a7b5065359638d7f543dde34c0 (patch)
tree30aeeec7ca54322d1003f1aa35448890e7b9b9a1 /src/rpc/virnetservermdns.c
parentvirsh: Switch to close callback (diff)
downloadlibvirt-1f6f723ce1de27a7b5065359638d7f543dde34c0.tar.gz
libvirt-1f6f723ce1de27a7b5065359638d7f543dde34c0.tar.bz2
libvirt-1f6f723ce1de27a7b5065359638d7f543dde34c0.zip
build: add stubs so mdns code can be unconditionally compiled
The recent changes to the testsuite to validate exported symbols flushed out a case of unconditionally exporting symbols that were only conditionally compiled under HAVE_AVAHI. * src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile virnetservermdns unconditionally. * configure.ac (HAVE_AVAHI): Drop unused automake conditional. * src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not present.
Diffstat (limited to 'src/rpc/virnetservermdns.c')
-rw-r--r--src/rpc/virnetservermdns.c98
1 files changed, 90 insertions, 8 deletions
diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c
index 274be19b4..7c43c400e 100644
--- a/src/rpc/virnetservermdns.c
+++ b/src/rpc/virnetservermdns.c
@@ -1,7 +1,7 @@
/*
* virnetservermdns.c: advertise server sockets
*
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011-2012 Red Hat, Inc.
* Copyright (C) 2007 Daniel P. Berrange
*
* Derived from Avahi example service provider code.
@@ -29,14 +29,16 @@
#include <stdio.h>
#include <stdlib.h>
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
+#if HAVE_AVAHI
+# include <avahi-client/client.h>
+# include <avahi-client/publish.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
+# include <avahi-common/alternative.h>
+# include <avahi-common/simple-watch.h>
+# include <avahi-common/malloc.h>
+# include <avahi-common/error.h>
+# include <avahi-common/timeval.h>
+#endif
#include "virnetservermdns.h"
#include "event.h"
@@ -55,18 +57,23 @@ struct _virNetServerMDNSEntry {
struct _virNetServerMDNSGroup {
virNetServerMDNSPtr mdns;
+#if HAVE_AVAHI
AvahiEntryGroup *handle;
+#endif
char *name;
virNetServerMDNSEntryPtr entry;
virNetServerMDNSGroupPtr next;
};
struct _virNetServerMDNS {
+#if HAVE_AVAHI
AvahiClient *client;
AvahiPoll *poller;
+#endif
virNetServerMDNSGroupPtr group;
};
+#if HAVE_AVAHI
/* Avahi API requires this struct name in the app :-( */
struct AvahiWatch {
int watch;
@@ -612,3 +619,78 @@ void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry)
VIR_FREE(entry->type);
VIR_FREE(entry);
}
+
+#else /* ! HAVE_AVAHI */
+
+static const char *unsupported = N_("avahi not available at build time");
+
+virNetServerMDNS *
+virNetServerMDNSNew(void)
+{
+ VIR_DEBUG("%s", _(unsupported));
+ return NULL;
+}
+
+int
+virNetServerMDNSStart(virNetServerMDNS *mdns ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+ return -1;
+}
+
+virNetServerMDNSGroupPtr
+virNetServerMDNSAddGroup(virNetServerMDNS *mdns ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+ return NULL;
+}
+
+void
+virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED,
+ virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+virNetServerMDNSEntryPtr
+virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
+ const char *type ATTRIBUTE_UNUSED,
+ int port ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+ return NULL;
+}
+
+void
+virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
+ virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+void
+virNetServerMDNSStop(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+void
+virNetServerMDNSFree(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+void
+virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+void
+virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("%s", _(unsupported));
+}
+
+#endif /* ! HAVE_AVAHI */