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