4 * Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
6 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
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
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
27 #endif /* HAVE_DNSSD */
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 */
43 * Printer/class information structure...
46 typedef struct cupsd_printer_s
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.) */
67 external_type
; /* Printer type that is advertised */
68 char *browse_attrs
; /* Attributes sent with browse data */
69 time_t browse_expire
; /* Expiration time for printer */
70 time_t browse_time
; /* Last time update was sent/received */
71 char *device_uri
; /* Device URI */
72 char *port_monitor
; /* Port monitor */
73 int raw
; /* Raw queue? */
74 int remote
; /* Remote queue? */
75 mime_type_t
*filetype
, /* Pseudo-filetype for printer */
76 *prefiltertype
; /* Pseudo-filetype for pre-filters */
77 cups_array_t
*filetypes
; /* Supported file types */
78 void *job
; /* Current job in queue */
79 ipp_t
*attrs
; /* Attributes supported by this printer */
80 int num_printers
, /* Number of printers in class */
81 last_printer
; /* Last printer job was sent to */
82 struct cupsd_printer_s
**printers
; /* Printers in class */
83 int quota_period
, /* Period for quotas */
84 page_limit
, /* Maximum number of pages */
85 k_limit
; /* Maximum number of kilobytes */
86 cups_array_t
*quotas
; /* Quota records */
87 int deny_users
, /* 1 = deny, 0 = allow */
88 num_users
; /* Number of allowed/denied users */
89 const char **users
; /* Allowed/denied users */
90 int num_history
; /* Number of history collections */
91 ipp_t
**history
; /* History data */
92 int sequence_number
; /* Increasing sequence number */
93 int num_options
; /* Number of default options */
94 cups_option_t
*options
; /* Default options */
95 int num_auth_info_required
; /* Number of required auth fields */
96 const char *auth_info_required
[4]; /* Required authentication fields */
97 char *alert
, /* PSX printer-alert value */
98 *alert_description
; /* PSX printer-alert-description value */
101 char *recoverable
; /* com.apple.print.recoverable-message */
102 #endif /* __APPLE__ */
105 char *reg_name
, /* Name used for service registration */
106 *product
, /* PPD Product string */
107 *pdl
, /* pdl value for TXT record */
108 *txt_record
; /* TXT record contents */
109 int txt_len
; /* TXT record length */
110 DNSServiceRef dnssd_ipp_ref
; /* DNSServiceRegister ref for _ipp */
111 int dnssd_ipp_fd
; /* File descriptor for DNSServiceRegister reference */
112 #endif /* HAVE_DNSSD */
120 VAR ipp_t
*CommonData
VALUE(NULL
);
121 /* Common printer object attrs */
122 VAR cups_array_t
*CommonDefaults
VALUE(NULL
);
123 /* Common -default option names */
124 VAR cups_array_t
*Printers
VALUE(NULL
),
126 *ImplicitPrinters
VALUE(NULL
);
127 /* Implicit class printers */
128 VAR cupsd_printer_t
*DefaultPrinter
VALUE(NULL
);
129 /* Default printer */
130 VAR
char *DefaultPolicy
VALUE(NULL
);
131 /* Default policy name */
132 VAR cupsd_policy_t
*DefaultPolicyPtr
134 /* Pointer to default policy */
141 extern cupsd_printer_t
*cupsdAddPrinter(const char *name
);
142 extern void cupsdAddPrinterHistory(cupsd_printer_t
*p
);
143 extern void cupsdAddPrinterUser(cupsd_printer_t
*p
,
144 const char *username
);
145 extern void cupsdCreateCommonData(void);
146 extern void cupsdDeleteAllPrinters(void);
147 extern void cupsdDeletePrinter(cupsd_printer_t
*p
, int update
);
148 extern cupsd_printer_t
*cupsdFindDest(const char *name
);
149 extern cupsd_printer_t
*cupsdFindPrinter(const char *name
);
150 extern cupsd_quota_t
*cupsdFindQuota(cupsd_printer_t
*p
,
151 const char *username
);
152 extern void cupsdFreePrinterUsers(cupsd_printer_t
*p
);
153 extern void cupsdFreeQuotas(cupsd_printer_t
*p
);
154 extern void cupsdLoadAllPrinters(void);
155 extern void cupsdRenamePrinter(cupsd_printer_t
*p
,
157 extern char *cupsdSanitizeURI(const char *uri
, char *buffer
,
159 extern void cupsdSaveAllPrinters(void);
160 extern int cupsdSetAuthInfoRequired(cupsd_printer_t
*p
,
162 ipp_attribute_t
*attr
);
163 extern void cupsdSetPrinterAttrs(cupsd_printer_t
*p
);
164 extern void cupsdSetPrinterReasons(cupsd_printer_t
*p
,
166 extern void cupsdSetPrinterState(cupsd_printer_t
*p
, ipp_pstate_t s
,
168 #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
169 extern void cupsdStopPrinter(cupsd_printer_t
*p
, int update
);
170 extern void cupsdUpdatePrinters(void);
171 extern cupsd_quota_t
*cupsdUpdateQuota(cupsd_printer_t
*p
,
172 const char *username
, int pages
,
174 extern const char *cupsdValidateDest(const char *uri
,
176 cupsd_printer_t
**printer
);
177 extern void cupsdWritePrintcap(void);