]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / printers.h
1 /*
2 * "$Id: printers.h 5533 2006-05-16 19:45:14Z mike $"
3 *
4 * Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
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
25 /*
26 * Quota data...
27 */
28
29 typedef struct
30 {
31 char username[33]; /* User data */
32 time_t next_update; /* Next update time */
33 int page_count, /* Count of pages */
34 k_count; /* Count of kilobytes */
35 } cupsd_quota_t;
36
37
38 /*
39 * Printer/class information structure...
40 */
41
42 typedef struct cupsd_printer_s
43 {
44 char *uri, /* Printer URI */
45 *hostname, /* Host printer resides on */
46 *name, /* Printer name */
47 *location, /* Location code */
48 *make_model, /* Make and model */
49 *info, /* Description */
50 *op_policy, /* Operation policy name */
51 *error_policy; /* Error policy */
52 cupsd_policy_t *op_policy_ptr; /* Pointer to operation policy */
53 int shared; /* Shared? */
54 int accepting; /* Accepting jobs? */
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 */
59 char *reasons[16]; /* printer-state-reasons strings */
60 time_t state_time; /* Time at this state */
61 char *job_sheets[2]; /* Banners/job sheets */
62 cups_ptype_t type; /* Printer type (color, small, etc.) */
63 char *browse_attrs; /* Attributes sent with browse data */
64 time_t browse_expire; /* Expiration time for printer */
65 time_t browse_time; /* Last time update was sent/received */
66 char *device_uri; /* Device URI */
67 char *port_monitor; /* Port monitor */
68 int raw; /* Raw queue? */
69 mime_type_t *filetype; /* Pseudo-filetype for printer */
70 cups_array_t *filetypes; /* Supported file types */
71 void *job; /* Current job in queue */
72 ipp_t *attrs; /* Attributes supported by this printer */
73 int num_printers, /* Number of printers in class */
74 last_printer; /* Last printer job was sent to */
75 struct cupsd_printer_s **printers; /* Printers in class */
76 int quota_period, /* Period for quotas */
77 page_limit, /* Maximum number of pages */
78 k_limit; /* Maximum number of kilobytes */
79 cups_array_t *quotas; /* Quota records */
80 int deny_users, /* 1 = deny, 0 = allow */
81 num_users; /* Number of allowed/denied users */
82 const char **users; /* Allowed/denied users */
83 int num_history; /* Number of history collections */
84 ipp_t **history; /* History data */
85 int sequence_number; /* Increasing sequence number */
86 int num_options; /* Number of default options */
87 cups_option_t *options; /* Default options */
88 #ifdef __APPLE__
89 char *recoverable; /* com.apple.print.recoverable-message */
90 #endif /* __APPLE__ */
91 } cupsd_printer_t;
92
93
94 /*
95 * Globals...
96 */
97
98 VAR ipp_t *CommonData VALUE(NULL);
99 /* Common printer object attrs */
100 VAR cups_array_t *Printers VALUE(NULL),
101 /* Printer list */
102 *ImplicitPrinters VALUE(NULL);
103 /* Implicit class printers */
104 VAR cupsd_printer_t *DefaultPrinter VALUE(NULL);
105 /* Default printer */
106 VAR char *DefaultPolicy VALUE(NULL);
107 /* Default policy name */
108 VAR cupsd_policy_t *DefaultPolicyPtr
109 VALUE(NULL);
110 /* Pointer to default policy */
111
112
113 /*
114 * Prototypes...
115 */
116
117 extern cupsd_printer_t *cupsdAddPrinter(const char *name);
118 extern void cupsdAddPrinterHistory(cupsd_printer_t *p);
119 extern void cupsdAddPrinterUser(cupsd_printer_t *p, const char *username);
120 extern void cupsdCreateCommonData(void);
121 extern void cupsdDeleteAllPrinters(void);
122 extern void cupsdDeletePrinter(cupsd_printer_t *p, int update);
123 extern cupsd_printer_t *cupsdFindDest(const char *name);
124 extern cupsd_printer_t *cupsdFindPrinter(const char *name);
125 extern void cupsdFreePrinterUsers(cupsd_printer_t *p);
126 extern void cupsdFreeQuotas(cupsd_printer_t *p);
127 extern void cupsdLoadAllPrinters(void);
128 extern void cupsdRenamePrinter(cupsd_printer_t *p, const char *name);
129 extern void cupsdSaveAllPrinters(void);
130 extern void cupsdSetPrinterAttrs(cupsd_printer_t *p);
131 extern void cupsdSetPrinterReasons(cupsd_printer_t *p, const char *s);
132 extern void cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, int update);
133 #define cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
134 extern void cupsdStopPrinter(cupsd_printer_t *p, int update);
135 extern void cupsdUpdatePrinters(void);
136 extern cupsd_quota_t *cupsdUpdateQuota(cupsd_printer_t *p, const char *username,
137 int pages, int k);
138 extern const char *cupsdValidateDest(const char *uri,
139 cups_ptype_t *dtype,
140 cupsd_printer_t **printer);
141 extern void cupsdWritePrintcap(void);
142
143 extern char *cupsdSanitizeURI(const char *uri, char *buffer,
144 int buflen);
145
146
147 /*
148 * End of "$Id: printers.h 5533 2006-05-16 19:45:14Z mike $".
149 */