]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/printers.h
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / printers.h
CommitLineData
ef416fc2 1/*
323c5de1 2 * "$Id: printers.h 6433 2007-04-02 21:50:50Z mike $"
ef416fc2 3 *
4 * Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
f7deaa1a 6 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 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
f7deaa1a 25#ifdef HAVE_DNSSD
26# include <dns_sd.h>
27#endif /* HAVE_DNSSD */
28
ef416fc2 29/*
30 * Quota data...
31 */
32
33typedef 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
46typedef 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.) */
b423cd4c 67 char *browse_attrs; /* Attributes sent with browse data */
68 time_t browse_expire; /* Expiration time for printer */
ef416fc2 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? */
d09495fa 73 int remote; /* Remote queue? */
f7deaa1a 74 mime_type_t *filetype, /* Pseudo-filetype for printer */
75 *prefiltertype; /* Pseudo-filetype for pre-filters */
80ca4592 76 cups_array_t *filetypes; /* Supported file types */
ef416fc2 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 */
fa73b229 84 k_limit; /* Maximum number of kilobytes */
85 cups_array_t *quotas; /* Quota records */
ef416fc2 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 */
b423cd4c 92 int num_options; /* Number of default options */
93 cups_option_t *options; /* Default options */
f7deaa1a 94 int num_auth_info_required; /* Number of required auth fields */
95 const char *auth_info_required[4]; /* Required authentication fields */
323c5de1 96 char *alert, /* PSX printer-alert value */
97 *alert_description; /* PSX printer-alert-description value */
98
e00b005a 99#ifdef __APPLE__
100 char *recoverable; /* com.apple.print.recoverable-message */
101#endif /* __APPLE__ */
f7deaa1a 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 */
ef416fc2 112} cupsd_printer_t;
113
114
115/*
116 * Globals...
117 */
118
119VAR ipp_t *CommonData VALUE(NULL);
120 /* Common printer object attrs */
f7deaa1a 121VAR cups_array_t *CommonDefaults VALUE(NULL);
122 /* Common -default option names */
ef416fc2 123VAR cups_array_t *Printers VALUE(NULL),
124 /* Printer list */
125 *ImplicitPrinters VALUE(NULL);
126 /* Implicit class printers */
127VAR cupsd_printer_t *DefaultPrinter VALUE(NULL);
128 /* Default printer */
129VAR char *DefaultPolicy VALUE(NULL);
130 /* Default policy name */
131VAR cupsd_policy_t *DefaultPolicyPtr
132 VALUE(NULL);
133 /* Pointer to default policy */
134
135
136/*
137 * Prototypes...
138 */
139
140extern cupsd_printer_t *cupsdAddPrinter(const char *name);
ef416fc2 141extern void cupsdAddPrinterHistory(cupsd_printer_t *p);
f7deaa1a 142extern void cupsdAddPrinterUser(cupsd_printer_t *p,
143 const char *username);
ef416fc2 144extern void cupsdCreateCommonData(void);
145extern void cupsdDeleteAllPrinters(void);
146extern void cupsdDeletePrinter(cupsd_printer_t *p, int update);
ef416fc2 147extern cupsd_printer_t *cupsdFindDest(const char *name);
148extern cupsd_printer_t *cupsdFindPrinter(const char *name);
ef416fc2 149extern void cupsdFreePrinterUsers(cupsd_printer_t *p);
150extern void cupsdFreeQuotas(cupsd_printer_t *p);
151extern void cupsdLoadAllPrinters(void);
f7deaa1a 152extern void cupsdRenamePrinter(cupsd_printer_t *p,
153 const char *name);
154extern char *cupsdSanitizeURI(const char *uri, char *buffer,
155 int buflen);
ef416fc2 156extern void cupsdSaveAllPrinters(void);
f7deaa1a 157extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p,
158 const char *values,
159 ipp_attribute_t *attr);
ef416fc2 160extern void cupsdSetPrinterAttrs(cupsd_printer_t *p);
f7deaa1a 161extern void cupsdSetPrinterReasons(cupsd_printer_t *p,
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);
167extern void cupsdUpdatePrinters(void);
f7deaa1a 168extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p,
169 const char *username, int pages,
170 int k);
171extern const char *cupsdValidateDest(const char *uri,
ef416fc2 172 cups_ptype_t *dtype,
173 cupsd_printer_t **printer);
174extern void cupsdWritePrintcap(void);
175
ef416fc2 176
177/*
323c5de1 178 * End of "$Id: printers.h 6433 2007-04-02 21:50:50Z mike $".
ef416fc2 179 */