xref: /titanic_51/usr/src/cmd/lp/include/requests.h (revision a31148363f598def767ac48c5d82e1572e44b935)
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 #if	!defined(_LP_REQUESTS_H)
33 #define	_LP_REQUESTS_H
34 
35 /**
36  ** The disk copy of the request files:
37  **/
38 
39 /*
40  * There are 18 fields in the request file.
41  */
42 #define RQ_MAX	18
43 # define RQ_COPIES	0
44 # define RQ_DEST	1
45 # define RQ_FILE	2
46 # define RQ_FORM	3
47 # define RQ_HANDL	4
48 # define RQ_NOTIFY	5
49 # define RQ_OPTS	6
50 # define RQ_PRIOR	7
51 # define RQ_PAGES	8
52 # define RQ_CHARS	9
53 # define RQ_TITLE	10
54 # define RQ_MODES	11
55 # define RQ_TYPE	12
56 # define RQ_USER	13
57 # define RQ_RAW		14
58 # define RQ_FAST	15
59 # define RQ_STAT	16
60 
61 /**
62  ** The internal copy of a request as seen by the rest of the world:
63  **/
64 
65 /*
66  * A (char **) list is an array of string pointers (char *) with
67  * a null pointer after the last item.
68  */
69 typedef struct REQUEST {
70 	short  copies;        /* number of copies of request to print */
71 	char   *destination;  /* printer or class name */
72 	char   **file_list;   /* list of files to print: req. content */
73 	char   *form;         /* preprinted form to print on */
74 	ushort actions;       /* mail/write, immediate/hold/resume, raw */
75 	char   *alert;        /* program to run to alert user when done */
76 	char   *options;      /* print options; space separated list */
77 	short  priority;      /* priority level, 0-39, of the request */
78 	char   *pages;        /* list of pages to print (uniq. please!) */
79 	char   *charset;      /* character set to select or mount */
80 	char   *modes;        /* mode(s) of operation; space sep. list */
81 	char   *title;        /* optional title for banner page */
82 	char   *input_type;   /* type of content */
83 	char   *user;         /* user name of person submitting */
84 	ushort outcome;       /* success/fauilure */
85 }			REQUEST;
86 
87 
88 /*
89  * Bit flags for the "actions" member:
90  */
91 #define ACT_MAIL	0x0001	/* send mail when finished printing */
92 #define ACT_WRITE	0x0002	/* write to the terminal when finished */
93 #define	ACT_NOTIFY	0x0004	/* tell the remote that this is done */
94 #define ACT_IMMEDIATE	0x0010	/* print immediately */
95 #define ACT_HOLD	0x0020	/* don't print until resumed */
96 #define ACT_RESUME	0x0030	/* resume a held request */
97 #define ACT_SPECIAL	0x0030	/* bit mask of immediate/hold/resume */
98 #define ACT_RAW		0x0100	/* don't filter the input */
99 
100 /*
101  * Currently, the following is used only for alignment patterns:
102  */
103 #define ACT_FAST	0x8000	/* force all filters to be fast */
104 
105 
106 /*
107  * Bit flags for the "outcome" member:
108  */
109 #define RS_HELD		0x0001	/* held pending resume */
110 #define RS_FILTERING	0x0002	/* slow filter is running */
111 #define RS_FILTERED	0x0004	/* slow filter has finished running */
112 #define RS_PRINTING	0x0008	/* on printer */
113 #define RS_PRINTED	0x0010	/* has finished printing */
114 #define RS_CHANGING	0x0020	/* request held pending user change */
115 #define RS_CANCELLED	0x0040	/* request was cancelled */
116 #define RS_IMMEDIATE	0x0080	/* should be next to print */
117 #define RS_FAILED	0x0100	/* slow filter or interface failed */
118 #define RS_NOTIFY	0x0400	/* user is to be notified (alert) */
119 #define RS_NOTIFYING	0x0800	/* notification (alert) is running */
120 #define RS_ADMINHELD	0x2000	/* administrator placed RS_HELD */
121 #define RS_REFILTER	0x4000	/* had to change filters */
122 #define RS_STOPPED	0x8000	/* temporarily stopped the request */
123 
124 /*
125  * Some bit combinations, for convenience and consistency:
126  *
127  *	RS_DONE		request is finished printing or was cancelled
128  *	RS_ACTIVE	request is being handled, can be skipped
129  */
130 #define RS_DONE	       (RS_CANCELLED|RS_PRINTED|RS_FAILED)
131 #define RS_ACTIVE      (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING)
132 
133 /**
134  ** Various routines.
135  **/
136 
137 REQUEST *		getrequest ( char * );
138 int			putrequest ( char *, REQUEST * );
139 void			freerequest ( REQUEST * );
140 
141 #endif
142