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