Print this page
Bump Apache dependency to Apache 2
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/print/libpapi-common/common/papi.h
+++ new/usr/src/lib/print/libpapi-common/common/papi.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
23 24 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 25 * Use is subject to license terms.
25 26 *
26 27 */
27 28
28 29 #ifndef _PAPI_H
29 30 #define _PAPI_H
30 31
31 32 /* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */
32 33
33 -#pragma ident "%Z%%M% %I% %E% SMI"
34 -
35 34 #include <sys/types.h>
36 35 #include <time.h>
37 36 #include <stdio.h>
38 37
39 38 #ifdef __cplusplus
40 39 extern "C" {
41 40 #endif
42 41
43 42 /*
44 43 * Types
45 44 */
46 45
47 46 /* service related types */
48 47 typedef void *papi_service_t;
49 48 typedef void *papi_printer_t;
50 49 typedef void *papi_job_t;
51 50 typedef void *papi_stream_t;
52 51
53 52 typedef enum {
54 53 PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
55 54 PAPI_ENCRYPT_NEVER, /* Never encrypt */
56 55 PAPI_ENCRYPT_REQUIRED, /* Encryption required (TLS upgrade) */
57 56 PAPI_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
58 57 } papi_encryption_t;
59 58
60 59 /* attribute related types */
61 60 typedef enum {
62 61 PAPI_STRING,
63 62 PAPI_INTEGER,
64 63 PAPI_BOOLEAN,
65 64 PAPI_RANGE,
66 65 PAPI_RESOLUTION,
67 66 PAPI_DATETIME,
68 67 PAPI_COLLECTION,
69 68 PAPI_METADATA
70 69 } papi_attribute_value_type_t;
71 70
72 71 typedef enum {
73 72 PAPI_RES_PER_INCH = 3,
74 73 PAPI_RES_PER_CM
75 74 } papi_resolution_unit_t;
76 75
77 76 enum { /* for boolean values */
78 77 PAPI_FALSE = 0,
79 78 PAPI_TRUE = 1
80 79 };
81 80
82 81 typedef enum {
83 82 PAPI_UNSUPPORTED = 0x10,
84 83 PAPI_DEFAULT = 0x11,
85 84 PAPI_UNKNOWN,
86 85 PAPI_NO_VALUE,
87 86 PAPI_NOT_SETTABLE = 0x15,
88 87 PAPI_DELETE = 0x16
89 88 } papi_metadata_t;
90 89
91 90 #define PAPI_LIST_JOBS_OTHERS 0x0001
92 91 #define PAPI_LIST_JOBS_COMPLETED 0x0002
93 92 #define PAPI_LIST_JOBS_NOT_COMPLETED 0x0004
94 93 #define PAPI_LIST_JOBS_ALL 0xFFFF
95 94
96 95 typedef struct papi_attribute_s papi_attribute_t;
97 96
98 97 typedef union {
99 98 char *string; /* PAPI_STRING value */
100 99 int integer; /* PAPI_INTEGER value */
101 100 char boolean; /* PAPI_BOOLEAN value */
102 101 struct { /* PAPI_RANGE value */
103 102 int lower;
104 103 int upper;
105 104 } range;
106 105 struct { /* PAPI_RESOLUTION value */
107 106 int xres;
108 107 int yres;
109 108 papi_resolution_unit_t units;
110 109 } resolution;
111 110 time_t datetime; /* PAPI_DATETIME value */
112 111 papi_attribute_t **collection; /* PAPI_COLLECTION value */
113 112 papi_metadata_t metadata; /* PAPI_METADATA value */
114 113 } papi_attribute_value_t;
115 114
116 115 struct papi_attribute_s {
117 116 char *name; /* attribute name */
118 117 papi_attribute_value_type_t type; /* type of values */
119 118 papi_attribute_value_t **values; /* list of values */
120 119 };
121 120
122 121 #define PAPI_ATTR_APPEND 0x0001 /* Add values to attr */
123 122 #define PAPI_ATTR_REPLACE 0x0002 /* Delete existing values, then add */
124 123 #define PAPI_ATTR_EXCL 0x0004 /* Fail if attr exists */
125 124
126 125 /* job related types */
127 126 typedef enum {
128 127 PAPI_JT_FORMAT_JDF = 0,
129 128 PAPI_JT_FORMAT_PWG = 1
130 129 } papi_jt_format_t;
131 130
132 131 typedef struct {
133 132 papi_jt_format_t format;
134 133 char *ticket_data;
135 134 char *file_name;
136 135 } papi_job_ticket_t;
137 136
138 137 /* status related types */
139 138 typedef enum {
140 139 PAPI_OK = 0x0000,
141 140 PAPI_OK_SUBST,
142 141 PAPI_OK_CONFLICT,
143 142 PAPI_OK_IGNORED_SUBSCRIPTIONS,
144 143 PAPI_OK_IGNORED_NOTIFICATIONS,
145 144 PAPI_OK_TOO_MANY_EVENTS,
146 145 PAPI_OK_BUT_CANCEL_SUBSCRIPTION,
147 146 PAPI_REDIRECTION_OTHER_SITE = 0x0300,
148 147 PAPI_BAD_REQUEST = 0x0400,
149 148 PAPI_FORBIDDEN,
150 149 PAPI_NOT_AUTHENTICATED,
151 150 PAPI_NOT_AUTHORIZED,
152 151 PAPI_NOT_POSSIBLE,
153 152 PAPI_TIMEOUT,
154 153 PAPI_NOT_FOUND,
155 154 PAPI_GONE,
156 155 PAPI_REQUEST_ENTITY,
157 156 PAPI_REQUEST_VALUE,
158 157 PAPI_DOCUMENT_FORMAT,
159 158 PAPI_ATTRIBUTES,
160 159 PAPI_URI_SCHEME,
161 160 PAPI_CHARSET,
162 161 PAPI_CONFLICT,
163 162 PAPI_COMPRESSION_NOT_SUPPORTED,
164 163 PAPI_COMPRESSION_ERROR,
165 164 PAPI_DOCUMENT_FORMAT_ERROR,
166 165 PAPI_DOCUMENT_ACCESS_ERROR,
167 166 PAPI_ATTRIBUTES_NOT_SETTABLE,
168 167 PAPI_IGNORED_ALL_SUBSCRIPTIONS,
169 168 PAPI_TOO_MANY_SUBSCRIPTIONS,
170 169 PAPI_IGNORED_ALL_NOTIFICATIONS,
171 170 PAPI_PRINT_SUPPORT_FILE_NOT_FOUND,
172 171 PAPI_INTERNAL_ERROR = 0x0500,
173 172 PAPI_OPERATION_NOT_SUPPORTED,
174 173 PAPI_SERVICE_UNAVAILABLE,
175 174 PAPI_VERSION_NOT_SUPPORTED,
176 175 PAPI_DEVICE_ERROR,
177 176 PAPI_TEMPORARY_ERROR,
178 177 PAPI_NOT_ACCEPTING,
179 178 PAPI_PRINTER_BUSY,
180 179 PAPI_ERROR_JOB_CANCELLED,
181 180 PAPI_MULTIPLE_JOBS_NOT_SUPPORTED,
182 181 PAPI_PRINTER_IS_DEACTIVATED,
183 182 PAPI_BAD_ARGUMENT,
184 183 PAPI_JOB_TICKET_NOT_SUPPORTED
185 184 } papi_status_t;
186 185
187 186 /* list filter related */
188 187 typedef enum {
189 188 PAPI_FILTER_BITMASK = 0
190 189 } papi_filter_type_t;
191 190
192 191 typedef struct {
193 192 papi_filter_type_t type;
194 193 union {
195 194 struct { /* PAPI_FILTER_BITMASK */
196 195 unsigned int mask;
197 196 unsigned int value;
198 197 } bitmask;
199 198 } filter;
200 199 } papi_filter_t;
201 200
202 201 enum {
203 202 PAPI_PRINTER_LOCAL = 0x0000, /* Local destination */
204 203 PAPI_PRINTER_CLASS = 0x0001, /* Printer class */
205 204 PAPI_PRINTER_REMOTE = 0x0002, /* Remote destination */
206 205 PAPI_PRINTER_BW = 0x0004, /* Can do B&W printing */
207 206 PAPI_PRINTER_COLOR = 0x0008, /* Can do color printing */
208 207 PAPI_PRINTER_DUPLEX = 0x0010, /* Can do duplex printing */
209 208 PAPI_PRINTER_STAPLE = 0x0020, /* Can do stapling */
210 209 PAPI_PRINTER_COPIES = 0x0040, /* Can do copies */
211 210 PAPI_PRINTER_COLLATE = 0x0080, /* Can collate copies */
212 211 PAPI_PRINTER_PUNCH = 0x0100, /* Can punch output */
213 212 PAPI_PRINTER_COVER = 0x0200, /* Can cover output */
214 213 PAPI_PRINTER_BIND = 0x0400, /* Can bind output */
215 214 PAPI_PRINTER_SORT = 0x0800, /* Can sort output */
216 215 PAPI_PRINTER_SMALL = 0x1000, /* Can do letter/legal/a4 */
217 216 PAPI_PRINTER_MEDIUM = 0x2000, /* Can do tabloid/B/C/A3/A2 */
218 217 PAPI_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */
219 218 PAPI_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
220 219 PAPI_PRINTER_IMPLICIT = 0x10000, /* implicit class */
221 220 PAPI_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
222 221 PAPI_PRINTER_OPTIONS = 0xfffc /* ~ (CLASS | REMOTE | IMPLICIT) */
223 222 };
224 223
225 224 /*
226 225 * Functions
227 226 */
228 227
229 228 /* Service related */
230 229 extern papi_status_t papiServiceCreate(papi_service_t *handle,
231 230 char *service_name, char *user_name,
232 231 char *password,
233 232 int (*authCB)(papi_service_t svc,
234 233 void *app_data),
235 234 papi_encryption_t encryption,
236 235 void *app_data);
237 236 extern void papiServiceDestroy(papi_service_t handle);
238 237 extern papi_status_t papiServiceSetUserName(papi_service_t handle,
239 238 char *user_name);
240 239 extern papi_status_t papiServiceSetPassword(papi_service_t handle,
241 240 char *password);
242 241 extern papi_status_t papiServiceSetEncryption(papi_service_t handle,
243 242 papi_encryption_t encryption);
244 243 extern papi_status_t papiServiceSetAuthCB(papi_service_t handle,
245 244 int (*authCB)(papi_service_t s,
246 245 void *app_data));
247 246 extern papi_status_t papiServiceSetAppData(papi_service_t handle,
248 247 void *app_data);
↓ open down ↓ |
204 lines elided |
↑ open up ↑ |
249 248 extern char *papiServiceGetServiceName(papi_service_t handle);
250 249 extern char *papiServiceGetUserName(papi_service_t handle);
251 250 extern char *papiServiceGetPassword(papi_service_t handle);
252 251 extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle);
253 252 extern void *papiServiceGetAppData(papi_service_t handle);
254 253 extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle);
255 254 extern char *papiServiceGetStatusMessage(papi_service_t handle);
256 255
257 256 /* Attribute related */
258 257 extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
259 - int flags, char *name,
258 + int flags, const char *name,
260 259 papi_attribute_value_type_t type,
261 260 papi_attribute_value_t *value);
262 261 extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
263 262 int flags, char *name, char *string);
264 263 extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
265 264 int flags, char *name, int integer);
266 265 extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
267 - int flags, char *name, char boolean);
266 + int flags, const char *name, char boolean);
268 267 extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
269 268 int flags, char *name,
270 269 int lower, int upper);
271 270 extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
272 271 int flags, char *name,
273 272 int xres, int yres,
274 273 papi_resolution_unit_t units);
275 274 extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
276 275 int flags, char *name, time_t datetime);
277 276 extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
278 277 int flags, char *name,
279 278 papi_attribute_t **collection);
280 279 extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
281 280 int flags, char *name,
282 281 papi_metadata_t metadata);
283 282 extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
284 283 char *name);
285 284 extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
286 285 void **iterator, char *name,
287 286 papi_attribute_value_type_t type,
288 287 papi_attribute_value_t **value);
289 288 extern papi_status_t papiAttributeListGetString(papi_attribute_t **list,
290 289 void **iterator, char *name,
291 290 char **vptr);
292 291 extern papi_status_t papiAttributeListGetInteger(papi_attribute_t **list,
293 292 void **iterator, char *name, int *vptr);
294 293 extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
295 294 void **iterator, char *name,
296 295 char *vptr);
297 296 extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
298 297 void **iterator, char *name,
299 298 int *min, int *max);
300 299 extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
301 300 void **iterator, char *name,
302 301 int *x, int *y,
303 302 papi_resolution_unit_t *units);
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
304 303 extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
305 304 void **iterator, char *name,
306 305 time_t *dt);
307 306 extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
308 307 void **iterator, char *name,
309 308 papi_attribute_t ***collection);
310 309 extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
311 310 void **iterator, char *name,
312 311 papi_metadata_t *vptr);
313 312 extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
314 - char *name);
313 + const char *name);
315 314 extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
316 315 void **iterator);
317 316 extern void papiAttributeListFree(papi_attribute_t **attributes);
318 317
319 318 extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
320 319 int flags, char *string);
321 320 extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
322 321 char *delim,
323 322 char *buffer, size_t buflen);
324 323 extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list,
325 324 char *prefix_fmt, ...);
326 325
327 326 /* Printer related */
328 327 extern papi_status_t papiPrintersList(papi_service_t handle,
329 328 char **requested_attrs,
330 329 papi_filter_t *filter,
331 330 papi_printer_t **printers);
332 331 extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name,
333 332 char **requested_attrs,
334 333 papi_attribute_t **job_attributes,
335 334 papi_printer_t *printer);
336 335 extern papi_status_t papiPrinterAdd(papi_service_t handle, char *name,
337 336 papi_attribute_t **attributes,
338 337 papi_printer_t *printer);
339 338 extern papi_status_t papiPrinterModify(papi_service_t handle, char *name,
340 339 papi_attribute_t **attributes,
341 340 papi_printer_t *printer);
342 341 extern papi_status_t papiPrinterRemove(papi_service_t handle, char *name);
343 342 extern papi_status_t papiPrinterDisable(papi_service_t handle, char *name,
344 343 char *message);
345 344 extern papi_status_t papiPrinterEnable(papi_service_t handle, char *name);
346 345 extern papi_status_t papiPrinterPause(papi_service_t handle, char *name,
347 346 char *message);
348 347 extern papi_status_t papiPrinterResume(papi_service_t handle, char *name);
349 348 extern papi_status_t papiPrinterPurgeJobs(papi_service_t handle,
350 349 char *name, papi_job_t **jobs);
351 350 extern papi_status_t papiPrinterListJobs(papi_service_t handle,
352 351 char *name, char **requested_attrs,
353 352 int type_mask, int max_num_jobs,
354 353 papi_job_t **jobs);
355 354 extern papi_attribute_t **papiPrinterGetAttributeList(papi_printer_t printer);
356 355 extern void papiPrinterFree(papi_printer_t printer);
357 356 extern void papiPrinterListFree(papi_printer_t *printers);
358 357
359 358 /* Job related */
360 359 extern papi_status_t papiJobSubmit(papi_service_t handle, char *printer,
361 360 papi_attribute_t **job_attributes,
362 361 papi_job_ticket_t *job_ticket,
363 362 char **files, papi_job_t *job);
364 363 extern papi_status_t papiJobSubmitByReference(papi_service_t handle,
365 364 char *printer,
366 365 papi_attribute_t **job_attributes,
367 366 papi_job_ticket_t *job_ticket,
368 367 char **files, papi_job_t *job);
369 368 extern papi_status_t papiJobValidate(papi_service_t handle, char *printer,
370 369 papi_attribute_t **job_attributes,
371 370 papi_job_ticket_t *job_ticket,
372 371 char **files, papi_job_t *job);
373 372 extern papi_status_t papiJobStreamOpen(papi_service_t handle,
374 373 char *printer,
375 374 papi_attribute_t **job_attributes,
376 375 papi_job_ticket_t *job_ticket,
377 376 papi_stream_t *stream);
378 377 extern papi_status_t papiJobStreamWrite(papi_service_t handle,
379 378 papi_stream_t stream,
380 379 void *buffer, size_t buflen);
381 380 extern papi_status_t papiJobStreamClose(papi_service_t handle,
382 381 papi_stream_t stream,
383 382 papi_job_t *job);
384 383 extern papi_status_t papiJobQuery(papi_service_t handle, char *printer,
385 384 int32_t job_id, char **requested_attrs,
386 385 papi_job_t *job);
387 386 extern papi_status_t papiJobModify(papi_service_t handle, char *printer,
388 387 int32_t job_id,
389 388 papi_attribute_t **attributes,
390 389 papi_job_t *job);
391 390 extern papi_status_t papiJobMove(papi_service_t handle, char *printer,
392 391 int32_t job_id, char *destination);
393 392 extern papi_status_t papiJobCancel(papi_service_t handle, char *printer,
394 393 int32_t job_id);
395 394 extern papi_status_t papiJobHold(papi_service_t handle, char *printer,
396 395 int32_t job_id);
397 396 extern papi_status_t papiJobRelease(papi_service_t handle, char *printer,
398 397 int32_t job_id);
399 398 extern papi_status_t papiJobRestart(papi_service_t handle, char *printer,
400 399 int32_t job_id);
401 400 extern papi_status_t papiJobPromote(papi_service_t handle, char *printer,
402 401 int32_t job_id);
403 402 extern papi_attribute_t **papiJobGetAttributeList(papi_job_t printer);
404 403 extern char *papiJobGetPrinterName(papi_job_t printer);
405 404 extern int32_t papiJobGetId(papi_job_t printer);
406 405 extern papi_job_ticket_t *papiJobGetJobTicket(papi_job_t printer);
407 406 extern void papiJobFree(papi_job_t job);
408 407 extern void papiJobListFree(papi_job_t *jobs);
409 408
410 409 #ifdef SOLARIS_PRIVATE_POST_0_9
411 410 /*
412 411 * These have been added to support IPP create-job/send-document with PAPI v0.9
413 412 * in an IPP listener using PAPI as it's spooler interface. A future version
414 413 * of the API is expected to support this type of functionality
415 414 */
416 415 extern papi_status_t papiJobCreate(papi_service_t handle, char *printer,
417 416 papi_attribute_t **job_attributes,
418 417 papi_job_ticket_t *job_ticket,
419 418 papi_job_t *job);
420 419 extern papi_status_t papiJobStreamAdd(papi_service_t handle, char *printer,
421 420 int32_t id, papi_stream_t *stream);
422 421 extern papi_status_t papiJobCommit(papi_service_t handle, char *printer,
423 422 int32_t id);
424 423 extern papi_status_t papiServiceSetPeer(papi_service_t handle, int peerfd);
425 424 #endif /* SOLARIS_PRIVATE_POST_0_9 */
426 425
427 426 extern char *papiStatusString(papi_status_t status);
428 427
429 428 /*
430 429 * Internal functions that aren't in the API, but are shared across
431 430 * protocol support implementations(psms) and the tightly bound
432 431 * listener library. Do not use these in your applications.
433 432 */
434 433 extern void list_append();
435 434 extern void list_concatenate();
436 435 extern void list_remove();
437 436 extern void copy_attributes(papi_attribute_t ***result,
438 437 papi_attribute_t **list);
439 438 extern void split_and_copy_attributes(char **list,
440 439 papi_attribute_t **attributes,
441 440 papi_attribute_t ***in,
442 441 papi_attribute_t ***out);
443 442
444 443 extern papi_attribute_t **getprinterbyname(char *name, char *ns);
445 444
446 445 extern int is_localhost(char *hostname);
447 446
448 447 #ifdef __cplusplus
449 448 }
450 449 #endif
451 450
452 451 #endif /* _PAPI_H */
↓ open down ↓ |
128 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX