xref: /titanic_44/usr/src/lib/print/libpapi-ipp/common/papi_impl.h (revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  */
27 
28 #ifndef _PAPI_IMPL_H
29 #define	_PAPI_IMPL_H
30 
31 /* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #include <papi.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include <time.h>
42 #include <sys/types.h>
43 #include <stdarg.h>
44 #include <uri.h>
45 
46 #include <http.h>
47 #include <ipp.h>
48 
49 /*
50  * Implementation specific types/prototypes/definitions follow
51  *
52  *
53  * Ex:
54  */
55 typedef enum {
56 	TRANSFER_ENCODING_CHUNKED,
57 	TRANSFER_ENCODING_LENGTH
58 } http_transfer_encoding_t;
59 
60 typedef struct {
61 	papi_attribute_t **attributes;
62 	char *name;
63 	char *user;
64 	char *password;
65 	int (*authCB)(papi_service_t svc, void *app_data);
66 	papi_encryption_t encryption;
67 	void *app_data;
68 	uri_t *uri;
69 	char *post;
70 	http_t *connection;
71 	http_transfer_encoding_t transfer_encoding;
72 } service_t;
73 
74 typedef struct job {
75 	papi_attribute_t **attributes;
76 } job_t;
77 
78 typedef struct {
79 	papi_attribute_t **attributes;
80 } printer_t;
81 
82 /* IPP glue interfaces */
83 extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
84 extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
85 extern papi_status_t ipp_send_request(service_t *svc,
86 				papi_attribute_t **request,
87 				papi_attribute_t ***response);
88 extern papi_status_t ipp_send_request_with_file(service_t *svc,
89 				papi_attribute_t **request,
90 				papi_attribute_t ***response, char *file);
91 extern papi_status_t ipp_send_initial_request_block(service_t *svc,
92 				papi_attribute_t **request, ssize_t file_size);
93 extern papi_status_t ipp_status_info(service_t *svc,
94 				papi_attribute_t **response);
95 extern void ipp_initialize_request(service_t *svc,
96 				papi_attribute_t ***request, uint16_t type);
97 extern void ipp_initialize_operational_attributes(service_t *svc,
98 				papi_attribute_t ***op,
99 				char *printer, int job_id);
100 extern papi_status_t ipp_to_papi_status(uint16_t status);
101 extern papi_status_t http_to_papi_status(http_status_t status);
102 
103 /* service related interfaces */
104 extern void detailed_error(service_t *svc, char *fmt, ...);
105 extern papi_status_t service_connect(service_t *svc, char *service_name);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* _PAPI_IMPL_H */
112