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 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 */
27
28 #ifndef _PAPI_H
29 #define _PAPI_H
30
31 /* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */
32
33 #pragma ident "%Z%%M% %I% %E% SMI"
34
35 #include <sys/types.h>
36 #include <time.h>
37 #include <stdio.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * Types
45 */
46
47 /* service related types */
48 typedef void *papi_service_t;
49 typedef void *papi_printer_t;
50 typedef void *papi_job_t;
51 typedef void *papi_stream_t;
52
53 typedef enum {
54 PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
239 char *user_name);
240 extern papi_status_t papiServiceSetPassword(papi_service_t handle,
241 char *password);
242 extern papi_status_t papiServiceSetEncryption(papi_service_t handle,
243 papi_encryption_t encryption);
244 extern papi_status_t papiServiceSetAuthCB(papi_service_t handle,
245 int (*authCB)(papi_service_t s,
246 void *app_data));
247 extern papi_status_t papiServiceSetAppData(papi_service_t handle,
248 void *app_data);
249 extern char *papiServiceGetServiceName(papi_service_t handle);
250 extern char *papiServiceGetUserName(papi_service_t handle);
251 extern char *papiServiceGetPassword(papi_service_t handle);
252 extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle);
253 extern void *papiServiceGetAppData(papi_service_t handle);
254 extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle);
255 extern char *papiServiceGetStatusMessage(papi_service_t handle);
256
257 /* Attribute related */
258 extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
259 int flags, char *name,
260 papi_attribute_value_type_t type,
261 papi_attribute_value_t *value);
262 extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
263 int flags, char *name, char *string);
264 extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
265 int flags, char *name, int integer);
266 extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
267 int flags, char *name, char boolean);
268 extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
269 int flags, char *name,
270 int lower, int upper);
271 extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
272 int flags, char *name,
273 int xres, int yres,
274 papi_resolution_unit_t units);
275 extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
276 int flags, char *name, time_t datetime);
277 extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
278 int flags, char *name,
279 papi_attribute_t **collection);
280 extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
281 int flags, char *name,
282 papi_metadata_t metadata);
283 extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
284 char *name);
285 extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
286 void **iterator, char *name,
287 papi_attribute_value_type_t type,
294 extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
295 void **iterator, char *name,
296 char *vptr);
297 extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
298 void **iterator, char *name,
299 int *min, int *max);
300 extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
301 void **iterator, char *name,
302 int *x, int *y,
303 papi_resolution_unit_t *units);
304 extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
305 void **iterator, char *name,
306 time_t *dt);
307 extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
308 void **iterator, char *name,
309 papi_attribute_t ***collection);
310 extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
311 void **iterator, char *name,
312 papi_metadata_t *vptr);
313 extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
314 char *name);
315 extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
316 void **iterator);
317 extern void papiAttributeListFree(papi_attribute_t **attributes);
318
319 extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
320 int flags, char *string);
321 extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
322 char *delim,
323 char *buffer, size_t buflen);
324 extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list,
325 char *prefix_fmt, ...);
326
327 /* Printer related */
328 extern papi_status_t papiPrintersList(papi_service_t handle,
329 char **requested_attrs,
330 papi_filter_t *filter,
331 papi_printer_t **printers);
332 extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name,
333 char **requested_attrs,
334 papi_attribute_t **job_attributes,
|
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 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 */
27
28 #ifndef _PAPI_H
29 #define _PAPI_H
30
31 /* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */
32
33 #include <sys/types.h>
34 #include <time.h>
35 #include <stdio.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 /*
42 * Types
43 */
44
45 /* service related types */
46 typedef void *papi_service_t;
47 typedef void *papi_printer_t;
48 typedef void *papi_job_t;
49 typedef void *papi_stream_t;
50
51 typedef enum {
52 PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
237 char *user_name);
238 extern papi_status_t papiServiceSetPassword(papi_service_t handle,
239 char *password);
240 extern papi_status_t papiServiceSetEncryption(papi_service_t handle,
241 papi_encryption_t encryption);
242 extern papi_status_t papiServiceSetAuthCB(papi_service_t handle,
243 int (*authCB)(papi_service_t s,
244 void *app_data));
245 extern papi_status_t papiServiceSetAppData(papi_service_t handle,
246 void *app_data);
247 extern char *papiServiceGetServiceName(papi_service_t handle);
248 extern char *papiServiceGetUserName(papi_service_t handle);
249 extern char *papiServiceGetPassword(papi_service_t handle);
250 extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle);
251 extern void *papiServiceGetAppData(papi_service_t handle);
252 extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle);
253 extern char *papiServiceGetStatusMessage(papi_service_t handle);
254
255 /* Attribute related */
256 extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
257 int flags, const char *name,
258 papi_attribute_value_type_t type,
259 papi_attribute_value_t *value);
260 extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
261 int flags, char *name, char *string);
262 extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
263 int flags, char *name, int integer);
264 extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
265 int flags, const char *name, char boolean);
266 extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
267 int flags, char *name,
268 int lower, int upper);
269 extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
270 int flags, char *name,
271 int xres, int yres,
272 papi_resolution_unit_t units);
273 extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
274 int flags, char *name, time_t datetime);
275 extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
276 int flags, char *name,
277 papi_attribute_t **collection);
278 extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
279 int flags, char *name,
280 papi_metadata_t metadata);
281 extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
282 char *name);
283 extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
284 void **iterator, char *name,
285 papi_attribute_value_type_t type,
292 extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
293 void **iterator, char *name,
294 char *vptr);
295 extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
296 void **iterator, char *name,
297 int *min, int *max);
298 extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
299 void **iterator, char *name,
300 int *x, int *y,
301 papi_resolution_unit_t *units);
302 extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
303 void **iterator, char *name,
304 time_t *dt);
305 extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
306 void **iterator, char *name,
307 papi_attribute_t ***collection);
308 extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
309 void **iterator, char *name,
310 papi_metadata_t *vptr);
311 extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
312 const char *name);
313 extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
314 void **iterator);
315 extern void papiAttributeListFree(papi_attribute_t **attributes);
316
317 extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
318 int flags, char *string);
319 extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
320 char *delim,
321 char *buffer, size_t buflen);
322 extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list,
323 char *prefix_fmt, ...);
324
325 /* Printer related */
326 extern papi_status_t papiPrintersList(papi_service_t handle,
327 char **requested_attrs,
328 papi_filter_t *filter,
329 papi_printer_t **printers);
330 extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name,
331 char **requested_attrs,
332 papi_attribute_t **job_attributes,
|