]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/job.h
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / scheduler / job.h
CommitLineData
ef416fc2 1/*
581dae2d 2 * Print job definitions for the CUPS scheduler.
ef416fc2 3 *
9514a192 4 * Copyright 2007-2015 by Apple Inc.
581dae2d 5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 6 *
581dae2d
MS
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
57b7b66b 11 * missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 12 */
13
b9faaae1
MS
14/*
15 * Constants...
16 */
17
18typedef enum cupsd_jobaction_e /**** Actions for state changes ****/
19{
20 CUPSD_JOB_DEFAULT, /* Use default action */
21 CUPSD_JOB_FORCE, /* Force the change */
22 CUPSD_JOB_PURGE /* Force the change and purge */
23} cupsd_jobaction_t;
24
25
ef416fc2 26/*
27 * Job request structure...
28 */
29
178cb736 30struct cupsd_job_s /**** Job request ****/
ef416fc2 31{
32 int id, /* Job ID */
3dfe78b3
MS
33 priority, /* Job priority */
34 dirty; /* Do we need to write the "c" file? */
bd7854cb 35 ipp_jstate_t state_value; /* Cached job-state */
b9faaae1
MS
36 int pending_timeout;/* Non-zero if the job was created and
37 * waiting on files */
ef416fc2 38 char *username; /* Printing user */
39 char *dest; /* Destination printer or class */
f16ea703
MS
40 char *name; /* Job name/title */
41 int koctets; /* job-k-octets */
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 */
9514a192
MS
47 ipp_attribute_t *impressions, /* job-impressions-completed */
48 *sheets; /* job-media-sheets-completed */
238c3832 49 time_t access_time, /* Last access time */
dcb445bc 50 cancel_time, /* When to cancel/send SIGTERM */
f16ea703 51 creation_time, /* When job was created */
eec1fbc3 52 completed_time, /* When job was completed (0 if not) */
82cc1f9a
MS
53 file_time, /* Job file retain time */
54 history_time, /* Job history retain time */
55 hold_until, /* Hold expiration date/time */
56 kill_time; /* When to send SIGKILL */
bd7854cb 57 ipp_attribute_t *state; /* Job state */
12f89d24 58 ipp_attribute_t *reasons; /* Job state reasons */
bd7854cb 59 ipp_attribute_t *job_sheets; /* Job sheets (NULL if none) */
bc44d920 60 ipp_attribute_t *printer_message,
61 /* job-printer-state-message */
62 *printer_reasons;
63 /* job-printer-state-reasons */
bd7854cb 64 int current_file; /* Current file in job */
ef416fc2 65 ipp_t *attrs; /* Job attributes */
ef416fc2 66 int print_pipes[2], /* Print data pipes */
89d46774 67 back_pipes[2], /* Backchannel pipes */
f7deaa1a 68 side_pipes[2], /* Sidechannel pipes */
89d46774 69 status_pipes[2];/* Status pipes */
70 cupsd_statbuf_t *status_buffer; /* Status buffer for this job */
b9faaae1
MS
71 int status_level; /* Highest log level in a status
72 * message */
ef416fc2 73 int cost; /* Filtering cost */
e07d4801 74 int pending_cost; /* Waiting for FilterLimit */
ef416fc2 75 int filters[MAX_FILTERS + 1];
76 /* Filter process IDs, 0 terminated */
77 int backend; /* Backend process ID */
78 int status; /* Status code from filters */
ef416fc2 79 int tries; /* Number of tries for this job */
1e3e80bb 80 int completed; /* cups-waiting-for-job-completed seen */
8e67b75b 81 int retry_as_raster;/* Need to retry the job as raster */
88f9aafc 82 char *auth_env[3], /* AUTH_xxx environment variables,
b9faaae1 83 * if any */
88f9aafc 84 *auth_uid; /* AUTH_UID environment variable */
8fe0183a
MS
85 void *profile, /* Security profile for filters */
86 *bprofile; /* Security profile for backend */
178cb736 87 cups_array_t *history; /* Debug log history */
9a4f8274 88 int progress; /* Printing progress */
a29fd7dd
MS
89 int num_keywords; /* Number of PPD keywords */
90 cups_option_t *keywords; /* PPD keywords */
f11a948a 91};
ef416fc2 92
178cb736
MS
93typedef struct cupsd_joblog_s /**** Job log message ****/
94{
95 time_t time; /* Time of message */
96 char message[1]; /* Message string */
97} cupsd_joblog_t;
98
ef416fc2 99
100/*
101 * Globals...
102 */
103
82cc1f9a 104VAR int JobHistory VALUE(INT_MAX);
ef416fc2 105 /* Preserve job history? */
82cc1f9a 106VAR int JobFiles VALUE(86400);
ef416fc2 107 /* Preserve job files? */
82cc1f9a
MS
108VAR time_t JobHistoryUpdate VALUE(0);
109 /* Time for next job history update */
ef416fc2 110VAR int MaxJobs VALUE(0),
111 /* Max number of jobs */
112 MaxActiveJobs VALUE(0),
113 /* Max number of active jobs */
3e7fe0ca
MS
114 MaxHoldTime VALUE(0),
115 /* Max time for indefinite hold */
ef416fc2 116 MaxJobsPerUser VALUE(0),
117 /* Max jobs per user */
dcb445bc 118 MaxJobsPerPrinter VALUE(0),
ef416fc2 119 /* Max jobs per printer */
dcb445bc
MS
120 MaxJobTime VALUE(3 * 60 * 60);
121 /* Max time for a job */
ef416fc2 122VAR int JobAutoPurge VALUE(0);
123 /* Automatically purge jobs */
124VAR cups_array_t *Jobs VALUE(NULL),
125 /* List of current jobs */
3dfe78b3 126 *ActiveJobs VALUE(NULL),
ef416fc2 127 /* List of active jobs */
3dfe78b3
MS
128 *PrintingJobs VALUE(NULL);
129 /* List of jobs that are printing */
ef416fc2 130VAR int NextJobId VALUE(1);
131 /* Next job ID to use */
238c3832
MS
132VAR int JobKillDelay VALUE(DEFAULT_TIMEOUT),
133 /* Delay before killing jobs */
134 JobRetryLimit VALUE(5),
ef416fc2 135 /* Max number of tries */
136 JobRetryInterval VALUE(300);
137 /* Seconds between retries */
138
139
140/*
141 * Prototypes...
142 */
143
144extern cupsd_job_t *cupsdAddJob(int priority, const char *dest);
ef416fc2 145extern void cupsdCancelJobs(const char *dest, const char *username,
146 int purge);
147extern void cupsdCheckJobs(void);
148extern void cupsdCleanJobs(void);
b9faaae1
MS
149extern void cupsdContinueJob(cupsd_job_t *job);
150extern void cupsdDeleteJob(cupsd_job_t *job,
151 cupsd_jobaction_t action);
ef416fc2 152extern cupsd_job_t *cupsdFindJob(int id);
ef416fc2 153extern void cupsdFreeAllJobs(void);
eec1fbc3 154extern cups_array_t *cupsdGetCompletedJobs(cupsd_printer_t *p);
ef416fc2 155extern int cupsdGetPrinterJobCount(const char *dest);
156extern int cupsdGetUserJobCount(const char *username);
ef416fc2 157extern void cupsdLoadAllJobs(void);
dfd5680b 158extern int cupsdLoadJob(cupsd_job_t *job);
e53920b9 159extern void cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
ef416fc2 160extern void cupsdReleaseJob(cupsd_job_t *job);
161extern void cupsdRestartJob(cupsd_job_t *job);
bd7854cb 162extern void cupsdSaveAllJobs(void);
ef416fc2 163extern void cupsdSaveJob(cupsd_job_t *job);
b9faaae1
MS
164extern void cupsdSetJobHoldUntil(cupsd_job_t *job,
165 const char *when, int update);
ef416fc2 166extern void cupsdSetJobPriority(cupsd_job_t *job, int priority);
b9faaae1
MS
167extern void cupsdSetJobState(cupsd_job_t *job,
168 ipp_jstate_t newstate,
169 cupsd_jobaction_t action,
170 const char *message, ...)
85dda01c
MS
171 __attribute__((__format__(__printf__,
172 4, 5)));
238c3832
MS
173extern void cupsdStopAllJobs(cupsd_jobaction_t action,
174 int kill_delay);
91c84a35 175extern int cupsdTimeoutJob(cupsd_job_t *job);
bc44d920 176extern void cupsdUnloadCompletedJobs(void);
82cc1f9a 177extern void cupsdUpdateJobs(void);