[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cups-commit
Subject:    [cups.commit] [CUPS] r10414 - in trunk: cups scheduler
From:       cups-dev () easysw ! com
Date:       2012-04-14 0:17:23
Message-ID: 11186-cups.commit () news ! easysw ! com
[Download RAW message or body]

Author: mike
Date: 2012-04-13 17:17:22 -0700 (Fri, 13 Apr 2012)
New Revision: 10414
Log:
Save work (doesn't compile, sorry...)


Modified:
   trunk/cups/http-support.c
   trunk/scheduler/cupsd.h
   trunk/scheduler/dirsvc.c
   trunk/scheduler/dirsvc.h
   trunk/scheduler/main.c
   trunk/scheduler/printers.h

Modified: trunk/cups/http-support.c
===================================================================
--- trunk/cups/http-support.c	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/cups/http-support.c	2012-04-14 00:17:22 UTC (rev 10414)
@@ -44,6 +44,7 @@
  *   http_client_cb()	  - Client callback for resolving URI.
  *   http_copy_decode()   - Copy and decode a URI.
  *   http_copy_encode()   - Copy and encode a URI.
+ *   http_poll_cb()       - Wait for input on the specified file descriptors.
  *   http_resolve_cb()	  - Build a device URI for the given service name.
  *   http_resolve_cb()	  - Build a device URI for the given service name.
  */

Modified: trunk/scheduler/cupsd.h
===================================================================
--- trunk/scheduler/cupsd.h	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/scheduler/cupsd.h	2012-04-14 00:17:22 UTC (rev 10414)
@@ -138,16 +138,7 @@
 
 typedef void (*cupsd_selfunc_t)(void *data);
 
-#ifdef HAVE_AVAHI
-/*
- * Timeout callback function type...
- */
 
-typedef struct _cupsd_timeout_s cupsd_timeout_t;
-typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data);
-#endif /* HAVE_AVAHI */
-
-
 /*
  * Globals...
  */
@@ -180,13 +171,7 @@
 					/* Running from launchd */
 #endif /* HAVE_LAUNCH_H */
 
-#ifdef HAVE_AVAHI
-VAR cups_array_t	*Timeouts	VALUE(NULL);
-					/* Timed callbacks for main loop */
-#endif /* HAVE_AVAHI */
 
-
-
 /*
  * Prototypes...
  */
@@ -249,20 +234,7 @@
 extern void		cupsdStartServer(void);
 extern void		cupsdStopServer(void);
 
-#ifdef HAVE_AVAHI
-extern cupsd_timeout_t	*cupsdAddTimeout(const struct timeval *tv,
-					 cupsd_timeoutfunc_t cb,
-					 void *data);
-extern cupsd_timeout_t	*cupsdNextTimeout(long *delay);
-extern void		cupsdRemoveTimeout(cupsd_timeout_t *timeout);
-extern void		cupsdRunTimeout(cupsd_timeout_t *timeout);
-extern void		cupsdUpdateTimeout(cupsd_timeout_t *timeout,
-					   const struct timeval *tv);
-#endif /* HAVE_AVAHI */
 
-extern int		cupsdRemoveFile(const char *filename);
-
-
 /*
  * End of "$Id$".
  */

Modified: trunk/scheduler/dirsvc.c
===================================================================
--- trunk/scheduler/dirsvc.c	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/scheduler/dirsvc.c	2012-04-14 00:17:22 UTC (rev 10414)
@@ -3,7 +3,7 @@
  *
  *   Directory services routines for the CUPS scheduler.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -77,25 +77,32 @@
 static void	update_smb(int onoff);
 
 
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
 #  ifdef HAVE_COREFOUNDATION
-static void	dnssdAddAlias(const void *key, const void *value,
-		              void *context);
+static void		dnssdAddAlias(const void *key, const void *value,
+			              void *context);
 #  endif /* HAVE_COREFOUNDATION */
-static char	*dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
-		                     int for_lpd);
+#  ifdef HAVE_DNSSD
+static TXTRecordRef	dnssdBuildTxtRecord(cupsd_printer_t *p, int for_lpd);
+#  else
+static AvahiStringList	*dnssdBuildTxtRecord(cupsd_printer_t *p, int for_lpd);
+#  endif /* HAVE_DNSSD */
 static void	dnssdDeregisterPrinter(cupsd_printer_t *p);
