10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3125Sjacobs * Common Development and Distribution License (the "License"). 6*3125Sjacobs * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3125Sjacobs * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate 30*3125Sjacobs #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #if !defined(_LP_REQUESTS_H) 330Sstevel@tonic-gate #define _LP_REQUESTS_H 340Sstevel@tonic-gate 350Sstevel@tonic-gate /** 360Sstevel@tonic-gate ** The disk copy of the request files: 370Sstevel@tonic-gate **/ 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * There are 18 fields in the request file. 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate #define RQ_MAX 18 430Sstevel@tonic-gate # define RQ_COPIES 0 440Sstevel@tonic-gate # define RQ_DEST 1 450Sstevel@tonic-gate # define RQ_FILE 2 460Sstevel@tonic-gate # define RQ_FORM 3 470Sstevel@tonic-gate # define RQ_HANDL 4 480Sstevel@tonic-gate # define RQ_NOTIFY 5 490Sstevel@tonic-gate # define RQ_OPTS 6 500Sstevel@tonic-gate # define RQ_PRIOR 7 510Sstevel@tonic-gate # define RQ_PAGES 8 520Sstevel@tonic-gate # define RQ_CHARS 9 530Sstevel@tonic-gate # define RQ_TITLE 10 540Sstevel@tonic-gate # define RQ_MODES 11 550Sstevel@tonic-gate # define RQ_TYPE 12 560Sstevel@tonic-gate # define RQ_USER 13 570Sstevel@tonic-gate # define RQ_RAW 14 580Sstevel@tonic-gate # define RQ_FAST 15 590Sstevel@tonic-gate # define RQ_STAT 16 600Sstevel@tonic-gate 610Sstevel@tonic-gate /** 620Sstevel@tonic-gate ** The internal copy of a request as seen by the rest of the world: 630Sstevel@tonic-gate **/ 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * A (char **) list is an array of string pointers (char *) with 670Sstevel@tonic-gate * a null pointer after the last item. 680Sstevel@tonic-gate */ 690Sstevel@tonic-gate typedef struct REQUEST { 700Sstevel@tonic-gate short copies; /* number of copies of request to print */ 710Sstevel@tonic-gate char *destination; /* printer or class name */ 720Sstevel@tonic-gate char **file_list; /* list of files to print: req. content */ 730Sstevel@tonic-gate char *form; /* preprinted form to print on */ 740Sstevel@tonic-gate ushort actions; /* mail/write, immediate/hold/resume, raw */ 750Sstevel@tonic-gate char *alert; /* program to run to alert user when done */ 760Sstevel@tonic-gate char *options; /* print options; space separated list */ 770Sstevel@tonic-gate short priority; /* priority level, 0-39, of the request */ 780Sstevel@tonic-gate char *pages; /* list of pages to print (uniq. please!) */ 790Sstevel@tonic-gate char *charset; /* character set to select or mount */ 800Sstevel@tonic-gate char *modes; /* mode(s) of operation; space sep. list */ 810Sstevel@tonic-gate char *title; /* optional title for banner page */ 820Sstevel@tonic-gate char *input_type; /* type of content */ 830Sstevel@tonic-gate char *user; /* user name of person submitting */ 840Sstevel@tonic-gate ushort outcome; /* success/fauilure */ 850Sstevel@tonic-gate } REQUEST; 860Sstevel@tonic-gate 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* 890Sstevel@tonic-gate * Bit flags for the "actions" member: 900Sstevel@tonic-gate */ 910Sstevel@tonic-gate #define ACT_MAIL 0x0001 /* send mail when finished printing */ 920Sstevel@tonic-gate #define ACT_WRITE 0x0002 /* write to the terminal when finished */ 930Sstevel@tonic-gate #define ACT_NOTIFY 0x0004 /* tell the remote that this is done */ 940Sstevel@tonic-gate #define ACT_IMMEDIATE 0x0010 /* print immediately */ 950Sstevel@tonic-gate #define ACT_HOLD 0x0020 /* don't print until resumed */ 960Sstevel@tonic-gate #define ACT_RESUME 0x0030 /* resume a held request */ 970Sstevel@tonic-gate #define ACT_SPECIAL 0x0030 /* bit mask of immediate/hold/resume */ 980Sstevel@tonic-gate #define ACT_RAW 0x0100 /* don't filter the input */ 990Sstevel@tonic-gate 1000Sstevel@tonic-gate /* 1010Sstevel@tonic-gate * Currently, the following is used only for alignment patterns: 1020Sstevel@tonic-gate */ 1030Sstevel@tonic-gate #define ACT_FAST 0x8000 /* force all filters to be fast */ 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate /* 1070Sstevel@tonic-gate * Bit flags for the "outcome" member: 1080Sstevel@tonic-gate */ 1090Sstevel@tonic-gate #define RS_HELD 0x0001 /* held pending resume */ 1100Sstevel@tonic-gate #define RS_FILTERING 0x0002 /* slow filter is running */ 1110Sstevel@tonic-gate #define RS_FILTERED 0x0004 /* slow filter has finished running */ 1120Sstevel@tonic-gate #define RS_PRINTING 0x0008 /* on printer */ 1130Sstevel@tonic-gate #define RS_PRINTED 0x0010 /* has finished printing */ 1140Sstevel@tonic-gate #define RS_CHANGING 0x0020 /* request held pending user change */ 1150Sstevel@tonic-gate #define RS_CANCELLED 0x0040 /* request was cancelled */ 1160Sstevel@tonic-gate #define RS_IMMEDIATE 0x0080 /* should be next to print */ 1170Sstevel@tonic-gate #define RS_FAILED 0x0100 /* slow filter or interface failed */ 1180Sstevel@tonic-gate #define RS_NOTIFY 0x0400 /* user is to be notified (alert) */ 1190Sstevel@tonic-gate #define RS_NOTIFYING 0x0800 /* notification (alert) is running */ 1200Sstevel@tonic-gate #define RS_ADMINHELD 0x2000 /* administrator placed RS_HELD */ 1210Sstevel@tonic-gate #define RS_REFILTER 0x4000 /* had to change filters */ 1220Sstevel@tonic-gate #define RS_STOPPED 0x8000 /* temporarily stopped the request */ 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * Some bit combinations, for convenience and consistency: 1260Sstevel@tonic-gate * 1270Sstevel@tonic-gate * RS_DONE request is finished printing or was cancelled 1280Sstevel@tonic-gate * RS_ACTIVE request is being handled, can be skipped 1290Sstevel@tonic-gate */ 1300Sstevel@tonic-gate #define RS_DONE (RS_CANCELLED|RS_PRINTED|RS_FAILED) 1310Sstevel@tonic-gate #define RS_ACTIVE (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING) 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate /** 1340Sstevel@tonic-gate ** Various routines. 1350Sstevel@tonic-gate **/ 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate REQUEST * getrequest ( char * ); 1380Sstevel@tonic-gate int putrequest ( char *, REQUEST * ); 1390Sstevel@tonic-gate void freerequest ( REQUEST * ); 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate #endif 142