]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / printers.h
1 /*
2 * "$Id: printers.h 6318 2007-03-06 04:36:55Z 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 #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 *txt_record; /* TXT record contents */
105 int txt_len; /* TXT record length */
106 DNSServiceRef dnssd_ipp_ref; /* DNSServiceRegister ref for _ipp */
107 int dnssd_ipp_fd; /* File descriptor for DNSServiceRegister reference */
108 #endif /* HAVE_DNSSD */
109 } cupsd_printer_t;
110
111
112 /*
113 * Globals...
114 */
115
116 VAR ipp_t *CommonData VALUE(NULL);
117 /* Common printer object attrs */
118 VAR cups_array_t *CommonDefaults VALUE(NULL);
119 /* Common -default option names */
120 VAR cups_array_t *Printers VALUE(NULL),
121 /* Printer list */
122 *ImplicitPrinters VALUE(NULL);
123 /* Implicit class printers */
124 VAR cupsd_printer_t *DefaultPrinter VALUE(NULL);
125 /* Default printer */
126 VAR char *DefaultPolicy VALUE(NULL);
127 /* Default policy name */
128 VAR cupsd_policy_t *DefaultPolicyPtr
129 VALUE(NULL);
130 /* Pointer to default policy */
131
132
133 /*
134 * Prototypes...
135 */
136
137 extern cupsd_printer_t *cupsdAddPrinter(const char *name);
138 extern void cupsdAddPrinterHistory(cupsd_printer_t *p);
139 extern void cupsdAddPrinterUser(cupsd_printer_t *p,
140 const char *username);
141 extern void cupsdCreateCommonData(void);
142 extern void cupsdDeleteAllPrinters(void);
143 extern void cupsdDeletePrinter(cupsd_printer_t *p, int update);
144 extern cupsd_printer_t *cupsdFindDest(const char *name);
145 extern cupsd_printer_t *cupsdFindPrinter(const char *name);
146 extern void cupsdFreePrinterUsers(cupsd_printer_t *p);
147 extern void cupsdFreeQuotas(cupsd_printer_t *p);
148 extern void cupsdLoadAllPrinters(void);
149 extern void cupsdRenamePrinter(cupsd_printer_t *p,
150 const char *name);
151 extern char *cupsdSanitizeURI(const char *uri, char *buffer,
152 int buflen);
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 cupsdSetPrinterAttrs(cupsd_printer_t *p);
158 extern void cupsdSetPrinterReasons(cupsd_printer_t *p,
159 const char *s);
160 extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s,
161 int update);
162 #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
163 extern void cupsdStopPrinter(cupsd_printer_t *p, int update);
164 extern void cupsdUpdatePrinters(void);
165 extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p,
166 const char *username, int pages,
167 int k);
168 extern const char *cupsdValidateDest(const char *uri,
169 cups_ptype_t *dtype,
170 cupsd_printer_t **printer);
171 extern void cupsdWritePrintcap(void);
172
173
174 /*
175 * End of "$Id: printers.h 6318 2007-03-06 04:36:55Z mike $".
176 */