xref: /titanic_50/usr/src/lib/print/libpapi-ipp/common/papi_impl.h (revision 223f6c28404c8d330c123e98936160b8da9a26b2)
1355b4669Sjacobs /*
2355b4669Sjacobs  * CDDL HEADER START
3355b4669Sjacobs  *
4355b4669Sjacobs  * The contents of this file are subject to the terms of the
5355b4669Sjacobs  * Common Development and Distribution License (the "License").
6355b4669Sjacobs  * You may not use this file except in compliance with the License.
7355b4669Sjacobs  *
8355b4669Sjacobs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9355b4669Sjacobs  * or http://www.opensolaris.org/os/licensing.
10355b4669Sjacobs  * See the License for the specific language governing permissions
11355b4669Sjacobs  * and limitations under the License.
12355b4669Sjacobs  *
13355b4669Sjacobs  * When distributing Covered Code, include this CDDL HEADER in each
14355b4669Sjacobs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15355b4669Sjacobs  * If applicable, add the following below this CDDL HEADER, with the
16355b4669Sjacobs  * fields enclosed by brackets "[]" replaced with your own identifying
17355b4669Sjacobs  * information: Portions Copyright [yyyy] [name of copyright owner]
18355b4669Sjacobs  *
19355b4669Sjacobs  * CDDL HEADER END
20355b4669Sjacobs  */
21355b4669Sjacobs 
22355b4669Sjacobs /*
23*223f6c28Sjacobs  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24355b4669Sjacobs  * Use is subject to license terms.
25355b4669Sjacobs  *
26355b4669Sjacobs  */
27355b4669Sjacobs 
28355b4669Sjacobs #ifndef _PAPI_IMPL_H
29355b4669Sjacobs #define	_PAPI_IMPL_H
30355b4669Sjacobs 
31355b4669Sjacobs /* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
32355b4669Sjacobs 
33355b4669Sjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
34355b4669Sjacobs 
35355b4669Sjacobs #include <papi.h>
36355b4669Sjacobs 
37355b4669Sjacobs #ifdef __cplusplus
38355b4669Sjacobs extern "C" {
39355b4669Sjacobs #endif
40355b4669Sjacobs 
41355b4669Sjacobs #include <time.h>
42355b4669Sjacobs #include <sys/types.h>
43355b4669Sjacobs #include <stdarg.h>
44355b4669Sjacobs #include <uri.h>
45355b4669Sjacobs 
46355b4669Sjacobs #include <http.h>
47355b4669Sjacobs #include <ipp.h>
48355b4669Sjacobs 
49355b4669Sjacobs /*
50355b4669Sjacobs  * Implementation specific types/prototypes/definitions follow
51355b4669Sjacobs  *
52355b4669Sjacobs  *
53355b4669Sjacobs  * Ex:
54355b4669Sjacobs  */
55355b4669Sjacobs typedef enum {
56355b4669Sjacobs 	TRANSFER_ENCODING_CHUNKED,
57355b4669Sjacobs 	TRANSFER_ENCODING_LENGTH
58355b4669Sjacobs } http_transfer_encoding_t;
59355b4669Sjacobs 
60355b4669Sjacobs typedef struct {
61355b4669Sjacobs 	papi_attribute_t **attributes;
62355b4669Sjacobs 	char *name;
63355b4669Sjacobs 	char *user;
64355b4669Sjacobs 	char *password;
65355b4669Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);
66355b4669Sjacobs 	papi_encryption_t encryption;
67355b4669Sjacobs 	void *app_data;
68355b4669Sjacobs 	uri_t *uri;
69355b4669Sjacobs 	char *post;
70355b4669Sjacobs 	http_t *connection;
71355b4669Sjacobs 	http_transfer_encoding_t transfer_encoding;
72355b4669Sjacobs } service_t;
73355b4669Sjacobs 
74355b4669Sjacobs typedef struct job {
75355b4669Sjacobs 	papi_attribute_t **attributes;
76355b4669Sjacobs } job_t;
77355b4669Sjacobs 
78355b4669Sjacobs typedef struct {
79355b4669Sjacobs 	papi_attribute_t **attributes;
80355b4669Sjacobs } printer_t;
81355b4669Sjacobs 
82355b4669Sjacobs /* IPP glue interfaces */
83355b4669Sjacobs extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
84355b4669Sjacobs extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
85355b4669Sjacobs extern papi_status_t ipp_send_request(service_t *svc,
86355b4669Sjacobs 				papi_attribute_t **request,
87355b4669Sjacobs 				papi_attribute_t ***response);
88355b4669Sjacobs extern papi_status_t ipp_send_request_with_file(service_t *svc,
89355b4669Sjacobs 				papi_attribute_t **request,
90355b4669Sjacobs 				papi_attribute_t ***response, char *file);
91355b4669Sjacobs extern papi_status_t ipp_send_initial_request_block(service_t *svc,
92355b4669Sjacobs 				papi_attribute_t **request, ssize_t file_size);
93355b4669Sjacobs extern papi_status_t ipp_status_info(service_t *svc,
94355b4669Sjacobs 				papi_attribute_t **response);
95355b4669Sjacobs extern void ipp_initialize_request(service_t *svc,
96355b4669Sjacobs 				papi_attribute_t ***request, uint16_t type);
97355b4669Sjacobs extern void ipp_initialize_operational_attributes(service_t *svc,
98355b4669Sjacobs 				papi_attribute_t ***op,
99*223f6c28Sjacobs 				char *printer, int job_id);
100355b4669Sjacobs extern papi_status_t ipp_to_papi_status(uint16_t status);
101355b4669Sjacobs extern papi_status_t http_to_papi_status(http_status_t status);
102355b4669Sjacobs 
103355b4669Sjacobs /* service related interfaces */
104355b4669Sjacobs extern void detailed_error(service_t *svc, char *fmt, ...);
105355b4669Sjacobs extern papi_status_t service_connect(service_t *svc, char *service_name);
106355b4669Sjacobs 
107355b4669Sjacobs #ifdef __cplusplus
108355b4669Sjacobs }
109355b4669Sjacobs #endif
110355b4669Sjacobs 
111355b4669Sjacobs #endif /* _PAPI_IMPL_H */
112