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