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