xref: /onnv-gate/usr/src/cmd/lp/include/printers.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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
220Sstevel@tonic-gate /*	  All Rights Reserved  	*/
230Sstevel@tonic-gate 
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
26*3125Sjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
270Sstevel@tonic-gate  * Use is subject to license terms.
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #if	!defined(_LP_PRINTERS_H)
330Sstevel@tonic-gate #define	_LP_PRINTERS_H
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Define the following to support administrator configurable
370Sstevel@tonic-gate  * streams modules:
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate #define	CAN_DO_MODULES	1	/* */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /**
420Sstevel@tonic-gate  ** The disk copy of the printer files:
430Sstevel@tonic-gate  **/
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * There are 19 fields in the printer configuration file.
470Sstevel@tonic-gate  */
480Sstevel@tonic-gate #define PR_MAX	19
490Sstevel@tonic-gate # define PR_BAN		0
500Sstevel@tonic-gate # define PR_CPI		1
510Sstevel@tonic-gate # define PR_CS		2
520Sstevel@tonic-gate # define PR_ITYPES	3
530Sstevel@tonic-gate # define PR_DEV		4
540Sstevel@tonic-gate # define PR_DIAL	5
550Sstevel@tonic-gate # define PR_RECOV	6
560Sstevel@tonic-gate # define PR_INTFC	7
570Sstevel@tonic-gate # define PR_LPI		8
580Sstevel@tonic-gate # define PR_LEN		9
590Sstevel@tonic-gate # define PR_LOGIN	10
600Sstevel@tonic-gate # define PR_PTYPE	11
610Sstevel@tonic-gate # define PR_REMOTE	12
620Sstevel@tonic-gate # define PR_SPEED	13
630Sstevel@tonic-gate # define PR_STTY	14
640Sstevel@tonic-gate # define PR_WIDTH	15
650Sstevel@tonic-gate # define PR_MODULES	16
660Sstevel@tonic-gate #define PR_OPTIONS	17
670Sstevel@tonic-gate #define PR_PPD		18
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /**
700Sstevel@tonic-gate  ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
710Sstevel@tonic-gate  **/
720Sstevel@tonic-gate 
730Sstevel@tonic-gate #define	PS_REJECTED	0x001
740Sstevel@tonic-gate #define	PS_DISABLED	0x002
750Sstevel@tonic-gate #define	PS_FAULTED	0x004
760Sstevel@tonic-gate #define	PS_BUSY		0x008
770Sstevel@tonic-gate #define	PS_LATER	0x010	/* Printer is scheduled for service */
780Sstevel@tonic-gate #define PS_SHOW_FAULT	0x100 /* set if exMess should be run when fault */
790Sstevel@tonic-gate #define PS_USE_AS_KEY	0x200 /* to insure that status used as key is non 0 */
800Sstevel@tonic-gate #define PS_FORM_FAULT	0x400 /* set a form fault rather a printer fault*/
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /**
830Sstevel@tonic-gate  ** The internal copy of a printer as seen by the rest of the world:
840Sstevel@tonic-gate  **/
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /*
870Sstevel@tonic-gate  * A (char **) list is an array of string pointers (char *) with
880Sstevel@tonic-gate  * a null pointer after the last item.
890Sstevel@tonic-gate  */
900Sstevel@tonic-gate typedef struct PRINTER {
910Sstevel@tonic-gate 	char   *name;		/* name of printer (redundant) */
920Sstevel@tonic-gate 	unsigned short banner;	/* banner page conditions */
930Sstevel@tonic-gate 	SCALED cpi;             /* default character pitch */
940Sstevel@tonic-gate 	char   **char_sets;     /* list of okay char-sets/print-wheels */
950Sstevel@tonic-gate 	char   **input_types;   /* list of types acceptable to printer */
960Sstevel@tonic-gate 	char   *device;         /* printer port full path name */
970Sstevel@tonic-gate 	char   *dial_info;      /* system name or phone # for dial-up */
980Sstevel@tonic-gate 	char   *fault_rec;      /* printer fault recovery procedure */
990Sstevel@tonic-gate 	char   *interface;      /* interface program full path name */
1000Sstevel@tonic-gate 	SCALED lpi;             /* default line pitch */
1010Sstevel@tonic-gate 	SCALED plen;            /* default page length */
1020Sstevel@tonic-gate 	unsigned short login;	/* is/isn't a login terminal */
1030Sstevel@tonic-gate 	char   *printer_type;   /* Terminfo look-up value (obsolete) */
1040Sstevel@tonic-gate 	char   *remote;         /* remote machine!printer-name */
1050Sstevel@tonic-gate 	char   *speed;          /* baud rate for connection */
1060Sstevel@tonic-gate 	char   *stty;           /* space separated list of stty options */
1070Sstevel@tonic-gate 	SCALED pwid;            /* default page width */
1080Sstevel@tonic-gate 	char   *description;	/* comment about printer */
1090Sstevel@tonic-gate 	FALERT fault_alert;	/* how to alert on printer fault */
1100Sstevel@tonic-gate 	short  daisy;           /* 1/0 - printwheels/character-sets */
1110Sstevel@tonic-gate #if     defined(CAN_DO_MODULES)
1120Sstevel@tonic-gate 	char   **modules;	/* streams modules to push */
1130Sstevel@tonic-gate #endif
1140Sstevel@tonic-gate 	char   **printer_types; /* Terminfo look-up values */
1150Sstevel@tonic-gate 	char	**options;	/* space separated list of undefined -o options */
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate #ifdef LP_USE_PAPI_ATTR
1180Sstevel@tonic-gate 	char	*ppd;		/* printer's PPD file full path name */
1190Sstevel@tonic-gate #endif
1200Sstevel@tonic-gate 	/*
1210Sstevel@tonic-gate 	 * Adding new members to this structure? Check out
1220Sstevel@tonic-gate 	 * cmd/lpadmin/do_printer.c, where we initialize
1230Sstevel@tonic-gate 	 * each new printer structure.
1240Sstevel@tonic-gate 	 */
1250Sstevel@tonic-gate }			PRINTER;
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate #define BAN_ALWAYS	0x01	/* user can't override banner */
1280Sstevel@tonic-gate #define BAN_OFF		0x02	/* don't print banner page */
1290Sstevel@tonic-gate #define BAN_NEVER	BAN_OFF
1300Sstevel@tonic-gate #define BAN_OPTIONAL	(BAN_ALWAYS | BAN_NEVER) /* user can override banner */
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate #define LOG_IN		0x01	/* printer is login terminal */
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate #define PCK_TYPE	0x0001	/* printer type isn't in Terminfo */
1350Sstevel@tonic-gate #define PCK_CHARSET	0x0002	/* printer type can't handle ".char_sets" */
1360Sstevel@tonic-gate #define PCK_CPI		0x0004	/* printer type can't handle ".cpi" */
1370Sstevel@tonic-gate #define PCK_LPI		0x0008	/* printer type can't handle ".lpi" */
1380Sstevel@tonic-gate #define PCK_WIDTH	0x0010	/* printer type can't handle ".pwid" */
1390Sstevel@tonic-gate #define PCK_LENGTH	0x0020	/* printer type can't handle ".plen" */
1400Sstevel@tonic-gate #define PCK_PAPER	0x0040	/* printer type can't handle paper */
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate /*
1430Sstevel@tonic-gate  * The following PCK_... bits are only set by the Spooler,
1440Sstevel@tonic-gate  * when refusing a request.
1450Sstevel@tonic-gate  */
1460Sstevel@tonic-gate #define PCK_BANNER	0x1000	/* printer needs banner */
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /*
1490Sstevel@tonic-gate  * Flags set by "putprinter()" for things that go wrong.
1500Sstevel@tonic-gate  */
1510Sstevel@tonic-gate #define BAD_REMOTE	0x0001	/* has attributes of remote and local */
1520Sstevel@tonic-gate #define BAD_INTERFACE	0x0002	/* no interface or can't read it */
1530Sstevel@tonic-gate #define BAD_DEVDIAL	0x0004	/* no device or dial information */
1540Sstevel@tonic-gate #define BAD_FAULT	0x0008	/* not recognized fault recovery */
1550Sstevel@tonic-gate #define BAD_ALERT	0x0010	/* has reserved word for alert command */
1560Sstevel@tonic-gate #define BAD_ITYPES	0x0020	/* multiple printer AND input types */
1570Sstevel@tonic-gate #define BAD_PTYPES	0x0040	/* multiple printer types, incl unknown */
1580Sstevel@tonic-gate #define BAD_DAISY	0x0080	/* printer types don't agree on "daisy" */
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate /*
1610Sstevel@tonic-gate  * A comma separated list of STREAMS modules to be pushed on an
1620Sstevel@tonic-gate  * opened port.
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate #define	DEFMODULES	"ldterm"
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate /*
1670Sstevel@tonic-gate  * For print wheels:
1680Sstevel@tonic-gate  */
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate typedef struct PWHEEL {
1710Sstevel@tonic-gate 	char   *name;		/* name of print wheel */
1720Sstevel@tonic-gate 	FALERT alert;		/* how to alert when mount needed */
1730Sstevel@tonic-gate }			PWHEEL;
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate extern unsigned long	badprinter,
1760Sstevel@tonic-gate 			ignprinter;
1770Sstevel@tonic-gate 
1780Sstevel@tonic-gate /*
1790Sstevel@tonic-gate  * Set if ppd file information is from the user rather than
1800Sstevel@tonic-gate  * the configuration file.
1810Sstevel@tonic-gate  */
1820Sstevel@tonic-gate extern int ppdopt;
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate /**
1850Sstevel@tonic-gate  ** Various routines.
1860Sstevel@tonic-gate  **/
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate PRINTER *	getprinter ( char * );
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate PWHEEL *	getpwheel ( char * );
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate char *		getdefault ( void );
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate int		putprinter ( char *, PRINTER *);
1950Sstevel@tonic-gate int		delprinter ( char * );
1960Sstevel@tonic-gate int		putdefault ( char * );
1970Sstevel@tonic-gate int		deldefault ( void );
1980Sstevel@tonic-gate int		putpwheel ( char * , PWHEEL * );
1990Sstevel@tonic-gate int		delpwheel ( char * );
2000Sstevel@tonic-gate int		okprinter ( char * , PRINTER * , int );
2010Sstevel@tonic-gate 
2020Sstevel@tonic-gate unsigned long	chkprinter (char *, char *, char *, char *, char *, char *);
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate void		freeprinter ( PRINTER * );
2050Sstevel@tonic-gate void		freepwheel ( PWHEEL * );
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate char *	getpentry(char *, int);
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate /**
2100Sstevel@tonic-gate  ** Aliases (copies) of some important Terminfo caps.
2110Sstevel@tonic-gate  **/
2120Sstevel@tonic-gate 
2130Sstevel@tonic-gate extern int		ti_daisy;
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate #endif
216