]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/printers.h
Fix fast reload and common printer attrs (STR #562)
[thirdparty/cups.git] / scheduler / printers.h
1 /*
2 * "$Id: printers.h,v 1.36 2004/02/05 16:17:16 mike Exp $"
3 *
4 * Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 1997-2003 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-3111 USA
19 *
20 * Voice: (301) 373-9603
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 } quota_t;
36
37
38 /*
39 * Printer/class information structure...
40 */
41
42 typedef struct printer_str
43 {
44 struct printer_str *next; /* Next printer in list */
45 char *uri, /* Printer URI */
46 *hostname, /* Host printer resides on */
47 *name, /* Printer name */
48 *location, /* Location code */
49 *make_model, /* Make and model */
50 *info; /* Description */
51 int accepting; /* Accepting jobs? */
52 ipp_pstate_t state; /* Printer state */
53 char state_message[1024]; /* Printer state message */
54 int num_reasons; /* Number of printer-state-reasons */
55 char *reasons[16]; /* printer-state-reasons strings */
56 time_t state_time; /* Time at this state */
57 char *job_sheets[2]; /* Banners/job sheets */
58 cups_ptype_t type; /* Printer type (color, small, etc.) */
59 time_t browse_time; /* Last time update was sent/received */
60 char *device_uri; /* Device URI */
61 int raw; /* Raw queue? */
62 mime_type_t *filetype; /* Pseudo-filetype for printer */
63 void *job; /* Current job in queue */
64 ipp_t *attrs; /* Attributes supported by this printer */
65 int num_printers, /* Number of printers in class */
66 last_printer; /* Last printer job was sent to */
67 struct printer_str **printers; /* Printers in class */
68 int quota_period, /* Period for quotas */
69 page_limit, /* Maximum number of pages */
70 k_limit, /* Maximum number of kilobytes */
71 num_quotas; /* Number of quota records */
72 quota_t *quotas; /* Quota records */
73 int deny_users, /* 1 = deny, 0 = allow */
74 num_users; /* Number of allowed/denied users */
75 const char **users; /* Allowed/denied users */
76 int num_history; /* Number of history collections */
77 ipp_t **history; /* History data */
78 int sequence_number; /* Increasing sequence number */
79 } printer_t;
80
81
82 /*
83 * Globals...
84 */
85
86 VAR ipp_t *CommonData VALUE(NULL);/* Common printer object attrs */
87 VAR printer_t *Printers VALUE(NULL); /* Printer list */
88 VAR printer_t *DefaultPrinter VALUE(NULL);
89 /* Default printer */
90
91 /*
92 * Prototypes...
93 */
94
95 extern printer_t *AddPrinter(const char *name);
96 extern void AddPrinterFilter(printer_t *p, const char *filter);
97 extern void AddPrinterHistory(printer_t *p);
98 extern void AddPrinterUser(printer_t *p, const char *username);
99 extern quota_t *AddQuota(printer_t *p, const char *username);
100 extern void CreateCommonData(void);
101 extern void DeleteAllPrinters(void);
102 extern void DeletePrinter(printer_t *p, int update);
103 extern void DeletePrinterFilters(printer_t *p);
104 extern printer_t *FindDest(const char *name);
105 extern printer_t *FindPrinter(const char *name);
106 extern quota_t *FindQuota(printer_t *p, const char *username);
107 extern void FreePrinterUsers(printer_t *p);
108 extern void FreeQuotas(printer_t *p);
109 extern void LoadAllPrinters(void);
110 extern void SaveAllPrinters(void);
111 extern void SetPrinterAttrs(printer_t *p);
112 extern void SetPrinterReasons(printer_t *p, const char *s);
113 extern void SetPrinterState(printer_t *p, ipp_pstate_t s, int update);
114 extern void SortPrinters(void);
115 #define StartPrinter(p,u) SetPrinterState((p), IPP_PRINTER_IDLE, (u))
116 extern void StopPrinter(printer_t *p, int update);
117 extern quota_t *UpdateQuota(printer_t *p, const char *username,
118 int pages, int k);
119 extern const char *ValidateDest(const char *hostname,
120 const char *resource,
121 cups_ptype_t *dtype);
122 extern void WritePrintcap(void);
123
124
125 /*
126 * End of "$Id: printers.h,v 1.36 2004/02/05 16:17:16 mike Exp $".
127 */