xref: /illumos-gate/usr/src/cmd/lp/lib/papi/papi_impl.h (revision 2a8bcb4e)
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 #include <papi.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <time.h>
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <stdarg.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /* lpsched include files */
407c478bd9Sstevel@tonic-gate #include <lp.h>
417c478bd9Sstevel@tonic-gate #include <msgs.h>
427c478bd9Sstevel@tonic-gate #include <printers.h>
437c478bd9Sstevel@tonic-gate #include <requests.h>
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Implementation specific types/prototypes/definitions follow
487c478bd9Sstevel@tonic-gate  *
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  * Ex:
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate typedef struct {
547c478bd9Sstevel@tonic-gate 	papi_attribute_t **attributes;
55*355b4669Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);
567c478bd9Sstevel@tonic-gate 	void *app_data;
577c478bd9Sstevel@tonic-gate 	MESG *md;
587c478bd9Sstevel@tonic-gate 	char *msgbuf;
597c478bd9Sstevel@tonic-gate 	size_t msgbuf_size;
607c478bd9Sstevel@tonic-gate } service_t;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate typedef struct job {
637c478bd9Sstevel@tonic-gate 	papi_attribute_t **attributes;	/* job attributes */
647c478bd9Sstevel@tonic-gate } job_t;
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate typedef struct {
677c478bd9Sstevel@tonic-gate 	papi_attribute_t **attributes;	/* queue attributes */
687c478bd9Sstevel@tonic-gate } printer_t;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate typedef struct {
717c478bd9Sstevel@tonic-gate 	int fd;
727c478bd9Sstevel@tonic-gate 	REQUEST *request;
737c478bd9Sstevel@tonic-gate 	char *meta_data_file;
747c478bd9Sstevel@tonic-gate 	char added;
757c478bd9Sstevel@tonic-gate } job_stream_t;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate extern void lpsched_read_job_configuration(service_t *svc, job_t *j,
787c478bd9Sstevel@tonic-gate 				char *file);
797c478bd9Sstevel@tonic-gate extern void lpsched_request_to_job(REQUEST *r, job_t *j);
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate extern void job_status_to_attributes(job_t *job, char *req_id, char *user,
8245916cd2Sjpk 				char *slabel, size_t size, time_t date,
8345916cd2Sjpk 				short state, char *destination, char *form,
8445916cd2Sjpk 				char *charset, short rank, char *file);
857c478bd9Sstevel@tonic-gate extern papi_status_t addLPString(papi_attribute_t ***list,
867c478bd9Sstevel@tonic-gate 					int flags, char *name, char *value);
87*355b4669Sjacobs extern papi_status_t papiAttributeListAddLPStrings(papi_attribute_t ***list,
887c478bd9Sstevel@tonic-gate 					int flags, char *name, char **values);
89*355b4669Sjacobs extern void papiAttributeListGetLPString(papi_attribute_t **attributes,
90*355b4669Sjacobs 			char *key, char **string);
91*355b4669Sjacobs extern void papiAttributeListGetLPStrings(papi_attribute_t **attributes,
92*355b4669Sjacobs 			char *key, char ***string);
93*355b4669Sjacobs 
947c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_printer_configuration_to_attributes(
957c478bd9Sstevel@tonic-gate 				service_t *svc, printer_t *p, char *dest);
967c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc,
977c478bd9Sstevel@tonic-gate 	printer_t *p, char *dest);
987c478bd9Sstevel@tonic-gate extern papi_status_t class_status_to_attributes(printer_t *p, char *printer,
997c478bd9Sstevel@tonic-gate 	short status, char *reject_reason, long reject_date);
100*355b4669Sjacobs extern papi_status_t lpsched_reject_printer(papi_service_t svc,
101*355b4669Sjacobs 	char *printer, char *message);
102*355b4669Sjacobs extern papi_status_t lpsched_accept_printer(papi_service_t svc,
103*355b4669Sjacobs 	char *printer);
1047c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_disable_printer(papi_service_t svc,
105*355b4669Sjacobs 	char *printer, char *message);
1067c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_enable_printer(papi_service_t svc,
107*355b4669Sjacobs 	char *printer);
1087c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_status_to_papi_status(int status);
1097c478bd9Sstevel@tonic-gate extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc,
1107c478bd9Sstevel@tonic-gate 	REQUEST *r, papi_attribute_t **attributes);
1117c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number,
1127c478bd9Sstevel@tonic-gate 	char **prefix);
1137c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job,
1147c478bd9Sstevel@tonic-gate 	char **tmp);
1157c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_start_change(papi_service_t svc,
116*355b4669Sjacobs 	char *printer, int32_t job_id, char **tmp);
1177c478bd9Sstevel@tonic-gate extern papi_status_t lpsched_end_change(papi_service_t svc,
118*355b4669Sjacobs 	char *printer, int32_t job_id);
1197c478bd9Sstevel@tonic-gate extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer,
1207c478bd9Sstevel@tonic-gate 	char *form, char *character_set, char *reject_reason,
1217c478bd9Sstevel@tonic-gate 	char *disable_reason, short status, char *request_id, long enable_date,
1227c478bd9Sstevel@tonic-gate 	long reject_date);
123*355b4669Sjacobs extern papi_status_t lpsched_remove_printer(papi_service_t svc, char *dest);
124*355b4669Sjacobs extern papi_status_t lpsched_remove_class(papi_service_t svc, char *dest);
125*355b4669Sjacobs extern papi_status_t lpsched_add_modify_printer(papi_service_t svc, char *dest,
126*355b4669Sjacobs 	papi_attribute_t **attributes, int type);
127*355b4669Sjacobs extern papi_status_t lpsched_add_modify_class(papi_service_t svc, char *dest,
128*355b4669Sjacobs 	papi_attribute_t **attributes);
129*355b4669Sjacobs 
130*355b4669Sjacobs extern void lpsched_service_information(papi_attribute_t ***attrs);
1317c478bd9Sstevel@tonic-gate extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j);
1327c478bd9Sstevel@tonic-gate extern void detailed_error(service_t *svc, char *fmt, ...);
1337c478bd9Sstevel@tonic-gate extern char *banner_type(unsigned short banner);
1347c478bd9Sstevel@tonic-gate extern char *mime_type_to_lp_type(char *mime_type);
1357c478bd9Sstevel@tonic-gate extern char *lp_type_to_mime_type(char *lp_type);
136*355b4669Sjacobs extern char *fifo_name_from_uri(char *uri);
137*355b4669Sjacobs extern char *printer_name_from_uri_id(char *uri, int32_t id);
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate extern int snd_msg(service_t *svc, int type, ...);
1407c478bd9Sstevel@tonic-gate extern int rcv_msg(service_t *svc, int type, ...);
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1437c478bd9Sstevel@tonic-gate }
1447c478bd9Sstevel@tonic-gate #endif
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #endif /* _PAPI_IMPL_H */
147