tests \
service-type-database \
avahi-compat-libdns_sd \
- avahi-compat-howl
+ avahi-compat-howl
DX_INPUT = \
noinst_HEADERS = internal.h
+if ENABLE_TESTS
+
noinst_PROGRAMS = \
client-test \
srv-test
+endif
+
lib_LTLIBRARIES = libavahi-client.la
libavahi_client_la_SOURCES = \
llist.h \
rlist.h
+if ENABLE_TESTS
noinst_PROGRAMS = \
strlst-test \
domain-test \
alternative-test \
timeval-test \
watch-test
+endif
lib_LTLIBRARIES = \
libavahi-common.la
/** 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 */
/** Some flags for lookup functions */
typedef enum {
- AVAHI_LOOKUP_NULL = 0,
AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */
AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */
AVAHI_LOOKUP_NO_TXT = 4, /**< When doing service resolving, don't lookup TXT record */
/** Some flags for lookup callback functions */
typedef enum {
- AVAHI_LOOKUP_RESULT_NULL = 0,
AVAHI_LOOKUP_RESULT_CACHED = 1, /**< This response originates from the cache */
AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, /**< This response originates from wide area DNS */
AVAHI_LOOKUP_RESULT_MULTICAST = 4, /**< This response originates from multicast DNS */
return AVAHI_OK;
}
+#ifndef HAVE_STRLCPY
-char *avahi_strlcpy(char *dest, const char *src, size_t n) {
+static size_t strlcpy(char *dest, const char *src, size_t n) {
assert(dest);
assert(src);
-
- if (n == 0)
- return dest;
-
- strncpy(dest, src, n-1);
- dest[n-1] = 0;
- return dest;
+
+ if (n > 0) {
+ strncpy(dest, src, n-1);
+ dest[n-1] = 0;
+ }
+
+ return strlen(src);
}
+#endif
+
int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size) {
enum {
NAME,
switch (state) {
case NAME:
- avahi_strlcpy(name, buf, name_size);
+ strlcpy(name, buf, name_size);
state = TYPE;
break;
SUBDIRS = . samples
if HAVE_DBUS
+if ENABLE_COMPAT_HOWL
avahi_compat_howldir=$(includedir)/avahi-compat-howl
avahi_compat_howl_rendezvousdir=$(avahi_compat_howldir)/rendezvous
lib_LTLIBRARIES = libavahi-compat-howl.la
+if ENABLE_TESTS
noinst_PROGRAMS = address-test text-test browse-domain-test
+endif
libavahi_compat_howl_la_SOURCES = \
$(HOWLHEADERS) \
browse_domain_test_LDADD = $(AM_LDADD) libavahi-compat-howl.la
endif
+endif
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
if HAVE_DBUS
+if ENABLE_COMPAT_HOWL
+if ENABLE_TESTS
noinst_PROGRAMS = browse resolve publish query
+endif
browse_SOURCES = \
browse.c
query_LDADD = $(AM_LDADD) ../libavahi-compat-howl.la
endif
+endif
int buffer_valid;
};
+#ifndef HAVE_STRLCPY
+
+static size_t strlcpy(char *dest, const char *src, size_t n) {
+ assert(dest);
+ assert(src);
+
+ if (n > 0) {
+ strncpy(dest, src, n-1);
+ dest[n-1] = 0;
+ }
+
+ return strlen(src);
+}
+
+#endif
+
sw_result sw_text_record_init(sw_text_record *self) {
assert(self);
if (avahi_string_list_get_pair(self->index, &mkey, &mvalue, &msize) < 0)
return SW_E_UNKNOWN;
- avahi_strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
+ strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
memset(val, 0, SW_TEXT_RECORD_MAX_LEN);
memcpy(val, mvalue, msize);
*val_len = msize;
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
if HAVE_DBUS
+if ENABLE_COMPAT_LIBDNS_SD
avahi_compat_libdns_sddir=$(includedir)/avahi-compat-libdns_sd
lib_LTLIBRARIES = libavahi-compat-libdns_sd.la
+if ENABLE_TESTS
noinst_PROGRAMS = txt-test
+endif
libavahi_compat_libdns_sd_la_SOURCES = \
dns_sd.h \
CLEANFILES = libdns_sd-test.o libdns_sd-test
endif
+endif
lib_LTLIBRARIES = \
libavahi-core.la
+if ENABLE_TESTS
noinst_PROGRAMS = \
prioq-test \
avahi-test \
hashmap-test \
querier-test \
update-test
+endif
libavahi_core_la_SOURCES = \
timeeventq.c timeeventq.h\
r->data.srv.weight = 0;
r->data.srv.port = port;
r->data.srv.name = n;
- ret = avahi_server_add(s, g, interface, protocol, AVAHI_PUBLISH_NULL, r);
+ ret = avahi_server_add(s, g, interface, protocol, 0, r);
avahi_record_unref(r);
return ret;
sbin_PROGRAMS = \
avahi-daemon
+if ENABLE_TESTS
noinst_PROGRAMS = \
ini-file-parser-test
+endif
avahi_daemon_SOURCES = \
main.c main.h \
BROWSING
} state = ACKWAIT;
-static int quit = 0;
-
static enum {
DAEMON_RUN,
DAEMON_KILL,
DAEMON_CHECK
} command = DAEMON_RUN;
+static int quit = 0;
static int daemonize = 0;
+#if !HAVE_DECL_ENVIRON
+extern char **environ;
+#endif
+
typedef struct DNSServerInfo DNSServerInfo;
struct DNSServerInfo {
return r;
}
-static char *getifname(AvahiIfIndex interface, char *name, size_t len) {
- int fd = -1;
- char *ret = NULL;
- struct ifreq ifr;
-
- assert(interface >= 0);
-
- if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
- daemon_log(LOG_ERR, "socket(): %s", strerror(errno));
- goto finish;
- }
-
- memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_ifindex = (int) interface;
-
- if (ioctl(fd, SIOCGIFNAME, &ifr) < 0) {
- daemon_log(LOG_ERR, "SIOCGIFNAME: %s\n", strerror(errno));
- goto finish;
- }
-
- strncpy(name, ifr.ifr_name, len-1);
- name[len-1] = 0;
- ret = name;
-
-finish:
- if (fd >= 0)
- close(fd);
-
- return ret;
-}
-
static void set_env(const char *name, const char *value) {
char **e;
size_t l;
char *p;
int ret;
char ia[16], pa[16];
- char name[IFNAMSIZ+1];
+ char name[IF_NAMESIZE];
assert(interface > 0);
- if (!getifname(interface, name, sizeof(name)))
+ if (!if_indextoname(interface, name))
return;
p = concat_dns_servers(interface);
lib_LTLIBRARIES = \
libavahi-glib.la
+if ENABLE_TESTS
+
noinst_PROGRAMS = \
glib-watch-test
+endif
+
libavahi_glib_la_SOURCES = \
glib-watch.c glib-watch.h \
glib-malloc.h glib-malloc.c
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_MALLOC
AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday putenv strncasecmp])
+AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday putenv strncasecmp strclpy])
AC_FUNC_CHOWN
AC_FUNC_STAT
AC_TYPE_MODE_T
AC_TYPE_PID_T
+AC_CHECK_DECLS(environ)
+
# Check for pkg-config manually first, as if its not installed the
# PKG_PROG_PKG_CONFIG macro won't be defined.
AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
fi
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
-
-
#
# D-BUS
#
AC_SUBST(avahi_runtime_dir)
AC_SUBST(avahi_socket)
-
#
# Avahi interfaces dir
#
AC_SUBST(interfacesdir)
fi
-
#
# Doxygen
#
AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
+#
+# Conditionally compile test and example programs
+#
+AC_ARG_ENABLE(tests,
+ AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
+ [case "${enableval}" in
+ yes) ENABLE_TESTS=yes ;;
+ no) ENABLE_TESTS=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
+ esac],
+ [ENABLE_TESTS=no])
+
+AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
+
+#
+# Optionally enable libdns_sd compatibility support
+#
+AC_ARG_ENABLE(compat-libdns_sd,
+ AS_HELP_STRING([--enable-compat-libdns_sd],[Enable compatibility layer for libdns_sd]),
+ [case "${enableval}" in
+ yes) ENABLE_COMPAT_LIBDNS_SD=yes ;;
+ no) ENABLE_COMPAT_LIBDNS_SD=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libdns_sd) ;;
+ esac],
+ [ENABLE_COMPAT_LIBDNS_SD=no])
+
+AM_CONDITIONAL([ENABLE_COMPAT_LIBDNS_SD], [test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes"])
+
+#
+# Optionally enable HOWL compatibility support
+#
+AC_ARG_ENABLE(compat-howl,
+ AS_HELP_STRING([--enable-compat-howl],[Enable compatibility layer for HOWL]),
+ [case "${enableval}" in
+ yes) ENABLE_COMPAT_HOWL=yes ;;
+ no) ENABLE_COMPAT_HOWL=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-howl) ;;
+ esac],
+ [ENABLE_COMPAT_HOWL=no])
+
+AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
+
+
# ==========================================================================
AC_CONFIG_FILES([
Makefile
BUILD_CLIENT=yes
fi
+if test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
+ AC_MSG_ERROR([building avahi-compat-libdns_sd without building libavahi-client doesn't work])
+fi
+if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
+ AC_MSG_ERROR([building avahi-compat-howl without building libavahi-client doesn't work])
+fi
+
+
echo "
Building libavahi-core yes
Building avahi-daemon: ${BUILD_DAEMON}
Building libavahi-qt3: ${HAVE_QT3}
Building libavahi-qt4: ${HAVE_QT4}
Building avahi-sharp: ${HAVE_MONO}
- Building avahi-compat-libdns_sd: ${BUILD_CLIENT}
- Building avahi-compat-howl: ${BUILD_CLIENT}
+ Building avahi-compat-libdns_sd: ${ENABLE_COMPAT_LIBDNS_SD}
+ Building avahi-compat-howl: ${ENABLE_COMPAT_HOWL}
+ Building tests: ${ENABLE_TESTS}
"
* add API to allow user to tell the server that some service is not reachable
* generate local CNAME responses
* drop partially created created entries on failure
+* add error state for server and entry group
* add support for subtypes in static services
* Add static host configuration like static services [lathiat]
* wrap avahi_server_add_record() via DBUS and in avahi-client [lathiat]
AM_CFLAGS=-I$(top_srcdir)
+if ENABLE_TESTS
noinst_PROGRAMS = \
core-publish-service \
core-browse-services
+endif
core_publish_service_SOURCES = core-publish-service.c
core_publish_service_CFLAGS = $(AM_CFLAGS)
if HAVE_DBUS
+if ENABLE_TESTS
noinst_PROGRAMS += \
client-publish-service \
client-browse-services
+endif
+
client_publish_service_SOURCES = client-publish-service.c
client_publish_service_CFLAGS = $(AM_CFLAGS)
client_publish_service_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
if HAVE_GLIB
+if ENABLE_TESTS
noinst_PROGRAMS += \
glib-integration
+endif
+
glib_integration_SOURCES = glib-integration.c
glib_integration_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
glib_integration_LDADD = $(AM_LDADD) $(GLIB20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la ../avahi-glib/libavahi-glib.la
if HAVE_DBUS
if HAVE_NETLINK
+if ENABLE_TESTS
noinst_PROGRAMS = c-plus-plus-test
+endif
c_plus_plus_test_SOURCES = c-plus-plus-test.cc