-static char	*dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2],
-		                    int count);
+#  ifdef HAVE_DNSSD
 static void	dnssdRegisterCallback(DNSServiceRef sdRef,
 		                      DNSServiceFlags flags,
 				      DNSServiceErrorType errorCode,
 				      const char *name, const char *regtype,
 				      const char *domain, void *context);
+#  else
+static void	dnssdRegisterCallback(AvahiEntryGroup *p,
+		                      AvahiEntryGroupState state,
+		                      void *context);
+#  endif /* HAVE_DNSSD */
 static void	dnssdRegisterPrinter(cupsd_printer_t *p);
 static void	dnssdStop(void);
 static void	dnssdUpdate(void);
-#endif /* HAVE_DNSSD */
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
 
 
 /*
@@ -449,7 +456,7 @@
 #endif /* HAVE_DNSSD */
 
 
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
 #  ifdef HAVE_COREFOUNDATION
 /*
  * 'dnssdAddAlias()' - Add a DNS-SD alias name.
@@ -495,13 +502,17 @@
  * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info.
  */
 
-static char *				/* O - TXT record */
+#  ifdef HAVE_DNSSD
+static TXTRecordRef			/* O - TXT record */
+#  else
+static AvahiStringList *		/* O - TXT record */
+#  endif /* HAVE_DNSSD */
 dnssdBuildTxtRecord(
-    int             *txt_len,		/* O - TXT record length */
     cupsd_printer_t *p,			/* I - Printer information */
     int             for_lpd)		/* I - 1 = LPD, 0 = IPP */
 {
-  int		i;			/* Looping var */
+  int		i,			/* Looping var */
+		count;			/* Count of key/value pairs */
   char		admin_hostname[256],	/* .local hostname for admin page */
 		adminurl_str[256],	/* URL for the admin page */
 		type_str[32],		/* Type to string buffer */
@@ -509,115 +520,165 @@
 		rp_str[1024],		/* Queue name string buffer */
 		air_str[1024],		/* auth-info-required string buffer */
 		*keyvalue[32][2];	/* Table of key/value pairs */
+#  ifdef HAVE_DNSSD
+  TXTRecordRef	txt;			/* TXT record strings */
+#  else
+  AvahiStringList *txt;			/* TXT record strings */
+#  endif /* HAVE_DNSSD */
 
 
  /*
   * Load up the key value pairs...
   */
 
-  i = 0;
+  count = 0;
 
-  keyvalue[i  ][0] = "txtvers";
-  keyvalue[i++][1] = "1";
+  keyvalue[count  ][0] = "txtvers";
+  keyvalue[count++][1] = "1";
 
-  keyvalue[i  ][0] = "qtotal";
-  keyvalue[i++][1] = "1";
+  keyvalue[count  ][0] = "qtotal";
+  keyvalue[count++][1] = "1";
 
-  keyvalue[i  ][0] = "rp";
-  keyvalue[i++][1] = rp_str;
+  keyvalue[count  ][0] = "rp";
+  keyvalue[count++][1] = rp_str;
   if (for_lpd)
     strlcpy(rp_str, p->name, sizeof(rp_str));
   else
     snprintf(rp_str, sizeof(rp_str), "%s/%s",
 	     (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", p->name);
 
-  keyvalue[i  ][0] = "ty";
-  keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
+  keyvalue[count  ][0] = "ty";
+  keyvalue[count++][1] = p->make_model ? p->make_model : "Unknown";
 
   snprintf(admin_hostname, sizeof(admin_hostname), "%s.local.", DNSSDHostName);
   httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
                    "http", NULL, admin_hostname, DNSSDPort, "/%s/%s",
 		   (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
 		   p->name);
-  keyvalue[i  ][0] = "adminurl";
-  keyvalue[i++][1] = adminurl_str;
+  keyvalue[count  ][0] = "adminurl";
+  keyvalue[count++][1] = adminurl_str;
 
-  keyvalue[i  ][0] = "note";
-  keyvalue[i++][1] = p->location ? p->location : "";
+  if (p->location)
+  {
+    keyvalue[count  ][0] = "note";
+    keyvalue[count++][1] = p->location;
+  }
 
-  keyvalue[i  ][0] = "priority";
-  keyvalue[i++][1] = for_lpd ? "100" : "0";
+  keyvalue[count  ][0] = "priority";
+  keyvalue[count++][1] = for_lpd ? "100" : "0";
 
-  keyvalue[i  ][0] = "product";
-  keyvalue[i++][1] = p->pc && p->pc->product ? p->pc->product : "Unknown";
+  keyvalue[count  ][0] = "product";
+  keyvalue[count++][1] = p->pc && p->pc->product ? p->pc->product : "Unknown";
 
-  keyvalue[i  ][0] = "pdl";
-  keyvalue[i++][1] = p->pdl ? p->pdl : "application/postscript";
+  keyvalue[count  ][0] = "pdl";
+  keyvalue[count++][1] = p->pdl ? p->pdl : "application/postscript";
 
   if (get_auth_info_required(p, air_str, sizeof(air_str)))
   {
-    keyvalue[i  ][0] = "air";
-    keyvalue[i++][1] = air_str;
+    keyvalue[count  ][0] = "air";
+    keyvalue[count++][1] = air_str;
   }
 
-  keyvalue[i  ][0] = "UUID";
-  keyvalue[i++][1] = p->uuid + 9;
+  keyvalue[count  ][0] = "UUID";
+  keyvalue[count++][1] = p->uuid + 9;
 
 #ifdef HAVE_SSL
-  keyvalue[i  ][0] = "TLS";
-  keyvalue[i++][1] = "1.2";
+  keyvalue[count  ][0] = "TLS";
+  keyvalue[count++][1] = "1.2";
 #endif /* HAVE_SSL */
 
-  keyvalue[i  ][0] = "Transparent";
-  keyvalue[i++][1] = "F";
+  if (p->type & CUPS_PRINTER_FAX)
+  {
+    keyvalue[count  ][0] = "Fax";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_FAX) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Binary";
-  keyvalue[i++][1] = "F";
+  if (p->type & CUPS_PRINTER_COLOR)
+  {
+    keyvalue[count  ][0] = "Color";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_COLOR) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Fax";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_FAX) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_DUPLEX)
+  {
+    keyvalue[count  ][0] = "Duplex";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_DUPLEX) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Color";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLOR) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_STAPLE)
+  {
+    keyvalue[count  ][0] = "Staple";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_STAPLE) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Duplex";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_DUPLEX) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_COPIES)
+  {
+    keyvalue[count  ][0] = "Copies";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_COPIES) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Staple";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_STAPLE) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_COLLATE)
+  {
+    keyvalue[count  ][0] = "Collate";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_COLLATE) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Copies";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COPIES) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_PUNCH)
+  {
+    keyvalue[count  ][0] = "Punch";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_PUNCH) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Collate";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLLATE) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_BIND)
+  {
+    keyvalue[count  ][0] = "Bind";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_BIND) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Punch";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_PUNCH) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_SORT)
+  {
+    keyvalue[count  ][0] = "Sort";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_SORT) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Bind";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_BIND) ? "T" : "F";
+  if (p->type & CUPS_PRINTER_MFP)
+  {
+    keyvalue[count  ][0] = "Scan";
+    keyvalue[count++][1] = (p->type & CUPS_PRINTER_MFP) ? "T" : "F";
+  }
 
-  keyvalue[i  ][0] = "Sort";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_SORT) ? "T" : "F";
-
-  keyvalue[i  ][0] = "Scan";
-  keyvalue[i++][1] = (p->type & CUPS_PRINTER_MFP) ? "T" : "F";
-
   snprintf(type_str, sizeof(type_str), "0x%X", p->type | CUPS_PRINTER_REMOTE);
   snprintf(state_str, sizeof(state_str), "%d", p->state);
 
-  keyvalue[i  ][0] = "printer-state";
-  keyvalue[i++][1] = state_str;
+  keyvalue[count  ][0] = "printer-state";
+  keyvalue[count++][1] = state_str;
 
-  keyvalue[i  ][0] = "printer-type";
-  keyvalue[i++][1] = type_str;
+  keyvalue[count  ][0] = "printer-type";
+  keyvalue[count++][1] = type_str;
 
  /*
   * Then pack them into a proper txt record...
   */
 
-  return (dnssdPackTxtRecord(txt_len, keyvalue, i));
+#  ifdef HAVE_DNSSD
+  TXTRecordCreate(&txt, 0, NULL);
+
+  for (i = 0; i < count; i ++)
+  {
+    size_t len = strlen(keyvalue[i][1]);
+
+    if (len < 256)
+      TXTRecordSetValue(txt, keyvalue[i][0], (uint8_t)len, keyvalue[i][1]);
+  }
+
+#  else
+  txt = avahi_string_list_new(NULL);
+
+  for (i = 0; i < count; i ++)
+    avahi_string_list_add_printf(txt, "%s=%s", keyvalue[i][0], keyvalue[i][1]);
+#  endif /* HAVE_DNSSD */
+
+  return (txt);
 }
 
 
@@ -636,37 +697,72 @@
   * Closing the socket deregisters the service
   */
 
+#  ifdef HAVE_DNSSD
   if (p->ipp_ref)
   {
     DNSServiceRefDeallocate(p->ipp_ref);
     p->ipp_ref = NULL;
   }
 
+#    ifdef HAVE_SSL
+  if (p->ipps_ref)
+  {
+    DNSServiceRefDeallocate(p->ipps_ref);
+    p->ipps_ref = NULL;
+  }
+#    endif /* HAVE_SSL */
+
+  if (p->printer_ref)
+  {
+    DNSServiceRefDeallocate(p->ipp_ref);
+    p->ipp_ref = NULL;
+  }
+
   if (p->ipp_txt)
   {
-   /*
-    * p->ipp_txt is malloc'd, not _cupsStrAlloc'd...
-    */
-
-    free(p->ipp_txt);
+    TXTRecordDeallocate(&p->ipp_txt);
     p->ipp_txt = NULL;
   }
 
+  if (p->printer_txt)
+  {
+    TXTRecordDeallocate(&p->printer_txt);
+    p->printer_txt = NULL;
+  }
+
+#  else
+  if (p->ipp_ref)
+  {
+    avahi_entry_group_free(p->ipp_ref);
+    p->ipp_ref = NULL;
+  }
+
+#    ifdef HAVE_SSL
+  if (p->ipps_ref)
+  {
+    avahi_entry_group_free(p->ipps_ref);
+    p->ipps_ref = NULL;
+  }
+#    endif /* HAVE_SSL */
+
   if (p->printer_ref)
   {
-    DNSServiceRefDeallocate(p->printer_ref);
+    avahi_entry_group_free(p->printer_ref);
     p->printer_ref = NULL;
   }
 
+  if (p->ipp_txt)
+  {
+    avahi_string_list_free(p->ipp_txt);
+    p->ipp_txt = NULL;
+  }
+
   if (p->printer_txt)
   {
-   /*
-    * p->printer_txt is malloc'd, not _cupsStrAlloc'd...
-    */
-
-    free(p->printer_txt);
+    avahi_string_list_free(p->printer_txt);
     p->printer_txt = NULL;
   }
+#  endif /* HAVE_DNSSD */
 
  /*
   * Remove the printer from the array of DNS-SD printers, then clear the
@@ -679,71 +775,6 @@
 
 
 /*
- * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
- *                          TXT record format.
- */
-
-static char *				/* O - TXT record */
-dnssdPackTxtRecord(int  *txt_len,	/* O - TXT record length */
-		   char *keyvalue[][2],	/* I - Table of key value pairs */
-		   int  count)		/* I - Items in table */
-{
-  int  i;				/* Looping var */
-  int  length;				/* Length of TXT record */
-  int  length2;				/* Length of value */
-  char *txtRecord;			/* TXT record buffer */
-  char *cursor;				/* Looping pointer */
-
-
- /*
-  * Calculate the buffer size
-  */
-
-  if (count <= 0)
-    return (NULL);
-
-  for (length = i = 0; i < count; i++)
-    length += 1 + strlen(keyvalue[i][0]) +
-	      (keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0);
-
- /*
-  * Allocate and fill it
-  */
-
-  txtRecord = malloc(length);
-  if (txtRecord)
-  {
-    *txt_len = length;
-
-    for (cursor = txtRecord, i = 0; i < count; i++)
-    {
-     /*
-      * Drop in the p-string style length byte followed by the data
-      */
-
-      length  = strlen(keyvalue[i][0]);
-      length2 = keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0;
-
-      *cursor++ = (unsigned char)(length + length2);
-
-      memcpy(cursor, keyvalue[i][0], length);
-      cursor += length;
-
-      if (length2)
-      {
-        length2 --;
-	*cursor++ = '=';
-	memcpy(cursor, keyvalue[i][1], length2);
-	cursor += length2;
-      }
-    }
-  }
-
-  return (txtRecord);
-}
-
-
-/*
  * 'dnssdRegisterCallback()' - DNSServiceRegister callback.
  */
 
@@ -802,9 +833,7 @@
 			*printer_txt,	/* LPD TXT record buffer */
 			name[1024],	/* Service name */
 			*nameptr;	/* Pointer into name */
-  int			ipp_len,	/* IPP TXT record length */
-			printer_len,	/* LPD TXT record length */
-			printer_port;	/* LPD port number */
+  int			printer_port;	/* LPD port number */
   const char		*regtype;	/* Registration type */
 
 
@@ -855,9 +884,9 @@
   * Register IPP and (optionally) LPD...
   */
 
-  ipp_len = 0;				/* anti-compiler-warning-code */
-  ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
+  ipp_txt = dnssdBuildTxtRecord(p, 0);
 
+#uf 0
   if (p->ipp_ref &&
       (ipp_len != p->ipp_len || memcmp(ipp_txt, p->ipp_txt, ipp_len)))
   {
@@ -1027,6 +1056,7 @@
 
   if (printer_txt)
     free(printer_txt);
+#endif /* 0 */
 }
 
 

Modified: trunk/scheduler/dirsvc.h
===================================================================
--- trunk/scheduler/dirsvc.h	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/scheduler/dirsvc.h	2012-04-14 00:17:22 UTC (rev 10414)
@@ -3,7 +3,7 @@
  *
  *   Directory services definitions for the CUPS scheduler.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -34,7 +34,7 @@
 			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),
 					/* Computer/server name */
 			*DNSSDHostName	VALUE(NULL),
