]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/job.h
Allow backends to have group read + execute permissions and still run as root
[thirdparty/cups.git] / scheduler / job.h
CommitLineData
ef416fc2 1/*
f2d18633 2 * "$Id$"
ef416fc2 3 *
581dae2d 4 * Print job definitions for the CUPS scheduler.
ef416fc2 5 *
8e67b75b 6 * Copyright 2007-2014 by Apple Inc.
581dae2d 7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8 *
581dae2d
MS
9 * These coded instructions, statements, and computer programs are the
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 */
82cc1f9a
MS
50 file_time, /* Job file retain time */
51 history_time, /* Job history retain time */
52 hold_until, /* Hold expiration date/time */
53 kill_time; /* When to send SIGKILL */
bd7854cb 54 ipp_attribute_t *state; /* Job state */
12f89d24 55 ipp_attribute_t *reasons; /* Job state reasons */
bd7854cb 56 ipp_attribute_t *job_sheets; /* Job sheets (NULL if none) */
bc44d920 57 ipp_attribute_t *printer_message,
58 /* job-printer-state-message */
59 *printer_reasons;
60 /* job-printer-state-reasons */
bd7854cb 61 int current_file; /* Current file in job */
ef416fc2 62 ipp_t *attrs; /* Job attributes */
ef416fc2 63 int print_pipes[2], /* Print data pipes */
89d46774 64 back_pipes[2], /* Backchannel pipes */
f7deaa1a 65 side_pipes[2], /* Sidechannel pipes */
89d46774 66 status_pipes[2];/* Status pipes */
67 cupsd_statbuf_t *status_buffer; /* Status buffer for this job */
b9faaae1
MS
68 int status_level; /* Highest log level in a status
69 * message */
ef416fc2 70 int cost; /* Filtering cost */
e07d4801 71 int pending_cost; /* Waiting for FilterLimit */
ef416fc2 72 int filters[MAX_FILTERS + 1];
73 /* Filter process IDs, 0 terminated */
74 int backend; /* Backend process ID */
75 int status; /* Status code from filters */
ef416fc2 76 int tries; /* Number of tries for this job */
1e3e80bb 77 int completed; /* cups-waiting-for-job-completed seen */
8e67b75b 78 int retry_as_raster;/* Need to retry the job as raster */
88f9aafc 79 char *auth_env[3], /* AUTH_xxx environment variables,
b9faaae1 80 * if any */
88f9aafc 81 *auth_uid; /* AUTH_UID environment variable */
8fe0183a
MS
82 void *profile, /* Security profile for filters */
83 *bprofile; /* Security profile for backend */
178cb736 84 cups_array_t *history; /* Debug log history */
9a4f8274 85 int progress; /* Printing progress */
a29fd7dd
MS
86 int num_keywords; /* Number of PPD keywords */
87 cups_option_t *keywords; /* PPD keywords */
f11a948a 88};
ef416fc2 89
178cb736
MS
90typedef struct cupsd_joblog_s /**** Job log message ****/
91{
92 time_t time; /* Time of message */
93 char message[1]; /* Message string */
94} cupsd_joblog_t;
95
ef416fc2 96
97/*
98 * Globals...
99 */
100
82cc1f9a 101VAR int JobHistory VALUE(INT_MAX);
ef416fc2 102 /* Preserve job history? */
82cc1f9a 103VAR int JobFiles VALUE(86400);
ef416fc2 104 /* Preserve job files? */
82cc1f9a
MS
105VAR time_t JobHistoryUpdate VALUE(0);
106 /* Time for next job history update */
ef416fc2 107VAR int MaxJobs VALUE(0),
108 /* Max number of jobs */
109 MaxActiveJobs VALUE(0),
110 /* Max number of active jobs */
3e7fe0ca
MS
111 MaxHoldTime VALUE(0),
112 /* Max time for indefinite hold */
ef416fc2 113 MaxJobsPerUser VALUE(0),
114 /* Max jobs per user */
dcb445bc 115 MaxJobsPerPrinter VALUE(0),
ef416fc2 116 /* Max jobs per printer */
dcb445bc
MS
117 MaxJobTime VALUE(3 * 60 * 60);
118 /* Max time for a job */
ef416fc2 119VAR int JobAutoPurge VALUE(0);
120 /* Automatically purge jobs */
121VAR cups_array_t *Jobs VALUE(NULL),
122 /* List of current jobs */
3dfe78b3 123 *ActiveJobs VALUE(NULL),
ef416fc2 124 /* List of active jobs */
3dfe78b3
MS
125 *PrintingJobs VALUE(NULL);
126 /* List of jobs that are printing */
ef416fc2 127VAR int NextJobId VALUE(1);
128 /* Next job ID to use */
238c3832
MS
129VAR int JobKillDelay VALUE(DEFAULT_TIMEOUT),
130 /* Delay before killing jobs */
131 JobRetryLimit VALUE(5),
ef416fc2 132 /* Max number of tries */
133 JobRetryInterval VALUE(300);
134 /* Seconds between retries */
135
136
137/*
138 * Prototypes...
139 */
140
141extern cupsd_job_t *cupsdAddJob(int priority, const char *dest);
ef416fc2 142extern void cupsdCancelJobs(const char *dest, const char *username,
143 int purge);
144extern void cupsdCheckJobs(void);
145extern void cupsdCleanJobs(void);
b9faaae1
MS
146extern void cupsdContinueJob(cupsd_job_t *job);
147extern void cupsdDeleteJob(cupsd_job_t *job,
148 cupsd_jobaction_t action);
ef416fc2 149extern cupsd_job_t *cupsdFindJob(int id);
ef416fc2 150extern void cupsdFreeAllJobs(void);
151extern int cupsdGetPrinterJobCount(const char *dest);
152extern int cupsdGetUserJobCount(const char *username);
ef416fc2 153extern void cupsdLoadAllJobs(void);
dfd5680b 154extern int cupsdLoadJob(cupsd_job_t *job);
e53920b9 155extern void cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
ef416fc2 156extern void cupsdReleaseJob(cupsd_job_t *job);
157extern void cupsdRestartJob(cupsd_job_t *job);
bd7854cb 158extern void cupsdSaveAllJobs(void);
ef416fc2 159extern void cupsdSaveJob(cupsd_job_t *job);
b9faaae1
MS
160extern void cupsdSetJobHoldUntil(cupsd_job_t *job,
161 const char *when, int update);
ef416fc2 162extern void cupsdSetJobPriority(cupsd_job_t *job, int priority);
b9faaae1
MS
163extern void cupsdSetJobState(cupsd_job_t *job,
164 ipp_jstate_t newstate,
165 cupsd_jobaction_t action,
166 const char *message, ...)
85dda01c
MS
167 __attribute__((__format__(__printf__,
168 4, 5)));
238c3832
MS
169extern void cupsdStopAllJobs(cupsd_jobaction_t action,
170 int kill_delay);
91c84a35 171extern int cupsdTimeoutJob(cupsd_job_t *job);
bc44d920 172extern void cupsdUnloadCompletedJobs(void);
82cc1f9a 173extern void cupsdUpdateJobs(void);
ef416fc2 174
175
176/*
f2d18633 177 * End of "$Id$".
ef416fc2 178 */