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 51676Sjpk * Common Development and Distribution License (the "License"). 61676Sjpk * 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 /* 221676Sjpk * 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 #ifndef _PAPI_IMPL_H 270Sstevel@tonic-gate #define _PAPI_IMPL_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <papi.h> 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate #include <time.h> 380Sstevel@tonic-gate #include <sys/types.h> 390Sstevel@tonic-gate #include <stdarg.h> 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* lpsched include files */ 420Sstevel@tonic-gate #include <lp.h> 430Sstevel@tonic-gate #include <msgs.h> 440Sstevel@tonic-gate #include <printers.h> 450Sstevel@tonic-gate #include <requests.h> 460Sstevel@tonic-gate 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * Implementation specific types/prototypes/definitions follow 500Sstevel@tonic-gate * 510Sstevel@tonic-gate * 520Sstevel@tonic-gate * Ex: 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate 550Sstevel@tonic-gate typedef struct { 560Sstevel@tonic-gate papi_attribute_t **attributes; 57*2264Sjacobs int (*authCB)(papi_service_t svc, void *app_data); 580Sstevel@tonic-gate void *app_data; 590Sstevel@tonic-gate MESG *md; 600Sstevel@tonic-gate char *msgbuf; 610Sstevel@tonic-gate size_t msgbuf_size; 620Sstevel@tonic-gate } service_t; 630Sstevel@tonic-gate 640Sstevel@tonic-gate typedef struct job { 650Sstevel@tonic-gate papi_attribute_t **attributes; /* job attributes */ 660Sstevel@tonic-gate } job_t; 670Sstevel@tonic-gate 680Sstevel@tonic-gate typedef struct { 690Sstevel@tonic-gate papi_attribute_t **attributes; /* queue attributes */ 700Sstevel@tonic-gate } printer_t; 710Sstevel@tonic-gate 720Sstevel@tonic-gate typedef struct { 730Sstevel@tonic-gate int fd; 740Sstevel@tonic-gate REQUEST *request; 750Sstevel@tonic-gate char *meta_data_file; 760Sstevel@tonic-gate char added; 770Sstevel@tonic-gate } job_stream_t; 780Sstevel@tonic-gate 790Sstevel@tonic-gate extern void lpsched_read_job_configuration(service_t *svc, job_t *j, 800Sstevel@tonic-gate char *file); 810Sstevel@tonic-gate extern void lpsched_request_to_job(REQUEST *r, job_t *j); 820Sstevel@tonic-gate 830Sstevel@tonic-gate extern void job_status_to_attributes(job_t *job, char *req_id, char *user, 841676Sjpk char *slabel, size_t size, time_t date, 851676Sjpk short state, char *destination, char *form, 861676Sjpk char *charset, short rank, char *file); 870Sstevel@tonic-gate extern papi_status_t addLPString(papi_attribute_t ***list, 880Sstevel@tonic-gate int flags, char *name, char *value); 89*2264Sjacobs extern papi_status_t papiAttributeListAddLPStrings(papi_attribute_t ***list, 900Sstevel@tonic-gate int flags, char *name, char **values); 91*2264Sjacobs extern void papiAttributeListGetLPString(papi_attribute_t **attributes, 92*2264Sjacobs char *key, char **string); 93*2264Sjacobs extern void papiAttributeListGetLPStrings(papi_attribute_t **attributes, 94*2264Sjacobs char *key, char ***string); 95*2264Sjacobs 960Sstevel@tonic-gate extern papi_status_t lpsched_printer_configuration_to_attributes( 970Sstevel@tonic-gate service_t *svc, printer_t *p, char *dest); 980Sstevel@tonic-gate extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc, 990Sstevel@tonic-gate printer_t *p, char *dest); 1000Sstevel@tonic-gate extern papi_status_t class_status_to_attributes(printer_t *p, char *printer, 1010Sstevel@tonic-gate short status, char *reject_reason, long reject_date); 102*2264Sjacobs extern papi_status_t lpsched_reject_printer(papi_service_t svc, 103*2264Sjacobs char *printer, char *message); 104*2264Sjacobs extern papi_status_t lpsched_accept_printer(papi_service_t svc, 105*2264Sjacobs char *printer); 1060Sstevel@tonic-gate extern papi_status_t lpsched_disable_printer(papi_service_t svc, 107*2264Sjacobs char *printer, char *message); 1080Sstevel@tonic-gate extern papi_status_t lpsched_enable_printer(papi_service_t svc, 109*2264Sjacobs char *printer); 1100Sstevel@tonic-gate extern papi_status_t lpsched_status_to_papi_status(int status); 1110Sstevel@tonic-gate extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc, 1120Sstevel@tonic-gate REQUEST *r, papi_attribute_t **attributes); 1130Sstevel@tonic-gate extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number, 1140Sstevel@tonic-gate char **prefix); 1150Sstevel@tonic-gate extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job, 1160Sstevel@tonic-gate char **tmp); 1170Sstevel@tonic-gate extern papi_status_t lpsched_start_change(papi_service_t svc, 118*2264Sjacobs char *printer, int32_t job_id, char **tmp); 1190Sstevel@tonic-gate extern papi_status_t lpsched_end_change(papi_service_t svc, 120*2264Sjacobs char *printer, int32_t job_id); 1210Sstevel@tonic-gate extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer, 1220Sstevel@tonic-gate char *form, char *character_set, char *reject_reason, 1230Sstevel@tonic-gate char *disable_reason, short status, char *request_id, long enable_date, 1240Sstevel@tonic-gate long reject_date); 125*2264Sjacobs extern papi_status_t lpsched_remove_printer(papi_service_t svc, char *dest); 126*2264Sjacobs extern papi_status_t lpsched_remove_class(papi_service_t svc, char *dest); 127*2264Sjacobs extern papi_status_t lpsched_add_modify_printer(papi_service_t svc, char *dest, 128*2264Sjacobs papi_attribute_t **attributes, int type); 129*2264Sjacobs extern papi_status_t lpsched_add_modify_class(papi_service_t svc, char *dest, 130*2264Sjacobs papi_attribute_t **attributes); 1310Sstevel@tonic-gate 132*2264Sjacobs extern void lpsched_service_information(papi_attribute_t ***attrs); 1330Sstevel@tonic-gate extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j); 1340Sstevel@tonic-gate extern void detailed_error(service_t *svc, char *fmt, ...); 1350Sstevel@tonic-gate extern char *banner_type(unsigned short banner); 1360Sstevel@tonic-gate extern char *mime_type_to_lp_type(char *mime_type); 1370Sstevel@tonic-gate extern char *lp_type_to_mime_type(char *lp_type); 138*2264Sjacobs extern char *fifo_name_from_uri(char *uri); 139*2264Sjacobs extern char *printer_name_from_uri_id(char *uri, int32_t id); 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate extern int snd_msg(service_t *svc, int type, ...); 1420Sstevel@tonic-gate extern int rcv_msg(service_t *svc, int type, ...); 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate #ifdef __cplusplus 1450Sstevel@tonic-gate } 1460Sstevel@tonic-gate #endif 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate #endif /* _PAPI_IMPL_H */ 149