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;
56 border: dotted thin #999999;
61 PRE.command EM, PRE.example EM {
62 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
66 font-family: monaco, courier, monospace;
77 border: solid thin #999999;
88 -moz-border-radius: 10px;
93 text-decoration: none;
96 A:link:hover, A:visited:hover, A:active {
97 text-decoration: underline;
104 TR.data, TD.data, TR.data TD {
107 border-bottom: solid 1pt #999999;
111 border-bottom: solid 1pt #999999;
118 border: solid thin #999999;
119 border-collapse: collapse;
135 border: solid thin #cccccc;
142 border-bottom: solid thin #999999;
151 caption-side: bottom;
175 border: thin solid black;
183 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
192 border-bottom: solid 2pt #000000;
195 DIV.indent, TABLE.indent {
203 border-collapse: collapse;
206 TABLE.indent TD, TABLE.indent TH {
211 border-collapse: collapse;
219 border-bottom: solid thin #cccccc;
224 vertical-align: bottom;
233 border-bottom: solid thin #eeeeee;
238 TABLE.list TR:nth-child(even) {
242 TABLE.list TR:nth-child(odd) {
261 font-family: monaco, courier, monospace;
265 border: solid thin #999999;
266 border-collapse: collapse;
271 DIV.summary TABLE TD, DIV.summary TABLE TH {
272 border: solid thin #999999;
278 DIV.summary TABLE THEAD TH {
282 /* API documentation styles... */
289 div.body h3, div.body h4, div.body h5 {
290 margin-bottom: 0.5em;
293 .class, .enumeration, .function, .struct, .typedef, .union {
294 border-bottom: solid thin #999999;
301 code, p.code, pre, ul.code li {
302 font-family: monaco, courier, monospace;
305 ul.code, ul.contents, ul.subcontents {
306 list-style-type: none;
316 ul.contents li ul.code, ul.contents li ul.subcontents {
329 margin-bottom: 0.5em;
332 /* This is just for the HTML files generated with the framedhelp target */
335 border: solid thin black;
344 div.contents ul.contents {
347 div.contents ul.subcontents li {
356 CUPS API header for CUPS.
358 Copyright 2008-2011 by Apple Inc.
360 These coded instructions, statements, and computer programs are the
361 property of Apple Inc. and are protected by Federal copyright
362 law. Distribution and use rights are outlined in the file "LICENSE.txt"
363 which should have been included with this file. If this file is
364 file is missing or damaged, see the license at "http://www.cups.org/".
367 <h1 class='title'
>CUPS API
</h1>
369 <div class='summary'
><table summary='General Information'
>
383 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
384 Programming:
<a href='api-array.html' target='_top'
>Array API
</a><br>
385 Programming:
<a href='api-filedir.html' target='_top'
>File and Directory APIs
</a><br>
386 Programming:
<a href='api-filter.html' target='_top'
>Filter and Backend Programming
</a><br>
387 Programming:
<a href='api-httpipp.html' target='_top'
>HTTP and IPP APIs
</a><br>
388 Programming:
<a href='api-ppd.html' target='_top'
>PPD API
</a><br>
389 Programming:
<a href='api-raster.html' target='_top'
>Raster API
</a></td>
393 <h2 class=
"title">Contents
</h2>
394 <ul class=
"contents">
395 <li><a href=
"#OVERVIEW">Overview
</a><ul class=
"subcontents">
396 <li><a href=
"#CLIENTS_AND_SERVERS">Clients and Servers
</a></li>
397 <li><a href=
"#PRINTERS_AND_CLASSES">Printers and Classes
</a></li>
398 <li><a href=
"#OPTIONS">Options
</a></li>
399 <li><a href=
"#PRINT_JOBS">Print Jobs
</a></li>
400 <li><a href=
"#ERROR_HANDLING">Error Handling
</a></li>
401 <li><a href=
"#PASSWORDS_AND_AUTHENTICATION">Passwords and Authentication
</a></li>
403 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
404 <li><a href=
"#cupsAddDest" title=
"Add a destination to the list of destinations.">cupsAddDest
</a></li>
405 <li><a href=
"#cupsAddOption" title=
"Add an option to an option array.">cupsAddOption
</a></li>
406 <li><a href=
"#cupsAdminCreateWindowsPPD" title=
"Create the Windows PPD file for a printer.">cupsAdminCreateWindowsPPD
</a></li>
407 <li><a href=
"#cupsAdminExportSamba" title=
"Export a printer to Samba.">cupsAdminExportSamba
</a></li>
408 <li><a href=
"#cupsAdminGetServerSettings" title=
"Get settings from the server.">cupsAdminGetServerSettings
</a></li>
409 <li><a href=
"#cupsAdminSetServerSettings" title=
"Set settings on the server.">cupsAdminSetServerSettings
</a></li>
410 <li><a href=
"#cupsCancelDestJob" title=
"Include necessary headers...">cupsCancelDestJob
</a></li>
411 <li><a href=
"#cupsCancelJob" title=
"Cancel a print job on the default server.">cupsCancelJob
</a></li>
412 <li><a href=
"#cupsCancelJob2" title=
"Cancel or purge a print job.">cupsCancelJob2
</a></li>
413 <li><a href=
"#cupsCheckDestSupported" title=
"Check that the option and value are supported
414 by the destination.">cupsCheckDestSupported
</a></li>
415 <li><a href=
"#cupsCloseDestJob" title=
"Close a job and start printing.">cupsCloseDestJob
</a></li>
416 <li><a href=
"#cupsConnectDest" title=
"Connect to the server for a destination.">cupsConnectDest
</a></li>
417 <li><a href=
"#cupsConnectDestBlock" title=
"Connect to the server for a destination.">cupsConnectDestBlock
</a></li>
418 <li><a href=
"#cupsCopyDest" title=
"Callback block">cupsCopyDest
</a></li>
419 <li><a href=
"#cupsCopyDestConflicts" title=
"Get conflicts and resolutions for a new
420 option/value pair.">cupsCopyDestConflicts
</a></li>
421 <li><a href=
"#cupsCopyDestInfo" title=
"Get the supported values/capabilities for the
422 destination.">cupsCopyDestInfo
</a></li>
423 <li><a href=
"#cupsCreateDestJob" title=
"Create a job on a destination.">cupsCreateDestJob
</a></li>
424 <li><a href=
"#cupsCreateJob" title=
"Create an empty job for streaming.">cupsCreateJob
</a></li>
425 <li><a href=
"#cupsEncryption" title=
"Get the current encryption settings.">cupsEncryption
</a></li>
426 <li><a href=
"#cupsEnumDests" title=
"Enumerate available destinations with a callback function.">cupsEnumDests
</a></li>
427 <li><a href=
"#cupsEnumDestsBlock" title=
"Enumerate available destinations with a block.">cupsEnumDestsBlock
</a></li>
428 <li><a href=
"#cupsFindDestDefault" title=
"Find the default value(s) for the given option.">cupsFindDestDefault
</a></li>
429 <li><a href=
"#cupsFindDestReady" title=
"Find the default value(s) for the given option.">cupsFindDestReady
</a></li>
430 <li><a href=
"#cupsFindDestSupported" title=
"Find the default value(s) for the given option.">cupsFindDestSupported
</a></li>
431 <li><a href=
"#cupsFinishDestDocument" title=
"Finish the current document.">cupsFinishDestDocument
</a></li>
432 <li><a href=
"#cupsFinishDocument" title=
"Finish sending a document.">cupsFinishDocument
</a></li>
433 <li><a href=
"#cupsFreeDestInfo" title=
"Free destination information obtained using
434 cupsCopyDestInfo.">cupsFreeDestInfo
</a></li>
435 <li><a href=
"#cupsFreeDests" title=
"Free the memory used by the list of destinations.">cupsFreeDests
</a></li>
436 <li><a href=
"#cupsFreeJobs" title=
"Free memory used by job data.">cupsFreeJobs
</a></li>
437 <li><a href=
"#cupsFreeOptions" title=
"Free all memory used by options.">cupsFreeOptions
</a></li>
438 <li><a href=
"#cupsGetClasses" title=
"Get a list of printer classes from the default server.">cupsGetClasses
</a></li>
439 <li><a href=
"#cupsGetDefault" title=
"Get the default printer or class for the default server.">cupsGetDefault
</a></li>
440 <li><a href=
"#cupsGetDefault2" title=
"Get the default printer or class for the specified server.">cupsGetDefault2
</a></li>
441 <li><a href=
"#cupsGetDest" title=
"Get the named destination from the list.">cupsGetDest
</a></li>
442 <li><a href=
"#cupsGetDestMediaByIndex" title=
"Get a media name, dimension, and margins for a
443 specific size.">cupsGetDestMediaByIndex
</a></li>
444 <li><a href=
"#cupsGetDestMediaByName" title=
"Get media names, dimensions, and margins.">cupsGetDestMediaByName
</a></li>
445 <li><a href=
"#cupsGetDestMediaBySize" title=
"Get media names, dimensions, and margins.">cupsGetDestMediaBySize
</a></li>
446 <li><a href=
"#cupsGetDestMediaCount" title=
"Get the number of sizes supported by a
447 destination.">cupsGetDestMediaCount
</a></li>
448 <li><a href=
"#cupsGetDestMediaDefault" title=
"Get the default size for a destination.">cupsGetDestMediaDefault
</a></li>
449 <li><a href=
"#cupsGetDestWithURI" title=
"Get a destination associated with a URI.">cupsGetDestWithURI
</a></li>
450 <li><a href=
"#cupsGetDests" title=
"Get the list of destinations from the default server.">cupsGetDests
</a></li>
451 <li><a href=
"#cupsGetDests2" title=
"Get the list of destinations from the specified server.">cupsGetDests2
</a></li>
452 <li><a href=
"#cupsGetJobs" title=
"Get the jobs from the default server.">cupsGetJobs
</a></li>
453 <li><a href=
"#cupsGetJobs2" title=
"Get the jobs from the specified server.">cupsGetJobs2
</a></li>
454 <li><a href=
"#cupsGetNamedDest" title=
"Get options for the named destination.">cupsGetNamedDest
</a></li>
455 <li><a href=
"#cupsGetOption" title=
"Get an option value.">cupsGetOption
</a></li>
456 <li><a href=
"#cupsGetPassword" title=
"Get a password from the user.">cupsGetPassword
</a></li>
457 <li><a href=
"#cupsGetPassword2" title=
"Get a password from the user using the advanced
458 password callback.">cupsGetPassword2
</a></li>
459 <li><a href=
"#cupsGetPrinters" title=
"Get a list of printers from the default server.">cupsGetPrinters
</a></li>
460 <li><a href=
"#cupsLangDefault" title=
"Return the default language.">cupsLangDefault
</a></li>
461 <li><a href=
"#cupsLangEncoding" title=
"Return the character encoding (us-ascii, etc.)
462 for the given language.">cupsLangEncoding
</a></li>
463 <li><a href=
"#cupsLangFlush" title=
"Flush all language data out of the cache.">cupsLangFlush
</a></li>
464 <li><a href=
"#cupsLangFree" title=
"Free language data.">cupsLangFree
</a></li>
465 <li><a href=
"#cupsLangGet" title=
"Get a language.">cupsLangGet
</a></li>
466 <li><a href=
"#cupsLocalizeDestMedia" title=
"Get the localized string for a destination media
467 size.">cupsLocalizeDestMedia
</a></li>
468 <li><a href=
"#cupsLocalizeDestOption" title=
"Get the localized string for a destination
469 option.">cupsLocalizeDestOption
</a></li>
470 <li><a href=
"#cupsLocalizeDestValue" title=
"Get the localized string for a destination
471 option+value pair.">cupsLocalizeDestValue
</a></li>
472 <li><a href=
"#cupsNotifySubject" title=
"Return the subject for the given notification message.">cupsNotifySubject
</a></li>
473 <li><a href=
"#cupsNotifyText" title=
"Return the text for the given notification message.">cupsNotifyText
</a></li>
474 <li><a href=
"#cupsParseOptions" title=
"Parse options from a command-line argument.">cupsParseOptions
</a></li>
475 <li><a href=
"#cupsPrintFile" title=
"Print a file to a printer or class on the default server.">cupsPrintFile
</a></li>
476 <li><a href=
"#cupsPrintFile2" title=
"Print a file to a printer or class on the specified
477 server.">cupsPrintFile2
</a></li>
478 <li><a href=
"#cupsPrintFiles" title=
"Print one or more files to a printer or class on the
479 default server.">cupsPrintFiles
</a></li>
480 <li><a href=
"#cupsPrintFiles2" title=
"Print one or more files to a printer or class on the
481 specified server.">cupsPrintFiles2
</a></li>
482 <li><a href=
"#cupsRemoveDest" title=
"Remove a destination from the destination list.">cupsRemoveDest
</a></li>
483 <li><a href=
"#cupsRemoveOption" title=
"Remove an option from an option array.">cupsRemoveOption
</a></li>
484 <li><a href=
"#cupsServer" title=
"Return the hostname/address of the current server.">cupsServer
</a></li>
485 <li><a href=
"#cupsSetClientCertCB" title=
"Set the client certificate callback.">cupsSetClientCertCB
</a></li>
486 <li><a href=
"#cupsSetCredentials" title=
"Set the default credentials to be used for SSL/TLS
487 connections.">cupsSetCredentials
</a></li>
488 <li><a href=
"#cupsSetDefaultDest" title=
"Set the default destination.">cupsSetDefaultDest
</a></li>
489 <li><a href=
"#cupsSetDests" title=
"Save the list of destinations for the default server.">cupsSetDests
</a></li>
490 <li><a href=
"#cupsSetDests2" title=
"Save the list of destinations for the specified server.">cupsSetDests2
</a></li>
491 <li><a href=
"#cupsSetEncryption" title=
"Set the encryption preference.">cupsSetEncryption
</a></li>
492 <li><a href=
"#cupsSetPasswordCB" title=
"Set the password callback for CUPS.">cupsSetPasswordCB
</a></li>
493 <li><a href=
"#cupsSetPasswordCB2" title=
"Set the advanced password callback for CUPS.">cupsSetPasswordCB2
</a></li>
494 <li><a href=
"#cupsSetServer" title=
"Set the default server name and port.">cupsSetServer
</a></li>
495 <li><a href=
"#cupsSetServerCertCB" title=
"Set the server certificate callback.">cupsSetServerCertCB
</a></li>
496 <li><a href=
"#cupsSetUser" title=
"Set the default user name.">cupsSetUser
</a></li>
497 <li><a href=
"#cupsSetUserAgent" title=
"Set the default HTTP User-Agent string.">cupsSetUserAgent
</a></li>
498 <li><a href=
"#cupsStartDestDocument" title=
"Start a new document.">cupsStartDestDocument
</a></li>
499 <li><a href=
"#cupsStartDocument" title=
"Add a document to a job created with cupsCreateJob().">cupsStartDocument
</a></li>
500 <li><a href=
"#cupsTempFd" title=
"Creates a temporary file.">cupsTempFd
</a></li>
501 <li><a href=
"#cupsTempFile" title=
"Generates a temporary filename.">cupsTempFile
</a></li>
502 <li><a href=
"#cupsTempFile2" title=
"Creates a temporary CUPS file.">cupsTempFile2
</a></li>
503 <li><a href=
"#cupsUser" title=
"Return the current user's name.">cupsUser
</a></li>
504 <li><a href=
"#cupsUserAgent" title=
"Return the default HTTP User-Agent string.">cupsUserAgent
</a></li>
505 <li><a href=
"#pwgFormatSizeName" title=
"Generate a PWG self-describing media size name.">pwgFormatSizeName
</a></li>
506 <li><a href=
"#pwgInitSize" title=
"Initialize a pwg_size_t structure using IPP Job Template
507 attributes.">pwgInitSize
</a></li>
508 <li><a href=
"#pwgMediaForLegacy" title=
"Find a PWG media size by ISO/IPP legacy name.">pwgMediaForLegacy
</a></li>
509 <li><a href=
"#pwgMediaForPPD" title=
"Find a PWG media size by Adobe PPD name.">pwgMediaForPPD
</a></li>
510 <li><a href=
"#pwgMediaForPWG" title=
"Find a PWG media size by 5101.1 self-describing name.">pwgMediaForPWG
</a></li>
511 <li><a href=
"#pwgMediaForSize" title=
"Get the PWG media size for the given dimensions.">pwgMediaForSize
</a></li>
513 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
514 <li><a href=
"#cups_client_cert_cb_t" title=
"Client credentials callback
515 ">cups_client_cert_cb_t
</a></li>
516 <li><a href=
"#cups_dest_block_t" title=
"Destination enumeration block
517 ">cups_dest_block_t
</a></li>
518 <li><a href=
"#cups_dest_cb_t" title=
"Destination enumeration callback
519 ">cups_dest_cb_t
</a></li>
520 <li><a href=
"#cups_dest_t" title=
"Destination">cups_dest_t
</a></li>
521 <li><a href=
"#cups_device_cb_t" title=
"Device callback
522 ">cups_device_cb_t
</a></li>
523 <li><a href=
"#cups_dinfo_t" title=
"Destination capability and status
524 information ">cups_dinfo_t
</a></li>
525 <li><a href=
"#cups_job_t" title=
"Job">cups_job_t
</a></li>
526 <li><a href=
"#cups_option_t" title=
"Printer Options">cups_option_t
</a></li>
527 <li><a href=
"#cups_password_cb2_t" title=
"New password callback
528 ">cups_password_cb2_t
</a></li>
529 <li><a href=
"#cups_password_cb_t" title=
"Password callback">cups_password_cb_t
</a></li>
530 <li><a href=
"#cups_ptype_t" title=
"Printer type/capability bits">cups_ptype_t
</a></li>
531 <li><a href=
"#cups_server_cert_cb_t" title=
"Server credentials callback
532 ">cups_server_cert_cb_t
</a></li>
533 <li><a href=
"#cups_size_t" title=
"Media Size ">cups_size_t
</a></li>
534 <li><a href=
"#pwg_map_t" title=
"Map element - PPD to/from PWG">pwg_map_t
</a></li>
535 <li><a href=
"#pwg_media_t" title=
"Common media size data">pwg_media_t
</a></li>
536 <li><a href=
"#pwg_size_t" title=
"Size element - PPD to/from PWG">pwg_size_t
</a></li>
538 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
539 <li><a href=
"#cups_dest_s" title=
"Destination">cups_dest_s
</a></li>
540 <li><a href=
"#cups_job_s" title=
"Job">cups_job_s
</a></li>
541 <li><a href=
"#cups_option_s" title=
"Printer Options">cups_option_s
</a></li>
542 <li><a href=
"#cups_size_s" title=
"Media Size ">cups_size_s
</a></li>
543 <li><a href=
"#pollfd" title=
"User data (unused)">pollfd
</a></li>
544 <li><a href=
"#pwg_map_s" title=
"Map element - PPD to/from PWG">pwg_map_s
</a></li>
545 <li><a href=
"#pwg_media_s" title=
"Common media size data">pwg_media_s
</a></li>
546 <li><a href=
"#pwg_size_s" title=
"Size element - PPD to/from PWG">pwg_size_s
</a></li>
548 <li><a href=
"#VARIABLES">Variables
</a><ul class=
"code">
549 <li><a href=
"#CF_RETURNS_RETAINED" title=
"Get the Apple language identifier associated with a
550 locale ID.">CF_RETURNS_RETAINED
</a></li>
552 <li><a href=
"#ENUMERATIONS">Constants
</a><ul class=
"code">
553 <li><a href=
"#cups_ptype_e" title=
"Printer type/capability bit
554 constants">cups_ptype_e
</a></li>
558 API introduction for CUPS.
560 Copyright 2007-2013 by Apple Inc.
561 Copyright 1997-2006 by Easy Software Products, all rights reserved.
563 These coded instructions, statements, and computer programs are the
564 property of Apple Inc. and are protected by Federal copyright
565 law. Distribution and use rights are outlined in the file "LICENSE.txt"
566 which should have been included with this file. If this file is
567 file is missing or damaged, see the license at "http://www.cups.org/".
570 <h2 class='title'
><a name='OVERVIEW'
>Overview
</a></h2>
572 <p>The CUPS API provides the convenience functions needed to support
573 applications, filters, printer drivers, and backends that need to interface
574 with the CUPS scheduler.
</p>
576 <h3><a name='CLIENTS_AND_SERVERS'
>Clients and Servers
</a></h3>
578 <p>CUPS is based on the Internet Printing Protocol (
"IPP"), which allows
579 clients (applications) to communicate with a server (the scheduler) to get a
580 list of printers, send print jobs, and so forth. You identify which server
581 you want to communicate with using a pointer to the opaque structure
582 <code>http_t
</code>. All of the examples in this document use the
583 <code>CUPS_HTTP_DEFAULT
</code> constant, referring to the default connection
584 to the scheduler. The
<a href='api-httpipp.html' target='_top'
>HTTP and IPP
585 APIs
</a> document provides more information on server connections.
</p>
587 <h3><a name='PRINTERS_AND_CLASSES'
>Printers and Classes
</a></h3>
589 <p>Printers and classes (collections of printers) are accessed through
590 the
<a href=
"#cups_dest_t"><code>cups_dest_t
</code></a> structure which
591 includes the name (
<code>name
</code>), instance (
<code>instance
</code> -
592 a way of selecting certain saved options/settings), and the options and
593 attributes associated with that destination (
<code>num_options
</code> and
594 <code>options
</code>). Destinations are created using the
595 <a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> function and freed
596 using the
<a href='#cupsFreeDests'
><code>cupsFreeDests
</code></a> function.
597 The
<a href='#cupsGetDest'
><code>cupsGetDest
</code></a> function finds a
598 specific destination for printing:
</p>
600 <pre class='example'
>
601 #include
<cups/cups.h
>
603 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
604 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
605 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest =
<a href='#cupsGetDest'
>cupsGetDest
</a>(
"name", NULL, num_dests, dests);
607 /* do something with dest */
609 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
612 <p>Passing
<code>NULL
</code> to
613 <a href='#cupsGetDest'
><code>cupsGetDest
</code></a> for the destination name
614 will return the default destination. Similarly, passing a
<code>NULL
</code>
615 instance will return the default instance for that destination.
</p>
617 <div class='table'
><table summary='Table
1: Printer Attributes' width='
80%'
>
618 <caption>Table
1:
<a name='TABLE1'
>Printer Attributes
</a></caption>
621 <th>Attribute Name
</th>
627 <td>"auth-info-required"</td>
628 <td>The type of authentication required for printing to this
629 destination:
"none",
"username,password",
"domain,username,password",
630 or
"negotiate" (Kerberos)
</td>
633 <td>"printer-info"</td>
634 <td>The human-readable description of the destination such as
"My
638 <td>"printer-is-accepting-jobs"</td>
639 <td>"true" if the destination is accepting new jobs,
"false" if
643 <td>"printer-is-shared"</td>
644 <td>"true" if the destination is being shared with other computers,
648 <td>"printer-location"</td>
649 <td>The human-readable location of the destination such as
"Lab 4".
</td>
652 <td>"printer-make-and-model"</td>
653 <td>The human-readable make and model of the destination such as
"HP
654 LaserJet 4000 Series".
</td>
657 <td>"printer-state"</td>
658 <td>"3" if the destination is idle,
"4" if the destination is printing
659 a job, and
"5" if the destination is stopped.
</td>
662 <td>"printer-state-change-time"</td>
663 <td>The UNIX time when the destination entered the current state.
</td>
666 <td>"printer-state-reasons"</td>
667 <td>Additional comma-delimited state keywords for the destination
668 such as
"media-tray-empty-error" and
"toner-low-warning".
</td>
671 <td>"printer-type"</td>
672 <td>The
<a href='#cups_printer_t'
><code>cups_printer_t
</code></a>
673 value associated with the destination.
</td>
678 <h3><a name='OPTIONS'
>Options
</a></h3>
680 <p>Options are stored in arrays of
681 <a href='#cups_option_t'
><code>cups_option_t
</code></a> structures. Each
682 option has a name (
<code>name
</code>) and value (
<code>value
</code>)
683 associated with it. The
<a href='#cups_dest_t'
><code>cups_dest_t
</code></a>
684 <code>num_options
</code> and
<code>options
</code> members contain the
685 default options for a particular destination, along with several informational
686 attributes about the destination as shown in
<a href='#TABLE1'
>Table
1</a>.
687 The
<a href='#cupsGetOption'
><code>cupsGetOption
</code></a> function gets
688 the value for the named option. For example, the following code lists the
689 available destinations and their human-readable descriptions:
</p>
691 <pre class='example'
>
692 #include
<cups/cups.h
>
694 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
695 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
696 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
700 for (i = num_dests, dest = dests; i
> 0; i --, dest ++)
701 if (dest-
>instance == NULL)
703 value =
<a href='#cupsGetOption'
>cupsGetOption
</a>(
"printer-info", dest-
>num_options, dest-
>options);
704 printf(
"%s (%s)\n", dest-
>name, value ? value :
"no description");
707 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
710 <p>You can create your own option arrays using the
711 <a href='#cupsAddOption'
><code>cupsAddOption
</code></a> function, which
712 adds a single named option to an array:
</p>
714 <pre class='example'
>
715 #include
<cups/cups.h
>
718 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
720 /* The returned num_options value is updated as needed */
721 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"value", num_options,
&options);
723 /* This adds a second option value */
724 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"second",
"value", num_options,
&options);
726 /* This replaces the first option we added */
727 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"new value", num_options,
&options);
730 <p>Use a
<code>for
</code> loop to copy the options from a destination:
</p>
732 <pre class='example'
>
733 #include
<cups/cups.h
>
737 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
738 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
740 for (i =
0; i
< dest-
>num_options; i ++)
741 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(dest-
>options[i].name, dest-
>options[i].value,
742 num_options,
&options);
745 <p>Use the
<a href='#cupsFreeOptions'
><code>cupsFreeOptions
</code></a>
746 function to free the options array when you are done using it:
</p>
748 <pre class='example'
>
749 <a href='#cupsFreeOptions'
>cupsFreeOptions
</a>(num_options, options);
752 <h3><a name='PRINT_JOBS'
>Print Jobs
</a></h3>
754 <p>Print jobs are identified by a locally-unique job ID number from
1 to
755 2<sup>31</sup>-
1 and have options and one or more files for printing to a
756 single destination. The
<a href='#cupsPrintFile'
><code>cupsPrintFile
</code></a>
757 function creates a new job with one file. The following code prints the CUPS
760 <pre class='example'
>
761 #include
<cups/cups.h
>
763 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
765 <a href='#cups_option_t'
>cups_option_t
</a> *options;
768 /* Print a single file */
769 job_id =
<a href='#cupsPrintFile'
>cupsPrintFile
</a>(dest-
>name,
"/usr/share/cups/data/testprint.ps",
770 "Test Print", num_options, options);
773 <p>The
<a href='#cupsPrintFiles'
><code>cupsPrintFiles
</code></a> function
774 creates a job with multiple files. The files are provided in a
775 <code>char *
</code> array:
</p>
777 <pre class='example'
>
778 #include
<cups/cups.h
>
780 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
782 <a href='#cups_option_t'
>cups_option_t
</a> *options;
784 char *files[
3] = {
"file1.pdf",
"file2.pdf",
"file3.pdf" };
786 /* Print three files */
787 job_id =
<a href='#cupsPrintFiles'
>cupsPrintFiles
</a>(dest-
>name,
3, files,
"Test Print", num_options, options);
790 <p>Finally, the
<a href='#cupsCreateJob'
><code>cupsCreateJob
</code></a>
791 function creates a new job with no files in it. Files are added using the
792 <a href='#cupsStartDocument'
><code>cupsStartDocument
</code></a>,
793 <a href='api-httpipp.html#cupsWriteRequestData'
><code>cupsWriteRequestData
</code></a>,
794 and
<a href='#cupsFinishDocument'
><code>cupsFinishDocument
</code></a> functions.
795 The following example creates a job with
10 text files for printing:
</p>
797 <pre class='example'
>
798 #include
<cups/cups.h
>
800 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
802 <a href='#cups_option_t'
>cups_option_t
</a> *options;
808 job_id =
<a href='#cupsCreateJob'
>cupsCreateJob
</a>(CUPS_HTTP_DEFAULT, dest-
>name,
"10 Text Files",
809 num_options, options);
811 /* If the job is created, add
10 files */
814 for (i =
1; i
<=
10; i ++)
816 snprintf(buffer, sizeof(buffer),
"file%d.txt", i);
818 <a href='#cupsStartDocument'
>cupsStartDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name, job_id, buffer,
819 CUPS_FORMAT_TEXT, i ==
10);
821 snprintf(buffer, sizeof(buffer),
829 /* cupsWriteRequestData can be called as many times as needed */
830 <a href='#cupsWriteRequestData'
>cupsWriteRequestData
</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
832 <a href='#cupsFinishDocument'
>cupsFinishDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name);
837 <p>Once you have created a job, you can monitor its status using the
838 <a href='#cupsGetJobs'
><code>cupsGetJobs
</code></a> function, which returns
839 an array of
<a href='#cups_job_t'
><code>cups_job_t
</code></a> structures.
840 Each contains the job ID (
<code>id
</code>), destination name
841 (
<code>dest
</code>), title (
<code>title
</code>), and other information
842 associated with the job. The job array is freed using the
843 <a href='#cupsFreeJobs'
><code>cupsFreeJobs
</code></a> function. The following
844 example monitors a specific job ID, showing the current job state once every
845 5 seconds until the job is completed:
</p>
847 <pre class='example'
>
848 #include
<cups/cups.h
>
850 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
853 <a href='#cups_job_t'
>cups_job_t
</a> *jobs;
855 ipp_jstate_t job_state = IPP_JOB_PENDING;
857 while (job_state
< IPP_JOB_STOPPED)
859 /* Get my jobs (
1) with any state (-
1) */
860 num_jobs =
<a href='#cupsGetJobs'
>cupsGetJobs
</a>(
&jobs, dest-
>name,
1, -
1);
862 /* Loop to find my job */
863 job_state = IPP_JOB_COMPLETED;
865 for (i =
0; i
< num_jobs; i ++)
866 if (jobs[i].id == job_id)
868 job_state = jobs[i].state;
872 /* Free the job array */
873 <a href='#cupsFreeJobs'
>cupsFreeJobs
</a>(num_jobs, jobs);
875 /* Show the current state */
878 case IPP_JOB_PENDING :
879 printf(
"Job %d is pending.\n", job_id);
882 printf(
"Job %d is held.\n", job_id);
884 case IPP_JOB_PROCESSING :
885 printf(
"Job %d is processing.\n", job_id);
887 case IPP_JOB_STOPPED :
888 printf(
"Job %d is stopped.\n", job_id);
890 case IPP_JOB_CANCELED :
891 printf(
"Job %d is canceled.\n", job_id);
893 case IPP_JOB_ABORTED :
894 printf(
"Job %d is aborted.\n", job_id);
896 case IPP_JOB_COMPLETED :
897 printf(
"Job %d is completed.\n", job_id);
901 /* Sleep if the job is not finished */
902 if (job_state
< IPP_JOB_STOPPED)
907 <p>To cancel a job, use the
908 <a href='#cupsCancelJob'
><code>cupsCancelJob
</code></a> function with the
911 <pre class='example'
>
912 #include
<cups/cups.h
>
914 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
917 <a href='#cupsCancelJob'
>cupsCancelJob
</a>(dest-
>name, job_id);
920 <h3><a name='ERROR_HANDLING'
>Error Handling
</a></h3>
922 <p>If any of the CUPS API printing functions returns an error, the reason for
923 that error can be found by calling the
924 <a href='#cupsLastError'
><code>cupsLastError
</code></a> and
925 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> functions.
926 <a href='#cupsLastError'
><code>cupsLastError
</code></a> returns the last IPP
928 (
<a href='api-httpipp.html#ipp_status_t'
><code>ipp_status_t
</code></a>)
929 that was encountered, while
930 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> returns
931 a (localized) human-readable string that can be shown to the user. For example,
932 if any of the job creation functions returns a job ID of
0, you can use
933 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> to show
934 the reason why the job could not be created:
</p>
936 <pre class='example'
>
937 #include
<cups/cups.h
>
942 puts(cupsLastErrorString());
945 <h3><a name='PASSWORDS_AND_AUTHENTICATION'
>Passwords and Authentication
</a></h3>
947 <p>CUPS supports authentication of any request, including submission of print
948 jobs. The default mechanism for getting the username and password is to use the
949 login user and a password from the console.
</p>
951 <p>To support other types of applications, in particular Graphical User
952 Interfaces (
"GUIs"), the CUPS API provides functions to set the default
953 username and to register a callback function that returns a password string.
</p>
955 <p>The
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a>
956 function is used to set a password callback in your program. Only one
957 function can be used at any time.
</p>
959 <p>The
<a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function sets the
960 current username for authentication. This function can be called by your
961 password callback function to change the current username as needed.
</p>
963 <p>The following example shows a simple password callback that gets a
964 username and password from the user:
</p>
966 <pre class='example'
>
967 #include
<cups/cups.h
>
970 my_password_cb(const char *prompt)
977 /* Get a username from the user */
978 printf(
"Username: ");
979 if (fgets(user, sizeof(user), stdin) == NULL)
982 /* Strip the newline from the string and set the user */
983 user[strlen(user) -
1] = '\
0';
985 <a href='#cupsSetUser'
>cupsSetUser
</a>(user);
987 /* Use getpass() to ask for the password... */
988 return (getpass(
"Password: "));
991 <a href='#cupsSetPasswordCB'
>cupsSetPasswordCB
</a>(my_password_cb);
994 <p>Similarly, a GUI could display the prompt string in a window with input
995 fields for the username and password. The username should default to the
996 string returned by the
<a href=
"#cupsUser"><code>cupsUser
</code></a>
998 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
999 <h3 class=
"function"><a name=
"cupsAddDest">cupsAddDest
</a></h3>
1000 <p class=
"description">Add a destination to the list of destinations.
</p>
1002 int cupsAddDest (
<br>
1003 const char *name,
<br>
1004 const char *instance,
<br>
1005 int num_dests,
<br>
1006 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1008 <h4 class=
"parameters">Parameters
</h4>
1011 <dd class=
"description">Destination name
</dd>
1013 <dd class=
"description">Instance name or
<code>NULL
</code> for none/primary
</dd>
1015 <dd class=
"description">Number of destinations
</dd>
1017 <dd class=
"description">Destinations
</dd>
1019 <h4 class=
"returnvalue">Return Value
</h4>
1020 <p class=
"description">New number of destinations
</p>
1021 <h4 class=
"discussion">Discussion
</h4>
1022 <p class=
"discussion">This function cannot be used to add a new class or printer queue,
1023 it only adds a new container of saved options for the named
1024 destination or instance.
<br>
1026 If the named destination already exists, the destination list is
1027 returned unchanged. Adding a new instance of a destination creates
1028 a copy of that destination's options.
<br>
1030 Use the
<a href=
"#cupsSaveDests"><code>cupsSaveDests
</code></a> function to save the updated list of
1031 destinations to the user's lpoptions file.
</p>
1032 <h3 class=
"function"><a name=
"cupsAddOption">cupsAddOption
</a></h3>
1033 <p class=
"description">Add an option to an option array.
</p>
1035 int cupsAddOption (
<br>
1036 const char *name,
<br>
1037 const char *value,
<br>
1038 int num_options,
<br>
1039 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
1041 <h4 class=
"parameters">Parameters
</h4>
1044 <dd class=
"description">Name of option
</dd>
1046 <dd class=
"description">Value of option
</dd>
1047 <dt>num_options
</dt>
1048 <dd class=
"description">Number of options
</dd>
1050 <dd class=
"description">Pointer to options
</dd>
1052 <h4 class=
"returnvalue">Return Value
</h4>
1053 <p class=
"description">Number of options
</p>
1054 <h4 class=
"discussion">Discussion
</h4>
1055 <p class=
"discussion">New option arrays can be initialized simply by passing
0 for the
1056 "num_options
" parameter.
</p>
1057 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD
</a></h3>
1058 <p class=
"description">Create the Windows PPD file for a printer.
</p>
1060 char *cupsAdminCreateWindowsPPD (
<br>
1061 http_t *http,
<br>
1062 const char *dest,
<br>
1063 char *buffer,
<br>
1064 int bufsize
<br>
1066 <h4 class=
"parameters">Parameters
</h4>
1069 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1071 <dd class=
"description">Printer or class
</dd>
1073 <dd class=
"description">Filename buffer
</dd>
1075 <dd class=
"description">Size of filename buffer
</dd>
1077 <h4 class=
"returnvalue">Return Value
</h4>
1078 <p class=
"description">PPD file or NULL
</p>
1079 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsAdminExportSamba">cupsAdminExportSamba
</a></h3>
1080 <p class=
"description">Export a printer to Samba.
</p>
1082 int cupsAdminExportSamba (
<br>
1083 const char *dest,
<br>
1084 const char *ppd,
<br>
1085 const char *samba_server,
<br>
1086 const char *samba_user,
<br>
1087 const char *samba_password,
<br>
1088 FILE *logfile
<br>
1090 <h4 class=
"parameters">Parameters
</h4>
1093 <dd class=
"description">Destination to export
</dd>
1095 <dd class=
"description">PPD file
</dd>
1096 <dt>samba_server
</dt>
1097 <dd class=
"description">Samba server
</dd>
1099 <dd class=
"description">Samba username
</dd>
1100 <dt>samba_password
</dt>
1101 <dd class=
"description">Samba password
</dd>
1103 <dd class=
"description">Log file, if any
</dd>
1105 <h4 class=
"returnvalue">Return Value
</h4>
1106 <p class=
"description">1 on success,
0 on failure
</p>
1107 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsAdminGetServerSettings">cupsAdminGetServerSettings
</a></h3>
1108 <p class=
"description">Get settings from the server.
</p>
1110 int cupsAdminGetServerSettings (
<br>
1111 http_t *http,
<br>
1112 int *num_settings,
<br>
1113 <a href=
"#cups_option_t">cups_option_t
</a> **settings
<br>
1115 <h4 class=
"parameters">Parameters
</h4>
1118 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1119 <dt>num_settings
</dt>
1120 <dd class=
"description">Number of settings
</dd>
1122 <dd class=
"description">Settings
</dd>
1124 <h4 class=
"returnvalue">Return Value
</h4>
1125 <p class=
"description">1 on success,
0 on failure
</p>
1126 <h4 class=
"discussion">Discussion
</h4>
1127 <p class=
"discussion">The returned settings should be freed with cupsFreeOptions() when
1128 you are done with them.
1131 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsAdminSetServerSettings">cupsAdminSetServerSettings
</a></h3>
1132 <p class=
"description">Set settings on the server.
</p>
1134 int cupsAdminSetServerSettings (
<br>
1135 http_t *http,
<br>
1136 int num_settings,
<br>
1137 <a href=
"#cups_option_t">cups_option_t
</a> *settings
<br>
1139 <h4 class=
"parameters">Parameters
</h4>
1142 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1143 <dt>num_settings
</dt>
1144 <dd class=
"description">Number of settings
</dd>
1146 <dd class=
"description">Settings
</dd>
1148 <h4 class=
"returnvalue">Return Value
</h4>
1149 <p class=
"description">1 on success,
0 on failure
</p>
1150 <h3 class=
"function"><a name=
"cupsCancelDestJob">cupsCancelDestJob
</a></h3>
1151 <p class=
"description">Include necessary headers...
</p>
1153 ipp_status_t cupsCancelDestJob (
<br>
1154 http_t *http,
<br>
1155 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1156 int job_id
<br>
1158 <h4 class=
"parameters">Parameters
</h4>
1161 <dd class=
"description">Connection to destination
</dd>
1163 <dd class=
"description">Destination
</dd>
1165 <dd class=
"description">Job ID
</dd>
1167 <h4 class=
"returnvalue">Return Value
</h4>
1168 <p class=
"description">Cancel a job on a destination.
</p>
1169 <p class=
"discussion">The
"job_id
" is the number returned by cupsCreateDestJob.
<br>
1171 Returns
<code>IPP_STATUS_OK
</code> on success and
1172 <code>IPP_STATUS_ERRPR_NOT_AUTHORIZED
</code> or
1173 <code>IPP_STATUS_ERROR_FORBIDDEN
</code> on failure.
1176 <h3 class=
"function"><a name=
"cupsCancelJob">cupsCancelJob
</a></h3>
1177 <p class=
"description">Cancel a print job on the default server.
</p>
1179 int cupsCancelJob (
<br>
1180 const char *name,
<br>
1181 int job_id
<br>
1183 <h4 class=
"parameters">Parameters
</h4>
1186 <dd class=
"description">Name of printer or class
</dd>
1188 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1190 <h4 class=
"returnvalue">Return Value
</h4>
1191 <p class=
"description">1 on success,
0 on failure
</p>
1192 <h4 class=
"discussion">Discussion
</h4>
1193 <p class=
"discussion">Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1194 to cancel the current job on the named destination.
<br>
1196 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1197 the cause of any failure.
</p>
1198 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsCancelJob2">cupsCancelJob2
</a></h3>
1199 <p class=
"description">Cancel or purge a print job.
</p>
1201 ipp_status_t cupsCancelJob2 (
<br>
1202 http_t *http,
<br>
1203 const char *name,
<br>
1204 int job_id,
<br>
1205 int purge
<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">Name of printer or class
</dd>
1214 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1216 <dd class=
"description">1 to purge,
0 to cancel
</dd>
1218 <h4 class=
"returnvalue">Return Value
</h4>
1219 <p class=
"description">IPP status
</p>
1220 <h4 class=
"discussion">Discussion
</h4>
1221 <p class=
"discussion">Canceled jobs remain in the job history while purged jobs are removed
1222 from the job history.
<br>
1224 Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1225 to cancel the current job on the named destination.
<br>
1227 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1228 the cause of any failure.
1231 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCheckDestSupported">cupsCheckDestSupported
</a></h3>
1232 <p class=
"description">Check that the option and value are supported
1233 by the destination.
</p>
1235 int cupsCheckDestSupported (
<br>
1236 http_t *http,
<br>
1237 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1238 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1239 const char *option,
<br>
1240 const char *value
<br>
1242 <h4 class=
"parameters">Parameters
</h4>
1245 <dd class=
"description">Connection to destination
</dd>
1247 <dd class=
"description">Destination
</dd>
1249 <dd class=
"description">Destination information
</dd>
1251 <dd class=
"description">Option
</dd>
1253 <dd class=
"description">Value
</dd>
1255 <h4 class=
"returnvalue">Return Value
</h4>
1256 <p class=
"description">1 if supported,
0 otherwise
</p>
1257 <h4 class=
"discussion">Discussion
</h4>
1258 <p class=
"discussion">Returns
1 if supported,
0 otherwise.
1261 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCloseDestJob">cupsCloseDestJob
</a></h3>
1262 <p class=
"description">Close a job and start printing.
</p>
1264 ipp_status_t cupsCloseDestJob (
<br>
1265 http_t *http,
<br>
1266 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1267 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
1268 int job_id
<br>
1270 <h4 class=
"parameters">Parameters
</h4>
1273 <dd class=
"description">Connection to destination
</dd>
1275 <dd class=
"description">Destination
</dd>
1277 <dd class=
"description">Destination information
</dd>
1279 <dd class=
"description">Job ID
</dd>
1281 <h4 class=
"returnvalue">Return Value
</h4>
1282 <p class=
"description">IPP status code
</p>
1283 <h4 class=
"discussion">Discussion
</h4>
1284 <p class=
"discussion">Use when the last call to cupsStartDocument passed
0 for
"last_document
".
1285 "job_id
" is the job ID returned by cupsCreateDestJob. Returns
<code>IPP_STATUS_OK
</code>
1289 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsConnectDest">cupsConnectDest
</a></h3>
1290 <p class=
"description">Connect to the server for a destination.
</p>
1292 http_t *cupsConnectDest (
<br>
1293 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1294 unsigned flags,
<br>
1295 int msec,
<br>
1296 int *cancel,
<br>
1297 char *resource,
<br>
1298 size_t resourcesize,
<br>
1299 <a href=
"#cups_dest_cb_t">cups_dest_cb_t
</a> cb,
<br>
1300 void *user_data
<br>
1302 <h4 class=
"parameters">Parameters
</h4>
1305 <dd class=
"description">Destination
</dd>
1307 <dd class=
"description">Connection flags
</dd>
1309 <dd class=
"description">Timeout in milliseconds
</dd>
1311 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1313 <dd class=
"description">Resource buffer
</dd>
1314 <dt>resourcesize
</dt>
1315 <dd class=
"description">Size of resource buffer
</dd>
1317 <dd class=
"description">Callback function
</dd>
1319 <dd class=
"description">User data pointer
</dd>
1321 <h4 class=
"returnvalue">Return Value
</h4>
1322 <p class=
"description">Connection to server or
<code>NULL
</code></p>
1323 <h4 class=
"discussion">Discussion
</h4>
1324 <p class=
"discussion">Connect to the destination, returning a new http_t connection object and
1325 optionally the resource path to use for the destination. These calls will
1326 block until a connection is made, the timeout expires, the integer pointed
1327 to by
"cancel
" is non-zero, or the callback function (or block) returns
0,
1328 The caller is responsible for calling httpClose() on the returned object.
1331 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsConnectDestBlock">cupsConnectDestBlock
</a></h3>
1332 <p class=
"description">Connect to the server for a destination.
</p>
1334 http_t *cupsConnectDestBlock (
<br>
1335 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1336 unsigned flags,
<br>
1337 int msec,
<br>
1338 int *cancel,
<br>
1339 char *resource,
<br>
1340 size_t resourcesize,
<br>
1341 <a href=
"#cups_dest_block_t">cups_dest_block_t
</a> block
<br>
1343 <h4 class=
"parameters">Parameters
</h4>
1346 <dd class=
"description">Destination
</dd>
1348 <dd class=
"description">Connection flags
</dd>
1350 <dd class=
"description">Timeout in milliseconds
</dd>
1352 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1354 <dd class=
"description">Resource buffer
</dd>
1355 <dt>resourcesize
</dt>
1356 <dd class=
"description">Size of resource buffer
</dd>
1358 <dd class=
"description">Callback block
</dd>
1360 <h4 class=
"returnvalue">Return Value
</h4>
1361 <p class=
"description">Connection to server or
<code>NULL
</code></p>
1362 <h4 class=
"discussion">Discussion
</h4>
1363 <p class=
"discussion">Connect to the destination, returning a new http_t connection object and
1364 optionally the resource path to use for the destination. These calls will
1365 block until a connection is made, the timeout expires, the integer pointed
1366 to by
"cancel
" is non-zero, or the callback function (or block) returns
0,
1367 The caller is responsible for calling httpClose() on the returned object.
1370 <h3 class=
"function"><a name=
"cupsCopyDest">cupsCopyDest
</a></h3>
1371 <p class=
"description">Callback block
</p>
1373 int cupsCopyDest (
<br>
1374 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1375 int num_dests,
<br>
1376 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1378 <h4 class=
"parameters">Parameters
</h4>
1384 <h4 class=
"returnvalue">Return Value
</h4>
1385 <p class=
"description">Copy a destination.
</p>
1386 <p class=
"discussion">Make a copy of the destination to an array of destinations (or just a single
1387 copy) - for use with the cupsEnumDests* functions. The caller is responsible
1388 for calling cupsFreeDests() on the returned object(s).
1391 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCopyDestConflicts">cupsCopyDestConflicts
</a></h3>
1392 <p class=
"description">Get conflicts and resolutions for a new
1393 option/value pair.
</p>
1395 int cupsCopyDestConflicts (
<br>
1396 http_t *http,
<br>
1397 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1398 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1399 int num_options,
<br>
1400 <a href=
"#cups_option_t">cups_option_t
</a> *options,
<br>
1401 const char *new_option,
<br>
1402 const char *new_value,
<br>
1403 int *num_conflicts,
<br>
1404 <a href=
"#cups_option_t">cups_option_t
</a> **conflicts,
<br>
1405 int *num_resolved,
<br>
1406 <a href=
"#cups_option_t">cups_option_t
</a> **resolved
<br>
1408 <h4 class=
"parameters">Parameters
</h4>
1411 <dd class=
"description">Connection to destination
</dd>
1413 <dd class=
"description">Destination
</dd>
1415 <dd class=
"description">Destination information
</dd>
1416 <dt>num_options
</dt>
1417 <dd class=
"description">Number of current options
</dd>
1419 <dd class=
"description">Current options
</dd>
1421 <dd class=
"description">New option
</dd>
1423 <dd class=
"description">New value
</dd>
1424 <dt>num_conflicts
</dt>
1425 <dd class=
"description">Number of conflicting options
</dd>
1427 <dd class=
"description">Conflicting options
</dd>
1428 <dt>num_resolved
</dt>
1429 <dd class=
"description">Number of options to resolve
</dd>
1431 <dd class=
"description">Resolved options
</dd>
1433 <h4 class=
"returnvalue">Return Value
</h4>
1434 <p class=
"description">1 if there is a conflict,
0 if none, -
1 on error
</p>
1435 <h4 class=
"discussion">Discussion
</h4>
1436 <p class=
"discussion">"num_options
" and
"options
" represent the currently selected options by the
1437 user.
"new_option
" and
"new_value
" are the setting the user has just
1440 Returns
1 if there is a conflict,
0 if there are no conflicts, and -
1 if
1441 there was an unrecoverable error such as a resolver loop.
<br>
1443 If
"num_conflicts
" and
"conflicts
" are not
<code>NULL
</code>, they are set to
1444 contain the list of conflicting option/value pairs. Similarly, if
1445 "num_resolved
" and
"resolved
" are not
<code>NULL
</code> they will be set to the
1446 list of changes needed to resolve the conflict.
<br>
1448 If cupsCopyDestConflicts returns
1 but
"num_resolved
" and
"resolved
" are set
1449 to
0 and
<code>NULL
</code>, respectively, then the conflict cannot be resolved.
1452 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCopyDestInfo">cupsCopyDestInfo
</a></h3>
1453 <p class=
"description">Get the supported values/capabilities for the
1456 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *cupsCopyDestInfo (
<br>
1457 http_t *http,
<br>
1458 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest
<br>
1460 <h4 class=
"parameters">Parameters
</h4>
1463 <dd class=
"description">Connection to destination
</dd>
1465 <dd class=
"description">Destination
</dd>
1467 <h4 class=
"returnvalue">Return Value
</h4>
1468 <p class=
"description">Destination information
</p>
1469 <h4 class=
"discussion">Discussion
</h4>
1470 <p class=
"discussion">The caller is responsible for calling
<a href=
"#cupsFreeDestInfo"><code>cupsFreeDestInfo
</code></a> on the return
1471 value.
<code>NULL
</code> is returned on error.
1474 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCreateDestJob">cupsCreateDestJob
</a></h3>
1475 <p class=
"description">Create a job on a destination.
</p>
1477 ipp_status_t cupsCreateDestJob (
<br>
1478 http_t *http,
<br>
1479 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1480 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
1481 int *job_id,
<br>
1482 const char *title,
<br>
1483 int num_options,
<br>
1484 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1486 <h4 class=
"parameters">Parameters
</h4>
1489 <dd class=
"description">Connection to destination
</dd>
1491 <dd class=
"description">Destination
</dd>
1493 <dd class=
"description">Destination information
</dd>
1495 <dd class=
"description">Job ID or
0 on error
</dd>
1497 <dd class=
"description">Job name
</dd>
1498 <dt>num_options
</dt>
1499 <dd class=
"description">Number of job options
</dd>
1501 <dd class=
"description">Job options
</dd>
1503 <h4 class=
"returnvalue">Return Value
</h4>
1504 <p class=
"description">IPP status code
</p>
1505 <h4 class=
"discussion">Discussion
</h4>
1506 <p class=
"discussion">Returns
<code>IPP_STATUS_OK
</code> or
<code>IPP_STATUS_OK_SUBST
</code> on success, saving the job ID
1507 in the variable pointed to by
"job_id
".
1510 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsCreateJob">cupsCreateJob
</a></h3>
1511 <p class=
"description">Create an empty job for streaming.
</p>
1513 int cupsCreateJob (
<br>
1514 http_t *http,
<br>
1515 const char *name,
<br>
1516 const char *title,
<br>
1517 int num_options,
<br>
1518 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1520 <h4 class=
"parameters">Parameters
</h4>
1523 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1525 <dd class=
"description">Destination name
</dd>
1527 <dd class=
"description">Title of job
</dd>
1528 <dt>num_options
</dt>
1529 <dd class=
"description">Number of options
</dd>
1531 <dd class=
"description">Options
</dd>
1533 <h4 class=
"returnvalue">Return Value
</h4>
1534 <p class=
"description">Job ID or
0 on error
</p>
1535 <h4 class=
"discussion">Discussion
</h4>
1536 <p class=
"discussion">Use this function when you want to stream print data using the
1537 <a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>,
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a>, and
1538 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> functions. If you have one or more files to
1539 print, use the
<a href=
"#cupsPrintFile2"><code>cupsPrintFile2
</code></a> or
<a href=
"#cupsPrintFiles2"><code>cupsPrintFiles2
</code></a> function
1543 <h3 class=
"function"><a name=
"cupsEncryption">cupsEncryption
</a></h3>
1544 <p class=
"description">Get the current encryption settings.
</p>
1546 http_encryption_t cupsEncryption (void);
</p>
1547 <h4 class=
"returnvalue">Return Value
</h4>
1548 <p class=
"description">Encryption settings
</p>
1549 <h4 class=
"discussion">Discussion
</h4>
1550 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
1551 environment variable, then the ~/.cups/client.conf file, and finally the
1552 /etc/cups/client.conf file. If not set, the default is
1553 <code>HTTP_ENCRYPTION_IF_REQUESTED
</code>.
<br>
1555 Note: The current encryption setting is tracked separately for each thread
1556 in a program. Multi-threaded programs that override the setting via the
1557 <a href=
"#cupsSetEncryption"><code>cupsSetEncryption
</code></a> function need to do so in each thread for the same
1558 setting to be used.
</p>
1559 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsEnumDests">cupsEnumDests
</a></h3>
1560 <p class=
"description">Enumerate available destinations with a callback function.
</p>
1562 int cupsEnumDests (
<br>
1563 unsigned flags,
<br>
1564 int msec,
<br>
1565 int *cancel,
<br>
1566 <a href=
"#cups_ptype_t">cups_ptype_t
</a> type,
<br>
1567 <a href=
"#cups_ptype_t">cups_ptype_t
</a> mask,
<br>
1568 <a href=
"#cups_dest_cb_t">cups_dest_cb_t
</a> cb,
<br>
1569 void *user_data
<br>
1571 <h4 class=
"parameters">Parameters
</h4>
1574 <dd class=
"description">Enumeration flags
</dd>
1576 <dd class=
"description">Timeout in milliseconds,
1577 -
1 for indefinite
</dd>
1579 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1581 <dd class=
"description">Printer type bits
</dd>
1583 <dd class=
"description">Mask for printer type bits
</dd>
1585 <dd class=
"description">Callback function
</dd>
1587 <dd class=
"description">User data
</dd>
1589 <h4 class=
"returnvalue">Return Value
</h4>
1590 <p class=
"description">1 on success,
0 on failure
</p>
1591 <h4 class=
"discussion">Discussion
</h4>
1592 <p class=
"discussion">Destinations are enumerated from one or more sources. The callback function
1593 receives the
<code>user_data
</code> pointer, destination name, instance, number of
1594 options, and options which can be used as input to the
<a href=
"#cupsAddDest"><code>cupsAddDest
</code></a>
1595 function. The function must return
1 to continue enumeration or
0 to stop.
<br>
1597 Enumeration happens on the current thread and does not return until all
1598 destinations have been enumerated or the callback function returns
0.
1601 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsEnumDestsBlock">cupsEnumDestsBlock
</a></h3>
1602 <p class=
"description">Enumerate available destinations with a block.
</p>
1604 int cupsEnumDestsBlock (
<br>
1605 unsigned flags,
<br>
1606 int timeout,
<br>
1607 int *cancel,
<br>
1608 <a href=
"#cups_ptype_t">cups_ptype_t
</a> type,
<br>
1609 <a href=
"#cups_ptype_t">cups_ptype_t
</a> mask,
<br>
1610 <a href=
"#cups_dest_block_t">cups_dest_block_t
</a> block
<br>
1612 <h4 class=
"parameters">Parameters
</h4>
1615 <dd class=
"description">Enumeration flags
</dd>
1617 <dd class=
"description">Timeout in milliseconds,
0 for indefinite
</dd>
1619 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1621 <dd class=
"description">Printer type bits
</dd>
1623 <dd class=
"description">Mask for printer type bits
</dd>
1625 <dd class=
"description">Block
</dd>
1627 <h4 class=
"returnvalue">Return Value
</h4>
1628 <p class=
"description">1 on success,
0 on failure
</p>
1629 <h4 class=
"discussion">Discussion
</h4>
1630 <p class=
"discussion">Destinations are enumerated from one or more sources. The block receives the
1631 destination name, instance, number of options, and options which can be used
1632 as input to the
<a href=
"#cupsAddDest"><code>cupsAddDest
</code></a> function. The block must return
1 to
1633 continue enumeration or
0 to stop.
<br>
1635 Enumeration happens on the current thread and does not return until all
1636 destinations have been enumerated or the block returns
0.
1639 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestDefault">cupsFindDestDefault
</a></h3>
1640 <p class=
"description">Find the default value(s) for the given option.
</p>
1642 ipp_attribute_t *cupsFindDestDefault (
<br>
1643 http_t *http,
<br>
1644 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1645 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1646 const char *option
<br>
1648 <h4 class=
"parameters">Parameters
</h4>
1651 <dd class=
"description">Connection to destination
</dd>
1653 <dd class=
"description">Destination
</dd>
1655 <dd class=
"description">Destination information
</dd>
1657 <dd class=
"description">Option/attribute name
</dd>
1659 <h4 class=
"returnvalue">Return Value
</h4>
1660 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1661 <h4 class=
"discussion">Discussion
</h4>
1662 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1663 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1664 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1665 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1666 functions to inspect the default value(s) as needed.
1669 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestReady">cupsFindDestReady
</a></h3>
1670 <p class=
"description">Find the default value(s) for the given option.
</p>
1672 ipp_attribute_t *cupsFindDestReady (
<br>
1673 http_t *http,
<br>
1674 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1675 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1676 const char *option
<br>
1678 <h4 class=
"parameters">Parameters
</h4>
1681 <dd class=
"description">Connection to destination
</dd>
1683 <dd class=
"description">Destination
</dd>
1685 <dd class=
"description">Destination information
</dd>
1687 <dd class=
"description">Option/attribute name
</dd>
1689 <h4 class=
"returnvalue">Return Value
</h4>
1690 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1691 <h4 class=
"discussion">Discussion
</h4>
1692 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1693 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1694 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1695 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1696 functions to inspect the default value(s) as needed.
1699 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestSupported">cupsFindDestSupported
</a></h3>
1700 <p class=
"description">Find the default value(s) for the given option.
</p>
1702 ipp_attribute_t *cupsFindDestSupported (
<br>
1703 http_t *http,
<br>
1704 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1705 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1706 const char *option
<br>
1708 <h4 class=
"parameters">Parameters
</h4>
1711 <dd class=
"description">Connection to destination
</dd>
1713 <dd class=
"description">Destination
</dd>
1715 <dd class=
"description">Destination information
</dd>
1717 <dd class=
"description">Option/attribute name
</dd>
1719 <h4 class=
"returnvalue">Return Value
</h4>
1720 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1721 <h4 class=
"discussion">Discussion
</h4>
1722 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1723 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1724 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1725 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1726 functions to inspect the default value(s) as needed.
1729 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsFinishDestDocument">cupsFinishDestDocument
</a></h3>
1730 <p class=
"description">Finish the current document.
</p>
1732 ipp_status_t cupsFinishDestDocument (
<br>
1733 http_t *http,
<br>
1734 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1735 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info
<br>
1737 <h4 class=
"parameters">Parameters
</h4>
1740 <dd class=
"description">Connection to destination
</dd>
1742 <dd class=
"description">Destination
</dd>
1744 <dd class=
"description">Destination information
</dd>
1746 <h4 class=
"returnvalue">Return Value
</h4>
1747 <p class=
"description">Status of document submission
</p>
1748 <h4 class=
"discussion">Discussion
</h4>
1749 <p class=
"discussion">Returns
<code>IPP_STATUS_OK
</code> or
<code>IPP_STATUS_OK_SUBST
</code> on success.
1752 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsFinishDocument">cupsFinishDocument
</a></h3>
1753 <p class=
"description">Finish sending a document.
</p>
1755 ipp_status_t cupsFinishDocument (
<br>
1756 http_t *http,
<br>
1757 const char *name
<br>
1759 <h4 class=
"parameters">Parameters
</h4>
1762 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1764 <dd class=
"description">Destination name
</dd>
1766 <h4 class=
"returnvalue">Return Value
</h4>
1767 <p class=
"description">Status of document submission
</p>
1768 <h4 class=
"discussion">Discussion
</h4>
1769 <p class=
"discussion">The document must have been started using
<a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>.
1772 <h3 class=
"function"><a name=
"cupsFreeDestInfo">cupsFreeDestInfo
</a></h3>
1773 <p class=
"description">Free destination information obtained using
1774 <a href=
"#cupsCopyDestInfo"><code>cupsCopyDestInfo
</code></a>.
</p>
1776 void cupsFreeDestInfo (
<br>
1777 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo
<br>
1779 <h4 class=
"parameters">Parameters
</h4>
1782 <dd class=
"description">Destination information
</dd>
1784 <h3 class=
"function"><a name=
"cupsFreeDests">cupsFreeDests
</a></h3>
1785 <p class=
"description">Free the memory used by the list of destinations.
</p>
1787 void cupsFreeDests (
<br>
1788 int num_dests,
<br>
1789 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1791 <h4 class=
"parameters">Parameters
</h4>
1794 <dd class=
"description">Number of destinations
</dd>
1796 <dd class=
"description">Destinations
</dd>
1798 <h3 class=
"function"><a name=
"cupsFreeJobs">cupsFreeJobs
</a></h3>
1799 <p class=
"description">Free memory used by job data.
</p>
1801 void cupsFreeJobs (
<br>
1802 int num_jobs,
<br>
1803 <a href=
"#cups_job_t">cups_job_t
</a> *jobs
<br>
1805 <h4 class=
"parameters">Parameters
</h4>
1808 <dd class=
"description">Number of jobs
</dd>
1810 <dd class=
"description">Jobs
</dd>
1812 <h3 class=
"function"><a name=
"cupsFreeOptions">cupsFreeOptions
</a></h3>
1813 <p class=
"description">Free all memory used by options.
</p>
1815 void cupsFreeOptions (
<br>
1816 int num_options,
<br>
1817 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1819 <h4 class=
"parameters">Parameters
</h4>
1821 <dt>num_options
</dt>
1822 <dd class=
"description">Number of options
</dd>
1824 <dd class=
"description">Pointer to options
</dd>
1826 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetClasses">cupsGetClasses
</a></h3>
1827 <p class=
"description">Get a list of printer classes from the default server.
</p>
1829 int cupsGetClasses (
<br>
1830 char ***classes
<br>
1832 <h4 class=
"parameters">Parameters
</h4>
1835 <dd class=
"description">Classes
</dd>
1837 <h4 class=
"returnvalue">Return Value
</h4>
1838 <p class=
"description">Number of classes
</p>
1839 <h4 class=
"discussion">Discussion
</h4>
1840 <p class=
"discussion">This function is deprecated and no longer returns a list of printer
1841 classes - use
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
1844 <h3 class=
"function"><a name=
"cupsGetDefault">cupsGetDefault
</a></h3>
1845 <p class=
"description">Get the default printer or class for the default server.
</p>
1847 const char *cupsGetDefault (void);
</p>
1848 <h4 class=
"returnvalue">Return Value
</h4>
1849 <p class=
"description">Default printer or
<code>NULL
</code></p>
1850 <h4 class=
"discussion">Discussion
</h4>
1851 <p class=
"discussion">This function returns the default printer or class as defined by
1852 the LPDEST or PRINTER environment variables. If these environment
1853 variables are not set, the server default destination is returned.
1854 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1855 functions to get the user-defined default printer, as this function does
1856 not support the lpoptions-defined default printer.
</p>
1857 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetDefault2">cupsGetDefault2
</a></h3>
1858 <p class=
"description">Get the default printer or class for the specified server.
</p>
1860 const char *cupsGetDefault2 (
<br>
1861 http_t *http
<br>
1863 <h4 class=
"parameters">Parameters
</h4>
1866 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1868 <h4 class=
"returnvalue">Return Value
</h4>
1869 <p class=
"description">Default printer or
<code>NULL
</code></p>
1870 <h4 class=
"discussion">Discussion
</h4>
1871 <p class=
"discussion">This function returns the default printer or class as defined by
1872 the LPDEST or PRINTER environment variables. If these environment
1873 variables are not set, the server default destination is returned.
1874 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1875 functions to get the user-defined default printer, as this function does
1876 not support the lpoptions-defined default printer.
1879 <h3 class=
"function"><a name=
"cupsGetDest">cupsGetDest
</a></h3>
1880 <p class=
"description">Get the named destination from the list.
</p>
1882 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetDest (
<br>
1883 const char *name,
<br>
1884 const char *instance,
<br>
1885 int num_dests,
<br>
1886 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1888 <h4 class=
"parameters">Parameters
</h4>
1891 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
1893 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
1895 <dd class=
"description">Number of destinations
</dd>
1897 <dd class=
"description">Destinations
</dd>
1899 <h4 class=
"returnvalue">Return Value
</h4>
1900 <p class=
"description">Destination pointer or
<code>NULL
</code></p>
1901 <h4 class=
"discussion">Discussion
</h4>
1902 <p class=
"discussion">Use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> or
<a href=
"#cupsGetDests2"><code>cupsGetDests2
</code></a> functions to get a
1903 list of supported destinations for the current user.
</p>
1904 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaByIndex">cupsGetDestMediaByIndex
</a></h3>
1905 <p class=
"description">Get a media name, dimension, and margins for a
1908 int cupsGetDestMediaByIndex (
<br>
1909 http_t *http,
<br>
1910 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1911 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1912 int n,
<br>
1913 unsigned flags,
<br>
1914 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1916 <h4 class=
"parameters">Parameters
</h4>
1919 <dd class=
"description">Connection to destination
</dd>
1921 <dd class=
"description">Destination
</dd>
1923 <dd class=
"description">Destination information
</dd>
1925 <dd class=
"description">Media size number (
0-based)
</dd>
1927 <dd class=
"description">Media flags
</dd>
1929 <dd class=
"description">Media size information
</dd>
1931 <h4 class=
"returnvalue">Return Value
</h4>
1932 <p class=
"description">1 on success,
0 on failure
</p>
1933 <h4 class=
"discussion">Discussion
</h4>
1934 <p class=
"discussion">The
<code>flags
</code> parameter determines which set of media are indexed. For
1935 example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will get the Nth
1936 borderless size supported by the printer.
1939 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsGetDestMediaByName">cupsGetDestMediaByName
</a></h3>
1940 <p class=
"description">Get media names, dimensions, and margins.
</p>
1942 int cupsGetDestMediaByName (
<br>
1943 http_t *http,
<br>
1944 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1945 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1946 const char *media,
<br>
1947 unsigned flags,
<br>
1948 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1950 <h4 class=
"parameters">Parameters
</h4>
1953 <dd class=
"description">Connection to destination
</dd>
1955 <dd class=
"description">Destination
</dd>
1957 <dd class=
"description">Destination information
</dd>
1959 <dd class=
"description">Media name
</dd>
1961 <dd class=
"description">Media matching flags
</dd>
1963 <dd class=
"description">Media size information
</dd>
1965 <h4 class=
"returnvalue">Return Value
</h4>
1966 <p class=
"description">1 on match,
0 on failure
</p>
1967 <h4 class=
"discussion">Discussion
</h4>
1968 <p class=
"discussion">The
"media
" string is a PWG media name.
"Flags
" provides some matching
1969 guidance (multiple flags can be combined):
<br>
1971 CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
1972 CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
1973 CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with
2-sided printing,
1974 CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
1975 CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
1976 size amongst the
"ready
" media.
<br>
1978 The matching result (if any) is returned in the
"cups_size_t
" structure.
<br>
1980 Returns
1 when there is a match and
0 if there is not a match.
1983 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsGetDestMediaBySize">cupsGetDestMediaBySize
</a></h3>
1984 <p class=
"description">Get media names, dimensions, and margins.
</p>
1986 int cupsGetDestMediaBySize (
<br>
1987 http_t *http,
<br>
1988 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1989 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1990 int width,
<br>
1991 int length,
<br>
1992 unsigned flags,
<br>
1993 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1995 <h4 class=
"parameters">Parameters
</h4>
1998 <dd class=
"description">Connection to destination
</dd>
2000 <dd class=
"description">Destination
</dd>
2002 <dd class=
"description">Destination information
</dd>
2004 <dd class=
"description">Media width in hundredths of
2007 <dd class=
"description">Media length in hundredths of
2010 <dd class=
"description">Media matching flags
</dd>
2012 <dd class=
"description">Media size information
</dd>
2014 <h4 class=
"returnvalue">Return Value
</h4>
2015 <p class=
"description">1 on match,
0 on failure
</p>
2016 <h4 class=
"discussion">Discussion
</h4>
2017 <p class=
"discussion">"Width
" and
"length
" are the dimensions in hundredths of millimeters.
2018 "Flags
" provides some matching guidance (multiple flags can be combined):
<br>
2020 CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
2021 CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
2022 CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with
2-sided printing,
2023 CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
2024 CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
2025 size amongst the
"ready
" media.
<br>
2027 The matching result (if any) is returned in the
"cups_size_t
" structure.
<br>
2029 Returns
1 when there is a match and
0 if there is not a match.
2032 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaCount">cupsGetDestMediaCount
</a></h3>
2033 <p class=
"description">Get the number of sizes supported by a
2036 int cupsGetDestMediaCount (
<br>
2037 http_t *http,
<br>
2038 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2039 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2040 unsigned flags
<br>
2042 <h4 class=
"parameters">Parameters
</h4>
2045 <dd class=
"description">Connection to destination
</dd>
2047 <dd class=
"description">Destination
</dd>
2049 <dd class=
"description">Destination information
</dd>
2051 <dd class=
"description">Media flags
</dd>
2053 <h4 class=
"returnvalue">Return Value
</h4>
2054 <p class=
"description">Number of sizes
</p>
2055 <h4 class=
"discussion">Discussion
</h4>
2056 <p class=
"discussion">The
<code>flags
</code> parameter determines the set of media sizes that are
2057 counted. For example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will return
2058 the number of borderless sizes.
2061 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaDefault">cupsGetDestMediaDefault
</a></h3>
2062 <p class=
"description">Get the default size for a destination.
</p>
2064 int cupsGetDestMediaDefault (
<br>
2065 http_t *http,
<br>
2066 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2067 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2068 unsigned flags,
<br>
2069 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
2071 <h4 class=
"parameters">Parameters
</h4>
2074 <dd class=
"description">Connection to destination
</dd>
2076 <dd class=
"description">Destination
</dd>
2078 <dd class=
"description">Destination information
</dd>
2080 <dd class=
"description">Media flags
</dd>
2082 <dd class=
"description">Media size information
</dd>
2084 <h4 class=
"returnvalue">Return Value
</h4>
2085 <p class=
"description">1 on success,
0 on failure
</p>
2086 <h4 class=
"discussion">Discussion
</h4>
2087 <p class=
"discussion">The
<code>flags
</code> parameter determines which default size is returned. For
2088 example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will return the default
2089 borderless size, typically US Letter or A4, but sometimes
4x6 photo media.
2092 <h3 class=
"function"><span class=
"info"> CUPS
2.0/OS X
10.10 </span><a name=
"cupsGetDestWithURI">cupsGetDestWithURI
</a></h3>
2093 <p class=
"description">Get a destination associated with a URI.
</p>
2095 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetDestWithURI (
<br>
2096 const char *name,
<br>
2097 const char *uri
<br>
2099 <h4 class=
"parameters">Parameters
</h4>
2102 <dd class=
"description">Desired printer name or
<code>NULL
</code></dd>
2104 <dd class=
"description">URI for the printer
</dd>
2106 <h4 class=
"returnvalue">Return Value
</h4>
2107 <p class=
"description">Destination or
<code>NULL
</code></p>
2108 <h4 class=
"discussion">Discussion
</h4>
2109 <p class=
"discussion">"name
" is the desired name for the printer. If
<code>NULL
</code>, a name will be
2110 created using the URI.
<br>
2112 "uri
" is the
"ipp
" or
"ipps
" URI for the printer.
2115 <h3 class=
"function"><a name=
"cupsGetDests">cupsGetDests
</a></h3>
2116 <p class=
"description">Get the list of destinations from the default server.
</p>
2118 int cupsGetDests (
<br>
2119 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2121 <h4 class=
"parameters">Parameters
</h4>
2124 <dd class=
"description">Destinations
</dd>
2126 <h4 class=
"returnvalue">Return Value
</h4>
2127 <p class=
"description">Number of destinations
</p>
2128 <h4 class=
"discussion">Discussion
</h4>
2129 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
2130 printer-info, printer-is-accepting-jobs, printer-is-shared,
2131 printer-make-and-model, printer-state, printer-state-change-time,
2132 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
2133 adds the marker-change-time, marker-colors, marker-high-levels,
2134 marker-levels, marker-low-levels, marker-message, marker-names,
2135 marker-types, and printer-commands attributes as well.
<br>
2137 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
2138 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
</p>
2139 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetDests2">cupsGetDests2
</a></h3>
2140 <p class=
"description">Get the list of destinations from the specified server.
</p>
2142 int cupsGetDests2 (
<br>
2143 http_t *http,
<br>
2144 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2146 <h4 class=
"parameters">Parameters
</h4>
2149 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2151 <dd class=
"description">Destinations
</dd>
2153 <h4 class=
"returnvalue">Return Value
</h4>
2154 <p class=
"description">Number of destinations
</p>
2155 <h4 class=
"discussion">Discussion
</h4>
2156 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
2157 printer-info, printer-is-accepting-jobs, printer-is-shared,
2158 printer-make-and-model, printer-state, printer-state-change-time,
2159 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
2160 adds the marker-change-time, marker-colors, marker-high-levels,
2161 marker-levels, marker-low-levels, marker-message, marker-names,
2162 marker-types, and printer-commands attributes as well.
<br>
2164 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
2165 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
2168 <h3 class=
"function"><a name=
"cupsGetJobs">cupsGetJobs
</a></h3>
2169 <p class=
"description">Get the jobs from the default server.
</p>
2171 int cupsGetJobs (
<br>
2172 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
2173 const char *name,
<br>
2174 int myjobs,
<br>
2175 int whichjobs
<br>
2177 <h4 class=
"parameters">Parameters
</h4>
2180 <dd class=
"description">Job data
</dd>
2182 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
2184 <dd class=
"description">0 = all users,
1 = mine
</dd>
2186 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
2188 <h4 class=
"returnvalue">Return Value
</h4>
2189 <p class=
"description">Number of jobs
</p>
2190 <h4 class=
"discussion">Discussion
</h4>
2191 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
2192 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
2193 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
2194 jobs that are stopped, canceled, aborted, or completed.
</p>
2195 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetJobs2">cupsGetJobs2
</a></h3>
2196 <p class=
"description">Get the jobs from the specified server.
</p>
2198 int cupsGetJobs2 (
<br>
2199 http_t *http,
<br>
2200 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
2201 const char *name,
<br>
2202 int myjobs,
<br>
2203 int whichjobs
<br>
2205 <h4 class=
"parameters">Parameters
</h4>
2208 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2210 <dd class=
"description">Job data
</dd>
2212 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
2214 <dd class=
"description">0 = all users,
1 = mine
</dd>
2216 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
2218 <h4 class=
"returnvalue">Return Value
</h4>
2219 <p class=
"description">Number of jobs
</p>
2220 <h4 class=
"discussion">Discussion
</h4>
2221 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
2222 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
2223 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
2224 jobs that are stopped, canceled, aborted, or completed.
2227 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsGetNamedDest">cupsGetNamedDest
</a></h3>
2228 <p class=
"description">Get options for the named destination.
</p>
2230 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetNamedDest (
<br>
2231 http_t *http,
<br>
2232 const char *name,
<br>
2233 const char *instance
<br>
2235 <h4 class=
"parameters">Parameters
</h4>
2238 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2240 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
2242 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2244 <h4 class=
"returnvalue">Return Value
</h4>
2245 <p class=
"description">Destination or
<code>NULL
</code></p>
2246 <h4 class=
"discussion">Discussion
</h4>
2247 <p class=
"discussion">This function is optimized for retrieving a single destination and should
2248 be used instead of
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> when you either
2249 know the name of the destination or want to print to the default destination.
2250 If
<code>NULL
</code> is returned, the destination does not exist or there is no
2251 default destination.
<br>
2253 If
"http
" is
<code>CUPS_HTTP_DEFAULT
</code>, the connection to the default print
2254 server will be used.
<br>
2256 If
"name
" is
<code>NULL
</code>, the default printer for the current user will be
2259 The returned destination must be freed using
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> with a
2260 "num_dests
" value of
1.
2263 <h3 class=
"function"><a name=
"cupsGetOption">cupsGetOption
</a></h3>
2264 <p class=
"description">Get an option value.
</p>
2266 const char *cupsGetOption (
<br>
2267 const char *name,
<br>
2268 int num_options,
<br>
2269 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2271 <h4 class=
"parameters">Parameters
</h4>
2274 <dd class=
"description">Name of option
</dd>
2275 <dt>num_options
</dt>
2276 <dd class=
"description">Number of options
</dd>
2278 <dd class=
"description">Options
</dd>
2280 <h4 class=
"returnvalue">Return Value
</h4>
2281 <p class=
"description">Option value or
<code>NULL
</code></p>
2282 <h3 class=
"function"><a name=
"cupsGetPassword">cupsGetPassword
</a></h3>
2283 <p class=
"description">Get a password from the user.
</p>
2285 const char *cupsGetPassword (
<br>
2286 const char *prompt
<br>
2288 <h4 class=
"parameters">Parameters
</h4>
2291 <dd class=
"description">Prompt string
</dd>
2293 <h4 class=
"returnvalue">Return Value
</h4>
2294 <p class=
"description">Password
</p>
2295 <h4 class=
"discussion">Discussion
</h4>
2296 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
2297 user does not provide a password.
<br>
2299 Note: The current password callback function is tracked separately for each
2300 thread in a program. Multi-threaded programs that override the setting via
2301 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
2302 do so in each thread for the same function to be used.
</p>
2303 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsGetPassword2">cupsGetPassword2
</a></h3>
2304 <p class=
"description">Get a password from the user using the advanced
2305 password callback.
</p>
2307 const char *cupsGetPassword2 (
<br>
2308 const char *prompt,
<br>
2309 http_t *http,
<br>
2310 const char *method,
<br>
2311 const char *resource
<br>
2313 <h4 class=
"parameters">Parameters
</h4>
2316 <dd class=
"description">Prompt string
</dd>
2318 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2320 <dd class=
"description">Request method (
"GET
",
"POST
",
"PUT
")
</dd>
2322 <dd class=
"description">Resource path
</dd>
2324 <h4 class=
"returnvalue">Return Value
</h4>
2325 <p class=
"description">Password
</p>
2326 <h4 class=
"discussion">Discussion
</h4>
2327 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
2328 user does not provide a password.
<br>
2330 Note: The current password callback function is tracked separately for each
2331 thread in a program. Multi-threaded programs that override the setting via
2332 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
2333 do so in each thread for the same function to be used.
2336 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetPrinters">cupsGetPrinters
</a></h3>
2337 <p class=
"description">Get a list of printers from the default server.
</p>
2339 int cupsGetPrinters (
<br>
2340 char ***printers
<br>
2342 <h4 class=
"parameters">Parameters
</h4>
2345 <dd class=
"description">Printers
</dd>
2347 <h4 class=
"returnvalue">Return Value
</h4>
2348 <p class=
"description">Number of printers
</p>
2349 <h4 class=
"discussion">Discussion
</h4>
2350 <p class=
"discussion">This function is deprecated and no longer returns a list of printers - use
2351 <a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
2354 <h3 class=
"function"><a name=
"cupsLangDefault">cupsLangDefault
</a></h3>
2355 <p class=
"description">Return the default language.
</p>
2357 cups_lang_t *cupsLangDefault (void);
</p>
2358 <h4 class=
"returnvalue">Return Value
</h4>
2359 <p class=
"description">Language data
</p>
2360 <h3 class=
"function"><a name=
"cupsLangEncoding">cupsLangEncoding
</a></h3>
2361 <p class=
"description">Return the character encoding (us-ascii, etc.)
2362 for the given language.
</p>
2364 const char *cupsLangEncoding (
<br>
2365 cups_lang_t *lang
<br>
2367 <h4 class=
"parameters">Parameters
</h4>
2370 <dd class=
"description">Language data
</dd>
2372 <h4 class=
"returnvalue">Return Value
</h4>
2373 <p class=
"description">Character encoding
</p>
2374 <h3 class=
"function"><a name=
"cupsLangFlush">cupsLangFlush
</a></h3>
2375 <p class=
"description">Flush all language data out of the cache.
</p>
2377 void cupsLangFlush (void);
</p>
2378 <h3 class=
"function"><a name=
"cupsLangFree">cupsLangFree
</a></h3>
2379 <p class=
"description">Free language data.
</p>
2381 void cupsLangFree (
<br>
2382 cups_lang_t *lang
<br>
2384 <h4 class=
"parameters">Parameters
</h4>
2387 <dd class=
"description">Language to free
</dd>
2389 <h4 class=
"discussion">Discussion
</h4>
2390 <p class=
"discussion">This does not actually free anything; use
<a href=
"#cupsLangFlush"><code>cupsLangFlush
</code></a> for that.
</p>
2391 <h3 class=
"function"><a name=
"cupsLangGet">cupsLangGet
</a></h3>
2392 <p class=
"description">Get a language.
</p>
2394 cups_lang_t *cupsLangGet (
<br>
2395 const char *language
<br>
2397 <h4 class=
"parameters">Parameters
</h4>
2400 <dd class=
"description">Language or locale
</dd>
2402 <h4 class=
"returnvalue">Return Value
</h4>
2403 <p class=
"description">Language data
</p>
2404 <h3 class=
"function"><span class=
"info"> CUPS
2.0/OS X
10.10 </span><a name=
"cupsLocalizeDestMedia">cupsLocalizeDestMedia
</a></h3>
2405 <p class=
"description">Get the localized string for a destination media
2408 const char *cupsLocalizeDestMedia (
<br>
2409 http_t *http,
<br>
2410 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2411 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2412 unsigned flags,
<br>
2413 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
2415 <h4 class=
"parameters">Parameters
</h4>
2418 <dd class=
"description">Connection to destination
</dd>
2420 <dd class=
"description">Destination
</dd>
2422 <dd class=
"description">Destination information
</dd>
2424 <dd class=
"description">Media flags
</dd>
2426 <dd class=
"description">Media size
</dd>
2428 <h4 class=
"returnvalue">Return Value
</h4>
2429 <p class=
"description">Localized string
</p>
2430 <h4 class=
"discussion">Discussion
</h4>
2431 <p class=
"discussion">The returned string is stored in the destination information and will become
2432 invalid if the destination information is deleted.
2435 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsLocalizeDestOption">cupsLocalizeDestOption
</a></h3>
2436 <p class=
"description">Get the localized string for a destination
2439 const char *cupsLocalizeDestOption (
<br>
2440 http_t *http,
<br>
2441 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2442 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2443 const char *option
<br>
2445 <h4 class=
"parameters">Parameters
</h4>
2448 <dd class=
"description">Connection to destination
</dd>
2450 <dd class=
"description">Destination
</dd>
2452 <dd class=
"description">Destination information
</dd>
2454 <dd class=
"description">Option to localize
</dd>
2456 <h4 class=
"returnvalue">Return Value
</h4>
2457 <p class=
"description">Localized string
</p>
2458 <h4 class=
"discussion">Discussion
</h4>
2459 <p class=
"discussion">The returned string is stored in the destination information and will become
2460 invalid if the destination information is deleted.
2463 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsLocalizeDestValue">cupsLocalizeDestValue
</a></h3>
2464 <p class=
"description">Get the localized string for a destination
2465 option+value pair.
</p>
2467 const char *cupsLocalizeDestValue (
<br>
2468 http_t *http,
<br>
2469 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2470 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2471 const char *option,
<br>
2472 const char *value
<br>
2474 <h4 class=
"parameters">Parameters
</h4>
2477 <dd class=
"description">Connection to destination
</dd>
2479 <dd class=
"description">Destination
</dd>
2481 <dd class=
"description">Destination information
</dd>
2483 <dd class=
"description">Option to localize
</dd>
2485 <dd class=
"description">Value to localize
</dd>
2487 <h4 class=
"returnvalue">Return Value
</h4>
2488 <p class=
"description">Localized string
</p>
2489 <h4 class=
"discussion">Discussion
</h4>
2490 <p class=
"discussion">The returned string is stored in the destination information and will become
2491 invalid if the destination information is deleted.
2494 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsNotifySubject">cupsNotifySubject
</a></h3>
2495 <p class=
"description">Return the subject for the given notification message.
</p>
2497 char *cupsNotifySubject (
<br>
2498 cups_lang_t *lang,
<br>
2499 ipp_t *event
<br>
2501 <h4 class=
"parameters">Parameters
</h4>
2504 <dd class=
"description">Language data
</dd>
2506 <dd class=
"description">Event data
</dd>
2508 <h4 class=
"returnvalue">Return Value
</h4>
2509 <p class=
"description">Subject string or
<code>NULL
</code></p>
2510 <h4 class=
"discussion">Discussion
</h4>
2511 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
2514 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsNotifyText">cupsNotifyText
</a></h3>
2515 <p class=
"description">Return the text for the given notification message.
</p>
2517 char *cupsNotifyText (
<br>
2518 cups_lang_t *lang,
<br>
2519 ipp_t *event
<br>
2521 <h4 class=
"parameters">Parameters
</h4>
2524 <dd class=
"description">Language data
</dd>
2526 <dd class=
"description">Event data
</dd>
2528 <h4 class=
"returnvalue">Return Value
</h4>
2529 <p class=
"description">Message text or
<code>NULL
</code></p>
2530 <h4 class=
"discussion">Discussion
</h4>
2531 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
2534 <h3 class=
"function"><a name=
"cupsParseOptions">cupsParseOptions
</a></h3>
2535 <p class=
"description">Parse options from a command-line argument.
</p>
2537 int cupsParseOptions (
<br>
2538 const char *arg,
<br>
2539 int num_options,
<br>
2540 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
2542 <h4 class=
"parameters">Parameters
</h4>
2545 <dd class=
"description">Argument to parse
</dd>
2546 <dt>num_options
</dt>
2547 <dd class=
"description">Number of options
</dd>
2549 <dd class=
"description">Options found
</dd>
2551 <h4 class=
"returnvalue">Return Value
</h4>
2552 <p class=
"description">Number of options found
</p>
2553 <h4 class=
"discussion">Discussion
</h4>
2554 <p class=
"discussion">This function converts space-delimited name/value pairs according
2555 to the PAPI text option ABNF specification. Collection values
2556 (
"name={a=... b=... c=...}
") are stored with the curley brackets
2557 intact - use
<code>cupsParseOptions
</code> on the value to extract the
2558 collection attributes.
</p>
2559 <h3 class=
"function"><a name=
"cupsPrintFile">cupsPrintFile
</a></h3>
2560 <p class=
"description">Print a file to a printer or class on the default server.
</p>
2562 int cupsPrintFile (
<br>
2563 const char *name,
<br>
2564 const char *filename,
<br>
2565 const char *title,
<br>
2566 int num_options,
<br>
2567 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2569 <h4 class=
"parameters">Parameters
</h4>
2572 <dd class=
"description">Destination name
</dd>
2574 <dd class=
"description">File to print
</dd>
2576 <dd class=
"description">Title of job
</dd>
2577 <dt>num_options
</dt>
2578 <dd class=
"description">Number of options
</dd>
2580 <dd class=
"description">Options
</dd>
2582 <h4 class=
"returnvalue">Return Value
</h4>
2583 <p class=
"description">Job ID or
0 on error
</p>
2584 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsPrintFile2">cupsPrintFile2
</a></h3>
2585 <p class=
"description">Print a file to a printer or class on the specified
2588 int cupsPrintFile2 (
<br>
2589 http_t *http,
<br>
2590 const char *name,
<br>
2591 const char *filename,
<br>
2592 const char *title,
<br>
2593 int num_options,
<br>
2594 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2596 <h4 class=
"parameters">Parameters
</h4>
2599 <dd class=
"description">Connection to server
</dd>
2601 <dd class=
"description">Destination name
</dd>
2603 <dd class=
"description">File to print
</dd>
2605 <dd class=
"description">Title of job
</dd>
2606 <dt>num_options
</dt>
2607 <dd class=
"description">Number of options
</dd>
2609 <dd class=
"description">Options
</dd>
2611 <h4 class=
"returnvalue">Return Value
</h4>
2612 <p class=
"description">Job ID or
0 on error
</p>
2613 <h3 class=
"function"><a name=
"cupsPrintFiles">cupsPrintFiles
</a></h3>
2614 <p class=
"description">Print one or more files to a printer or class on the
2617 int cupsPrintFiles (
<br>
2618 const char *name,
<br>
2619 int num_files,
<br>
2620 const char **files,
<br>
2621 const char *title,
<br>
2622 int num_options,
<br>
2623 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2625 <h4 class=
"parameters">Parameters
</h4>
2628 <dd class=
"description">Destination name
</dd>
2630 <dd class=
"description">Number of files
</dd>
2632 <dd class=
"description">File(s) to print
</dd>
2634 <dd class=
"description">Title of job
</dd>
2635 <dt>num_options
</dt>
2636 <dd class=
"description">Number of options
</dd>
2638 <dd class=
"description">Options
</dd>
2640 <h4 class=
"returnvalue">Return Value
</h4>
2641 <p class=
"description">Job ID or
0 on error
</p>
2642 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsPrintFiles2">cupsPrintFiles2
</a></h3>
2643 <p class=
"description">Print one or more files to a printer or class on the
2644 specified server.
</p>
2646 int cupsPrintFiles2 (
<br>
2647 http_t *http,
<br>
2648 const char *name,
<br>
2649 int num_files,
<br>
2650 const char **files,
<br>
2651 const char *title,
<br>
2652 int num_options,
<br>
2653 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2655 <h4 class=
"parameters">Parameters
</h4>
2658 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2660 <dd class=
"description">Destination name
</dd>
2662 <dd class=
"description">Number of files
</dd>
2664 <dd class=
"description">File(s) to print
</dd>
2666 <dd class=
"description">Title of job
</dd>
2667 <dt>num_options
</dt>
2668 <dd class=
"description">Number of options
</dd>
2670 <dd class=
"description">Options
</dd>
2672 <h4 class=
"returnvalue">Return Value
</h4>
2673 <p class=
"description">Job ID or
0 on error
</p>
2674 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsRemoveDest">cupsRemoveDest
</a></h3>
2675 <p class=
"description">Remove a destination from the destination list.
</p>
2677 int cupsRemoveDest (
<br>
2678 const char *name,
<br>
2679 const char *instance,
<br>
2680 int num_dests,
<br>
2681 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2683 <h4 class=
"parameters">Parameters
</h4>
2686 <dd class=
"description">Destination name
</dd>
2688 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2690 <dd class=
"description">Number of destinations
</dd>
2692 <dd class=
"description">Destinations
</dd>
2694 <h4 class=
"returnvalue">Return Value
</h4>
2695 <p class=
"description">New number of destinations
</p>
2696 <h4 class=
"discussion">Discussion
</h4>
2697 <p class=
"discussion">Removing a destination/instance does not delete the class or printer
2698 queue, merely the lpoptions for that destination/instance. Use the
2699 <a href=
"#cupsSetDests"><code>cupsSetDests
</code></a> or
<a href=
"#cupsSetDests2"><code>cupsSetDests2
</code></a> functions to save the new
2700 options for the user.
2703 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsRemoveOption">cupsRemoveOption
</a></h3>
2704 <p class=
"description">Remove an option from an option array.
</p>
2706 int cupsRemoveOption (
<br>
2707 const char *name,
<br>
2708 int num_options,
<br>
2709 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
2711 <h4 class=
"parameters">Parameters
</h4>
2714 <dd class=
"description">Option name
</dd>
2715 <dt>num_options
</dt>
2716 <dd class=
"description">Current number of options
</dd>
2718 <dd class=
"description">Options
</dd>
2720 <h4 class=
"returnvalue">Return Value
</h4>
2721 <p class=
"description">New number of options
</p>
2722 <h3 class=
"function"><a name=
"cupsServer">cupsServer
</a></h3>
2723 <p class=
"description">Return the hostname/address of the current server.
</p>
2725 const char *cupsServer (void);
</p>
2726 <h4 class=
"returnvalue">Return Value
</h4>
2727 <p class=
"description">Server name
</p>
2728 <h4 class=
"discussion">Discussion
</h4>
2729 <p class=
"discussion">The default server comes from the CUPS_SERVER environment variable, then the
2730 ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
2731 set, the default is the local system - either
"localhost
" or a domain socket
2734 The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
2735 address, or a domain socket pathname.
<br>
2737 Note: The current server is tracked separately for each thread in a program.
2738 Multi-threaded programs that override the server via the
2739 <a href=
"#cupsSetServer"><code>cupsSetServer
</code></a> function need to do so in each thread for the same
2740 server to be used.
</p>
2741 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetClientCertCB">cupsSetClientCertCB
</a></h3>
2742 <p class=
"description">Set the client certificate callback.
</p>
2744 void cupsSetClientCertCB (
<br>
2745 <a href=
"#cups_client_cert_cb_t">cups_client_cert_cb_t
</a> cb,
<br>
2746 void *user_data
<br>
2748 <h4 class=
"parameters">Parameters
</h4>
2751 <dd class=
"description">Callback function
</dd>
2753 <dd class=
"description">User data pointer
</dd>
2755 <h4 class=
"discussion">Discussion
</h4>
2756 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2758 Note: The current certificate callback is tracked separately for each thread
2759 in a program. Multi-threaded programs that override the callback need to do
2760 so in each thread for the same callback to be used.
2763 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetCredentials">cupsSetCredentials
</a></h3>
2764 <p class=
"description">Set the default credentials to be used for SSL/TLS
2767 int cupsSetCredentials (
<br>
2768 cups_array_t *credentials
<br>
2770 <h4 class=
"parameters">Parameters
</h4>
2772 <dt>credentials
</dt>
2773 <dd class=
"description">Array of credentials
</dd>
2775 <h4 class=
"returnvalue">Return Value
</h4>
2776 <p class=
"description">Status of call (
0 = success)
</p>
2777 <h4 class=
"discussion">Discussion
</h4>
2778 <p class=
"discussion">Note: The default credentials are tracked separately for each thread in a
2779 program. Multi-threaded programs that override the setting need to do so in
2780 each thread for the same setting to be used.
2783 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsSetDefaultDest">cupsSetDefaultDest
</a></h3>
2784 <p class=
"description">Set the default destination.
</p>
2786 void cupsSetDefaultDest (
<br>
2787 const char *name,
<br>
2788 const char *instance,
<br>
2789 int num_dests,
<br>
2790 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2792 <h4 class=
"parameters">Parameters
</h4>
2795 <dd class=
"description">Destination name
</dd>
2797 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2799 <dd class=
"description">Number of destinations
</dd>
2801 <dd class=
"description">Destinations
</dd>
2803 <h3 class=
"function"><a name=
"cupsSetDests">cupsSetDests
</a></h3>
2804 <p class=
"description">Save the list of destinations for the default server.
</p>
2806 void cupsSetDests (
<br>
2807 int num_dests,
<br>
2808 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2810 <h4 class=
"parameters">Parameters
</h4>
2813 <dd class=
"description">Number of destinations
</dd>
2815 <dd class=
"description">Destinations
</dd>
2817 <h4 class=
"discussion">Discussion
</h4>
2818 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2819 as root and ~/.cups/lpoptions when run as a normal user.
</p>
2820 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsSetDests2">cupsSetDests2
</a></h3>
2821 <p class=
"description">Save the list of destinations for the specified server.
</p>
2823 int cupsSetDests2 (
<br>
2824 http_t *http,
<br>
2825 int num_dests,
<br>
2826 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2828 <h4 class=
"parameters">Parameters
</h4>
2831 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2833 <dd class=
"description">Number of destinations
</dd>
2835 <dd class=
"description">Destinations
</dd>
2837 <h4 class=
"returnvalue">Return Value
</h4>
2838 <p class=
"description">0 on success, -
1 on error
</p>
2839 <h4 class=
"discussion">Discussion
</h4>
2840 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2841 as root and ~/.cups/lpoptions when run as a normal user.
2844 <h3 class=
"function"><a name=
"cupsSetEncryption">cupsSetEncryption
</a></h3>
2845 <p class=
"description">Set the encryption preference.
</p>
2847 void cupsSetEncryption (
<br>
2848 http_encryption_t e
<br>
2850 <h4 class=
"parameters">Parameters
</h4>
2853 <dd class=
"description">New encryption preference
</dd>
2855 <h4 class=
"discussion">Discussion
</h4>
2856 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
2857 environment variable, then the ~/.cups/client.conf file, and finally the
2858 /etc/cups/client.conf file. If not set, the default is
2859 <code>HTTP_ENCRYPTION_IF_REQUESTED
</code>.
<br>
2861 Note: The current encryption setting is tracked separately for each thread
2862 in a program. Multi-threaded programs that override the setting need to do
2863 so in each thread for the same setting to be used.
</p>
2864 <h3 class=
"function"><a name=
"cupsSetPasswordCB">cupsSetPasswordCB
</a></h3>
2865 <p class=
"description">Set the password callback for CUPS.
</p>
2867 void cupsSetPasswordCB (
<br>
2868 <a href=
"#cups_password_cb_t">cups_password_cb_t
</a> cb
<br>
2870 <h4 class=
"parameters">Parameters
</h4>
2873 <dd class=
"description">Callback function
</dd>
2875 <h4 class=
"discussion">Discussion
</h4>
2876 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2877 reads the password from the console. Programs should call either this
2878 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2879 by a program per thread.
<br>
2881 Note: The current password callback is tracked separately for each thread
2882 in a program. Multi-threaded programs that override the callback need to do
2883 so in each thread for the same callback to be used.
</p>
2884 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsSetPasswordCB2">cupsSetPasswordCB2
</a></h3>
2885 <p class=
"description">Set the advanced password callback for CUPS.
</p>
2887 void cupsSetPasswordCB2 (
<br>
2888 <a href=
"#cups_password_cb2_t">cups_password_cb2_t
</a> cb,
<br>
2889 void *user_data
<br>
2891 <h4 class=
"parameters">Parameters
</h4>
2894 <dd class=
"description">Callback function
</dd>
2896 <dd class=
"description">User data pointer
</dd>
2898 <h4 class=
"discussion">Discussion
</h4>
2899 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2900 reads the password from the console. Programs should call either this
2901 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2902 by a program per thread.
<br>
2904 Note: The current password callback is tracked separately for each thread
2905 in a program. Multi-threaded programs that override the callback need to do
2906 so in each thread for the same callback to be used.
2909 <h3 class=
"function"><a name=
"cupsSetServer">cupsSetServer
</a></h3>
2910 <p class=
"description">Set the default server name and port.
</p>
2912 void cupsSetServer (
<br>
2913 const char *server
<br>
2915 <h4 class=
"parameters">Parameters
</h4>
2918 <dd class=
"description">Server name
</dd>
2920 <h4 class=
"discussion">Discussion
</h4>
2921 <p class=
"discussion">The
"server
" string can be a fully-qualified hostname, a numeric
2922 IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
2923 addresses can be optionally followed by a colon and port number to override
2924 the default port
631, e.g.
"hostname:
8631". Pass
<code>NULL
</code> to restore the
2925 default server name and port.
<br>
2927 Note: The current server is tracked separately for each thread in a program.
2928 Multi-threaded programs that override the server need to do so in each
2929 thread for the same server to be used.
</p>
2930 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetServerCertCB">cupsSetServerCertCB
</a></h3>
2931 <p class=
"description">Set the server certificate callback.
</p>
2933 void cupsSetServerCertCB (
<br>
2934 <a href=
"#cups_server_cert_cb_t">cups_server_cert_cb_t
</a> cb,
<br>
2935 void *user_data
<br>
2937 <h4 class=
"parameters">Parameters
</h4>
2940 <dd class=
"description">Callback function
</dd>
2942 <dd class=
"description">User data pointer
</dd>
2944 <h4 class=
"discussion">Discussion
</h4>
2945 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2947 Note: The current credentials callback is tracked separately for each thread
2948 in a program. Multi-threaded programs that override the callback need to do
2949 so in each thread for the same callback to be used.
2952 <h3 class=
"function"><a name=
"cupsSetUser">cupsSetUser
</a></h3>
2953 <p class=
"description">Set the default user name.
</p>
2955 void cupsSetUser (
<br>
2956 const char *user
<br>
2958 <h4 class=
"parameters">Parameters
</h4>
2961 <dd class=
"description">User name
</dd>
2963 <h4 class=
"discussion">Discussion
</h4>
2964 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default user name.
<br>
2966 Note: The current user name is tracked separately for each thread in a
2967 program. Multi-threaded programs that override the user name need to do so
2968 in each thread for the same user name to be used.
</p>
2969 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsSetUserAgent">cupsSetUserAgent
</a></h3>
2970 <p class=
"description">Set the default HTTP User-Agent string.
</p>
2972 void cupsSetUserAgent (
<br>
2973 const char *user_agent
<br>
2975 <h4 class=
"parameters">Parameters
</h4>
2978 <dd class=
"description">User-Agent string or
<code>NULL
</code></dd>
2980 <h4 class=
"discussion">Discussion
</h4>
2981 <p class=
"discussion">Setting the string to NULL forces the default value containing the CUPS
2982 version, IPP version, and operating system version and architecture.
2985 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsStartDestDocument">cupsStartDestDocument
</a></h3>
2986 <p class=
"description">Start a new document.
</p>
2988 http_status_t cupsStartDestDocument (
<br>
2989 http_t *http,
<br>
2990 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2991 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
2992 int job_id,
<br>
2993 const char *docname,
<br>
2994 const char *format,
<br>
2995 int num_options,
<br>
2996 <a href=
"#cups_option_t">cups_option_t
</a> *options,
<br>
2997 int last_document
<br>
2999 <h4 class=
"parameters">Parameters
</h4>
3002 <dd class=
"description">Connection to destination
</dd>
3004 <dd class=
"description">Destination
</dd>
3006 <dd class=
"description">Destination information
</dd>
3008 <dd class=
"description">Job ID
</dd>
3010 <dd class=
"description">Document name
</dd>
3012 <dd class=
"description">Document format
</dd>
3013 <dt>num_options
</dt>
3014 <dd class=
"description">Number of document options
</dd>
3016 <dd class=
"description">Document options
</dd>
3017 <dt>last_document
</dt>
3018 <dd class=
"description">1 if this is the last document
</dd>
3020 <h4 class=
"returnvalue">Return Value
</h4>
3021 <p class=
"description">Status of document creation
</p>
3022 <h4 class=
"discussion">Discussion
</h4>
3023 <p class=
"discussion">"job_id
" is the job ID returned by cupsCreateDestJob.
"docname
" is the name
3024 of the document/file being printed,
"format
" is the MIME media type for the
3025 document (see CUPS_FORMAT_xxx constants), and
"num_options
" and
"options
"
3026 are the options do be applied to the document.
"last_document
" should be
1
3027 if this is the last document to be submitted in the job. Returns
3028 <code>HTTP_CONTINUE
</code> on success.
3031 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsStartDocument">cupsStartDocument
</a></h3>
3032 <p class=
"description">Add a document to a job created with cupsCreateJob().
</p>
3034 http_status_t cupsStartDocument (
<br>
3035 http_t *http,
<br>
3036 const char *name,
<br>
3037 int job_id,
<br>
3038 const char *docname,
<br>
3039 const char *format,
<br>
3040 int last_document
<br>
3042 <h4 class=
"parameters">Parameters
</h4>
3045 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
3047 <dd class=
"description">Destination name
</dd>
3049 <dd class=
"description">Job ID from
<a href=
"#cupsCreateJob"><code>cupsCreateJob
</code></a></dd>
3051 <dd class=
"description">Name of document
</dd>
3053 <dd class=
"description">MIME type or
<code>CUPS_FORMAT_foo
</code></dd>
3054 <dt>last_document
</dt>
3055 <dd class=
"description">1 for last document in job,
0 otherwise
</dd>
3057 <h4 class=
"returnvalue">Return Value
</h4>
3058 <p class=
"description">HTTP status of request
</p>
3059 <h4 class=
"discussion">Discussion
</h4>
3060 <p class=
"discussion">Use
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a> to write data for the document and
3061 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> to finish the document and get the submission status.
<br>
3063 The MIME type constants
<code>CUPS_FORMAT_AUTO
</code>,
<code>CUPS_FORMAT_PDF
</code>,
3064 <code>CUPS_FORMAT_POSTSCRIPT
</code>,
<code>CUPS_FORMAT_RAW
</code>, and
3065 <code>CUPS_FORMAT_TEXT
</code> are provided for the
"format
" argument, although
3066 any supported MIME type string can be supplied.
3069 <h3 class=
"function"><a name=
"cupsTempFd">cupsTempFd
</a></h3>
3070 <p class=
"description">Creates a temporary file.
</p>
3072 int cupsTempFd (
<br>
3073 char *filename,
<br>
3074 int len
<br>
3076 <h4 class=
"parameters">Parameters
</h4>
3079 <dd class=
"description">Pointer to buffer
</dd>
3081 <dd class=
"description">Size of buffer
</dd>
3083 <h4 class=
"returnvalue">Return Value
</h4>
3084 <p class=
"description">New file descriptor or -
1 on error
</p>
3085 <h4 class=
"discussion">Discussion
</h4>
3086 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3087 The temporary file is opened for reading and writing.
</p>
3088 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsTempFile">cupsTempFile
</a></h3>
3089 <p class=
"description">Generates a temporary filename.
</p>
3091 char *cupsTempFile (
<br>
3092 char *filename,
<br>
3093 int len
<br>
3095 <h4 class=
"parameters">Parameters
</h4>
3098 <dd class=
"description">Pointer to buffer
</dd>
3100 <dd class=
"description">Size of buffer
</dd>
3102 <h4 class=
"returnvalue">Return Value
</h4>
3103 <p class=
"description">Filename or
<code>NULL
</code> on error
</p>
3104 <h4 class=
"discussion">Discussion
</h4>
3105 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3106 This function is deprecated and will no longer generate a temporary
3107 filename - use
<a href=
"#cupsTempFd"><code>cupsTempFd
</code></a> or
<a href=
"#cupsTempFile2"><code>cupsTempFile2
</code></a> instead.
3110 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsTempFile2">cupsTempFile2
</a></h3>
3111 <p class=
"description">Creates a temporary CUPS file.
</p>
3113 cups_file_t *cupsTempFile2 (
<br>
3114 char *filename,
<br>
3115 int len
<br>
3117 <h4 class=
"parameters">Parameters
</h4>
3120 <dd class=
"description">Pointer to buffer
</dd>
3122 <dd class=
"description">Size of buffer
</dd>
3124 <h4 class=
"returnvalue">Return Value
</h4>
3125 <p class=
"description">CUPS file or
<code>NULL
</code> on error
</p>
3126 <h4 class=
"discussion">Discussion
</h4>
3127 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3128 The temporary file is opened for writing.
3131 <h3 class=
"function"><a name=
"cupsUser">cupsUser
</a></h3>
3132 <p class=
"description">Return the current user's name.
</p>
3134 const char *cupsUser (void);
</p>
3135 <h4 class=
"returnvalue">Return Value
</h4>
3136 <p class=
"description">User name
</p>
3137 <h4 class=
"discussion">Discussion
</h4>
3138 <p class=
"discussion">Note: The current user name is tracked separately for each thread in a
3139 program. Multi-threaded programs that override the user name with the
3140 <a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function need to do so in each thread for the same user
3141 name to be used.
</p>
3142 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsUserAgent">cupsUserAgent
</a></h3>
3143 <p class=
"description">Return the default HTTP User-Agent string.
</p>
3145 const char *cupsUserAgent (void);
</p>
3146 <h4 class=
"returnvalue">Return Value
</h4>
3147 <p class=
"description">User-Agent string
</p>
3148 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgFormatSizeName">pwgFormatSizeName
</a></h3>
3149 <p class=
"description">Generate a PWG self-describing media size name.
</p>
3151 int pwgFormatSizeName (
<br>
3152 char *keyword,
<br>
3153 size_t keysize,
<br>
3154 const char *prefix,
<br>
3155 const char *name,
<br>
3156 int width,
<br>
3157 int length,
<br>
3158 const char *units
<br>
3160 <h4 class=
"parameters">Parameters
</h4>
3163 <dd class=
"description">Keyword buffer
</dd>
3165 <dd class=
"description">Size of keyword buffer
</dd>
3167 <dd class=
"description">Prefix for PWG size or
<code>NULL
</code> for automatic
</dd>
3169 <dd class=
"description">Size name or
<code>NULL
</code></dd>
3171 <dd class=
"description">Width of page in
2540ths
</dd>
3173 <dd class=
"description">Length of page in
2540ths
</dd>
3175 <dd class=
"description">Units -
"in
",
"mm
", or
<code>NULL
</code> for automatic
</dd>
3177 <h4 class=
"returnvalue">Return Value
</h4>
3178 <p class=
"description">1 on success,
0 on failure
</p>
3179 <h4 class=
"discussion">Discussion
</h4>
3180 <p class=
"discussion">This function generates a PWG self-describing media size name of the form
3181 "prefix_name_WIDTHxLENGTHunits
". The prefix is typically
"custom
" or
"roll
"
3182 for user-supplied sizes but can also be
"disc
",
"iso
",
"jis
",
"jpn
",
"na
",
3183 "oe
",
"om
",
"prc
", or
"roc
". A value of
<code>NULL
</code> automatically chooses
3184 "oe
" or
"om
" depending on the units.
<br>
3186 The size name may only contain lowercase letters, numbers,
"-
", and
".
". If
3187 <code>NULL
</code> is passed, the size name will contain the formatted dimensions.
<br>
3189 The width and length are specified in hundredths of millimeters, equivalent
3190 to
1/
100000th of a meter or
1/
2540th of an inch. The width, length, and
3191 units used for the generated size name are calculated automatically if the
3192 units string is
<code>NULL
</code>, otherwise inches (
"in
") or millimeters (
"mm
")
3196 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgInitSize">pwgInitSize
</a></h3>
3197 <p class=
"description">Initialize a pwg_size_t structure using IPP Job Template
3200 int pwgInitSize (
<br>
3201 <a href=
"#pwg_size_t">pwg_size_t
</a> *size,
<br>
3202 ipp_t *job,
<br>
3203 int *margins_set
<br>
3205 <h4 class=
"parameters">Parameters
</h4>
3208 <dd class=
"description">Size to initialize
</dd>
3210 <dd class=
"description">Job template attributes
</dd>
3211 <dt>margins_set
</dt>
3212 <dd class=
"description">1 if margins were set,
0 otherwise
</dd>
3214 <h4 class=
"returnvalue">Return Value
</h4>
3215 <p class=
"description">1 if size was initialized,
0 otherwise
</p>
3216 <h4 class=
"discussion">Discussion
</h4>
3217 <p class=
"discussion">This function initializes a pwg_size_t structure from an IPP
"media
" or
3218 "media-col
" attribute in the specified IPP message.
0 is returned if neither
3219 attribute is found in the message or the values are not valid.
<br>
3221 The
"margins_set
" variable is initialized to
1 if any
"media-xxx-margin
"
3222 member attribute was specified in the
"media-col
" Job Template attribute,
3223 otherwise it is initialized to
0.
3226 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForLegacy">pwgMediaForLegacy
</a></h3>
3227 <p class=
"description">Find a PWG media size by ISO/IPP legacy name.
</p>
3229 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForLegacy (
<br>
3230 const char *legacy
<br>
3232 <h4 class=
"parameters">Parameters
</h4>
3235 <dd class=
"description">Legacy size name
</dd>
3237 <h4 class=
"returnvalue">Return Value
</h4>
3238 <p class=
"description">Matching size or NULL
</p>
3239 <h4 class=
"discussion">Discussion
</h4>
3240 <p class=
"discussion">The
"name
" argument specifies the legacy ISO media size name, for example
3241 "iso-a4
" or
"na-letter
".
3244 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForPPD">pwgMediaForPPD
</a></h3>
3245 <p class=
"description">Find a PWG media size by Adobe PPD name.
</p>
3247 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForPPD (
<br>
3248 const char *ppd
<br>
3250 <h4 class=
"parameters">Parameters
</h4>
3253 <dd class=
"description">PPD size name
</dd>
3255 <h4 class=
"returnvalue">Return Value
</h4>
3256 <p class=
"description">Matching size or NULL
</p>
3257 <h4 class=
"discussion">Discussion
</h4>
3258 <p class=
"discussion">The
"ppd
" argument specifies an Adobe page size name as defined in Table B
.1
3259 of the Adobe PostScript Printer Description File Format Specification Version
3262 If the name is non-standard, the returned PWG media size is stored in
3263 thread-local storage and is overwritten by each call to the function in the
3264 thread. Custom names can be of the form
"Custom.WIDTHxLENGTH[units]
" or
3265 "WIDTHxLENGTH[units]
".
3268 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForPWG">pwgMediaForPWG
</a></h3>
3269 <p class=
"description">Find a PWG media size by
5101.1 self-describing name.
</p>
3271 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForPWG (
<br>
3272 const char *pwg
<br>
3274 <h4 class=
"parameters">Parameters
</h4>
3277 <dd class=
"description">PWG size name
</dd>
3279 <h4 class=
"returnvalue">Return Value
</h4>
3280 <p class=
"description">Matching size or NULL
</p>
3281 <h4 class=
"discussion">Discussion
</h4>
3282 <p class=
"discussion">The
"pwg
" argument specifies a self-describing media size name of the form
3283 "prefix_name_WIDTHxLENGTHunits
" as defined in PWG
5101.1.
<br>
3285 If the name is non-standard, the returned PWG media size is stored in
3286 thread-local storage and is overwritten by each call to the function in the
3290 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForSize">pwgMediaForSize
</a></h3>
3291 <p class=
"description">Get the PWG media size for the given dimensions.
</p>
3293 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForSize (
<br>
3294 int width,
<br>
3295 int length
<br>
3297 <h4 class=
"parameters">Parameters
</h4>
3300 <dd class=
"description">Width in hundredths of millimeters
</dd>
3302 <dd class=
"description">Length in hundredths of millimeters
</dd>
3304 <h4 class=
"returnvalue">Return Value
</h4>
3305 <p class=
"description">PWG media name
</p>
3306 <h4 class=
"discussion">Discussion
</h4>
3307 <p class=
"discussion">The
"width
" and
"length
" are in hundredths of millimeters, equivalent to
3308 1/
100000th of a meter or
1/
2540th of an inch.
<br>
3310 If the dimensions are non-standard, the returned PWG media size is stored in
3311 thread-local storage and is overwritten by each call to the function in the
3315 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
3316 <h3 class=
"typedef"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cups_client_cert_cb_t">cups_client_cert_cb_t
</a></h3>
3317 <p class=
"description">Client credentials callback
3320 typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
3322 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_dest_block_t">cups_dest_block_t
</a></h3>
3323 <p class=
"description">Destination enumeration block
3326 typedef int (*cups_dest_block_t(unsigned flags,
<a href=
"#cups_dest_t">cups_dest_t
</a> *dest);
3328 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_dest_cb_t">cups_dest_cb_t
</a></h3>
3329 <p class=
"description">Destination enumeration callback
3332 typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
<a href=
"#cups_dest_t">cups_dest_t
</a> *dest);
3334 <h3 class=
"typedef"><a name=
"cups_dest_t">cups_dest_t
</a></h3>
3335 <p class=
"description">Destination
</p>
3337 typedef struct
<a href=
"#cups_dest_s">cups_dest_s
</a> cups_dest_t;
3339 <h3 class=
"typedef"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cups_device_cb_t">cups_device_cb_t
</a></h3>
3340 <p class=
"description">Device callback
3343 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);
3345 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_dinfo_t">cups_dinfo_t
</a></h3>
3346 <p class=
"description">Destination capability and status
3349 typedef struct _cups_dinfo_s cups_dinfo_t;
3351 <h3 class=
"typedef"><a name=
"cups_job_t">cups_job_t
</a></h3>
3352 <p class=
"description">Job
</p>
3354 typedef struct
<a href=
"#cups_job_s">cups_job_s
</a> cups_job_t;
3356 <h3 class=
"typedef"><a name=
"cups_option_t">cups_option_t
</a></h3>
3357 <p class=
"description">Printer Options
</p>
3359 typedef struct
<a href=
"#cups_option_s">cups_option_s
</a> cups_option_t;
3361 <h3 class=
"typedef"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cups_password_cb2_t">cups_password_cb2_t
</a></h3>
3362 <p class=
"description">New password callback
3365 typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
3367 <h3 class=
"typedef"><a name=
"cups_password_cb_t">cups_password_cb_t
</a></h3>
3368 <p class=
"description">Password callback
</p>
3370 typedef const char *(*cups_password_cb_t)(const char *prompt);
3372 <h3 class=
"typedef"><a name=
"cups_ptype_t">cups_ptype_t
</a></h3>
3373 <p class=
"description">Printer type/capability bits
</p>
3375 typedef unsigned cups_ptype_t;
3377 <h3 class=
"typedef"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cups_server_cert_cb_t">cups_server_cert_cb_t
</a></h3>
3378 <p class=
"description">Server credentials callback
3381 typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
3383 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_size_t">cups_size_t
</a></h3>
3384 <p class=
"description">Media Size
</p>
3386 typedef struct
<a href=
"#cups_size_s">cups_size_s
</a> cups_size_t;
3388 <h3 class=
"typedef"><a name=
"pwg_map_t">pwg_map_t
</a></h3>
3389 <p class=
"description">Map element - PPD to/from PWG
</p>
3391 typedef struct
<a href=
"#pwg_map_s">pwg_map_s
</a> pwg_map_t;
3393 <h3 class=
"typedef"><a name=
"pwg_media_t">pwg_media_t
</a></h3>
3394 <p class=
"description">Common media size data
</p>
3396 typedef struct
<a href=
"#pwg_media_s">pwg_media_s
</a> pwg_media_t;
3398 <h3 class=
"typedef"><a name=
"pwg_size_t">pwg_size_t
</a></h3>
3399 <p class=
"description">Size element - PPD to/from PWG
</p>
3401 typedef struct
<a href=
"#pwg_size_s">pwg_size_s
</a> pwg_size_t;
3403 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
3404 <h3 class=
"struct"><a name=
"cups_dest_s">cups_dest_s
</a></h3>
3405 <p class=
"description">Destination
</p>
3406 <p class=
"code">struct cups_dest_s {
<br>
3407 char *name, *instance;
<br>
3408 int is_default;
<br>
3409 int num_options;
<br>
3410 <a href=
"#cups_option_t">cups_option_t
</a> *options;
<br>
3412 <h4 class=
"members">Members
</h4>
3415 <dd class=
"description">Local instance name or NULL
</dd>
3416 <dt>is_default
</dt>
3417 <dd class=
"description">Is this printer the default?
</dd>
3418 <dt>num_options
</dt>
3419 <dd class=
"description">Number of options
</dd>
3421 <dd class=
"description">Options
</dd>
3423 <h3 class=
"struct"><a name=
"cups_job_s">cups_job_s
</a></h3>
3424 <p class=
"description">Job
</p>
3425 <p class=
"code">struct cups_job_s {
<br>
3426 time_t completed_time;
<br>
3427 time_t creation_time;
<br>
3428 char *dest;
<br>
3429 char *format;
<br>
3430 int id;
<br>
3431 int priority;
<br>
3432 time_t processing_time;
<br>
3433 int size;
<br>
3434 ipp_jstate_t state;
<br>
3435 char *title;
<br>
3436 char *user;
<br>
3438 <h4 class=
"members">Members
</h4>
3440 <dt>completed_time
</dt>
3441 <dd class=
"description">Time the job was completed
</dd>
3442 <dt>creation_time
</dt>
3443 <dd class=
"description">Time the job was created
</dd>
3445 <dd class=
"description">Printer or class name
</dd>
3447 <dd class=
"description">Document format
</dd>
3449 <dd class=
"description">The job ID
</dd>
3451 <dd class=
"description">Priority (
1-
100)
</dd>
3452 <dt>processing_time
</dt>
3453 <dd class=
"description">Time the job was processed
</dd>
3455 <dd class=
"description">Size in kilobytes
</dd>
3457 <dd class=
"description">Job state
</dd>
3459 <dd class=
"description">Title/job name
</dd>
3461 <dd class=
"description">User the submitted the job
</dd>
3463 <h3 class=
"struct"><a name=
"cups_option_s">cups_option_s
</a></h3>
3464 <p class=
"description">Printer Options
</p>
3465 <p class=
"code">struct cups_option_s {
<br>
3466 char *name;
<br>
3467 char *value;
<br>
3469 <h4 class=
"members">Members
</h4>
3472 <dd class=
"description">Name of option
</dd>
3474 <dd class=
"description">Value of option
</dd>
3476 <h3 class=
"struct"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_size_s">cups_size_s
</a></h3>
3477 <p class=
"description">Media Size
</p>
3478 <p class=
"code">struct cups_size_s {
<br>
3479 char media[
128];
<br>
3480 int width, length, bottom, left, right, top;
<br>
3482 <h4 class=
"members">Members
</h4>
3484 <dt>media[
128]
</dt>
3485 <dd class=
"description">Media name to use
</dd>
3487 <dd class=
"description">Top margin in hundredths of
3490 <h3 class=
"struct"><a name=
"pollfd">pollfd
</a></h3>
3491 <p class=
"description">User data (unused)
</p>
3492 <p class=
"code">struct pollfd *pollfds, unsigned int num_pollfds, int timeout, void *context) {
<br>
3493 _cups_dnssd_data_t *data;
<br>
3494 else if(val
0) data - got_data;
<br>
3495 void) timeout;
<br>
3496 int val;
<br>
3498 <h4 class=
"members">Members
</h4>
3501 <dd class=
"description">Enumeration data
</dd>
3505 <dd class=
"description">Return value
</dd>
3507 <h3 class=
"struct"><a name=
"pwg_map_s">pwg_map_s
</a></h3>
3508 <p class=
"description">Map element - PPD to/from PWG
</p>
3509 <p class=
"code">struct pwg_map_s {
<br>
3510 char *pwg, *ppd;
<br>
3512 <h4 class=
"members">Members
</h4>
3515 <dd class=
"description">PPD option keyword
</dd>
3517 <h3 class=
"struct"><a name=
"pwg_media_s">pwg_media_s
</a></h3>
3518 <p class=
"description">Common media size data
</p>
3519 <p class=
"code">struct pwg_media_s {
<br>
3520 int width, length;
<br>
3521 const char *pwg, *legacy, *ppd;
<br>
3523 <h4 class=
"members">Members
</h4>
3526 <dd class=
"description">Length in
2540ths
</dd>
3528 <dd class=
"description">Standard Adobe PPD name
</dd>
3530 <h3 class=
"struct"><a name=
"pwg_size_s">pwg_size_s
</a></h3>
3531 <p class=
"description">Size element - PPD to/from PWG
</p>
3532 <p class=
"code">struct pwg_size_s {
<br>
3533 <a href=
"#pwg_map_t">pwg_map_t
</a> map;
<br>
3534 int width, length, left, bottom, right, top;
<br>
3536 <h4 class=
"members">Members
</h4>
3539 <dd class=
"description">Map element
</dd>
3541 <dd class=
"description">Top margin in
2540ths
</dd>
3543 <h2 class=
"title"><a name=
"VARIABLES">Variables
</a></h2>
3544 <h3 class=
"variable"><a name=
"CF_RETURNS_RETAINED">CF_RETURNS_RETAINED
</a></h3>
3545 <p class=
"description">Get the Apple language identifier associated with a
3547 <p class=
"code">const char *locale) CF_RETURNS_RETAINED;
</p>
3548 <h2 class=
"title"><a name=
"ENUMERATIONS">Constants
</a></h2>
3549 <h3 class=
"enumeration"><a name=
"cups_ptype_e">cups_ptype_e
</a></h3>
3550 <p class=
"description">Printer type/capability bit
3552 <h4 class=
"constants">Constants
</h4>
3554 <dt>CUPS_PRINTER_3D
<span class=
"info"> CUPS
2.1 </span></dt>
3555 <dd class=
"description">Printer with
3D capabilities
</dd>
3556 <dt>CUPS_PRINTER_AUTHENTICATED
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3557 <dd class=
"description">Printer requires authentication
3559 <dt>CUPS_PRINTER_BIND
</dt>
3560 <dd class=
"description">Can bind output
</dd>
3561 <dt>CUPS_PRINTER_BW
</dt>
3562 <dd class=
"description">Can do B
&W printing
</dd>
3563 <dt>CUPS_PRINTER_CLASS
</dt>
3564 <dd class=
"description">Printer class
</dd>
3565 <dt>CUPS_PRINTER_COLLATE
</dt>
3566 <dd class=
"description">Can collage copies
</dd>
3567 <dt>CUPS_PRINTER_COLOR
</dt>
3568 <dd class=
"description">Can do color printing
</dd>
3569 <dt>CUPS_PRINTER_COMMANDS
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3570 <dd class=
"description">Printer supports maintenance commands
3572 <dt>CUPS_PRINTER_COPIES
</dt>
3573 <dd class=
"description">Can do copies
</dd>
3574 <dt>CUPS_PRINTER_COVER
</dt>
3575 <dd class=
"description">Can cover output
</dd>
3576 <dt>CUPS_PRINTER_DEFAULT
</dt>
3577 <dd class=
"description">Default printer on network
</dd>
3578 <dt>CUPS_PRINTER_DELETE
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3579 <dd class=
"description">Delete printer
3581 <dt>CUPS_PRINTER_DUPLEX
</dt>
3582 <dd class=
"description">Can do duplexing
</dd>
3583 <dt>CUPS_PRINTER_FAX
</dt>
3584 <dd class=
"description">Fax queue
</dd>
3585 <dt>CUPS_PRINTER_LARGE
</dt>
3586 <dd class=
"description">Can do D/E/A1/A0
</dd>
3587 <dt>CUPS_PRINTER_LOCAL
</dt>
3588 <dd class=
"description">Local printer or class
</dd>
3589 <dt>CUPS_PRINTER_MEDIUM
</dt>
3590 <dd class=
"description">Can do Tabloid/B/C/A3/A2
</dd>
3591 <dt>CUPS_PRINTER_MFP
<span class=
"info"> CUPS
1.4/OS X
10.6 </span></dt>
3592 <dd class=
"description">Printer with scanning capabilities
3594 <dt>CUPS_PRINTER_NOT_SHARED
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3595 <dd class=
"description">Printer is not shared
3597 <dt>CUPS_PRINTER_PUNCH
</dt>
3598 <dd class=
"description">Can punch output
</dd>
3599 <dt>CUPS_PRINTER_REJECTING
</dt>
3600 <dd class=
"description">Printer is rejecting jobs
</dd>
3601 <dt>CUPS_PRINTER_REMOTE
</dt>
3602 <dd class=
"description">Remote printer or class
</dd>
3603 <dt>CUPS_PRINTER_SCANNER
<span class=
"info"> CUPS
1.4/OS X
10.6 </span></dt>
3604 <dd class=
"description">Scanner-only device
3606 <dt>CUPS_PRINTER_SMALL
</dt>
3607 <dd class=
"description">Can do Letter/Legal/A4
</dd>
3608 <dt>CUPS_PRINTER_SORT
</dt>
3609 <dd class=
"description">Can sort output
</dd>
3610 <dt>CUPS_PRINTER_STAPLE
</dt>
3611 <dd class=
"description">Can staple output
</dd>
3612 <dt>CUPS_PRINTER_VARIABLE
</dt>
3613 <dd class=
"description">Can do variable sizes
</dd>