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