papi_impl.h revision 1676:37f4a3e2bd99
1140074Spjd/* 2141993Spjd * CDDL HEADER START 3140074Spjd * 4140074Spjd * The contents of this file are subject to the terms of the 5140074Spjd * Common Development and Distribution License (the "License"). 6140074Spjd * You may not use this file except in compliance with the License. 7140074Spjd * 8140074Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9140074Spjd * or http://www.opensolaris.org/os/licensing. 10140074Spjd * See the License for the specific language governing permissions 11140074Spjd * and limitations under the License. 12140074Spjd * 13155174Spjd * When distributing Covered Code, include this CDDL HEADER in each 14140074Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15140074Spjd * If applicable, add the following below this CDDL HEADER, with the 16140074Spjd * fields enclosed by brackets "[]" replaced with your own identifying 17140074Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 18140074Spjd * 19140074Spjd * CDDL HEADER END 20140074Spjd */ 21140074Spjd/* 22140074Spjd * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23140074Spjd * Use is subject to license terms. 24140074Spjd */ 25140074Spjd 26140074Spjd#ifndef _PAPI_IMPL_H 27140074Spjd#define _PAPI_IMPL_H 28140074Spjd 29140074Spjd#pragma ident "%Z%%M% %I% %E% SMI" 30140074Spjd 31140074Spjd#include <papi.h> 32140074Spjd 33140074Spjd#ifdef __cplusplus 34140074Spjdextern "C" { 35140074Spjd#endif 36140074Spjd 37140074Spjd#include <time.h> 38140074Spjd#include <sys/types.h> 39140074Spjd#include <stdarg.h> 40142727Spjd 41140074Spjd/* lpsched include files */ 42142727Spjd#include <lp.h> 43140074Spjd#include <msgs.h> 44140074Spjd#include <printers.h> 45140074Spjd#include <requests.h> 46140074Spjd 47140074Spjd 48140074Spjd/* 49140074Spjd * Implementation specific types/prototypes/definitions follow 50140074Spjd * 51140074Spjd * 52140074Spjd * Ex: 53140074Spjd */ 54140074Spjd 55140074Spjdtypedef struct { 56140074Spjd papi_attribute_t **attributes; 57140074Spjd int (*authCB)(papi_service_t svc); 58140074Spjd void *app_data; 59140074Spjd MESG *md; 60140074Spjd char *msgbuf; 61140074Spjd size_t msgbuf_size; 62140074Spjd} service_t; 63140074Spjd 64140074Spjdtypedef struct job { 65140074Spjd papi_attribute_t **attributes; /* job attributes */ 66140074Spjd} job_t; 67140074Spjd 68140074Spjdtypedef struct { 69140074Spjd papi_attribute_t **attributes; /* queue attributes */ 70140074Spjd} printer_t; 71140074Spjd 72140074Spjdtypedef struct { 73140074Spjd int fd; 74140074Spjd REQUEST *request; 75140074Spjd char *meta_data_file; 76140074Spjd char added; 77140074Spjd} job_stream_t; 78140074Spjd 79140074Spjdextern void lpsched_read_job_configuration(service_t *svc, job_t *j, 80140074Spjd char *file); 81140074Spjdextern void lpsched_request_to_job(REQUEST *r, job_t *j); 82140074Spjd 83140074Spjdextern void job_status_to_attributes(job_t *job, char *req_id, char *user, 84140074Spjd char *slabel, size_t size, time_t date, 85140074Spjd short state, char *destination, char *form, 86140074Spjd char *charset, short rank, char *file); 87140074Spjdextern papi_status_t addLPString(papi_attribute_t ***list, 88140074Spjd int flags, char *name, char *value); 89142727Spjdextern papi_status_t addLPStrings(papi_attribute_t ***list, 90140074Spjd int flags, char *name, char **values); 91140074Spjdextern papi_status_t lpsched_printer_configuration_to_attributes( 92140074Spjd service_t *svc, printer_t *p, char *dest); 93140074Spjdextern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc, 94140074Spjd printer_t *p, char *dest); 95140074Spjdextern papi_status_t class_status_to_attributes(printer_t *p, char *printer, 96140074Spjd short status, char *reject_reason, long reject_date); 97140074Spjdextern papi_status_t lpsched_disable_printer(papi_service_t svc, 98140074Spjd const char *printer, const char *message); 99140074Spjdextern papi_status_t lpsched_enable_printer(papi_service_t svc, 100140074Spjd const char *printer); 101140074Spjdextern papi_status_t lpsched_status_to_papi_status(int status); 102142727Spjdextern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc, 103140074Spjd REQUEST *r, papi_attribute_t **attributes); 104140074Spjdextern papi_status_t lpsched_alloc_files(papi_service_t svc, int number, 105140074Spjd char **prefix); 106140074Spjdextern papi_status_t lpsched_commit_job(papi_service_t svc, char *job, 107140074Spjd char **tmp); 108140074Spjdextern papi_status_t lpsched_start_change(papi_service_t svc, 109140074Spjd const char *printer, int32_t job_id, char **tmp); 110140074Spjdextern papi_status_t lpsched_end_change(papi_service_t svc, 111140074Spjd const char *printer, int32_t job_id); 112140074Spjdextern papi_status_t printer_status_to_attributes(printer_t *p, char *printer, 113140074Spjd char *form, char *character_set, char *reject_reason, 114140074Spjd char *disable_reason, short status, char *request_id, long enable_date, 115142727Spjd long reject_date); 116140074Spjd 117140074Spjdextern void lpsched_service_information(printer_t *p); 118extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j); 119extern void detailed_error(service_t *svc, char *fmt, ...); 120extern char *banner_type(unsigned short banner); 121extern char *mime_type_to_lp_type(char *mime_type); 122extern char *lp_type_to_mime_type(char *lp_type); 123extern char *fifo_name_from_uri(const char *uri); 124extern char *printer_name_from_uri_id(const char *uri, int32_t id); 125 126extern int snd_msg(service_t *svc, int type, ...); 127extern int rcv_msg(service_t *svc, int type, ...); 128 129extern int list_append(); 130extern void list_remove(); 131 132 133 134#ifdef __cplusplus 135} 136#endif 137 138#endif /* _PAPI_IMPL_H */ 139