]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/job.h
Merge changes from CUPS 1.4svn-r8628.
[thirdparty/cups.git] / scheduler / job.h
index 25aed68d6ff28b4ca0f58adb6a79a158e82b0c67..16dd09ff7cfc587fe25f852bdc01c47ae9dab516 100644 (file)
@@ -1,61 +1,95 @@
 /*
- * "$Id: job.h 177 2006-06-21 00:20:03Z jlovell $"
+ * "$Id: job.h 7883 2008-08-28 20:38:13Z mike $"
  *
  *   Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 2007-2009 by Apple Inc.
+ *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+/*
+ * Constants...
  */
 
+typedef enum cupsd_jobaction_e         /**** Actions for state changes ****/
+{
+  CUPSD_JOB_DEFAULT,                   /* Use default action */
+  CUPSD_JOB_FORCE,                     /* Force the change */
+  CUPSD_JOB_PURGE                      /* Force the change and purge */
+} cupsd_jobaction_t;
+
+
 /*
  * Job request structure...
  */
 
-typedef struct cupsd_job_s
+struct cupsd_job_s                     /**** Job request ****/
 {
   int                  id,             /* Job ID */
-                       priority;       /* Job priority */
+                       priority,       /* Job priority */
+                       dirty;          /* Do we need to write the "c" file? */
   ipp_jstate_t         state_value;    /* Cached job-state */
+  int                  pending_timeout;/* Non-zero if the job was created and
+                                        * waiting on files */
   char                 *username;      /* Printing user */
   char                 *dest;          /* Destination printer or class */
-  cups_ptype_t         dtype;          /* Destination type (class/remote bits) */
+  cups_ptype_t         dtype;          /* Destination type */
   int                  num_files;      /* Number of files in job */
   mime_type_t          **filetypes;    /* File types */
   int                  *compressions;  /* Compression status of each file */
-  time_t               access_time;    /* Last access time */
   ipp_attribute_t      *sheets;        /* job-media-sheets-completed */
-  time_t               hold_until;     /* Hold expiration date/time */
+  time_t               access_time,    /* Last access time */
+                       kill_time,      /* When to send SIGKILL */
+                       hold_until;     /* Hold expiration date/time */
   ipp_attribute_t      *state;         /* Job state */
   ipp_attribute_t      *job_sheets;    /* Job sheets (NULL if none) */
+  ipp_attribute_t      *printer_message,
+                                       /* job-printer-state-message */
+                       *printer_reasons;
+                                       /* job-printer-state-reasons */
   int                  current_file;   /* Current file in job */
   ipp_t                        *attrs;         /* Job attributes */
   int                  print_pipes[2], /* Print data pipes */
                        back_pipes[2],  /* Backchannel pipes */
+                       side_pipes[2],  /* Sidechannel pipes */
                        status_pipes[2];/* Status pipes */
   cupsd_statbuf_t      *status_buffer; /* Status buffer for this job */
+  int                  status_level;   /* Highest log level in a status
+                                        * message */
   int                  cost;           /* Filtering cost */
+  int                  pending_cost;   /* Waiting for FilterLimit */
   int                  filters[MAX_FILTERS + 1];
                                        /* Filter process IDs, 0 terminated */
   int                  backend;        /* Backend process ID */
   int                  status;         /* Status code from filters */
   cupsd_printer_t      *printer;       /* Printer this job is assigned to */
   int                  tries;          /* Number of tries for this job */
-} cupsd_job_t;
+  char                 *auth_username, /* AUTH_USERNAME environment variable,
+                                         * if any */
+                       *auth_domain,   /* AUTH_DOMAIN environment variable,
+                                        * if any */
+                       *auth_password; /* AUTH_PASSWORD environment variable,
+                                        * if any */
+  void                 *profile;       /* Security profile */
+  cups_array_t         *history;       /* Debug log history */
+  int                  progress;       /* Printing progress */
+#ifdef HAVE_GSSAPI
+  krb5_ccache          ccache;         /* Kerberos credential cache */
+  char                 *ccname;        /* KRB5CCNAME environment variable */
+#endif /* HAVE_GSSAPI */
+};
+
+typedef struct cupsd_joblog_s          /**** Job log message ****/
+{
+  time_t               time;           /* Time of message */
+  char                 message[1];     /* Message string */
+} cupsd_joblog_t;
 
 
 /*
@@ -78,11 +112,15 @@ VAR int                    JobAutoPurge    VALUE(0);
                                        /* Automatically purge jobs */
 VAR cups_array_t       *Jobs           VALUE(NULL),
                                        /* List of current jobs */
-                       *ActiveJobs     VALUE(NULL);
+                       *ActiveJobs     VALUE(NULL),
                                        /* List of active jobs */
+                       *PrintingJobs   VALUE(NULL);
+                                       /* List of jobs that are printing */
 VAR int                        NextJobId       VALUE(1);
                                        /* Next job ID to use */
-VAR int                        JobRetryLimit   VALUE(5),
+VAR int                        JobKillDelay    VALUE(DEFAULT_TIMEOUT),
+                                       /* Delay before killing jobs */
+                       JobRetryLimit   VALUE(5),
                                        /* Max number of tries */
                        JobRetryInterval VALUE(300);
                                        /* Seconds between retries */
@@ -93,33 +131,41 @@ VAR int                    JobRetryLimit   VALUE(5),
  */
 
 extern cupsd_job_t     *cupsdAddJob(int priority, const char *dest);
-extern void            cupsdCancelJob(cupsd_job_t *job, int purge);
 extern void            cupsdCancelJobs(const char *dest, const char *username,
                                        int purge);
 extern void            cupsdCheckJobs(void);
 extern void            cupsdCleanJobs(void);
-extern void            cupsdDeleteJob(cupsd_job_t *job);
+extern void            cupsdContinueJob(cupsd_job_t *job);
+extern void            cupsdDeleteJob(cupsd_job_t *job,
+                                      cupsd_jobaction_t action);
 extern cupsd_job_t     *cupsdFindJob(int id);
-extern void            cupsdFinishJob(cupsd_job_t *job);
-extern void            cupsdUnloadCompletedJobs(void);
 extern void            cupsdFreeAllJobs(void);
 extern int             cupsdGetPrinterJobCount(const char *dest);
 extern int             cupsdGetUserJobCount(const char *username);
-extern void            cupsdHoldJob(cupsd_job_t *job);
 extern void            cupsdLoadAllJobs(void);
-extern void            cupsdLoadJob(cupsd_job_t *job);
+extern int             cupsdLoadJob(cupsd_job_t *job);
 extern void            cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
 extern void            cupsdReleaseJob(cupsd_job_t *job);
 extern void            cupsdRestartJob(cupsd_job_t *job);
 extern void            cupsdSaveAllJobs(void);
 extern void            cupsdSaveJob(cupsd_job_t *job);
-extern void            cupsdSetJobHoldUntil(cupsd_job_t *job, const char *when);
+extern void            cupsdSetJobHoldUntil(cupsd_job_t *job,
+                                            const char *when, int update);
 extern void            cupsdSetJobPriority(cupsd_job_t *job, int priority);
-extern void            cupsdStopAllJobs(void);
-extern void            cupsdStopJob(cupsd_job_t *job, int force);
-extern void            cupsdUpdateJob(cupsd_job_t *job);
+extern void            cupsdSetJobState(cupsd_job_t *job,
+                                        ipp_jstate_t newstate,
+                                        cupsd_jobaction_t action,
+                                        const char *message, ...)
+#ifdef __GNUC__
+__attribute__ ((__format__ (__printf__, 4, 5)))
+#endif /* __GNUC__ */
+;
+extern void            cupsdStopAllJobs(cupsd_jobaction_t action,
+                                        int kill_delay);
+extern int             cupsdTimeoutJob(cupsd_job_t *job);
+extern void            cupsdUnloadCompletedJobs(void);
 
 
 /*
- * End of "$Id: job.h 177 2006-06-21 00:20:03Z jlovell $".
+ * End of "$Id: job.h 7883 2008-08-28 20:38:13Z mike $".
  */