xref: /onnv-gate/usr/src/lib/print/libpapi-ipp/common/papi_impl.h (revision 3917:9e19a8d4a355)
12264Sjacobs /*
22264Sjacobs  * CDDL HEADER START
32264Sjacobs  *
42264Sjacobs  * The contents of this file are subject to the terms of the
52264Sjacobs  * Common Development and Distribution License (the "License").
62264Sjacobs  * You may not use this file except in compliance with the License.
72264Sjacobs  *
82264Sjacobs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92264Sjacobs  * or http://www.opensolaris.org/os/licensing.
102264Sjacobs  * See the License for the specific language governing permissions
112264Sjacobs  * and limitations under the License.
122264Sjacobs  *
132264Sjacobs  * When distributing Covered Code, include this CDDL HEADER in each
142264Sjacobs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152264Sjacobs  * If applicable, add the following below this CDDL HEADER, with the
162264Sjacobs  * fields enclosed by brackets "[]" replaced with your own identifying
172264Sjacobs  * information: Portions Copyright [yyyy] [name of copyright owner]
182264Sjacobs  *
192264Sjacobs  * CDDL HEADER END
202264Sjacobs  */
212264Sjacobs 
222264Sjacobs /*
23*3917Sjacobs  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
242264Sjacobs  * Use is subject to license terms.
252264Sjacobs  *
262264Sjacobs  */
272264Sjacobs 
282264Sjacobs #ifndef _PAPI_IMPL_H
292264Sjacobs #define	_PAPI_IMPL_H
302264Sjacobs 
312264Sjacobs /* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
322264Sjacobs 
332264Sjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
342264Sjacobs 
352264Sjacobs #include <papi.h>
362264Sjacobs 
372264Sjacobs #ifdef __cplusplus
382264Sjacobs extern "C" {
392264Sjacobs #endif
402264Sjacobs 
412264Sjacobs #include <time.h>
422264Sjacobs #include <sys/types.h>
432264Sjacobs #include <stdarg.h>
442264Sjacobs #include <uri.h>
452264Sjacobs 
462264Sjacobs #include <http.h>
472264Sjacobs #include <ipp.h>
482264Sjacobs 
492264Sjacobs /*
502264Sjacobs  * Implementation specific types/prototypes/definitions follow
512264Sjacobs  *
522264Sjacobs  *
532264Sjacobs  * Ex:
542264Sjacobs  */
552264Sjacobs typedef enum {
562264Sjacobs 	TRANSFER_ENCODING_CHUNKED,
572264Sjacobs 	TRANSFER_ENCODING_LENGTH
582264Sjacobs } http_transfer_encoding_t;
592264Sjacobs 
602264Sjacobs typedef struct {
612264Sjacobs 	papi_attribute_t **attributes;
622264Sjacobs 	char *name;
632264Sjacobs 	char *user;
642264Sjacobs 	char *password;
652264Sjacobs 	int (*authCB)(papi_service_t svc, void *app_data);
662264Sjacobs 	papi_encryption_t encryption;
672264Sjacobs 	void *app_data;
682264Sjacobs 	uri_t *uri;
692264Sjacobs 	char *post;
702264Sjacobs 	http_t *connection;
712264Sjacobs 	http_transfer_encoding_t transfer_encoding;
722264Sjacobs } service_t;
732264Sjacobs 
742264Sjacobs typedef struct job {
752264Sjacobs 	papi_attribute_t **attributes;
762264Sjacobs } job_t;
772264Sjacobs 
782264Sjacobs typedef struct {
792264Sjacobs 	papi_attribute_t **attributes;
802264Sjacobs } printer_t;
812264Sjacobs 
822264Sjacobs /* IPP glue interfaces */
832264Sjacobs extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
842264Sjacobs extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
852264Sjacobs extern papi_status_t ipp_send_request(service_t *svc,
862264Sjacobs 				papi_attribute_t **request,
872264Sjacobs 				papi_attribute_t ***response);
882264Sjacobs extern papi_status_t ipp_send_request_with_file(service_t *svc,
892264Sjacobs 				papi_attribute_t **request,
902264Sjacobs 				papi_attribute_t ***response, char *file);
912264Sjacobs extern papi_status_t ipp_send_initial_request_block(service_t *svc,
922264Sjacobs 				papi_attribute_t **request, ssize_t file_size);
932264Sjacobs extern papi_status_t ipp_status_info(service_t *svc,
942264Sjacobs 				papi_attribute_t **response);
952264Sjacobs extern void ipp_initialize_request(service_t *svc,
962264Sjacobs 				papi_attribute_t ***request, uint16_t type);
972264Sjacobs extern void ipp_initialize_operational_attributes(service_t *svc,
982264Sjacobs 				papi_attribute_t ***op,
99*3917Sjacobs 				char *printer, int job_id);
1002264Sjacobs extern papi_status_t ipp_to_papi_status(uint16_t status);
1012264Sjacobs extern papi_status_t http_to_papi_status(http_status_t status);
1022264Sjacobs 
1032264Sjacobs /* service related interfaces */
1042264Sjacobs extern void detailed_error(service_t *svc, char *fmt, ...);
1052264Sjacobs extern papi_status_t service_connect(service_t *svc, char *service_name);
1062264Sjacobs 
1072264Sjacobs #ifdef __cplusplus
1082264Sjacobs }
1092264Sjacobs #endif
1102264Sjacobs 
1112264Sjacobs #endif /* _PAPI_IMPL_H */
112