]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
c822ad157b91d2c35dd21ba2d18ee8132d8d85e9
[thirdparty/cups.git] / scheduler / printers.h
1 /*
2 * "$Id: printers.h 6433 2007-04-02 21:50:50Z mike $"
3 *
4 * Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 */
24
25 #ifdef HAVE_DNSSD
26 # include <dns_sd.h>
27 #endif /* HAVE_DNSSD */
28
29 /*
30 * Quota data...
31 */
32
33 typedef struct
34 {
35 char username[33]; /* User data */
36 time_t next_update; /* Next update time */
37 int page_count, /* Count of pages */
38 k_count; /* Count of kilobytes */
39 } cupsd_quota_t;
40
41
42 /*
43 * Printer/class information structure...
44 */
45
46 typedef struct cupsd_printer_s
47 {
48 char *uri, /* Printer URI */
49 *hostname, /* Host printer resides on */
50 *name, /* Printer name */
51 *location, /* Location code */
52 *make_model, /* Make and model */
53 *info, /* Description */
54 *op_policy, /* Operation policy name */
55 *error_policy; /* Error policy */
56 cupsd_policy_t *op_policy_ptr; /* Pointer to operation policy */
57 int shared; /* Shared? */
58 int accepting; /* Accepting jobs? */
59 int in_implicit_class; /* In an implicit class? */
60 ipp_pstate_t state; /* Printer state */
61 char state_message[1024]; /* Printer state message */
62 int num_reasons; /* Number of printer-state-reasons */
63 char *reasons[16]; /* printer-state-reasons strings */
64 time_t state_time; /* Time at this state */
65 char *job_sheets[2]; /* Banners/job sheets */
66 cups_ptype_t type; /* Printer type (color, small, etc.) */
67 char *browse_attrs; /* Attributes sent with browse data */
68 time_t browse_expire; /* Expiration time for printer */
69 time_t browse_time; /* Last time update was sent/received */
70 char *device_uri; /* Device URI */
71 char *port_monitor; /* Port monitor */
72 int raw; /* Raw queue? */
73 int remote; /* Remote queue? */
74 mime_type_t *filetype, /* Pseudo-filetype for printer */
75 *prefiltertype; /* Pseudo-filetype for pre-filters */
76 cups_array_t *filetypes; /* Supported file types */
77 void *job; /* Current job in queue */
78 ipp_t *attrs; /* Attributes supported by this printer */
79 int num_printers, /* Number of printers in class */
80 last_printer; /* Last printer job was sent to */
81 struct cupsd_printer_s **printers; /* Printers in class */
82 int quota_period, /* Period for quotas */
83 page_limit, /* Maximum number of pages */
84 k_limit; /* Maximum number of kilobytes */
85 cups_array_t *quotas; /* Quota records */
86 int deny_users, /* 1 = deny, 0 = allow */
87 num_users; /* Number of allowed/denied users */
88 const char **users; /* Allowed/denied users */
89 int num_history; /* Number of history collections */
90 ipp_t **history; /* History data */
91 int sequence_number; /* Increasing sequence number */
92 int num_options; /* Number of default options */
93 cups_option_t *options; /* Default options */
94 int num_auth_info_required; /* Number of required auth fields */
95 const char *auth_info_required[4]; /* Required authentication fields */
96 char *alert, /* PSX printer-alert value */
97 *alert_description; /* PSX printer-alert-description value */
98
99 #ifdef __APPLE__
100 char *recoverable; /* com.apple.print.recoverable-message */
101 #endif /* __APPLE__ */
102
103 #ifdef HAVE_DNSSD
104 char *reg_name, /* Name used for service registration */
105 *product, /* PPD Product string */
106 *pdl, /* pdl value for TXT record */
107 *txt_record; /* TXT record contents */
108 int txt_len; /* TXT record length */
109 DNSServiceRef dnssd_ipp_ref; /* DNSServiceRegister ref for _ipp */
110 int dnssd_ipp_fd; /* File descriptor for DNSServiceRegister reference */
111 #endif /* HAVE_DNSSD */
112 } cupsd_printer_t;
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 cupsdAddPrinterUser(cupsd_printer_t *p,
143 const char *username);
144 extern void cupsdCreateCommonData(void);
145 extern void cupsdDeleteAllPrinters(void);
146 extern void cupsdDeletePrinter(cupsd_printer_t *p, int update);
147 extern cupsd_printer_t *cupsdFindDest(const char *name);
148 extern cupsd_printer_t *cupsdFindPrinter(const char *name);
149 extern void cupsdFreePrinterUsers(cupsd_printer_t *p);
150 extern void cupsdFreeQuotas(cupsd_printer_t *p);
151 extern void cupsdLoadAllPrinters(void);
152 extern void cupsdRenamePrinter(cupsd_printer_t *p,
153 const char *name);
154 extern char *cupsdSanitizeURI(const char *uri, char *buffer,
155 int buflen);
156 extern void cupsdSaveAllPrinters(void);
157 extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p,
158 const char *values,
159 ipp_attribute_t *attr);
160 extern void cupsdSetPrinterAttrs(cupsd_printer_t *p);
161 extern void 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 void cupsdUpdatePrinters(void);
168 extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p,
169 const char *username, int pages,
170 int k);
171 extern const char *cupsdValidateDest(const char *uri,
172 cups_ptype_t *dtype,
173 cupsd_printer_t **printer);
174 extern void cupsdWritePrintcap(void);
175
176
177 /*
178 * End of "$Id: printers.h 6433 2007-04-02 21:50:50Z mike $".
179 */