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