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