@@ -47,11 +47,20 @@
 					/* Port number to register */
 VAR cups_array_t	*DNSSDPrinters	VALUE(NULL);
 					/* Printers we have registered */
+#  ifdef HAVE_DNSSD
 VAR DNSServiceRef	DNSSDRef	VALUE(NULL),
 					/* Master DNS-SD service reference */
 			WebIFRef	VALUE(NULL);
 					/* Service reference for the web interface */
-#endif /* HAVE_DNSSD */
+#  else
+VAR AvahiThreadedPoll	*DNSSDPoll	VALUE(NULL);
+					/* Threaded polling interface for Avahi */
+VAR AvahiClient		*DNSSDClient	VALUE(NULL);
+					/* Client information */
+VAR AvahiEntryGroup	*WebIFRef	VALUE(NULL);
+					/* Service reference for the web interface */
+#  endif /* HAVE_DNSSD */
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
 
 VAR char		*LPDConfigFile	VALUE(NULL),
 					/* LPD configuration file */
@@ -67,9 +76,9 @@
 extern void	cupsdRegisterPrinter(cupsd_printer_t *p);
 extern void	cupsdStartBrowsing(void);
 extern void	cupsdStopBrowsing(void);
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
 extern void	cupsdUpdateDNSSDName(void);
-#endif /* HAVE_DNSSD */
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
 
 
 /*

Modified: trunk/scheduler/main.c
===================================================================
--- trunk/scheduler/main.c	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/scheduler/main.c	2012-04-14 00:17:22 UTC (rev 10414)
@@ -145,10 +145,6 @@
   int			launchd_idle_exit;
 					/* Idle exit on select timeout? */
 #endif	/* HAVE_LAUNCHD */
