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