]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
4 * Printer definitions for the CUPS scheduler.
6 * Copyright 2007-2012 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
9 * These coded instructions, statements, and computer programs are the
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/".
18 #elif defined(HAVE_AVAHI)
19 # include <avahi-client/client.h>
20 # include <avahi-client/publish.h>
21 # include <avahi-common/thread-watch.h>
22 #endif /* HAVE_DNSSD */
23 #include <cups/pwg-private.h>
32 char username
[33]; /* User data */
33 time_t next_update
; /* Next update time */
34 int page_count
, /* Count of pages */
35 k_count
; /* Count of kilobytes */
40 * Printer/class information structure...
43 typedef struct cupsd_job_s cupsd_job_t
;
45 struct cupsd_printer_s
47 char *uri
, /* Printer URI */
48 *uuid
, /* Printer UUID */
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 holding_new_jobs
; /* Holding new jobs for printing? */
60 int in_implicit_class
; /* In an implicit class? */
61 ipp_pstate_t state
; /* Printer state */
62 char state_message
[1024]; /* Printer state message */
63 int num_reasons
; /* Number of printer-state-reasons */
64 char *reasons
[64]; /* printer-state-reasons strings */
65 time_t state_time
; /* Time at this state */
66 char *job_sheets
[2]; /* Banners/job sheets */
67 cups_ptype_t type
; /* Printer type (color, small, etc.) */
68 char *device_uri
; /* Device URI */
69 char *sanitized_device_uri
; /* Sanitized device URI */
70 char *port_monitor
; /* Port monitor */
71 int raw
; /* Raw queue? */
72 int remote
; /* Remote queue? */
73 mime_type_t
*filetype
, /* Pseudo-filetype for printer */
74 *prefiltertype
; /* Pseudo-filetype for pre-filters */
75 cups_array_t
*filetypes
, /* Supported file types */
76 *dest_types
; /* Destination types for queue */
77 cupsd_job_t
*job
; /* Current job in queue */
78 ipp_t
*attrs
, /* Attributes supported by this printer */
79 *ppd_attrs
; /* Attributes based on the PPD */
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 cups_array_t
*users
; /* Allowed/denied users */
89 int sequence_number
; /* Increasing sequence number */
90 int num_options
; /* Number of default options */
91 cups_option_t
*options
; /* Default options */
92 int num_auth_info_required
; /* Number of required auth fields */
93 const char *auth_info_required
[4]; /* Required authentication fields */
94 char *alert
, /* PSX printer-alert value */
95 *alert_description
; /* PSX printer-alert-description value */
96 time_t marker_time
; /* Last time marker attributes were updated */
97 _ppd_cache_t
*pc
; /* PPD cache and mapping data */
99 #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
100 char *reg_name
, /* Name used for service registration */
101 *pdl
; /* pdl value for TXT record */
103 TXTRecordRef ipp_txt
, /* IPP(S) TXT record contents */
104 printer_txt
; /* LPD TXT record contents */
105 DNSServiceRef ipp_ref
, /* Reference for _ipp._tcp */
107 ipps_ref
, /* Reference for _ipps._tcp */
108 # endif /* HAVE_SSL */
109 printer_ref
; /* Reference for _printer._tcp */
110 # else /* HAVE_AVAHI */
111 AvahiStringList
*ipp_txt
, /* IPP(S) TXT record contents */
112 *printer_txt
; /* LPD TXT record contents */
113 AvahiEntryGroup
*ipp_ref
, /* Reference for _ipp._tcp */
115 *ipps_ref
, /* Reference for _ipps._tcp */
116 # endif /* HAVE_SSL */
117 *printer_ref
; /* Reference for _printer._tcp */
118 # endif /* HAVE_DNSSD */
119 #endif /* HAVE_DNSSD || HAVE_AVAHI */
127 VAR ipp_t
*CommonData
VALUE(NULL
);
128 /* Common printer object attrs */
129 VAR cups_array_t
*CommonDefaults
VALUE(NULL
);
130 /* Common -default option names */
131 VAR cups_array_t
*Printers
VALUE(NULL
);
133 VAR cupsd_printer_t
*DefaultPrinter
VALUE(NULL
);
134 /* Default printer */
135 VAR
char *DefaultPolicy
VALUE(NULL
);
136 /* Default policy name */
137 VAR cupsd_policy_t
*DefaultPolicyPtr
139 /* Pointer to default policy */
146 extern cupsd_printer_t
*cupsdAddPrinter(const char *name
);
147 extern void cupsdCreateCommonData(void);
148 extern void cupsdDeleteAllPrinters(void);
149 extern int cupsdDeletePrinter(cupsd_printer_t
*p
, int update
);
150 extern cupsd_printer_t
*cupsdFindDest(const char *name
);
151 extern cupsd_printer_t
*cupsdFindPrinter(const char *name
);
152 extern cupsd_quota_t
*cupsdFindQuota(cupsd_printer_t
*p
,
153 const char *username
);
154 extern void cupsdFreeQuotas(cupsd_printer_t
*p
);
155 extern void cupsdLoadAllPrinters(void);
156 extern void cupsdRenamePrinter(cupsd_printer_t
*p
,
158 extern void cupsdSaveAllPrinters(void);
159 extern int cupsdSetAuthInfoRequired(cupsd_printer_t
*p
,
161 ipp_attribute_t
*attr
);
162 extern void cupsdSetDeviceURI(cupsd_printer_t
*p
, const char *uri
);
163 extern void cupsdSetPrinterAttr(cupsd_printer_t
*p
,
164 const char *name
, char *value
);
165 extern void cupsdSetPrinterAttrs(cupsd_printer_t
*p
);
166 extern int cupsdSetPrinterReasons(cupsd_printer_t
*p
,
168 extern void cupsdSetPrinterState(cupsd_printer_t
*p
, ipp_pstate_t s
,
170 #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
171 extern void cupsdStopPrinter(cupsd_printer_t
*p
, int update
);
172 extern int cupsdUpdatePrinterPPD(cupsd_printer_t
*p
,
174 cups_option_t
*keywords
);
175 extern void cupsdUpdatePrinters(void);
176 extern cupsd_quota_t
*cupsdUpdateQuota(cupsd_printer_t
*p
,
177 const char *username
, int pages
,
179 extern const char *cupsdValidateDest(const char *uri
,
181 cupsd_printer_t
**printer
);
182 extern void cupsdWritePrintcap(void);