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