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