From: Michael R Sweet Date: Sat, 6 Mar 2021 15:17:55 +0000 (-0500) Subject: Modernize cups-dnssd autoconf source file. X-Git-Tag: v2.4b1~235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b61dfbe9b92aef948fda423725b18ccbece469;p=thirdparty%2Fcups.git Modernize cups-dnssd autoconf source file. Now use --with-dnssd=foo, where "foo" is "avahi", "mdnsresponder", "no", or "yes" (which auto-detects which DNS-SD client to use) HAVE_DNSSD now specifies DNS-SD support is available. HAVE_MDNSRESPONDER now specifies that mDNSResponder is being used vs HAVE_AVAHI for Avahi. --- diff --git a/backend/dnssd.c b/backend/dnssd.c index fde79ecb97..e570291780 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -1,6 +1,7 @@ /* * DNS-SD discovery backend for CUPS. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2008-2018 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more @@ -13,9 +14,9 @@ #include "backend-private.h" #include -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI # include # include @@ -44,9 +45,9 @@ typedef enum typedef struct { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceRef ref; /* Service reference for query */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI AvahiRecordBrowser *ref; /* Browser for query */ #endif /* HAVE_AVAHI */ @@ -81,10 +82,10 @@ static int browsers = 0; /* Number of running browsers */ * Local functions... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8); static void browse_local_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI static void browse_callback(AvahiServiceBrowser *browser, AvahiIfIndex interface, @@ -103,7 +104,7 @@ static void client_callback(AvahiClient *client, static int compare_devices(cups_device_t *a, cups_device_t *b); static void exec_backend(char **argv) _CUPS_NORETURN; static cups_device_t *get_device(cups_array_t *devices, const char *serviceName, const char *regtype, const char *replyDomain) _CUPS_NONNULL(1,2,3,4); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void query_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullName, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context) _CUPS_NONNULL(1,5,9,11); #elif defined(HAVE_AVAHI) static int poll_callback(struct pollfd *pollfds, @@ -118,7 +119,7 @@ static void query_callback(AvahiRecordBrowser *browser, size_t rdlen, AvahiLookupResultFlags flags, void *context); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ static void sigterm_handler(int sig); static void unquote(char *dst, const char *src, size_t dstsize) _CUPS_NONNULL(1,2); @@ -135,7 +136,7 @@ main(int argc, /* I - Number of command-line args */ cups_array_t *devices; /* Device array */ cups_device_t *device; /* Current device */ char uriName[1024]; /* Unquoted fullName for URI */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER int fd; /* Main file descriptor */ fd_set input; /* Input set for select() */ struct timeval timeout; /* Timeout for select() */ @@ -152,7 +153,7 @@ main(int argc, /* I - Number of command-line args */ pdl_datastream_ref, /* AppSocket service reference */ printer_ref, /* LPD service reference */ riousbprint_ref; /* Remote IO service reference */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI AvahiClient *client; /* Client information */ int error; /* Error code, if any */ @@ -216,7 +217,7 @@ main(int argc, /* I - Number of command-line args */ * Browse for different kinds of printers... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError) { perror("ERROR: Unable to create service connection"); @@ -277,7 +278,7 @@ main(int argc, /* I - Number of command-line args */ riousbprint_ref = main_ref; DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0, "_riousbprint._tcp", NULL, browse_callback, devices); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI if ((simple_poll = avahi_simple_poll_new()) == NULL) @@ -333,7 +334,7 @@ main(int argc, /* I - Number of command-line args */ { int announce = 0; /* Announce printers? */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER FD_ZERO(&input); FD_SET(fd, &input); @@ -369,7 +370,7 @@ main(int argc, /* I - Number of command-line args */ if (!got_data) announce = 1; -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* fprintf(stderr, "DEBUG: announce=%d\n", announce);*/ @@ -379,9 +380,9 @@ main(int argc, /* I - Number of command-line args */ * Announce any devices we've found... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceErrorType status; /* DNS query status */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ cups_device_t *best; /* Best matching device */ char device_uri[1024]; /* Device URI */ int count; /* Number of queries */ @@ -408,7 +409,7 @@ main(int argc, /* I - Number of command-line args */ { fprintf(stderr, "DEBUG: Querying \"%s\"...\n", device->fullName); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER device->ref = main_ref; status = DNSServiceQueryRecord(&(device->ref), @@ -446,7 +447,7 @@ main(int argc, /* I - Number of command-line args */ } else if (!device->sent) { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER /* * Got the TXT records, now report the device... */ @@ -454,7 +455,7 @@ main(int argc, /* I - Number of command-line args */ DNSServiceRefDeallocate(device->ref); #else avahi_record_browser_free(device->ref); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ device->ref = NULL; @@ -535,7 +536,7 @@ main(int argc, /* I - Number of command-line args */ } -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER /* * 'browse_callback()' - Browse devices. */ @@ -618,7 +619,7 @@ browse_local_callback( device->fullName); device->sent = 1; } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI @@ -867,13 +868,13 @@ get_device(cups_array_t *devices, /* I - Device array */ free(device->domain); device->domain = strdup(replyDomain); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceConstructFullName(fullName, device->name, regtype, replyDomain); #else /* HAVE_AVAHI */ avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName, regtype, replyDomain); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ free(device->fullName); device->fullName = strdup(fullName); @@ -898,11 +899,11 @@ get_device(cups_array_t *devices, /* I - Device array */ * Set the "full name" of this service, which is used for queries... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain); #else /* HAVE_AVAHI */ avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName, regtype, replyDomain); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ device->fullName = strdup(fullName); @@ -944,8 +945,8 @@ poll_callback( #endif /* HAVE_AVAHI */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) -# ifdef HAVE_DNSSD +#ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER /* * 'query_callback()' - Process query data. */ @@ -986,7 +987,7 @@ query_callback( { AvahiClient *client = avahi_record_browser_get_client(browser); /* Client information */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ char *ptr; /* Pointer into string */ cups_device_t *device = (cups_device_t *)context; /* Device */ @@ -1002,7 +1003,7 @@ query_callback( device_id[2048]; /* 1284 device ID */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, " "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", " "rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, " @@ -1034,7 +1035,7 @@ query_callback( return; } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* * Pull out the priority and make and model from the TXT @@ -1236,7 +1237,7 @@ query_callback( else device->make_and_model = strdup(model); } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* diff --git a/config-scripts/cups-dnssd.m4 b/config-scripts/cups-dnssd.m4 index 0c272bf931..b5b0fd6f50 100644 --- a/config-scripts/cups-dnssd.m4 +++ b/config-scripts/cups-dnssd.m4 @@ -1,76 +1,103 @@ dnl dnl DNS Service Discovery (aka Bonjour) stuff for CUPS. dnl +dnl Copyright © 2021 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl dnl Licensed under Apache License v2.0. See the file "LICENSE" for more dnl information. dnl -AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi]) -AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder]) -AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library], - LDFLAGS="-L$withval $LDFLAGS" - DSOFLAGS="-L$withval $DSOFLAGS",) -AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes], - CFLAGS="-I$withval $CFLAGS" - CPPFLAGS="-I$withval $CPPFLAGS",) +AC_ARG_WITH([dnssd], AS_HELP_STRING([--with-dnssd=...], [enable DNS Service Discovery support (avahi, mdnsresponder, no, yes)])) +AS_IF([test x$with_dnssd = x], [ + with_dnssd="yes" +], [test "$with_dnssd" != avahi -a "$with_dnssd" != mdnsresponder -a "$with_dnssd" != no -a "$with_dnssd" != yes], [ + AC_MSG_ERROR([Unsupported --with-dnssd value "$with_dnssd".]) +]) +AC_ARG_WITH([dnssd_libs], AS_HELP_STRING([--with-dnssd-libs], [set directory for DNS Service Discovery library]), [ + LDFLAGS="-L$withval $LDFLAGS" + DSOFLAGS="-L$withval $DSOFLAGS" +]) +AC_ARG_WITH([dnssd_includes], AS_HELP_STRING([--with-dnssd-includes], [set directory for DNS Service Discovery header files]), [ + CFLAGS="-I$withval $CFLAGS" + CPPFLAGS="-I$withval $CPPFLAGS" +]) DNSSDLIBS="" DNSSD_BACKEND="" IPPFIND_BIN="" IPPFIND_MAN="" -if test "x$PKGCONFIG" != x -a x$enable_avahi != xno -a x$host_os_name != xdarwin; then - AC_MSG_CHECKING(for Avahi) - if $PKGCONFIG --exists avahi-client; then - AC_MSG_RESULT(yes) +dnl First try using mDNSResponder... +AS_IF([test $with_dnssd = yes -o $with_dnssd = mdnsresponder], [ + AC_CHECK_HEADER([dns_sd.h], [ + AS_CASE(["$host_os_name"], [darwin*], [ + # Darwin and macOS... + AC_DEFINE([HAVE_DNSSD], [1], [Have DNS-SD support?]) + AC_DEFINE([HAVE_MDNSRESPONDER], [1], [Have mDNSResponder library?]) + DNSSD_BACKEND="dnssd" + IPPFIND_BIN="ippfind" + IPPFIND_MAN="ippfind.1" + ], [*], [ + # All others... + AC_MSG_CHECKING([for current version of dns_sd library]) + SAVELIBS="$LIBS" + LIBS="$LIBS -ldns_sd" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[ + int constant = kDNSServiceFlagsShareConnection; + unsigned char txtRecord[100]; + uint8_t valueLen; + TXTRecordGetValuePtr(sizeof(txtRecord), txtRecord, "value", &valueLen); + ]]) + ], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_DNSSD], [1], [Have DNS-SD support?]) + AC_DEFINE([HAVE_MDNSRESPONDER], [1], [Have mDNSResponder library?]) + DNSSDLIBS="-ldns_sd" + DNSSD_BACKEND="dnssd" + IPPFIND_BIN="ippfind" + IPPFIND_MAN="ippfind.1" + ], [ + AC_MSG_RESULT([no]) + AS_IF([test $with_dnssd = mdnsresponder], [ + AC_MSG_ERROR([--with-dnssd=mdnsresponder specified but dns_sd library not present.]) + ]) + ]) + LIBS="$SAVELIBS" + ]) + ]) +]) + +dnl Then try Avahi... +AS_IF([test "x$DNSSD_BACKEND" = x], [ + AS_IF([test $with_dnssd = avahi -o $with_dnssd = yes], [ + AS_IF([test "x$PKGCONFIG" = x], [ + AS_IF([test $with_dnssd = avahi], [ + AC_MSG_ERROR([Avahi requires pkg-config.]) + ]) + ], [ + AC_MSG_CHECKING([for Avahi client]) + AS_IF([$PKGCONFIG --exists avahi-client], [ + AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" DNSSD_BACKEND="dnssd" IPPFIND_BIN="ippfind" IPPFIND_MAN="ippfind.1" - AC_DEFINE(HAVE_AVAHI) - else - AC_MSG_RESULT(no) - fi -fi - -if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then - AC_CHECK_HEADER(dns_sd.h, [ - case "$host_os_name" in - darwin*) - # Darwin and macOS... - AC_DEFINE(HAVE_DNSSD) - DNSSD_BACKEND="dnssd" - IPPFIND_BIN="ippfind" - IPPFIND_MAN="ippfind.1" - ;; - *) - # All others... - AC_MSG_CHECKING(for current version of dns_sd library) - SAVELIBS="$LIBS" - LIBS="$LIBS -ldns_sd" - AC_TRY_COMPILE([#include ], - [int constant = kDNSServiceFlagsShareConnection; - unsigned char txtRecord[100]; - uint8_t valueLen; - TXTRecordGetValuePtr(sizeof(txtRecord), - txtRecord, "value", &valueLen);], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DNSSD) - DNSSDLIBS="-ldns_sd" - DNSSD_BACKEND="dnssd" - IPPFIND_BIN="ippfind" - IPPFIND_MAN="ippfind.1", - AC_MSG_RESULT(no)) - LIBS="$SAVELIBS" - ;; - esac + AC_DEFINE([HAVE_AVAHI], [1], [Have Avahi client library?]) + AC_DEFINE([HAVE_DNSSD], [1], [Have DNS-SD support?]) + ], [ + AC_MSG_RESULT([no]) + AS_IF([test $with_dnssd = avahi], [ + AC_MSG_ERROR([--with-dnssd=avahi specified but Avahi client not present.]) + ]) + ]) ]) -fi + ]) +]) -AC_SUBST(DNSSDLIBS) -AC_SUBST(DNSSD_BACKEND) -AC_SUBST(IPPFIND_BIN) -AC_SUBST(IPPFIND_MAN) +AC_SUBST([DNSSDLIBS]) +AC_SUBST([DNSSD_BACKEND]) +AC_SUBST([IPPFIND_BIN]) +AC_SUBST([IPPFIND_MAN]) diff --git a/config.h.in b/config.h.in index bdf687c501..8e1d4806f9 100644 --- a/config.h.in +++ b/config.h.in @@ -338,14 +338,21 @@ /* - * Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)? + * Do we have DNS Service Discovery (aka Bonjour) support? */ #undef HAVE_DNSSD /* - * Do we have Avahi for DNS Service Discovery (aka Bonjour)? + * Do we have mDNSResponder for DNS-SD? + */ + +#undef HAVE_MDNSRESPONDER + + +/* + * Do we have Avahi for DNS-SD? */ #undef HAVE_AVAHI diff --git a/configure b/configure index 927615f01b..3c995e5c56 100755 --- a/configure +++ b/configure @@ -897,8 +897,7 @@ enable_gnutls enable_pam with_pam_module enable_largefile -enable_avahi -enable_dnssd +with_dnssd with_dnssd_libs with_dnssd_includes enable_snapped_cupsd @@ -1601,8 +1600,6 @@ Optional Features: --enable-gnutls use GNU TLS for SSL/TLS support, default=second --disable-pam disable PAM support --disable-largefile omit support for large files - --disable-avahi disable DNS Service Discovery support using Avahi - --disable-dnssd disable DNS Service Discovery support using mDNSResponder --enable-snapped-cupsd enable support for packaging CUPS in a Snap --enable-snapped-clients enable support for CUPS controlling admin access from snapped clients --disable-launchd disable launchd support @@ -1640,8 +1637,10 @@ Optional Packages: --with-domainsocket set unix domain socket name --with-gssservicename set default gss service name --with-pam-module set the PAM module to use + --with-dnssd=... enable DNS Service Discovery support (avahi, + mdnsresponder, no, yes) --with-dnssd-libs set directory for DNS Service Discovery library - --with-dnssd-includes set directory for DNS Service Discovery includes + --with-dnssd-includes set directory for DNS Service Discovery header files --with-snapctl Set path for snapctl, only needed with --enable-snapped-cupsd, default=/usr/bin/snapctl --with-cups-control-slot Name for cups-control slot as defined in snapcraft.yaml, only needed with --enable-snapped-cupsd, default=admin --with-systemd set directory for systemd service files @@ -10167,32 +10166,42 @@ fi -# Check whether --enable-avahi was given. -if test ${enable_avahi+y} + +# Check whether --with-dnssd was given. +if test ${with_dnssd+y} then : - enableval=$enable_avahi; + withval=$with_dnssd; fi -# Check whether --enable-dnssd was given. -if test ${enable_dnssd+y} +if test x$with_dnssd = x then : - enableval=$enable_dnssd; -fi + with_dnssd="yes" + +elif test "$with_dnssd" != avahi -a "$with_dnssd" != mdnsresponder -a "$with_dnssd" != no -a "$with_dnssd" != yes +then : + + as_fn_error $? "Unsupported --with-dnssd value \"$with_dnssd\"." "$LINENO" 5 + +fi -# Check whether --with-dnssd-libs was given. +# Check whether --with-dnssd_libs was given. if test ${with_dnssd_libs+y} then : - withval=$with_dnssd_libs; LDFLAGS="-L$withval $LDFLAGS" - DSOFLAGS="-L$withval $DSOFLAGS" + withval=$with_dnssd_libs; + LDFLAGS="-L$withval $LDFLAGS" + DSOFLAGS="-L$withval $DSOFLAGS" + fi -# Check whether --with-dnssd-includes was given. +# Check whether --with-dnssd_includes was given. if test ${with_dnssd_includes+y} then : - withval=$with_dnssd_includes; CFLAGS="-I$withval $CFLAGS" - CPPFLAGS="-I$withval $CPPFLAGS" + withval=$with_dnssd_includes; + CFLAGS="-I$withval $CFLAGS" + CPPFLAGS="-I$withval $CPPFLAGS" + fi @@ -10201,78 +10210,143 @@ DNSSD_BACKEND="" IPPFIND_BIN="" IPPFIND_MAN="" -if test "x$PKGCONFIG" != x -a x$enable_avahi != xno -a x$host_os_name != xdarwin; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Avahi" >&5 -printf %s "checking for Avahi... " >&6; } - if $PKGCONFIG --exists avahi-client; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" - DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" - DNSSD_BACKEND="dnssd" - IPPFIND_BIN="ippfind" - IPPFIND_MAN="ippfind.1" - printf "%s\n" "#define HAVE_AVAHI 1" >>confdefs.h - - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi -fi +if test $with_dnssd = yes -o $with_dnssd = mdnsresponder +then : -if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then - ac_fn_c_check_header_compile "$LINENO" "dns_sd.h" "ac_cv_header_dns_sd_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "dns_sd.h" "ac_cv_header_dns_sd_h" "$ac_includes_default" if test "x$ac_cv_header_dns_sd_h" = xyes then : - case "$host_os_name" in - darwin*) - # Darwin and macOS... - printf "%s\n" "#define HAVE_DNSSD 1" >>confdefs.h + case "$host_os_name" in #( + darwin*) : - DNSSD_BACKEND="dnssd" - IPPFIND_BIN="ippfind" - IPPFIND_MAN="ippfind.1" - ;; - *) - # All others... - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for current version of dns_sd library" >&5 + # Darwin and macOS... + +printf "%s\n" "#define HAVE_DNSSD 1" >>confdefs.h + + +printf "%s\n" "#define HAVE_MDNSRESPONDER 1" >>confdefs.h + + DNSSD_BACKEND="dnssd" + IPPFIND_BIN="ippfind" + IPPFIND_MAN="ippfind.1" + ;; #( + *) : + + # All others... + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for current version of dns_sd library" >&5 printf %s "checking for current version of dns_sd library... " >&6; } - SAVELIBS="$LIBS" - LIBS="$LIBS -ldns_sd" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + SAVELIBS="$LIBS" + LIBS="$LIBS -ldns_sd" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + + #include int main (void) { -int constant = kDNSServiceFlagsShareConnection; - unsigned char txtRecord[100]; - uint8_t valueLen; - TXTRecordGetValuePtr(sizeof(txtRecord), - txtRecord, "value", &valueLen); + + int constant = kDNSServiceFlagsShareConnection; + unsigned char txtRecord[100]; + uint8_t valueLen; + TXTRecordGetValuePtr(sizeof(txtRecord), txtRecord, "value", &valueLen); + ; return 0; } + _ACEOF if ac_fn_c_try_compile "$LINENO" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - printf "%s\n" "#define HAVE_DNSSD 1" >>confdefs.h - DNSSDLIBS="-ldns_sd" - DNSSD_BACKEND="dnssd" - IPPFIND_BIN="ippfind" - IPPFIND_MAN="ippfind.1" +printf "%s\n" "#define HAVE_DNSSD 1" >>confdefs.h + + +printf "%s\n" "#define HAVE_MDNSRESPONDER 1" >>confdefs.h + + DNSSDLIBS="-ldns_sd" + DNSSD_BACKEND="dnssd" + IPPFIND_BIN="ippfind" + IPPFIND_MAN="ippfind.1" + else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + if test $with_dnssd = mdnsresponder +then : + + as_fn_error $? "--with-dnssd=mdnsresponder specified but dns_sd library not present." "$LINENO" 5 + +fi + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - LIBS="$SAVELIBS" - ;; - esac + LIBS="$SAVELIBS" + ;; #( + *) : + ;; +esac + +fi + + +fi + +if test "x$DNSSD_BACKEND" = x +then : + + if test $with_dnssd = avahi -o $with_dnssd = yes +then : + + if test "x$PKGCONFIG" = x +then : + + if test $with_dnssd = avahi +then : + + as_fn_error $? "Avahi requires pkg-config." "$LINENO" 5 + +fi + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Avahi client" >&5 +printf %s "checking for Avahi client... " >&6; } + if $PKGCONFIG --exists avahi-client +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" + DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" + DNSSD_BACKEND="dnssd" + IPPFIND_BIN="ippfind" + IPPFIND_MAN="ippfind.1" + +printf "%s\n" "#define HAVE_AVAHI 1" >>confdefs.h + + +printf "%s\n" "#define HAVE_DNSSD 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + if test $with_dnssd = avahi +then : + + as_fn_error $? "--with-dnssd=avahi specified but Avahi client not present." "$LINENO" 5 + +fi + +fi + +fi fi diff --git a/cups/dest.c b/cups/dest.c index 2017792a74..3f17843a98 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1,6 +1,7 @@ /* * User-defined destination (and option) support for CUPS. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products. * @@ -24,9 +25,9 @@ # include #endif /* HAVE_POLL */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI # include @@ -56,19 +57,19 @@ # define kUseLastPrinter CFSTR("UseLastPrinter") #endif /* __APPLE__ */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD # define _CUPS_DNSSD_GET_DESTS 250 /* Milliseconds for cupsGetDests */ # define _CUPS_DNSSD_MAXTIME 50 /* Milliseconds for maximum quantum of time */ #else # define _CUPS_DNSSD_GET_DESTS 0 /* Milliseconds for cupsGetDests */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* * Types... */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD typedef enum _cups_dnssd_state_e /* Enumerated device state */ { _CUPS_DNSSD_NEW, @@ -81,14 +82,14 @@ typedef enum _cups_dnssd_state_e /* Enumerated device state */ typedef struct _cups_dnssd_data_s /* Enumeration data */ { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceRef main_ref; /* Main service reference */ # else /* HAVE_AVAHI */ AvahiSimplePoll *simple_poll; /* Polling interface */ AvahiClient *client; /* Client information */ int got_data; /* Did we get data? */ int browsers; /* How many browsers are running? */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ cups_dest_cb_t cb; /* Callback */ void *user_data; /* User data pointer */ cups_ptype_t type, /* Printer type filter */ @@ -103,11 +104,11 @@ typedef struct _cups_dnssd_data_s /* Enumeration data */ typedef struct _cups_dnssd_device_s /* Enumerated device */ { _cups_dnssd_state_t state; /* State of device listing */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceRef ref; /* Service reference for query */ # else /* HAVE_AVAHI */ AvahiRecordBrowser *ref; /* Browser for query */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ char *fullName, /* Full name */ *regtype, /* Registration type */ *domain; /* Domain name */ @@ -159,8 +160,8 @@ static int cups_block_cb(cups_dest_block_t block, unsigned flags, cups_dest_t *dest); #endif /* __BLOCKS__ */ static int cups_compare_dests(cups_dest_t *a, cups_dest_t *b); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) -# ifdef HAVE_DNSSD +#ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER static void cups_dnssd_browse_cb(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, @@ -182,7 +183,7 @@ static void cups_dnssd_browse_cb(AvahiServiceBrowser *browser, static void cups_dnssd_client_cb(AvahiClient *client, AvahiClientState state, void *context); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ static int cups_dnssd_compare_devices(_cups_dnssd_device_t *a, _cups_dnssd_device_t *b); static void cups_dnssd_free_device(_cups_dnssd_device_t *device, @@ -192,7 +193,7 @@ static _cups_dnssd_device_t * const char *serviceName, const char *regtype, const char *replyDomain); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER static void cups_dnssd_query_cb(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, @@ -214,7 +215,7 @@ static void cups_dnssd_query_cb(AvahiRecordBrowser *browser, size_t rdlen, AvahiLookupResultFlags flags, void *context); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ static const char *cups_dnssd_resolve(cups_dest_t *dest, const char *uri, int msec, int *cancel, cups_dest_cb_t cb, void *user_data); @@ -222,7 +223,7 @@ static int cups_dnssd_resolve_cb(void *context); static void cups_dnssd_unquote(char *dst, const char *src, size_t dstsize); static int cups_elapsed(struct timeval *t); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ static int cups_enum_dests(http_t *http, unsigned flags, int msec, int *cancel, cups_ptype_t type, cups_ptype_t mask, cups_dest_cb_t cb, void *user_data); static int cups_find_dest(const char *name, const char *instance, int num_dests, cups_dest_t *dests, int prev, @@ -634,20 +635,20 @@ cupsConnectDest( { if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL) { -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (strstr(uri, "._tcp")) uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb, user_data); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } } else if ((uri = cupsGetOption("printer-uri-supported", dest->num_options, dest->options)) == NULL) { if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL) { -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (strstr(uri, "._tcp")) uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb, user_data); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } if (uri) @@ -1136,7 +1137,7 @@ _cupsGetDestResource( DEBUG_printf(("1_cupsGetDestResource: device-uri=\"%s\", printer-uri-supported=\"%s\".", device_uri, printer_uri)); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (((flags & CUPS_DEST_FLAGS_DEVICE) || !printer_uri) && strstr(device_uri, "._tcp")) { if ((device_uri = cups_dnssd_resolve(dest, device_uri, 5000, NULL, NULL, NULL)) != NULL) @@ -1155,7 +1156,7 @@ _cupsGetDestResource( return (NULL); } } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if (flags & CUPS_DEST_FLAGS_DEVICE) { @@ -2554,8 +2555,8 @@ cups_compare_dests(cups_dest_t *a, /* I - First destination */ } -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) -# ifdef HAVE_DNSSD +#ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER /* * 'cups_dnssd_browse_cb()' - Browse for printers. */ @@ -2678,7 +2679,7 @@ cups_dnssd_client_cb( avahi_simple_poll_quit(data->simple_poll); } } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* @@ -2705,13 +2706,13 @@ cups_dnssd_free_device( { DEBUG_printf(("5cups_dnssd_free_device(device=%p(%s), data=%p)", (void *)device, device->dest.name, (void *)data)); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (device->ref) DNSServiceRefDeallocate(device->ref); # else /* HAVE_AVAHI */ if (device->ref) avahi_record_browser_free(device->ref); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ _cupsStrFree(device->domain); _cupsStrFree(device->fullName); @@ -2824,22 +2825,22 @@ cups_dnssd_get_device( * Set the "full name" of this service, which is used for queries... */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain); # else /* HAVE_AVAHI */ avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName, regtype, replyDomain); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ _cupsStrFree(device->fullName); device->fullName = _cupsStrAlloc(fullName); if (device->ref) { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceRefDeallocate(device->ref); # else /* HAVE_AVAHI */ avahi_record_browser_free(device->ref); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ device->ref = 0; } @@ -2907,7 +2908,7 @@ cups_dnssd_poll_cb( static void cups_dnssd_query_cb( -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceRef sdRef, /* I - Service reference */ DNSServiceFlags flags, /* I - Data flags */ uint32_t interfaceIndex, /* I - Interface */ @@ -2930,7 +2931,7 @@ cups_dnssd_query_cb( const void *rdata, /* I - TXT record */ size_t rdlen, /* I - Length of TXT record */ AvahiLookupResultFlags flags, /* I - Flags */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ void *context) /* I - Enumeration data */ { # if defined(DEBUG) && defined(HAVE_AVAHI) @@ -2946,7 +2947,7 @@ cups_dnssd_query_cb( *device; /* Device */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DEBUG_printf(("5cups_dnssd_query_cb(sdRef=%p, flags=%x, interfaceIndex=%d, errorCode=%d, fullName=\"%s\", rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, context=%p)", (void *)sdRef, flags, interfaceIndex, errorCode, fullName, rrtype, rrclass, rdlen, rdata, ttl, context)); /* @@ -2970,7 +2971,7 @@ cups_dnssd_query_cb( return; } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* * Lookup the service in the devices array. @@ -3338,10 +3339,8 @@ cups_dnssd_unquote(char *dst, /* I - Destination buffer */ *dst = '\0'; } -#endif /* HAVE_DNSSD */ -#if defined(HAVE_AVAHI) || defined(HAVE_DNSSD) /* * 'cups_elapsed()' - Return the elapsed time in milliseconds. */ @@ -3361,7 +3360,7 @@ cups_elapsed(struct timeval *t) /* IO - Previous time */ return (msecs); } -#endif /* HAVE_AVAHI || HAVE_DNSSD */ +#endif /* HAVE_DNSSD */ /* @@ -3385,14 +3384,14 @@ cups_enum_dests( *dest; /* Current destination */ cups_option_t *option; /* Current option */ const char *user_default; /* Default printer from environment */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD int count, /* Number of queries started */ completed, /* Number of completed queries */ remaining; /* Remainder of timeout */ struct timeval curtime; /* Current time */ _cups_dnssd_data_t data; /* Data for callback */ _cups_dnssd_device_t *device; /* Current device */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER int nfds, /* Number of files responded */ main_fd; /* File descriptor for lookups */ DNSServiceRef ipp_ref = NULL; /* IPP browser */ @@ -3411,10 +3410,10 @@ cups_enum_dests( # ifdef HAVE_SSL AvahiServiceBrowser *ipps_ref = NULL; /* IPPS browser */ # endif /* HAVE_SSL */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ #else _cups_getdata_t data; /* Data for callback */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ char filename[1024]; /* Local lpoptions file */ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ @@ -3486,13 +3485,13 @@ cups_enum_dests( * Get ready to enumerate... */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD data.type = type; data.mask = mask; data.cb = cb; data.user_data = user_data; data.devices = cupsArrayNew3((cups_array_func_t)cups_dnssd_compare_devices, NULL, NULL, 0, NULL, (cups_afree_func_t)cups_dnssd_free_device); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if (!(mask & CUPS_PRINTER_DISCOVERED) || !(type & CUPS_PRINTER_DISCOVERED)) { @@ -3520,9 +3519,9 @@ cups_enum_dests( i --, dest ++) { cups_dest_t *user_dest; /* Destination from lpoptions */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD const char *device_uri; /* Device URI */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if ((user_dest = cupsGetDest(dest->name, dest->instance, data.num_dests, data.dests)) != NULL) { @@ -3537,7 +3536,7 @@ cups_enum_dests( if (!(*cb)(user_data, i > 1 ? CUPS_DEST_FLAGS_MORE : CUPS_DEST_FLAGS_NONE, dest)) break; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (!dest->instance && (device_uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL && !strncmp(device_uri, "dnssd://", 8)) { /* @@ -3569,7 +3568,7 @@ cups_enum_dests( } } } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } cupsFreeDests(num_dests, dests); @@ -3585,14 +3584,14 @@ cups_enum_dests( if ((mask & CUPS_PRINTER_DISCOVERED) && !(type & CUPS_PRINTER_DISCOVERED)) goto enum_finished; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD /* * Get Bonjour-shared printers... */ gettimeofday(&curtime, NULL); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (DNSServiceCreateConnection(&data.main_ref) != kDNSServiceErr_NoError) { DEBUG_puts("1cups_enum_dests: Unable to create service browser, returning 0."); @@ -3681,7 +3680,7 @@ cups_enum_dests( return (0); } # endif /* HAVE_SSL */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ if (msec < 0) remaining = INT_MAX; @@ -3698,7 +3697,7 @@ cups_enum_dests( cups_elapsed(&curtime); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER # ifdef HAVE_POLL pfd.fd = main_fd; pfd.events = POLLIN; @@ -3734,7 +3733,7 @@ cups_enum_dests( } DEBUG_printf(("1cups_enum_dests: got_data=%d", data.got_data)); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ remaining -= cups_elapsed(&curtime); @@ -3753,7 +3752,7 @@ cups_enum_dests( { DEBUG_printf(("1cups_enum_dests: Querying '%s'.", device->fullName)); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER device->ref = data.main_ref; if (DNSServiceQueryRecord(&(device->ref), kDNSServiceFlagsShareConnection, 0, device->fullName, kDNSServiceType_TXT, kDNSServiceClass_IN, (DNSServiceQueryRecordReply)cups_dnssd_query_cb, &data) == kDNSServiceErr_NoError) @@ -3780,7 +3779,7 @@ cups_enum_dests( DEBUG_printf(("1cups_enum_dests: Query failed: %s", avahi_strerror(avahi_client_errno(data.client)))); } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } else if (device->ref && device->state == _CUPS_DNSSD_PENDING) { @@ -3834,7 +3833,7 @@ cups_enum_dests( break; # endif /* HAVE_AVAHI */ } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* * Return... @@ -3844,10 +3843,10 @@ cups_enum_dests( cupsFreeDests(data.num_dests, data.dests); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD cupsArrayDelete(data.devices); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (ipp_ref) DNSServiceRefDeallocate(ipp_ref); @@ -3871,8 +3870,8 @@ cups_enum_dests( avahi_client_free(data.client); if (data.simple_poll) avahi_simple_poll_free(data.simple_poll); -# endif /* HAVE_DNSSD */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +# endif /* HAVE_MDNSRESPONDER */ +#endif /* HAVE_DNSSD */ DEBUG_puts("1cups_enum_dests: Returning 1."); diff --git a/cups/http-support.c b/cups/http-support.c index 33ccd4e71a..f442268da2 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -1,7 +1,7 @@ /* * HTTP support routines for CUPS. * - * Copyright © 2020 by OpenPrinting + * Copyright © 2020-2021 by OpenPrinting * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -15,7 +15,7 @@ #include "cups-private.h" #include "debug-internal.h" -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include # ifdef _WIN32 # include @@ -29,7 +29,7 @@ # include # include # include -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* @@ -110,7 +110,7 @@ static const char *http_copy_decode(char *dst, const char *src, static char *http_copy_encode(char *dst, const char *src, char *dstend, const char *reserved, const char *term, int encode); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void DNSSD_API http_resolve_cb(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, @@ -120,7 +120,7 @@ static void DNSSD_API http_resolve_cb(DNSServiceRef sdRef, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI static void http_client_cb(AvahiClient *client, @@ -1770,14 +1770,14 @@ _httpResolveURI( if (strstr(hostname, "._tcp")) { -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD char *regtype, /* Pointer to type in hostname */ *domain, /* Pointer to domain in hostname */ *uuid, /* Pointer to UUID in URI */ *uuidend; /* Pointer to end of UUID in URI */ _http_uribuf_t uribuf; /* URI buffer */ int offline = 0; /* offline-report state set? */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceRef ref, /* DNS-SD master service reference */ domainref = NULL,/* DNS-SD service reference for domain */ ippref = NULL, /* DNS-SD service reference for network IPP */ @@ -1793,7 +1793,7 @@ _httpResolveURI( # elif defined(HAVE_AVAHI) AvahiClient *client; /* Client information */ int error; /* Status */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ if (options & _HTTP_RESOLVE_STDERR) fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname); @@ -1857,7 +1857,7 @@ _httpResolveURI( uri = NULL; -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError) { uint32_t myinterface = kDNSServiceInterfaceIndexAny; @@ -2080,7 +2080,7 @@ _httpResolveURI( avahi_simple_poll_free(uribuf.poll); } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ if (options & _HTTP_RESOLVE_STDERR) { @@ -2096,13 +2096,13 @@ _httpResolveURI( } } -#else /* HAVE_DNSSD || HAVE_AVAHI */ +#else /* !HAVE_DNSSD */ /* * No DNS-SD support... */ uri = NULL; -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if ((options & _HTTP_RESOLVE_STDERR) && !uri) _cupsLangPrintFilter(stderr, "INFO", _("Unable to find printer.")); @@ -2274,7 +2274,7 @@ http_copy_encode(char *dst, /* O - Destination buffer */ } -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER /* * 'http_resolve_cb()' - Build a device URI for the given service name. */ @@ -2722,4 +2722,4 @@ http_resolve_cb( avahi_simple_poll_quit(uribuf->poll); } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ diff --git a/scheduler/client.c b/scheduler/client.c index 9730eeaaf7..313d748491 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,6 +1,7 @@ /* * Client routines for the CUPS scheduler. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -3594,7 +3595,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ !strcmp(con->clientname, "[::1]")); } -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD /* * Check if the hostname is something.local (Bonjour); if so, allow it. */ @@ -3612,7 +3613,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ if (end && (!_cups_strcasecmp(end, ".local") || !_cups_strcasecmp(end, ".local."))) return (1); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* * Check if the hostname is an IP address... @@ -3666,7 +3667,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ } } -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD for (a = (cupsd_alias_t *)cupsArrayFirst(DNSSDAlias); a; a = (cupsd_alias_t *)cupsArrayNext(DNSSDAlias)) @@ -3690,7 +3691,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ return (1); } } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* * Check for interface hostname matches... diff --git a/scheduler/conf.c b/scheduler/conf.c index fba5ed4389..54c3f7cf5e 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -68,9 +68,9 @@ typedef struct static const cupsd_var_t cupsd_vars[] = { { "AutoPurgeJobs", &JobAutoPurge, CUPSD_VARTYPE_BOOLEAN }, -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD { "BrowseDNSSDSubTypes", &DNSSDSubTypes, CUPSD_VARTYPE_STRING }, -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ { "BrowseWebIF", &BrowseWebIF, CUPSD_VARTYPE_BOOLEAN }, { "Browsing", &Browsing, CUPSD_VARTYPE_BOOLEAN }, { "Classification", &Classification, CUPSD_VARTYPE_STRING }, @@ -81,9 +81,9 @@ static const cupsd_var_t cupsd_vars[] = { "DefaultPolicy", &DefaultPolicy, CUPSD_VARTYPE_STRING }, { "DefaultShared", &DefaultShared, CUPSD_VARTYPE_BOOLEAN }, { "DirtyCleanInterval", &DirtyCleanInterval, CUPSD_VARTYPE_TIME }, -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD { "DNSSDHostName", &DNSSDHostName, CUPSD_VARTYPE_STRING }, -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ { "ErrorPolicy", &ErrorPolicy, CUPSD_VARTYPE_STRING }, { "FilterLimit", &FilterLimit, CUPSD_VARTYPE_INTEGER }, { "FilterNice", &FilterNice, CUPSD_VARTYPE_INTEGER }, @@ -743,10 +743,10 @@ cupsdReadConfiguration(void) Browsing = CUPS_DEFAULT_BROWSING; DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD cupsdSetString(&DNSSDSubTypes, "_cups,_print"); cupsdClearString(&DNSSDHostName); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ cupsdSetString(&ErrorPolicy, CUPS_DEFAULT_ERROR_POLICY); diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index 3e0a904971..d754ae6185 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -16,11 +16,11 @@ #include "cupsd.h" #include -#if defined(HAVE_DNSSD) && defined(__APPLE__) +#if defined(HAVE_MDNSRESPONDER) && defined(__APPLE__) # include # include # include -#endif /* HAVE_DNSSD && __APPLE__ */ +#endif /* HAVE_MDNSRESPONDER && __APPLE__ */ /* @@ -36,7 +36,7 @@ static int avahi_running = 0; * Local functions... */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD static char *get_auth_info_required(cupsd_printer_t *p, char *buffer, size_t bufsize); # ifdef __APPLE__ @@ -53,7 +53,7 @@ static void dnssdDeregisterPrinter(cupsd_printer_t *p, int clear_name, int from static const char *dnssdErrorString(int error); static void dnssdFreeTxtRecord(cupsd_txt_t *txt); static void dnssdRegisterAllPrinters(int from_callback); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER static void dnssdRegisterCallback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, @@ -65,15 +65,15 @@ static void dnssdRegisterCallback(DNSServiceRef sdRef, static void dnssdRegisterCallback(AvahiEntryGroup *p, AvahiEntryGroupState state, void *context); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ static int dnssdRegisterInstance(cupsd_srv_t *srv, cupsd_printer_t *p, char *name, const char *type, const char *subtypes, int port, cupsd_txt_t *txt, int commit, int from_callback); static void dnssdRegisterPrinter(cupsd_printer_t *p, int from_callback); static void dnssdStop(void); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER static void dnssdUpdate(void); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ static void dnssdUpdateDNSSDName(int from_callback); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* @@ -103,10 +103,10 @@ cupsdDeregisterPrinter( * Announce the deletion... */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDMaster) dnssdDeregisterPrinter(p, 1, 0); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } @@ -125,10 +125,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_SCANNER))) return; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDMaster) dnssdRegisterPrinter(p, 0); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } @@ -142,10 +142,10 @@ cupsdStartBrowsing(void) if (!Browsing || !BrowseLocalProtocols) return; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (BrowseLocalProtocols & BROWSE_DNSSD) { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER DNSServiceErrorType error; /* Error from service creation */ /* @@ -210,17 +210,15 @@ cupsdStartBrowsing(void) else avahi_threaded_poll_start(DNSSDMaster); } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) /* * Register the individual printers */ dnssdRegisterAllPrinters(0); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } @@ -234,7 +232,7 @@ cupsdStopBrowsing(void) if (!Browsing || !BrowseLocalProtocols) return; -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD /* * De-register the individual printers */ @@ -247,11 +245,11 @@ cupsdStopBrowsing(void) if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDMaster) dnssdStop(); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD /* * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing... */ @@ -493,7 +491,7 @@ dnssdBuildTxtRecord( * Then pack them into a proper txt record... */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER TXTRecordCreate(&txt, 0, NULL); for (i = 0; i < count; i ++) @@ -508,7 +506,7 @@ dnssdBuildTxtRecord( for (i = 0, txt = NULL; i < count; i ++) txt = avahi_string_list_add_printf(txt, "%s=%s", keyvalue[i][0], keyvalue[i][1]); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ return (txt); } @@ -653,7 +651,7 @@ dnssdDeregisterInstance( if (!srv || !*srv) return; -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER (void)from_callback; DNSServiceRefDeallocate(*srv); @@ -672,7 +670,7 @@ dnssdDeregisterInstance( if (!from_callback) avahi_threaded_poll_unlock(DNSSDMaster); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } @@ -695,12 +693,12 @@ dnssdDeregisterPrinter( { dnssdDeregisterInstance(&p->ipp_srv, from_callback); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER # ifdef HAVE_SSL dnssdDeregisterInstance(&p->ipps_srv, from_callback); # endif /* HAVE_SSL */ dnssdDeregisterInstance(&p->printer_srv, from_callback); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } /* @@ -726,7 +724,7 @@ dnssdDeregisterPrinter( static const char * /* O - Error message */ dnssdErrorString(int error) /* I - Error number */ { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER switch (error) { case kDNSServiceErr_NoError : @@ -829,7 +827,7 @@ dnssdErrorString(int error) /* I - Error number */ # else /* HAVE_AVAHI */ return (avahi_strerror(error)); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } @@ -840,13 +838,13 @@ dnssdErrorString(int error) /* I - Error number */ static void dnssdFreeTxtRecord(cupsd_txt_t *txt) /* I - TXT record */ { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER TXTRecordDeallocate(txt); # else /* HAVE_AVAHI */ avahi_string_list_free(*txt); *txt = NULL; -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } @@ -875,7 +873,7 @@ dnssdRegisterAllPrinters(int from_callback) /* I - Called from callback? */ * 'dnssdRegisterCallback()' - DNSServiceRegister callback. */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER static void dnssdRegisterCallback( DNSServiceRef sdRef, /* I - DNS Service reference */ @@ -935,7 +933,7 @@ dnssdRegisterCallback( /* TODO: Handle collisions with avahi_alternate_service_name(p->reg_name)? */ } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* @@ -959,9 +957,9 @@ dnssdRegisterInstance( int error; /* Any error */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER (void)from_callback; -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ cupsdLogMessage(CUPSD_LOG_DEBUG, "Registering \"%s\" with DNS-SD type \"%s\".", name, type); @@ -971,7 +969,7 @@ dnssdRegisterInstance( * Assign the correct pointer for "srv"... */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (!strcmp(type, "_printer._tcp")) srv = &p->printer_srv; /* Target LPD service */ # ifdef HAVE_SSL @@ -983,10 +981,10 @@ dnssdRegisterInstance( # else /* HAVE_AVAHI */ srv = &p->ipp_srv; /* Target service group */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER (void)commit; # else /* HAVE_AVAHI */ @@ -1004,7 +1002,7 @@ dnssdRegisterInstance( name, dnssdErrorString(avahi_client_errno(DNSSDClient))); return (0); } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* * Make sure the name is <= 63 octets, and when we truncate be sure to @@ -1028,7 +1026,7 @@ dnssdRegisterInstance( * Register the service... */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER if (subtypes) snprintf(temp, sizeof(temp), "%s,%s", type, subtypes); else @@ -1117,7 +1115,7 @@ dnssdRegisterInstance( if (!from_callback) avahi_threaded_poll_unlock(DNSSDMaster); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ if (error) { @@ -1235,12 +1233,12 @@ dnssdRegisterPrinter( dnssdDeregisterInstance(&p->ipp_srv, from_callback); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER # ifdef HAVE_SSL dnssdDeregisterInstance(&p->ipps_srv, from_callback); # endif /* HAVE_SSL */ dnssdDeregisterInstance(&p->printer_srv, from_callback); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } } @@ -1270,7 +1268,7 @@ dnssdStop(void) dnssdDeregisterInstance(&WebIFSrv, 0); -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER cupsdRemoveSelect(DNSServiceRefSockFD(DNSSDMaster)); DNSServiceRefDeallocate(DNSSDMaster); @@ -1291,7 +1289,7 @@ dnssdStop(void) avahi_threaded_poll_free(DNSSDMaster); DNSSDMaster = NULL; } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ cupsArrayDelete(DNSSDPrinters); DNSSDPrinters = NULL; @@ -1300,7 +1298,7 @@ dnssdStop(void) } -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER /* * 'dnssdUpdate()' - Handle DNS-SD queries. */ @@ -1319,7 +1317,7 @@ dnssdUpdate(void) dnssdStop(); } } -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ /* @@ -1602,4 +1600,4 @@ get_auth_info_required( return ("none"); } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ diff --git a/scheduler/dirsvc.h b/scheduler/dirsvc.h index c2094b451e..9d0eaf8872 100644 --- a/scheduler/dirsvc.h +++ b/scheduler/dirsvc.h @@ -28,7 +28,7 @@ VAR int Browsing VALUE(TRUE), BrowseLocalProtocols VALUE(BROWSE_ALL); /* Protocols to support for local printers */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD VAR char *DNSSDComputerName VALUE(NULL), /* Computer/server name */ *DNSSDHostName VALUE(NULL), @@ -41,7 +41,7 @@ VAR int DNSSDPort VALUE(0); /* Port number to register */ VAR cups_array_t *DNSSDPrinters VALUE(NULL); /* Printers we have registered */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER VAR DNSServiceRef DNSSDMaster VALUE(NULL); /* Master DNS-SD service reference */ # else /* HAVE_AVAHI */ @@ -49,10 +49,10 @@ VAR AvahiThreadedPoll *DNSSDMaster VALUE(NULL); /* Master polling interface for Avahi */ VAR AvahiClient *DNSSDClient VALUE(NULL); /* Client information */ -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ VAR cupsd_srv_t WebIFSrv VALUE(NULL); /* Service reference for the web interface */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* @@ -63,6 +63,6 @@ extern void cupsdDeregisterPrinter(cupsd_printer_t *p, int removeit); extern void cupsdRegisterPrinter(cupsd_printer_t *p); extern void cupsdStartBrowsing(void); extern void cupsdStopBrowsing(void); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD extern void cupsdUpdateDNSSDName(void); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 0167f4ed80..d289e58487 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,7 +1,7 @@ /* * IPP routines for the CUPS scheduler. * - * Copyright © 2020 by OpenPrinting + * Copyright © 2020-2021 by OpenPrinting * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -4906,7 +4906,7 @@ copy_printer_attrs( if (!ra || cupsArrayFind(ra, "printer-current-time")) ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time", ippTimeToDate(curtime)); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (!ra || cupsArrayFind(ra, "printer-dns-sd-name")) { if (printer->reg_name) @@ -4914,7 +4914,7 @@ copy_printer_attrs( else ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE, "printer-dns-sd-name", 0); } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if (!ra || cupsArrayFind(ra, "printer-error-policy")) ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME, "printer-error-policy", NULL, printer->error_policy); diff --git a/scheduler/main.c b/scheduler/main.c index d14b48e91b..90ecb349cb 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,6 +1,7 @@ /* * Main loop for the CUPS scheduler. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -859,9 +860,9 @@ main(int argc, /* I - Number of command-line args */ * Got an error from select! */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD cupsd_printer_t *p; /* Current printer */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ if (errno == EINTR) /* Just interrupted by a signal */ continue; @@ -901,13 +902,13 @@ main(int argc, /* I - Number of command-line args */ job->print_pipes[0], job->print_pipes[1], job->back_pipes[0], job->back_pipes[1]); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers)) cupsdLogMessage(CUPSD_LOG_EMERG, "printer[%s] reg_name=\"%s\"", p->name, p->reg_name ? p->reg_name : "(null)"); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ break; } diff --git a/scheduler/printers.c b/scheduler/printers.c index 41a2e610fb..7638a7cf78 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,7 +1,7 @@ /* * Printer routines for the CUPS scheduler. * - * Copyright © 2020 by OpenPrinting + * Copyright © 2020-2021 by OpenPrinting * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -851,10 +851,10 @@ cupsdDeletePrinter( cupsdClearString(&p->alert); cupsdClearString(&p->alert_description); -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD cupsdClearString(&p->pdl); cupsdClearString(&p->reg_name); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ cupsArrayDelete(p->filetypes); @@ -3692,7 +3692,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */ attr->values[i].string.text = _cupsStrAlloc(mimetype); } -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD { char pdl[1024]; /* Buffer to build pdl list */ mime_filter_t *filter; /* MIME filter looping var */ @@ -3747,7 +3747,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */ cupsdSetString(&p->pdl, pdl); } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ } diff --git a/scheduler/printers.h b/scheduler/printers.h index 4959bf2760..c0887d64f0 100644 --- a/scheduler/printers.h +++ b/scheduler/printers.h @@ -1,20 +1,21 @@ /* * Printer definitions for the CUPS scheduler. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright © 2021 by OpenPrinting. + * Copyright @ 2007-2017 by Apple Inc. + * Copyright @ 1997-2007 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more information. */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include #elif defined(HAVE_AVAHI) # include # include # include # include -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #include @@ -35,14 +36,14 @@ typedef struct * DNS-SD types to make the code cleaner/clearer... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER typedef DNSServiceRef cupsd_srv_t; /* Service reference */ typedef TXTRecordRef cupsd_txt_t; /* TXT record */ #elif defined(HAVE_AVAHI) typedef AvahiEntryGroup *cupsd_srv_t; /* Service reference */ typedef AvahiStringList *cupsd_txt_t; /* TXT record */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* @@ -113,17 +114,17 @@ struct cupsd_printer_s time_t marker_time; /* Last time marker attributes were updated */ _ppd_cache_t *pc; /* PPD cache and mapping data */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD char *reg_name, /* Name used for service registration */ *pdl; /* pdl value for TXT record */ cupsd_srv_t ipp_srv; /* IPP service(s) */ -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER # ifdef HAVE_SSL cupsd_srv_t ipps_srv; /* IPPS service(s) */ # endif /* HAVE_SSL */ cupsd_srv_t printer_srv; /* LPD service */ -# endif /* HAVE_DNSSD */ -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +# endif /* HAVE_MDNSRESPONDER */ +#endif /* HAVE_DNSSD */ }; diff --git a/scheduler/sysman.c b/scheduler/sysman.c index 56eb4e32a0..bf5fff8d78 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -1,10 +1,12 @@ /* * System management functions for the CUPS scheduler. * - * Copyright 2007-2018 by Apple Inc. - * Copyright 2006 by Easy Software Products. + * Copyright © 2021 by OpenPrinting. + * Copyright @ 2007-2018 by Apple Inc. + * Copyright @ 2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ @@ -1019,13 +1021,13 @@ sysUpdateNames(void) p = (cupsd_printer_t *)cupsArrayNext(Printers)) cupsdDeregisterPrinter(p, 1); -# if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +# ifdef HAVE_DNSSD /* * Update the computer name and BTMM domain list... */ cupsdUpdateDNSSDName(); -# endif /* HAVE_DNSSD || HAVE_AVAHI */ +# endif /* HAVE_DNSSD */ /* * Now re-register them... diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index 7a71f0c622..92b2290b3c 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -1,6 +1,7 @@ /* * IPP Everywhere printer application for CUPS. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2020 by the IEEE-ISTO Printer Working Group. * Copyright © 2010-2019 by Apple Inc. * @@ -45,7 +46,7 @@ extern char **environ; # include #endif /* _WIN32 */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include #elif defined(HAVE_AVAHI) # include @@ -54,7 +55,7 @@ extern char **environ; # include # include # include -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_SYS_MOUNT_H # include @@ -150,7 +151,7 @@ static const char * const ippeve_preason_strings[] = * Structures... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER typedef DNSServiceRef ippeve_srv_t; /* Service reference */ typedef TXTRecordRef ippeve_txt_t; /* TXT record */ @@ -161,7 +162,7 @@ typedef AvahiStringList *ippeve_txt_t; /* TXT record */ #else typedef void *ippeve_srv_t; /* Service reference */ typedef void *ippeve_txt_t; /* TXT record */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #if HAVE_LIBPAM typedef struct ippeve_authdata_s /* Authentication data */ @@ -184,14 +185,14 @@ typedef struct ippeve_printer_s /**** Printer data ****/ /* TODO: One IPv4 and one IPv6 listener are really not sufficient */ int ipv4, /* IPv4 listener */ ipv6; /* IPv6 listener */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER ippeve_srv_t ipp_ref, /* DNS-SD IPP service */ ipps_ref, /* DNS-SD IPPS service */ http_ref, /* DNS-SD HTTP service */ printer_ref; /* DNS-SD LPD service */ #elif defined(HAVE_AVAHI) ippeve_srv_t dnssd_ref; /* DNS-SD services */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ char *dnssd_subtypes;/* DNS-SD subtypes */ int dnssd_collision;/* Name collision? */ char *dnssd_name, /* printer-dns-sd-name */ @@ -284,12 +285,12 @@ static void debug_attributes(const char *title, ipp_t *ipp, int response); static void delete_client(ippeve_client_t *client); static void delete_job(ippeve_job_t *job); static void delete_printer(ippeve_printer_t *printer); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void DNSSD_API dnssd_callback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, ippeve_printer_t *printer); #elif defined(HAVE_AVAHI) static void dnssd_callback(AvahiEntryGroup *p, AvahiEntryGroupState state, void *context); static void dnssd_client_cb(AvahiClient *c, AvahiClientState state, void *userdata); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ static void dnssd_init(void); static int filter_cb(ippeve_filter_t *filter, ipp_t *dst, ipp_attribute_t *attr); static ippeve_job_t *find_job(ippeve_client_t *client); @@ -347,12 +348,12 @@ static int valid_job_attributes(ippeve_client_t *client); * Globals... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static DNSServiceRef DNSSDMaster = NULL; #elif defined(HAVE_AVAHI) static AvahiThreadedPoll *DNSSDMaster = NULL; static AvahiClient *DNSSDClient = NULL; -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ static int KeepFiles = 0, /* Keep spooled job files? */ MaxVersion = 20,/* Maximum IPP version (20 = 2.0, 11 = 1.1, etc.) */ @@ -2120,7 +2121,7 @@ delete_printer(ippeve_printer_t *printer) /* I - Printer */ if (printer->ipv6 >= 0) close(printer->ipv6); -#if HAVE_DNSSD +#if HAVE_MDNSRESPONDER if (printer->printer_ref) DNSServiceRefDeallocate(printer->printer_ref); if (printer->ipp_ref) @@ -2136,7 +2137,7 @@ delete_printer(ippeve_printer_t *printer) /* I - Printer */ avahi_entry_group_free(printer->dnssd_ref); avahi_threaded_poll_unlock(DNSSDMaster); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ if (printer->dnssd_name) free(printer->dnssd_name); @@ -2166,7 +2167,7 @@ delete_printer(ippeve_printer_t *printer) /* I - Printer */ } -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER /* * 'dnssd_callback()' - Handle DNS-SD registration events. */ @@ -2254,7 +2255,7 @@ dnssd_client_cb( break; } } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* @@ -2264,7 +2265,7 @@ dnssd_client_cb( static void dnssd_init(void) { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER if (DNSServiceCreateConnection(&DNSSDMaster) != kDNSServiceErr_NoError) { fputs("Error: Unable to initialize DNS-SD.\n", stderr); @@ -2287,7 +2288,7 @@ dnssd_init(void) } avahi_threaded_poll_start(DNSSDMaster); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ } @@ -7133,7 +7134,7 @@ static int /* O - 1 on success, 0 on error */ register_printer( ippeve_printer_t *printer) /* I - Printer */ { -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD ippeve_txt_t ipp_txt; /* DNS-SD IPP TXT record */ int i, /* Looping var */ count; /* Number of values */ @@ -7219,9 +7220,9 @@ register_printer( printer->dnssd_collision = 0; } -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceErrorType error; /* Error from DNS-SD */ char regtype[256]; /* DNS-SD service type */ uint32_t ifindex; /* Interface index */ @@ -7434,7 +7435,7 @@ register_printer( avahi_threaded_poll_unlock(DNSSDMaster); avahi_string_list_free(ipp_txt); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ return (1); } @@ -7629,10 +7630,10 @@ run_printer(ippeve_printer_t *printer) /* I - Printer */ num_fds = 2; -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER polldata[num_fds ].fd = DNSServiceRefSockFD(DNSSDMaster); polldata[num_fds ++].events = POLLIN; -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* * Loop until we are killed or have a hard error... @@ -7686,15 +7687,15 @@ run_printer(ippeve_printer_t *printer) /* I - Printer */ * Process DNS-SD messages... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER if (polldata[2].revents & POLLIN) DNSServiceProcessResult(DNSSDMaster); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ -#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) +#ifdef HAVE_DNSSD if (printer->dnssd_collision) register_printer(printer); -#endif /* HAVE_DNSSD || HAVE_AVAHI */ +#endif /* HAVE_DNSSD */ /* * Clean out old jobs... diff --git a/tools/ippfind.c b/tools/ippfind.c index 53da12557b..e0ea856704 100644 --- a/tools/ippfind.c +++ b/tools/ippfind.c @@ -3,6 +3,7 @@ * commands such as IPP and Bonjour conformance tests. This tool is * inspired by the UNIX "find" command, thus its name. * + * Copyright © 2021 by OpenPrinting. * Copyright © 2020 by the IEEE-ISTO Printer Working Group * Copyright © 2008-2018 by Apple Inc. * @@ -23,7 +24,7 @@ # include #endif /* _WIN32 */ #include -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER # include #elif defined(HAVE_AVAHI) # include @@ -33,7 +34,7 @@ # include # include # define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifndef _WIN32 extern char **environ; /* Process environment variables */ @@ -99,11 +100,11 @@ typedef struct ippfind_expr_s /* Expression */ typedef struct ippfind_srv_s /* Service information */ { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceRef ref; /* Service reference for query */ #elif defined(HAVE_AVAHI) AvahiServiceResolver *ref; /* Resolver */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ char *name, /* Service name */ *domain, /* Domain name */ *regtype, /* Registration type */ @@ -124,14 +125,14 @@ typedef struct ippfind_srv_s /* Service information */ * Local globals... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static DNSServiceRef dnssd_ref; /* Master service reference */ #elif defined(HAVE_AVAHI) static AvahiClient *avahi_client = NULL;/* Client information */ static int avahi_got_data = 0; /* Got data from poll? */ static AvahiSimplePoll *avahi_poll = NULL; /* Poll information */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ static int address_family = AF_UNSPEC; /* Address family for LIST */ @@ -144,7 +145,7 @@ static int ipp_version = 20; /* IPP version for LIST */ * Local functions... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void DNSSD_API browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8); static void DNSSD_API browse_local_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8); #elif defined(HAVE_AVAHI) @@ -160,7 +161,7 @@ static void browse_callback(AvahiServiceBrowser *browser, static void client_callback(AvahiClient *client, AvahiClientState state, void *context); -#endif /* HAVE_AVAHI */ +#endif /* HAVE_MDNSRESPONDER */ static int compare_services(ippfind_srv_t *a, ippfind_srv_t *b); static const char *dnssd_error_string(int error); @@ -174,7 +175,7 @@ static int list_service(ippfind_srv_t *service); static ippfind_expr_t *new_expr(ippfind_op_t op, int invert, const char *value, const char *regex, char **args); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void DNSSD_API resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullName, const char *hostTarget, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context) _CUPS_NONNULL(1,5,6,9, 10); #elif defined(HAVE_AVAHI) static int poll_callback(struct pollfd *pollfds, @@ -193,7 +194,7 @@ static void resolve_callback(AvahiServiceResolver *res, AvahiStringList *txt, AvahiLookupResultFlags flags, void *context); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ static void set_service_uri(ippfind_srv_t *service); static void show_usage(void) _CUPS_NORETURN; static void show_version(void) _CUPS_NORETURN; @@ -227,10 +228,10 @@ main(int argc, /* I - Number of command-line args */ /* Logic for next expression */ int invert = 0; /* Invert expression? */ int err; /* DNS-SD error */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER fd_set sinput; /* Input set for select() */ struct timeval stimeout; /* Timeout for select() */ -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ double endtime; /* End time */ static const char * const ops[] = /* Node operation names */ { @@ -1129,7 +1130,7 @@ main(int argc, /* I - Number of command-line args */ * Start up browsing/resolving... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER if ((err = DNSServiceCreateConnection(&dnssd_ref)) != kDNSServiceErr_NoError) { _cupsLangPrintf(stderr, _("ippfind: Unable to use Bonjour: %s"), @@ -1155,7 +1156,7 @@ main(int argc, /* I - Number of command-line args */ dnssd_error_string(err)); return (IPPFIND_EXIT_BONJOUR); } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ for (search = (const char *)cupsArrayFirst(searches); search; @@ -1230,7 +1231,7 @@ main(int argc, /* I - Number of command-line args */ if (getenv("IPPFIND_DEBUG")) fprintf(stderr, "Resolving name=\"%s\", regtype=\"%s\", domain=\"%s\"\n", name, regtype, domain); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER service->ref = dnssd_ref; err = DNSServiceResolve(&(service->ref), kDNSServiceFlagsShareConnection, 0, name, @@ -1247,7 +1248,7 @@ main(int argc, /* I - Number of command-line args */ err = 0; else err = avahi_client_errno(avahi_client); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ } else { @@ -1258,7 +1259,7 @@ main(int argc, /* I - Number of command-line args */ if (getenv("IPPFIND_DEBUG")) fprintf(stderr, "Browsing for regtype=\"%s\", domain=\"%s\"\n", regtype, domain); -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceRef ref; /* Browse reference */ ref = dnssd_ref; @@ -1290,7 +1291,7 @@ main(int argc, /* I - Number of command-line args */ err = 0; else err = avahi_client_errno(avahi_client); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ } if (err) @@ -1315,7 +1316,7 @@ main(int argc, /* I - Number of command-line args */ { int process = 0; /* Process services? */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER int fd = DNSServiceRefSockFD(dnssd_ref); /* File descriptor for DNS-SD */ @@ -1366,7 +1367,7 @@ main(int argc, /* I - Number of command-line args */ process = 1; } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ if (process) { @@ -1396,7 +1397,7 @@ main(int argc, /* I - Number of command-line args */ if (active < 50) { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER service->ref = dnssd_ref; err = DNSServiceResolve(&(service->ref), kDNSServiceFlagsShareConnection, 0, @@ -1418,7 +1419,7 @@ main(int argc, /* I - Number of command-line args */ err = 0; else err = avahi_client_errno(avahi_client); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ if (err) { @@ -1439,11 +1440,11 @@ main(int argc, /* I - Number of command-line args */ if (service->ref) { -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceRefDeallocate(service->ref); #else avahi_service_resolver_free(service->ref); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ service->ref = NULL; } @@ -1473,7 +1474,7 @@ main(int argc, /* I - Number of command-line args */ } -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER /* * 'browse_callback()' - Browse devices. */ @@ -1543,7 +1544,7 @@ browse_local_callback( replyDomain); service->is_local = 1; } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ #ifdef HAVE_AVAHI @@ -1647,7 +1648,7 @@ compare_services(ippfind_srv_t *a, /* I - First device */ static const char * /* O - Error message */ dnssd_error_string(int error) /* I - Error number */ { -# ifdef HAVE_DNSSD +# ifdef HAVE_MDNSRESPONDER switch (error) { case kDNSServiceErr_NoError : @@ -1752,7 +1753,7 @@ dnssd_error_string(int error) /* I - Error number */ # elif defined(HAVE_AVAHI) return (avahi_strerror(error)); -# endif /* HAVE_DNSSD */ +# endif /* HAVE_MDNSRESPONDER */ } @@ -2178,12 +2179,12 @@ get_service(cups_array_t *services, /* I - Service array */ * resolves... */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain); #else /* HAVE_AVAHI */ avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName, regtype, replyDomain); -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ service->fullName = strdup(fullName); @@ -2545,7 +2546,7 @@ poll_callback( * 'resolve_callback()' - Process resolve data. */ -#ifdef HAVE_DNSSD +#ifdef HAVE_MDNSRESPONDER static void DNSSD_API resolve_callback( DNSServiceRef sdRef, /* I - Service reference */ @@ -2698,7 +2699,7 @@ resolve_callback( set_service_uri(service); } -#endif /* HAVE_DNSSD */ +#endif /* HAVE_MDNSRESPONDER */ /* diff --git a/vcnet/config.h b/vcnet/config.h index 5577b0a58d..e8268d6b29 100644 --- a/vcnet/config.h +++ b/vcnet/config.h @@ -430,24 +430,31 @@ typedef unsigned long useconds_t; /* - * Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)? + * Do we have DNS Service Discovery (aka Bonjour) support? */ #define HAVE_DNSSD 1 /* - * Do we have Avahi for DNS Service Discovery (aka Bonjour)? + * Do we have mDNSResponder for DNS-SD? */ -#undef HAVE_AVAHI +#define HAVE_MDNSRESPONDER 1 + + +/* + * Do we have Avahi for DNS-SD? + */ + +/* #undef HAVE_AVAHI */ /* * Do we have ? */ -#undef HAVE_SYS_IOCTL_H +/* #undef HAVE_SYS_IOCTL_H */ /* diff --git a/xcode/config.h b/xcode/config.h index 150ac5a814..b5da930770 100644 --- a/xcode/config.h +++ b/xcode/config.h @@ -356,14 +356,21 @@ /* - * Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)? + * Do we have DNS Service Discovery (aka Bonjour) support? */ #define HAVE_DNSSD 1 /* - * Do we have Avahi for DNS Service Discovery (aka Bonjour)? + * Do we have mDNSResponder for DNS-SD? + */ + +#define HAVE_MDNSRESPONDER 1 + + +/* + * Do we have Avahi for DNS-SD? */ /* #undef HAVE_AVAHI */