17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * 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. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21355b4669Sjacobs 227c478bd9Sstevel@tonic-gate /* 23*a18dc42fSps * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25355b4669Sjacobs * 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _PAPI_H 297c478bd9Sstevel@tonic-gate #define _PAPI_H 307c478bd9Sstevel@tonic-gate 31355b4669Sjacobs /* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */ 32355b4669Sjacobs 337c478bd9Sstevel@tonic-gate #include <sys/types.h> 347c478bd9Sstevel@tonic-gate #include <time.h> 357c478bd9Sstevel@tonic-gate #include <stdio.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Types 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* service related types */ 467c478bd9Sstevel@tonic-gate typedef void *papi_service_t; 477c478bd9Sstevel@tonic-gate typedef void *papi_printer_t; 487c478bd9Sstevel@tonic-gate typedef void *papi_job_t; 497c478bd9Sstevel@tonic-gate typedef void *papi_stream_t; 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate typedef enum { 527c478bd9Sstevel@tonic-gate PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */ 537c478bd9Sstevel@tonic-gate PAPI_ENCRYPT_NEVER, /* Never encrypt */ 547c478bd9Sstevel@tonic-gate PAPI_ENCRYPT_REQUIRED, /* Encryption required (TLS upgrade) */ 557c478bd9Sstevel@tonic-gate PAPI_ENCRYPT_ALWAYS /* Always encrypt (SSL) */ 567c478bd9Sstevel@tonic-gate } papi_encryption_t; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* attribute related types */ 597c478bd9Sstevel@tonic-gate typedef enum { 607c478bd9Sstevel@tonic-gate PAPI_STRING, 617c478bd9Sstevel@tonic-gate PAPI_INTEGER, 627c478bd9Sstevel@tonic-gate PAPI_BOOLEAN, 637c478bd9Sstevel@tonic-gate PAPI_RANGE, 647c478bd9Sstevel@tonic-gate PAPI_RESOLUTION, 657c478bd9Sstevel@tonic-gate PAPI_DATETIME, 66355b4669Sjacobs PAPI_COLLECTION, 67355b4669Sjacobs PAPI_METADATA 687c478bd9Sstevel@tonic-gate } papi_attribute_value_type_t; 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate typedef enum { 717c478bd9Sstevel@tonic-gate PAPI_RES_PER_INCH = 3, 727c478bd9Sstevel@tonic-gate PAPI_RES_PER_CM 737c478bd9Sstevel@tonic-gate } papi_resolution_unit_t; 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate enum { /* for boolean values */ 767c478bd9Sstevel@tonic-gate PAPI_FALSE = 0, 777c478bd9Sstevel@tonic-gate PAPI_TRUE = 1 787c478bd9Sstevel@tonic-gate }; 797c478bd9Sstevel@tonic-gate 80355b4669Sjacobs typedef enum { 81355b4669Sjacobs PAPI_UNSUPPORTED = 0x10, 82355b4669Sjacobs PAPI_DEFAULT = 0x11, 83355b4669Sjacobs PAPI_UNKNOWN, 84355b4669Sjacobs PAPI_NO_VALUE, 85355b4669Sjacobs PAPI_NOT_SETTABLE = 0x15, 86355b4669Sjacobs PAPI_DELETE = 0x16 87355b4669Sjacobs } papi_metadata_t; 88355b4669Sjacobs 897c478bd9Sstevel@tonic-gate #define PAPI_LIST_JOBS_OTHERS 0x0001 907c478bd9Sstevel@tonic-gate #define PAPI_LIST_JOBS_COMPLETED 0x0002 917c478bd9Sstevel@tonic-gate #define PAPI_LIST_JOBS_NOT_COMPLETED 0x0004 927c478bd9Sstevel@tonic-gate #define PAPI_LIST_JOBS_ALL 0xFFFF 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate typedef struct papi_attribute_s papi_attribute_t; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate typedef union { 977c478bd9Sstevel@tonic-gate char *string; /* PAPI_STRING value */ 987c478bd9Sstevel@tonic-gate int integer; /* PAPI_INTEGER value */ 997c478bd9Sstevel@tonic-gate char boolean; /* PAPI_BOOLEAN value */ 1007c478bd9Sstevel@tonic-gate struct { /* PAPI_RANGE value */ 1017c478bd9Sstevel@tonic-gate int lower; 1027c478bd9Sstevel@tonic-gate int upper; 1037c478bd9Sstevel@tonic-gate } range; 1047c478bd9Sstevel@tonic-gate struct { /* PAPI_RESOLUTION value */ 1057c478bd9Sstevel@tonic-gate int xres; 1067c478bd9Sstevel@tonic-gate int yres; 1077c478bd9Sstevel@tonic-gate papi_resolution_unit_t units; 1087c478bd9Sstevel@tonic-gate } resolution; 1097c478bd9Sstevel@tonic-gate time_t datetime; /* PAPI_DATETIME value */ 1107c478bd9Sstevel@tonic-gate papi_attribute_t **collection; /* PAPI_COLLECTION value */ 111355b4669Sjacobs papi_metadata_t metadata; /* PAPI_METADATA value */ 1127c478bd9Sstevel@tonic-gate } papi_attribute_value_t; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate struct papi_attribute_s { 1157c478bd9Sstevel@tonic-gate char *name; /* attribute name */ 1167c478bd9Sstevel@tonic-gate papi_attribute_value_type_t type; /* type of values */ 1177c478bd9Sstevel@tonic-gate papi_attribute_value_t **values; /* list of values */ 1187c478bd9Sstevel@tonic-gate }; 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #define PAPI_ATTR_APPEND 0x0001 /* Add values to attr */ 1217c478bd9Sstevel@tonic-gate #define PAPI_ATTR_REPLACE 0x0002 /* Delete existing values, then add */ 1227c478bd9Sstevel@tonic-gate #define PAPI_ATTR_EXCL 0x0004 /* Fail if attr exists */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* job related types */ 1257c478bd9Sstevel@tonic-gate typedef enum { 1267c478bd9Sstevel@tonic-gate PAPI_JT_FORMAT_JDF = 0, 1277c478bd9Sstevel@tonic-gate PAPI_JT_FORMAT_PWG = 1 1287c478bd9Sstevel@tonic-gate } papi_jt_format_t; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate typedef struct { 1317c478bd9Sstevel@tonic-gate papi_jt_format_t format; 1327c478bd9Sstevel@tonic-gate char *ticket_data; 1337c478bd9Sstevel@tonic-gate char *file_name; 1347c478bd9Sstevel@tonic-gate } papi_job_ticket_t; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* status related types */ 1377c478bd9Sstevel@tonic-gate typedef enum { 1387c478bd9Sstevel@tonic-gate PAPI_OK = 0x0000, 1397c478bd9Sstevel@tonic-gate PAPI_OK_SUBST, 1407c478bd9Sstevel@tonic-gate PAPI_OK_CONFLICT, 1417c478bd9Sstevel@tonic-gate PAPI_OK_IGNORED_SUBSCRIPTIONS, 1427c478bd9Sstevel@tonic-gate PAPI_OK_IGNORED_NOTIFICATIONS, 1437c478bd9Sstevel@tonic-gate PAPI_OK_TOO_MANY_EVENTS, 1447c478bd9Sstevel@tonic-gate PAPI_OK_BUT_CANCEL_SUBSCRIPTION, 1457c478bd9Sstevel@tonic-gate PAPI_REDIRECTION_OTHER_SITE = 0x0300, 1467c478bd9Sstevel@tonic-gate PAPI_BAD_REQUEST = 0x0400, 1477c478bd9Sstevel@tonic-gate PAPI_FORBIDDEN, 1487c478bd9Sstevel@tonic-gate PAPI_NOT_AUTHENTICATED, 1497c478bd9Sstevel@tonic-gate PAPI_NOT_AUTHORIZED, 1507c478bd9Sstevel@tonic-gate PAPI_NOT_POSSIBLE, 1517c478bd9Sstevel@tonic-gate PAPI_TIMEOUT, 1527c478bd9Sstevel@tonic-gate PAPI_NOT_FOUND, 1537c478bd9Sstevel@tonic-gate PAPI_GONE, 1547c478bd9Sstevel@tonic-gate PAPI_REQUEST_ENTITY, 1557c478bd9Sstevel@tonic-gate PAPI_REQUEST_VALUE, 1567c478bd9Sstevel@tonic-gate PAPI_DOCUMENT_FORMAT, 1577c478bd9Sstevel@tonic-gate PAPI_ATTRIBUTES, 1587c478bd9Sstevel@tonic-gate PAPI_URI_SCHEME, 1597c478bd9Sstevel@tonic-gate PAPI_CHARSET, 1607c478bd9Sstevel@tonic-gate PAPI_CONFLICT, 1617c478bd9Sstevel@tonic-gate PAPI_COMPRESSION_NOT_SUPPORTED, 1627c478bd9Sstevel@tonic-gate PAPI_COMPRESSION_ERROR, 1637c478bd9Sstevel@tonic-gate PAPI_DOCUMENT_FORMAT_ERROR, 1647c478bd9Sstevel@tonic-gate PAPI_DOCUMENT_ACCESS_ERROR, 1657c478bd9Sstevel@tonic-gate PAPI_ATTRIBUTES_NOT_SETTABLE, 1667c478bd9Sstevel@tonic-gate PAPI_IGNORED_ALL_SUBSCRIPTIONS, 1677c478bd9Sstevel@tonic-gate PAPI_TOO_MANY_SUBSCRIPTIONS, 1687c478bd9Sstevel@tonic-gate PAPI_IGNORED_ALL_NOTIFICATIONS, 1697c478bd9Sstevel@tonic-gate PAPI_PRINT_SUPPORT_FILE_NOT_FOUND, 1707c478bd9Sstevel@tonic-gate PAPI_INTERNAL_ERROR = 0x0500, 1717c478bd9Sstevel@tonic-gate PAPI_OPERATION_NOT_SUPPORTED, 1727c478bd9Sstevel@tonic-gate PAPI_SERVICE_UNAVAILABLE, 1737c478bd9Sstevel@tonic-gate PAPI_VERSION_NOT_SUPPORTED, 1747c478bd9Sstevel@tonic-gate PAPI_DEVICE_ERROR, 1757c478bd9Sstevel@tonic-gate PAPI_TEMPORARY_ERROR, 1767c478bd9Sstevel@tonic-gate PAPI_NOT_ACCEPTING, 1777c478bd9Sstevel@tonic-gate PAPI_PRINTER_BUSY, 1787c478bd9Sstevel@tonic-gate PAPI_ERROR_JOB_CANCELLED, 1797c478bd9Sstevel@tonic-gate PAPI_MULTIPLE_JOBS_NOT_SUPPORTED, 1807c478bd9Sstevel@tonic-gate PAPI_PRINTER_IS_DEACTIVATED, 1817c478bd9Sstevel@tonic-gate PAPI_BAD_ARGUMENT, 1827c478bd9Sstevel@tonic-gate PAPI_JOB_TICKET_NOT_SUPPORTED 1837c478bd9Sstevel@tonic-gate } papi_status_t; 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate /* list filter related */ 1867c478bd9Sstevel@tonic-gate typedef enum { 1877c478bd9Sstevel@tonic-gate PAPI_FILTER_BITMASK = 0 1887c478bd9Sstevel@tonic-gate } papi_filter_type_t; 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate typedef struct { 1917c478bd9Sstevel@tonic-gate papi_filter_type_t type; 1927c478bd9Sstevel@tonic-gate union { 1937c478bd9Sstevel@tonic-gate struct { /* PAPI_FILTER_BITMASK */ 1947c478bd9Sstevel@tonic-gate unsigned int mask; 1957c478bd9Sstevel@tonic-gate unsigned int value; 1967c478bd9Sstevel@tonic-gate } bitmask; 1977c478bd9Sstevel@tonic-gate } filter; 1987c478bd9Sstevel@tonic-gate } papi_filter_t; 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate enum { 2017c478bd9Sstevel@tonic-gate PAPI_PRINTER_LOCAL = 0x0000, /* Local destination */ 2027c478bd9Sstevel@tonic-gate PAPI_PRINTER_CLASS = 0x0001, /* Printer class */ 2037c478bd9Sstevel@tonic-gate PAPI_PRINTER_REMOTE = 0x0002, /* Remote destination */ 2047c478bd9Sstevel@tonic-gate PAPI_PRINTER_BW = 0x0004, /* Can do B&W printing */ 2057c478bd9Sstevel@tonic-gate PAPI_PRINTER_COLOR = 0x0008, /* Can do color printing */ 2067c478bd9Sstevel@tonic-gate PAPI_PRINTER_DUPLEX = 0x0010, /* Can do duplex printing */ 2077c478bd9Sstevel@tonic-gate PAPI_PRINTER_STAPLE = 0x0020, /* Can do stapling */ 2087c478bd9Sstevel@tonic-gate PAPI_PRINTER_COPIES = 0x0040, /* Can do copies */ 2097c478bd9Sstevel@tonic-gate PAPI_PRINTER_COLLATE = 0x0080, /* Can collate copies */ 2107c478bd9Sstevel@tonic-gate PAPI_PRINTER_PUNCH = 0x0100, /* Can punch output */ 2117c478bd9Sstevel@tonic-gate PAPI_PRINTER_COVER = 0x0200, /* Can cover output */ 2127c478bd9Sstevel@tonic-gate PAPI_PRINTER_BIND = 0x0400, /* Can bind output */ 2137c478bd9Sstevel@tonic-gate PAPI_PRINTER_SORT = 0x0800, /* Can sort output */ 2147c478bd9Sstevel@tonic-gate PAPI_PRINTER_SMALL = 0x1000, /* Can do letter/legal/a4 */ 2157c478bd9Sstevel@tonic-gate PAPI_PRINTER_MEDIUM = 0x2000, /* Can do tabloid/B/C/A3/A2 */ 2167c478bd9Sstevel@tonic-gate PAPI_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ 2177c478bd9Sstevel@tonic-gate PAPI_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ 2187c478bd9Sstevel@tonic-gate PAPI_PRINTER_IMPLICIT = 0x10000, /* implicit class */ 2197c478bd9Sstevel@tonic-gate PAPI_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ 2207c478bd9Sstevel@tonic-gate PAPI_PRINTER_OPTIONS = 0xfffc /* ~ (CLASS | REMOTE | IMPLICIT) */ 2217c478bd9Sstevel@tonic-gate }; 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate /* 2247c478bd9Sstevel@tonic-gate * Functions 2257c478bd9Sstevel@tonic-gate */ 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate /* Service related */ 2287c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceCreate(papi_service_t *handle, 229355b4669Sjacobs char *service_name, char *user_name, 230355b4669Sjacobs char *password, 231355b4669Sjacobs int (*authCB)(papi_service_t svc, 232355b4669Sjacobs void *app_data), 233355b4669Sjacobs papi_encryption_t encryption, 2347c478bd9Sstevel@tonic-gate void *app_data); 2357c478bd9Sstevel@tonic-gate extern void papiServiceDestroy(papi_service_t handle); 2367c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceSetUserName(papi_service_t handle, 237355b4669Sjacobs char *user_name); 2387c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceSetPassword(papi_service_t handle, 239355b4669Sjacobs char *password); 2407c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceSetEncryption(papi_service_t handle, 241355b4669Sjacobs papi_encryption_t encryption); 2427c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceSetAuthCB(papi_service_t handle, 243355b4669Sjacobs int (*authCB)(papi_service_t s, 244355b4669Sjacobs void *app_data)); 2457c478bd9Sstevel@tonic-gate extern papi_status_t papiServiceSetAppData(papi_service_t handle, 246355b4669Sjacobs void *app_data); 2477c478bd9Sstevel@tonic-gate extern char *papiServiceGetServiceName(papi_service_t handle); 2487c478bd9Sstevel@tonic-gate extern char *papiServiceGetUserName(papi_service_t handle); 2497c478bd9Sstevel@tonic-gate extern char *papiServiceGetPassword(papi_service_t handle); 2507c478bd9Sstevel@tonic-gate extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle); 2517c478bd9Sstevel@tonic-gate extern void *papiServiceGetAppData(papi_service_t handle); 252355b4669Sjacobs extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle); 2537c478bd9Sstevel@tonic-gate extern char *papiServiceGetStatusMessage(papi_service_t handle); 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate /* Attribute related */ 256355b4669Sjacobs extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs, 257355b4669Sjacobs int flags, char *name, 258355b4669Sjacobs papi_attribute_value_type_t type, 259355b4669Sjacobs papi_attribute_value_t *value); 2607c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs, 261355b4669Sjacobs int flags, char *name, char *string); 2627c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs, 263355b4669Sjacobs int flags, char *name, int integer); 2647c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs, 265355b4669Sjacobs int flags, char *name, char boolean); 2667c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs, 267355b4669Sjacobs int flags, char *name, 268355b4669Sjacobs int lower, int upper); 2697c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs, 270355b4669Sjacobs int flags, char *name, 271355b4669Sjacobs int xres, int yres, 2727c478bd9Sstevel@tonic-gate papi_resolution_unit_t units); 2737c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs, 274355b4669Sjacobs int flags, char *name, time_t datetime); 2757c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs, 276355b4669Sjacobs int flags, char *name, 277355b4669Sjacobs papi_attribute_t **collection); 278355b4669Sjacobs extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs, 279355b4669Sjacobs int flags, char *name, 280355b4669Sjacobs papi_metadata_t metadata); 2817c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes, 282355b4669Sjacobs char *name); 2837c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list, 284355b4669Sjacobs void **iterator, char *name, 2857c478bd9Sstevel@tonic-gate papi_attribute_value_type_t type, 2867c478bd9Sstevel@tonic-gate papi_attribute_value_t **value); 2877c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetString(papi_attribute_t **list, 288355b4669Sjacobs void **iterator, char *name, 2897c478bd9Sstevel@tonic-gate char **vptr); 2907c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetInteger(papi_attribute_t **list, 291355b4669Sjacobs void **iterator, char *name, int *vptr); 2927c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list, 293355b4669Sjacobs void **iterator, char *name, 2947c478bd9Sstevel@tonic-gate char *vptr); 2957c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list, 296355b4669Sjacobs void **iterator, char *name, 2977c478bd9Sstevel@tonic-gate int *min, int *max); 2987c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list, 299355b4669Sjacobs void **iterator, char *name, 3007c478bd9Sstevel@tonic-gate int *x, int *y, 3017c478bd9Sstevel@tonic-gate papi_resolution_unit_t *units); 3027c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list, 303355b4669Sjacobs void **iterator, char *name, 3047c478bd9Sstevel@tonic-gate time_t *dt); 3057c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list, 306355b4669Sjacobs void **iterator, char *name, 3077c478bd9Sstevel@tonic-gate papi_attribute_t ***collection); 308355b4669Sjacobs extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list, 309355b4669Sjacobs void **iterator, char *name, 310355b4669Sjacobs papi_metadata_t *vptr); 3117c478bd9Sstevel@tonic-gate extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list, 312355b4669Sjacobs char *name); 3137c478bd9Sstevel@tonic-gate extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list, 3147c478bd9Sstevel@tonic-gate void **iterator); 3157c478bd9Sstevel@tonic-gate extern void papiAttributeListFree(papi_attribute_t **attributes); 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs, 318355b4669Sjacobs int flags, char *string); 319355b4669Sjacobs extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs, 320355b4669Sjacobs char *delim, 321355b4669Sjacobs char *buffer, size_t buflen); 322355b4669Sjacobs extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list, 323355b4669Sjacobs char *prefix_fmt, ...); 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* Printer related */ 3267c478bd9Sstevel@tonic-gate extern papi_status_t papiPrintersList(papi_service_t handle, 327355b4669Sjacobs char **requested_attrs, 328355b4669Sjacobs papi_filter_t *filter, 3297c478bd9Sstevel@tonic-gate papi_printer_t **printers); 330355b4669Sjacobs extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name, 331355b4669Sjacobs char **requested_attrs, 332355b4669Sjacobs papi_attribute_t **job_attributes, 333355b4669Sjacobs papi_printer_t *printer); 334355b4669Sjacobs extern papi_status_t papiPrinterAdd(papi_service_t handle, char *name, 335355b4669Sjacobs papi_attribute_t **attributes, 3367c478bd9Sstevel@tonic-gate papi_printer_t *printer); 337355b4669Sjacobs extern papi_status_t papiPrinterModify(papi_service_t handle, char *name, 338355b4669Sjacobs papi_attribute_t **attributes, 3397c478bd9Sstevel@tonic-gate papi_printer_t *printer); 340355b4669Sjacobs extern papi_status_t papiPrinterRemove(papi_service_t handle, char *name); 341355b4669Sjacobs extern papi_status_t papiPrinterDisable(papi_service_t handle, char *name, 342355b4669Sjacobs char *message); 343355b4669Sjacobs extern papi_status_t papiPrinterEnable(papi_service_t handle, char *name); 344355b4669Sjacobs extern papi_status_t papiPrinterPause(papi_service_t handle, char *name, 345355b4669Sjacobs char *message); 346355b4669Sjacobs extern papi_status_t papiPrinterResume(papi_service_t handle, char *name); 3477c478bd9Sstevel@tonic-gate extern papi_status_t papiPrinterPurgeJobs(papi_service_t handle, 348355b4669Sjacobs char *name, papi_job_t **jobs); 3497c478bd9Sstevel@tonic-gate extern papi_status_t papiPrinterListJobs(papi_service_t handle, 350355b4669Sjacobs char *name, char **requested_attrs, 351355b4669Sjacobs int type_mask, int max_num_jobs, 3527c478bd9Sstevel@tonic-gate papi_job_t **jobs); 3537c478bd9Sstevel@tonic-gate extern papi_attribute_t **papiPrinterGetAttributeList(papi_printer_t printer); 3547c478bd9Sstevel@tonic-gate extern void papiPrinterFree(papi_printer_t printer); 3557c478bd9Sstevel@tonic-gate extern void papiPrinterListFree(papi_printer_t *printers); 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate /* Job related */ 358355b4669Sjacobs extern papi_status_t papiJobSubmit(papi_service_t handle, char *printer, 359355b4669Sjacobs papi_attribute_t **job_attributes, 360355b4669Sjacobs papi_job_ticket_t *job_ticket, 361355b4669Sjacobs char **files, papi_job_t *job); 3627c478bd9Sstevel@tonic-gate extern papi_status_t papiJobSubmitByReference(papi_service_t handle, 363355b4669Sjacobs char *printer, 364355b4669Sjacobs papi_attribute_t **job_attributes, 365355b4669Sjacobs papi_job_ticket_t *job_ticket, 366355b4669Sjacobs char **files, papi_job_t *job); 367355b4669Sjacobs extern papi_status_t papiJobValidate(papi_service_t handle, char *printer, 368355b4669Sjacobs papi_attribute_t **job_attributes, 369355b4669Sjacobs papi_job_ticket_t *job_ticket, 370355b4669Sjacobs char **files, papi_job_t *job); 3717c478bd9Sstevel@tonic-gate extern papi_status_t papiJobStreamOpen(papi_service_t handle, 372355b4669Sjacobs char *printer, 373355b4669Sjacobs papi_attribute_t **job_attributes, 374355b4669Sjacobs papi_job_ticket_t *job_ticket, 3757c478bd9Sstevel@tonic-gate papi_stream_t *stream); 3767c478bd9Sstevel@tonic-gate extern papi_status_t papiJobStreamWrite(papi_service_t handle, 3777c478bd9Sstevel@tonic-gate papi_stream_t stream, 378355b4669Sjacobs void *buffer, size_t buflen); 3797c478bd9Sstevel@tonic-gate extern papi_status_t papiJobStreamClose(papi_service_t handle, 3807c478bd9Sstevel@tonic-gate papi_stream_t stream, 3817c478bd9Sstevel@tonic-gate papi_job_t *job); 382355b4669Sjacobs extern papi_status_t papiJobQuery(papi_service_t handle, char *printer, 383355b4669Sjacobs int32_t job_id, char **requested_attrs, 3847c478bd9Sstevel@tonic-gate papi_job_t *job); 385355b4669Sjacobs extern papi_status_t papiJobModify(papi_service_t handle, char *printer, 386355b4669Sjacobs int32_t job_id, 387355b4669Sjacobs papi_attribute_t **attributes, 3887c478bd9Sstevel@tonic-gate papi_job_t *job); 389355b4669Sjacobs extern papi_status_t papiJobMove(papi_service_t handle, char *printer, 390355b4669Sjacobs int32_t job_id, char *destination); 391355b4669Sjacobs extern papi_status_t papiJobCancel(papi_service_t handle, char *printer, 392355b4669Sjacobs int32_t job_id); 393355b4669Sjacobs extern papi_status_t papiJobHold(papi_service_t handle, char *printer, 394355b4669Sjacobs int32_t job_id); 395355b4669Sjacobs extern papi_status_t papiJobRelease(papi_service_t handle, char *printer, 396355b4669Sjacobs int32_t job_id); 397355b4669Sjacobs extern papi_status_t papiJobRestart(papi_service_t handle, char *printer, 398355b4669Sjacobs int32_t job_id); 399355b4669Sjacobs extern papi_status_t papiJobPromote(papi_service_t handle, char *printer, 400355b4669Sjacobs int32_t job_id); 401355b4669Sjacobs extern papi_attribute_t **papiJobGetAttributeList(papi_job_t printer); 402355b4669Sjacobs extern char *papiJobGetPrinterName(papi_job_t printer); 403355b4669Sjacobs extern int32_t papiJobGetId(papi_job_t printer); 404355b4669Sjacobs extern papi_job_ticket_t *papiJobGetJobTicket(papi_job_t printer); 4057c478bd9Sstevel@tonic-gate extern void papiJobFree(papi_job_t job); 4067c478bd9Sstevel@tonic-gate extern void papiJobListFree(papi_job_t *jobs); 4077c478bd9Sstevel@tonic-gate 408355b4669Sjacobs #ifdef SOLARIS_PRIVATE_POST_0_9 4097c478bd9Sstevel@tonic-gate /* 410355b4669Sjacobs * These have been added to support IPP create-job/send-document with PAPI v0.9 4117c478bd9Sstevel@tonic-gate * in an IPP listener using PAPI as it's spooler interface. A future version 4127c478bd9Sstevel@tonic-gate * of the API is expected to support this type of functionality 4137c478bd9Sstevel@tonic-gate */ 414355b4669Sjacobs extern papi_status_t papiJobCreate(papi_service_t handle, char *printer, 415355b4669Sjacobs papi_attribute_t **job_attributes, 416355b4669Sjacobs papi_job_ticket_t *job_ticket, 4177c478bd9Sstevel@tonic-gate papi_job_t *job); 418355b4669Sjacobs extern papi_status_t papiJobStreamAdd(papi_service_t handle, char *printer, 419355b4669Sjacobs int32_t id, papi_stream_t *stream); 420355b4669Sjacobs extern papi_status_t papiJobCommit(papi_service_t handle, char *printer, 421355b4669Sjacobs int32_t id); 422355b4669Sjacobs extern papi_status_t papiServiceSetPeer(papi_service_t handle, int peerfd); 423355b4669Sjacobs #endif /* SOLARIS_PRIVATE_POST_0_9 */ 4247c478bd9Sstevel@tonic-gate 425355b4669Sjacobs extern char *papiStatusString(papi_status_t status); 426355b4669Sjacobs 427355b4669Sjacobs /* 428355b4669Sjacobs * Internal functions that aren't in the API, but are shared across 429355b4669Sjacobs * protocol support implementations(psms) and the tightly bound 430355b4669Sjacobs * listener library. Do not use these in your applications. 431355b4669Sjacobs */ 432355b4669Sjacobs extern void list_append(); 433355b4669Sjacobs extern void list_concatenate(); 434355b4669Sjacobs extern void list_remove(); 435355b4669Sjacobs extern void copy_attributes(papi_attribute_t ***result, 436355b4669Sjacobs papi_attribute_t **list); 437355b4669Sjacobs extern void split_and_copy_attributes(char **list, 438355b4669Sjacobs papi_attribute_t **attributes, 439355b4669Sjacobs papi_attribute_t ***in, 440355b4669Sjacobs papi_attribute_t ***out); 4417c478bd9Sstevel@tonic-gate 4420a44ef6dSjacobs extern papi_attribute_t **getprinterbyname(char *name, char *ns); 4430a44ef6dSjacobs 444*a18dc42fSps extern int is_localhost(char *hostname); 445*a18dc42fSps 4467c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4477c478bd9Sstevel@tonic-gate } 4487c478bd9Sstevel@tonic-gate #endif 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gate #endif /* _PAPI_H */ 451