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