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