]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
Merge changes from CUPS 1.5svn-r9567
[thirdparty/cups.git] / scheduler / printers.h
1 /*
2 * "$Id: printers.h 7564 2008-05-15 00:57:43Z mike $"
3 *
4 * Printer definitions for the CUPS scheduler.
5 *
6 * Copyright 2007-2011 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
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/".
14 */
15
16 #ifdef HAVE_DNSSD
17 # include <dns_sd.h>
18 #endif /* HAVE_DNSSD */
19 #include <cups/pwg-private.h>
20
21
22 /*
23 * Quota data...
24 */
25
26 typedef struct
27 {
28 char username[33]; /* User data */
29 time_t next_update; /* Next update time */
30 int page_count, /* Count of pages */
31 k_count; /* Count of kilobytes */
32 } cupsd_quota_t;
33
34
35 /*
36 * Printer/class information structure...
37 */
38
39 typedef struct cupsd_job_s cupsd_job_t;
40
41 struct cupsd_printer_s
42 {
43 char *uri, /* Printer URI */
44 *hostname, /* Host printer resides on */
45 *name, /* Printer name */
46 *location, /* Location code */
47 *make_model, /* Make and model */
48 *info, /* Description */
49 *op_policy, /* Operation policy name */
50 *error_policy; /* Error policy */
51 cupsd_policy_t *op_policy_ptr; /* Pointer to operation policy */
52 int shared; /* Shared? */
53 int accepting; /* Accepting jobs? */
54 int holding_new_jobs; /* Holding new jobs for printing? */
55 int in_implicit_class; /* In an implicit class? */
56 ipp_pstate_t state; /* Printer state */
57 char state_message[1024]; /* Printer state message */
58 int num_reasons; /* Number of printer-state-reasons */
59 char *reasons[64]; /* printer-state-reasons strings */
60 time_t state_time; /* Time at this state */
61 char *job_sheets[2]; /* Banners/job sheets */
62 cups_ptype_t type; /* Printer type (color, small, etc.) */
63 char *browse_attrs; /* Attributes sent with browse data */
64 time_t browse_expire; /* Expiration time for printer */
65 time_t browse_time; /* Last time update was sent/received */
66 char *device_uri; /* Device URI */
67 char *sanitized_device_uri; /* Sanitized device URI */
68 char *port_monitor; /* Port monitor */
69 int raw; /* Raw queue? */
70 int remote; /* Remote queue? */
71 mime_type_t *filetype, /* Pseudo-filetype for printer */
72 *prefiltertype; /* Pseudo-filetype for pre-filters */
73 cups_array_t *filetypes; /* Supported file types */
74 cupsd_job_t *job; /* Current job in queue */
75 ipp_t *attrs, /* Attributes supported by this printer */
76 *ppd_attrs; /* Attributes based on the PPD */
77 int num_printers, /* Number of printers in class */
78 last_printer; /* Last printer job was sent to */
79 struct cupsd_printer_s **printers; /* Printers in class */
80 int quota_period, /* Period for quotas */
81 page_limit, /* Maximum number of pages */
82 k_limit; /* Maximum number of kilobytes */
83 cups_array_t *quotas; /* Quota records */
84 int deny_users; /* 1 = deny, 0 = allow */
85 cups_array_t *users; /* Allowed/denied users */
86 int num_history; /* Number of history collections */
87 ipp_t **history; /* History data */
88 int sequence_number; /* Increasing sequence number */
89 int num_options; /* Number of default options */
90 cups_option_t *options; /* Default options */
91 int num_auth_info_required; /* Number of required auth fields */
92 const char *auth_info_required[4]; /* Required authentication fields */
93 char *alert, /* PSX printer-alert value */
94 *alert_description; /* PSX printer-alert-description value */
95 time_t marker_time; /* Last time marker attributes were updated */
96 cups_array_t *filters, /* Filters for queue */
97 *pre_filters, /* Pre-filters for queue */
98 *dest_types; /* Destination types for queue */
99 _pwg_t *pwg; /* PWG<->PPD mapping data */
100
101 #ifdef HAVE_DNSSD
102 char *reg_name, /* Name used for service registration */
103 *product, /* PPD Product string */
104 *pdl, /* pdl value for TXT record */
105 *ipp_txt, /* IPP TXT record contents */
106 *printer_txt; /* LPD TXT record contents */
107 int ipp_len, /* IPP TXT record length */
108 printer_len; /* LPD TXT record length */
109 DNSServiceRef ipp_ref, /* Reference for _ipp._tcp,_cups */
110 printer_ref; /* Reference for _printer._tcp */
111 #endif /* HAVE_DNSSD */
112 };
113
114
115 /*
116 * Globals...
117 */
118
119 VAR ipp_t *CommonData VALUE(NULL);
120 /* Common printer object attrs */
121 VAR cups_array_t *CommonDefaults VALUE(NULL);
122 /* Common -default option names */
123 VAR cups_array_t *Printers VALUE(NULL),
124 /* Printer list */
125 *ImplicitPrinters VALUE(NULL);
126 /* Implicit class printers */
127 VAR cupsd_printer_t *DefaultPrinter VALUE(NULL);
128 /* Default printer */
129 VAR char *DefaultPolicy VALUE(NULL);
130 /* Default policy name */
131 VAR cupsd_policy_t *DefaultPolicyPtr
132 VALUE(NULL);
133 /* Pointer to default policy */
134
135
136 /*
137 * Prototypes...
138 */
139
140 extern cupsd_printer_t *cupsdAddPrinter(const char *name);
141 extern void cupsdAddPrinterHistory(cupsd_printer_t *p);
142 extern void cupsdCreateCommonData(void);
143 extern void cupsdDeleteAllPrinters(void);
144 extern int cupsdDeletePrinter(cupsd_printer_t *p, int update);
145 extern cupsd_printer_t *cupsdFindDest(const char *name);
146 extern cupsd_printer_t *cupsdFindPrinter(const char *name);
147 extern cupsd_quota_t *cupsdFindQuota(cupsd_printer_t *p,
148 const char *username);
149 extern void cupsdFreeQuotas(cupsd_printer_t *p);
150 extern void cupsdLoadAllPrinters(void);
151 extern void cupsdRenamePrinter(cupsd_printer_t *p,
152 const char *name);
153 extern void cupsdSaveAllPrinters(void);
154 extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p,
155 const char *values,
156 ipp_attribute_t *attr);
157 extern void cupsdSetDeviceURI(cupsd_printer_t *p, const char *uri);
158 extern void cupsdSetPrinterAttr(cupsd_printer_t *p,
159 const char *name, char *value);
160 extern void cupsdSetPrinterAttrs(cupsd_printer_t *p);
161 extern int cupsdSetPrinterReasons(cupsd_printer_t *p,
162 const char *s);
163 extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s,
164 int update);
165 #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
166 extern void cupsdStopPrinter(cupsd_printer_t *p, int update);
167 extern int cupsdUpdatePrinterPPD(cupsd_printer_t *p,
168 int num_keywords,
169 cups_option_t *keywords);
170 extern void cupsdUpdatePrinters(void);
171 extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p,
172 const char *username, int pages,
173 int k);
174 extern const char *cupsdValidateDest(const char *uri,
175 cups_ptype_t *dtype,
176 cupsd_printer_t **printer);
177 extern void cupsdWritePrintcap(void);
178
179
180 /*
181 * End of "$Id: printers.h 7564 2008-05-15 00:57:43Z mike $".
182 */