xref: /titanic_50/usr/src/cmd/lp/include/requests.h (revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0a44ef6dSjacobs  * Common Development and Distribution License (the "License").
6*0a44ef6dSjacobs  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*0a44ef6dSjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
30*0a44ef6dSjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #if	!defined(_LP_REQUESTS_H)
337c478bd9Sstevel@tonic-gate #define	_LP_REQUESTS_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /**
367c478bd9Sstevel@tonic-gate  ** The disk copy of the request files:
377c478bd9Sstevel@tonic-gate  **/
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * There are 18 fields in the request file.
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate #define RQ_MAX	18
437c478bd9Sstevel@tonic-gate # define RQ_COPIES	0
447c478bd9Sstevel@tonic-gate # define RQ_DEST	1
457c478bd9Sstevel@tonic-gate # define RQ_FILE	2
467c478bd9Sstevel@tonic-gate # define RQ_FORM	3
477c478bd9Sstevel@tonic-gate # define RQ_HANDL	4
487c478bd9Sstevel@tonic-gate # define RQ_NOTIFY	5
497c478bd9Sstevel@tonic-gate # define RQ_OPTS	6
507c478bd9Sstevel@tonic-gate # define RQ_PRIOR	7
517c478bd9Sstevel@tonic-gate # define RQ_PAGES	8
527c478bd9Sstevel@tonic-gate # define RQ_CHARS	9
537c478bd9Sstevel@tonic-gate # define RQ_TITLE	10
547c478bd9Sstevel@tonic-gate # define RQ_MODES	11
557c478bd9Sstevel@tonic-gate # define RQ_TYPE	12
567c478bd9Sstevel@tonic-gate # define RQ_USER	13
577c478bd9Sstevel@tonic-gate # define RQ_RAW		14
587c478bd9Sstevel@tonic-gate # define RQ_FAST	15
597c478bd9Sstevel@tonic-gate # define RQ_STAT	16
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /**
627c478bd9Sstevel@tonic-gate  ** The internal copy of a request as seen by the rest of the world:
637c478bd9Sstevel@tonic-gate  **/
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * A (char **) list is an array of string pointers (char *) with
677c478bd9Sstevel@tonic-gate  * a null pointer after the last item.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate typedef struct REQUEST {
707c478bd9Sstevel@tonic-gate 	short  copies;        /* number of copies of request to print */
717c478bd9Sstevel@tonic-gate 	char   *destination;  /* printer or class name */
727c478bd9Sstevel@tonic-gate 	char   **file_list;   /* list of files to print: req. content */
737c478bd9Sstevel@tonic-gate 	char   *form;         /* preprinted form to print on */
747c478bd9Sstevel@tonic-gate 	ushort actions;       /* mail/write, immediate/hold/resume, raw */
757c478bd9Sstevel@tonic-gate 	char   *alert;        /* program to run to alert user when done */
767c478bd9Sstevel@tonic-gate 	char   *options;      /* print options; space separated list */
777c478bd9Sstevel@tonic-gate 	short  priority;      /* priority level, 0-39, of the request */
787c478bd9Sstevel@tonic-gate 	char   *pages;        /* list of pages to print (uniq. please!) */
797c478bd9Sstevel@tonic-gate 	char   *charset;      /* character set to select or mount */
807c478bd9Sstevel@tonic-gate 	char   *modes;        /* mode(s) of operation; space sep. list */
817c478bd9Sstevel@tonic-gate 	char   *title;        /* optional title for banner page */
827c478bd9Sstevel@tonic-gate 	char   *input_type;   /* type of content */
837c478bd9Sstevel@tonic-gate 	char   *user;         /* user name of person submitting */
847c478bd9Sstevel@tonic-gate 	ushort outcome;       /* success/fauilure */
857c478bd9Sstevel@tonic-gate }			REQUEST;
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  * Bit flags for the "actions" member:
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate #define ACT_MAIL	0x0001	/* send mail when finished printing */
927c478bd9Sstevel@tonic-gate #define ACT_WRITE	0x0002	/* write to the terminal when finished */
937c478bd9Sstevel@tonic-gate #define	ACT_NOTIFY	0x0004	/* tell the remote that this is done */
947c478bd9Sstevel@tonic-gate #define ACT_IMMEDIATE	0x0010	/* print immediately */
957c478bd9Sstevel@tonic-gate #define ACT_HOLD	0x0020	/* don't print until resumed */
967c478bd9Sstevel@tonic-gate #define ACT_RESUME	0x0030	/* resume a held request */
977c478bd9Sstevel@tonic-gate #define ACT_SPECIAL	0x0030	/* bit mask of immediate/hold/resume */
987c478bd9Sstevel@tonic-gate #define ACT_RAW		0x0100	/* don't filter the input */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * Currently, the following is used only for alignment patterns:
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate #define ACT_FAST	0x8000	/* force all filters to be fast */
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
1077c478bd9Sstevel@tonic-gate  * Bit flags for the "outcome" member:
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate #define RS_HELD		0x0001	/* held pending resume */
1107c478bd9Sstevel@tonic-gate #define RS_FILTERING	0x0002	/* slow filter is running */
1117c478bd9Sstevel@tonic-gate #define RS_FILTERED	0x0004	/* slow filter has finished running */
1127c478bd9Sstevel@tonic-gate #define RS_PRINTING	0x0008	/* on printer */
1137c478bd9Sstevel@tonic-gate #define RS_PRINTED	0x0010	/* has finished printing */
1147c478bd9Sstevel@tonic-gate #define RS_CHANGING	0x0020	/* request held pending user change */
1157c478bd9Sstevel@tonic-gate #define RS_CANCELLED	0x0040	/* request was cancelled */
1167c478bd9Sstevel@tonic-gate #define RS_IMMEDIATE	0x0080	/* should be next to print */
1177c478bd9Sstevel@tonic-gate #define RS_FAILED	0x0100	/* slow filter or interface failed */
1187c478bd9Sstevel@tonic-gate #define RS_NOTIFY	0x0400	/* user is to be notified (alert) */
1197c478bd9Sstevel@tonic-gate #define RS_NOTIFYING	0x0800	/* notification (alert) is running */
1207c478bd9Sstevel@tonic-gate #define RS_ADMINHELD	0x2000	/* administrator placed RS_HELD */
1217c478bd9Sstevel@tonic-gate #define RS_REFILTER	0x4000	/* had to change filters */
1227c478bd9Sstevel@tonic-gate #define RS_STOPPED	0x8000	/* temporarily stopped the request */
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate /*
1257c478bd9Sstevel@tonic-gate  * Some bit combinations, for convenience and consistency:
1267c478bd9Sstevel@tonic-gate  *
1277c478bd9Sstevel@tonic-gate  *	RS_DONE		request is finished printing or was cancelled
1287c478bd9Sstevel@tonic-gate  *	RS_ACTIVE	request is being handled, can be skipped
1297c478bd9Sstevel@tonic-gate  */
1307c478bd9Sstevel@tonic-gate #define RS_DONE	       (RS_CANCELLED|RS_PRINTED|RS_FAILED)
1317c478bd9Sstevel@tonic-gate #define RS_ACTIVE      (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING)
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /**
1347c478bd9Sstevel@tonic-gate  ** Various routines.
1357c478bd9Sstevel@tonic-gate  **/
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate REQUEST *		getrequest ( char * );
1387c478bd9Sstevel@tonic-gate int			putrequest ( char *, REQUEST * );
1397c478bd9Sstevel@tonic-gate void			freerequest ( REQUEST * );
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #endif
142