1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3 <!-- SECTION: Programming -->
5 <title>CUPS API
</title>
6 <meta name=
"keywords" content=
"Programming">
7 <meta http-equiv=
"Content-Type" content=
"text/html;charset=utf-8">
8 <meta name=
"creator" content=
"Mini-XML v2.7">
9 <style type=
"text/css"><!--
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
14 H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
19 font-family: monaco, courier, monospace;
24 font-family: monaco, courier, monospace;
28 border: dotted thin #7f7f7f;
44 border: dotted thin #999999;
49 PRE.command EM, PRE.example EM {
50 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
54 font-family: monaco, courier, monospace;
65 border: solid thin #999999;
76 -moz-border-radius: 10px;
81 text-decoration: none;
84 A:link:hover, A:visited:hover, A:active {
85 text-decoration: underline;
92 TR.data, TD.data, TR.data TD {
95 border-bottom: solid 1pt #999999;
99 border-bottom: solid 1pt #999999;
106 border: solid thin #999999;
107 border-collapse: collapse;
123 border: solid thin #cccccc;
130 border-bottom: solid thin #999999;
139 caption-side: bottom;
163 border: thin solid black;
171 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
180 border-bottom: solid 2pt #000000;
183 DIV.indent, TABLE.indent {
191 border-collapse: collapse;
194 TABLE.indent TD, TABLE.indent TH {
199 border-collapse: collapse;
207 border-bottom: solid thin #cccccc;
212 vertical-align: bottom;
221 border-bottom: solid thin #eeeeee;
226 TABLE.list TR:nth-child(even) {
230 TABLE.list TR:nth-child(odd) {
249 font-family: monaco, courier, monospace;
253 border: solid thin #999999;
254 border-collapse: collapse;
259 DIV.summary TABLE TD, DIV.summary TABLE TH {
260 border: solid thin #999999;
266 DIV.summary TABLE THEAD TH {
270 /* API documentation styles... */
277 div.body h3, div.body h4, div.body h5 {
278 margin-bottom: 0.5em;
281 .class, .enumeration, .function, .struct, .typedef, .union {
282 border-bottom: solid thin #999999;
289 code, p.code, pre, ul.code li {
290 font-family: monaco, courier, monospace;
293 ul.code, ul.contents, ul.subcontents {
294 list-style-type: none;
304 ul.contents li ul.code, ul.contents li ul.subcontents {
317 margin-bottom: 0.5em;
320 /* This is just for the HTML files generated with the framedhelp target */
323 border: solid thin black;
332 div.contents ul.contents {
335 div.contents ul.subcontents li {
346 CUPS API header for the Common UNIX Printing System (CUPS).
348 Copyright 2008-2009 by Apple Inc.
350 These coded instructions, statements, and computer programs are the
351 property of Apple Inc. and are protected by Federal copyright
352 law. Distribution and use rights are outlined in the file "LICENSE.txt"
353 which should have been included with this file. If this file is
354 file is missing or damaged, see the license at "http://www.cups.org/".
357 <h1 class='title'
>CUPS API
</h1>
359 <div class='summary'
><table summary='General Information'
>
373 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
374 Programming:
<a href='api-array.html' target='_top'
>Array API
</a><br>
375 Programming:
<a href='api-filedir.html' target='_top'
>File and Directory APIs
</a><br>
376 Programming:
<a href='api-filter.html' target='_top'
>Filter and Backend Programming
</a><br>
377 Programming:
<a href='api-httpipp.html' target='_top'
>HTTP and IPP APIs
</a><br>
378 Programming:
<a href='api-ppd.html' target='_top'
>PPD API
</a><br>
379 Programming:
<a href='api-raster.html' target='_top'
>Raster API
</a></td>
383 <h2 class=
"title">Contents
</h2>
384 <ul class=
"contents">
385 <li><a href=
"#OVERVIEW">Overview
</a><ul class=
"subcontents">
386 <li><a href=
"#CLIENTS_AND_SERVERS">Clients and Servers
</a></li>
387 <li><a href=
"#PRINTERS_AND_CLASSES">Printers and Classes
</a></li>
388 <li><a href=
"#OPTIONS">Options
</a></li>
389 <li><a href=
"#PRINT_JOBS">Print Jobs
</a></li>
390 <li><a href=
"#ERROR_HANDLING">Error Handling
</a></li>
391 <li><a href=
"#PASSWORDS_AND_AUTHENTICATION">Passwords and Authentication
</a></li>
393 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
394 <li><a href=
"#appleGetPaperSize" title=
"Get the default paper size.">appleGetPaperSize
</a></li>
395 <li><a href=
"#cupsAddDest" title=
"Add a destination to the list of destinations.">cupsAddDest
</a></li>
396 <li><a href=
"#cupsAddOption" title=
"Add an option to an option array.">cupsAddOption
</a></li>
397 <li><a href=
"#cupsAdminCreateWindowsPPD" title=
"Create the Windows PPD file for a printer.">cupsAdminCreateWindowsPPD
</a></li>
398 <li><a href=
"#cupsAdminExportSamba" title=
"Export a printer to Samba.">cupsAdminExportSamba
</a></li>
399 <li><a href=
"#cupsAdminGetServerSettings" title=
"Get settings from the server.">cupsAdminGetServerSettings
</a></li>
400 <li><a href=
"#cupsAdminSetServerSettings" title=
"Set settings on the server.">cupsAdminSetServerSettings
</a></li>
401 <li><a href=
"#cupsCancelJob" title=
"Cancel a print job on the default server.">cupsCancelJob
</a></li>
402 <li><a href=
"#cupsCancelJob2" title=
"Cancel or purge a print job.">cupsCancelJob2
</a></li>
403 <li><a href=
"#cupsCreateJob" title=
"Create an empty job for streaming.">cupsCreateJob
</a></li>
404 <li><a href=
"#cupsEncryption" title=
"Get the current encryption settings.">cupsEncryption
</a></li>
405 <li><a href=
"#cupsFinishDocument" title=
"Finish sending a document.">cupsFinishDocument
</a></li>
406 <li><a href=
"#cupsFreeDests" title=
"Free the memory used by the list of destinations.">cupsFreeDests
</a></li>
407 <li><a href=
"#cupsFreeJobs" title=
"Free memory used by job data.">cupsFreeJobs
</a></li>
408 <li><a href=
"#cupsFreeOptions" title=
"Free all memory used by options.">cupsFreeOptions
</a></li>
409 <li><a href=
"#cupsGetClasses" title=
"Get a list of printer classes from the default server.">cupsGetClasses
</a></li>
410 <li><a href=
"#cupsGetDefault" title=
"Get the default printer or class for the default server.">cupsGetDefault
</a></li>
411 <li><a href=
"#cupsGetDefault2" title=
"Get the default printer or class for the specified server.">cupsGetDefault2
</a></li>
412 <li><a href=
"#cupsGetDest" title=
"Get the named destination from the list.">cupsGetDest
</a></li>
413 <li><a href=
"#cupsGetDests" title=
"Get the list of destinations from the default server.">cupsGetDests
</a></li>
414 <li><a href=
"#cupsGetDests2" title=
"Get the list of destinations from the specified server.">cupsGetDests2
</a></li>
415 <li><a href=
"#cupsGetJobs" title=
"Get the jobs from the default server.">cupsGetJobs
</a></li>
416 <li><a href=
"#cupsGetJobs2" title=
"Get the jobs from the specified server.">cupsGetJobs2
</a></li>
417 <li><a href=
"#cupsGetNamedDest" title=
"Get options for the named destination.">cupsGetNamedDest
</a></li>
418 <li><a href=
"#cupsGetOption" title=
"Get an option value.">cupsGetOption
</a></li>
419 <li><a href=
"#cupsGetPPD" title=
"Get the PPD file for a printer on the default server.">cupsGetPPD
</a></li>
420 <li><a href=
"#cupsGetPPD2" title=
"Get the PPD file for a printer from the specified server.">cupsGetPPD2
</a></li>
421 <li><a href=
"#cupsGetPPD3" title=
"Get the PPD file for a printer on the specified
422 server if it has changed.">cupsGetPPD3
</a></li>
423 <li><a href=
"#cupsGetPassword" title=
"Get a password from the user.">cupsGetPassword
</a></li>
424 <li><a href=
"#cupsGetPassword2" title=
"Get a password from the user using the advanced
425 password callback.">cupsGetPassword2
</a></li>
426 <li><a href=
"#cupsGetPrinters" title=
"Get a list of printers from the default server.">cupsGetPrinters
</a></li>
427 <li><a href=
"#cupsGetServerPPD" title=
"Get an available PPD file from the server.">cupsGetServerPPD
</a></li>
428 <li><a href=
"#cupsLangDefault" title=
"Return the default language.">cupsLangDefault
</a></li>
429 <li><a href=
"#cupsLangEncoding" title=
"Return the character encoding (us-ascii, etc.)
430 for the given language.">cupsLangEncoding
</a></li>
431 <li><a href=
"#cupsLangFlush" title=
"Flush all language data out of the cache.">cupsLangFlush
</a></li>
432 <li><a href=
"#cupsLangFree" title=
"Free language data.">cupsLangFree
</a></li>
433 <li><a href=
"#cupsLangGet" title=
"Get a language.">cupsLangGet
</a></li>
434 <li><a href=
"#cupsNotifySubject" title=
"Return the subject for the given notification message.">cupsNotifySubject
</a></li>
435 <li><a href=
"#cupsNotifyText" title=
"Return the text for the given notification message.">cupsNotifyText
</a></li>
436 <li><a href=
"#cupsParseOptions" title=
"Parse options from a command-line argument.">cupsParseOptions
</a></li>
437 <li><a href=
"#cupsPrintFile" title=
"Print a file to a printer or class on the default server.">cupsPrintFile
</a></li>
438 <li><a href=
"#cupsPrintFile2" title=
"Print a file to a printer or class on the specified
439 server.">cupsPrintFile2
</a></li>
440 <li><a href=
"#cupsPrintFiles" title=
"Print one or more files to a printer or class on the
441 default server.">cupsPrintFiles
</a></li>
442 <li><a href=
"#cupsPrintFiles2" title=
"Print one or more files to a printer or class on the
443 specified server.">cupsPrintFiles2
</a></li>
444 <li><a href=
"#cupsRemoveDest" title=
"Remove a destination from the destination list.">cupsRemoveDest
</a></li>
445 <li><a href=
"#cupsRemoveOption" title=
"Remove an option from an option array.">cupsRemoveOption
</a></li>
446 <li><a href=
"#cupsServer" title=
"Return the hostname/address of the current server.">cupsServer
</a></li>
447 <li><a href=
"#cupsSetClientCertCB" title=
"Set the client certificate callback.">cupsSetClientCertCB
</a></li>
448 <li><a href=
"#cupsSetCredentials" title=
"Set the default credentials to be used for SSL/TLS
449 connections.">cupsSetCredentials
</a></li>
450 <li><a href=
"#cupsSetDefaultDest" title=
"Set the default destination.">cupsSetDefaultDest
</a></li>
451 <li><a href=
"#cupsSetDests" title=
"Save the list of destinations for the default server.">cupsSetDests
</a></li>
452 <li><a href=
"#cupsSetDests2" title=
"Save the list of destinations for the specified server.">cupsSetDests2
</a></li>
453 <li><a href=
"#cupsSetEncryption" title=
"Set the encryption preference.">cupsSetEncryption
</a></li>
454 <li><a href=
"#cupsSetPasswordCB" title=
"Set the password callback for CUPS.">cupsSetPasswordCB
</a></li>
455 <li><a href=
"#cupsSetPasswordCB2" title=
"Set the advanced password callback for CUPS.">cupsSetPasswordCB2
</a></li>
456 <li><a href=
"#cupsSetServer" title=
"Set the default server name and port.">cupsSetServer
</a></li>
457 <li><a href=
"#cupsSetServerCertCB" title=
"Set the server certificate callback.">cupsSetServerCertCB
</a></li>
458 <li><a href=
"#cupsSetUser" title=
"Set the default user name.">cupsSetUser
</a></li>
459 <li><a href=
"#cupsStartDocument" title=
"Add a document to a job created with cupsCreateJob().">cupsStartDocument
</a></li>
460 <li><a href=
"#cupsTempFd" title=
"Creates a temporary file.">cupsTempFd
</a></li>
461 <li><a href=
"#cupsTempFile" title=
"Generates a temporary filename.">cupsTempFile
</a></li>
462 <li><a href=
"#cupsTempFile2" title=
"Creates a temporary CUPS file.">cupsTempFile2
</a></li>
463 <li><a href=
"#cupsUser" title=
"Return the current user's name.">cupsUser
</a></li>
465 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
466 <li><a href=
"#cups_client_cert_cb_t" title=
"Client credentials callback ">cups_client_cert_cb_t
</a></li>
467 <li><a href=
"#cups_dest_t" title=
"Destination">cups_dest_t
</a></li>
468 <li><a href=
"#cups_device_cb_t" title=
"Device callback ">cups_device_cb_t
</a></li>
469 <li><a href=
"#cups_job_t" title=
"Job">cups_job_t
</a></li>
470 <li><a href=
"#cups_option_t" title=
"Printer Options">cups_option_t
</a></li>
471 <li><a href=
"#cups_password_cb2_t" title=
"New password callback ">cups_password_cb2_t
</a></li>
472 <li><a href=
"#cups_password_cb_t" title=
"Password callback">cups_password_cb_t
</a></li>
473 <li><a href=
"#cups_ptype_t" title=
"Printer type/capability bits">cups_ptype_t
</a></li>
474 <li><a href=
"#cups_server_cert_cb_t" title=
"Server credentials callback ">cups_server_cert_cb_t
</a></li>
476 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
477 <li><a href=
"#cups_dest_s" title=
"Destination">cups_dest_s
</a></li>
478 <li><a href=
"#cups_job_s" title=
"Job">cups_job_s
</a></li>
479 <li><a href=
"#cups_option_s" title=
"Printer Options">cups_option_s
</a></li>
481 <li><a href=
"#ENUMERATIONS">Constants
</a><ul class=
"code">
482 <li><a href=
"#cups_ptype_e" title=
"Printer type/capability bit constants">cups_ptype_e
</a></li>
488 CUPS API introduction for the Common UNIX Printing System (CUPS).
490 Copyright 2007-2010 by Apple Inc.
491 Copyright 1997-2006 by Easy Software Products, all rights reserved.
493 These coded instructions, statements, and computer programs are the
494 property of Apple Inc. and are protected by Federal copyright
495 law. Distribution and use rights are outlined in the file "LICENSE.txt"
496 which should have been included with this file. If this file is
497 file is missing or damaged, see the license at "http://www.cups.org/".
500 <h2 class='title'
><a name='OVERVIEW'
>Overview
</a></h2>
502 <p>The CUPS API provides the convenience functions needed to support
503 applications, filters, printer drivers, and backends that need to interface
504 with the CUPS scheduler.
</p>
506 <h3><a name='CLIENTS_AND_SERVERS'
>Clients and Servers
</a></h3>
508 <p>CUPS is based on the Internet Printing Protocol (
"IPP"), which allows
509 clients (applications) to communicate with a server (the scheduler) to get a
510 list of printers, send print jobs, and so forth. You identify which server
511 you want to communicate with using a pointer to the opaque structure
512 <code>http_t
</code>. All of the examples in this document use the
513 <code>CUPS_HTTP_DEFAULT
</code> constant, referring to the default connection
514 to the scheduler. The
<a href='api-httpipp.html' target='_top'
>HTTP and IPP
515 APIs
</a> document provides more information on server connections.
</p>
517 <h3><a name='PRINTERS_AND_CLASSES'
>Printers and Classes
</a></h3>
519 <p>Printers and classes (collections of printers) are accessed through
520 the
<a href=
"#cups_dest_t"><code>cups_dest_t
</code></a> structure which
521 includes the name (
<code>name
</code>), instance (
<code>instance
</code> -
522 a way of selecting certain saved options/settings), and the options and
523 attributes associated with that destination (
<code>num_options
</code> and
524 <code>options
</code>). Destinations are created using the
525 <a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> function and freed
526 using the
<a href='#cupsFreeDests'
><code>cupsFreeDests
</code></a> function.
527 The
<a href='#cupsGetDest'
><code>cupsGetDest
</code></a> function finds a
528 specific destination for printing:
</p>
530 <pre class='example'
>
531 #include
<cups/cups.h
>
533 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
534 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
535 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest =
<a href='#cupsGetDest'
>cupsGetDest
</a>(
"name", NULL, num_dests, dests);
537 /* do something wiith dest */
539 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
542 <p>Passing
<code>NULL
</code> to
543 <a href='#cupsGetDest'
><code>cupsGetDest
</code></a> for the destination name
544 will return the default destination. Similarly, passing a
<code>NULL
</code>
545 instance will return the default instance for that destination.
</p>
547 <div class='table'
><table summary='Table
1: Printer Attributes' width='
80%'
>
548 <caption>Table
1:
<a name='TABLE1'
>Printer Attributes
</a></caption>
551 <th>Attribute Name
</th>
557 <td>"auth-info-required"</td>
558 <td>The type of authentication required for printing to this
559 destination:
"none",
"username,password",
"domain,username,password",
560 or
"negotiate" (Kerberos)
</td>
563 <td>"printer-info"</td>
564 <td>The human-readable description of the destination such as
"My
568 <td>"printer-is-accepting-jobs"</td>
569 <td>"true" if the destination is accepting new jobs,
"false" if
573 <td>"printer-is-shared"</td>
574 <td>"true" if the destination is being shared with other computers,
578 <td>"printer-location"</td>
579 <td>The human-readable location of the destination such as
"Lab 4".
</td>
582 <td>"printer-make-and-model"</td>
583 <td>The human-readable make and model of the destination such as
"HP
584 LaserJet 4000 Series".
</td>
587 <td>"printer-state"</td>
588 <td>"3" if the destination is idle,
"4" if the destination is printing
589 a job, and
"5" if the destination is stopped.
</td>
592 <td>"printer-state-change-time"</td>
593 <td>The UNIX time when the destination entered the current state.
</td>
596 <td>"printer-state-reasons"</td>
597 <td>Additional comma-delimited state keywords for the destination
598 such as
"media-tray-empty-error" and
"toner-low-warning".
</td>
601 <td>"printer-type"</td>
602 <td>The
<a href='#cups_printer_t'
><code>cups_printer_t
</code></a>
603 value associated with the destination.
</td>
608 <h3><a name='OPTIONS'
>Options
</a></h3>
610 <p>Options are stored in arrays of
611 <a href='#cups_option_t'
><code>cups_option_t
</code></a> structures. Each
612 option has a name (
<code>name
</code>) and value (
<code>value
</code>)
613 associated with it. The
<a href='#cups_dest_t'
><code>cups_dest_t
</code></a>
614 <code>num_options
</code> and
<code>options
</code> members contain the
615 default options for a particular destination, along with several informational
616 attributes about the destination as shown in
<a href='#TABLE1'
>Table
1</a>.
617 The
<a href='#cupsGetOption'
><code>cupsGetOption
</code></a> function gets
618 the value for the named option. For example, the following code lists the
619 available destinations and their human-readable descriptions:
</p>
621 <pre class='example'
>
622 #include
<cups/cups.h
>
624 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
625 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
626 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
630 for (i = num_dests, dest = dests; i
> 0; i --, dest ++)
631 if (dest-
>instance == NULL)
633 value =
<a href='#cupsGetOption'
>cupsGetOption
</a>(
"printer-info", dest-
>num_options, dest-
>options);
634 printf(
"%s (%s)\n", dest-
>name, value ? value :
"no description");
637 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
640 <p>You can create your own option arrays using the
641 <a href='#cupsAddOption'
><code>cupsAddOption
</code></a> function, which
642 adds a single named option to an array:
</p>
644 <pre class='example'
>
645 #include
<cups/cups.h
>
648 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
650 /* The returned num_options value is updated as needed */
651 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"value", num_options,
&options);
653 /* This adds a second option value */
654 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"second",
"value", num_options,
&options);
656 /* This replaces the first option we added */
657 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"new value", num_options,
&options);
660 <p>Use a
<code>for
</code> loop to copy the options from a destination:
</p>
662 <pre class='example'
>
663 #include
<cups/cups.h
>
667 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
668 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
670 for (i =
0; i < dest-
>num_options; i ++)
671 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(dest-
>options[i].name, dest-
>options[i].value,
672 num_options,
&options);
675 <p>Use the
<a href='#cupsFreeOptions'
><code>cupsFreeOptions
</code></a>
676 function to free the options array when you are done using it:
</p>
678 <pre class='example'
>
679 <a href='#cupsFreeOptions'
>cupsFreeOptions
</a>(num_options, options);
682 <h3><a name='PRINT_JOBS'
>Print Jobs
</a></h3>
684 <p>Print jobs are identified by a locally-unique job ID number from
1 to
685 2<sup>31</sup>-
1 and have options and one or more files for printing to a
686 single destination. The
<a href='#cupsPrintFile'
><code>cupsPrintFile
</code></a>
687 function creates a new job with one file. The following code prints the CUPS
690 <pre class='example'
>
691 #include
<cups/cups.h
>
693 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
695 <a href='#cups_option_t'
>cups_option_t
</a> *options;
698 /* Print a single file */
699 job_id =
<a href='#cupsPrintFile'
>cupsPrintFile
</a>(dest-
>name,
"/usr/share/cups/data/testprint.ps",
700 "Test Print", num_options, options);
703 <p>The
<a href='#cupsPrintFiles'
><code>cupsPrintFiles
</code></a> function
704 creates a job with multiple files. The files are provided in a
705 <code>char *
</code> array:
</p>
707 <pre class='example'
>
708 #include
<cups/cups.h
>
710 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
712 <a href='#cups_option_t'
>cups_option_t
</a> *options;
714 char *files[
3] = {
"file1.pdf",
"file2.pdf",
"file3.pdf" };
716 /* Print three files */
717 job_id =
<a href='#cupsPrintFiles'
>cupsPrintFiles
</a>(dest-
>name,
3, files,
"Test Print", num_options, options);
720 <p>Finally, the
<a href='#cupsCreateJob'
><code>cupsCreateJob
</code></a>
721 function creates a new job with no files in it. Files are added using the
722 <a href='#cupsStartDocument'
><code>cupsStartDocument
</code></a>,
723 <a href='api-httpipp.html#cupsWriteRequestData'
><code>cupsWriteRequestData
</code></a>,
724 and
<a href='#cupsFinishDocument'
><code>cupsFinishDocument
</code></a> functions.
725 The following example creates a job with
10 text files for printing:
</p>
727 <pre class='example'
>
728 #include
<cups/cups.h
>
730 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
732 <a href='#cups_option_t'
>cups_option_t
</a> *options;
738 job_id =
<a href='#cupsCreateJob'
>cupsCreateJob
</a>(CUPS_HTTP_DEFAULT, dest-
>name,
"10 Text Files",
739 num_options, options);
741 /* If the job is created, add
10 files */
744 for (i =
1; i
<=
10; i ++)
746 snprintf(buffer, sizeof(buffer),
"file%d.txt", i);
748 <a href='#cupsStartDocument'
>cupsStartDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name, job_id, buffer,
749 CUPS_FORMAT_TEXT, i ==
10);
751 snprintf(buffer, sizeof(buffer),
759 /* cupsWriteRequestData can be called as many times as needed */
760 <a href='#cupsWriteRequestData'
>cupsWriteRequestData
</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
762 <a href='#cupsFinishDocument'
>cupsFinishDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name);
767 <p>Once you have created a job, you can monitor its status using the
768 <a href='#cupsGetJobs'
><code>cupsGetJobs
</code></a> function, which returns
769 an array of
<a href='#cups_job_t'
><code>cups_job_t
</code></a> structures.
770 Each contains the job ID (
<code>id
</code>), destination name
771 (
<code>dest
</code>), title (
<code>title
</code>), and other information
772 associated with the job. The job array is freed using the
773 <a href='#cupsFreeJobs'
><code>cupsFreeJobs
</code></a> function. The following
774 example monitors a specific job ID, showing the current job state once every
775 5 seconds until the job is completed:
</p>
777 <pre class='example'
>
778 #include
<cups/cups.h
>
780 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
783 <a href='#cups_job_t'
>cups_job_t
</a> *jobs;
785 ipp_jstate_t job_state = IPP_JOB_PENDING;
787 while (job_state
< IPP_JOB_STOPPED)
789 /* Get my jobs (
1) with any state (-
1) */
790 num_jobs =
<a href='#cupsGetJobs'
>cupsGetJobs
</a>(
&jobs, dest-
>name,
1, -
1);
792 /* Loop to find my job */
793 job_state = IPP_JOB_COMPLETED;
795 for (i =
0; i
< num_jobs; i ++)
796 if (jobs[i].id == job_id)
798 job_state = jobs[i].state;
802 /* Free the job array */
803 <a href='#cupsFreeJobs'
>cupsFreeJobs
</a>(num_jobs, jobs);
805 /* Show the current state */
808 case IPP_JOB_PENDING :
809 printf(
"Job %d is pending.\n", job_id);
812 printf(
"Job %d is held.\n", job_id);
814 case IPP_JOB_PROCESSING :
815 printf(
"Job %d is processing.\n", job_id);
817 case IPP_JOB_STOPPED :
818 printf(
"Job %d is stopped.\n", job_id);
820 case IPP_JOB_CANCELED :
821 printf(
"Job %d is canceled.\n", job_id);
823 case IPP_JOB_ABORTED :
824 printf(
"Job %d is aborted.\n", job_id);
826 case IPP_JOB_COMPLETED :
827 printf(
"Job %d is completed.\n", job_id);
831 /* Sleep if the job is not finished */
832 if (job_state
< IPP_JOB_STOPPED)
837 <p>To cancel a job, use the
838 <a href='#cupsCancelJob'
><code>cupsCancelJob
</code></a> function with the
841 <pre class='example'
>
842 #include
<cups/cups.h
>
844 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
847 <a href='#cupsCancelJob'
>cupsCancelJob
</a>(dest-
>name, job_id);
850 <h3><a name='ERROR_HANDLING'
>Error Handling
</a></h3>
852 <p>If any of the CUPS API printing functions returns an error, the reason for
853 that error can be found by calling the
854 <a href='#cupsLastError'
><code>cupsLastError
</code></a> and
855 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> functions.
856 <a href='#cupsLastError'
><code>cupsLastError
</code></a> returns the last IPP
858 (
<a href='api-httpipp.html#ipp_status_t'
><code>ipp_status_t
</code></a>)
859 that was encountered, while
860 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> returns
861 a (localized) human-readable string that can be shown to the user. For example,
862 if any of the job creation functions returns a job ID of
0, you can use
863 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> to show
864 the reason why the job could not be created:
</p>
866 <pre class='example'
>
867 #include
<cups/cups.h
>
872 puts(cupsLastErrorString());
875 <h3><a name='PASSWORDS_AND_AUTHENTICATION'
>Passwords and Authentication
</a></h3>
877 <p>CUPS supports authentication of any request, including submission of print
878 jobs. The default mechanism for getting the username and password is to use the
879 login user and a password from the console.
</p>
881 <p>To support other types of applications, in particular Graphical User
882 Interfaces (
"GUIs"), the CUPS API provides functions to set the default
883 username and to register a callback function that returns a password string.
</p>
885 <p>The
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a>
886 function is used to set a password callback in your program. Only one
887 function can be used at any time.
</p>
889 <p>The
<a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function sets the
890 current username for authentication. This function can be called by your
891 password callback function to change the current username as needed.
</p>
893 <p>The following example shows a simple password callback that gets a
894 username and password from the user:
</p>
896 <pre class='example'
>
897 #include
<cups/cups.h
>
900 my_password_cb(const char *prompt)
907 /* Get a username from the user */
908 printf(
"Username: ");
909 if (fgets(user, sizeof(user), stdin) == NULL)
912 /* Strip the newline from the string and set the user */
913 user[strlen(user) -
1] = '\
0';
915 <a href='#cupsSetUser'
>cupsSetUser
</a>(user);
917 /* Use getpass() to ask for the password... */
918 return (getpass(
"Password: "));
921 <a href='#cupsSetPasswordCB'
>cupsSetPasswordCB
</a>(my_password_cb);
924 <p>Similarly, a GUI could display the prompt string in a window with input
925 fields for the username and password. The username should default to the
926 string returned by the
<a href=
"#cupsUser"><code>cupsUser
</code></a>
928 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
929 <h3 class=
"function"><a name=
"appleGetPaperSize">appleGetPaperSize
</a></h3>
930 <p class=
"description">Get the default paper size.
</p>
932 char *appleGetPaperSize (
<br>
933 char *name,
<br>
934 int namesize
<br>
936 <h4 class=
"parameters">Parameters
</h4>
939 <dd class=
"description">Paper size name buffer
</dd>
941 <dd class=
"description">Size of buffer
</dd>
943 <h4 class=
"returnvalue">Return Value
</h4>
944 <p class=
"description">Default paper size
</p>
945 <h3 class=
"function"><a name=
"cupsAddDest">cupsAddDest
</a></h3>
946 <p class=
"description">Add a destination to the list of destinations.
</p>
948 int cupsAddDest (
<br>
949 const char *name,
<br>
950 const char *instance,
<br>
951 int num_dests,
<br>
952 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
954 <h4 class=
"parameters">Parameters
</h4>
957 <dd class=
"description">Destination name
</dd>
959 <dd class=
"description">Instance name or
<code>NULL
</code> for none/primary
</dd>
961 <dd class=
"description">Number of destinations
</dd>
963 <dd class=
"description">Destinations
</dd>
965 <h4 class=
"returnvalue">Return Value
</h4>
966 <p class=
"description">New number of destinations
</p>
967 <h4 class=
"discussion">Discussion
</h4>
968 <p class=
"discussion">This function cannot be used to add a new class or printer queue,
969 it only adds a new container of saved options for the named
970 destination or instance.
<br>
972 If the named destination already exists, the destination list is
973 returned unchanged. Adding a new instance of a destination creates
974 a copy of that destination's options.
<br>
976 Use the
<a href=
"#cupsSaveDests"><code>cupsSaveDests
</code></a> function to save the updated list of
977 destinations to the user's lpoptions file.
</p>
978 <h3 class=
"function"><a name=
"cupsAddOption">cupsAddOption
</a></h3>
979 <p class=
"description">Add an option to an option array.
</p>
981 int cupsAddOption (
<br>
982 const char *name,
<br>
983 const char *value,
<br>
984 int num_options,
<br>
985 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
987 <h4 class=
"parameters">Parameters
</h4>
990 <dd class=
"description">Name of option
</dd>
992 <dd class=
"description">Value of option
</dd>
994 <dd class=
"description">Number of options
</dd>
996 <dd class=
"description">Pointer to options
</dd>
998 <h4 class=
"returnvalue">Return Value
</h4>
999 <p class=
"description">Number of options
</p>
1000 <h4 class=
"discussion">Discussion
</h4>
1001 <p class=
"discussion">New option arrays can be initialized simply by passing
0 for the
1002 "num_options
" parameter.
</p>
1003 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD
</a></h3>
1004 <p class=
"description">Create the Windows PPD file for a printer.
</p>
1006 char *cupsAdminCreateWindowsPPD (
<br>
1007 http_t *http,
<br>
1008 const char *dest,
<br>
1009 char *buffer,
<br>
1010 int bufsize
<br>
1012 <h4 class=
"parameters">Parameters
</h4>
1015 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1017 <dd class=
"description">Printer or class
</dd>
1019 <dd class=
"description">Filename buffer
</dd>
1021 <dd class=
"description">Size of filename buffer
</dd>
1023 <h4 class=
"returnvalue">Return Value
</h4>
1024 <p class=
"description">PPD file or NULL
</p>
1025 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsAdminExportSamba">cupsAdminExportSamba
</a></h3>
1026 <p class=
"description">Export a printer to Samba.
</p>
1028 int cupsAdminExportSamba (
<br>
1029 const char *dest,
<br>
1030 const char *ppd,
<br>
1031 const char *samba_server,
<br>
1032 const char *samba_user,
<br>
1033 const char *samba_password,
<br>
1034 FILE *logfile
<br>
1036 <h4 class=
"parameters">Parameters
</h4>
1039 <dd class=
"description">Destination to export
</dd>
1041 <dd class=
"description">PPD file
</dd>
1042 <dt>samba_server
</dt>
1043 <dd class=
"description">Samba server
</dd>
1045 <dd class=
"description">Samba username
</dd>
1046 <dt>samba_password
</dt>
1047 <dd class=
"description">Samba password
</dd>
1049 <dd class=
"description">Log file, if any
</dd>
1051 <h4 class=
"returnvalue">Return Value
</h4>
1052 <p class=
"description">1 on success,
0 on failure
</p>
1053 <h3 class=
"function"><span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span><a name=
"cupsAdminGetServerSettings">cupsAdminGetServerSettings
</a></h3>
1054 <p class=
"description">Get settings from the server.
</p>
1056 int cupsAdminGetServerSettings (
<br>
1057 http_t *http,
<br>
1058 int *num_settings,
<br>
1059 <a href=
"#cups_option_t">cups_option_t
</a> **settings
<br>
1061 <h4 class=
"parameters">Parameters
</h4>
1064 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1065 <dt>num_settings
</dt>
1066 <dd class=
"description">Number of settings
</dd>
1068 <dd class=
"description">Settings
</dd>
1070 <h4 class=
"returnvalue">Return Value
</h4>
1071 <p class=
"description">1 on success,
0 on failure
</p>
1072 <h4 class=
"discussion">Discussion
</h4>
1073 <p class=
"discussion">The returned settings should be freed with cupsFreeOptions() when
1074 you are done with them.
1077 <h3 class=
"function"><span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span><a name=
"cupsAdminSetServerSettings">cupsAdminSetServerSettings
</a></h3>
1078 <p class=
"description">Set settings on the server.
</p>
1080 int cupsAdminSetServerSettings (
<br>
1081 http_t *http,
<br>
1082 int num_settings,
<br>
1083 <a href=
"#cups_option_t">cups_option_t
</a> *settings
<br>
1085 <h4 class=
"parameters">Parameters
</h4>
1088 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1089 <dt>num_settings
</dt>
1090 <dd class=
"description">Number of settings
</dd>
1092 <dd class=
"description">Settings
</dd>
1094 <h4 class=
"returnvalue">Return Value
</h4>
1095 <p class=
"description">1 on success,
0 on failure
</p>
1096 <h3 class=
"function"><a name=
"cupsCancelJob">cupsCancelJob
</a></h3>
1097 <p class=
"description">Cancel a print job on the default server.
</p>
1099 int cupsCancelJob (
<br>
1100 const char *name,
<br>
1101 int job_id
<br>
1103 <h4 class=
"parameters">Parameters
</h4>
1106 <dd class=
"description">Name of printer or class
</dd>
1108 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1110 <h4 class=
"returnvalue">Return Value
</h4>
1111 <p class=
"description">1 on success,
0 on failure
</p>
1112 <h4 class=
"discussion">Discussion
</h4>
1113 <p class=
"discussion">Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1114 to cancel the current job on the named destination.
<br>
1116 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1117 the cause of any failure.
</p>
1118 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsCancelJob2">cupsCancelJob2
</a></h3>
1119 <p class=
"description">Cancel or purge a print job.
</p>
1121 ipp_status_t cupsCancelJob2 (
<br>
1122 http_t *http,
<br>
1123 const char *name,
<br>
1124 int job_id,
<br>
1125 int purge
<br>
1127 <h4 class=
"parameters">Parameters
</h4>
1130 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1132 <dd class=
"description">Name of printer or class
</dd>
1134 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1136 <dd class=
"description">1 to purge,
0 to cancel
</dd>
1138 <h4 class=
"returnvalue">Return Value
</h4>
1139 <p class=
"description">IPP status
</p>
1140 <h4 class=
"discussion">Discussion
</h4>
1141 <p class=
"discussion">Canceled jobs remain in the job history while purged jobs are removed
1142 from the job history.
<br>
1144 Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1145 to cancel the current job on the named destination.
<br>
1147 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1148 the cause of any failure.
1151 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsCreateJob">cupsCreateJob
</a></h3>
1152 <p class=
"description">Create an empty job for streaming.
</p>
1154 int cupsCreateJob (
<br>
1155 http_t *http,
<br>
1156 const char *name,
<br>
1157 const char *title,
<br>
1158 int num_options,
<br>
1159 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1161 <h4 class=
"parameters">Parameters
</h4>
1164 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1166 <dd class=
"description">Destination name
</dd>
1168 <dd class=
"description">Title of job
</dd>
1169 <dt>num_options
</dt>
1170 <dd class=
"description">Number of options
</dd>
1172 <dd class=
"description">Options
</dd>
1174 <h4 class=
"returnvalue">Return Value
</h4>
1175 <p class=
"description">Job ID or
0 on error
</p>
1176 <h4 class=
"discussion">Discussion
</h4>
1177 <p class=
"discussion">Use this function when you want to stream print data using the
1178 <a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>,
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a>, and
1179 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> functions. If you have one or more files to
1180 print, use the
<a href=
"#cupsPrintFile2"><code>cupsPrintFile2
</code></a> or
<a href=
"#cupsPrintFiles2"><code>cupsPrintFiles2
</code></a> function
1184 <h3 class=
"function"><a name=
"cupsEncryption">cupsEncryption
</a></h3>
1185 <p class=
"description">Get the current encryption settings.
</p>
1187 http_encryption_t cupsEncryption (void);
</p>
1188 <h4 class=
"returnvalue">Return Value
</h4>
1189 <p class=
"description">Encryption settings
</p>
1190 <h4 class=
"discussion">Discussion
</h4>
1191 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
1192 environment variable, then the ~/.cups/client.conf file, and finally the
1193 /etc/cups/client.conf file. If not set, the default is
1194 <code>HTTP_ENCRYPT_IF_REQUESTED
</code>.
<br>
1196 Note: The current encryption setting is tracked separately for each thread
1197 in a program. Multi-threaded programs that override the setting via the
1198 <a href=
"#cupsSetEncryption"><code>cupsSetEncryption
</code></a> function need to do so in each thread for the same
1199 setting to be used.
</p>
1200 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsFinishDocument">cupsFinishDocument
</a></h3>
1201 <p class=
"description">Finish sending a document.
</p>
1203 ipp_status_t cupsFinishDocument (
<br>
1204 http_t *http,
<br>
1205 const char *name
<br>
1207 <h4 class=
"parameters">Parameters
</h4>
1210 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1212 <dd class=
"description">Destination name
</dd>
1214 <h4 class=
"returnvalue">Return Value
</h4>
1215 <p class=
"description">Status of document submission
</p>
1216 <h4 class=
"discussion">Discussion
</h4>
1217 <p class=
"discussion">The document must have been started using
<a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>.
1220 <h3 class=
"function"><a name=
"cupsFreeDests">cupsFreeDests
</a></h3>
1221 <p class=
"description">Free the memory used by the list of destinations.
</p>
1223 void cupsFreeDests (
<br>
1224 int num_dests,
<br>
1225 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1227 <h4 class=
"parameters">Parameters
</h4>
1230 <dd class=
"description">Number of destinations
</dd>
1232 <dd class=
"description">Destinations
</dd>
1234 <h3 class=
"function"><a name=
"cupsFreeJobs">cupsFreeJobs
</a></h3>
1235 <p class=
"description">Free memory used by job data.
</p>
1237 void cupsFreeJobs (
<br>
1238 int num_jobs,
<br>
1239 <a href=
"#cups_job_t">cups_job_t
</a> *jobs
<br>
1241 <h4 class=
"parameters">Parameters
</h4>
1244 <dd class=
"description">Number of jobs
</dd>
1246 <dd class=
"description">Jobs
</dd>
1248 <h3 class=
"function"><a name=
"cupsFreeOptions">cupsFreeOptions
</a></h3>
1249 <p class=
"description">Free all memory used by options.
</p>
1251 void cupsFreeOptions (
<br>
1252 int num_options,
<br>
1253 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1255 <h4 class=
"parameters">Parameters
</h4>
1257 <dt>num_options
</dt>
1258 <dd class=
"description">Number of options
</dd>
1260 <dd class=
"description">Pointer to options
</dd>
1262 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetClasses">cupsGetClasses
</a></h3>
1263 <p class=
"description">Get a list of printer classes from the default server.
</p>
1265 int cupsGetClasses (
<br>
1266 char ***classes
<br>
1268 <h4 class=
"parameters">Parameters
</h4>
1271 <dd class=
"description">Classes
</dd>
1273 <h4 class=
"returnvalue">Return Value
</h4>
1274 <p class=
"description">Number of classes
</p>
1275 <h4 class=
"discussion">Discussion
</h4>
1276 <p class=
"discussion">This function is deprecated - use
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
1279 <h3 class=
"function"><a name=
"cupsGetDefault">cupsGetDefault
</a></h3>
1280 <p class=
"description">Get the default printer or class for the default server.
</p>
1282 const char *cupsGetDefault (void);
</p>
1283 <h4 class=
"returnvalue">Return Value
</h4>
1284 <p class=
"description">Default printer or
<code>NULL
</code></p>
1285 <h4 class=
"discussion">Discussion
</h4>
1286 <p class=
"discussion">This function returns the default printer or class as defined by
1287 the LPDEST or PRINTER environment variables. If these environment
1288 variables are not set, the server default destination is returned.
1289 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1290 functions to get the user-defined default printer, as this function does
1291 not support the lpoptions-defined default printer.
</p>
1292 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsGetDefault2">cupsGetDefault2
</a></h3>
1293 <p class=
"description">Get the default printer or class for the specified server.
</p>
1295 const char *cupsGetDefault2 (
<br>
1296 http_t *http
<br>
1298 <h4 class=
"parameters">Parameters
</h4>
1301 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1303 <h4 class=
"returnvalue">Return Value
</h4>
1304 <p class=
"description">Default printer or
<code>NULL
</code></p>
1305 <h4 class=
"discussion">Discussion
</h4>
1306 <p class=
"discussion">This function returns the default printer or class as defined by
1307 the LPDEST or PRINTER environment variables. If these environment
1308 variables are not set, the server default destination is returned.
1309 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1310 functions to get the user-defined default printer, as this function does
1311 not support the lpoptions-defined default printer.
1314 <h3 class=
"function"><a name=
"cupsGetDest">cupsGetDest
</a></h3>
1315 <p class=
"description">Get the named destination from the list.
</p>
1317 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetDest (
<br>
1318 const char *name,
<br>
1319 const char *instance,
<br>
1320 int num_dests,
<br>
1321 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1323 <h4 class=
"parameters">Parameters
</h4>
1326 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
1328 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
1330 <dd class=
"description">Number of destinations
</dd>
1332 <dd class=
"description">Destinations
</dd>
1334 <h4 class=
"returnvalue">Return Value
</h4>
1335 <p class=
"description">Destination pointer or
<code>NULL
</code></p>
1336 <h4 class=
"discussion">Discussion
</h4>
1337 <p class=
"discussion">Use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> or
<a href=
"#cupsGetDests2"><code>cupsGetDests2
</code></a> functions to get a
1338 list of supported destinations for the current user.
</p>
1339 <h3 class=
"function"><a name=
"cupsGetDests">cupsGetDests
</a></h3>
1340 <p class=
"description">Get the list of destinations from the default server.
</p>
1342 int cupsGetDests (
<br>
1343 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1345 <h4 class=
"parameters">Parameters
</h4>
1348 <dd class=
"description">Destinations
</dd>
1350 <h4 class=
"returnvalue">Return Value
</h4>
1351 <p class=
"description">Number of destinations
</p>
1352 <h4 class=
"discussion">Discussion
</h4>
1353 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
1354 printer-info, printer-is-accepting-jobs, printer-is-shared,
1355 printer-make-and-model, printer-state, printer-state-change-time,
1356 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
1357 adds the marker-change-time, marker-colors, marker-high-levels,
1358 marker-levels, marker-low-levels, marker-message, marker-names,
1359 marker-types, and printer-commands attributes as well.
<br>
1361 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
1362 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
</p>
1363 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsGetDests2">cupsGetDests2
</a></h3>
1364 <p class=
"description">Get the list of destinations from the specified server.
</p>
1366 int cupsGetDests2 (
<br>
1367 http_t *http,
<br>
1368 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1370 <h4 class=
"parameters">Parameters
</h4>
1373 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1375 <dd class=
"description">Destinations
</dd>
1377 <h4 class=
"returnvalue">Return Value
</h4>
1378 <p class=
"description">Number of destinations
</p>
1379 <h4 class=
"discussion">Discussion
</h4>
1380 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
1381 printer-info, printer-is-accepting-jobs, printer-is-shared,
1382 printer-make-and-model, printer-state, printer-state-change-time,
1383 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
1384 adds the marker-change-time, marker-colors, marker-high-levels,
1385 marker-levels, marker-low-levels, marker-message, marker-names,
1386 marker-types, and printer-commands attributes as well.
<br>
1388 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
1389 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
1392 <h3 class=
"function"><a name=
"cupsGetJobs">cupsGetJobs
</a></h3>
1393 <p class=
"description">Get the jobs from the default server.
</p>
1395 int cupsGetJobs (
<br>
1396 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
1397 const char *name,
<br>
1398 int myjobs,
<br>
1399 int whichjobs
<br>
1401 <h4 class=
"parameters">Parameters
</h4>
1404 <dd class=
"description">Job data
</dd>
1406 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
1408 <dd class=
"description">0 = all users,
1 = mine
</dd>
1410 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
1412 <h4 class=
"returnvalue">Return Value
</h4>
1413 <p class=
"description">Number of jobs
</p>
1414 <h4 class=
"discussion">Discussion
</h4>
1415 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
1416 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
1417 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
1418 jobs that are stopped, canceled, aborted, or completed.
</p>
1419 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsGetJobs2">cupsGetJobs2
</a></h3>
1420 <p class=
"description">Get the jobs from the specified server.
</p>
1422 int cupsGetJobs2 (
<br>
1423 http_t *http,
<br>
1424 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
1425 const char *name,
<br>
1426 int myjobs,
<br>
1427 int whichjobs
<br>
1429 <h4 class=
"parameters">Parameters
</h4>
1432 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1434 <dd class=
"description">Job data
</dd>
1436 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
1438 <dd class=
"description">0 = all users,
1 = mine
</dd>
1440 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
1442 <h4 class=
"returnvalue">Return Value
</h4>
1443 <p class=
"description">Number of jobs
</p>
1444 <h4 class=
"discussion">Discussion
</h4>
1445 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
1446 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
1447 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
1448 jobs that are stopped, canceled, aborted, or completed.
1451 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsGetNamedDest">cupsGetNamedDest
</a></h3>
1452 <p class=
"description">Get options for the named destination.
</p>
1454 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetNamedDest (
<br>
1455 http_t *http,
<br>
1456 const char *name,
<br>
1457 const char *instance
<br>
1459 <h4 class=
"parameters">Parameters
</h4>
1462 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1464 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
1466 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
1468 <h4 class=
"returnvalue">Return Value
</h4>
1469 <p class=
"description">Destination or
<code>NULL
</code></p>
1470 <h4 class=
"discussion">Discussion
</h4>
1471 <p class=
"discussion">This function is optimized for retrieving a single destination and should
1472 be used instead of
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> when you either
1473 know the name of the destination or want to print to the default destination.
1474 If
<code>NULL
</code> is returned, the destination does not exist or there is no
1475 default destination.
<br>
1477 If
"http
" is
<code>CUPS_HTTP_DEFAULT
</code>, the connection to the default print
1478 server will be used.
<br>
1480 If
"name
" is
<code>NULL
</code>, the default printer for the current user will be
1483 The returned destination must be freed using
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> with a
1484 "num_dests
" value of
1.
1487 <h3 class=
"function"><a name=
"cupsGetOption">cupsGetOption
</a></h3>
1488 <p class=
"description">Get an option value.
</p>
1490 const char *cupsGetOption (
<br>
1491 const char *name,
<br>
1492 int num_options,
<br>
1493 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1495 <h4 class=
"parameters">Parameters
</h4>
1498 <dd class=
"description">Name of option
</dd>
1499 <dt>num_options
</dt>
1500 <dd class=
"description">Number of options
</dd>
1502 <dd class=
"description">Options
</dd>
1504 <h4 class=
"returnvalue">Return Value
</h4>
1505 <p class=
"description">Option value or
<code>NULL
</code></p>
1506 <h3 class=
"function"><a name=
"cupsGetPPD">cupsGetPPD
</a></h3>
1507 <p class=
"description">Get the PPD file for a printer on the default server.
</p>
1509 const char *cupsGetPPD (
<br>
1510 const char *name
<br>
1512 <h4 class=
"parameters">Parameters
</h4>
1515 <dd class=
"description">Destination name
</dd>
1517 <h4 class=
"returnvalue">Return Value
</h4>
1518 <p class=
"description">Filename for PPD file
</p>
1519 <h4 class=
"discussion">Discussion
</h4>
1520 <p class=
"discussion">For classes,
<code>cupsGetPPD
</code> returns the PPD file for the first printer
1523 The returned filename is stored in a static buffer and is overwritten with
1524 each call to
<code>cupsGetPPD
</code> or
<a href=
"#cupsGetPPD2"><code>cupsGetPPD2
</code></a>. The caller
"owns
" the
1525 file that is created and must
<code>unlink
</code> the returned filename.
</p>
1526 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsGetPPD2">cupsGetPPD2
</a></h3>
1527 <p class=
"description">Get the PPD file for a printer from the specified server.
</p>
1529 const char *cupsGetPPD2 (
<br>
1530 http_t *http,
<br>
1531 const char *name
<br>
1533 <h4 class=
"parameters">Parameters
</h4>
1536 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1538 <dd class=
"description">Destination name
</dd>
1540 <h4 class=
"returnvalue">Return Value
</h4>
1541 <p class=
"description">Filename for PPD file
</p>
1542 <h4 class=
"discussion">Discussion
</h4>
1543 <p class=
"discussion">For classes,
<code>cupsGetPPD2
</code> returns the PPD file for the first printer
1546 The returned filename is stored in a static buffer and is overwritten with
1547 each call to
<a href=
"#cupsGetPPD"><code>cupsGetPPD
</code></a> or
<code>cupsGetPPD2
</code>. The caller
"owns
" the
1548 file that is created and must
<code>unlink
</code> the returned filename.
1551 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsGetPPD3">cupsGetPPD3
</a></h3>
1552 <p class=
"description">Get the PPD file for a printer on the specified
1553 server if it has changed.
</p>
1555 http_status_t cupsGetPPD3 (
<br>
1556 http_t *http,
<br>
1557 const char *name,
<br>
1558 time_t *modtime,
<br>
1559 char *buffer,
<br>
1560 size_t bufsize
<br>
1562 <h4 class=
"parameters">Parameters
</h4>
1565 <dd class=
"description">HTTP connection or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1567 <dd class=
"description">Destination name
</dd>
1569 <dd class=
"description">Modification time
</dd>
1571 <dd class=
"description">Filename buffer
</dd>
1573 <dd class=
"description">Size of filename buffer
</dd>
1575 <h4 class=
"returnvalue">Return Value
</h4>
1576 <p class=
"description">HTTP status
</p>
1577 <h4 class=
"discussion">Discussion
</h4>
1578 <p class=
"discussion">The
"modtime
" parameter contains the modification time of any
1579 locally-cached content and is updated with the time from the PPD file on
1582 The
"buffer
" parameter contains the local PPD filename. If it contains
1583 the empty string, a new temporary file is created, otherwise the existing
1584 file will be overwritten as needed. The caller
"owns
" the file that is
1585 created and must
<code>unlink
</code> the returned filename.
<br>
1587 On success,
<code>HTTP_OK
</code> is returned for a new PPD file and
1588 <code>HTTP_NOT_MODIFIED
</code> if the existing PPD file is up-to-date. Any other
1589 status is an error.
<br>
1591 For classes,
<code>cupsGetPPD3
</code> returns the PPD file for the first printer
1595 <h3 class=
"function"><a name=
"cupsGetPassword">cupsGetPassword
</a></h3>
1596 <p class=
"description">Get a password from the user.
</p>
1598 const char *cupsGetPassword (
<br>
1599 const char *prompt
<br>
1601 <h4 class=
"parameters">Parameters
</h4>
1604 <dd class=
"description">Prompt string
</dd>
1606 <h4 class=
"returnvalue">Return Value
</h4>
1607 <p class=
"description">Password
</p>
1608 <h4 class=
"discussion">Discussion
</h4>
1609 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
1610 user does not provide a password.
<br>
1612 Note: The current password callback function is tracked separately for each
1613 thread in a program. Multi-threaded programs that override the setting via
1614 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
1615 do so in each thread for the same function to be used.
</p>
1616 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsGetPassword2">cupsGetPassword2
</a></h3>
1617 <p class=
"description">Get a password from the user using the advanced
1618 password callback.
</p>
1620 const char *cupsGetPassword2 (
<br>
1621 const char *prompt,
<br>
1622 http_t *http,
<br>
1623 const char *method,
<br>
1624 const char *resource
<br>
1626 <h4 class=
"parameters">Parameters
</h4>
1629 <dd class=
"description">Prompt string
</dd>
1631 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1633 <dd class=
"description">Request method (
"GET
",
"POST
",
"PUT
")
</dd>
1635 <dd class=
"description">Resource path
</dd>
1637 <h4 class=
"returnvalue">Return Value
</h4>
1638 <p class=
"description">Password
</p>
1639 <h4 class=
"discussion">Discussion
</h4>
1640 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
1641 user does not provide a password.
<br>
1643 Note: The current password callback function is tracked separately for each
1644 thread in a program. Multi-threaded programs that override the setting via
1645 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
1646 do so in each thread for the same function to be used.
1649 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetPrinters">cupsGetPrinters
</a></h3>
1650 <p class=
"description">Get a list of printers from the default server.
</p>
1652 int cupsGetPrinters (
<br>
1653 char ***printers
<br>
1655 <h4 class=
"parameters">Parameters
</h4>
1658 <dd class=
"description">Printers
</dd>
1660 <h4 class=
"returnvalue">Return Value
</h4>
1661 <p class=
"description">Number of printers
</p>
1662 <h4 class=
"discussion">Discussion
</h4>
1663 <p class=
"discussion">This function is deprecated - use
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
1666 <h3 class=
"function"><span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span><a name=
"cupsGetServerPPD">cupsGetServerPPD
</a></h3>
1667 <p class=
"description">Get an available PPD file from the server.
</p>
1669 char *cupsGetServerPPD (
<br>
1670 http_t *http,
<br>
1671 const char *name
<br>
1673 <h4 class=
"parameters">Parameters
</h4>
1676 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1678 <dd class=
"description">Name of PPD file (
"ppd-name
")
</dd>
1680 <h4 class=
"returnvalue">Return Value
</h4>
1681 <p class=
"description">Name of PPD file or
<code>NULL
</code> on error
</p>
1682 <h4 class=
"discussion">Discussion
</h4>
1683 <p class=
"discussion">This function returns the named PPD file from the server. The
1684 list of available PPDs is provided by the IPP
<code>CUPS_GET_PPDS
</code>
1687 You must remove (unlink) the PPD file when you are finished with
1688 it. The PPD filename is stored in a static location that will be
1689 overwritten on the next call to
<a href=
"#cupsGetPPD"><code>cupsGetPPD
</code></a>,
<a href=
"#cupsGetPPD2"><code>cupsGetPPD2
</code></a>,
1690 or
<a href=
"#cupsGetServerPPD"><code>cupsGetServerPPD
</code></a>.
1693 <h3 class=
"function"><a name=
"cupsLangDefault">cupsLangDefault
</a></h3>
1694 <p class=
"description">Return the default language.
</p>
1696 cups_lang_t *cupsLangDefault (void);
</p>
1697 <h4 class=
"returnvalue">Return Value
</h4>
1698 <p class=
"description">Language data
</p>
1699 <h3 class=
"function"><a name=
"cupsLangEncoding">cupsLangEncoding
</a></h3>
1700 <p class=
"description">Return the character encoding (us-ascii, etc.)
1701 for the given language.
</p>
1703 const char *cupsLangEncoding (
<br>
1704 cups_lang_t *lang
<br>
1706 <h4 class=
"parameters">Parameters
</h4>
1709 <dd class=
"description">Language data
</dd>
1711 <h4 class=
"returnvalue">Return Value
</h4>
1712 <p class=
"description">Character encoding
</p>
1713 <h3 class=
"function"><a name=
"cupsLangFlush">cupsLangFlush
</a></h3>
1714 <p class=
"description">Flush all language data out of the cache.
</p>
1716 void cupsLangFlush (void);
</p>
1717 <h3 class=
"function"><a name=
"cupsLangFree">cupsLangFree
</a></h3>
1718 <p class=
"description">Free language data.
</p>
1720 void cupsLangFree (
<br>
1721 cups_lang_t *lang
<br>
1723 <h4 class=
"parameters">Parameters
</h4>
1726 <dd class=
"description">Language to free
</dd>
1728 <h4 class=
"discussion">Discussion
</h4>
1729 <p class=
"discussion">This does not actually free anything; use
<a href=
"#cupsLangFlush"><code>cupsLangFlush
</code></a> for that.
</p>
1730 <h3 class=
"function"><a name=
"cupsLangGet">cupsLangGet
</a></h3>
1731 <p class=
"description">Get a language.
</p>
1733 cups_lang_t *cupsLangGet (
<br>
1734 const char *language
<br>
1736 <h4 class=
"parameters">Parameters
</h4>
1739 <dd class=
"description">Language or locale
</dd>
1741 <h4 class=
"returnvalue">Return Value
</h4>
1742 <p class=
"description">Language data
</p>
1743 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsNotifySubject">cupsNotifySubject
</a></h3>
1744 <p class=
"description">Return the subject for the given notification message.
</p>
1746 char *cupsNotifySubject (
<br>
1747 cups_lang_t *lang,
<br>
1748 ipp_t *event
<br>
1750 <h4 class=
"parameters">Parameters
</h4>
1753 <dd class=
"description">Language data
</dd>
1755 <dd class=
"description">Event data
</dd>
1757 <h4 class=
"returnvalue">Return Value
</h4>
1758 <p class=
"description">Subject string or
<code>NULL
</code></p>
1759 <h4 class=
"discussion">Discussion
</h4>
1760 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
1763 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsNotifyText">cupsNotifyText
</a></h3>
1764 <p class=
"description">Return the text for the given notification message.
</p>
1766 char *cupsNotifyText (
<br>
1767 cups_lang_t *lang,
<br>
1768 ipp_t *event
<br>
1770 <h4 class=
"parameters">Parameters
</h4>
1773 <dd class=
"description">Language data
</dd>
1775 <dd class=
"description">Event data
</dd>
1777 <h4 class=
"returnvalue">Return Value
</h4>
1778 <p class=
"description">Message text or
<code>NULL
</code></p>
1779 <h4 class=
"discussion">Discussion
</h4>
1780 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
1783 <h3 class=
"function"><a name=
"cupsParseOptions">cupsParseOptions
</a></h3>
1784 <p class=
"description">Parse options from a command-line argument.
</p>
1786 int cupsParseOptions (
<br>
1787 const char *arg,
<br>
1788 int num_options,
<br>
1789 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
1791 <h4 class=
"parameters">Parameters
</h4>
1794 <dd class=
"description">Argument to parse
</dd>
1795 <dt>num_options
</dt>
1796 <dd class=
"description">Number of options
</dd>
1798 <dd class=
"description">Options found
</dd>
1800 <h4 class=
"returnvalue">Return Value
</h4>
1801 <p class=
"description">Number of options found
</p>
1802 <h4 class=
"discussion">Discussion
</h4>
1803 <p class=
"discussion">This function converts space-delimited name/value pairs according
1804 to the PAPI text option ABNF specification. Collection values
1805 (
"name={a=... b=... c=...}
") are stored with the curley brackets
1806 intact - use
<code>cupsParseOptions
</code> on the value to extract the
1807 collection attributes.
</p>
1808 <h3 class=
"function"><a name=
"cupsPrintFile">cupsPrintFile
</a></h3>
1809 <p class=
"description">Print a file to a printer or class on the default server.
</p>
1811 int cupsPrintFile (
<br>
1812 const char *name,
<br>
1813 const char *filename,
<br>
1814 const char *title,
<br>
1815 int num_options,
<br>
1816 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1818 <h4 class=
"parameters">Parameters
</h4>
1821 <dd class=
"description">Destination name
</dd>
1823 <dd class=
"description">File to print
</dd>
1825 <dd class=
"description">Title of job
</dd>
1826 <dt>num_options
</dt>
1827 <dd class=
"description">Number of options
</dd>
1829 <dd class=
"description">Options
</dd>
1831 <h4 class=
"returnvalue">Return Value
</h4>
1832 <p class=
"description">Job ID or
0 on error
</p>
1833 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsPrintFile2">cupsPrintFile2
</a></h3>
1834 <p class=
"description">Print a file to a printer or class on the specified
1837 int cupsPrintFile2 (
<br>
1838 http_t *http,
<br>
1839 const char *name,
<br>
1840 const char *filename,
<br>
1841 const char *title,
<br>
1842 int num_options,
<br>
1843 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1845 <h4 class=
"parameters">Parameters
</h4>
1848 <dd class=
"description">Connection to server
</dd>
1850 <dd class=
"description">Destination name
</dd>
1852 <dd class=
"description">File to print
</dd>
1854 <dd class=
"description">Title of job
</dd>
1855 <dt>num_options
</dt>
1856 <dd class=
"description">Number of options
</dd>
1858 <dd class=
"description">Options
</dd>
1860 <h4 class=
"returnvalue">Return Value
</h4>
1861 <p class=
"description">Job ID or
0 on error
</p>
1862 <h3 class=
"function"><a name=
"cupsPrintFiles">cupsPrintFiles
</a></h3>
1863 <p class=
"description">Print one or more files to a printer or class on the
1866 int cupsPrintFiles (
<br>
1867 const char *name,
<br>
1868 int num_files,
<br>
1869 const char **files,
<br>
1870 const char *title,
<br>
1871 int num_options,
<br>
1872 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1874 <h4 class=
"parameters">Parameters
</h4>
1877 <dd class=
"description">Destination name
</dd>
1879 <dd class=
"description">Number of files
</dd>
1881 <dd class=
"description">File(s) to print
</dd>
1883 <dd class=
"description">Title of job
</dd>
1884 <dt>num_options
</dt>
1885 <dd class=
"description">Number of options
</dd>
1887 <dd class=
"description">Options
</dd>
1889 <h4 class=
"returnvalue">Return Value
</h4>
1890 <p class=
"description">Job ID or
0 on error
</p>
1891 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsPrintFiles2">cupsPrintFiles2
</a></h3>
1892 <p class=
"description">Print one or more files to a printer or class on the
1893 specified server.
</p>
1895 int cupsPrintFiles2 (
<br>
1896 http_t *http,
<br>
1897 const char *name,
<br>
1898 int num_files,
<br>
1899 const char **files,
<br>
1900 const char *title,
<br>
1901 int num_options,
<br>
1902 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1904 <h4 class=
"parameters">Parameters
</h4>
1907 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1909 <dd class=
"description">Destination name
</dd>
1911 <dd class=
"description">Number of files
</dd>
1913 <dd class=
"description">File(s) to print
</dd>
1915 <dd class=
"description">Title of job
</dd>
1916 <dt>num_options
</dt>
1917 <dd class=
"description">Number of options
</dd>
1919 <dd class=
"description">Options
</dd>
1921 <h4 class=
"returnvalue">Return Value
</h4>
1922 <p class=
"description">Job ID or
0 on error
</p>
1923 <h3 class=
"function"><span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span><a name=
"cupsRemoveDest">cupsRemoveDest
</a></h3>
1924 <p class=
"description">Remove a destination from the destination list.
</p>
1926 int cupsRemoveDest (
<br>
1927 const char *name,
<br>
1928 const char *instance,
<br>
1929 int num_dests,
<br>
1930 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1932 <h4 class=
"parameters">Parameters
</h4>
1935 <dd class=
"description">Destination name
</dd>
1937 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
1939 <dd class=
"description">Number of destinations
</dd>
1941 <dd class=
"description">Destinations
</dd>
1943 <h4 class=
"returnvalue">Return Value
</h4>
1944 <p class=
"description">New number of destinations
</p>
1945 <h4 class=
"discussion">Discussion
</h4>
1946 <p class=
"discussion">Removing a destination/instance does not delete the class or printer
1947 queue, merely the lpoptions for that destination/instance. Use the
1948 <a href=
"#cupsSetDests"><code>cupsSetDests
</code></a> or
<a href=
"#cupsSetDests2"><code>cupsSetDests2
</code></a> functions to save the new
1949 options for the user.
1952 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsRemoveOption">cupsRemoveOption
</a></h3>
1953 <p class=
"description">Remove an option from an option array.
</p>
1955 int cupsRemoveOption (
<br>
1956 const char *name,
<br>
1957 int num_options,
<br>
1958 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
1960 <h4 class=
"parameters">Parameters
</h4>
1963 <dd class=
"description">Option name
</dd>
1964 <dt>num_options
</dt>
1965 <dd class=
"description">Current number of options
</dd>
1967 <dd class=
"description">Options
</dd>
1969 <h4 class=
"returnvalue">Return Value
</h4>
1970 <p class=
"description">New number of options
</p>
1971 <h3 class=
"function"><a name=
"cupsServer">cupsServer
</a></h3>
1972 <p class=
"description">Return the hostname/address of the current server.
</p>
1974 const char *cupsServer (void);
</p>
1975 <h4 class=
"returnvalue">Return Value
</h4>
1976 <p class=
"description">Server name
</p>
1977 <h4 class=
"discussion">Discussion
</h4>
1978 <p class=
"discussion">The default server comes from the CUPS_SERVER environment variable, then the
1979 ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
1980 set, the default is the local system - either
"localhost
" or a domain socket
1983 The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
1984 address, or a domain socket pathname.
<br>
1986 Note: The current server is tracked separately for each thread in a program.
1987 Multi-threaded programs that override the server via the
1988 <a href=
"#cupsSetServer"><code>cupsSetServer
</code></a> function need to do so in each thread for the same
1989 server to be used.
</p>
1990 <h3 class=
"function"><span class=
"info"> CUPS
1.5 </span><a name=
"cupsSetClientCertCB">cupsSetClientCertCB
</a></h3>
1991 <p class=
"description">Set the client certificate callback.
</p>
1993 void cupsSetClientCertCB (
<br>
1994 <a href=
"#cups_client_cert_cb_t">cups_client_cert_cb_t
</a> cb,
<br>
1995 void *user_data
<br>
1997 <h4 class=
"parameters">Parameters
</h4>
2000 <dd class=
"description">Callback function
</dd>
2002 <dd class=
"description">User data pointer
</dd>
2004 <h4 class=
"discussion">Discussion
</h4>
2005 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2007 Note: The current certificate callback is tracked separately for each thread
2008 in a program. Multi-threaded programs that override the callback need to do
2009 so in each thread for the same callback to be used.
2012 <h3 class=
"function"><span class=
"info"> CUPS
1.5 </span><a name=
"cupsSetCredentials">cupsSetCredentials
</a></h3>
2013 <p class=
"description">Set the default credentials to be used for SSL/TLS
2016 int cupsSetCredentials (
<br>
2017 cups_array_t *credentials
<br>
2019 <h4 class=
"parameters">Parameters
</h4>
2021 <dt>credentials
</dt>
2022 <dd class=
"description">Array of credentials
</dd>
2024 <h4 class=
"returnvalue">Return Value
</h4>
2025 <p class=
"description">Status of call (
0 = success)
</p>
2026 <h4 class=
"discussion">Discussion
</h4>
2027 <p class=
"discussion">Note: The default credentials are tracked separately for each thread in a
2028 program. Multi-threaded programs that override the setting need to do so in
2029 each thread for the same setting to be used.
2032 <h3 class=
"function"><span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span><a name=
"cupsSetDefaultDest">cupsSetDefaultDest
</a></h3>
2033 <p class=
"description">Set the default destination.
</p>
2035 void cupsSetDefaultDest (
<br>
2036 const char *name,
<br>
2037 const char *instance,
<br>
2038 int num_dests,
<br>
2039 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2041 <h4 class=
"parameters">Parameters
</h4>
2044 <dd class=
"description">Destination name
</dd>
2046 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2048 <dd class=
"description">Number of destinations
</dd>
2050 <dd class=
"description">Destinations
</dd>
2052 <h3 class=
"function"><a name=
"cupsSetDests">cupsSetDests
</a></h3>
2053 <p class=
"description">Save the list of destinations for the default server.
</p>
2055 void cupsSetDests (
<br>
2056 int num_dests,
<br>
2057 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2059 <h4 class=
"parameters">Parameters
</h4>
2062 <dd class=
"description">Number of destinations
</dd>
2064 <dd class=
"description">Destinations
</dd>
2066 <h4 class=
"discussion">Discussion
</h4>
2067 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2068 as root and ~/.cups/lpoptions when run as a normal user.
</p>
2069 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/Mac OS X
10.4 </span><a name=
"cupsSetDests2">cupsSetDests2
</a></h3>
2070 <p class=
"description">Save the list of destinations for the specified server.
</p>
2072 int cupsSetDests2 (
<br>
2073 http_t *http,
<br>
2074 int num_dests,
<br>
2075 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2077 <h4 class=
"parameters">Parameters
</h4>
2080 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2082 <dd class=
"description">Number of destinations
</dd>
2084 <dd class=
"description">Destinations
</dd>
2086 <h4 class=
"returnvalue">Return Value
</h4>
2087 <p class=
"description">0 on success, -
1 on error
</p>
2088 <h4 class=
"discussion">Discussion
</h4>
2089 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2090 as root and ~/.cups/lpoptions when run as a normal user.
2093 <h3 class=
"function"><a name=
"cupsSetEncryption">cupsSetEncryption
</a></h3>
2094 <p class=
"description">Set the encryption preference.
</p>
2096 void cupsSetEncryption (
<br>
2097 http_encryption_t e
<br>
2099 <h4 class=
"parameters">Parameters
</h4>
2102 <dd class=
"description">New encryption preference
</dd>
2104 <h4 class=
"discussion">Discussion
</h4>
2105 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
2106 environment variable, then the ~/.cups/client.conf file, and finally the
2107 /etc/cups/client.conf file. If not set, the default is
2108 <code>HTTP_ENCRYPT_IF_REQUESTED
</code>.
<br>
2110 Note: The current encryption setting is tracked separately for each thread
2111 in a program. Multi-threaded programs that override the setting need to do
2112 so in each thread for the same setting to be used.
</p>
2113 <h3 class=
"function"><a name=
"cupsSetPasswordCB">cupsSetPasswordCB
</a></h3>
2114 <p class=
"description">Set the password callback for CUPS.
</p>
2116 void cupsSetPasswordCB (
<br>
2117 <a href=
"#cups_password_cb_t">cups_password_cb_t
</a> cb
<br>
2119 <h4 class=
"parameters">Parameters
</h4>
2122 <dd class=
"description">Callback function
</dd>
2124 <h4 class=
"discussion">Discussion
</h4>
2125 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2126 reads the password from the console. Programs should call either this
2127 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2128 by a program per thread.
<br>
2130 Note: The current password callback is tracked separately for each thread
2131 in a program. Multi-threaded programs that override the callback need to do
2132 so in each thread for the same callback to be used.
</p>
2133 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsSetPasswordCB2">cupsSetPasswordCB2
</a></h3>
2134 <p class=
"description">Set the advanced password callback for CUPS.
</p>
2136 void cupsSetPasswordCB2 (
<br>
2137 <a href=
"#cups_password_cb2_t">cups_password_cb2_t
</a> cb,
<br>
2138 void *user_data
<br>
2140 <h4 class=
"parameters">Parameters
</h4>
2143 <dd class=
"description">Callback function
</dd>
2145 <dd class=
"description">User data pointer
</dd>
2147 <h4 class=
"discussion">Discussion
</h4>
2148 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2149 reads the password from the console. Programs should call either this
2150 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2151 by a program per thread.
<br>
2153 Note: The current password callback is tracked separately for each thread
2154 in a program. Multi-threaded programs that override the callback need to do
2155 so in each thread for the same callback to be used.
2158 <h3 class=
"function"><a name=
"cupsSetServer">cupsSetServer
</a></h3>
2159 <p class=
"description">Set the default server name and port.
</p>
2161 void cupsSetServer (
<br>
2162 const char *server
<br>
2164 <h4 class=
"parameters">Parameters
</h4>
2167 <dd class=
"description">Server name
</dd>
2169 <h4 class=
"discussion">Discussion
</h4>
2170 <p class=
"discussion">The
"server
" string can be a fully-qualified hostname, a numeric
2171 IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
2172 addresses can be optionally followed by a colon and port number to override
2173 the default port
631, e.g.
"hostname:
8631". Pass
<code>NULL
</code> to restore the
2174 default server name and port.
<br>
2176 Note: The current server is tracked separately for each thread in a program.
2177 Multi-threaded programs that override the server need to do so in each
2178 thread for the same server to be used.
</p>
2179 <h3 class=
"function"><span class=
"info"> CUPS
1.5 </span><a name=
"cupsSetServerCertCB">cupsSetServerCertCB
</a></h3>
2180 <p class=
"description">Set the server certificate callback.
</p>
2182 void cupsSetServerCertCB (
<br>
2183 <a href=
"#cups_server_cert_cb_t">cups_server_cert_cb_t
</a> cb,
<br>
2184 void *user_data
<br>
2186 <h4 class=
"parameters">Parameters
</h4>
2189 <dd class=
"description">Callback function
</dd>
2191 <dd class=
"description">User data pointer
</dd>
2193 <h4 class=
"discussion">Discussion
</h4>
2194 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2196 Note: The current credentials callback is tracked separately for each thread
2197 in a program. Multi-threaded programs that override the callback need to do
2198 so in each thread for the same callback to be used.
2201 <h3 class=
"function"><a name=
"cupsSetUser">cupsSetUser
</a></h3>
2202 <p class=
"description">Set the default user name.
</p>
2204 void cupsSetUser (
<br>
2205 const char *user
<br>
2207 <h4 class=
"parameters">Parameters
</h4>
2210 <dd class=
"description">User name
</dd>
2212 <h4 class=
"discussion">Discussion
</h4>
2213 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default user name.
<br>
2215 Note: The current user name is tracked separately for each thread in a
2216 program. Multi-threaded programs that override the user name need to do so
2217 in each thread for the same user name to be used.
</p>
2218 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsStartDocument">cupsStartDocument
</a></h3>
2219 <p class=
"description">Add a document to a job created with cupsCreateJob().
</p>
2221 http_status_t cupsStartDocument (
<br>
2222 http_t *http,
<br>
2223 const char *name,
<br>
2224 int job_id,
<br>
2225 const char *docname,
<br>
2226 const char *format,
<br>
2227 int last_document
<br>
2229 <h4 class=
"parameters">Parameters
</h4>
2232 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2234 <dd class=
"description">Destination name
</dd>
2236 <dd class=
"description">Job ID from
<a href=
"#cupsCreateJob"><code>cupsCreateJob
</code></a></dd>
2238 <dd class=
"description">Name of document
</dd>
2240 <dd class=
"description">MIME type or
<code>CUPS_FORMAT_foo
</code></dd>
2241 <dt>last_document
</dt>
2242 <dd class=
"description">1 for last document in job,
0 otherwise
</dd>
2244 <h4 class=
"returnvalue">Return Value
</h4>
2245 <p class=
"description">HTTP status of request
</p>
2246 <h4 class=
"discussion">Discussion
</h4>
2247 <p class=
"discussion">Use
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a> to write data for the document and
2248 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> to finish the document and get the submission status.
<br>
2250 The MIME type constants
<code>CUPS_FORMAT_AUTO
</code>,
<code>CUPS_FORMAT_PDF
</code>,
2251 <code>CUPS_FORMAT_POSTSCRIPT
</code>,
<code>CUPS_FORMAT_RAW
</code>, and
2252 <code>CUPS_FORMAT_TEXT
</code> are provided for the
"format
" argument, although
2253 any supported MIME type string can be supplied.
2256 <h3 class=
"function"><a name=
"cupsTempFd">cupsTempFd
</a></h3>
2257 <p class=
"description">Creates a temporary file.
</p>
2259 int cupsTempFd (
<br>
2260 char *filename,
<br>
2261 int len
<br>
2263 <h4 class=
"parameters">Parameters
</h4>
2266 <dd class=
"description">Pointer to buffer
</dd>
2268 <dd class=
"description">Size of buffer
</dd>
2270 <h4 class=
"returnvalue">Return Value
</h4>
2271 <p class=
"description">New file descriptor or -
1 on error
</p>
2272 <h4 class=
"discussion">Discussion
</h4>
2273 <p class=
"discussion">The temporary filename is returned in the filename buffer.
2274 The temporary file is opened for reading and writing.
</p>
2275 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsTempFile">cupsTempFile
</a></h3>
2276 <p class=
"description">Generates a temporary filename.
</p>
2278 char *cupsTempFile (
<br>
2279 char *filename,
<br>
2280 int len
<br>
2282 <h4 class=
"parameters">Parameters
</h4>
2285 <dd class=
"description">Pointer to buffer
</dd>
2287 <dd class=
"description">Size of buffer
</dd>
2289 <h4 class=
"returnvalue">Return Value
</h4>
2290 <p class=
"description">Filename or
<code>NULL
</code> on error
</p>
2291 <h4 class=
"discussion">Discussion
</h4>
2292 <p class=
"discussion">The temporary filename is returned in the filename buffer.
2293 This function is deprecated - use
<a href=
"#cupsTempFd"><code>cupsTempFd
</code></a> or
2294 <a href=
"#cupsTempFile2"><code>cupsTempFile2
</code></a> instead.
2297 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsTempFile2">cupsTempFile2
</a></h3>
2298 <p class=
"description">Creates a temporary CUPS file.
</p>
2300 cups_file_t *cupsTempFile2 (
<br>
2301 char *filename,
<br>
2302 int len
<br>
2304 <h4 class=
"parameters">Parameters
</h4>
2307 <dd class=
"description">Pointer to buffer
</dd>
2309 <dd class=
"description">Size of buffer
</dd>
2311 <h4 class=
"returnvalue">Return Value
</h4>
2312 <p class=
"description">CUPS file or
<code>NULL
</code> on error
</p>
2313 <h4 class=
"discussion">Discussion
</h4>
2314 <p class=
"discussion">The temporary filename is returned in the filename buffer.
2315 The temporary file is opened for writing.
2318 <h3 class=
"function"><a name=
"cupsUser">cupsUser
</a></h3>
2319 <p class=
"description">Return the current user's name.
</p>
2321 const char *cupsUser (void);
</p>
2322 <h4 class=
"returnvalue">Return Value
</h4>
2323 <p class=
"description">User name
</p>
2324 <h4 class=
"discussion">Discussion
</h4>
2325 <p class=
"discussion">Note: The current user name is tracked separately for each thread in a
2326 program. Multi-threaded programs that override the user name with the
2327 <a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function need to do so in each thread for the same user
2328 name to be used.
</p>
2329 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
2330 <h3 class=
"typedef"><span class=
"info"> CUPS
1.5 </span><a name=
"cups_client_cert_cb_t">cups_client_cert_cb_t
</a></h3>
2331 <p class=
"description">Client credentials callback
</p>
2333 typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
2335 <h3 class=
"typedef"><a name=
"cups_dest_t">cups_dest_t
</a></h3>
2336 <p class=
"description">Destination
</p>
2338 typedef struct
<a href=
"#cups_dest_s">cups_dest_s
</a> cups_dest_t;
2340 <h3 class=
"typedef"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cups_device_cb_t">cups_device_cb_t
</a></h3>
2341 <p class=
"description">Device callback
</p>
2343 typedef void (*cups_device_cb_t)(const char *device_class, const char *device_id, const char *device_info, const char *device_make_and_model, const char *device_uri, const char *device_location, void *user_data);
2345 <h3 class=
"typedef"><a name=
"cups_job_t">cups_job_t
</a></h3>
2346 <p class=
"description">Job
</p>
2348 typedef struct
<a href=
"#cups_job_s">cups_job_s
</a> cups_job_t;
2350 <h3 class=
"typedef"><a name=
"cups_option_t">cups_option_t
</a></h3>
2351 <p class=
"description">Printer Options
</p>
2353 typedef struct
<a href=
"#cups_option_s">cups_option_s
</a> cups_option_t;
2355 <h3 class=
"typedef"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cups_password_cb2_t">cups_password_cb2_t
</a></h3>
2356 <p class=
"description">New password callback
</p>
2358 typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
2360 <h3 class=
"typedef"><a name=
"cups_password_cb_t">cups_password_cb_t
</a></h3>
2361 <p class=
"description">Password callback
</p>
2363 typedef const char *(*cups_password_cb_t)(const char *prompt);
2365 <h3 class=
"typedef"><a name=
"cups_ptype_t">cups_ptype_t
</a></h3>
2366 <p class=
"description">Printer type/capability bits
</p>
2368 typedef unsigned cups_ptype_t;
2370 <h3 class=
"typedef"><span class=
"info"> CUPS
1.5 </span><a name=
"cups_server_cert_cb_t">cups_server_cert_cb_t
</a></h3>
2371 <p class=
"description">Server credentials callback
</p>
2373 typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
2375 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
2376 <h3 class=
"struct"><a name=
"cups_dest_s">cups_dest_s
</a></h3>
2377 <p class=
"description">Destination
</p>
2378 <p class=
"code">struct cups_dest_s {
<br>
2379 char *name, *instance;
<br>
2380 int is_default;
<br>
2381 int num_options;
<br>
2382 <a href=
"#cups_option_t">cups_option_t
</a> *options;
<br>
2384 <h4 class=
"members">Members
</h4>
2387 <dd class=
"description">Local instance name or NULL
</dd>
2388 <dt>is_default
</dt>
2389 <dd class=
"description">Is this printer the default?
</dd>
2390 <dt>num_options
</dt>
2391 <dd class=
"description">Number of options
</dd>
2393 <dd class=
"description">Options
</dd>
2395 <h3 class=
"struct"><a name=
"cups_job_s">cups_job_s
</a></h3>
2396 <p class=
"description">Job
</p>
2397 <p class=
"code">struct cups_job_s {
<br>
2398 time_t completed_time;
<br>
2399 time_t creation_time;
<br>
2400 char *dest;
<br>
2401 char *format;
<br>
2402 int id;
<br>
2403 int priority;
<br>
2404 time_t processing_time;
<br>
2405 int size;
<br>
2406 ipp_jstate_t state;
<br>
2407 char *title;
<br>
2408 char *user;
<br>
2410 <h4 class=
"members">Members
</h4>
2412 <dt>completed_time
</dt>
2413 <dd class=
"description">Time the job was completed
</dd>
2414 <dt>creation_time
</dt>
2415 <dd class=
"description">Time the job was created
</dd>
2417 <dd class=
"description">Printer or class name
</dd>
2419 <dd class=
"description">Document format
</dd>
2421 <dd class=
"description">The job ID
</dd>
2423 <dd class=
"description">Priority (
1-
100)
</dd>
2424 <dt>processing_time
</dt>
2425 <dd class=
"description">Time the job was processed
</dd>
2427 <dd class=
"description">Size in kilobytes
</dd>
2429 <dd class=
"description">Job state
</dd>
2431 <dd class=
"description">Title/job name
</dd>
2433 <dd class=
"description">User the submitted the job
</dd>
2435 <h3 class=
"struct"><a name=
"cups_option_s">cups_option_s
</a></h3>
2436 <p class=
"description">Printer Options
</p>
2437 <p class=
"code">struct cups_option_s {
<br>
2438 char *name;
<br>
2439 char *value;
<br>
2441 <h4 class=
"members">Members
</h4>
2444 <dd class=
"description">Name of option
</dd>
2446 <dd class=
"description">Value of option
</dd>
2448 <h2 class=
"title"><a name=
"ENUMERATIONS">Constants
</a></h2>
2449 <h3 class=
"enumeration"><a name=
"cups_ptype_e">cups_ptype_e
</a></h3>
2450 <p class=
"description">Printer type/capability bit constants
</p>
2451 <h4 class=
"constants">Constants
</h4>
2453 <dt>CUPS_PRINTER_AUTHENTICATED
<span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span></dt>
2454 <dd class=
"description">Printer requires authentication
</dd>
2455 <dt>CUPS_PRINTER_BIND
</dt>
2456 <dd class=
"description">Can bind output
</dd>
2457 <dt>CUPS_PRINTER_BW
</dt>
2458 <dd class=
"description">Can do B
&W printing
</dd>
2459 <dt>CUPS_PRINTER_CLASS
</dt>
2460 <dd class=
"description">Printer class
</dd>
2461 <dt>CUPS_PRINTER_COLLATE
</dt>
2462 <dd class=
"description">Can collage copies
</dd>
2463 <dt>CUPS_PRINTER_COLOR
</dt>
2464 <dd class=
"description">Can do color printing
</dd>
2465 <dt>CUPS_PRINTER_COMMANDS
<span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span></dt>
2466 <dd class=
"description">Printer supports maintenance commands
</dd>
2467 <dt>CUPS_PRINTER_COPIES
</dt>
2468 <dd class=
"description">Can do copies
</dd>
2469 <dt>CUPS_PRINTER_COVER
</dt>
2470 <dd class=
"description">Can cover output
</dd>
2471 <dt>CUPS_PRINTER_DEFAULT
</dt>
2472 <dd class=
"description">Default printer on network
</dd>
2473 <dt>CUPS_PRINTER_DELETE
<span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span></dt>
2474 <dd class=
"description">Delete printer
</dd>
2475 <dt>CUPS_PRINTER_DISCOVERED
<span class=
"info"> CUPS
1.3/Mac OS X
10.5 </span></dt>
2476 <dd class=
"description">Printer was automatically discovered and added
</dd>
2477 <dt>CUPS_PRINTER_DUPLEX
</dt>
2478 <dd class=
"description">Can do duplexing
</dd>
2479 <dt>CUPS_PRINTER_FAX
</dt>
2480 <dd class=
"description">Fax queue
</dd>
2481 <dt>CUPS_PRINTER_IMPLICIT
</dt>
2482 <dd class=
"description">Implicit class
</dd>
2483 <dt>CUPS_PRINTER_LARGE
</dt>
2484 <dd class=
"description">Can do D/E/A1/A0
</dd>
2485 <dt>CUPS_PRINTER_LOCAL
</dt>
2486 <dd class=
"description">Local printer or class
</dd>
2487 <dt>CUPS_PRINTER_MEDIUM
</dt>
2488 <dd class=
"description">Can do Tabloid/B/C/A3/A2
</dd>
2489 <dt>CUPS_PRINTER_MFP
<span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span></dt>
2490 <dd class=
"description">Printer with scanning capabilities
</dd>
2491 <dt>CUPS_PRINTER_NOT_SHARED
<span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span></dt>
2492 <dd class=
"description">Printer is not shared
</dd>
2493 <dt>CUPS_PRINTER_PUNCH
</dt>
2494 <dd class=
"description">Can punch output
</dd>
2495 <dt>CUPS_PRINTER_REJECTING
</dt>
2496 <dd class=
"description">Printer is rejecting jobs
</dd>
2497 <dt>CUPS_PRINTER_REMOTE
</dt>
2498 <dd class=
"description">Remote printer or class
</dd>
2499 <dt>CUPS_PRINTER_SCANNER
<span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span></dt>
2500 <dd class=
"description">Scanner-only device
</dd>
2501 <dt>CUPS_PRINTER_SMALL
</dt>
2502 <dd class=
"description">Can do Letter/Legal/A4
</dd>
2503 <dt>CUPS_PRINTER_SORT
</dt>
2504 <dd class=
"description">Can sort output
</dd>
2505 <dt>CUPS_PRINTER_STAPLE
</dt>
2506 <dd class=
"description">Can staple output
</dd>
2507 <dt>CUPS_PRINTER_VARIABLE
</dt>
2508 <dd class=
"description">Can do variable sizes
</dd>