-diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
-index 99b8e7b..2688eff 100644
---- a/cgi-bin/admin.c
-+++ b/cgi-bin/admin.c
-@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
- else
- local_protocols[0] = '\0';
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if (cgiGetVariable("BROWSE_LOCAL_DNSSD"))
- {
- if (local_protocols[0])
-@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
- else
- strcat(local_protocols, "dnssd");
- }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LDAP
- if (cgiGetVariable("BROWSE_LOCAL_LDAP"))
-@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP connection */
- #endif /* HAVE_GSSAPI */
- cgiSetVariable("KERBEROS", "");
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cgiSetVariable("HAVE_DNSSD", "1");
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LDAP
- cgiSetVariable("HAVE_LDAP", "1");
diff --git a/scheduler/client.c b/scheduler/client.c
index e4c9b01..984dcc5 100644
--- a/scheduler/client.c
--- a/scheduler/dirsvc.c
+++ b/scheduler/dirsvc.c
@@ -27,6 +27,7 @@
- * ldap_connect() - Start new LDAP connection
- * ldap_reconnect() - Reconnect to LDAP Server
- * ldap_disconnect() - Disconnect from LDAP Server
+ * remote printers.
+ * cupsdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+ * cupsdStartAvahiClient() - Start an Avahi client if needed
- * cupsdStartBrowsing() - Start sending and receiving broadcast
- * information.
- * cupsdStartPolling() - Start polling servers as needed.
+ * cupsdStartBrowsing() - Start sending and receiving broadcast
+ * information.
+ * cupsdStopBrowsing() - Stop sending and receiving broadcast
@@ -45,6 +46,8 @@
- * printer.
- * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
- * record format.
+ * printer.
+ * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
+ * record format.
+ * avahiPackTxtRecord() - Pack an array of key/value pairs into an
+ * AvahiStringList.
- * dnssdRegisterCallback() - DNSServiceRegister callback.
- * dnssdRegisterPrinter() - Start sending broadcast information for a
- * printer or update the broadcast contents.
+ * dnssdRegisterCallback() - DNSServiceRegister callback.
+ * dnssdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
@@ -83,6 +86,7 @@
*/
/*
-@@ -159,27 +174,39 @@ static void update_polling(void);
+@@ -159,26 +174,39 @@ static void update_polling(void);
static void update_smb(int onoff);
# endif /* HAVE_COREFOUNDATION */
-static char *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
- int for_lpd);
--static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
-static void dnssdDeregisterPrinter(cupsd_printer_t *p);
-static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2],
- int count);
+ void *userdata);
+#endif /* HAVE_AVAHI */
+
- #ifdef HAVE_LDAP
- static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
- {
+
+ /*
+ * 'cupsdDeregisterPrinter()' - Stop sending broadcast information for a
@@ -283,10 +310,10 @@ cupsdDeregisterPrinter(
ldap_dereg_printer(p);
#endif /* HAVE_LDAP */
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD)
+ if (BrowseLocalProtocols & BROWSE_DNSSD)
{
+#ifdef HAVE_DNSSD
DNSServiceErrorType error; /* Error from service creation */
+ }
+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_LIBSLP
- if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
+ /*
+ * Enable LPD and SMB printer sharing as needed through external programs...
@@ -1834,10 +1893,10 @@ cupsdStopBrowsing(void)
BrowseSocket = -1;
}
}
-@@ -2474,7 +2588,16 @@ static int /* O - Result of comparison */
- dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */
- cupsd_printer_t *b)/* I - Second printer */
- {
-- return (_cups_strcasecmp(a->reg_name, b->reg_name));
-+ if (!a->reg_name)
-+ if (!b->reg_name)
-+ return 0;
-+ else
-+ return -1;
-+ else
-+ if (!b->reg_name)
-+ return 1;
-+ else
-+ return (_cups_strcasecmp(a->reg_name, b->reg_name));
- }
-
-
@@ -2489,6 +2612,10 @@ dnssdDeregisterPrinter(
{
cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
--- a/scheduler/dirsvc.h
+++ b/scheduler/dirsvc.h
@@ -31,6 +31,10 @@
- # endif /* HAVE_LDAP_SSL_H */
- #endif /* HAVE_LDAP */
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+#ifdef HAVE_AVAHI
+# include <avahi-client/publish.h>
* Browse protocols...
*/
@@ -131,19 +135,22 @@ VAR int PollPipe VALUE(0);
- VAR cupsd_statbuf_t *PollStatusBuffer VALUE(NULL);
- /* Status buffer for pollers */
-
+ BrowseLocalProtocols
+ VALUE(BROWSE_ALL);
+ /* Protocols to support for local printers */
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
VAR char *DNSSDComputerName VALUE(NULL),
+ /* List of dynamic ServerAlias's */
VAR DNSServiceRef DNSSDRef VALUE(NULL),
/* Master DNS-SD service reference */
- WebIFRef VALUE(NULL),
+ WebIFRef VALUE(NULL);
@@ -152,6 +159,17 @@ VAR DNSServiceRef DNSSDRef VALUE(NULL),
/* Remote printer browse reference */
#endif /* HAVE_DNSSD */
+ /* Web interface entry group */
+#endif /* HAVE_AVAHI */
+
- #ifdef HAVE_LIBSLP
- VAR SLPHandle BrowseSLPHandle VALUE(NULL);
- /* SLP API handle */
-@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_printer_t *p);
- extern void cupsdRestartPolling(void);
- extern void cupsdSaveRemoteCache(void);
- extern void cupsdSendBrowseList(void);
+ VAR char *LPDConfigFile VALUE(NULL),
+ /* LPD configuration file */
+ *SMBConfigFile VALUE(NULL);
+@@ -195,11 +213,12 @@ extern void cupsdRegisterPrinter(cupsd_printer_t *p);
+
+ extern void cupsdDeregisterPrinter(cupsd_printer_t *p, int removeit);
+ extern void cupsdRegisterPrinter(cupsd_printer_t *p);
+extern void cupsdStartAvahiClient(void);
extern void cupsdStartBrowsing(void);
- extern void cupsdStartPolling(void);
extern void cupsdStopBrowsing(void);
- extern void cupsdStopPolling(void);
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
extern void cupsdUpdateDNSSDName(void);
-#endif /* HAVE_DNSSD */
+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_LDAP
- extern void cupsdUpdateLDAPBrowse(void);
- #endif /* HAVE_LDAP */
+
+
+ /*
diff --git a/scheduler/ipp.c b/scheduler/ipp.c
index a048baa..9a3ab11 100644
--- a/scheduler/ipp.c
+ avahi_client_time, /* Time for next Avahi client
+ check */
+#endif /* HAVE_AVAHI */
- browse_time, /* Next browse send time */
senddoc_time, /* Send-Document time */
expire_time, /* Subscription expire time */
+ report_time, /* Malloc/client/job report time */
@@ -662,6 +666,9 @@ main(int argc, /* I - Number of command-line args */
*/
+#ifdef HAVE_AVAHI
+ avahi_client_time = current_time;
+#endif /* HAVE_AVAHI */
- browse_time = current_time;
event_time = current_time;
expire_time = current_time;
+ fds = 1;
@@ -884,6 +891,16 @@ main(int argc, /* I - Number of command-line args */
tmo = cupsdNextTimeout (&tmo_delay);
if (tmo && tmo_delay == 0)