-#ifdef HAVE_AVAHI
-  cupsd_timeout_t	*tmo;		/* Next scheduled timed callback */
-  long			tmo_delay;	/* Time before it must be called */
-#endif /* HAVE_AVAHI */
 
 
 #ifdef HAVE_GETEUID
@@ -862,16 +858,6 @@
     }
 #endif /* __APPLE__ */
 
-#ifdef HAVE_AVAHI
-   /*
-    * If a timed callback is due, run it.
-    */
-
-    tmo = cupsdNextTimeout(&tmo_delay);
-    if (tmo && tmo_delay == 0)
-      cupsdRunTimeout(tmo);
-#endif /* HAVE_AVAHI */
-
 #ifndef __APPLE__
    /*
     * Update the network interfaces once a minute...
@@ -1773,10 +1759,6 @@
   cupsd_job_t		*job;		/* Job information */
   cupsd_subscription_t	*sub;		/* Subscription information */
   const char		*why;		/* Debugging aid */
-#ifdef HAVE_AVAHI
-  cupsd_timeout_t	*tmo;		/* Timed callback */
-  long			tmo_delay;	/* Seconds before calling it */
-#endif /* HAVE_AVAHI */
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "select_timeout: JobHistoryUpdate=%ld",
@@ -1822,20 +1804,7 @@
   }
 #endif /* __APPLE__ */
 
