]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/job.h
2 * "$Id: job.h 13138 2016-03-15 14:59:54Z msweet $"
4 * Print job definitions for the CUPS scheduler.
6 * Copyright 2007-2015 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
20 typedef enum cupsd_jobaction_e
/**** Actions for state changes ****/
22 CUPSD_JOB_DEFAULT
, /* Use default action */
23 CUPSD_JOB_FORCE
, /* Force the change */
24 CUPSD_JOB_PURGE
/* Force the change and purge */
29 * Job request structure...
32 struct cupsd_job_s
/**** Job request ****/
35 priority
, /* Job priority */
36 dirty
; /* Do we need to write the "c" file? */
37 ipp_jstate_t state_value
; /* Cached job-state */
38 int pending_timeout
;/* Non-zero if the job was created and
40 char *username
; /* Printing user */
41 char *dest
; /* Destination printer or class */
42 char *name
; /* Job name/title */
43 int koctets
; /* job-k-octets */
44 cups_ptype_t dtype
; /* Destination type */
45 cupsd_printer_t
*printer
; /* Printer this job is assigned to */
46 int num_files
; /* Number of files in job */
47 mime_type_t
**filetypes
; /* File types */
48 int *compressions
; /* Compression status of each file */
49 ipp_attribute_t
*impressions
, /* job-impressions-completed */
50 *sheets
; /* job-media-sheets-completed */
51 time_t access_time
, /* Last access time */
52 cancel_time
, /* When to cancel/send SIGTERM */
53 creation_time
, /* When job was created */
54 completed_time
, /* When job was completed (0 if not) */
55 file_time
, /* Job file retain time */
56 history_time
, /* Job history retain time */
57 hold_until
, /* Hold expiration date/time */
58 kill_time
; /* When to send SIGKILL */
59 ipp_attribute_t
*state
; /* Job state */
60 ipp_attribute_t
*reasons
; /* Job state reasons */
61 ipp_attribute_t
*job_sheets
; /* Job sheets (NULL if none) */
62 ipp_attribute_t
*printer_message
,
63 /* job-printer-state-message */
65 /* job-printer-state-reasons */
66 int current_file
; /* Current file in job */
67 ipp_t
*attrs
; /* Job attributes */
68 int print_pipes
[2], /* Print data pipes */
69 back_pipes
[2], /* Backchannel pipes */
70 side_pipes
[2], /* Sidechannel pipes */
71 status_pipes
[2];/* Status pipes */
72 cupsd_statbuf_t
*status_buffer
; /* Status buffer for this job */
73 int status_level
; /* Highest log level in a status
75 int cost
; /* Filtering cost */
76 int pending_cost
; /* Waiting for FilterLimit */
77 int filters
[MAX_FILTERS
+ 1];
78 /* Filter process IDs, 0 terminated */
79 int backend
; /* Backend process ID */
80 int status
; /* Status code from filters */
81 int tries
; /* Number of tries for this job */
82 int completed
; /* cups-waiting-for-job-completed seen */
83 int retry_as_raster
;/* Need to retry the job as raster */
84 char *auth_env
[3], /* AUTH_xxx environment variables,
86 *auth_uid
; /* AUTH_UID environment variable */
87 void *profile
, /* Security profile for filters */
88 *bprofile
; /* Security profile for backend */
89 cups_array_t
*history
; /* Debug log history */
90 int progress
; /* Printing progress */
91 int num_keywords
; /* Number of PPD keywords */
92 cups_option_t
*keywords
; /* PPD keywords */
95 typedef struct cupsd_joblog_s
/**** Job log message ****/
97 time_t time
; /* Time of message */
98 char message
[1]; /* Message string */
106 VAR
int JobHistory
VALUE(INT_MAX
);
107 /* Preserve job history? */
108 VAR
int JobFiles
VALUE(86400);
109 /* Preserve job files? */
110 VAR
time_t JobHistoryUpdate
VALUE(0);
111 /* Time for next job history update */
112 VAR
int MaxJobs
VALUE(0),
113 /* Max number of jobs */
114 MaxActiveJobs
VALUE(0),
115 /* Max number of active jobs */
116 MaxHoldTime
VALUE(0),
117 /* Max time for indefinite hold */
118 MaxJobsPerUser
VALUE(0),
119 /* Max jobs per user */
120 MaxJobsPerPrinter
VALUE(0),
121 /* Max jobs per printer */
122 MaxJobTime
VALUE(3 * 60 * 60);
123 /* Max time for a job */
124 VAR
int JobAutoPurge
VALUE(0);
125 /* Automatically purge jobs */
126 VAR cups_array_t
*Jobs
VALUE(NULL
),
127 /* List of current jobs */
128 *ActiveJobs
VALUE(NULL
),
129 /* List of active jobs */
130 *PrintingJobs
VALUE(NULL
);
131 /* List of jobs that are printing */
132 VAR
int NextJobId
VALUE(1);
133 /* Next job ID to use */
134 VAR
int JobKillDelay
VALUE(DEFAULT_TIMEOUT
),
135 /* Delay before killing jobs */
136 JobRetryLimit
VALUE(5),
137 /* Max number of tries */
138 JobRetryInterval
VALUE(300);
139 /* Seconds between retries */
146 extern cupsd_job_t
*cupsdAddJob(int priority
, const char *dest
);
147 extern void cupsdCancelJobs(const char *dest
, const char *username
,
149 extern void cupsdCheckJobs(void);
150 extern void cupsdCleanJobs(void);
151 extern void cupsdContinueJob(cupsd_job_t
*job
);
152 extern void cupsdDeleteJob(cupsd_job_t
*job
,
153 cupsd_jobaction_t action
);
154 extern cupsd_job_t
*cupsdFindJob(int id
);
155 extern void cupsdFreeAllJobs(void);
156 extern cups_array_t
*cupsdGetCompletedJobs(cupsd_printer_t
*p
);
157 extern int cupsdGetPrinterJobCount(const char *dest
);
158 extern int cupsdGetUserJobCount(const char *username
);
159 extern void cupsdLoadAllJobs(void);
160 extern int cupsdLoadJob(cupsd_job_t
*job
);
161 extern void cupsdMoveJob(cupsd_job_t
*job
, cupsd_printer_t
*p
);
162 extern void cupsdReleaseJob(cupsd_job_t
*job
);
163 extern void cupsdRestartJob(cupsd_job_t
*job
);
164 extern void cupsdSaveAllJobs(void);
165 extern void cupsdSaveJob(cupsd_job_t
*job
);
166 extern void cupsdSetJobHoldUntil(cupsd_job_t
*job
,
167 const char *when
, int update
);
168 extern void cupsdSetJobPriority(cupsd_job_t
*job
, int priority
);
169 extern void cupsdSetJobState(cupsd_job_t
*job
,
170 ipp_jstate_t newstate
,
171 cupsd_jobaction_t action
,
172 const char *message
, ...)
173 __attribute__((__format__(__printf__
,
175 extern void cupsdStopAllJobs(cupsd_jobaction_t action
,
177 extern int cupsdTimeoutJob(cupsd_job_t
*job
);
178 extern void cupsdUnloadCompletedJobs(void);
179 extern void cupsdUpdateJobs(void);
183 * End of "$Id: job.h 13138 2016-03-15 14:59:54Z msweet $".