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 #include <http.h>
47*2264Sjacobs #include <ipp.h>
48*2264Sjacobs 
49*2264Sjacobs /*
50*2264Sjacobs  * Implementation specific types/prototypes/definitions follow
51*2264Sjacobs  *
52*2264Sjacobs  *
53*2264Sjacobs  * Ex:
54*2264Sjacobs  */
55*2264Sjacobs typedef enum {
56*2264Sjacobs 	TRANSFER_ENCODING_CHUNKED,
57*2264Sjacobs 	TRANSFER_ENCODING_LENGTH
58*2264Sjacobs } http_transfer_encoding_t;
59*2264Sjacobs 
60*2264Sjacobs typedef struct {
61*2264Sjacobs 	papi_attribute_t **attributes;
62*2264Sjacobs 	char *name;
63*2264Sjacobs 	char *user;
64*2264Sjacobs 	char *password;
65*2264Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);
66*2264Sjacobs 	papi_encryption_t encryption;
67*2264Sjacobs 	void *app_data;
68*2264Sjacobs 	uri_t *uri;
69*2264Sjacobs 	char *post;
70*2264Sjacobs 	http_t *connection;
71*2264Sjacobs 	http_transfer_encoding_t transfer_encoding;
72*2264Sjacobs } service_t;
73*2264Sjacobs 
74*2264Sjacobs typedef struct job {
75*2264Sjacobs 	papi_attribute_t **attributes;
76*2264Sjacobs } job_t;
77*2264Sjacobs 
78*2264Sjacobs typedef struct {
79*2264Sjacobs 	papi_attribute_t **attributes;
80*2264Sjacobs } printer_t;
81*2264Sjacobs 
82*2264Sjacobs /* IPP glue interfaces */
83*2264Sjacobs extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
84*2264Sjacobs extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
85*2264Sjacobs extern papi_status_t ipp_send_request(service_t *svc,
86*2264Sjacobs 				papi_attribute_t **request,
87*2264Sjacobs 				papi_attribute_t ***response);
88*2264Sjacobs extern papi_status_t ipp_send_request_with_file(service_t *svc,
89*2264Sjacobs 				papi_attribute_t **request,
90*2264Sjacobs 				papi_attribute_t ***response, char *file);
91*2264Sjacobs extern papi_status_t ipp_send_initial_request_block(service_t *svc,
92*2264Sjacobs 				papi_attribute_t **request, ssize_t file_size);
93*2264Sjacobs extern papi_status_t ipp_status_info(service_t *svc,
94*2264Sjacobs 				papi_attribute_t **response);
95*2264Sjacobs extern void ipp_initialize_request(service_t *svc,
96*2264Sjacobs 				papi_attribute_t ***request, uint16_t type);
97*2264Sjacobs extern void ipp_initialize_operational_attributes(service_t *svc,
98*2264Sjacobs 				papi_attribute_t ***op,
99*2264Sjacobs 				papi_attribute_t **attributes);
100*2264Sjacobs extern papi_status_t ipp_to_papi_status(uint16_t status);
101*2264Sjacobs extern papi_status_t http_to_papi_status(http_status_t status);
102*2264Sjacobs 
103*2264Sjacobs extern void ipp_add_printer_uri(service_t *svc, char *name,
104*2264Sjacobs 				papi_attribute_t ***op);
105*2264Sjacobs 
106*2264Sjacobs /* service related interfaces */
107*2264Sjacobs extern void detailed_error(service_t *svc, char *fmt, ...);
108*2264Sjacobs extern papi_status_t service_connect(service_t *svc, char *service_name);
109*2264Sjacobs 
110*2264Sjacobs #ifdef __cplusplus
111*2264Sjacobs }
112*2264Sjacobs #endif
113*2264Sjacobs 
114*2264Sjacobs #endif /* _PAPI_IMPL_H */
115