-#ifdef HAVE_AVAHI
  /*
-  * See if there are any scheduled timed callbacks to run.
-  */
-
-  if ((tmo = cupsdNextTimeout(&tmo_delay)) != NULL &&
-      (now + tmo_delay) < timeout)
-  {
-    timeout = tmo_delay;
-    why     = "run a timed callback";
-  }
-#endif /* HAVE_AVAHI */
-
- /*
   * Check whether we are accepting new connections...
   */
 

Modified: trunk/scheduler/printers.h
===================================================================
--- trunk/scheduler/printers.h	2012-04-13 23:27:27 UTC (rev 10413)
+++ trunk/scheduler/printers.h	2012-04-14 00:17:22 UTC (rev 10414)
@@ -3,7 +3,7 @@
  *
  *   Printer definitions for the CUPS scheduler.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -15,6 +15,10 @@
 
 #ifdef HAVE_DNSSD
 #  include <dns_sd.h>
+#elif defined(HAVE_AVAHI)
+#  include <avahi-client/client.h>
+#  include <avahi-client/publish.h>
+#  include <avahi-common/thread-watch.h>
 #endif /* HAVE_DNSSD */
 #include <cups/pwg-private.h>
 
@@ -92,16 +96,27 @@
   time_t	marker_time;		/* Last time marker attributes were updated */
   _ppd_cache_t	*pc;			/* PPD cache and mapping data */
 
