xref: /illumos-gate/usr/src/cmd/lp/cmd/lpsched/nodes.h (revision cb159270e9e67dea31dfbd991ec758829de14d35)
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 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 typedef struct alert_node	ALERT;
31 typedef struct cstat_node	CLSTATUS;
32 typedef struct exec_node	EXEC;
33 typedef struct form_node	_FORM;
34 typedef struct fstat_node	FSTATUS;
35 typedef struct pfstat_node	PFSTATUS;
36 typedef struct pstat_node	PSTATUS;
37 typedef struct pwstat_node	PWSTATUS;
38 typedef struct rstat_node	RSTATUS;
39 
40 struct alert_node
41 {
42     short	active;			/* Non-zero if triggered     */
43     EXEC	*exec;			/* Index into EXEC table     */
44     char	*msgfile;
45 };
46 
47 struct cstat_node
48 {
49     short	status;
50     char	*rej_reason;
51     time_t	rej_date;
52     CLASS	*class;
53 };
54 
55 struct exec_node
56 {
57     int		pid;			/* process-id of exec		*/
58     int		status;			/* low order bits from wait	*/
59     long	key;			/* private key for security	*/
60     short	Errno;			/* copy of child's errno	*/
61     short	type;			/* type of exec, EX_...		*/
62     ushort	flags;			/* flags, EXF_...		*/
63     MESG	*md;
64     union ex
65     {
66 	RSTATUS		*request;
67 	FSTATUS		*form;
68 	PWSTATUS	*pwheel;
69 	PSTATUS		*printer;
70     } ex;
71 };
72 
73 #define	EX_INTERF	1	/* exec interface for ex.printer	*/
74 #define	EX_SLOWF	2	/* exec slow filter for ex.request	*/
75 #define	EX_ALERT	3	/* exec alert for ex.printer		*/
76 #define	EX_FALERT	4	/* exec alert for ex.form		*/
77 #define	EX_PALERT	5	/* exec alert for ex.pwheel		*/
78 #define	EX_NOTIFY	6	/* exec notification for ex.request	*/
79 #define	EX_FAULT_MESSAGE 7	/* exec fault message*/
80 #define	EX_FORM_MESSAGE	8	/* form fault message*/
81 
82 #define	EXF_RESTART	0x0001	/* restart the exec			*/
83 #define	EXF_KILLED	0x0002	/* terminate() has killed the exec	*/
84 #define	EXF_GONE	0x0004	/* child has disappeared		*/
85 
86 /*
87 **	Possible values for FLT.type
88 */
89 #define        FLT_FILES       1	/* remove alloc'd files		*/
90 #define        FLT_CHANGE      2	/* clear RS_CHANGING for .r1	*/
91 
92 struct fstat_node
93 {
94     _FORM	*form;
95     ALERT	*alert;
96     short	requests;		/* Number of events thus far */
97     short	requests_last;		/* # when alert last sent */
98     short	trigger;		/* Trigger when this value   */
99     short	mounted;		/* # times currently mounted */
100     char	**users_allowed;
101     char	**users_denied;
102     char	*cpi;
103     char	*lpi;
104     char	*plen;
105     char	*pwid;
106 };
107 
108 struct pfstat_node
109 {
110 	FSTATUS	*form;
111 	short isAvailable;
112 };
113 
114 struct pstat_node
115 {
116     short	status;			/* Current Status of printer */
117     RSTATUS	*request;
118     PRINTER	*printer;
119     ALERT	*alert;
120     EXEC	*exec;
121     PFSTATUS	*forms;
122     char	*pwheel_name;
123     PWSTATUS	*pwheel;
124     char	*dis_reason;
125     char	*rej_reason;
126     char	**users_allowed;
127     char	**users_denied;
128     char	**forms_allowed;
129     char	**forms_denied;
130     char	*cpi;
131     char	*lpi;
132     char	*plen;
133     char	*pwid;
134     time_t	dis_date;
135     time_t	rej_date;
136     short	last_dial_rc;		/* last exit from dial() */
137     short	nretry;			/* number of dial attempts */
138     short	nrequests;		/* TEMP ONLY! (used variously) */
139     char	*fault_reason;
140     EXEC	*fault_exec;
141     short	numForms;
142     char	**paper_allowed;
143 };
144 
145 struct pwstat_node
146 {
147     PWHEEL	*pwheel;
148     ALERT	*alert;
149     short	requests;
150     short	requests_last;		/* # when alert last sent */
151     short	trigger;
152     short	mounted;
153 };
154 
155 #define send		mputm
156 
157 struct rstat_node
158 {
159     long	status;
160     MESG	*md;
161 
162     char	*req_file;
163     char	*slow;
164     char	*fast;
165     short	copies;		/* # copies interface is to make */
166     short	reason;		/* reason for failing _validate() */
167 
168     SECURE	*secure;
169     REQUEST	*request;
170     PSTATUS	*printer;
171     FSTATUS	*form;
172     char	*pwheel_name;
173     PWSTATUS	*pwheel;
174     EXEC	*exec;		/* Pointer to running filter or notify */
175 
176     char	*printer_type;
177     char	*output_type;
178     char	*cpi;
179     char	*lpi;
180     char	*plen;
181     char	*pwid;
182 
183     RSTATUS	*next;
184     RSTATUS	*prev;
185     short	msgType; /* for getting status */
186     short	trayNum; /* for mounting trays remotely */
187     char	*formName; /* for mounting forms remotely */
188 };
189 
190 # define	RSS_PWMAND	0x00000008 /* pwheel must be mounted */
191 # define	RSS_SEND_FAULT_MESSAGE	0x00000040 /* need to send message*/
192 # define	RSS_SEND_FORM_MESSAGE	0x00000080 /* need to send form message*/
193 
194 struct form_node
195 {
196     SCALED	plen;
197     SCALED	pwid;
198     SCALED	lpi;
199     SCALED	cpi;
200     int	np;
201     char	*chset;
202     short	mandatory;
203     char	*rcolor;
204     char	*comment;
205     char	*conttype;
206     char	*name;
207     FALERT	alert;
208     char	*paper;
209     short	isDefault;
210 };
211