]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
75bd9771 | 2 | * "$Id: printers.h 7564 2008-05-15 00:57:43Z mike $" |
ef416fc2 | 3 | * |
10d09e33 | 4 | * Printer definitions for the CUPS scheduler. |
ef416fc2 | 5 | * |
10d09e33 | 6 | * Copyright 2007-2010 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 */ | |
54afec33 MS |
19 | #include <cups/pwg-private.h> |
20 | ||
f7deaa1a | 21 | |
ef416fc2 | 22 | /* |
23 | * Quota data... | |
24 | */ | |
25 | ||
26 | typedef struct | |
27 | { | |
28 | char username[33]; /* User data */ | |
29 | time_t next_update; /* Next update time */ | |
30 | int page_count, /* Count of pages */ | |
31 | k_count; /* Count of kilobytes */ | |
32 | } cupsd_quota_t; | |
33 | ||
34 | ||
35 | /* | |
36 | * Printer/class information structure... | |
37 | */ | |
38 | ||
f11a948a MS |
39 | typedef struct cupsd_job_s cupsd_job_t; |
40 | ||
10d09e33 | 41 | struct cupsd_printer_s |
ef416fc2 | 42 | { |
43 | char *uri, /* Printer URI */ | |
44 | *hostname, /* Host printer resides on */ | |
45 | *name, /* Printer name */ | |
46 | *location, /* Location code */ | |
47 | *make_model, /* Make and model */ | |
48 | *info, /* Description */ | |
49 | *op_policy, /* Operation policy name */ | |
50 | *error_policy; /* Error policy */ | |
51 | cupsd_policy_t *op_policy_ptr; /* Pointer to operation policy */ | |
52 | int shared; /* Shared? */ | |
53 | int accepting; /* Accepting jobs? */ | |
61cf44e2 | 54 | int holding_new_jobs; /* Holding new jobs for printing? */ |
ef416fc2 | 55 | int in_implicit_class; /* In an implicit class? */ |
56 | ipp_pstate_t state; /* Printer state */ | |
57 | char state_message[1024]; /* Printer state message */ | |
58 | int num_reasons; /* Number of printer-state-reasons */ | |
d1c13e16 | 59 | char *reasons[64]; /* printer-state-reasons strings */ |
ef416fc2 | 60 | time_t state_time; /* Time at this state */ |
61 | char *job_sheets[2]; /* Banners/job sheets */ | |
09a101d6 | 62 | cups_ptype_t type; /* Printer type (color, small, etc.) */ |
b423cd4c | 63 | char *browse_attrs; /* Attributes sent with browse data */ |
64 | time_t browse_expire; /* Expiration time for printer */ | |
ef416fc2 | 65 | time_t browse_time; /* Last time update was sent/received */ |
66 | char *device_uri; /* Device URI */ | |
0af14961 | 67 | char *sanitized_device_uri; /* Sanitized device URI */ |
ef416fc2 | 68 | char *port_monitor; /* Port monitor */ |
69 | int raw; /* Raw queue? */ | |
d09495fa | 70 | int remote; /* Remote queue? */ |
f7deaa1a | 71 | mime_type_t *filetype, /* Pseudo-filetype for printer */ |
72 | *prefiltertype; /* Pseudo-filetype for pre-filters */ | |
80ca4592 | 73 | cups_array_t *filetypes; /* Supported file types */ |
f11a948a | 74 | cupsd_job_t *job; /* Current job in queue */ |
61cf44e2 MS |
75 | ipp_t *attrs, /* Attributes supported by this printer */ |
76 | *ppd_attrs; /* Attributes based on the PPD */ | |
ef416fc2 | 77 | int num_printers, /* Number of printers in class */ |
78 | last_printer; /* Last printer job was sent to */ | |
79 | struct cupsd_printer_s **printers; /* Printers in class */ | |
80 | int quota_period, /* Period for quotas */ | |
81 | page_limit, /* Maximum number of pages */ | |
fa73b229 | 82 | k_limit; /* Maximum number of kilobytes */ |
83 | cups_array_t *quotas; /* Quota records */ | |
10d09e33 MS |
84 | int deny_users; /* 1 = deny, 0 = allow */ |
85 | cups_array_t *users; /* Allowed/denied users */ | |
ef416fc2 | 86 | int num_history; /* Number of history collections */ |
87 | ipp_t **history; /* History data */ | |
88 | int sequence_number; /* Increasing sequence number */ | |
b423cd4c | 89 | int num_options; /* Number of default options */ |
90 | cups_option_t *options; /* Default options */ | |
f7deaa1a | 91 | int num_auth_info_required; /* Number of required auth fields */ |
92 | const char *auth_info_required[4]; /* Required authentication fields */ | |
323c5de1 | 93 | char *alert, /* PSX printer-alert value */ |
94 | *alert_description; /* PSX printer-alert-description value */ | |
5a738aea | 95 | time_t marker_time; /* Last time marker attributes were updated */ |
58dc1933 MS |
96 | cups_array_t *filters, /* Filters for queue */ |
97 | *pre_filters; /* Pre-filters for queue */ | |
54afec33 | 98 | _pwg_t *pwg; /* PWG<->PPD mapping data */ |
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 */ |
10d09e33 | 111 | }; |
ef416fc2 | 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); |
ef416fc2 | 141 | extern void cupsdCreateCommonData(void); |
142 | extern void cupsdDeleteAllPrinters(void); | |
f8b3a85b | 143 | extern int cupsdDeletePrinter(cupsd_printer_t *p, int update); |
ef416fc2 | 144 | extern cupsd_printer_t *cupsdFindDest(const char *name); |
145 | extern cupsd_printer_t *cupsdFindPrinter(const char *name); | |
3d8365b8 | 146 | extern cupsd_quota_t *cupsdFindQuota(cupsd_printer_t *p, |
147 | const char *username); | |
ef416fc2 | 148 | extern void cupsdFreeQuotas(cupsd_printer_t *p); |
149 | extern void cupsdLoadAllPrinters(void); | |
f7deaa1a | 150 | extern void cupsdRenamePrinter(cupsd_printer_t *p, |
151 | const char *name); | |
ef416fc2 | 152 | extern void cupsdSaveAllPrinters(void); |
f7deaa1a | 153 | extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p, |
154 | const char *values, | |
155 | ipp_attribute_t *attr); | |
0af14961 | 156 | extern void cupsdSetDeviceURI(cupsd_printer_t *p, const char *uri); |
5a738aea MS |
157 | extern void cupsdSetPrinterAttr(cupsd_printer_t *p, |
158 | const char *name, char *value); | |
ef416fc2 | 159 | extern void cupsdSetPrinterAttrs(cupsd_printer_t *p); |
e07d4801 | 160 | extern int cupsdSetPrinterReasons(cupsd_printer_t *p, |
f7deaa1a | 161 | const char *s); |
162 | extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, | |
163 | int update); | |
ef416fc2 | 164 | #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u)) |
165 | extern void cupsdStopPrinter(cupsd_printer_t *p, int update); | |
c9fc04c6 MS |
166 | extern int cupsdUpdatePrinterPPD(cupsd_printer_t *p, |
167 | int num_keywords, | |
168 | cups_option_t *keywords); | |
ef416fc2 | 169 | extern void cupsdUpdatePrinters(void); |
f7deaa1a | 170 | extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p, |
171 | const char *username, int pages, | |
172 | int k); | |
173 | extern const char *cupsdValidateDest(const char *uri, | |
ef416fc2 | 174 | cups_ptype_t *dtype, |
175 | cupsd_printer_t **printer); | |
176 | extern void cupsdWritePrintcap(void); | |
177 | ||
ef416fc2 | 178 | |
179 | /* | |
75bd9771 | 180 | * End of "$Id: printers.h 7564 2008-05-15 00:57:43Z mike $". |
ef416fc2 | 181 | */ |