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