-#ifdef HAVE_DNSSD
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
   char		*reg_name,		/* Name used for service registration */
-		*pdl,			/* pdl value for TXT record */
-		*ipp_txt,		/* IPP TXT record contents */
+		*pdl;			/* pdl value for TXT record */
+#  ifdef HAVE_DNSSD
+  TXTRecordRef	ipp_txt,		/* IPP(S) TXT record contents */
+		printer_txt;		/* LPD TXT record contents */
+  DNSServiceRef	ipp_ref,		/* Reference for _ipp._tcp */
+#    ifdef HAVE_SSL
+		ipps_ref,		/* Reference for _ipps._tcp */
+#    endif /* HAVE_SSL */
+		printer_ref;		/* Reference for _printer._tcp */
+#  else /* HAVE_AVAHI */
+  AvahiStringList *ipp_txt,		/* IPP(S) TXT record contents */
 		*printer_txt;		/* LPD TXT record contents */
-  int		ipp_len,		/* IPP TXT record length */
-		printer_len;		/* LPD TXT record length */
-  DNSServiceRef	ipp_ref,		/* Reference for _ipp._tcp,_cups */
-		printer_ref;		/* Reference for _printer._tcp */
-#endif /* HAVE_DNSSD */
+  AvahiEntryGroup *ipp_ref,		/* Reference for _ipp._tcp */
+#    ifdef HAVE_SSL
+		*ipps_ref,		/* Reference for _ipps._tcp */
+#    endif /* HAVE_SSL */
+		*printer_ref;		/* Reference for _printer._tcp */
+#  endif /* HAVE_DNSSD */
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
 };
 
 

_______________________________________________
cups-commit mailing list
cups-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/cups-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic