]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/printers.h
Strip trailing slash from regex paths to prevent sandboxing issues.
[thirdparty/cups.git] / scheduler / printers.h
index f4e66913811f363e1c97fcabb99a43bfcc95b21f..a5ced9f21c5b18c3977ff4492b014ef9dc03e1c2 100644 (file)
@@ -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
 
 #ifdef HAVE_DNSSD
 #  include <dns_sd.h>
+#elif defined(HAVE_AVAHI)
+#  include <avahi-client/client.h>
+#  include <avahi-client/publish.h>
+#  include <avahi-common/error.h>
+#  include <avahi-common/thread-watch.h>
 #endif /* HAVE_DNSSD */
 #include <cups/pwg-private.h>
 
@@ -32,6 +37,20 @@ typedef struct
 } cupsd_quota_t;
 
 
+/*
+ * DNS-SD types to make the code cleaner/clearer...
+ */
+
+#ifdef HAVE_DNSSD
+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 */
+
+
 /*
  * Printer/class information structure...
  */
@@ -41,6 +60,7 @@ typedef struct cupsd_job_s cupsd_job_t;
 struct cupsd_printer_s
 {
   char         *uri,                   /* Printer URI */
+               *uuid,                  /* Printer UUID */
                *hostname,              /* Host printer resides on */
                *name,                  /* Printer name */
                *location,              /* Location code */
@@ -60,9 +80,6 @@ struct cupsd_printer_s
   time_t       state_time;             /* Time at this state */
   char         *job_sheets[2];         /* Banners/job sheets */
   cups_ptype_t type;                   /* Printer type (color, small, etc.) */
-  char         *browse_attrs;          /* Attributes sent with browse data */
-  time_t       browse_expire;          /* Expiration time for printer */
-  time_t       browse_time;            /* Last time update was sent/received */
   char         *device_uri;            /* Device URI */
   char         *sanitized_device_uri;  /* Sanitized device URI */
   char         *port_monitor;          /* Port monitor */
@@ -70,7 +87,8 @@ struct cupsd_printer_s
   int          remote;                 /* Remote queue? */
   mime_type_t  *filetype,              /* Pseudo-filetype for printer */
                *prefiltertype;         /* Pseudo-filetype for pre-filters */
-  cups_array_t *filetypes;             /* Supported file types */
+  cups_array_t *filetypes,             /* Supported file types */
+               *dest_types;            /* Destination types for queue */
   cupsd_job_t  *job;                   /* Current job in queue */
   ipp_t                *attrs,                 /* Attributes supported by this printer */
                *ppd_attrs;             /* Attributes based on the PPD */
@@ -91,22 +109,19 @@ struct cupsd_printer_s
   char         *alert,                 /* PSX printer-alert value */
                *alert_description;     /* PSX printer-alert-description value */
   time_t       marker_time;            /* Last time marker attributes were updated */
-  cups_array_t *filters,               /* Filters for queue */
-               *pre_filters,           /* Pre-filters for queue */
-               *dest_types;            /* Destination types for queue */
   _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 */
-               *product,               /* PPD Product string */
-               *pdl,                   /* pdl value for TXT record */
-               *ipp_txt,               /* IPP 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 */
+               *pdl;                   /* pdl value for TXT record */
+  cupsd_srv_t  ipp_srv;                /* IPP service(s) */
+#  ifdef HAVE_DNSSD
+#    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 */
 };
 
 
@@ -118,10 +133,8 @@ VAR ipp_t          *CommonData     VALUE(NULL);
                                        /* Common printer object attrs */
 VAR cups_array_t       *CommonDefaults VALUE(NULL);
                                        /* Common -default option names */
-VAR cups_array_t       *Printers       VALUE(NULL),
+VAR cups_array_t       *Printers       VALUE(NULL);
                                        /* Printer list */
-                       *ImplicitPrinters VALUE(NULL);
-                                       /* Implicit class printers */
 VAR cupsd_printer_t    *DefaultPrinter VALUE(NULL);
                                        /* Default printer */
 VAR char               *DefaultPolicy  VALUE(NULL);
@@ -159,7 +172,8 @@ extern int          cupsdSetPrinterReasons(cupsd_printer_t *p,
                                               const char *s);
 extern void            cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s,
                                             int update);
-#define                        cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
+#define                        cupsdStartPrinter(p,u) cupsdSetPrinterState((p), \
+                                                  IPP_PRINTER_IDLE, (u))
 extern void            cupsdStopPrinter(cupsd_printer_t *p, int update);
 extern int             cupsdUpdatePrinterPPD(cupsd_printer_t *p,
                                              int num_keywords,