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