]>
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 */ | |
89 | ||
e00b005a | 90 | #ifdef __APPLE__ |
91 | char *recoverable; /* com.apple.print.recoverable-message */ | |
92 | #endif /* __APPLE__ */ | |
f7deaa1a | 93 | |
94 | #ifdef HAVE_DNSSD | |
95 | char *reg_name, /* Name used for service registration */ | |
96 | *product, /* PPD Product string */ | |
97 | *pdl, /* pdl value for TXT record */ | |
98 | *txt_record; /* TXT record contents */ | |
99 | int txt_len; /* TXT record length */ | |
100 | DNSServiceRef dnssd_ipp_ref; /* DNSServiceRegister ref for _ipp */ | |
101 | int dnssd_ipp_fd; /* File descriptor for DNSServiceRegister reference */ | |
102 | #endif /* HAVE_DNSSD */ | |
ef416fc2 | 103 | } cupsd_printer_t; |
104 | ||
105 | ||
106 | /* | |
107 | * Globals... | |
108 | */ | |
109 | ||
110 | VAR ipp_t *CommonData VALUE(NULL); | |
111 | /* Common printer object attrs */ | |
f7deaa1a | 112 | VAR cups_array_t *CommonDefaults VALUE(NULL); |
113 | /* Common -default option names */ | |
ef416fc2 | 114 | VAR cups_array_t *Printers VALUE(NULL), |
115 | /* Printer list */ | |
116 | *ImplicitPrinters VALUE(NULL); | |
117 | /* Implicit class printers */ | |
118 | VAR cupsd_printer_t *DefaultPrinter VALUE(NULL); | |
119 | /* Default printer */ | |
120 | VAR char *DefaultPolicy VALUE(NULL); | |
121 | /* Default policy name */ | |
122 | VAR cupsd_policy_t *DefaultPolicyPtr | |
123 | VALUE(NULL); | |
124 | /* Pointer to default policy */ | |
125 | ||
126 | ||
127 | /* | |
128 | * Prototypes... | |
129 | */ | |
130 | ||
131 | extern cupsd_printer_t *cupsdAddPrinter(const char *name); | |
ef416fc2 | 132 | extern void cupsdAddPrinterHistory(cupsd_printer_t *p); |
f7deaa1a | 133 | extern void cupsdAddPrinterUser(cupsd_printer_t *p, |
134 | const char *username); | |
ef416fc2 | 135 | extern void cupsdCreateCommonData(void); |
136 | extern void cupsdDeleteAllPrinters(void); | |
137 | extern void cupsdDeletePrinter(cupsd_printer_t *p, int update); | |
ef416fc2 | 138 | extern cupsd_printer_t *cupsdFindDest(const char *name); |
139 | extern cupsd_printer_t *cupsdFindPrinter(const char *name); | |
3d8365b8 | 140 | extern cupsd_quota_t *cupsdFindQuota(cupsd_printer_t *p, |
141 | const char *username); | |
ef416fc2 | 142 | extern void cupsdFreePrinterUsers(cupsd_printer_t *p); |
143 | extern void cupsdFreeQuotas(cupsd_printer_t *p); | |
144 | extern void cupsdLoadAllPrinters(void); | |
f7deaa1a | 145 | extern void cupsdRenamePrinter(cupsd_printer_t *p, |
146 | const char *name); | |
147 | extern char *cupsdSanitizeURI(const char *uri, char *buffer, | |
148 | int buflen); | |
ef416fc2 | 149 | extern void cupsdSaveAllPrinters(void); |
f7deaa1a | 150 | extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p, |
151 | const char *values, | |
152 | ipp_attribute_t *attr); | |
ef416fc2 | 153 | extern void cupsdSetPrinterAttrs(cupsd_printer_t *p); |
f7deaa1a | 154 | extern void cupsdSetPrinterReasons(cupsd_printer_t *p, |
155 | const char *s); | |
156 | extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, | |
157 | int update); | |
ef416fc2 | 158 | #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u)) |
159 | extern void cupsdStopPrinter(cupsd_printer_t *p, int update); | |
160 | extern void cupsdUpdatePrinters(void); | |
f7deaa1a | 161 | extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p, |
162 | const char *username, int pages, | |
163 | int k); | |
164 | extern const char *cupsdValidateDest(const char *uri, | |
ef416fc2 | 165 | cups_ptype_t *dtype, |
166 | cupsd_printer_t **printer); | |
167 | extern void cupsdWritePrintcap(void); | |
168 | ||
ef416fc2 | 169 | |
170 | /* | |
bc44d920 | 171 | * End of "$Id: printers.h 6649 2007-07-11 21:46:42Z mike $". |
ef416fc2 | 172 | */ |