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 545916cd2Sjpk * Common Development and Distribution License (the "License"). 645916cd2Sjpk * 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 /* 2245916cd2Sjpk * 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 #ifndef _PAPI_IMPL_H 277c478bd9Sstevel@tonic-gate #define _PAPI_IMPL_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <papi.h> 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifdef __cplusplus 347c478bd9Sstevel@tonic-gate extern "C" { 357c478bd9Sstevel@tonic-gate #endif 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #include <time.h> 387c478bd9Sstevel@tonic-gate #include <sys/types.h> 397c478bd9Sstevel@tonic-gate #include <stdarg.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* lpsched include files */ 427c478bd9Sstevel@tonic-gate #include <lp.h> 437c478bd9Sstevel@tonic-gate #include <msgs.h> 447c478bd9Sstevel@tonic-gate #include <printers.h> 457c478bd9Sstevel@tonic-gate #include <requests.h> 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * Implementation specific types/prototypes/definitions follow 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate * 527c478bd9Sstevel@tonic-gate * Ex: 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate typedef struct { 567c478bd9Sstevel@tonic-gate papi_attribute_t **attributes; 57*355b4669Sjacobs int (*authCB)(papi_service_t svc, void *app_data); 587c478bd9Sstevel@tonic-gate void *app_data; 597c478bd9Sstevel@tonic-gate MESG *md; 607c478bd9Sstevel@tonic-gate char *msgbuf; 617c478bd9Sstevel@tonic-gate size_t msgbuf_size; 627c478bd9Sstevel@tonic-gate } service_t; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate typedef struct job { 657c478bd9Sstevel@tonic-gate papi_attribute_t **attributes; /* job attributes */ 667c478bd9Sstevel@tonic-gate } job_t; 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate typedef struct { 697c478bd9Sstevel@tonic-gate papi_attribute_t **attributes; /* queue attributes */ 707c478bd9Sstevel@tonic-gate } printer_t; 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate typedef struct { 737c478bd9Sstevel@tonic-gate int fd; 747c478bd9Sstevel@tonic-gate REQUEST *request; 757c478bd9Sstevel@tonic-gate char *meta_data_file; 767c478bd9Sstevel@tonic-gate char added; 777c478bd9Sstevel@tonic-gate } job_stream_t; 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate extern void lpsched_read_job_configuration(service_t *svc, job_t *j, 807c478bd9Sstevel@tonic-gate char *file); 817c478bd9Sstevel@tonic-gate extern void lpsched_request_to_job(REQUEST *r, job_t *j); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate extern void job_status_to_attributes(job_t *job, char *req_id, char *user, 8445916cd2Sjpk char *slabel, size_t size, time_t date, 8545916cd2Sjpk short state, char *destination, char *form, 8645916cd2Sjpk char *charset, short rank, char *file); 877c478bd9Sstevel@tonic-gate extern papi_status_t addLPString(papi_attribute_t ***list, 887c478bd9Sstevel@tonic-gate int flags, char *name, char *value); 89*355b4669Sjacobs extern papi_status_t papiAttributeListAddLPStrings(papi_attribute_t ***list, 907c478bd9Sstevel@tonic-gate int flags, char *name, char **values); 91*355b4669Sjacobs extern void papiAttributeListGetLPString(papi_attribute_t **attributes, 92*355b4669Sjacobs char *key, char **string); 93*355b4669Sjacobs extern void papiAttributeListGetLPStrings(papi_attribute_t **attributes, 94*355b4669Sjacobs char *key, char ***string); 95*355b4669Sjacobs 967c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_printer_configuration_to_attributes( 977c478bd9Sstevel@tonic-gate service_t *svc, printer_t *p, char *dest); 987c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc, 997c478bd9Sstevel@tonic-gate printer_t *p, char *dest); 1007c478bd9Sstevel@tonic-gate extern papi_status_t class_status_to_attributes(printer_t *p, char *printer, 1017c478bd9Sstevel@tonic-gate short status, char *reject_reason, long reject_date); 102*355b4669Sjacobs extern papi_status_t lpsched_reject_printer(papi_service_t svc, 103*355b4669Sjacobs char *printer, char *message); 104*355b4669Sjacobs extern papi_status_t lpsched_accept_printer(papi_service_t svc, 105*355b4669Sjacobs char *printer); 1067c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_disable_printer(papi_service_t svc, 107*355b4669Sjacobs char *printer, char *message); 1087c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_enable_printer(papi_service_t svc, 109*355b4669Sjacobs char *printer); 1107c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_status_to_papi_status(int status); 1117c478bd9Sstevel@tonic-gate extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc, 1127c478bd9Sstevel@tonic-gate REQUEST *r, papi_attribute_t **attributes); 1137c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number, 1147c478bd9Sstevel@tonic-gate char **prefix); 1157c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job, 1167c478bd9Sstevel@tonic-gate char **tmp); 1177c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_start_change(papi_service_t svc, 118*355b4669Sjacobs char *printer, int32_t job_id, char **tmp); 1197c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_end_change(papi_service_t svc, 120*355b4669Sjacobs char *printer, int32_t job_id); 1217c478bd9Sstevel@tonic-gate extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer, 1227c478bd9Sstevel@tonic-gate char *form, char *character_set, char *reject_reason, 1237c478bd9Sstevel@tonic-gate char *disable_reason, short status, char *request_id, long enable_date, 1247c478bd9Sstevel@tonic-gate long reject_date); 125*355b4669Sjacobs extern papi_status_t lpsched_remove_printer(papi_service_t svc, char *dest); 126*355b4669Sjacobs extern papi_status_t lpsched_remove_class(papi_service_t svc, char *dest); 127*355b4669Sjacobs extern papi_status_t lpsched_add_modify_printer(papi_service_t svc, char *dest, 128*355b4669Sjacobs papi_attribute_t **attributes, int type); 129*355b4669Sjacobs extern papi_status_t lpsched_add_modify_class(papi_service_t svc, char *dest, 130*355b4669Sjacobs papi_attribute_t **attributes); 1317c478bd9Sstevel@tonic-gate 132*355b4669Sjacobs extern void lpsched_service_information(papi_attribute_t ***attrs); 1337c478bd9Sstevel@tonic-gate extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j); 1347c478bd9Sstevel@tonic-gate extern void detailed_error(service_t *svc, char *fmt, ...); 1357c478bd9Sstevel@tonic-gate extern char *banner_type(unsigned short banner); 1367c478bd9Sstevel@tonic-gate extern char *mime_type_to_lp_type(char *mime_type); 1377c478bd9Sstevel@tonic-gate extern char *lp_type_to_mime_type(char *lp_type); 138*355b4669Sjacobs extern char *fifo_name_from_uri(char *uri); 139*355b4669Sjacobs extern char *printer_name_from_uri_id(char *uri, int32_t id); 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate extern int snd_msg(service_t *svc, int type, ...); 1427c478bd9Sstevel@tonic-gate extern int rcv_msg(service_t *svc, int type, ...); 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1457c478bd9Sstevel@tonic-gate } 1467c478bd9Sstevel@tonic-gate #endif 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #endif /* _PAPI_IMPL_H */ 149