xref: /illumos-gate/usr/src/cmd/lp/cmd/lpsched/validate.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 /*
30  * The old LP Spooler would take a job destined for a class of printers
31  * if the class was accepting, regardless of the acceptance status of
32  * the printers. This sounds a bit silly, so we thought we'd change it.
33  * Well, that's not compatible. So YOU decide. Define the following if
34  * you want compatibility, don't define it if you want to require BOTH
35  * the printers (at least one) and the class to be accepting.
36  */
37 #define CLASS_ACCEPT_PRINTERS_REJECT_SOWHAT 1	/* */
38 
39 /*
40  * Define the following if we should stop examing a list of printers
41  * on the first one that meets all the needs of the request.
42  * Currently this is done because to continue wouldn't matter. However,
43  * you may add additional code that considers other factors (e.g. size
44  * of queue for printer, size of file under consideration.)
45  */
46 #define FILTER_EARLY_OUT 1			/* */
47 
48 typedef struct candidate {
49 	PSTATUS *		pps;
50 	char *			slow;
51 	char *			fast;
52 	char **			printer_types;
53 	char *			printer_type;
54 	char *			output_type;
55 	unsigned short		flags;
56 	unsigned short		weight;
57 }			CANDIDATE;
58 
59 #define WEIGHT_NOFILTER	 1
60 #define WEIGHT_FREE	 2
61 #define	WEIGHT_ENABLED	 4
62 #define	WEIGHT_MOUNTED	 8
63 #define WEIGHT_SELECTS	16
64 #define	WEIGHT_MAX	( \
65 				WEIGHT_NOFILTER \
66 			      + WEIGHT_FREE \
67 			      + WEIGHT_ENABLED \
68 			      + 2 * WEIGHT_MOUNTED \
69 			      + WEIGHT_SELECTS \
70 			)
71 
72 extern int		pick_filter();
73 
74 extern char		*o_cpi,
75 			*o_lpi,
76 			*o_width,
77 			*o_length;
78