summaryrefslogtreecommitdiff
path: root/scheduler/printers.h
blob: ef8b3470909ef672748f076245de2e754c02b845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * "$Id: printers.h 5330 2006-03-23 21:07:20Z mike $"
 *
 *   Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
 *
 *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
 *
 *   These coded instructions, statements, and computer programs are the
 *   property of Easy Software Products and are protected by Federal
 *   copyright law.  Distribution and use rights are outlined in the file
 *   "LICENSE.txt" which should have been included with this file.  If this
 *   file is missing or damaged please contact Easy Software Products
 *   at:
 *
 *       Attn: CUPS Licensing Information
 *       Easy Software Products
 *       44141 Airport View Drive, Suite 204
 *       Hollywood, Maryland 20636 USA
 *
 *       Voice: (301) 373-9600
 *       EMail: cups-info@cups.org
 *         WWW: http://www.cups.org
 */

/*
 * Quota data...
 */

typedef struct
{
  char		username[33];		/* User data */
  time_t	next_update;		/* Next update time */
  int		page_count,		/* Count of pages */
		k_count;		/* Count of kilobytes */
} cupsd_quota_t;


/*
 * Printer/class information structure...
 */

typedef struct cupsd_printer_s
{
  char		*uri,			/* Printer URI */
		*hostname,		/* Host printer resides on */
		*name,			/* Printer name */
		*location,		/* Location code */
		*make_model,		/* Make and model */
		*info,			/* Description */
		*op_policy,		/* Operation policy name */
		*error_policy;		/* Error policy */
  cupsd_policy_t *op_policy_ptr;	/* Pointer to operation policy */
  int		shared;			/* Shared? */
  int		accepting;		/* Accepting jobs? */
  int		in_implicit_class;	/* In an implicit class? */
  ipp_pstate_t	state;			/* Printer state */
  char		state_message[1024];	/* Printer state message */
  int		num_reasons;		/* Number of printer-state-reasons */
  char		*reasons[16];		/* printer-state-reasons strings */
  time_t	state_time;		/* Time at this state */
  char		*job_sheets[2];		/* Banners/job sheets */
  cups_ptype_t	type;			/* Printer type (color, small, etc.) */
  char		*browse_attrs;		/* Attributes sent with browse data */
  time_t	browse_expire;		/* Expiration time for printer */
  time_t	browse_time;		/* Last time update was sent/received */
  char		*device_uri;		/* Device URI */
  char		*port_monitor;		/* Port monitor */
  int		raw;			/* Raw queue? */
  mime_type_t	*filetype;		/* Pseudo-filetype for printer */
  cups_array_t	*filetypes;		/* Supported file types */
  void		*job;			/* Current job in queue */
  ipp_t		*attrs;			/* Attributes supported by this printer */
  int		num_printers,		/* Number of printers in class */
		last_printer;		/* Last printer job was sent to */
  struct cupsd_printer_s **printers;	/* Printers in class */
  int		quota_period,		/* Period for quotas */
		page_limit,		/* Maximum number of pages */
		k_limit;		/* Maximum number of kilobytes */
  cups_array_t	*quotas;		/* Quota records */
  int		deny_users,		/* 1 = deny, 0 = allow */
		num_users;		/* Number of allowed/denied users */
  const char	**users;		/* Allowed/denied users */
  int		num_history;		/* Number of history collections */
  ipp_t		**history;		/* History data */
  int		sequence_number;	/* Increasing sequence number */
  int		num_options;		/* Number of default options */
  cups_option_t	*options;		/* Default options */
#ifdef __APPLE__
  char		*recoverable;		/* com.apple.print.recoverable-message */
#endif /* __APPLE__ */
} cupsd_printer_t;


/*
 * Globals...
 */

VAR ipp_t		*CommonData	VALUE(NULL);
					/* Common printer object attrs */
VAR cups_array_t	*Printers	VALUE(NULL),
					/* Printer list */
			*ImplicitPrinters VALUE(NULL);
					/* Implicit class printers */
VAR cupsd_printer_t	*DefaultPrinter	VALUE(NULL);
					/* Default printer */
VAR char		*DefaultPolicy	VALUE(NULL);
					/* Default policy name */
VAR cupsd_policy_t	*DefaultPolicyPtr
					VALUE(NULL);
					/* Pointer to default policy */


/*
 * Prototypes...
 */

extern cupsd_printer_t	*cupsdAddPrinter(const char *name);
extern void		cupsdAddPrinterHistory(cupsd_printer_t *p);
extern void		cupsdAddPrinterUser(cupsd_printer_t *p, const char *username);
extern void		cupsdCreateCommonData(void);
extern void		cupsdDeleteAllPrinters(void);
extern void		cupsdDeletePrinter(cupsd_printer_t *p, int update);
extern cupsd_printer_t	*cupsdFindDest(const char *name);
extern cupsd_printer_t	*cupsdFindPrinter(const char *name);
extern void		cupsdFreePrinterUsers(cupsd_printer_t *p);
extern void		cupsdFreeQuotas(cupsd_printer_t *p);
extern void		cupsdLoadAllPrinters(void);
extern void		cupsdRenamePrinter(cupsd_printer_t *p, const char *name);
extern void		cupsdSaveAllPrinters(void);
extern void		cupsdSetPrinterAttrs(cupsd_printer_t *p);
extern void		cupsdSetPrinterReasons(cupsd_printer_t *p, const char *s);
extern void		cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, int update);
#define			cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
extern void		cupsdStopPrinter(cupsd_printer_t *p, int update);
extern void		cupsdUpdatePrinters(void);
extern cupsd_quota_t	*cupsdUpdateQuota(cupsd_printer_t *p, const char *username,
			                  int pages, int k);
extern const char	*cupsdValidateDest(const char *hostname,
			        	   const char *resource,
			        	   cups_ptype_t *dtype,
					   cupsd_printer_t **printer);
extern void		cupsdWritePrintcap(void);

extern char		*cupsdSanitizeURI(const char *uri, char *buffer,
			                  int buflen);


/*
 * End of "$Id: printers.h 5330 2006-03-23 21:07:20Z mike $".
 */