xref: /illumos-gate/usr/src/lib/print/libpapi-ipp/common/papi_impl.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 #include <papi.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include <time.h>
40 #include <sys/types.h>
41 #include <stdarg.h>
42 #include <uri.h>
43 
44 #include <http.h>
45 #include <ipp.h>
46 
47 /*
48  * Implementation specific types/prototypes/definitions follow
49  *
50  *
51  * Ex:
52  */
53 typedef enum {
54 	TRANSFER_ENCODING_CHUNKED,
55 	TRANSFER_ENCODING_LENGTH
56 } http_transfer_encoding_t;
57 
58 typedef struct {
59 	papi_attribute_t **attributes;
60 	char *name;
61 	char *user;
62 	char *password;
63 	int (*authCB)(papi_service_t svc, void *app_data);
64 	papi_encryption_t encryption;
65 	void *app_data;
66 	uri_t *uri;
67 	char *post;
68 	http_t *connection;
69 	http_transfer_encoding_t transfer_encoding;
70 } service_t;
71 
72 typedef struct job {
73 	papi_attribute_t **attributes;
74 } job_t;
75 
76 typedef struct {
77 	papi_attribute_t **attributes;
78 } printer_t;
79 
80 /* IPP glue interfaces */
81 extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
82 extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
83 extern papi_status_t ipp_send_request(service_t *svc,
84 				papi_attribute_t **request,
85 				papi_attribute_t ***response);
86 extern papi_status_t ipp_send_request_with_file(service_t *svc,
87 				papi_attribute_t **request,
88 				papi_attribute_t ***response, char *file);
89 extern papi_status_t ipp_send_initial_request_block(service_t *svc,
90 				papi_attribute_t **request, ssize_t file_size);
91 extern papi_status_t ipp_status_info(service_t *svc,
92 				papi_attribute_t **response);
93 extern void ipp_initialize_request(service_t *svc,
94 				papi_attribute_t ***request, uint16_t type);
95 extern void ipp_initialize_operational_attributes(service_t *svc,
96 				papi_attribute_t ***op,
97 				char *printer, int job_id);
98 extern papi_status_t ipp_to_papi_status(uint16_t status);
99 extern papi_status_t http_to_papi_status(http_status_t status);
100 
101 /* service related interfaces */
102 extern void detailed_error(service_t *svc, char *fmt, ...);
103 extern papi_status_t service_connect(service_t *svc, char *service_name);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* _PAPI_IMPL_H */
110