]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/job.h
Import changes from CUPS 1.4svn-r8704.
[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
178cb736 32struct cupsd_job_s /**** Job request ****/
ef416fc2 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 ipp_attribute_t *sheets; /* job-media-sheets-completed */
238c3832
MS
47 time_t access_time, /* Last access time */
48 kill_time, /* When to send SIGKILL */
49 hold_until; /* Hold expiration date/time */
bd7854cb 50 ipp_attribute_t *state; /* Job state */
51 ipp_attribute_t *job_sheets; /* Job sheets (NULL if none) */
bc44d920 52 ipp_attribute_t *printer_message,
53 /* job-printer-state-message */
54 *printer_reasons;
55 /* job-printer-state-reasons */
bd7854cb 56 int current_file; /* Current file in job */
ef416fc2 57 ipp_t *attrs; /* Job attributes */
ef416fc2 58 int print_pipes[2], /* Print data pipes */
89d46774 59 back_pipes[2], /* Backchannel pipes */
f7deaa1a 60 side_pipes[2], /* Sidechannel pipes */
89d46774 61 status_pipes[2];/* Status pipes */
62 cupsd_statbuf_t *status_buffer; /* Status buffer for this job */
b9faaae1
MS
63 int status_level; /* Highest log level in a status
64 * message */
ef416fc2 65 int cost; /* Filtering cost */
e07d4801 66 int pending_cost; /* Waiting for FilterLimit */
ef416fc2 67 int filters[MAX_FILTERS + 1];
68 /* Filter process IDs, 0 terminated */
69 int backend; /* Backend process ID */
70 int status; /* Status code from filters */
71 cupsd_printer_t *printer; /* Printer this job is assigned to */
72 int tries; /* Number of tries for this job */
b9faaae1
MS
73 char *auth_username, /* AUTH_USERNAME environment variable,
74 * if any */
75 *auth_domain, /* AUTH_DOMAIN environment variable,
76 * if any */
77 *auth_password; /* AUTH_PASSWORD environment variable,
78 * if any */
a4924f6c 79 void *profile; /* Security profile */
178cb736 80 cups_array_t *history; /* Debug log history */
9a4f8274 81 int progress; /* Printing progress */
f7deaa1a 82#ifdef HAVE_GSSAPI
c24d2134 83 krb5_ccache ccache; /* Kerberos credential cache */
f7deaa1a 84 char *ccname; /* KRB5CCNAME environment variable */
85#endif /* HAVE_GSSAPI */
f11a948a 86};
ef416fc2 87
178cb736
MS
88typedef struct cupsd_joblog_s /**** Job log message ****/
89{
90 time_t time; /* Time of message */
91 char message[1]; /* Message string */
92} cupsd_joblog_t;
93
ef416fc2 94
95/*
96 * Globals...
97 */
98
99VAR int JobHistory VALUE(1);
100 /* Preserve job history? */
101VAR int JobFiles VALUE(0);
102 /* Preserve job files? */
103VAR int MaxJobs VALUE(0),
104 /* Max number of jobs */
105 MaxActiveJobs VALUE(0),
106 /* Max number of active jobs */
107 MaxJobsPerUser VALUE(0),
108 /* Max jobs per user */
109 MaxJobsPerPrinter VALUE(0);
110 /* Max jobs per printer */
111VAR int JobAutoPurge VALUE(0);
112 /* Automatically purge jobs */
113VAR cups_array_t *Jobs VALUE(NULL),
114 /* List of current jobs */
3dfe78b3 115 *ActiveJobs VALUE(NULL),
ef416fc2 116 /* List of active jobs */
3dfe78b3
MS
117 *PrintingJobs VALUE(NULL);
118 /* List of jobs that are printing */
ef416fc2 119VAR int NextJobId VALUE(1);
120 /* Next job ID to use */
238c3832
MS
121VAR int JobKillDelay VALUE(DEFAULT_TIMEOUT),
122 /* Delay before killing jobs */
123 JobRetryLimit VALUE(5),
ef416fc2 124 /* Max number of tries */
125 JobRetryInterval VALUE(300);
126 /* Seconds between retries */
127
128
129/*
130 * Prototypes...
131 */
132
133extern cupsd_job_t *cupsdAddJob(int priority, const char *dest);
ef416fc2 134extern void cupsdCancelJobs(const char *dest, const char *username,
135 int purge);
136extern void cupsdCheckJobs(void);
137extern void cupsdCleanJobs(void);
b9faaae1
MS
138extern void cupsdContinueJob(cupsd_job_t *job);
139extern void cupsdDeleteJob(cupsd_job_t *job,
140 cupsd_jobaction_t action);
ef416fc2 141extern cupsd_job_t *cupsdFindJob(int id);
ef416fc2 142extern void cupsdFreeAllJobs(void);
143extern int cupsdGetPrinterJobCount(const char *dest);
144extern int cupsdGetUserJobCount(const char *username);
ef416fc2 145extern void cupsdLoadAllJobs(void);
dfd5680b 146extern int cupsdLoadJob(cupsd_job_t *job);
e53920b9 147extern void cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
ef416fc2 148extern void cupsdReleaseJob(cupsd_job_t *job);
149extern void cupsdRestartJob(cupsd_job_t *job);
bd7854cb 150extern void cupsdSaveAllJobs(void);
ef416fc2 151extern void cupsdSaveJob(cupsd_job_t *job);
b9faaae1
MS
152extern void cupsdSetJobHoldUntil(cupsd_job_t *job,
153 const char *when, int update);
ef416fc2 154extern void cupsdSetJobPriority(cupsd_job_t *job, int priority);
b9faaae1
MS
155extern void cupsdSetJobState(cupsd_job_t *job,
156 ipp_jstate_t newstate,
157 cupsd_jobaction_t action,
158 const char *message, ...)
159#ifdef __GNUC__
160__attribute__ ((__format__ (__printf__, 4, 5)))
161#endif /* __GNUC__ */
162;
238c3832
MS
163extern void cupsdStopAllJobs(cupsd_jobaction_t action,
164 int kill_delay);
91c84a35 165extern int cupsdTimeoutJob(cupsd_job_t *job);
bc44d920 166extern void cupsdUnloadCompletedJobs(void);
ef416fc2 167
168
169/*
b19ccc9e 170 * End of "$Id: job.h 7883 2008-08-28 20:38:13Z mike $".
ef416fc2 171 */