xref: /illumos-gate/usr/src/cmd/lp/include/printers.h (revision b3b35633)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50a44ef6dSjacobs  * Common Development and Distribution License (the "License").
60a44ef6dSjacobs  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
227c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
260a44ef6dSjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
28*c3377ee9SJohn Levon  * Copyright 2019 Joyent, Inc.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #if	!defined(_LP_PRINTERS_H)
327c478bd9Sstevel@tonic-gate #define	_LP_PRINTERS_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Define the following to support administrator configurable
367c478bd9Sstevel@tonic-gate  * streams modules:
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #define	CAN_DO_MODULES	1	/* */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /**
417c478bd9Sstevel@tonic-gate  ** The disk copy of the printer files:
427c478bd9Sstevel@tonic-gate  **/
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * There are 19 fields in the printer configuration file.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #define PR_MAX	19
487c478bd9Sstevel@tonic-gate # define PR_BAN		0
497c478bd9Sstevel@tonic-gate # define PR_CPI		1
507c478bd9Sstevel@tonic-gate # define PR_CS		2
517c478bd9Sstevel@tonic-gate # define PR_ITYPES	3
527c478bd9Sstevel@tonic-gate # define PR_DEV		4
537c478bd9Sstevel@tonic-gate # define PR_DIAL	5
547c478bd9Sstevel@tonic-gate # define PR_RECOV	6
557c478bd9Sstevel@tonic-gate # define PR_INTFC	7
567c478bd9Sstevel@tonic-gate # define PR_LPI		8
577c478bd9Sstevel@tonic-gate # define PR_LEN		9
587c478bd9Sstevel@tonic-gate # define PR_LOGIN	10
597c478bd9Sstevel@tonic-gate # define PR_PTYPE	11
607c478bd9Sstevel@tonic-gate # define PR_REMOTE	12
617c478bd9Sstevel@tonic-gate # define PR_SPEED	13
627c478bd9Sstevel@tonic-gate # define PR_STTY	14
637c478bd9Sstevel@tonic-gate # define PR_WIDTH	15
647c478bd9Sstevel@tonic-gate # define PR_MODULES	16
657c478bd9Sstevel@tonic-gate #define PR_OPTIONS	17
667c478bd9Sstevel@tonic-gate #define PR_PPD		18
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /**
697c478bd9Sstevel@tonic-gate  ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
707c478bd9Sstevel@tonic-gate  **/
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #define	PS_REJECTED	0x001
737c478bd9Sstevel@tonic-gate #define	PS_DISABLED	0x002
747c478bd9Sstevel@tonic-gate #define	PS_FAULTED	0x004
757c478bd9Sstevel@tonic-gate #define	PS_BUSY		0x008
767c478bd9Sstevel@tonic-gate #define	PS_LATER	0x010	/* Printer is scheduled for service */
777c478bd9Sstevel@tonic-gate #define PS_SHOW_FAULT	0x100 /* set if exMess should be run when fault */
787c478bd9Sstevel@tonic-gate #define PS_USE_AS_KEY	0x200 /* to insure that status used as key is non 0 */
797c478bd9Sstevel@tonic-gate #define PS_FORM_FAULT	0x400 /* set a form fault rather a printer fault*/
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /**
827c478bd9Sstevel@tonic-gate  ** The internal copy of a printer as seen by the rest of the world:
837c478bd9Sstevel@tonic-gate  **/
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * A (char **) list is an array of string pointers (char *) with
877c478bd9Sstevel@tonic-gate  * a null pointer after the last item.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate typedef struct PRINTER {
907c478bd9Sstevel@tonic-gate 	char   *name;		/* name of printer (redundant) */
917c478bd9Sstevel@tonic-gate 	unsigned short banner;	/* banner page conditions */
927c478bd9Sstevel@tonic-gate 	SCALED cpi;             /* default character pitch */
937c478bd9Sstevel@tonic-gate 	char   **char_sets;     /* list of okay char-sets/print-wheels */
947c478bd9Sstevel@tonic-gate 	char   **input_types;   /* list of types acceptable to printer */
957c478bd9Sstevel@tonic-gate 	char   *device;         /* printer port full path name */
967c478bd9Sstevel@tonic-gate 	char   *dial_info;      /* system name or phone # for dial-up */
977c478bd9Sstevel@tonic-gate 	char   *fault_rec;      /* printer fault recovery procedure */
987c478bd9Sstevel@tonic-gate 	char   *interface;      /* interface program full path name */
997c478bd9Sstevel@tonic-gate 	SCALED lpi;             /* default line pitch */
1007c478bd9Sstevel@tonic-gate 	SCALED plen;            /* default page length */
1017c478bd9Sstevel@tonic-gate 	unsigned short login;	/* is/isn't a login terminal */
1027c478bd9Sstevel@tonic-gate 	char   *printer_type;   /* Terminfo look-up value (obsolete) */
1037c478bd9Sstevel@tonic-gate 	char   *remote;         /* remote machine!printer-name */
1047c478bd9Sstevel@tonic-gate 	char   *speed;          /* baud rate for connection */
1057c478bd9Sstevel@tonic-gate 	char   *stty;           /* space separated list of stty options */
1067c478bd9Sstevel@tonic-gate 	SCALED pwid;            /* default page width */
1077c478bd9Sstevel@tonic-gate 	char   *description;	/* comment about printer */
1087c478bd9Sstevel@tonic-gate 	FALERT fault_alert;	/* how to alert on printer fault */
1097c478bd9Sstevel@tonic-gate 	short  daisy;           /* 1/0 - printwheels/character-sets */
1107c478bd9Sstevel@tonic-gate #if     defined(CAN_DO_MODULES)
1117c478bd9Sstevel@tonic-gate 	char   **modules;	/* streams modules to push */
1127c478bd9Sstevel@tonic-gate #endif
1137c478bd9Sstevel@tonic-gate 	char   **printer_types; /* Terminfo look-up values */
1147c478bd9Sstevel@tonic-gate 	char	**options;	/* space separated list of undefined -o options */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #ifdef LP_USE_PAPI_ATTR
1177c478bd9Sstevel@tonic-gate 	char	*ppd;		/* printer's PPD file full path name */
1187c478bd9Sstevel@tonic-gate #endif
1197c478bd9Sstevel@tonic-gate 	/*
1207c478bd9Sstevel@tonic-gate 	 * Adding new members to this structure? Check out
1217c478bd9Sstevel@tonic-gate 	 * cmd/lpadmin/do_printer.c, where we initialize
1227c478bd9Sstevel@tonic-gate 	 * each new printer structure.
1237c478bd9Sstevel@tonic-gate 	 */
1247c478bd9Sstevel@tonic-gate }			PRINTER;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #define BAN_ALWAYS	0x01	/* user can't override banner */
1277c478bd9Sstevel@tonic-gate #define BAN_OFF		0x02	/* don't print banner page */
1287c478bd9Sstevel@tonic-gate #define BAN_NEVER	BAN_OFF
1297c478bd9Sstevel@tonic-gate #define BAN_OPTIONAL	(BAN_ALWAYS | BAN_NEVER) /* user can override banner */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #define LOG_IN		0x01	/* printer is login terminal */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #define PCK_TYPE	0x0001	/* printer type isn't in Terminfo */
1347c478bd9Sstevel@tonic-gate #define PCK_CHARSET	0x0002	/* printer type can't handle ".char_sets" */
1357c478bd9Sstevel@tonic-gate #define PCK_CPI		0x0004	/* printer type can't handle ".cpi" */
1367c478bd9Sstevel@tonic-gate #define PCK_LPI		0x0008	/* printer type can't handle ".lpi" */
1377c478bd9Sstevel@tonic-gate #define PCK_WIDTH	0x0010	/* printer type can't handle ".pwid" */
1387c478bd9Sstevel@tonic-gate #define PCK_LENGTH	0x0020	/* printer type can't handle ".plen" */
1397c478bd9Sstevel@tonic-gate #define PCK_PAPER	0x0040	/* printer type can't handle paper */
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * The following PCK_... bits are only set by the Spooler,
1437c478bd9Sstevel@tonic-gate  * when refusing a request.
1447c478bd9Sstevel@tonic-gate  */
1457c478bd9Sstevel@tonic-gate #define PCK_BANNER	0x1000	/* printer needs banner */
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * Flags set by "putprinter()" for things that go wrong.
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate #define BAD_REMOTE	0x0001	/* has attributes of remote and local */
1517c478bd9Sstevel@tonic-gate #define BAD_INTERFACE	0x0002	/* no interface or can't read it */
1527c478bd9Sstevel@tonic-gate #define BAD_DEVDIAL	0x0004	/* no device or dial information */
1537c478bd9Sstevel@tonic-gate #define BAD_FAULT	0x0008	/* not recognized fault recovery */
1547c478bd9Sstevel@tonic-gate #define BAD_ALERT	0x0010	/* has reserved word for alert command */
1557c478bd9Sstevel@tonic-gate #define BAD_ITYPES	0x0020	/* multiple printer AND input types */
1567c478bd9Sstevel@tonic-gate #define BAD_PTYPES	0x0040	/* multiple printer types, incl unknown */
1577c478bd9Sstevel@tonic-gate #define BAD_DAISY	0x0080	/* printer types don't agree on "daisy" */
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate /*
1607c478bd9Sstevel@tonic-gate  * A comma separated list of STREAMS modules to be pushed on an
1617c478bd9Sstevel@tonic-gate  * opened port.
1627c478bd9Sstevel@tonic-gate  */
1637c478bd9Sstevel@tonic-gate #define	DEFMODULES	"ldterm"
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  * For print wheels:
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate typedef struct PWHEEL {
1707c478bd9Sstevel@tonic-gate 	char   *name;		/* name of print wheel */
1717c478bd9Sstevel@tonic-gate 	FALERT alert;		/* how to alert when mount needed */
1727c478bd9Sstevel@tonic-gate }			PWHEEL;
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate extern unsigned long	badprinter,
1757c478bd9Sstevel@tonic-gate 			ignprinter;
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * Set if ppd file information is from the user rather than
1797c478bd9Sstevel@tonic-gate  * the configuration file.
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate extern int ppdopt;
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /**
1847c478bd9Sstevel@tonic-gate  ** Various routines.
1857c478bd9Sstevel@tonic-gate  **/
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate PRINTER *	getprinter ( char * );
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate PWHEEL *	getpwheel ( char * );
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate char *		getdefault ( void );
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate int		putprinter ( char *, PRINTER *);
1947c478bd9Sstevel@tonic-gate int		delprinter ( char * );
1957c478bd9Sstevel@tonic-gate int		putdefault ( char * );
1967c478bd9Sstevel@tonic-gate int		deldefault ( void );
1977c478bd9Sstevel@tonic-gate int		putpwheel ( char * , PWHEEL * );
1987c478bd9Sstevel@tonic-gate int		delpwheel ( char * );
1997c478bd9Sstevel@tonic-gate int		okprinter ( char * , PRINTER * , int );
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate unsigned long	chkprinter (char *, char *, char *, char *, char *, char *);
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate void		freeprinter ( PRINTER * );
2047c478bd9Sstevel@tonic-gate void		freepwheel ( PWHEEL * );
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate char *	getpentry(char *, int);
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /**
2097c478bd9Sstevel@tonic-gate  ** Aliases (copies) of some important Terminfo caps.
2107c478bd9Sstevel@tonic-gate  **/
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate extern int		ti_daisy;
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate #endif
215