]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/job.h
Merge changes from CUPS 1.4svn-r8443.
[thirdparty/cups.git] / scheduler / job.h
CommitLineData
ef416fc2 1/*
b19ccc9e 2 * "$Id: job.h 7883 2008-08-28 20:38:13Z mike $"
ef416fc2 3 *
4 * Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
dfd5680b 6 * Copyright 2007-2009 by Apple Inc.
09a101d6 7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8 *
9 * These coded instructions, statements, and computer programs are the
bc44d920 10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 14 */
15
b9faaae1
MS
16/*
17 * Constants...
18 */
19
20typedef enum cupsd_jobaction_e /**** Actions for state changes ****/
21{
22 CUPSD_JOB_DEFAULT, /* Use default action */
23 CUPSD_JOB_FORCE, /* Force the change */
24 CUPSD_JOB_PURGE /* Force the change and purge */
25} cupsd_jobaction_t;
26
27
ef416fc2 28/*
29 * Job request structure...
30 */
31
32typedef struct cupsd_job_s
33{
34 int id, /* Job ID */
3dfe78b3
MS
35 priority, /* Job priority */
36 dirty; /* Do we need to write the "c" file? */
bd7854cb 37 ipp_jstate_t state_value; /* Cached job-state */
b9faaae1
MS
38 int pending_timeout;/* Non-zero if the job was created and
39 * waiting on files */
ef416fc2 40 char *username; /* Printing user */
41 char *dest; /* Destination printer or class */
b9faaae1 42 cups_ptype_t dtype; /* Destination type */
ef416fc2 43 int num_files; /* Number of files in job */
ef416fc2 44 mime_type_t **filetypes; /* File types */
45 int *compressions; /* Compression status of each file */
bd7854cb 46 time_t access_time; /* Last access time */
47 ipp_attribute_t *sheets; /* job-media-sheets-completed */
48 time_t hold_until; /* Hold expiration date/time */
49 ipp_attribute_t *state; /* Job state */
50 ipp_attribute_t *job_sheets; /* Job sheets (NULL if none) */
bc44d920 51 ipp_attribute_t *printer_message,
52 /* job-printer-state-message */
53 *printer_reasons;
54 /* job-printer-state-reasons */
bd7854cb 55 int current_file; /* Current file in job */
ef416fc2 56 ipp_t *attrs; /* Job attributes */
ef416fc2 57 int print_pipes[2], /* Print data pipes */
89d46774 58 back_pipes[2], /* Backchannel pipes */
f7deaa1a 59 side_pipes[2], /* Sidechannel pipes */
89d46774 60 status_pipes[2];/* Status pipes */
61 cupsd_statbuf_t *status_buffer; /* Status buffer for this job */
b9faaae1
MS
62 int status_level; /* Highest log level in a status
63 * message */
ef416fc2 64 int cost; /* Filtering cost */
65 int filters[MAX_FILTERS + 1];
66 /* Filter process IDs, 0 terminated */
67 int backend; /* Backend process ID */
68 int status; /* Status code from filters */
69 cupsd_printer_t *printer; /* Printer this job is assigned to */
70 int tries; /* Number of tries for this job */
b9faaae1
MS
71 char *auth_username, /* AUTH_USERNAME environment variable,
72 * if any */
73 *auth_domain, /* AUTH_DOMAIN environment variable,
74 * if any */
75 *auth_password; /* AUTH_PASSWORD environment variable,
76 * if any */
a4924f6c 77 void *profile; /* Security profile */
9a4f8274 78 int progress; /* Printing progress */
f7deaa1a 79#ifdef HAVE_GSSAPI
c24d2134 80 krb5_ccache ccache; /* Kerberos credential cache */
f7deaa1a 81 char *ccname; /* KRB5CCNAME environment variable */
82#endif /* HAVE_GSSAPI */
ef416fc2 83} cupsd_job_t;
84
85
86/*
87 * Globals...
88 */
89
90VAR int JobHistory VALUE(1);
91 /* Preserve job history? */
92VAR int JobFiles VALUE(0);
93 /* Preserve job files? */
94VAR int MaxJobs VALUE(0),
95 /* Max number of jobs */
96 MaxActiveJobs VALUE(0),
97 /* Max number of active jobs */
98 MaxJobsPerUser VALUE(0),
99 /* Max jobs per user */
100 MaxJobsPerPrinter VALUE(0);
101 /* Max jobs per printer */
102VAR int JobAutoPurge VALUE(0);
103 /* Automatically purge jobs */
104VAR cups_array_t *Jobs VALUE(NULL),
105 /* List of current jobs */
3dfe78b3 106 *ActiveJobs VALUE(NULL),
ef416fc2 107 /* List of active jobs */
3dfe78b3
MS
108 *PrintingJobs VALUE(NULL);
109 /* List of jobs that are printing */
ef416fc2 110VAR int NextJobId VALUE(1);
111 /* Next job ID to use */
112VAR int JobRetryLimit VALUE(5),
113 /* Max number of tries */
114 JobRetryInterval VALUE(300);
115 /* Seconds between retries */
116
117
118/*
119 * Prototypes...
120 */
121
122extern cupsd_job_t *cupsdAddJob(int priority, const char *dest);
ef416fc2 123extern void cupsdCancelJobs(const char *dest, const char *username,
124 int purge);
125extern void cupsdCheckJobs(void);
126extern void cupsdCleanJobs(void);
b9faaae1
MS
127extern void cupsdContinueJob(cupsd_job_t *job);
128extern void cupsdDeleteJob(cupsd_job_t *job,
129 cupsd_jobaction_t action);
ef416fc2 130extern cupsd_job_t *cupsdFindJob(int id);
ef416fc2 131extern void cupsdFreeAllJobs(void);
132extern int cupsdGetPrinterJobCount(const char *dest);
133extern int cupsdGetUserJobCount(const char *username);
ef416fc2 134extern void cupsdLoadAllJobs(void);
dfd5680b 135extern int cupsdLoadJob(cupsd_job_t *job);
e53920b9 136extern void cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
ef416fc2 137extern void cupsdReleaseJob(cupsd_job_t *job);
138extern void cupsdRestartJob(cupsd_job_t *job);
bd7854cb 139extern void cupsdSaveAllJobs(void);
ef416fc2 140extern void cupsdSaveJob(cupsd_job_t *job);
b9faaae1
MS
141extern void cupsdSetJobHoldUntil(cupsd_job_t *job,
142 const char *when, int update);
ef416fc2 143extern void cupsdSetJobPriority(cupsd_job_t *job, int priority);
b9faaae1
MS
144extern void cupsdSetJobState(cupsd_job_t *job,
145 ipp_jstate_t newstate,
146 cupsd_jobaction_t action,
147 const char *message, ...)
148#ifdef __GNUC__
149__attribute__ ((__format__ (__printf__, 4, 5)))
150#endif /* __GNUC__ */
151;
152extern void cupsdStopAllJobs(cupsd_jobaction_t action);
91c84a35 153extern int cupsdTimeoutJob(cupsd_job_t *job);
bc44d920 154extern void cupsdUnloadCompletedJobs(void);
ef416fc2 155
156
157/*
b19ccc9e 158 * End of "$Id: job.h 7883 2008-08-28 20:38:13Z mike $".
ef416fc2 159 */