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 #include <papi.h>
34355b4669Sjacobs 
35355b4669Sjacobs #ifdef __cplusplus
36355b4669Sjacobs extern "C" {
37355b4669Sjacobs #endif
38355b4669Sjacobs 
39355b4669Sjacobs #include <time.h>
40355b4669Sjacobs #include <sys/types.h>
41355b4669Sjacobs #include <stdarg.h>
42355b4669Sjacobs #include <uri.h>
43355b4669Sjacobs 
44355b4669Sjacobs #include <http.h>
45355b4669Sjacobs #include <ipp.h>
46355b4669Sjacobs 
47355b4669Sjacobs /*
48355b4669Sjacobs  * Implementation specific types/prototypes/definitions follow
49355b4669Sjacobs  *
50355b4669Sjacobs  *
51355b4669Sjacobs  * Ex:
52355b4669Sjacobs  */
53355b4669Sjacobs typedef enum {
54355b4669Sjacobs 	TRANSFER_ENCODING_CHUNKED,
55355b4669Sjacobs 	TRANSFER_ENCODING_LENGTH
56355b4669Sjacobs } http_transfer_encoding_t;
57355b4669Sjacobs 
58355b4669Sjacobs typedef struct {
59355b4669Sjacobs 	papi_attribute_t **attributes;
60355b4669Sjacobs 	char *name;
61355b4669Sjacobs 	char *user;
62355b4669Sjacobs 	char *password;
63355b4669Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);
64355b4669Sjacobs 	papi_encryption_t encryption;
65355b4669Sjacobs 	void *app_data;
66355b4669Sjacobs 	uri_t *uri;
67355b4669Sjacobs 	char *post;
68355b4669Sjacobs 	http_t *connection;
69355b4669Sjacobs 	http_transfer_encoding_t transfer_encoding;
70355b4669Sjacobs } service_t;
71355b4669Sjacobs 
72355b4669Sjacobs typedef struct job {
73355b4669Sjacobs 	papi_attribute_t **attributes;
74355b4669Sjacobs } job_t;
75355b4669Sjacobs 
76355b4669Sjacobs typedef struct {
77355b4669Sjacobs 	papi_attribute_t **attributes;
78355b4669Sjacobs } printer_t;
79355b4669Sjacobs 
80355b4669Sjacobs /* IPP glue interfaces */
81355b4669Sjacobs extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
82355b4669Sjacobs extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
83355b4669Sjacobs extern papi_status_t ipp_send_request(service_t *svc,
84355b4669Sjacobs 				papi_attribute_t **request,
85355b4669Sjacobs 				papi_attribute_t ***response);
86355b4669Sjacobs extern papi_status_t ipp_send_request_with_file(service_t *svc,
87355b4669Sjacobs 				papi_attribute_t **request,
88355b4669Sjacobs 				papi_attribute_t ***response, char *file);
89355b4669Sjacobs extern papi_status_t ipp_send_initial_request_block(service_t *svc,
90355b4669Sjacobs 				papi_attribute_t **request, ssize_t file_size);
91355b4669Sjacobs extern papi_status_t ipp_status_info(service_t *svc,
92355b4669Sjacobs 				papi_attribute_t **response);
93355b4669Sjacobs extern void ipp_initialize_request(service_t *svc,
94355b4669Sjacobs 				papi_attribute_t ***request, uint16_t type);
95355b4669Sjacobs extern void ipp_initialize_operational_attributes(service_t *svc,
96355b4669Sjacobs 				papi_attribute_t ***op,
97*223f6c28Sjacobs 				char *printer, int job_id);
98355b4669Sjacobs extern papi_status_t ipp_to_papi_status(uint16_t status);
99355b4669Sjacobs extern papi_status_t http_to_papi_status(http_status_t status);
100355b4669Sjacobs 
101355b4669Sjacobs /* service related interfaces */
102355b4669Sjacobs extern void detailed_error(service_t *svc, char *fmt, ...);
103355b4669Sjacobs extern papi_status_t service_connect(service_t *svc, char *service_name);
104355b4669Sjacobs 
105355b4669Sjacobs #ifdef __cplusplus
106355b4669Sjacobs }
107355b4669Sjacobs #endif
108355b4669Sjacobs 
109355b4669Sjacobs #endif /* _PAPI_IMPL_H */
110