xref: /illumos-gate/usr/src/cmd/lp/include/requests.h (revision 7aec1d6e)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.13	*/
32 
33 #if	!defined(_LP_REQUESTS_H)
34 #define	_LP_REQUESTS_H
35 
36 /**
37  ** The disk copy of the request files:
38  **/
39 
40 /*
41  * There are 18 fields in the request file.
42  */
43 #define RQ_MAX	18
44 # define RQ_COPIES	0
45 # define RQ_DEST	1
46 # define RQ_FILE	2
47 # define RQ_FORM	3
48 # define RQ_HANDL	4
49 # define RQ_NOTIFY	5
50 # define RQ_OPTS	6
51 # define RQ_PRIOR	7
52 # define RQ_PAGES	8
53 # define RQ_CHARS	9
54 # define RQ_TITLE	10
55 # define RQ_MODES	11
56 # define RQ_TYPE	12
57 # define RQ_USER	13
58 # define RQ_RAW		14
59 # define RQ_FAST	15
60 # define RQ_STAT	16
61 # define RQ_VERSION	17
62 
63 /**
64  ** The internal copy of a request as seen by the rest of the world:
65  **/
66 
67 /*
68  * A (char **) list is an array of string pointers (char *) with
69  * a null pointer after the last item.
70  */
71 typedef struct REQUEST {
72 	short  copies;        /* number of copies of request to print */
73 	char   *destination;  /* printer or class name */
74 	char   **file_list;   /* list of files to print: req. content */
75 	char   *form;         /* preprinted form to print on */
76 	ushort actions;       /* mail/write, immediate/hold/resume, raw */
77 	char   *alert;        /* program to run to alert user when done */
78 	char   *options;      /* print options; space separated list */
79 	short  priority;      /* priority level, 0-39, of the request */
80 	char   *pages;        /* list of pages to print (uniq. please!) */
81 	char   *charset;      /* character set to select or mount */
82 	char   *modes;        /* mode(s) of operation; space sep. list */
83 	char   *title;        /* optional title for banner page */
84 	char   *input_type;   /* type of content */
85 	char   *user;         /* user name of person submitting */
86 	ushort outcome;       /* success/fauilure */
87 	ushort  version;      /* version of system sending job*/
88 }			REQUEST;
89 
90 #define BSD_FORM "=bsdForm=" /* form name given to jobs from bsd */
91 #define VERSION_BSD 0
92 #define VERSION_OLD_LP 1
93 #define VERSION_NEW_LP 2
94 
95 /*
96  * Bit flags for the "actions" member:
97  */
98 #define ACT_MAIL	0x0001	/* send mail when finished printing */
99 #define ACT_WRITE	0x0002	/* write to the terminal when finished */
100 #define	ACT_NOTIFY	0x0004	/* tell the remote that this is done */
101 #define ACT_IMMEDIATE	0x0010	/* print immediately */
102 #define ACT_HOLD	0x0020	/* don't print until resumed */
103 #define ACT_RESUME	0x0030	/* resume a held request */
104 #define ACT_SPECIAL	0x0030	/* bit mask of immediate/hold/resume */
105 #define ACT_RAW		0x0100	/* don't filter the input */
106 
107 /*
108  * Currently, the following is used only for alignment patterns:
109  */
110 #define ACT_FAST	0x8000	/* force all filters to be fast */
111 
112 
113 /*
114  * Bit flags for the "outcome" member:
115  */
116 #define RS_HELD		0x0001	/* held pending resume */
117 #define RS_FILTERING	0x0002	/* slow filter is running */
118 #define RS_FILTERED	0x0004	/* slow filter has finished running */
119 #define RS_PRINTING	0x0008	/* on printer */
120 #define RS_PRINTED	0x0010	/* has finished printing */
121 #define RS_CHANGING	0x0020	/* request held pending user change */
122 #define RS_CANCELLED	0x0040	/* request was cancelled */
123 #define RS_IMMEDIATE	0x0080	/* should be next to print */
124 #define RS_FAILED	0x0100	/* slow filter or interface failed */
125 #define RS_SENDING	0x0200	/* Request is in transit to a remote */
126 #define RS_NOTIFY	0x0400	/* user is to be notified (alert) */
127 #define RS_NOTIFYING	0x0800	/* notification (alert) is running */
128 #define	RS_SENT		0x1000	/* Request accepted on remote system */
129 #define RS_ADMINHELD	0x2000	/* administrator placed RS_HELD */
130 #define RS_REFILTER	0x4000	/* had to change filters */
131 #define RS_STOPPED	0x8000	/* temporarily stopped the request */
132 
133 /*
134  * Some bit combinations, for convenience and consistency:
135  *
136  *	RS_DONE		request is finished printing or was cancelled
137  *	RS_ACTIVE	request is being handled, can be skipped
138  *	RS_GONEREMOTE	request is being or has been sent to remote
139  */
140 #define RS_DONE	       (RS_CANCELLED|RS_PRINTED|RS_FAILED)
141 #define RS_ACTIVE      (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING)
142 #define RS_GONEREMOTE  (RS_SENT|RS_SENDING)
143 
144 /**
145  ** Various routines.
146  **/
147 
148 REQUEST *		getrequest ( char * );
149 int			putrequest ( char *, REQUEST * );
150 void			freerequest ( REQUEST * );
151 
152 #endif
153