1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _PAPI_IMPL_H 28*0Sstevel@tonic-gate #define _PAPI_IMPL_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <papi.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #ifdef __cplusplus 35*0Sstevel@tonic-gate extern "C" { 36*0Sstevel@tonic-gate #endif 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #include <time.h> 39*0Sstevel@tonic-gate #include <sys/types.h> 40*0Sstevel@tonic-gate #include <stdarg.h> 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* lpsched include files */ 43*0Sstevel@tonic-gate #include <lp.h> 44*0Sstevel@tonic-gate #include <msgs.h> 45*0Sstevel@tonic-gate #include <printers.h> 46*0Sstevel@tonic-gate #include <requests.h> 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate /* 50*0Sstevel@tonic-gate * Implementation specific types/prototypes/definitions follow 51*0Sstevel@tonic-gate * 52*0Sstevel@tonic-gate * 53*0Sstevel@tonic-gate * Ex: 54*0Sstevel@tonic-gate */ 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate typedef struct { 57*0Sstevel@tonic-gate papi_attribute_t **attributes; 58*0Sstevel@tonic-gate int (*authCB)(papi_service_t svc); 59*0Sstevel@tonic-gate void *app_data; 60*0Sstevel@tonic-gate MESG *md; 61*0Sstevel@tonic-gate char *msgbuf; 62*0Sstevel@tonic-gate size_t msgbuf_size; 63*0Sstevel@tonic-gate } service_t; 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate typedef struct job { 66*0Sstevel@tonic-gate papi_attribute_t **attributes; /* job attributes */ 67*0Sstevel@tonic-gate } job_t; 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate typedef struct { 70*0Sstevel@tonic-gate papi_attribute_t **attributes; /* queue attributes */ 71*0Sstevel@tonic-gate } printer_t; 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate typedef struct { 74*0Sstevel@tonic-gate int fd; 75*0Sstevel@tonic-gate REQUEST *request; 76*0Sstevel@tonic-gate char *meta_data_file; 77*0Sstevel@tonic-gate char added; 78*0Sstevel@tonic-gate } job_stream_t; 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate extern void lpsched_read_job_configuration(service_t *svc, job_t *j, 81*0Sstevel@tonic-gate char *file); 82*0Sstevel@tonic-gate extern void lpsched_request_to_job(REQUEST *r, job_t *j); 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate extern void job_status_to_attributes(job_t *job, char *req_id, char *user, 85*0Sstevel@tonic-gate size_t size, time_t date, short state, 86*0Sstevel@tonic-gate char *destination, char *form, char *charset, 87*0Sstevel@tonic-gate short rank, char *file); 88*0Sstevel@tonic-gate extern papi_status_t addLPString(papi_attribute_t ***list, 89*0Sstevel@tonic-gate int flags, char *name, char *value); 90*0Sstevel@tonic-gate extern papi_status_t addLPStrings(papi_attribute_t ***list, 91*0Sstevel@tonic-gate int flags, char *name, char **values); 92*0Sstevel@tonic-gate extern papi_status_t lpsched_printer_configuration_to_attributes( 93*0Sstevel@tonic-gate service_t *svc, printer_t *p, char *dest); 94*0Sstevel@tonic-gate extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc, 95*0Sstevel@tonic-gate printer_t *p, char *dest); 96*0Sstevel@tonic-gate extern papi_status_t class_status_to_attributes(printer_t *p, char *printer, 97*0Sstevel@tonic-gate short status, char *reject_reason, long reject_date); 98*0Sstevel@tonic-gate extern papi_status_t lpsched_disable_printer(papi_service_t svc, 99*0Sstevel@tonic-gate const char *printer, const char *message); 100*0Sstevel@tonic-gate extern papi_status_t lpsched_enable_printer(papi_service_t svc, 101*0Sstevel@tonic-gate const char *printer); 102*0Sstevel@tonic-gate extern papi_status_t lpsched_status_to_papi_status(int status); 103*0Sstevel@tonic-gate extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc, 104*0Sstevel@tonic-gate REQUEST *r, papi_attribute_t **attributes); 105*0Sstevel@tonic-gate extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number, 106*0Sstevel@tonic-gate char **prefix); 107*0Sstevel@tonic-gate extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job, 108*0Sstevel@tonic-gate char **tmp); 109*0Sstevel@tonic-gate extern papi_status_t lpsched_start_change(papi_service_t svc, 110*0Sstevel@tonic-gate const char *printer, int32_t job_id, char **tmp); 111*0Sstevel@tonic-gate extern papi_status_t lpsched_end_change(papi_service_t svc, 112*0Sstevel@tonic-gate const char *printer, int32_t job_id); 113*0Sstevel@tonic-gate extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer, 114*0Sstevel@tonic-gate char *form, char *character_set, char *reject_reason, 115*0Sstevel@tonic-gate char *disable_reason, short status, char *request_id, long enable_date, 116*0Sstevel@tonic-gate long reject_date); 117*0Sstevel@tonic-gate 118*0Sstevel@tonic-gate extern void lpsched_service_information(printer_t *p); 119*0Sstevel@tonic-gate extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j); 120*0Sstevel@tonic-gate extern void detailed_error(service_t *svc, char *fmt, ...); 121*0Sstevel@tonic-gate extern char *banner_type(unsigned short banner); 122*0Sstevel@tonic-gate extern char *mime_type_to_lp_type(char *mime_type); 123*0Sstevel@tonic-gate extern char *lp_type_to_mime_type(char *lp_type); 124*0Sstevel@tonic-gate extern char *fifo_name_from_uri(const char *uri); 125*0Sstevel@tonic-gate extern char *printer_name_from_uri_id(const char *uri, int32_t id); 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate extern int snd_msg(service_t *svc, int type, ...); 128*0Sstevel@tonic-gate extern int rcv_msg(service_t *svc, int type, ...); 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate extern int list_append(); 131*0Sstevel@tonic-gate extern void list_remove(); 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate #ifdef __cplusplus 136*0Sstevel@tonic-gate } 137*0Sstevel@tonic-gate #endif 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate #endif /* _PAPI_IMPL_H */ 140