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