xref: /onnv-gate/usr/src/cmd/lp/cmd/lpsched/validate.h (revision 3125:084bca4d4623)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3125Sjacobs  * Common Development and Distribution License (the "License").
6*3125Sjacobs  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3125Sjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
30*3125Sjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate /*
330Sstevel@tonic-gate  * The old LP Spooler would take a job destined for a class of printers
340Sstevel@tonic-gate  * if the class was accepting, regardless of the acceptance status of
350Sstevel@tonic-gate  * the printers. This sounds a bit silly, so we thought we'd change it.
360Sstevel@tonic-gate  * Well, that's not compatible. So YOU decide. Define the following if
370Sstevel@tonic-gate  * you want compatibility, don't define it if you want to require BOTH
380Sstevel@tonic-gate  * the printers (at least one) and the class to be accepting.
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate #define CLASS_ACCEPT_PRINTERS_REJECT_SOWHAT 1	/* */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Define the following if we should stop examing a list of printers
440Sstevel@tonic-gate  * on the first one that meets all the needs of the request.
450Sstevel@tonic-gate  * Currently this is done because to continue wouldn't matter. However,
460Sstevel@tonic-gate  * you may add additional code that considers other factors (e.g. size
470Sstevel@tonic-gate  * of queue for printer, size of file under consideration.)
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate #define FILTER_EARLY_OUT 1			/* */
500Sstevel@tonic-gate 
510Sstevel@tonic-gate typedef struct candidate {
520Sstevel@tonic-gate 	PSTATUS *		pps;
530Sstevel@tonic-gate 	char *			slow;
540Sstevel@tonic-gate 	char *			fast;
550Sstevel@tonic-gate 	char **			printer_types;
560Sstevel@tonic-gate 	char *			printer_type;
570Sstevel@tonic-gate 	char *			output_type;
580Sstevel@tonic-gate 	unsigned short		flags;
590Sstevel@tonic-gate 	unsigned short		weight;
600Sstevel@tonic-gate }			CANDIDATE;
610Sstevel@tonic-gate 
620Sstevel@tonic-gate #define WEIGHT_NOFILTER	 1
630Sstevel@tonic-gate #define WEIGHT_FREE	 2
640Sstevel@tonic-gate #define	WEIGHT_ENABLED	 4
650Sstevel@tonic-gate #define	WEIGHT_MOUNTED	 8
660Sstevel@tonic-gate #define WEIGHT_SELECTS	16
670Sstevel@tonic-gate #define	WEIGHT_MAX	( \
680Sstevel@tonic-gate 				WEIGHT_NOFILTER \
690Sstevel@tonic-gate 			      + WEIGHT_FREE \
700Sstevel@tonic-gate 			      + WEIGHT_ENABLED \
710Sstevel@tonic-gate 			      + 2 * WEIGHT_MOUNTED \
720Sstevel@tonic-gate 			      + WEIGHT_SELECTS \
730Sstevel@tonic-gate 			)
740Sstevel@tonic-gate 
750Sstevel@tonic-gate extern int		pick_filter();
760Sstevel@tonic-gate 
770Sstevel@tonic-gate extern char		*o_cpi,
780Sstevel@tonic-gate 			*o_lpi,
790Sstevel@tonic-gate 			*o_width,
800Sstevel@tonic-gate 			*o_length;
81