xref: /onnv-gate/usr/src/cmd/lp/lib/papi/papi_impl.h (revision 1676)
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
5*1676Sjpk  * Common Development and Distribution License (the "License").
6*1676Sjpk  * 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 /*
22*1676Sjpk  * 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;
570Sstevel@tonic-gate 	int (*authCB)(papi_service_t svc);
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,
84*1676Sjpk 				char *slabel, size_t size, time_t date,
85*1676Sjpk 				short state, char *destination, char *form,
86*1676Sjpk 				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);
890Sstevel@tonic-gate extern papi_status_t addLPStrings(papi_attribute_t ***list,
900Sstevel@tonic-gate 					int flags, char *name, char **values);
910Sstevel@tonic-gate extern papi_status_t lpsched_printer_configuration_to_attributes(
920Sstevel@tonic-gate 				service_t *svc, printer_t *p, char *dest);
930Sstevel@tonic-gate extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc,
940Sstevel@tonic-gate 	printer_t *p, char *dest);
950Sstevel@tonic-gate extern papi_status_t class_status_to_attributes(printer_t *p, char *printer,
960Sstevel@tonic-gate 	short status, char *reject_reason, long reject_date);
970Sstevel@tonic-gate extern papi_status_t lpsched_disable_printer(papi_service_t svc,
980Sstevel@tonic-gate 	const char *printer, const char *message);
990Sstevel@tonic-gate extern papi_status_t lpsched_enable_printer(papi_service_t svc,
1000Sstevel@tonic-gate 	const char *printer);
1010Sstevel@tonic-gate extern papi_status_t lpsched_status_to_papi_status(int status);
1020Sstevel@tonic-gate extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc,
1030Sstevel@tonic-gate 	REQUEST *r, papi_attribute_t **attributes);
1040Sstevel@tonic-gate extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number,
1050Sstevel@tonic-gate 	char **prefix);
1060Sstevel@tonic-gate extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job,
1070Sstevel@tonic-gate 	char **tmp);
1080Sstevel@tonic-gate extern papi_status_t lpsched_start_change(papi_service_t svc,
1090Sstevel@tonic-gate 	const char *printer, int32_t job_id, char **tmp);
1100Sstevel@tonic-gate extern papi_status_t lpsched_end_change(papi_service_t svc,
1110Sstevel@tonic-gate 	const char *printer, int32_t job_id);
1120Sstevel@tonic-gate extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer,
1130Sstevel@tonic-gate 	char *form, char *character_set, char *reject_reason,
1140Sstevel@tonic-gate 	char *disable_reason, short status, char *request_id, long enable_date,
1150Sstevel@tonic-gate 	long reject_date);
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate extern void lpsched_service_information(printer_t *p);
1180Sstevel@tonic-gate extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j);
1190Sstevel@tonic-gate extern void detailed_error(service_t *svc, char *fmt, ...);
1200Sstevel@tonic-gate extern char *banner_type(unsigned short banner);
1210Sstevel@tonic-gate extern char *mime_type_to_lp_type(char *mime_type);
1220Sstevel@tonic-gate extern char *lp_type_to_mime_type(char *lp_type);
1230Sstevel@tonic-gate extern char *fifo_name_from_uri(const char *uri);
1240Sstevel@tonic-gate extern char *printer_name_from_uri_id(const char *uri, int32_t id);
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate extern int snd_msg(service_t *svc, int type, ...);
1270Sstevel@tonic-gate extern int rcv_msg(service_t *svc, int type, ...);
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate extern int list_append();
1300Sstevel@tonic-gate extern void list_remove();
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate #ifdef __cplusplus
1350Sstevel@tonic-gate }
1360Sstevel@tonic-gate #endif
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate #endif /* _PAPI_IMPL_H */
139