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