xref: /titanic_50/usr/src/cmd/lp/include/printers.h (revision 0209230bf1261579beab4f55226bb509e6b850cb)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22 /*	  All Rights Reserved  	*/
23 
24 
25 /*
26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #if	!defined(_LP_PRINTERS_H)
33 #define	_LP_PRINTERS_H
34 
35 /*
36  * Define the following to support administrator configurable
37  * streams modules:
38  */
39 #define	CAN_DO_MODULES	1	/* */
40 
41 /**
42  ** The disk copy of the printer files:
43  **/
44 
45 /*
46  * There are 19 fields in the printer configuration file.
47  */
48 #define PR_MAX	19
49 # define PR_BAN		0
50 # define PR_CPI		1
51 # define PR_CS		2
52 # define PR_ITYPES	3
53 # define PR_DEV		4
54 # define PR_DIAL	5
55 # define PR_RECOV	6
56 # define PR_INTFC	7
57 # define PR_LPI		8
58 # define PR_LEN		9
59 # define PR_LOGIN	10
60 # define PR_PTYPE	11
61 # define PR_REMOTE	12
62 # define PR_SPEED	13
63 # define PR_STTY	14
64 # define PR_WIDTH	15
65 # define PR_MODULES	16
66 #define PR_OPTIONS	17
67 #define PR_PPD		18
68 
69 /**
70  ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
71  **/
72 
73 #define	PS_REJECTED	0x001
74 #define	PS_DISABLED	0x002
75 #define	PS_FAULTED	0x004
76 #define	PS_BUSY		0x008
77 #define	PS_LATER	0x010	/* Printer is scheduled for service */
78 #define PS_SHOW_FAULT	0x100 /* set if exMess should be run when fault */
79 #define PS_USE_AS_KEY	0x200 /* to insure that status used as key is non 0 */
80 #define PS_FORM_FAULT	0x400 /* set a form fault rather a printer fault*/
81 
82 /**
83  ** The internal copy of a printer as seen by the rest of the world:
84  **/
85 
86 /*
87  * A (char **) list is an array of string pointers (char *) with
88  * a null pointer after the last item.
89  */
90 typedef struct PRINTER {
91 	char   *name;		/* name of printer (redundant) */
92 	unsigned short banner;	/* banner page conditions */
93 	SCALED cpi;             /* default character pitch */
94 	char   **char_sets;     /* list of okay char-sets/print-wheels */
95 	char   **input_types;   /* list of types acceptable to printer */
96 	char   *device;         /* printer port full path name */
97 	char   *dial_info;      /* system name or phone # for dial-up */
98 	char   *fault_rec;      /* printer fault recovery procedure */
99 	char   *interface;      /* interface program full path name */
100 	SCALED lpi;             /* default line pitch */
101 	SCALED plen;            /* default page length */
102 	unsigned short login;	/* is/isn't a login terminal */
103 	char   *printer_type;   /* Terminfo look-up value (obsolete) */
104 	char   *remote;         /* remote machine!printer-name */
105 	char   *speed;          /* baud rate for connection */
106 	char   *stty;           /* space separated list of stty options */
107 	SCALED pwid;            /* default page width */
108 	char   *description;	/* comment about printer */
109 	FALERT fault_alert;	/* how to alert on printer fault */
110 	short  daisy;           /* 1/0 - printwheels/character-sets */
111 #if     defined(CAN_DO_MODULES)
112 	char   **modules;	/* streams modules to push */
113 #endif
114 	char   **printer_types; /* Terminfo look-up values */
115 	char	**options;	/* space separated list of undefined -o options */
116 
117 #ifdef LP_USE_PAPI_ATTR
118 	char	*ppd;		/* printer's PPD file full path name */
119 #endif
120 	/*
121 	 * Adding new members to this structure? Check out
122 	 * cmd/lpadmin/do_printer.c, where we initialize
123 	 * each new printer structure.
124 	 */
125 }			PRINTER;
126 
127 #define BAN_ALWAYS	0x01	/* user can't override banner */
128 #define BAN_OFF		0x02	/* don't print banner page */
129 #define BAN_NEVER	BAN_OFF
130 #define BAN_OPTIONAL	(BAN_ALWAYS | BAN_NEVER) /* user can override banner */
131 
132 #define LOG_IN		0x01	/* printer is login terminal */
133 
134 #define PCK_TYPE	0x0001	/* printer type isn't in Terminfo */
135 #define PCK_CHARSET	0x0002	/* printer type can't handle ".char_sets" */
136 #define PCK_CPI		0x0004	/* printer type can't handle ".cpi" */
137 #define PCK_LPI		0x0008	/* printer type can't handle ".lpi" */
138 #define PCK_WIDTH	0x0010	/* printer type can't handle ".pwid" */
139 #define PCK_LENGTH	0x0020	/* printer type can't handle ".plen" */
140 #define PCK_PAPER	0x0040	/* printer type can't handle paper */
141 
142 /*
143  * The following PCK_... bits are only set by the Spooler,
144  * when refusing a request.
145  */
146 #define PCK_BANNER	0x1000	/* printer needs banner */
147 
148 /*
149  * Flags set by "putprinter()" for things that go wrong.
150  */
151 #define BAD_REMOTE	0x0001	/* has attributes of remote and local */
152 #define BAD_INTERFACE	0x0002	/* no interface or can't read it */
153 #define BAD_DEVDIAL	0x0004	/* no device or dial information */
154 #define BAD_FAULT	0x0008	/* not recognized fault recovery */
155 #define BAD_ALERT	0x0010	/* has reserved word for alert command */
156 #define BAD_ITYPES	0x0020	/* multiple printer AND input types */
157 #define BAD_PTYPES	0x0040	/* multiple printer types, incl unknown */
158 #define BAD_DAISY	0x0080	/* printer types don't agree on "daisy" */
159 
160 /*
161  * A comma separated list of STREAMS modules to be pushed on an
162  * opened port.
163  */
164 #define	DEFMODULES	"ldterm"
165 
166 /*
167  * For print wheels:
168  */
169 
170 typedef struct PWHEEL {
171 	char   *name;		/* name of print wheel */
172 	FALERT alert;		/* how to alert when mount needed */
173 }			PWHEEL;
174 
175 extern unsigned long	badprinter,
176 			ignprinter;
177 
178 /*
179  * Set if ppd file information is from the user rather than
180  * the configuration file.
181  */
182 extern int ppdopt;
183 
184 /**
185  ** Various routines.
186  **/
187 
188 PRINTER *	getprinter ( char * );
189 
190 PWHEEL *	getpwheel ( char * );
191 
192 char *		getdefault ( void );
193 
194 int		putprinter ( char *, PRINTER *);
195 int		delprinter ( char * );
196 int		putdefault ( char * );
197 int		deldefault ( void );
198 int		putpwheel ( char * , PWHEEL * );
199 int		delpwheel ( char * );
200 int		okprinter ( char * , PRINTER * , int );
201 
202 unsigned long	chkprinter (char *, char *, char *, char *, char *, char *);
203 
204 void		freeprinter ( PRINTER * );
205 void		freepwheel ( PWHEEL * );
206 
207 char *	getpentry(char *, int);
208 
209 /**
210  ** Aliases (copies) of some important Terminfo caps.
211  **/
212 
213 extern int		ti_daisy;
214 
215 #endif
216