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 #if !defined(_LP_REQUESTS_H) 307c478bd9Sstevel@tonic-gate #define _LP_REQUESTS_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /** 337c478bd9Sstevel@tonic-gate ** The disk copy of the request files: 347c478bd9Sstevel@tonic-gate **/ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * There are 18 fields in the request file. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate #define RQ_MAX 18 407c478bd9Sstevel@tonic-gate # define RQ_COPIES 0 417c478bd9Sstevel@tonic-gate # define RQ_DEST 1 427c478bd9Sstevel@tonic-gate # define RQ_FILE 2 437c478bd9Sstevel@tonic-gate # define RQ_FORM 3 447c478bd9Sstevel@tonic-gate # define RQ_HANDL 4 457c478bd9Sstevel@tonic-gate # define RQ_NOTIFY 5 467c478bd9Sstevel@tonic-gate # define RQ_OPTS 6 477c478bd9Sstevel@tonic-gate # define RQ_PRIOR 7 487c478bd9Sstevel@tonic-gate # define RQ_PAGES 8 497c478bd9Sstevel@tonic-gate # define RQ_CHARS 9 507c478bd9Sstevel@tonic-gate # define RQ_TITLE 10 517c478bd9Sstevel@tonic-gate # define RQ_MODES 11 527c478bd9Sstevel@tonic-gate # define RQ_TYPE 12 537c478bd9Sstevel@tonic-gate # define RQ_USER 13 547c478bd9Sstevel@tonic-gate # define RQ_RAW 14 557c478bd9Sstevel@tonic-gate # define RQ_FAST 15 567c478bd9Sstevel@tonic-gate # define RQ_STAT 16 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /** 597c478bd9Sstevel@tonic-gate ** The internal copy of a request as seen by the rest of the world: 607c478bd9Sstevel@tonic-gate **/ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * A (char **) list is an array of string pointers (char *) with 647c478bd9Sstevel@tonic-gate * a null pointer after the last item. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate typedef struct REQUEST { 677c478bd9Sstevel@tonic-gate short copies; /* number of copies of request to print */ 687c478bd9Sstevel@tonic-gate char *destination; /* printer or class name */ 697c478bd9Sstevel@tonic-gate char **file_list; /* list of files to print: req. content */ 707c478bd9Sstevel@tonic-gate char *form; /* preprinted form to print on */ 717c478bd9Sstevel@tonic-gate ushort actions; /* mail/write, immediate/hold/resume, raw */ 727c478bd9Sstevel@tonic-gate char *alert; /* program to run to alert user when done */ 737c478bd9Sstevel@tonic-gate char *options; /* print options; space separated list */ 747c478bd9Sstevel@tonic-gate short priority; /* priority level, 0-39, of the request */ 757c478bd9Sstevel@tonic-gate char *pages; /* list of pages to print (uniq. please!) */ 767c478bd9Sstevel@tonic-gate char *charset; /* character set to select or mount */ 777c478bd9Sstevel@tonic-gate char *modes; /* mode(s) of operation; space sep. list */ 787c478bd9Sstevel@tonic-gate char *title; /* optional title for banner page */ 797c478bd9Sstevel@tonic-gate char *input_type; /* type of content */ 807c478bd9Sstevel@tonic-gate char *user; /* user name of person submitting */ 817c478bd9Sstevel@tonic-gate ushort outcome; /* success/fauilure */ 827c478bd9Sstevel@tonic-gate } REQUEST; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * Bit flags for the "actions" member: 877c478bd9Sstevel@tonic-gate */ 887c478bd9Sstevel@tonic-gate #define ACT_MAIL 0x0001 /* send mail when finished printing */ 897c478bd9Sstevel@tonic-gate #define ACT_WRITE 0x0002 /* write to the terminal when finished */ 907c478bd9Sstevel@tonic-gate #define ACT_NOTIFY 0x0004 /* tell the remote that this is done */ 917c478bd9Sstevel@tonic-gate #define ACT_IMMEDIATE 0x0010 /* print immediately */ 927c478bd9Sstevel@tonic-gate #define ACT_HOLD 0x0020 /* don't print until resumed */ 937c478bd9Sstevel@tonic-gate #define ACT_RESUME 0x0030 /* resume a held request */ 947c478bd9Sstevel@tonic-gate #define ACT_SPECIAL 0x0030 /* bit mask of immediate/hold/resume */ 957c478bd9Sstevel@tonic-gate #define ACT_RAW 0x0100 /* don't filter the input */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * Currently, the following is used only for alignment patterns: 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate #define ACT_FAST 0x8000 /* force all filters to be fast */ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* 1047c478bd9Sstevel@tonic-gate * Bit flags for the "outcome" member: 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate #define RS_HELD 0x0001 /* held pending resume */ 1077c478bd9Sstevel@tonic-gate #define RS_FILTERING 0x0002 /* slow filter is running */ 1087c478bd9Sstevel@tonic-gate #define RS_FILTERED 0x0004 /* slow filter has finished running */ 1097c478bd9Sstevel@tonic-gate #define RS_PRINTING 0x0008 /* on printer */ 1107c478bd9Sstevel@tonic-gate #define RS_PRINTED 0x0010 /* has finished printing */ 1117c478bd9Sstevel@tonic-gate #define RS_CHANGING 0x0020 /* request held pending user change */ 1127c478bd9Sstevel@tonic-gate #define RS_CANCELLED 0x0040 /* request was cancelled */ 1137c478bd9Sstevel@tonic-gate #define RS_IMMEDIATE 0x0080 /* should be next to print */ 1147c478bd9Sstevel@tonic-gate #define RS_FAILED 0x0100 /* slow filter or interface failed */ 1157c478bd9Sstevel@tonic-gate #define RS_NOTIFY 0x0400 /* user is to be notified (alert) */ 1167c478bd9Sstevel@tonic-gate #define RS_NOTIFYING 0x0800 /* notification (alert) is running */ 1177c478bd9Sstevel@tonic-gate #define RS_ADMINHELD 0x2000 /* administrator placed RS_HELD */ 1187c478bd9Sstevel@tonic-gate #define RS_REFILTER 0x4000 /* had to change filters */ 1197c478bd9Sstevel@tonic-gate #define RS_STOPPED 0x8000 /* temporarily stopped the request */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * Some bit combinations, for convenience and consistency: 1237c478bd9Sstevel@tonic-gate * 1247c478bd9Sstevel@tonic-gate * RS_DONE request is finished printing or was cancelled 1257c478bd9Sstevel@tonic-gate * RS_ACTIVE request is being handled, can be skipped 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate #define RS_DONE (RS_CANCELLED|RS_PRINTED|RS_FAILED) 1287c478bd9Sstevel@tonic-gate #define RS_ACTIVE (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING) 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /** 1317c478bd9Sstevel@tonic-gate ** Various routines. 1327c478bd9Sstevel@tonic-gate **/ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate REQUEST * getrequest ( char * ); 1357c478bd9Sstevel@tonic-gate int putrequest ( char *, REQUEST * ); 1367c478bd9Sstevel@tonic-gate void freerequest ( REQUEST * ); 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #endif 139