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