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