xref: /onnv-gate/usr/src/lib/print/libpapi-lpd/common/papi_impl.h (revision 2264:b2b9267d002d)
1*2264Sjacobs /*
2*2264Sjacobs  * CDDL HEADER START
3*2264Sjacobs  *
4*2264Sjacobs  * The contents of this file are subject to the terms of the
5*2264Sjacobs  * Common Development and Distribution License (the "License").
6*2264Sjacobs  * You may not use this file except in compliance with the License.
7*2264Sjacobs  *
8*2264Sjacobs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2264Sjacobs  * or http://www.opensolaris.org/os/licensing.
10*2264Sjacobs  * See the License for the specific language governing permissions
11*2264Sjacobs  * and limitations under the License.
12*2264Sjacobs  *
13*2264Sjacobs  * When distributing Covered Code, include this CDDL HEADER in each
14*2264Sjacobs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2264Sjacobs  * If applicable, add the following below this CDDL HEADER, with the
16*2264Sjacobs  * fields enclosed by brackets "[]" replaced with your own identifying
17*2264Sjacobs  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2264Sjacobs  *
19*2264Sjacobs  * CDDL HEADER END
20*2264Sjacobs  */
21*2264Sjacobs 
22*2264Sjacobs /*
23*2264Sjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*2264Sjacobs  * Use is subject to license terms.
25*2264Sjacobs  *
26*2264Sjacobs  */
27*2264Sjacobs 
28*2264Sjacobs #ifndef _PAPI_IMPL_H
29*2264Sjacobs #define	_PAPI_IMPL_H
30*2264Sjacobs 
31*2264Sjacobs /* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
32*2264Sjacobs 
33*2264Sjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*2264Sjacobs 
35*2264Sjacobs #include <papi.h>
36*2264Sjacobs 
37*2264Sjacobs #ifdef __cplusplus
38*2264Sjacobs extern "C" {
39*2264Sjacobs #endif
40*2264Sjacobs 
41*2264Sjacobs #include <time.h>
42*2264Sjacobs #include <sys/types.h>
43*2264Sjacobs #include <stdarg.h>
44*2264Sjacobs #include <uri.h>
45*2264Sjacobs 
46*2264Sjacobs typedef struct {
47*2264Sjacobs 	papi_attribute_t **attributes;
48*2264Sjacobs } printer_t;
49*2264Sjacobs 
50*2264Sjacobs typedef struct job {
51*2264Sjacobs 	papi_attribute_t **attributes;
52*2264Sjacobs } job_t;
53*2264Sjacobs 
54*2264Sjacobs typedef struct stream {
55*2264Sjacobs 	job_t  *job;		/* describes current job */
56*2264Sjacobs 	int fd;			/* the fd to write to */
57*2264Sjacobs 	char *metadata;		/* the converted metadata */
58*2264Sjacobs 	char *dfname;		/* the stream data (if we can't stream) */
59*2264Sjacobs 
60*2264Sjacobs } stream_t;
61*2264Sjacobs 
62*2264Sjacobs typedef struct {	/* used for query operations only */
63*2264Sjacobs 	time_t timestamp;
64*2264Sjacobs 	printer_t *printer;
65*2264Sjacobs 	job_t **jobs;
66*2264Sjacobs } cache_t;
67*2264Sjacobs 
68*2264Sjacobs typedef struct {
69*2264Sjacobs 	papi_attribute_t **attributes;		/* extra info */
70*2264Sjacobs 	uri_t *uri;				/* printer uri */
71*2264Sjacobs 	cache_t *cache;				/* printer/job cache */
72*2264Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);	/* unused */
73*2264Sjacobs 	void *app_data;				/* unused */
74*2264Sjacobs } service_t;
75*2264Sjacobs 
76*2264Sjacobs 
77*2264Sjacobs extern papi_status_t service_fill_in(service_t *svc, char *name);
78*2264Sjacobs extern void detailed_error(service_t *svc, char *fmt, ...);
79*2264Sjacobs extern char *queue_name_from_uri(uri_t *uri);
80*2264Sjacobs extern char *fdgets(char *buf, size_t len, int fd);
81*2264Sjacobs 
82*2264Sjacobs 
83*2264Sjacobs /* lpd operations */
84*2264Sjacobs 	/* open a connection to remote print service */
85*2264Sjacobs extern int lpd_open(service_t *svc, char type, char **args,
86*2264Sjacobs 				int timeout);
87*2264Sjacobs 	/* job cancelation */
88*2264Sjacobs extern papi_status_t lpd_purge_jobs(service_t *svc, job_t ***jobs);
89*2264Sjacobs extern papi_status_t lpd_cancel_job(service_t *svc, int job_id);
90*2264Sjacobs 	/* job submission */
91*2264Sjacobs extern papi_status_t lpd_submit_job(service_t *svc, char *metadata,
92*2264Sjacobs 				papi_attribute_t ***attributes, int *fd);
93*2264Sjacobs extern papi_status_t lpd_job_add_attributes(service_t *svc,
94*2264Sjacobs 				papi_attribute_t **attributes,
95*2264Sjacobs 				char **metadata,
96*2264Sjacobs 				papi_attribute_t ***used_attributes);
97*2264Sjacobs extern papi_status_t lpd_job_add_files(service_t *svc,
98*2264Sjacobs 				papi_attribute_t **attributes, char **files,
99*2264Sjacobs 				char **metadata,
100*2264Sjacobs 				papi_attribute_t ***used_attributes);
101*2264Sjacobs 	/* query cache lookup routines */
102*2264Sjacobs extern papi_status_t lpd_find_printer_info(service_t *svc, printer_t **result);
103*2264Sjacobs extern papi_status_t lpd_find_job_info(service_t *svc, int job_id, job_t **job);
104*2264Sjacobs extern papi_status_t lpd_find_jobs_info(service_t *svc, job_t ***jobs);
105*2264Sjacobs 
106*2264Sjacobs 
107*2264Sjacobs #ifdef __cplusplus
108*2264Sjacobs }
109*2264Sjacobs #endif
110*2264Sjacobs 
111*2264Sjacobs #endif /* _PAPI_IMPL_H */
112