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 50a44ef6dSjacobs * Common Development and Distribution License (the "License"). 60a44ef6dSjacobs * 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 /* 220a44ef6dSjacobs * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate typedef struct alert_node ALERT; 31*19d32b9aSRobert Mustacchi typedef struct cstat_node CLSTATUS; 327c478bd9Sstevel@tonic-gate typedef struct exec_node EXEC; 337c478bd9Sstevel@tonic-gate typedef struct form_node _FORM; 347c478bd9Sstevel@tonic-gate typedef struct fstat_node FSTATUS; 357c478bd9Sstevel@tonic-gate typedef struct pfstat_node PFSTATUS; 367c478bd9Sstevel@tonic-gate typedef struct pstat_node PSTATUS; 377c478bd9Sstevel@tonic-gate typedef struct pwstat_node PWSTATUS; 387c478bd9Sstevel@tonic-gate typedef struct rstat_node RSTATUS; 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate struct alert_node 417c478bd9Sstevel@tonic-gate { 427c478bd9Sstevel@tonic-gate short active; /* Non-zero if triggered */ 437c478bd9Sstevel@tonic-gate EXEC *exec; /* Index into EXEC table */ 447c478bd9Sstevel@tonic-gate char *msgfile; 457c478bd9Sstevel@tonic-gate }; 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate struct cstat_node 487c478bd9Sstevel@tonic-gate { 497c478bd9Sstevel@tonic-gate short status; 507c478bd9Sstevel@tonic-gate char *rej_reason; 517c478bd9Sstevel@tonic-gate time_t rej_date; 527c478bd9Sstevel@tonic-gate CLASS *class; 537c478bd9Sstevel@tonic-gate }; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate struct exec_node 567c478bd9Sstevel@tonic-gate { 577c478bd9Sstevel@tonic-gate int pid; /* process-id of exec */ 587c478bd9Sstevel@tonic-gate int status; /* low order bits from wait */ 597c478bd9Sstevel@tonic-gate long key; /* private key for security */ 607c478bd9Sstevel@tonic-gate short Errno; /* copy of child's errno */ 617c478bd9Sstevel@tonic-gate short type; /* type of exec, EX_... */ 627c478bd9Sstevel@tonic-gate ushort flags; /* flags, EXF_... */ 637c478bd9Sstevel@tonic-gate MESG *md; 647c478bd9Sstevel@tonic-gate union ex 657c478bd9Sstevel@tonic-gate { 667c478bd9Sstevel@tonic-gate RSTATUS *request; 677c478bd9Sstevel@tonic-gate FSTATUS *form; 687c478bd9Sstevel@tonic-gate PWSTATUS *pwheel; 697c478bd9Sstevel@tonic-gate PSTATUS *printer; 707c478bd9Sstevel@tonic-gate } ex; 717c478bd9Sstevel@tonic-gate }; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #define EX_INTERF 1 /* exec interface for ex.printer */ 747c478bd9Sstevel@tonic-gate #define EX_SLOWF 2 /* exec slow filter for ex.request */ 757c478bd9Sstevel@tonic-gate #define EX_ALERT 3 /* exec alert for ex.printer */ 767c478bd9Sstevel@tonic-gate #define EX_FALERT 4 /* exec alert for ex.form */ 777c478bd9Sstevel@tonic-gate #define EX_PALERT 5 /* exec alert for ex.pwheel */ 787c478bd9Sstevel@tonic-gate #define EX_NOTIFY 6 /* exec notification for ex.request */ 797c478bd9Sstevel@tonic-gate #define EX_FAULT_MESSAGE 7 /* exec fault message*/ 807c478bd9Sstevel@tonic-gate #define EX_FORM_MESSAGE 8 /* form fault message*/ 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define EXF_RESTART 0x0001 /* restart the exec */ 837c478bd9Sstevel@tonic-gate #define EXF_KILLED 0x0002 /* terminate() has killed the exec */ 847c478bd9Sstevel@tonic-gate #define EXF_GONE 0x0004 /* child has disappeared */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* 877c478bd9Sstevel@tonic-gate ** Possible values for FLT.type 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate #define FLT_FILES 1 /* remove alloc'd files */ 907c478bd9Sstevel@tonic-gate #define FLT_CHANGE 2 /* clear RS_CHANGING for .r1 */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate struct fstat_node 937c478bd9Sstevel@tonic-gate { 947c478bd9Sstevel@tonic-gate _FORM *form; 957c478bd9Sstevel@tonic-gate ALERT *alert; 967c478bd9Sstevel@tonic-gate short requests; /* Number of events thus far */ 977c478bd9Sstevel@tonic-gate short requests_last; /* # when alert last sent */ 987c478bd9Sstevel@tonic-gate short trigger; /* Trigger when this value */ 997c478bd9Sstevel@tonic-gate short mounted; /* # times currently mounted */ 1007c478bd9Sstevel@tonic-gate char **users_allowed; 1017c478bd9Sstevel@tonic-gate char **users_denied; 1027c478bd9Sstevel@tonic-gate char *cpi; 1037c478bd9Sstevel@tonic-gate char *lpi; 1047c478bd9Sstevel@tonic-gate char *plen; 1057c478bd9Sstevel@tonic-gate char *pwid; 1067c478bd9Sstevel@tonic-gate }; 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate struct pfstat_node 1097c478bd9Sstevel@tonic-gate { 1107c478bd9Sstevel@tonic-gate FSTATUS *form; 1117c478bd9Sstevel@tonic-gate short isAvailable; 1127c478bd9Sstevel@tonic-gate }; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate struct pstat_node 1157c478bd9Sstevel@tonic-gate { 1167c478bd9Sstevel@tonic-gate short status; /* Current Status of printer */ 1177c478bd9Sstevel@tonic-gate RSTATUS *request; 1187c478bd9Sstevel@tonic-gate PRINTER *printer; 1197c478bd9Sstevel@tonic-gate ALERT *alert; 1207c478bd9Sstevel@tonic-gate EXEC *exec; 1217c478bd9Sstevel@tonic-gate PFSTATUS *forms; 1227c478bd9Sstevel@tonic-gate char *pwheel_name; 1237c478bd9Sstevel@tonic-gate PWSTATUS *pwheel; 1247c478bd9Sstevel@tonic-gate char *dis_reason; 1257c478bd9Sstevel@tonic-gate char *rej_reason; 1267c478bd9Sstevel@tonic-gate char **users_allowed; 1277c478bd9Sstevel@tonic-gate char **users_denied; 1287c478bd9Sstevel@tonic-gate char **forms_allowed; 1297c478bd9Sstevel@tonic-gate char **forms_denied; 1307c478bd9Sstevel@tonic-gate char *cpi; 1317c478bd9Sstevel@tonic-gate char *lpi; 1327c478bd9Sstevel@tonic-gate char *plen; 1337c478bd9Sstevel@tonic-gate char *pwid; 1347c478bd9Sstevel@tonic-gate time_t dis_date; 1357c478bd9Sstevel@tonic-gate time_t rej_date; 1367c478bd9Sstevel@tonic-gate short last_dial_rc; /* last exit from dial() */ 1377c478bd9Sstevel@tonic-gate short nretry; /* number of dial attempts */ 1387c478bd9Sstevel@tonic-gate short nrequests; /* TEMP ONLY! (used variously) */ 1397c478bd9Sstevel@tonic-gate char *fault_reason; 1407c478bd9Sstevel@tonic-gate EXEC *fault_exec; 1417c478bd9Sstevel@tonic-gate short numForms; 1427c478bd9Sstevel@tonic-gate char **paper_allowed; 1437c478bd9Sstevel@tonic-gate }; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate struct pwstat_node 1467c478bd9Sstevel@tonic-gate { 1477c478bd9Sstevel@tonic-gate PWHEEL *pwheel; 1487c478bd9Sstevel@tonic-gate ALERT *alert; 1497c478bd9Sstevel@tonic-gate short requests; 1507c478bd9Sstevel@tonic-gate short requests_last; /* # when alert last sent */ 1517c478bd9Sstevel@tonic-gate short trigger; 1527c478bd9Sstevel@tonic-gate short mounted; 1537c478bd9Sstevel@tonic-gate }; 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #define send mputm 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate struct rstat_node 1587c478bd9Sstevel@tonic-gate { 1597c478bd9Sstevel@tonic-gate long status; 1607c478bd9Sstevel@tonic-gate MESG *md; 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate char *req_file; 1637c478bd9Sstevel@tonic-gate char *slow; 1647c478bd9Sstevel@tonic-gate char *fast; 1657c478bd9Sstevel@tonic-gate short copies; /* # copies interface is to make */ 1667c478bd9Sstevel@tonic-gate short reason; /* reason for failing _validate() */ 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate SECURE *secure; 1697c478bd9Sstevel@tonic-gate REQUEST *request; 1707c478bd9Sstevel@tonic-gate PSTATUS *printer; 1717c478bd9Sstevel@tonic-gate FSTATUS *form; 1727c478bd9Sstevel@tonic-gate char *pwheel_name; 1737c478bd9Sstevel@tonic-gate PWSTATUS *pwheel; 1747c478bd9Sstevel@tonic-gate EXEC *exec; /* Pointer to running filter or notify */ 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate char *printer_type; 1777c478bd9Sstevel@tonic-gate char *output_type; 1787c478bd9Sstevel@tonic-gate char *cpi; 1797c478bd9Sstevel@tonic-gate char *lpi; 1807c478bd9Sstevel@tonic-gate char *plen; 1817c478bd9Sstevel@tonic-gate char *pwid; 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate RSTATUS *next; 1847c478bd9Sstevel@tonic-gate RSTATUS *prev; 1857c478bd9Sstevel@tonic-gate short msgType; /* for getting status */ 1867c478bd9Sstevel@tonic-gate short trayNum; /* for mounting trays remotely */ 1877c478bd9Sstevel@tonic-gate char *formName; /* for mounting forms remotely */ 1887c478bd9Sstevel@tonic-gate }; 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate # define RSS_PWMAND 0x00000008 /* pwheel must be mounted */ 1917c478bd9Sstevel@tonic-gate # define RSS_SEND_FAULT_MESSAGE 0x00000040 /* need to send message*/ 1927c478bd9Sstevel@tonic-gate # define RSS_SEND_FORM_MESSAGE 0x00000080 /* need to send form message*/ 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate struct form_node 1957c478bd9Sstevel@tonic-gate { 1967c478bd9Sstevel@tonic-gate SCALED plen; 1977c478bd9Sstevel@tonic-gate SCALED pwid; 1987c478bd9Sstevel@tonic-gate SCALED lpi; 1997c478bd9Sstevel@tonic-gate SCALED cpi; 2007c478bd9Sstevel@tonic-gate int np; 2017c478bd9Sstevel@tonic-gate char *chset; 2027c478bd9Sstevel@tonic-gate short mandatory; 2037c478bd9Sstevel@tonic-gate char *rcolor; 2047c478bd9Sstevel@tonic-gate char *comment; 2057c478bd9Sstevel@tonic-gate char *conttype; 2067c478bd9Sstevel@tonic-gate char *name; 2077c478bd9Sstevel@tonic-gate FALERT alert; 2087c478bd9Sstevel@tonic-gate char *paper; 2097c478bd9Sstevel@tonic-gate short isDefault; 2107c478bd9Sstevel@tonic-gate }; 211