]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
f7deaa1a | 2 | * "$Id: printers.h 6318 2007-03-06 04:36:55Z 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 | ||
33 | typedef 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 | ||
46 | typedef 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 */ | |
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 */ | |
104 | *txt_record; /* TXT record contents */ | |
105 | int txt_len; /* TXT record length */ | |
106 | DNSServiceRef dnssd_ipp_ref; /* DNSServiceRegister ref for _ipp */ | |
107 | int dnssd_ipp_fd; /* File descriptor for DNSServiceRegister reference */ | |
108 | #endif /* HAVE_DNSSD */ | |
ef416fc2 | 109 | } cupsd_printer_t; |
110 | ||
111 | ||
112 | /* | |
113 | * Globals... | |
114 | */ | |
115 | ||
116 | VAR ipp_t *CommonData VALUE(NULL); | |
117 | /* Common printer object attrs */ | |
f7deaa1a | 118 | VAR cups_array_t *CommonDefaults VALUE(NULL); |
119 | /* Common -default option names */ | |
ef416fc2 | 120 | VAR cups_array_t *Printers VALUE(NULL), |
121 | /* Printer list */ | |
122 | *ImplicitPrinters VALUE(NULL); | |
123 | /* Implicit class printers */ | |
124 | VAR cupsd_printer_t *DefaultPrinter VALUE(NULL); | |
125 | /* Default printer */ | |
126 | VAR char *DefaultPolicy VALUE(NULL); | |
127 | /* Default policy name */ | |
128 | VAR cupsd_policy_t *DefaultPolicyPtr | |
129 | VALUE(NULL); | |
130 | /* Pointer to default policy */ | |
131 | ||
132 | ||
133 | /* | |
134 | * Prototypes... | |
135 | */ | |
136 | ||
137 | extern cupsd_printer_t *cupsdAddPrinter(const char *name); | |
ef416fc2 | 138 | extern void cupsdAddPrinterHistory(cupsd_printer_t *p); |
f7deaa1a | 139 | extern void cupsdAddPrinterUser(cupsd_printer_t *p, |
140 | const char *username); | |
ef416fc2 | 141 | extern void cupsdCreateCommonData(void); |
142 | extern void cupsdDeleteAllPrinters(void); | |
143 | extern void 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); | |
ef416fc2 | 146 | extern void cupsdFreePrinterUsers(cupsd_printer_t *p); |
147 | extern void cupsdFreeQuotas(cupsd_printer_t *p); | |
148 | extern void cupsdLoadAllPrinters(void); | |
f7deaa1a | 149 | extern void cupsdRenamePrinter(cupsd_printer_t *p, |
150 | const char *name); | |
151 | extern char *cupsdSanitizeURI(const char *uri, char *buffer, | |
152 | int buflen); | |
ef416fc2 | 153 | extern void cupsdSaveAllPrinters(void); |
f7deaa1a | 154 | extern int cupsdSetAuthInfoRequired(cupsd_printer_t *p, |
155 | const char *values, | |
156 | ipp_attribute_t *attr); | |
ef416fc2 | 157 | extern void cupsdSetPrinterAttrs(cupsd_printer_t *p); |
f7deaa1a | 158 | extern void cupsdSetPrinterReasons(cupsd_printer_t *p, |
159 | const char *s); | |
160 | extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, | |
161 | int update); | |
ef416fc2 | 162 | #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u)) |
163 | extern void cupsdStopPrinter(cupsd_printer_t *p, int update); | |
164 | extern void cupsdUpdatePrinters(void); | |
f7deaa1a | 165 | extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p, |
166 | const char *username, int pages, | |
167 | int k); | |
168 | extern const char *cupsdValidateDest(const char *uri, | |
ef416fc2 | 169 | cups_ptype_t *dtype, |
170 | cupsd_printer_t **printer); | |
171 | extern void cupsdWritePrintcap(void); | |
172 | ||
ef416fc2 | 173 | |
174 | /* | |
f7deaa1a | 175 | * End of "$Id: printers.h 6318 2007-03-06 04:36:55Z mike $". |
ef416fc2 | 176 | */ |