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.8">
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_dinfo_t" title=
"Destination capability and status
522 information ">cups_dinfo_t
</a></li>
523 <li><a href=
"#cups_job_t" title=
"Job">cups_job_t
</a></li>
524 <li><a href=
"#cups_option_t" title=
"Printer Options">cups_option_t
</a></li>
525 <li><a href=
"#cups_password_cb2_t" title=
"New password callback
526 ">cups_password_cb2_t
</a></li>
527 <li><a href=
"#cups_password_cb_t" title=
"Password callback">cups_password_cb_t
</a></li>
528 <li><a href=
"#cups_ptype_t" title=
"Printer type/capability bits">cups_ptype_t
</a></li>
529 <li><a href=
"#cups_server_cert_cb_t" title=
"Server credentials callback
530 ">cups_server_cert_cb_t
</a></li>
531 <li><a href=
"#cups_size_t" title=
"Media Size ">cups_size_t
</a></li>
532 <li><a href=
"#pwg_map_t" title=
"Map element - PPD to/from PWG">pwg_map_t
</a></li>
533 <li><a href=
"#pwg_media_t" title=
"Common media size data">pwg_media_t
</a></li>
534 <li><a href=
"#pwg_size_t" title=
"Size element - PPD to/from PWG">pwg_size_t
</a></li>
536 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
537 <li><a href=
"#cups_dest_s" title=
"Destination">cups_dest_s
</a></li>
538 <li><a href=
"#cups_job_s" title=
"Job">cups_job_s
</a></li>
539 <li><a href=
"#cups_option_s" title=
"Printer Options">cups_option_s
</a></li>
540 <li><a href=
"#cups_size_s" title=
"Media Size ">cups_size_s
</a></li>
541 <li><a href=
"#pollfd" title=
"User data (unused)">pollfd
</a></li>
542 <li><a href=
"#pwg_map_s" title=
"Map element - PPD to/from PWG">pwg_map_s
</a></li>
543 <li><a href=
"#pwg_media_s" title=
"Common media size data">pwg_media_s
</a></li>
544 <li><a href=
"#pwg_size_s" title=
"Size element - PPD to/from PWG">pwg_size_s
</a></li>
546 <li><a href=
"#VARIABLES">Variables
</a><ul class=
"code">
547 <li><a href=
"#CF_RETURNS_RETAINED" title=
"Get the Apple language identifier associated with a
548 locale ID.">CF_RETURNS_RETAINED
</a></li>
550 <li><a href=
"#ENUMERATIONS">Constants
</a><ul class=
"code">
551 <li><a href=
"#cups_ptype_e" title=
"Printer type/capability bit
552 constants">cups_ptype_e
</a></li>
556 API introduction for CUPS.
558 Copyright 2007-2013 by Apple Inc.
559 Copyright 1997-2006 by Easy Software Products, all rights reserved.
561 These coded instructions, statements, and computer programs are the
562 property of Apple Inc. and are protected by Federal copyright
563 law. Distribution and use rights are outlined in the file "LICENSE.txt"
564 which should have been included with this file. If this file is
565 file is missing or damaged, see the license at "http://www.cups.org/".
568 <h2 class='title'
><a name='OVERVIEW'
>Overview
</a></h2>
570 <p>The CUPS API provides the convenience functions needed to support
571 applications, filters, printer drivers, and backends that need to interface
572 with the CUPS scheduler.
</p>
574 <h3><a name='CLIENTS_AND_SERVERS'
>Clients and Servers
</a></h3>
576 <p>CUPS is based on the Internet Printing Protocol (
"IPP"), which allows
577 clients (applications) to communicate with a server (the scheduler) to get a
578 list of printers, send print jobs, and so forth. You identify which server
579 you want to communicate with using a pointer to the opaque structure
580 <code>http_t
</code>. All of the examples in this document use the
581 <code>CUPS_HTTP_DEFAULT
</code> constant, referring to the default connection
582 to the scheduler. The
<a href='api-httpipp.html' target='_top'
>HTTP and IPP
583 APIs
</a> document provides more information on server connections.
</p>
585 <h3><a name='PRINTERS_AND_CLASSES'
>Printers and Classes
</a></h3>
587 <p>Printers and classes (collections of printers) are accessed through
588 the
<a href=
"#cups_dest_t"><code>cups_dest_t
</code></a> structure which
589 includes the name (
<code>name
</code>), instance (
<code>instance
</code> -
590 a way of selecting certain saved options/settings), and the options and
591 attributes associated with that destination (
<code>num_options
</code> and
592 <code>options
</code>). Destinations are created using the
593 <a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> function and freed
594 using the
<a href='#cupsFreeDests'
><code>cupsFreeDests
</code></a> function.
595 The
<a href='#cupsGetDest'
><code>cupsGetDest
</code></a> function finds a
596 specific destination for printing:
</p>
598 <pre class='example'
>
599 #include
<cups/cups.h
>
601 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
602 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
603 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest =
<a href='#cupsGetDest'
>cupsGetDest
</a>(
"name", NULL, num_dests, dests);
605 /* do something with dest */
607 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
610 <p>Passing
<code>NULL
</code> to
611 <a href='#cupsGetDest'
><code>cupsGetDest
</code></a> for the destination name
612 will return the default destination. Similarly, passing a
<code>NULL
</code>
613 instance will return the default instance for that destination.
</p>
615 <div class='table'
><table summary='Table
1: Printer Attributes' width='
80%'
>
616 <caption>Table
1:
<a name='TABLE1'
>Printer Attributes
</a></caption>
619 <th>Attribute Name
</th>
625 <td>"auth-info-required"</td>
626 <td>The type of authentication required for printing to this
627 destination:
"none",
"username,password",
"domain,username,password",
628 or
"negotiate" (Kerberos)
</td>
631 <td>"printer-info"</td>
632 <td>The human-readable description of the destination such as
"My
636 <td>"printer-is-accepting-jobs"</td>
637 <td>"true" if the destination is accepting new jobs,
"false" if
641 <td>"printer-is-shared"</td>
642 <td>"true" if the destination is being shared with other computers,
646 <td>"printer-location"</td>
647 <td>The human-readable location of the destination such as
"Lab 4".
</td>
650 <td>"printer-make-and-model"</td>
651 <td>The human-readable make and model of the destination such as
"HP
652 LaserJet 4000 Series".
</td>
655 <td>"printer-state"</td>
656 <td>"3" if the destination is idle,
"4" if the destination is printing
657 a job, and
"5" if the destination is stopped.
</td>
660 <td>"printer-state-change-time"</td>
661 <td>The UNIX time when the destination entered the current state.
</td>
664 <td>"printer-state-reasons"</td>
665 <td>Additional comma-delimited state keywords for the destination
666 such as
"media-tray-empty-error" and
"toner-low-warning".
</td>
669 <td>"printer-type"</td>
670 <td>The
<a href='#cups_printer_t'
><code>cups_printer_t
</code></a>
671 value associated with the destination.
</td>
676 <h3><a name='OPTIONS'
>Options
</a></h3>
678 <p>Options are stored in arrays of
679 <a href='#cups_option_t'
><code>cups_option_t
</code></a> structures. Each
680 option has a name (
<code>name
</code>) and value (
<code>value
</code>)
681 associated with it. The
<a href='#cups_dest_t'
><code>cups_dest_t
</code></a>
682 <code>num_options
</code> and
<code>options
</code> members contain the
683 default options for a particular destination, along with several informational
684 attributes about the destination as shown in
<a href='#TABLE1'
>Table
1</a>.
685 The
<a href='#cupsGetOption'
><code>cupsGetOption
</code></a> function gets
686 the value for the named option. For example, the following code lists the
687 available destinations and their human-readable descriptions:
</p>
689 <pre class='example'
>
690 #include
<cups/cups.h
>
692 <a href='#cups_dest_t'
>cups_dest_t
</a> *dests;
693 int num_dests =
<a href='#cupsGetDests'
>cupsGetDests
</a>(
&dests);
694 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
698 for (i = num_dests, dest = dests; i
> 0; i --, dest ++)
699 if (dest-
>instance == NULL)
701 value =
<a href='#cupsGetOption'
>cupsGetOption
</a>(
"printer-info", dest-
>num_options, dest-
>options);
702 printf(
"%s (%s)\n", dest-
>name, value ? value :
"no description");
705 <a href='#cupsFreeDests'
>cupsFreeDests
</a>(num_dests, dests);
708 <p>You can create your own option arrays using the
709 <a href='#cupsAddOption'
><code>cupsAddOption
</code></a> function, which
710 adds a single named option to an array:
</p>
712 <pre class='example'
>
713 #include
<cups/cups.h
>
716 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
718 /* The returned num_options value is updated as needed */
719 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"value", num_options,
&options);
721 /* This adds a second option value */
722 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"second",
"value", num_options,
&options);
724 /* This replaces the first option we added */
725 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(
"first",
"new value", num_options,
&options);
728 <p>Use a
<code>for
</code> loop to copy the options from a destination:
</p>
730 <pre class='example'
>
731 #include
<cups/cups.h
>
735 <a href='#cups_option_t'
>cups_option_t
</a> *options = NULL;
736 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
738 for (i =
0; i
< dest-
>num_options; i ++)
739 num_options =
<a href='#cupsAddOption'
>cupsAddOption
</a>(dest-
>options[i].name, dest-
>options[i].value,
740 num_options,
&options);
743 <p>Use the
<a href='#cupsFreeOptions'
><code>cupsFreeOptions
</code></a>
744 function to free the options array when you are done using it:
</p>
746 <pre class='example'
>
747 <a href='#cupsFreeOptions'
>cupsFreeOptions
</a>(num_options, options);
750 <h3><a name='PRINT_JOBS'
>Print Jobs
</a></h3>
752 <p>Print jobs are identified by a locally-unique job ID number from
1 to
753 2<sup>31</sup>-
1 and have options and one or more files for printing to a
754 single destination. The
<a href='#cupsPrintFile'
><code>cupsPrintFile
</code></a>
755 function creates a new job with one file. The following code prints the CUPS
758 <pre class='example'
>
759 #include
<cups/cups.h
>
761 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
763 <a href='#cups_option_t'
>cups_option_t
</a> *options;
766 /* Print a single file */
767 job_id =
<a href='#cupsPrintFile'
>cupsPrintFile
</a>(dest-
>name,
"/usr/share/cups/data/testprint.ps",
768 "Test Print", num_options, options);
771 <p>The
<a href='#cupsPrintFiles'
><code>cupsPrintFiles
</code></a> function
772 creates a job with multiple files. The files are provided in a
773 <code>char *
</code> array:
</p>
775 <pre class='example'
>
776 #include
<cups/cups.h
>
778 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
780 <a href='#cups_option_t'
>cups_option_t
</a> *options;
782 char *files[
3] = {
"file1.pdf",
"file2.pdf",
"file3.pdf" };
784 /* Print three files */
785 job_id =
<a href='#cupsPrintFiles'
>cupsPrintFiles
</a>(dest-
>name,
3, files,
"Test Print", num_options, options);
788 <p>Finally, the
<a href='#cupsCreateJob'
><code>cupsCreateJob
</code></a>
789 function creates a new job with no files in it. Files are added using the
790 <a href='#cupsStartDocument'
><code>cupsStartDocument
</code></a>,
791 <a href='api-httpipp.html#cupsWriteRequestData'
><code>cupsWriteRequestData
</code></a>,
792 and
<a href='#cupsFinishDocument'
><code>cupsFinishDocument
</code></a> functions.
793 The following example creates a job with
10 text files for printing:
</p>
795 <pre class='example'
>
796 #include
<cups/cups.h
>
798 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
800 <a href='#cups_option_t'
>cups_option_t
</a> *options;
806 job_id =
<a href='#cupsCreateJob'
>cupsCreateJob
</a>(CUPS_HTTP_DEFAULT, dest-
>name,
"10 Text Files",
807 num_options, options);
809 /* If the job is created, add
10 files */
812 for (i =
1; i
<=
10; i ++)
814 snprintf(buffer, sizeof(buffer),
"file%d.txt", i);
816 <a href='#cupsStartDocument'
>cupsStartDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name, job_id, buffer,
817 CUPS_FORMAT_TEXT, i ==
10);
819 snprintf(buffer, sizeof(buffer),
827 /* cupsWriteRequestData can be called as many times as needed */
828 <a href='#cupsWriteRequestData'
>cupsWriteRequestData
</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
830 <a href='#cupsFinishDocument'
>cupsFinishDocument
</a>(CUPS_HTTP_DEFAULT, dest-
>name);
835 <p>Once you have created a job, you can monitor its status using the
836 <a href='#cupsGetJobs'
><code>cupsGetJobs
</code></a> function, which returns
837 an array of
<a href='#cups_job_t'
><code>cups_job_t
</code></a> structures.
838 Each contains the job ID (
<code>id
</code>), destination name
839 (
<code>dest
</code>), title (
<code>title
</code>), and other information
840 associated with the job. The job array is freed using the
841 <a href='#cupsFreeJobs'
><code>cupsFreeJobs
</code></a> function. The following
842 example monitors a specific job ID, showing the current job state once every
843 5 seconds until the job is completed:
</p>
845 <pre class='example'
>
846 #include
<cups/cups.h
>
848 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
851 <a href='#cups_job_t'
>cups_job_t
</a> *jobs;
853 ipp_jstate_t job_state = IPP_JOB_PENDING;
855 while (job_state
< IPP_JOB_STOPPED)
857 /* Get my jobs (
1) with any state (-
1) */
858 num_jobs =
<a href='#cupsGetJobs'
>cupsGetJobs
</a>(
&jobs, dest-
>name,
1, -
1);
860 /* Loop to find my job */
861 job_state = IPP_JOB_COMPLETED;
863 for (i =
0; i
< num_jobs; i ++)
864 if (jobs[i].id == job_id)
866 job_state = jobs[i].state;
870 /* Free the job array */
871 <a href='#cupsFreeJobs'
>cupsFreeJobs
</a>(num_jobs, jobs);
873 /* Show the current state */
876 case IPP_JOB_PENDING :
877 printf(
"Job %d is pending.\n", job_id);
880 printf(
"Job %d is held.\n", job_id);
882 case IPP_JOB_PROCESSING :
883 printf(
"Job %d is processing.\n", job_id);
885 case IPP_JOB_STOPPED :
886 printf(
"Job %d is stopped.\n", job_id);
888 case IPP_JOB_CANCELED :
889 printf(
"Job %d is canceled.\n", job_id);
891 case IPP_JOB_ABORTED :
892 printf(
"Job %d is aborted.\n", job_id);
894 case IPP_JOB_COMPLETED :
895 printf(
"Job %d is completed.\n", job_id);
899 /* Sleep if the job is not finished */
900 if (job_state
< IPP_JOB_STOPPED)
905 <p>To cancel a job, use the
906 <a href='#cupsCancelJob'
><code>cupsCancelJob
</code></a> function with the
909 <pre class='example'
>
910 #include
<cups/cups.h
>
912 <a href='#cups_dest_t'
>cups_dest_t
</a> *dest;
915 <a href='#cupsCancelJob'
>cupsCancelJob
</a>(dest-
>name, job_id);
918 <h3><a name='ERROR_HANDLING'
>Error Handling
</a></h3>
920 <p>If any of the CUPS API printing functions returns an error, the reason for
921 that error can be found by calling the
922 <a href='#cupsLastError'
><code>cupsLastError
</code></a> and
923 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> functions.
924 <a href='#cupsLastError'
><code>cupsLastError
</code></a> returns the last IPP
926 (
<a href='api-httpipp.html#ipp_status_t'
><code>ipp_status_t
</code></a>)
927 that was encountered, while
928 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> returns
929 a (localized) human-readable string that can be shown to the user. For example,
930 if any of the job creation functions returns a job ID of
0, you can use
931 <a href='#cupsLastErrorString'
><code>cupsLastErrorString
</code></a> to show
932 the reason why the job could not be created:
</p>
934 <pre class='example'
>
935 #include
<cups/cups.h
>
940 puts(cupsLastErrorString());
943 <h3><a name='PASSWORDS_AND_AUTHENTICATION'
>Passwords and Authentication
</a></h3>
945 <p>CUPS supports authentication of any request, including submission of print
946 jobs. The default mechanism for getting the username and password is to use the
947 login user and a password from the console.
</p>
949 <p>To support other types of applications, in particular Graphical User
950 Interfaces (
"GUIs"), the CUPS API provides functions to set the default
951 username and to register a callback function that returns a password string.
</p>
953 <p>The
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a>
954 function is used to set a password callback in your program. Only one
955 function can be used at any time.
</p>
957 <p>The
<a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function sets the
958 current username for authentication. This function can be called by your
959 password callback function to change the current username as needed.
</p>
961 <p>The following example shows a simple password callback that gets a
962 username and password from the user:
</p>
964 <pre class='example'
>
965 #include
<cups/cups.h
>
968 my_password_cb(const char *prompt)
975 /* Get a username from the user */
976 printf(
"Username: ");
977 if (fgets(user, sizeof(user), stdin) == NULL)
980 /* Strip the newline from the string and set the user */
981 user[strlen(user) -
1] = '\
0';
983 <a href='#cupsSetUser'
>cupsSetUser
</a>(user);
985 /* Use getpass() to ask for the password... */
986 return (getpass(
"Password: "));
989 <a href='#cupsSetPasswordCB'
>cupsSetPasswordCB
</a>(my_password_cb);
992 <p>Similarly, a GUI could display the prompt string in a window with input
993 fields for the username and password. The username should default to the
994 string returned by the
<a href=
"#cupsUser"><code>cupsUser
</code></a>
996 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
997 <h3 class=
"function"><a name=
"cupsAddDest">cupsAddDest
</a></h3>
998 <p class=
"description">Add a destination to the list of destinations.
</p>
1000 int cupsAddDest (
<br>
1001 const char *name,
<br>
1002 const char *instance,
<br>
1003 int num_dests,
<br>
1004 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1006 <h4 class=
"parameters">Parameters
</h4>
1009 <dd class=
"description">Destination name
</dd>
1011 <dd class=
"description">Instance name or
<code>NULL
</code> for none/primary
</dd>
1013 <dd class=
"description">Number of destinations
</dd>
1015 <dd class=
"description">Destinations
</dd>
1017 <h4 class=
"returnvalue">Return Value
</h4>
1018 <p class=
"description">New number of destinations
</p>
1019 <h4 class=
"discussion">Discussion
</h4>
1020 <p class=
"discussion">This function cannot be used to add a new class or printer queue,
1021 it only adds a new container of saved options for the named
1022 destination or instance.
<br>
1024 If the named destination already exists, the destination list is
1025 returned unchanged. Adding a new instance of a destination creates
1026 a copy of that destination's options.
<br>
1028 Use the
<a href=
"#cupsSaveDests"><code>cupsSaveDests
</code></a> function to save the updated list of
1029 destinations to the user's lpoptions file.
</p>
1030 <h3 class=
"function"><a name=
"cupsAddOption">cupsAddOption
</a></h3>
1031 <p class=
"description">Add an option to an option array.
</p>
1033 int cupsAddOption (
<br>
1034 const char *name,
<br>
1035 const char *value,
<br>
1036 int num_options,
<br>
1037 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
1039 <h4 class=
"parameters">Parameters
</h4>
1042 <dd class=
"description">Name of option
</dd>
1044 <dd class=
"description">Value of option
</dd>
1045 <dt>num_options
</dt>
1046 <dd class=
"description">Number of options
</dd>
1048 <dd class=
"description">Pointer to options
</dd>
1050 <h4 class=
"returnvalue">Return Value
</h4>
1051 <p class=
"description">Number of options
</p>
1052 <h4 class=
"discussion">Discussion
</h4>
1053 <p class=
"discussion">New option arrays can be initialized simply by passing
0 for the
1054 "num_options
" parameter.
</p>
1055 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD
</a></h3>
1056 <p class=
"description">Create the Windows PPD file for a printer.
</p>
1058 char *cupsAdminCreateWindowsPPD (
<br>
1059 http_t *http,
<br>
1060 const char *dest,
<br>
1061 char *buffer,
<br>
1062 int bufsize
<br>
1064 <h4 class=
"parameters">Parameters
</h4>
1067 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1069 <dd class=
"description">Printer or class
</dd>
1071 <dd class=
"description">Filename buffer
</dd>
1073 <dd class=
"description">Size of filename buffer
</dd>
1075 <h4 class=
"returnvalue">Return Value
</h4>
1076 <p class=
"description">PPD file or NULL
</p>
1077 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsAdminExportSamba">cupsAdminExportSamba
</a></h3>
1078 <p class=
"description">Export a printer to Samba.
</p>
1080 int cupsAdminExportSamba (
<br>
1081 const char *dest,
<br>
1082 const char *ppd,
<br>
1083 const char *samba_server,
<br>
1084 const char *samba_user,
<br>
1085 const char *samba_password,
<br>
1086 FILE *logfile
<br>
1088 <h4 class=
"parameters">Parameters
</h4>
1091 <dd class=
"description">Destination to export
</dd>
1093 <dd class=
"description">PPD file
</dd>
1094 <dt>samba_server
</dt>
1095 <dd class=
"description">Samba server
</dd>
1097 <dd class=
"description">Samba username
</dd>
1098 <dt>samba_password
</dt>
1099 <dd class=
"description">Samba password
</dd>
1101 <dd class=
"description">Log file, if any
</dd>
1103 <h4 class=
"returnvalue">Return Value
</h4>
1104 <p class=
"description">1 on success,
0 on failure
</p>
1105 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsAdminGetServerSettings">cupsAdminGetServerSettings
</a></h3>
1106 <p class=
"description">Get settings from the server.
</p>
1108 int cupsAdminGetServerSettings (
<br>
1109 http_t *http,
<br>
1110 int *num_settings,
<br>
1111 <a href=
"#cups_option_t">cups_option_t
</a> **settings
<br>
1113 <h4 class=
"parameters">Parameters
</h4>
1116 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1117 <dt>num_settings
</dt>
1118 <dd class=
"description">Number of settings
</dd>
1120 <dd class=
"description">Settings
</dd>
1122 <h4 class=
"returnvalue">Return Value
</h4>
1123 <p class=
"description">1 on success,
0 on failure
</p>
1124 <h4 class=
"discussion">Discussion
</h4>
1125 <p class=
"discussion">The returned settings should be freed with cupsFreeOptions() when
1126 you are done with them.
1129 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsAdminSetServerSettings">cupsAdminSetServerSettings
</a></h3>
1130 <p class=
"description">Set settings on the server.
</p>
1132 int cupsAdminSetServerSettings (
<br>
1133 http_t *http,
<br>
1134 int num_settings,
<br>
1135 <a href=
"#cups_option_t">cups_option_t
</a> *settings
<br>
1137 <h4 class=
"parameters">Parameters
</h4>
1140 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1141 <dt>num_settings
</dt>
1142 <dd class=
"description">Number of settings
</dd>
1144 <dd class=
"description">Settings
</dd>
1146 <h4 class=
"returnvalue">Return Value
</h4>
1147 <p class=
"description">1 on success,
0 on failure
</p>
1148 <h3 class=
"function"><a name=
"cupsCancelDestJob">cupsCancelDestJob
</a></h3>
1149 <p class=
"description">Include necessary headers...
</p>
1151 ipp_status_t cupsCancelDestJob (
<br>
1152 http_t *http,
<br>
1153 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1154 int job_id
<br>
1156 <h4 class=
"parameters">Parameters
</h4>
1159 <dd class=
"description">Connection to destination
</dd>
1161 <dd class=
"description">Destination
</dd>
1163 <dd class=
"description">Job ID
</dd>
1165 <h4 class=
"returnvalue">Return Value
</h4>
1166 <p class=
"description">Cancel a job on a destination.
</p>
1167 <p class=
"discussion">The
"job_id
" is the number returned by cupsCreateDestJob.
<br>
1169 Returns
<code>IPP_STATUS_OK
</code> on success and
1170 <code>IPP_STATUS_ERRPR_NOT_AUTHORIZED
</code> or
1171 <code>IPP_STATUS_ERROR_FORBIDDEN
</code> on failure.
1174 <h3 class=
"function"><a name=
"cupsCancelJob">cupsCancelJob
</a></h3>
1175 <p class=
"description">Cancel a print job on the default server.
</p>
1177 int cupsCancelJob (
<br>
1178 const char *name,
<br>
1179 int job_id
<br>
1181 <h4 class=
"parameters">Parameters
</h4>
1184 <dd class=
"description">Name of printer or class
</dd>
1186 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1188 <h4 class=
"returnvalue">Return Value
</h4>
1189 <p class=
"description">1 on success,
0 on failure
</p>
1190 <h4 class=
"discussion">Discussion
</h4>
1191 <p class=
"discussion">Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1192 to cancel the current job on the named destination.
<br>
1194 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1195 the cause of any failure.
</p>
1196 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsCancelJob2">cupsCancelJob2
</a></h3>
1197 <p class=
"description">Cancel or purge a print job.
</p>
1199 ipp_status_t cupsCancelJob2 (
<br>
1200 http_t *http,
<br>
1201 const char *name,
<br>
1202 int job_id,
<br>
1203 int purge
<br>
1205 <h4 class=
"parameters">Parameters
</h4>
1208 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1210 <dd class=
"description">Name of printer or class
</dd>
1212 <dd class=
"description">Job ID,
<code>CUPS_JOBID_CURRENT
</code> for the current job, or
<code>CUPS_JOBID_ALL
</code> for all jobs
</dd>
1214 <dd class=
"description">1 to purge,
0 to cancel
</dd>
1216 <h4 class=
"returnvalue">Return Value
</h4>
1217 <p class=
"description">IPP status
</p>
1218 <h4 class=
"discussion">Discussion
</h4>
1219 <p class=
"discussion">Canceled jobs remain in the job history while purged jobs are removed
1220 from the job history.
<br>
1222 Pass
<code>CUPS_JOBID_ALL
</code> to cancel all jobs or
<code>CUPS_JOBID_CURRENT
</code>
1223 to cancel the current job on the named destination.
<br>
1225 Use the
<a href=
"#cupsLastError"><code>cupsLastError
</code></a> and
<a href=
"#cupsLastErrorString"><code>cupsLastErrorString
</code></a> functions to get
1226 the cause of any failure.
1229 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCheckDestSupported">cupsCheckDestSupported
</a></h3>
1230 <p class=
"description">Check that the option and value are supported
1231 by the destination.
</p>
1233 int cupsCheckDestSupported (
<br>
1234 http_t *http,
<br>
1235 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1236 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1237 const char *option,
<br>
1238 const char *value
<br>
1240 <h4 class=
"parameters">Parameters
</h4>
1243 <dd class=
"description">Connection to destination
</dd>
1245 <dd class=
"description">Destination
</dd>
1247 <dd class=
"description">Destination information
</dd>
1249 <dd class=
"description">Option
</dd>
1251 <dd class=
"description">Value
</dd>
1253 <h4 class=
"returnvalue">Return Value
</h4>
1254 <p class=
"description">1 if supported,
0 otherwise
</p>
1255 <h4 class=
"discussion">Discussion
</h4>
1256 <p class=
"discussion">Returns
1 if supported,
0 otherwise.
1259 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCloseDestJob">cupsCloseDestJob
</a></h3>
1260 <p class=
"description">Close a job and start printing.
</p>
1262 ipp_status_t cupsCloseDestJob (
<br>
1263 http_t *http,
<br>
1264 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1265 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
1266 int job_id
<br>
1268 <h4 class=
"parameters">Parameters
</h4>
1271 <dd class=
"description">Connection to destination
</dd>
1273 <dd class=
"description">Destination
</dd>
1275 <dd class=
"description">Destination information
</dd>
1277 <dd class=
"description">Job ID
</dd>
1279 <h4 class=
"returnvalue">Return Value
</h4>
1280 <p class=
"description">IPP status code
</p>
1281 <h4 class=
"discussion">Discussion
</h4>
1282 <p class=
"discussion">Use when the last call to cupsStartDocument passed
0 for
"last_document
".
1283 "job_id
" is the job ID returned by cupsCreateDestJob. Returns
<code>IPP_STATUS_OK
</code>
1287 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsConnectDest">cupsConnectDest
</a></h3>
1288 <p class=
"description">Connect to the server for a destination.
</p>
1290 http_t *cupsConnectDest (
<br>
1291 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1292 unsigned flags,
<br>
1293 int msec,
<br>
1294 int *cancel,
<br>
1295 char *resource,
<br>
1296 size_t resourcesize,
<br>
1297 <a href=
"#cups_dest_cb_t">cups_dest_cb_t
</a> cb,
<br>
1298 void *user_data
<br>
1300 <h4 class=
"parameters">Parameters
</h4>
1303 <dd class=
"description">Destination
</dd>
1305 <dd class=
"description">Connection flags
</dd>
1307 <dd class=
"description">Timeout in milliseconds
</dd>
1309 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1311 <dd class=
"description">Resource buffer
</dd>
1312 <dt>resourcesize
</dt>
1313 <dd class=
"description">Size of resource buffer
</dd>
1315 <dd class=
"description">Callback function
</dd>
1317 <dd class=
"description">User data pointer
</dd>
1319 <h4 class=
"returnvalue">Return Value
</h4>
1320 <p class=
"description">Connection to server or
<code>NULL
</code></p>
1321 <h4 class=
"discussion">Discussion
</h4>
1322 <p class=
"discussion">Connect to the destination, returning a new http_t connection object and
1323 optionally the resource path to use for the destination. These calls will
1324 block until a connection is made, the timeout expires, the integer pointed
1325 to by
"cancel
" is non-zero, or the callback function (or block) returns
0,
1326 The caller is responsible for calling httpClose() on the returned object.
1329 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsConnectDestBlock">cupsConnectDestBlock
</a></h3>
1330 <p class=
"description">Connect to the server for a destination.
</p>
1332 http_t *cupsConnectDestBlock (
<br>
1333 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1334 unsigned flags,
<br>
1335 int msec,
<br>
1336 int *cancel,
<br>
1337 char *resource,
<br>
1338 size_t resourcesize,
<br>
1339 <a href=
"#cups_dest_block_t">cups_dest_block_t
</a> block
<br>
1341 <h4 class=
"parameters">Parameters
</h4>
1344 <dd class=
"description">Destination
</dd>
1346 <dd class=
"description">Connection flags
</dd>
1348 <dd class=
"description">Timeout in milliseconds
</dd>
1350 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1352 <dd class=
"description">Resource buffer
</dd>
1353 <dt>resourcesize
</dt>
1354 <dd class=
"description">Size of resource buffer
</dd>
1356 <dd class=
"description">Callback block
</dd>
1358 <h4 class=
"returnvalue">Return Value
</h4>
1359 <p class=
"description">Connection to server or
<code>NULL
</code></p>
1360 <h4 class=
"discussion">Discussion
</h4>
1361 <p class=
"discussion">Connect to the destination, returning a new http_t connection object and
1362 optionally the resource path to use for the destination. These calls will
1363 block until a connection is made, the timeout expires, the integer pointed
1364 to by
"cancel
" is non-zero, or the callback function (or block) returns
0,
1365 The caller is responsible for calling httpClose() on the returned object.
1368 <h3 class=
"function"><a name=
"cupsCopyDest">cupsCopyDest
</a></h3>
1369 <p class=
"description">Callback block
</p>
1371 int cupsCopyDest (
<br>
1372 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1373 int num_dests,
<br>
1374 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
1376 <h4 class=
"parameters">Parameters
</h4>
1382 <h4 class=
"returnvalue">Return Value
</h4>
1383 <p class=
"description">Copy a destination.
</p>
1384 <p class=
"discussion">Make a copy of the destination to an array of destinations (or just a single
1385 copy) - for use with the cupsEnumDests* functions. The caller is responsible
1386 for calling cupsFreeDests() on the returned object(s).
1389 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCopyDestConflicts">cupsCopyDestConflicts
</a></h3>
1390 <p class=
"description">Get conflicts and resolutions for a new
1391 option/value pair.
</p>
1393 int cupsCopyDestConflicts (
<br>
1394 http_t *http,
<br>
1395 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1396 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1397 int num_options,
<br>
1398 <a href=
"#cups_option_t">cups_option_t
</a> *options,
<br>
1399 const char *new_option,
<br>
1400 const char *new_value,
<br>
1401 int *num_conflicts,
<br>
1402 <a href=
"#cups_option_t">cups_option_t
</a> **conflicts,
<br>
1403 int *num_resolved,
<br>
1404 <a href=
"#cups_option_t">cups_option_t
</a> **resolved
<br>
1406 <h4 class=
"parameters">Parameters
</h4>
1409 <dd class=
"description">Connection to destination
</dd>
1411 <dd class=
"description">Destination
</dd>
1413 <dd class=
"description">Destination information
</dd>
1414 <dt>num_options
</dt>
1415 <dd class=
"description">Number of current options
</dd>
1417 <dd class=
"description">Current options
</dd>
1419 <dd class=
"description">New option
</dd>
1421 <dd class=
"description">New value
</dd>
1422 <dt>num_conflicts
</dt>
1423 <dd class=
"description">Number of conflicting options
</dd>
1425 <dd class=
"description">Conflicting options
</dd>
1426 <dt>num_resolved
</dt>
1427 <dd class=
"description">Number of options to resolve
</dd>
1429 <dd class=
"description">Resolved options
</dd>
1431 <h4 class=
"returnvalue">Return Value
</h4>
1432 <p class=
"description">1 if there is a conflict,
0 if none, -
1 on error
</p>
1433 <h4 class=
"discussion">Discussion
</h4>
1434 <p class=
"discussion">"num_options
" and
"options
" represent the currently selected options by the
1435 user.
"new_option
" and
"new_value
" are the setting the user has just
1438 Returns
1 if there is a conflict,
0 if there are no conflicts, and -
1 if
1439 there was an unrecoverable error such as a resolver loop.
<br>
1441 If
"num_conflicts
" and
"conflicts
" are not
<code>NULL
</code>, they are set to
1442 contain the list of conflicting option/value pairs. Similarly, if
1443 "num_resolved
" and
"resolved
" are not
<code>NULL
</code> they will be set to the
1444 list of changes needed to resolve the conflict.
<br>
1446 If cupsCopyDestConflicts returns
1 but
"num_resolved
" and
"resolved
" are set
1447 to
0 and
<code>NULL
</code>, respectively, then the conflict cannot be resolved.
1450 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCopyDestInfo">cupsCopyDestInfo
</a></h3>
1451 <p class=
"description">Get the supported values/capabilities for the
1454 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *cupsCopyDestInfo (
<br>
1455 http_t *http,
<br>
1456 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest
<br>
1458 <h4 class=
"parameters">Parameters
</h4>
1461 <dd class=
"description">Connection to destination
</dd>
1463 <dd class=
"description">Destination
</dd>
1465 <h4 class=
"returnvalue">Return Value
</h4>
1466 <p class=
"description">Destination information
</p>
1467 <h4 class=
"discussion">Discussion
</h4>
1468 <p class=
"discussion">The caller is responsible for calling
<a href=
"#cupsFreeDestInfo"><code>cupsFreeDestInfo
</code></a> on the return
1469 value.
<code>NULL
</code> is returned on error.
1472 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsCreateDestJob">cupsCreateDestJob
</a></h3>
1473 <p class=
"description">Create a job on a destination.
</p>
1475 ipp_status_t cupsCreateDestJob (
<br>
1476 http_t *http,
<br>
1477 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1478 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
1479 int *job_id,
<br>
1480 const char *title,
<br>
1481 int num_options,
<br>
1482 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1484 <h4 class=
"parameters">Parameters
</h4>
1487 <dd class=
"description">Connection to destination
</dd>
1489 <dd class=
"description">Destination
</dd>
1491 <dd class=
"description">Destination information
</dd>
1493 <dd class=
"description">Job ID or
0 on error
</dd>
1495 <dd class=
"description">Job name
</dd>
1496 <dt>num_options
</dt>
1497 <dd class=
"description">Number of job options
</dd>
1499 <dd class=
"description">Job options
</dd>
1501 <h4 class=
"returnvalue">Return Value
</h4>
1502 <p class=
"description">IPP status code
</p>
1503 <h4 class=
"discussion">Discussion
</h4>
1504 <p class=
"discussion">Returns
<code>IPP_STATUS_OK
</code> or
<code>IPP_STATUS_OK_SUBST
</code> on success, saving the job ID
1505 in the variable pointed to by
"job_id
".
1508 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsCreateJob">cupsCreateJob
</a></h3>
1509 <p class=
"description">Create an empty job for streaming.
</p>
1511 int cupsCreateJob (
<br>
1512 http_t *http,
<br>
1513 const char *name,
<br>
1514 const char *title,
<br>
1515 int num_options,
<br>
1516 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1518 <h4 class=
"parameters">Parameters
</h4>
1521 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1523 <dd class=
"description">Destination name
</dd>
1525 <dd class=
"description">Title of job
</dd>
1526 <dt>num_options
</dt>
1527 <dd class=
"description">Number of options
</dd>
1529 <dd class=
"description">Options
</dd>
1531 <h4 class=
"returnvalue">Return Value
</h4>
1532 <p class=
"description">Job ID or
0 on error
</p>
1533 <h4 class=
"discussion">Discussion
</h4>
1534 <p class=
"discussion">Use this function when you want to stream print data using the
1535 <a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>,
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a>, and
1536 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> functions. If you have one or more files to
1537 print, use the
<a href=
"#cupsPrintFile2"><code>cupsPrintFile2
</code></a> or
<a href=
"#cupsPrintFiles2"><code>cupsPrintFiles2
</code></a> function
1541 <h3 class=
"function"><a name=
"cupsEncryption">cupsEncryption
</a></h3>
1542 <p class=
"description">Get the current encryption settings.
</p>
1544 http_encryption_t cupsEncryption (void);
</p>
1545 <h4 class=
"returnvalue">Return Value
</h4>
1546 <p class=
"description">Encryption settings
</p>
1547 <h4 class=
"discussion">Discussion
</h4>
1548 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
1549 environment variable, then the ~/.cups/client.conf file, and finally the
1550 /etc/cups/client.conf file. If not set, the default is
1551 <code>HTTP_ENCRYPTION_IF_REQUESTED
</code>.
<br>
1553 Note: The current encryption setting is tracked separately for each thread
1554 in a program. Multi-threaded programs that override the setting via the
1555 <a href=
"#cupsSetEncryption"><code>cupsSetEncryption
</code></a> function need to do so in each thread for the same
1556 setting to be used.
</p>
1557 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsEnumDests">cupsEnumDests
</a></h3>
1558 <p class=
"description">Enumerate available destinations with a callback function.
</p>
1560 int cupsEnumDests (
<br>
1561 unsigned flags,
<br>
1562 int msec,
<br>
1563 int *cancel,
<br>
1564 <a href=
"#cups_ptype_t">cups_ptype_t
</a> type,
<br>
1565 <a href=
"#cups_ptype_t">cups_ptype_t
</a> mask,
<br>
1566 <a href=
"#cups_dest_cb_t">cups_dest_cb_t
</a> cb,
<br>
1567 void *user_data
<br>
1569 <h4 class=
"parameters">Parameters
</h4>
1572 <dd class=
"description">Enumeration flags
</dd>
1574 <dd class=
"description">Timeout in milliseconds,
1575 -
1 for indefinite
</dd>
1577 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1579 <dd class=
"description">Printer type bits
</dd>
1581 <dd class=
"description">Mask for printer type bits
</dd>
1583 <dd class=
"description">Callback function
</dd>
1585 <dd class=
"description">User data
</dd>
1587 <h4 class=
"returnvalue">Return Value
</h4>
1588 <p class=
"description">1 on success,
0 on failure
</p>
1589 <h4 class=
"discussion">Discussion
</h4>
1590 <p class=
"discussion">Destinations are enumerated from one or more sources. The callback function
1591 receives the
<code>user_data
</code> pointer, destination name, instance, number of
1592 options, and options which can be used as input to the
<a href=
"#cupsAddDest"><code>cupsAddDest
</code></a>
1593 function. The function must return
1 to continue enumeration or
0 to stop.
<br>
1595 Enumeration happens on the current thread and does not return until all
1596 destinations have been enumerated or the callback function returns
0.
1599 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsEnumDestsBlock">cupsEnumDestsBlock
</a></h3>
1600 <p class=
"description">Enumerate available destinations with a block.
</p>
1602 int cupsEnumDestsBlock (
<br>
1603 unsigned flags,
<br>
1604 int timeout,
<br>
1605 int *cancel,
<br>
1606 <a href=
"#cups_ptype_t">cups_ptype_t
</a> type,
<br>
1607 <a href=
"#cups_ptype_t">cups_ptype_t
</a> mask,
<br>
1608 <a href=
"#cups_dest_block_t">cups_dest_block_t
</a> block
<br>
1610 <h4 class=
"parameters">Parameters
</h4>
1613 <dd class=
"description">Enumeration flags
</dd>
1615 <dd class=
"description">Timeout in milliseconds,
0 for indefinite
</dd>
1617 <dd class=
"description">Pointer to
"cancel
" variable
</dd>
1619 <dd class=
"description">Printer type bits
</dd>
1621 <dd class=
"description">Mask for printer type bits
</dd>
1623 <dd class=
"description">Block
</dd>
1625 <h4 class=
"returnvalue">Return Value
</h4>
1626 <p class=
"description">1 on success,
0 on failure
</p>
1627 <h4 class=
"discussion">Discussion
</h4>
1628 <p class=
"discussion">Destinations are enumerated from one or more sources. The block receives the
1629 destination name, instance, number of options, and options which can be used
1630 as input to the
<a href=
"#cupsAddDest"><code>cupsAddDest
</code></a> function. The block must return
1 to
1631 continue enumeration or
0 to stop.
<br>
1633 Enumeration happens on the current thread and does not return until all
1634 destinations have been enumerated or the block returns
0.
1637 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestDefault">cupsFindDestDefault
</a></h3>
1638 <p class=
"description">Find the default value(s) for the given option.
</p>
1640 ipp_attribute_t *cupsFindDestDefault (
<br>
1641 http_t *http,
<br>
1642 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1643 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1644 const char *option
<br>
1646 <h4 class=
"parameters">Parameters
</h4>
1649 <dd class=
"description">Connection to destination
</dd>
1651 <dd class=
"description">Destination
</dd>
1653 <dd class=
"description">Destination information
</dd>
1655 <dd class=
"description">Option/attribute name
</dd>
1657 <h4 class=
"returnvalue">Return Value
</h4>
1658 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1659 <h4 class=
"discussion">Discussion
</h4>
1660 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1661 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1662 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1663 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1664 functions to inspect the default value(s) as needed.
1667 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestReady">cupsFindDestReady
</a></h3>
1668 <p class=
"description">Find the default value(s) for the given option.
</p>
1670 ipp_attribute_t *cupsFindDestReady (
<br>
1671 http_t *http,
<br>
1672 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1673 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1674 const char *option
<br>
1676 <h4 class=
"parameters">Parameters
</h4>
1679 <dd class=
"description">Connection to destination
</dd>
1681 <dd class=
"description">Destination
</dd>
1683 <dd class=
"description">Destination information
</dd>
1685 <dd class=
"description">Option/attribute name
</dd>
1687 <h4 class=
"returnvalue">Return Value
</h4>
1688 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1689 <h4 class=
"discussion">Discussion
</h4>
1690 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1691 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1692 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1693 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1694 functions to inspect the default value(s) as needed.
1697 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsFindDestSupported">cupsFindDestSupported
</a></h3>
1698 <p class=
"description">Find the default value(s) for the given option.
</p>
1700 ipp_attribute_t *cupsFindDestSupported (
<br>
1701 http_t *http,
<br>
1702 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1703 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1704 const char *option
<br>
1706 <h4 class=
"parameters">Parameters
</h4>
1709 <dd class=
"description">Connection to destination
</dd>
1711 <dd class=
"description">Destination
</dd>
1713 <dd class=
"description">Destination information
</dd>
1715 <dd class=
"description">Option/attribute name
</dd>
1717 <h4 class=
"returnvalue">Return Value
</h4>
1718 <p class=
"description">Default attribute or
<code>NULL
</code> for none
</p>
1719 <h4 class=
"discussion">Discussion
</h4>
1720 <p class=
"discussion">The returned value is an IPP attribute. Use the
<code>ippGetBoolean
</code>,
1721 <code>ippGetCollection
</code>,
<code>ippGetCount
</code>,
<code>ippGetDate
</code>,
1722 <code>ippGetInteger
</code>,
<code>ippGetOctetString
</code>,
<code>ippGetRange
</code>,
1723 <code>ippGetResolution
</code>,
<code>ippGetString
</code>, and
<code>ippGetValueTag
</code>
1724 functions to inspect the default value(s) as needed.
1727 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsFinishDestDocument">cupsFinishDestDocument
</a></h3>
1728 <p class=
"description">Finish the current document.
</p>
1730 ipp_status_t cupsFinishDestDocument (
<br>
1731 http_t *http,
<br>
1732 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1733 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info
<br>
1735 <h4 class=
"parameters">Parameters
</h4>
1738 <dd class=
"description">Connection to destination
</dd>
1740 <dd class=
"description">Destination
</dd>
1742 <dd class=
"description">Destination information
</dd>
1744 <h4 class=
"returnvalue">Return Value
</h4>
1745 <p class=
"description">Status of document submission
</p>
1746 <h4 class=
"discussion">Discussion
</h4>
1747 <p class=
"discussion">Returns
<code>IPP_STATUS_OK
</code> or
<code>IPP_STATUS_OK_SUBST
</code> on success.
1750 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsFinishDocument">cupsFinishDocument
</a></h3>
1751 <p class=
"description">Finish sending a document.
</p>
1753 ipp_status_t cupsFinishDocument (
<br>
1754 http_t *http,
<br>
1755 const char *name
<br>
1757 <h4 class=
"parameters">Parameters
</h4>
1760 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1762 <dd class=
"description">Destination name
</dd>
1764 <h4 class=
"returnvalue">Return Value
</h4>
1765 <p class=
"description">Status of document submission
</p>
1766 <h4 class=
"discussion">Discussion
</h4>
1767 <p class=
"discussion">The document must have been started using
<a href=
"#cupsStartDocument"><code>cupsStartDocument
</code></a>.
1770 <h3 class=
"function"><a name=
"cupsFreeDestInfo">cupsFreeDestInfo
</a></h3>
1771 <p class=
"description">Free destination information obtained using
1772 <a href=
"#cupsCopyDestInfo"><code>cupsCopyDestInfo
</code></a>.
</p>
1774 void cupsFreeDestInfo (
<br>
1775 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo
<br>
1777 <h4 class=
"parameters">Parameters
</h4>
1780 <dd class=
"description">Destination information
</dd>
1782 <h3 class=
"function"><a name=
"cupsFreeDests">cupsFreeDests
</a></h3>
1783 <p class=
"description">Free the memory used by the list of destinations.
</p>
1785 void cupsFreeDests (
<br>
1786 int num_dests,
<br>
1787 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1789 <h4 class=
"parameters">Parameters
</h4>
1792 <dd class=
"description">Number of destinations
</dd>
1794 <dd class=
"description">Destinations
</dd>
1796 <h3 class=
"function"><a name=
"cupsFreeJobs">cupsFreeJobs
</a></h3>
1797 <p class=
"description">Free memory used by job data.
</p>
1799 void cupsFreeJobs (
<br>
1800 int num_jobs,
<br>
1801 <a href=
"#cups_job_t">cups_job_t
</a> *jobs
<br>
1803 <h4 class=
"parameters">Parameters
</h4>
1806 <dd class=
"description">Number of jobs
</dd>
1808 <dd class=
"description">Jobs
</dd>
1810 <h3 class=
"function"><a name=
"cupsFreeOptions">cupsFreeOptions
</a></h3>
1811 <p class=
"description">Free all memory used by options.
</p>
1813 void cupsFreeOptions (
<br>
1814 int num_options,
<br>
1815 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
1817 <h4 class=
"parameters">Parameters
</h4>
1819 <dt>num_options
</dt>
1820 <dd class=
"description">Number of options
</dd>
1822 <dd class=
"description">Pointer to options
</dd>
1824 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetClasses">cupsGetClasses
</a></h3>
1825 <p class=
"description">Get a list of printer classes from the default server.
</p>
1827 int cupsGetClasses (
<br>
1828 char ***classes
<br>
1830 <h4 class=
"parameters">Parameters
</h4>
1833 <dd class=
"description">Classes
</dd>
1835 <h4 class=
"returnvalue">Return Value
</h4>
1836 <p class=
"description">Number of classes
</p>
1837 <h4 class=
"discussion">Discussion
</h4>
1838 <p class=
"discussion">This function is deprecated and no longer returns a list of printer
1839 classes - use
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
1842 <h3 class=
"function"><a name=
"cupsGetDefault">cupsGetDefault
</a></h3>
1843 <p class=
"description">Get the default printer or class for the default server.
</p>
1845 const char *cupsGetDefault (void);
</p>
1846 <h4 class=
"returnvalue">Return Value
</h4>
1847 <p class=
"description">Default printer or
<code>NULL
</code></p>
1848 <h4 class=
"discussion">Discussion
</h4>
1849 <p class=
"discussion">This function returns the default printer or class as defined by
1850 the LPDEST or PRINTER environment variables. If these environment
1851 variables are not set, the server default destination is returned.
1852 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1853 functions to get the user-defined default printer, as this function does
1854 not support the lpoptions-defined default printer.
</p>
1855 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetDefault2">cupsGetDefault2
</a></h3>
1856 <p class=
"description">Get the default printer or class for the specified server.
</p>
1858 const char *cupsGetDefault2 (
<br>
1859 http_t *http
<br>
1861 <h4 class=
"parameters">Parameters
</h4>
1864 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
1866 <h4 class=
"returnvalue">Return Value
</h4>
1867 <p class=
"description">Default printer or
<code>NULL
</code></p>
1868 <h4 class=
"discussion">Discussion
</h4>
1869 <p class=
"discussion">This function returns the default printer or class as defined by
1870 the LPDEST or PRINTER environment variables. If these environment
1871 variables are not set, the server default destination is returned.
1872 Applications should use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a>
1873 functions to get the user-defined default printer, as this function does
1874 not support the lpoptions-defined default printer.
1877 <h3 class=
"function"><a name=
"cupsGetDest">cupsGetDest
</a></h3>
1878 <p class=
"description">Get the named destination from the list.
</p>
1880 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetDest (
<br>
1881 const char *name,
<br>
1882 const char *instance,
<br>
1883 int num_dests,
<br>
1884 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
1886 <h4 class=
"parameters">Parameters
</h4>
1889 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
1891 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
1893 <dd class=
"description">Number of destinations
</dd>
1895 <dd class=
"description">Destinations
</dd>
1897 <h4 class=
"returnvalue">Return Value
</h4>
1898 <p class=
"description">Destination pointer or
<code>NULL
</code></p>
1899 <h4 class=
"discussion">Discussion
</h4>
1900 <p class=
"discussion">Use the
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> or
<a href=
"#cupsGetDests2"><code>cupsGetDests2
</code></a> functions to get a
1901 list of supported destinations for the current user.
</p>
1902 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaByIndex">cupsGetDestMediaByIndex
</a></h3>
1903 <p class=
"description">Get a media name, dimension, and margins for a
1906 int cupsGetDestMediaByIndex (
<br>
1907 http_t *http,
<br>
1908 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1909 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1910 int n,
<br>
1911 unsigned flags,
<br>
1912 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1914 <h4 class=
"parameters">Parameters
</h4>
1917 <dd class=
"description">Connection to destination
</dd>
1919 <dd class=
"description">Destination
</dd>
1921 <dd class=
"description">Destination information
</dd>
1923 <dd class=
"description">Media size number (
0-based)
</dd>
1925 <dd class=
"description">Media flags
</dd>
1927 <dd class=
"description">Media size information
</dd>
1929 <h4 class=
"returnvalue">Return Value
</h4>
1930 <p class=
"description">1 on success,
0 on failure
</p>
1931 <h4 class=
"discussion">Discussion
</h4>
1932 <p class=
"discussion">The
<code>flags
</code> parameter determines which set of media are indexed. For
1933 example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will get the Nth
1934 borderless size supported by the printer.
1937 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsGetDestMediaByName">cupsGetDestMediaByName
</a></h3>
1938 <p class=
"description">Get media names, dimensions, and margins.
</p>
1940 int cupsGetDestMediaByName (
<br>
1941 http_t *http,
<br>
1942 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1943 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1944 const char *media,
<br>
1945 unsigned flags,
<br>
1946 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1948 <h4 class=
"parameters">Parameters
</h4>
1951 <dd class=
"description">Connection to destination
</dd>
1953 <dd class=
"description">Destination
</dd>
1955 <dd class=
"description">Destination information
</dd>
1957 <dd class=
"description">Media name
</dd>
1959 <dd class=
"description">Media matching flags
</dd>
1961 <dd class=
"description">Media size information
</dd>
1963 <h4 class=
"returnvalue">Return Value
</h4>
1964 <p class=
"description">1 on match,
0 on failure
</p>
1965 <h4 class=
"discussion">Discussion
</h4>
1966 <p class=
"discussion">The
"media
" string is a PWG media name.
"Flags
" provides some matching
1967 guidance (multiple flags can be combined):
<br>
1969 CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
1970 CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
1971 CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with
2-sided printing,
1972 CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
1973 CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
1974 size amongst the
"ready
" media.
<br>
1976 The matching result (if any) is returned in the
"cups_size_t
" structure.
<br>
1978 Returns
1 when there is a match and
0 if there is not a match.
1981 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsGetDestMediaBySize">cupsGetDestMediaBySize
</a></h3>
1982 <p class=
"description">Get media names, dimensions, and margins.
</p>
1984 int cupsGetDestMediaBySize (
<br>
1985 http_t *http,
<br>
1986 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
1987 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
1988 int width,
<br>
1989 int length,
<br>
1990 unsigned flags,
<br>
1991 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
1993 <h4 class=
"parameters">Parameters
</h4>
1996 <dd class=
"description">Connection to destination
</dd>
1998 <dd class=
"description">Destination
</dd>
2000 <dd class=
"description">Destination information
</dd>
2002 <dd class=
"description">Media width in hundredths of
2005 <dd class=
"description">Media length in hundredths of
2008 <dd class=
"description">Media matching flags
</dd>
2010 <dd class=
"description">Media size information
</dd>
2012 <h4 class=
"returnvalue">Return Value
</h4>
2013 <p class=
"description">1 on match,
0 on failure
</p>
2014 <h4 class=
"discussion">Discussion
</h4>
2015 <p class=
"discussion">"Width
" and
"length
" are the dimensions in hundredths of millimeters.
2016 "Flags
" provides some matching guidance (multiple flags can be combined):
<br>
2018 CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
2019 CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
2020 CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with
2-sided printing,
2021 CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
2022 CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
2023 size amongst the
"ready
" media.
<br>
2025 The matching result (if any) is returned in the
"cups_size_t
" structure.
<br>
2027 Returns
1 when there is a match and
0 if there is not a match.
2030 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaCount">cupsGetDestMediaCount
</a></h3>
2031 <p class=
"description">Get the number of sizes supported by a
2034 int cupsGetDestMediaCount (
<br>
2035 http_t *http,
<br>
2036 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2037 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2038 unsigned flags
<br>
2040 <h4 class=
"parameters">Parameters
</h4>
2043 <dd class=
"description">Connection to destination
</dd>
2045 <dd class=
"description">Destination
</dd>
2047 <dd class=
"description">Destination information
</dd>
2049 <dd class=
"description">Media flags
</dd>
2051 <h4 class=
"returnvalue">Return Value
</h4>
2052 <p class=
"description">Number of sizes
</p>
2053 <h4 class=
"discussion">Discussion
</h4>
2054 <p class=
"discussion">The
<code>flags
</code> parameter determines the set of media sizes that are
2055 counted. For example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will return
2056 the number of borderless sizes.
2059 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsGetDestMediaDefault">cupsGetDestMediaDefault
</a></h3>
2060 <p class=
"description">Get the default size for a destination.
</p>
2062 int cupsGetDestMediaDefault (
<br>
2063 http_t *http,
<br>
2064 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2065 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2066 unsigned flags,
<br>
2067 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
2069 <h4 class=
"parameters">Parameters
</h4>
2072 <dd class=
"description">Connection to destination
</dd>
2074 <dd class=
"description">Destination
</dd>
2076 <dd class=
"description">Destination information
</dd>
2078 <dd class=
"description">Media flags
</dd>
2080 <dd class=
"description">Media size information
</dd>
2082 <h4 class=
"returnvalue">Return Value
</h4>
2083 <p class=
"description">1 on success,
0 on failure
</p>
2084 <h4 class=
"discussion">Discussion
</h4>
2085 <p class=
"discussion">The
<code>flags
</code> parameter determines which default size is returned. For
2086 example, passing
<code>CUPS_MEDIA_FLAGS_BORDERLESS
</code> will return the default
2087 borderless size, typically US Letter or A4, but sometimes
4x6 photo media.
2090 <h3 class=
"function"><span class=
"info"> CUPS
2.0/OS X
10.10 </span><a name=
"cupsGetDestWithURI">cupsGetDestWithURI
</a></h3>
2091 <p class=
"description">Get a destination associated with a URI.
</p>
2093 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetDestWithURI (
<br>
2094 const char *name,
<br>
2095 const char *uri
<br>
2097 <h4 class=
"parameters">Parameters
</h4>
2100 <dd class=
"description">Desired printer name or
<code>NULL
</code></dd>
2102 <dd class=
"description">URI for the printer
</dd>
2104 <h4 class=
"returnvalue">Return Value
</h4>
2105 <p class=
"description">Destination or
<code>NULL
</code></p>
2106 <h4 class=
"discussion">Discussion
</h4>
2107 <p class=
"discussion">"name
" is the desired name for the printer. If
<code>NULL
</code>, a name will be
2108 created using the URI.
<br>
2110 "uri
" is the
"ipp
" or
"ipps
" URI for the printer.
2113 <h3 class=
"function"><a name=
"cupsGetDests">cupsGetDests
</a></h3>
2114 <p class=
"description">Get the list of destinations from the default server.
</p>
2116 int cupsGetDests (
<br>
2117 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2119 <h4 class=
"parameters">Parameters
</h4>
2122 <dd class=
"description">Destinations
</dd>
2124 <h4 class=
"returnvalue">Return Value
</h4>
2125 <p class=
"description">Number of destinations
</p>
2126 <h4 class=
"discussion">Discussion
</h4>
2127 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
2128 printer-info, printer-is-accepting-jobs, printer-is-shared,
2129 printer-make-and-model, printer-state, printer-state-change-time,
2130 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
2131 adds the marker-change-time, marker-colors, marker-high-levels,
2132 marker-levels, marker-low-levels, marker-message, marker-names,
2133 marker-types, and printer-commands attributes as well.
<br>
2135 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
2136 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
</p>
2137 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetDests2">cupsGetDests2
</a></h3>
2138 <p class=
"description">Get the list of destinations from the specified server.
</p>
2140 int cupsGetDests2 (
<br>
2141 http_t *http,
<br>
2142 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2144 <h4 class=
"parameters">Parameters
</h4>
2147 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2149 <dd class=
"description">Destinations
</dd>
2151 <h4 class=
"returnvalue">Return Value
</h4>
2152 <p class=
"description">Number of destinations
</p>
2153 <h4 class=
"discussion">Discussion
</h4>
2154 <p class=
"discussion">Starting with CUPS
1.2, the returned list of destinations include the
2155 printer-info, printer-is-accepting-jobs, printer-is-shared,
2156 printer-make-and-model, printer-state, printer-state-change-time,
2157 printer-state-reasons, and printer-type attributes as options. CUPS
1.4
2158 adds the marker-change-time, marker-colors, marker-high-levels,
2159 marker-levels, marker-low-levels, marker-message, marker-names,
2160 marker-types, and printer-commands attributes as well.
<br>
2162 Use the
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> function to free the destination list and
2163 the
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> function to find a particular destination.
2166 <h3 class=
"function"><a name=
"cupsGetJobs">cupsGetJobs
</a></h3>
2167 <p class=
"description">Get the jobs from the default server.
</p>
2169 int cupsGetJobs (
<br>
2170 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
2171 const char *name,
<br>
2172 int myjobs,
<br>
2173 int whichjobs
<br>
2175 <h4 class=
"parameters">Parameters
</h4>
2178 <dd class=
"description">Job data
</dd>
2180 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
2182 <dd class=
"description">0 = all users,
1 = mine
</dd>
2184 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
2186 <h4 class=
"returnvalue">Return Value
</h4>
2187 <p class=
"description">Number of jobs
</p>
2188 <h4 class=
"discussion">Discussion
</h4>
2189 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
2190 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
2191 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
2192 jobs that are stopped, canceled, aborted, or completed.
</p>
2193 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsGetJobs2">cupsGetJobs2
</a></h3>
2194 <p class=
"description">Get the jobs from the specified server.
</p>
2196 int cupsGetJobs2 (
<br>
2197 http_t *http,
<br>
2198 <a href=
"#cups_job_t">cups_job_t
</a> **jobs,
<br>
2199 const char *name,
<br>
2200 int myjobs,
<br>
2201 int whichjobs
<br>
2203 <h4 class=
"parameters">Parameters
</h4>
2206 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2208 <dd class=
"description">Job data
</dd>
2210 <dd class=
"description"><code>NULL
</code> = all destinations, otherwise show jobs for named destination
</dd>
2212 <dd class=
"description">0 = all users,
1 = mine
</dd>
2214 <dd class=
"description"><code>CUPS_WHICHJOBS_ALL
</code>,
<code>CUPS_WHICHJOBS_ACTIVE
</code>, or
<code>CUPS_WHICHJOBS_COMPLETED
</code></dd>
2216 <h4 class=
"returnvalue">Return Value
</h4>
2217 <p class=
"description">Number of jobs
</p>
2218 <h4 class=
"discussion">Discussion
</h4>
2219 <p class=
"discussion">A
"whichjobs
" value of
<code>CUPS_WHICHJOBS_ALL
</code> returns all jobs regardless
2220 of state, while
<code>CUPS_WHICHJOBS_ACTIVE
</code> returns jobs that are
2221 pending, processing, or held and
<code>CUPS_WHICHJOBS_COMPLETED
</code> returns
2222 jobs that are stopped, canceled, aborted, or completed.
2225 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsGetNamedDest">cupsGetNamedDest
</a></h3>
2226 <p class=
"description">Get options for the named destination.
</p>
2228 <a href=
"#cups_dest_t">cups_dest_t
</a> *cupsGetNamedDest (
<br>
2229 http_t *http,
<br>
2230 const char *name,
<br>
2231 const char *instance
<br>
2233 <h4 class=
"parameters">Parameters
</h4>
2236 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2238 <dd class=
"description">Destination name or
<code>NULL
</code> for the default destination
</dd>
2240 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2242 <h4 class=
"returnvalue">Return Value
</h4>
2243 <p class=
"description">Destination or
<code>NULL
</code></p>
2244 <h4 class=
"discussion">Discussion
</h4>
2245 <p class=
"discussion">This function is optimized for retrieving a single destination and should
2246 be used instead of
<a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> and
<a href=
"#cupsGetDest"><code>cupsGetDest
</code></a> when you either
2247 know the name of the destination or want to print to the default destination.
2248 If
<code>NULL
</code> is returned, the destination does not exist or there is no
2249 default destination.
<br>
2251 If
"http
" is
<code>CUPS_HTTP_DEFAULT
</code>, the connection to the default print
2252 server will be used.
<br>
2254 If
"name
" is
<code>NULL
</code>, the default printer for the current user will be
2257 The returned destination must be freed using
<a href=
"#cupsFreeDests"><code>cupsFreeDests
</code></a> with a
2258 "num_dests
" value of
1.
2261 <h3 class=
"function"><a name=
"cupsGetOption">cupsGetOption
</a></h3>
2262 <p class=
"description">Get an option value.
</p>
2264 const char *cupsGetOption (
<br>
2265 const char *name,
<br>
2266 int num_options,
<br>
2267 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2269 <h4 class=
"parameters">Parameters
</h4>
2272 <dd class=
"description">Name of option
</dd>
2273 <dt>num_options
</dt>
2274 <dd class=
"description">Number of options
</dd>
2276 <dd class=
"description">Options
</dd>
2278 <h4 class=
"returnvalue">Return Value
</h4>
2279 <p class=
"description">Option value or
<code>NULL
</code></p>
2280 <h3 class=
"function"><a name=
"cupsGetPassword">cupsGetPassword
</a></h3>
2281 <p class=
"description">Get a password from the user.
</p>
2283 const char *cupsGetPassword (
<br>
2284 const char *prompt
<br>
2286 <h4 class=
"parameters">Parameters
</h4>
2289 <dd class=
"description">Prompt string
</dd>
2291 <h4 class=
"returnvalue">Return Value
</h4>
2292 <p class=
"description">Password
</p>
2293 <h4 class=
"discussion">Discussion
</h4>
2294 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
2295 user does not provide a password.
<br>
2297 Note: The current password callback function is tracked separately for each
2298 thread in a program. Multi-threaded programs that override the setting via
2299 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
2300 do so in each thread for the same function to be used.
</p>
2301 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsGetPassword2">cupsGetPassword2
</a></h3>
2302 <p class=
"description">Get a password from the user using the advanced
2303 password callback.
</p>
2305 const char *cupsGetPassword2 (
<br>
2306 const char *prompt,
<br>
2307 http_t *http,
<br>
2308 const char *method,
<br>
2309 const char *resource
<br>
2311 <h4 class=
"parameters">Parameters
</h4>
2314 <dd class=
"description">Prompt string
</dd>
2316 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2318 <dd class=
"description">Request method (
"GET
",
"POST
",
"PUT
")
</dd>
2320 <dd class=
"description">Resource path
</dd>
2322 <h4 class=
"returnvalue">Return Value
</h4>
2323 <p class=
"description">Password
</p>
2324 <h4 class=
"discussion">Discussion
</h4>
2325 <p class=
"discussion">Uses the current password callback function. Returns
<code>NULL
</code> if the
2326 user does not provide a password.
<br>
2328 Note: The current password callback function is tracked separately for each
2329 thread in a program. Multi-threaded programs that override the setting via
2330 the
<a href=
"#cupsSetPasswordCB"><code>cupsSetPasswordCB
</code></a> or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a> functions need to
2331 do so in each thread for the same function to be used.
2334 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsGetPrinters">cupsGetPrinters
</a></h3>
2335 <p class=
"description">Get a list of printers from the default server.
</p>
2337 int cupsGetPrinters (
<br>
2338 char ***printers
<br>
2340 <h4 class=
"parameters">Parameters
</h4>
2343 <dd class=
"description">Printers
</dd>
2345 <h4 class=
"returnvalue">Return Value
</h4>
2346 <p class=
"description">Number of printers
</p>
2347 <h4 class=
"discussion">Discussion
</h4>
2348 <p class=
"discussion">This function is deprecated and no longer returns a list of printers - use
2349 <a href=
"#cupsGetDests"><code>cupsGetDests
</code></a> instead.
2352 <h3 class=
"function"><a name=
"cupsLangDefault">cupsLangDefault
</a></h3>
2353 <p class=
"description">Return the default language.
</p>
2355 cups_lang_t *cupsLangDefault (void);
</p>
2356 <h4 class=
"returnvalue">Return Value
</h4>
2357 <p class=
"description">Language data
</p>
2358 <h3 class=
"function"><a name=
"cupsLangEncoding">cupsLangEncoding
</a></h3>
2359 <p class=
"description">Return the character encoding (us-ascii, etc.)
2360 for the given language.
</p>
2362 const char *cupsLangEncoding (
<br>
2363 cups_lang_t *lang
<br>
2365 <h4 class=
"parameters">Parameters
</h4>
2368 <dd class=
"description">Language data
</dd>
2370 <h4 class=
"returnvalue">Return Value
</h4>
2371 <p class=
"description">Character encoding
</p>
2372 <h3 class=
"function"><a name=
"cupsLangFlush">cupsLangFlush
</a></h3>
2373 <p class=
"description">Flush all language data out of the cache.
</p>
2375 void cupsLangFlush (void);
</p>
2376 <h3 class=
"function"><a name=
"cupsLangFree">cupsLangFree
</a></h3>
2377 <p class=
"description">Free language data.
</p>
2379 void cupsLangFree (
<br>
2380 cups_lang_t *lang
<br>
2382 <h4 class=
"parameters">Parameters
</h4>
2385 <dd class=
"description">Language to free
</dd>
2387 <h4 class=
"discussion">Discussion
</h4>
2388 <p class=
"discussion">This does not actually free anything; use
<a href=
"#cupsLangFlush"><code>cupsLangFlush
</code></a> for that.
</p>
2389 <h3 class=
"function"><a name=
"cupsLangGet">cupsLangGet
</a></h3>
2390 <p class=
"description">Get a language.
</p>
2392 cups_lang_t *cupsLangGet (
<br>
2393 const char *language
<br>
2395 <h4 class=
"parameters">Parameters
</h4>
2398 <dd class=
"description">Language or locale
</dd>
2400 <h4 class=
"returnvalue">Return Value
</h4>
2401 <p class=
"description">Language data
</p>
2402 <h3 class=
"function"><span class=
"info"> CUPS
2.0/OS X
10.10 </span><a name=
"cupsLocalizeDestMedia">cupsLocalizeDestMedia
</a></h3>
2403 <p class=
"description">Get the localized string for a destination media
2406 const char *cupsLocalizeDestMedia (
<br>
2407 http_t *http,
<br>
2408 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2409 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2410 unsigned flags,
<br>
2411 <a href=
"#cups_size_t">cups_size_t
</a> *size
<br>
2413 <h4 class=
"parameters">Parameters
</h4>
2416 <dd class=
"description">Connection to destination
</dd>
2418 <dd class=
"description">Destination
</dd>
2420 <dd class=
"description">Destination information
</dd>
2422 <dd class=
"description">Media flags
</dd>
2424 <dd class=
"description">Media size
</dd>
2426 <h4 class=
"returnvalue">Return Value
</h4>
2427 <p class=
"description">Localized string
</p>
2428 <h4 class=
"discussion">Discussion
</h4>
2429 <p class=
"discussion">The returned string is stored in the destination information and will become
2430 invalid if the destination information is deleted.
2433 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsLocalizeDestOption">cupsLocalizeDestOption
</a></h3>
2434 <p class=
"description">Get the localized string for a destination
2437 const char *cupsLocalizeDestOption (
<br>
2438 http_t *http,
<br>
2439 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2440 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2441 const char *option
<br>
2443 <h4 class=
"parameters">Parameters
</h4>
2446 <dd class=
"description">Connection to destination
</dd>
2448 <dd class=
"description">Destination
</dd>
2450 <dd class=
"description">Destination information
</dd>
2452 <dd class=
"description">Option to localize
</dd>
2454 <h4 class=
"returnvalue">Return Value
</h4>
2455 <p class=
"description">Localized string
</p>
2456 <h4 class=
"discussion">Discussion
</h4>
2457 <p class=
"discussion">The returned string is stored in the destination information and will become
2458 invalid if the destination information is deleted.
2461 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsLocalizeDestValue">cupsLocalizeDestValue
</a></h3>
2462 <p class=
"description">Get the localized string for a destination
2463 option+value pair.
</p>
2465 const char *cupsLocalizeDestValue (
<br>
2466 http_t *http,
<br>
2467 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2468 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *dinfo,
<br>
2469 const char *option,
<br>
2470 const char *value
<br>
2472 <h4 class=
"parameters">Parameters
</h4>
2475 <dd class=
"description">Connection to destination
</dd>
2477 <dd class=
"description">Destination
</dd>
2479 <dd class=
"description">Destination information
</dd>
2481 <dd class=
"description">Option to localize
</dd>
2483 <dd class=
"description">Value to localize
</dd>
2485 <h4 class=
"returnvalue">Return Value
</h4>
2486 <p class=
"description">Localized string
</p>
2487 <h4 class=
"discussion">Discussion
</h4>
2488 <p class=
"discussion">The returned string is stored in the destination information and will become
2489 invalid if the destination information is deleted.
2492 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsNotifySubject">cupsNotifySubject
</a></h3>
2493 <p class=
"description">Return the subject for the given notification message.
</p>
2495 char *cupsNotifySubject (
<br>
2496 cups_lang_t *lang,
<br>
2497 ipp_t *event
<br>
2499 <h4 class=
"parameters">Parameters
</h4>
2502 <dd class=
"description">Language data
</dd>
2504 <dd class=
"description">Event data
</dd>
2506 <h4 class=
"returnvalue">Return Value
</h4>
2507 <p class=
"description">Subject string or
<code>NULL
</code></p>
2508 <h4 class=
"discussion">Discussion
</h4>
2509 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
2512 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsNotifyText">cupsNotifyText
</a></h3>
2513 <p class=
"description">Return the text for the given notification message.
</p>
2515 char *cupsNotifyText (
<br>
2516 cups_lang_t *lang,
<br>
2517 ipp_t *event
<br>
2519 <h4 class=
"parameters">Parameters
</h4>
2522 <dd class=
"description">Language data
</dd>
2524 <dd class=
"description">Event data
</dd>
2526 <h4 class=
"returnvalue">Return Value
</h4>
2527 <p class=
"description">Message text or
<code>NULL
</code></p>
2528 <h4 class=
"discussion">Discussion
</h4>
2529 <p class=
"discussion">The returned string must be freed by the caller using
<code>free
</code>.
2532 <h3 class=
"function"><a name=
"cupsParseOptions">cupsParseOptions
</a></h3>
2533 <p class=
"description">Parse options from a command-line argument.
</p>
2535 int cupsParseOptions (
<br>
2536 const char *arg,
<br>
2537 int num_options,
<br>
2538 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
2540 <h4 class=
"parameters">Parameters
</h4>
2543 <dd class=
"description">Argument to parse
</dd>
2544 <dt>num_options
</dt>
2545 <dd class=
"description">Number of options
</dd>
2547 <dd class=
"description">Options found
</dd>
2549 <h4 class=
"returnvalue">Return Value
</h4>
2550 <p class=
"description">Number of options found
</p>
2551 <h4 class=
"discussion">Discussion
</h4>
2552 <p class=
"discussion">This function converts space-delimited name/value pairs according
2553 to the PAPI text option ABNF specification. Collection values
2554 (
"name={a=... b=... c=...}
") are stored with the curley brackets
2555 intact - use
<code>cupsParseOptions
</code> on the value to extract the
2556 collection attributes.
</p>
2557 <h3 class=
"function"><a name=
"cupsPrintFile">cupsPrintFile
</a></h3>
2558 <p class=
"description">Print a file to a printer or class on the default server.
</p>
2560 int cupsPrintFile (
<br>
2561 const char *name,
<br>
2562 const char *filename,
<br>
2563 const char *title,
<br>
2564 int num_options,
<br>
2565 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2567 <h4 class=
"parameters">Parameters
</h4>
2570 <dd class=
"description">Destination name
</dd>
2572 <dd class=
"description">File to print
</dd>
2574 <dd class=
"description">Title of job
</dd>
2575 <dt>num_options
</dt>
2576 <dd class=
"description">Number of options
</dd>
2578 <dd class=
"description">Options
</dd>
2580 <h4 class=
"returnvalue">Return Value
</h4>
2581 <p class=
"description">Job ID or
0 on error
</p>
2582 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsPrintFile2">cupsPrintFile2
</a></h3>
2583 <p class=
"description">Print a file to a printer or class on the specified
2586 int cupsPrintFile2 (
<br>
2587 http_t *http,
<br>
2588 const char *name,
<br>
2589 const char *filename,
<br>
2590 const char *title,
<br>
2591 int num_options,
<br>
2592 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2594 <h4 class=
"parameters">Parameters
</h4>
2597 <dd class=
"description">Connection to server
</dd>
2599 <dd class=
"description">Destination name
</dd>
2601 <dd class=
"description">File to print
</dd>
2603 <dd class=
"description">Title of job
</dd>
2604 <dt>num_options
</dt>
2605 <dd class=
"description">Number of options
</dd>
2607 <dd class=
"description">Options
</dd>
2609 <h4 class=
"returnvalue">Return Value
</h4>
2610 <p class=
"description">Job ID or
0 on error
</p>
2611 <h3 class=
"function"><a name=
"cupsPrintFiles">cupsPrintFiles
</a></h3>
2612 <p class=
"description">Print one or more files to a printer or class on the
2615 int cupsPrintFiles (
<br>
2616 const char *name,
<br>
2617 int num_files,
<br>
2618 const char **files,
<br>
2619 const char *title,
<br>
2620 int num_options,
<br>
2621 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2623 <h4 class=
"parameters">Parameters
</h4>
2626 <dd class=
"description">Destination name
</dd>
2628 <dd class=
"description">Number of files
</dd>
2630 <dd class=
"description">File(s) to print
</dd>
2632 <dd class=
"description">Title of job
</dd>
2633 <dt>num_options
</dt>
2634 <dd class=
"description">Number of options
</dd>
2636 <dd class=
"description">Options
</dd>
2638 <h4 class=
"returnvalue">Return Value
</h4>
2639 <p class=
"description">Job ID or
0 on error
</p>
2640 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsPrintFiles2">cupsPrintFiles2
</a></h3>
2641 <p class=
"description">Print one or more files to a printer or class on the
2642 specified server.
</p>
2644 int cupsPrintFiles2 (
<br>
2645 http_t *http,
<br>
2646 const char *name,
<br>
2647 int num_files,
<br>
2648 const char **files,
<br>
2649 const char *title,
<br>
2650 int num_options,
<br>
2651 <a href=
"#cups_option_t">cups_option_t
</a> *options
<br>
2653 <h4 class=
"parameters">Parameters
</h4>
2656 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2658 <dd class=
"description">Destination name
</dd>
2660 <dd class=
"description">Number of files
</dd>
2662 <dd class=
"description">File(s) to print
</dd>
2664 <dd class=
"description">Title of job
</dd>
2665 <dt>num_options
</dt>
2666 <dd class=
"description">Number of options
</dd>
2668 <dd class=
"description">Options
</dd>
2670 <h4 class=
"returnvalue">Return Value
</h4>
2671 <p class=
"description">Job ID or
0 on error
</p>
2672 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsRemoveDest">cupsRemoveDest
</a></h3>
2673 <p class=
"description">Remove a destination from the destination list.
</p>
2675 int cupsRemoveDest (
<br>
2676 const char *name,
<br>
2677 const char *instance,
<br>
2678 int num_dests,
<br>
2679 <a href=
"#cups_dest_t">cups_dest_t
</a> **dests
<br>
2681 <h4 class=
"parameters">Parameters
</h4>
2684 <dd class=
"description">Destination name
</dd>
2686 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2688 <dd class=
"description">Number of destinations
</dd>
2690 <dd class=
"description">Destinations
</dd>
2692 <h4 class=
"returnvalue">Return Value
</h4>
2693 <p class=
"description">New number of destinations
</p>
2694 <h4 class=
"discussion">Discussion
</h4>
2695 <p class=
"discussion">Removing a destination/instance does not delete the class or printer
2696 queue, merely the lpoptions for that destination/instance. Use the
2697 <a href=
"#cupsSetDests"><code>cupsSetDests
</code></a> or
<a href=
"#cupsSetDests2"><code>cupsSetDests2
</code></a> functions to save the new
2698 options for the user.
2701 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsRemoveOption">cupsRemoveOption
</a></h3>
2702 <p class=
"description">Remove an option from an option array.
</p>
2704 int cupsRemoveOption (
<br>
2705 const char *name,
<br>
2706 int num_options,
<br>
2707 <a href=
"#cups_option_t">cups_option_t
</a> **options
<br>
2709 <h4 class=
"parameters">Parameters
</h4>
2712 <dd class=
"description">Option name
</dd>
2713 <dt>num_options
</dt>
2714 <dd class=
"description">Current number of options
</dd>
2716 <dd class=
"description">Options
</dd>
2718 <h4 class=
"returnvalue">Return Value
</h4>
2719 <p class=
"description">New number of options
</p>
2720 <h3 class=
"function"><a name=
"cupsServer">cupsServer
</a></h3>
2721 <p class=
"description">Return the hostname/address of the current server.
</p>
2723 const char *cupsServer (void);
</p>
2724 <h4 class=
"returnvalue">Return Value
</h4>
2725 <p class=
"description">Server name
</p>
2726 <h4 class=
"discussion">Discussion
</h4>
2727 <p class=
"discussion">The default server comes from the CUPS_SERVER environment variable, then the
2728 ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
2729 set, the default is the local system - either
"localhost
" or a domain socket
2732 The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
2733 address, or a domain socket pathname.
<br>
2735 Note: The current server is tracked separately for each thread in a program.
2736 Multi-threaded programs that override the server via the
2737 <a href=
"#cupsSetServer"><code>cupsSetServer
</code></a> function need to do so in each thread for the same
2738 server to be used.
</p>
2739 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetClientCertCB">cupsSetClientCertCB
</a></h3>
2740 <p class=
"description">Set the client certificate callback.
</p>
2742 void cupsSetClientCertCB (
<br>
2743 <a href=
"#cups_client_cert_cb_t">cups_client_cert_cb_t
</a> cb,
<br>
2744 void *user_data
<br>
2746 <h4 class=
"parameters">Parameters
</h4>
2749 <dd class=
"description">Callback function
</dd>
2751 <dd class=
"description">User data pointer
</dd>
2753 <h4 class=
"discussion">Discussion
</h4>
2754 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2756 Note: The current certificate callback is tracked separately for each thread
2757 in a program. Multi-threaded programs that override the callback need to do
2758 so in each thread for the same callback to be used.
2761 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetCredentials">cupsSetCredentials
</a></h3>
2762 <p class=
"description">Set the default credentials to be used for SSL/TLS
2765 int cupsSetCredentials (
<br>
2766 cups_array_t *credentials
<br>
2768 <h4 class=
"parameters">Parameters
</h4>
2770 <dt>credentials
</dt>
2771 <dd class=
"description">Array of credentials
</dd>
2773 <h4 class=
"returnvalue">Return Value
</h4>
2774 <p class=
"description">Status of call (
0 = success)
</p>
2775 <h4 class=
"discussion">Discussion
</h4>
2776 <p class=
"discussion">Note: The default credentials are tracked separately for each thread in a
2777 program. Multi-threaded programs that override the setting need to do so in
2778 each thread for the same setting to be used.
2781 <h3 class=
"function"><span class=
"info"> CUPS
1.3/OS X
10.5 </span><a name=
"cupsSetDefaultDest">cupsSetDefaultDest
</a></h3>
2782 <p class=
"description">Set the default destination.
</p>
2784 void cupsSetDefaultDest (
<br>
2785 const char *name,
<br>
2786 const char *instance,
<br>
2787 int num_dests,
<br>
2788 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2790 <h4 class=
"parameters">Parameters
</h4>
2793 <dd class=
"description">Destination name
</dd>
2795 <dd class=
"description">Instance name or
<code>NULL
</code></dd>
2797 <dd class=
"description">Number of destinations
</dd>
2799 <dd class=
"description">Destinations
</dd>
2801 <h3 class=
"function"><a name=
"cupsSetDests">cupsSetDests
</a></h3>
2802 <p class=
"description">Save the list of destinations for the default server.
</p>
2804 void cupsSetDests (
<br>
2805 int num_dests,
<br>
2806 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2808 <h4 class=
"parameters">Parameters
</h4>
2811 <dd class=
"description">Number of destinations
</dd>
2813 <dd class=
"description">Destinations
</dd>
2815 <h4 class=
"discussion">Discussion
</h4>
2816 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2817 as root and ~/.cups/lpoptions when run as a normal user.
</p>
2818 <h3 class=
"function"><span class=
"info"> CUPS
1.1.21/OS X
10.4 </span><a name=
"cupsSetDests2">cupsSetDests2
</a></h3>
2819 <p class=
"description">Save the list of destinations for the specified server.
</p>
2821 int cupsSetDests2 (
<br>
2822 http_t *http,
<br>
2823 int num_dests,
<br>
2824 <a href=
"#cups_dest_t">cups_dest_t
</a> *dests
<br>
2826 <h4 class=
"parameters">Parameters
</h4>
2829 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
2831 <dd class=
"description">Number of destinations
</dd>
2833 <dd class=
"description">Destinations
</dd>
2835 <h4 class=
"returnvalue">Return Value
</h4>
2836 <p class=
"description">0 on success, -
1 on error
</p>
2837 <h4 class=
"discussion">Discussion
</h4>
2838 <p class=
"discussion">This function saves the destinations to /etc/cups/lpoptions when run
2839 as root and ~/.cups/lpoptions when run as a normal user.
2842 <h3 class=
"function"><a name=
"cupsSetEncryption">cupsSetEncryption
</a></h3>
2843 <p class=
"description">Set the encryption preference.
</p>
2845 void cupsSetEncryption (
<br>
2846 http_encryption_t e
<br>
2848 <h4 class=
"parameters">Parameters
</h4>
2851 <dd class=
"description">New encryption preference
</dd>
2853 <h4 class=
"discussion">Discussion
</h4>
2854 <p class=
"discussion">The default encryption setting comes from the CUPS_ENCRYPTION
2855 environment variable, then the ~/.cups/client.conf file, and finally the
2856 /etc/cups/client.conf file. If not set, the default is
2857 <code>HTTP_ENCRYPTION_IF_REQUESTED
</code>.
<br>
2859 Note: The current encryption setting is tracked separately for each thread
2860 in a program. Multi-threaded programs that override the setting need to do
2861 so in each thread for the same setting to be used.
</p>
2862 <h3 class=
"function"><a name=
"cupsSetPasswordCB">cupsSetPasswordCB
</a></h3>
2863 <p class=
"description">Set the password callback for CUPS.
</p>
2865 void cupsSetPasswordCB (
<br>
2866 <a href=
"#cups_password_cb_t">cups_password_cb_t
</a> cb
<br>
2868 <h4 class=
"parameters">Parameters
</h4>
2871 <dd class=
"description">Callback function
</dd>
2873 <h4 class=
"discussion">Discussion
</h4>
2874 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2875 reads the password from the console. Programs should call either this
2876 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2877 by a program per thread.
<br>
2879 Note: The current password callback is tracked separately for each thread
2880 in a program. Multi-threaded programs that override the callback need to do
2881 so in each thread for the same callback to be used.
</p>
2882 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsSetPasswordCB2">cupsSetPasswordCB2
</a></h3>
2883 <p class=
"description">Set the advanced password callback for CUPS.
</p>
2885 void cupsSetPasswordCB2 (
<br>
2886 <a href=
"#cups_password_cb2_t">cups_password_cb2_t
</a> cb,
<br>
2887 void *user_data
<br>
2889 <h4 class=
"parameters">Parameters
</h4>
2892 <dd class=
"description">Callback function
</dd>
2894 <dd class=
"description">User data pointer
</dd>
2896 <h4 class=
"discussion">Discussion
</h4>
2897 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default (console) password callback, which
2898 reads the password from the console. Programs should call either this
2899 function or
<a href=
"#cupsSetPasswordCB2"><code>cupsSetPasswordCB2
</code></a>, as only one callback can be registered
2900 by a program per thread.
<br>
2902 Note: The current password callback is tracked separately for each thread
2903 in a program. Multi-threaded programs that override the callback need to do
2904 so in each thread for the same callback to be used.
2907 <h3 class=
"function"><a name=
"cupsSetServer">cupsSetServer
</a></h3>
2908 <p class=
"description">Set the default server name and port.
</p>
2910 void cupsSetServer (
<br>
2911 const char *server
<br>
2913 <h4 class=
"parameters">Parameters
</h4>
2916 <dd class=
"description">Server name
</dd>
2918 <h4 class=
"discussion">Discussion
</h4>
2919 <p class=
"discussion">The
"server
" string can be a fully-qualified hostname, a numeric
2920 IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
2921 addresses can be optionally followed by a colon and port number to override
2922 the default port
631, e.g.
"hostname:
8631". Pass
<code>NULL
</code> to restore the
2923 default server name and port.
<br>
2925 Note: The current server is tracked separately for each thread in a program.
2926 Multi-threaded programs that override the server need to do so in each
2927 thread for the same server to be used.
</p>
2928 <h3 class=
"function"><span class=
"info"> CUPS
1.5/OS X
10.7 </span><a name=
"cupsSetServerCertCB">cupsSetServerCertCB
</a></h3>
2929 <p class=
"description">Set the server certificate callback.
</p>
2931 void cupsSetServerCertCB (
<br>
2932 <a href=
"#cups_server_cert_cb_t">cups_server_cert_cb_t
</a> cb,
<br>
2933 void *user_data
<br>
2935 <h4 class=
"parameters">Parameters
</h4>
2938 <dd class=
"description">Callback function
</dd>
2940 <dd class=
"description">User data pointer
</dd>
2942 <h4 class=
"discussion">Discussion
</h4>
2943 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default callback.
<br>
2945 Note: The current credentials callback is tracked separately for each thread
2946 in a program. Multi-threaded programs that override the callback need to do
2947 so in each thread for the same callback to be used.
2950 <h3 class=
"function"><a name=
"cupsSetUser">cupsSetUser
</a></h3>
2951 <p class=
"description">Set the default user name.
</p>
2953 void cupsSetUser (
<br>
2954 const char *user
<br>
2956 <h4 class=
"parameters">Parameters
</h4>
2959 <dd class=
"description">User name
</dd>
2961 <h4 class=
"discussion">Discussion
</h4>
2962 <p class=
"discussion">Pass
<code>NULL
</code> to restore the default user name.
<br>
2964 Note: The current user name is tracked separately for each thread in a
2965 program. Multi-threaded programs that override the user name need to do so
2966 in each thread for the same user name to be used.
</p>
2967 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsSetUserAgent">cupsSetUserAgent
</a></h3>
2968 <p class=
"description">Set the default HTTP User-Agent string.
</p>
2970 void cupsSetUserAgent (
<br>
2971 const char *user_agent
<br>
2973 <h4 class=
"parameters">Parameters
</h4>
2976 <dd class=
"description">User-Agent string or
<code>NULL
</code></dd>
2978 <h4 class=
"discussion">Discussion
</h4>
2979 <p class=
"discussion">Setting the string to NULL forces the default value containing the CUPS
2980 version, IPP version, and operating system version and architecture.
2983 <h3 class=
"function"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cupsStartDestDocument">cupsStartDestDocument
</a></h3>
2984 <p class=
"description">Start a new document.
</p>
2986 http_status_t cupsStartDestDocument (
<br>
2987 http_t *http,
<br>
2988 <a href=
"#cups_dest_t">cups_dest_t
</a> *dest,
<br>
2989 <a href=
"#cups_dinfo_t">cups_dinfo_t
</a> *info,
<br>
2990 int job_id,
<br>
2991 const char *docname,
<br>
2992 const char *format,
<br>
2993 int num_options,
<br>
2994 <a href=
"#cups_option_t">cups_option_t
</a> *options,
<br>
2995 int last_document
<br>
2997 <h4 class=
"parameters">Parameters
</h4>
3000 <dd class=
"description">Connection to destination
</dd>
3002 <dd class=
"description">Destination
</dd>
3004 <dd class=
"description">Destination information
</dd>
3006 <dd class=
"description">Job ID
</dd>
3008 <dd class=
"description">Document name
</dd>
3010 <dd class=
"description">Document format
</dd>
3011 <dt>num_options
</dt>
3012 <dd class=
"description">Number of document options
</dd>
3014 <dd class=
"description">Document options
</dd>
3015 <dt>last_document
</dt>
3016 <dd class=
"description">1 if this is the last document
</dd>
3018 <h4 class=
"returnvalue">Return Value
</h4>
3019 <p class=
"description">Status of document creation
</p>
3020 <h4 class=
"discussion">Discussion
</h4>
3021 <p class=
"discussion">"job_id
" is the job ID returned by cupsCreateDestJob.
"docname
" is the name
3022 of the document/file being printed,
"format
" is the MIME media type for the
3023 document (see CUPS_FORMAT_xxx constants), and
"num_options
" and
"options
"
3024 are the options do be applied to the document.
"last_document
" should be
1
3025 if this is the last document to be submitted in the job. Returns
3026 <code>HTTP_CONTINUE
</code> on success.
3029 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsStartDocument">cupsStartDocument
</a></h3>
3030 <p class=
"description">Add a document to a job created with cupsCreateJob().
</p>
3032 http_status_t cupsStartDocument (
<br>
3033 http_t *http,
<br>
3034 const char *name,
<br>
3035 int job_id,
<br>
3036 const char *docname,
<br>
3037 const char *format,
<br>
3038 int last_document
<br>
3040 <h4 class=
"parameters">Parameters
</h4>
3043 <dd class=
"description">Connection to server or
<code>CUPS_HTTP_DEFAULT
</code></dd>
3045 <dd class=
"description">Destination name
</dd>
3047 <dd class=
"description">Job ID from
<a href=
"#cupsCreateJob"><code>cupsCreateJob
</code></a></dd>
3049 <dd class=
"description">Name of document
</dd>
3051 <dd class=
"description">MIME type or
<code>CUPS_FORMAT_foo
</code></dd>
3052 <dt>last_document
</dt>
3053 <dd class=
"description">1 for last document in job,
0 otherwise
</dd>
3055 <h4 class=
"returnvalue">Return Value
</h4>
3056 <p class=
"description">HTTP status of request
</p>
3057 <h4 class=
"discussion">Discussion
</h4>
3058 <p class=
"discussion">Use
<a href=
"#cupsWriteRequestData"><code>cupsWriteRequestData
</code></a> to write data for the document and
3059 <a href=
"#cupsFinishDocument"><code>cupsFinishDocument
</code></a> to finish the document and get the submission status.
<br>
3061 The MIME type constants
<code>CUPS_FORMAT_AUTO
</code>,
<code>CUPS_FORMAT_PDF
</code>,
3062 <code>CUPS_FORMAT_POSTSCRIPT
</code>,
<code>CUPS_FORMAT_RAW
</code>, and
3063 <code>CUPS_FORMAT_TEXT
</code> are provided for the
"format
" argument, although
3064 any supported MIME type string can be supplied.
3067 <h3 class=
"function"><a name=
"cupsTempFd">cupsTempFd
</a></h3>
3068 <p class=
"description">Creates a temporary file.
</p>
3070 int cupsTempFd (
<br>
3071 char *filename,
<br>
3072 int len
<br>
3074 <h4 class=
"parameters">Parameters
</h4>
3077 <dd class=
"description">Pointer to buffer
</dd>
3079 <dd class=
"description">Size of buffer
</dd>
3081 <h4 class=
"returnvalue">Return Value
</h4>
3082 <p class=
"description">New file descriptor or -
1 on error
</p>
3083 <h4 class=
"discussion">Discussion
</h4>
3084 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3085 The temporary file is opened for reading and writing.
</p>
3086 <h3 class=
"function"><span class=
"info"> DEPRECATED
</span><a name=
"cupsTempFile">cupsTempFile
</a></h3>
3087 <p class=
"description">Generates a temporary filename.
</p>
3089 char *cupsTempFile (
<br>
3090 char *filename,
<br>
3091 int len
<br>
3093 <h4 class=
"parameters">Parameters
</h4>
3096 <dd class=
"description">Pointer to buffer
</dd>
3098 <dd class=
"description">Size of buffer
</dd>
3100 <h4 class=
"returnvalue">Return Value
</h4>
3101 <p class=
"description">Filename or
<code>NULL
</code> on error
</p>
3102 <h4 class=
"discussion">Discussion
</h4>
3103 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3104 This function is deprecated and will no longer generate a temporary
3105 filename - use
<a href=
"#cupsTempFd"><code>cupsTempFd
</code></a> or
<a href=
"#cupsTempFile2"><code>cupsTempFile2
</code></a> instead.
3108 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsTempFile2">cupsTempFile2
</a></h3>
3109 <p class=
"description">Creates a temporary CUPS file.
</p>
3111 cups_file_t *cupsTempFile2 (
<br>
3112 char *filename,
<br>
3113 int len
<br>
3115 <h4 class=
"parameters">Parameters
</h4>
3118 <dd class=
"description">Pointer to buffer
</dd>
3120 <dd class=
"description">Size of buffer
</dd>
3122 <h4 class=
"returnvalue">Return Value
</h4>
3123 <p class=
"description">CUPS file or
<code>NULL
</code> on error
</p>
3124 <h4 class=
"discussion">Discussion
</h4>
3125 <p class=
"discussion">The temporary filename is returned in the filename buffer.
3126 The temporary file is opened for writing.
3129 <h3 class=
"function"><a name=
"cupsUser">cupsUser
</a></h3>
3130 <p class=
"description">Return the current user's name.
</p>
3132 const char *cupsUser (void);
</p>
3133 <h4 class=
"returnvalue">Return Value
</h4>
3134 <p class=
"description">User name
</p>
3135 <h4 class=
"discussion">Discussion
</h4>
3136 <p class=
"discussion">Note: The current user name is tracked separately for each thread in a
3137 program. Multi-threaded programs that override the user name with the
3138 <a href=
"#cupsSetUser"><code>cupsSetUser
</code></a> function need to do so in each thread for the same user
3139 name to be used.
</p>
3140 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"cupsUserAgent">cupsUserAgent
</a></h3>
3141 <p class=
"description">Return the default HTTP User-Agent string.
</p>
3143 const char *cupsUserAgent (void);
</p>
3144 <h4 class=
"returnvalue">Return Value
</h4>
3145 <p class=
"description">User-Agent string
</p>
3146 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgFormatSizeName">pwgFormatSizeName
</a></h3>
3147 <p class=
"description">Generate a PWG self-describing media size name.
</p>
3149 int pwgFormatSizeName (
<br>
3150 char *keyword,
<br>
3151 size_t keysize,
<br>
3152 const char *prefix,
<br>
3153 const char *name,
<br>
3154 int width,
<br>
3155 int length,
<br>
3156 const char *units
<br>
3158 <h4 class=
"parameters">Parameters
</h4>
3161 <dd class=
"description">Keyword buffer
</dd>
3163 <dd class=
"description">Size of keyword buffer
</dd>
3165 <dd class=
"description">Prefix for PWG size or
<code>NULL
</code> for automatic
</dd>
3167 <dd class=
"description">Size name or
<code>NULL
</code></dd>
3169 <dd class=
"description">Width of page in
2540ths
</dd>
3171 <dd class=
"description">Length of page in
2540ths
</dd>
3173 <dd class=
"description">Units -
"in
",
"mm
", or
<code>NULL
</code> for automatic
</dd>
3175 <h4 class=
"returnvalue">Return Value
</h4>
3176 <p class=
"description">1 on success,
0 on failure
</p>
3177 <h4 class=
"discussion">Discussion
</h4>
3178 <p class=
"discussion">This function generates a PWG self-describing media size name of the form
3179 "prefix_name_WIDTHxLENGTHunits
". The prefix is typically
"custom
" or
"roll
"
3180 for user-supplied sizes but can also be
"disc
",
"iso
",
"jis
",
"jpn
",
"na
",
3181 "oe
",
"om
",
"prc
", or
"roc
". A value of
<code>NULL
</code> automatically chooses
3182 "oe
" or
"om
" depending on the units.
<br>
3184 The size name may only contain lowercase letters, numbers,
"-
", and
".
". If
3185 <code>NULL
</code> is passed, the size name will contain the formatted dimensions.
<br>
3187 The width and length are specified in hundredths of millimeters, equivalent
3188 to
1/
100000th of a meter or
1/
2540th of an inch. The width, length, and
3189 units used for the generated size name are calculated automatically if the
3190 units string is
<code>NULL
</code>, otherwise inches (
"in
") or millimeters (
"mm
")
3194 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgInitSize">pwgInitSize
</a></h3>
3195 <p class=
"description">Initialize a pwg_size_t structure using IPP Job Template
3198 int pwgInitSize (
<br>
3199 <a href=
"#pwg_size_t">pwg_size_t
</a> *size,
<br>
3200 ipp_t *job,
<br>
3201 int *margins_set
<br>
3203 <h4 class=
"parameters">Parameters
</h4>
3206 <dd class=
"description">Size to initialize
</dd>
3208 <dd class=
"description">Job template attributes
</dd>
3209 <dt>margins_set
</dt>
3210 <dd class=
"description">1 if margins were set,
0 otherwise
</dd>
3212 <h4 class=
"returnvalue">Return Value
</h4>
3213 <p class=
"description">1 if size was initialized,
0 otherwise
</p>
3214 <h4 class=
"discussion">Discussion
</h4>
3215 <p class=
"discussion">This function initializes a pwg_size_t structure from an IPP
"media
" or
3216 "media-col
" attribute in the specified IPP message.
0 is returned if neither
3217 attribute is found in the message or the values are not valid.
<br>
3219 The
"margins_set
" variable is initialized to
1 if any
"media-xxx-margin
"
3220 member attribute was specified in the
"media-col
" Job Template attribute,
3221 otherwise it is initialized to
0.
3224 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForLegacy">pwgMediaForLegacy
</a></h3>
3225 <p class=
"description">Find a PWG media size by ISO/IPP legacy name.
</p>
3227 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForLegacy (
<br>
3228 const char *legacy
<br>
3230 <h4 class=
"parameters">Parameters
</h4>
3233 <dd class=
"description">Legacy size name
</dd>
3235 <h4 class=
"returnvalue">Return Value
</h4>
3236 <p class=
"description">Matching size or NULL
</p>
3237 <h4 class=
"discussion">Discussion
</h4>
3238 <p class=
"discussion">The
"name
" argument specifies the legacy ISO media size name, for example
3239 "iso-a4
" or
"na-letter
".
3242 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForPPD">pwgMediaForPPD
</a></h3>
3243 <p class=
"description">Find a PWG media size by Adobe PPD name.
</p>
3245 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForPPD (
<br>
3246 const char *ppd
<br>
3248 <h4 class=
"parameters">Parameters
</h4>
3251 <dd class=
"description">PPD size name
</dd>
3253 <h4 class=
"returnvalue">Return Value
</h4>
3254 <p class=
"description">Matching size or NULL
</p>
3255 <h4 class=
"discussion">Discussion
</h4>
3256 <p class=
"discussion">The
"ppd
" argument specifies an Adobe page size name as defined in Table B
.1
3257 of the Adobe PostScript Printer Description File Format Specification Version
3260 If the name is non-standard, the returned PWG media size is stored in
3261 thread-local storage and is overwritten by each call to the function in the
3262 thread. Custom names can be of the form
"Custom.WIDTHxLENGTH[units]
" or
3263 "WIDTHxLENGTH[units]
".
3266 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForPWG">pwgMediaForPWG
</a></h3>
3267 <p class=
"description">Find a PWG media size by
5101.1 self-describing name.
</p>
3269 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForPWG (
<br>
3270 const char *pwg
<br>
3272 <h4 class=
"parameters">Parameters
</h4>
3275 <dd class=
"description">PWG size name
</dd>
3277 <h4 class=
"returnvalue">Return Value
</h4>
3278 <p class=
"description">Matching size or NULL
</p>
3279 <h4 class=
"discussion">Discussion
</h4>
3280 <p class=
"discussion">The
"pwg
" argument specifies a self-describing media size name of the form
3281 "prefix_name_WIDTHxLENGTHunits
" as defined in PWG
5101.1.
<br>
3283 If the name is non-standard, the returned PWG media size is stored in
3284 thread-local storage and is overwritten by each call to the function in the
3288 <h3 class=
"function"><span class=
"info"> CUPS
1.7/OS X
10.9 </span><a name=
"pwgMediaForSize">pwgMediaForSize
</a></h3>
3289 <p class=
"description">Get the PWG media size for the given dimensions.
</p>
3291 <a href=
"#pwg_media_t">pwg_media_t
</a> *pwgMediaForSize (
<br>
3292 int width,
<br>
3293 int length
<br>
3295 <h4 class=
"parameters">Parameters
</h4>
3298 <dd class=
"description">Width in hundredths of millimeters
</dd>
3300 <dd class=
"description">Length in hundredths of millimeters
</dd>
3302 <h4 class=
"returnvalue">Return Value
</h4>
3303 <p class=
"description">PWG media name
</p>
3304 <h4 class=
"discussion">Discussion
</h4>
3305 <p class=
"discussion">The
"width
" and
"length
" are in hundredths of millimeters, equivalent to
3306 1/
100000th of a meter or
1/
2540th of an inch.
<br>
3308 If the dimensions are non-standard, the returned PWG media size is stored in
3309 thread-local storage and is overwritten by each call to the function in the
3313 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
3314 <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>
3315 <p class=
"description">Client credentials callback
3318 typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
3320 <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>
3321 <p class=
"description">Destination enumeration block
3324 typedef int (*cups_dest_block_t(unsigned flags,
<a href=
"#cups_dest_t">cups_dest_t
</a> *dest);
3326 <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>
3327 <p class=
"description">Destination enumeration callback
3330 typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
<a href=
"#cups_dest_t">cups_dest_t
</a> *dest);
3332 <h3 class=
"typedef"><a name=
"cups_dest_t">cups_dest_t
</a></h3>
3333 <p class=
"description">Destination
</p>
3335 typedef struct
<a href=
"#cups_dest_s">cups_dest_s
</a> cups_dest_t;
3337 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_dinfo_t">cups_dinfo_t
</a></h3>
3338 <p class=
"description">Destination capability and status
3341 typedef struct _cups_dinfo_s cups_dinfo_t;
3343 <h3 class=
"typedef"><a name=
"cups_job_t">cups_job_t
</a></h3>
3344 <p class=
"description">Job
</p>
3346 typedef struct
<a href=
"#cups_job_s">cups_job_s
</a> cups_job_t;
3348 <h3 class=
"typedef"><a name=
"cups_option_t">cups_option_t
</a></h3>
3349 <p class=
"description">Printer Options
</p>
3351 typedef struct
<a href=
"#cups_option_s">cups_option_s
</a> cups_option_t;
3353 <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>
3354 <p class=
"description">New password callback
3357 typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
3359 <h3 class=
"typedef"><a name=
"cups_password_cb_t">cups_password_cb_t
</a></h3>
3360 <p class=
"description">Password callback
</p>
3362 typedef const char *(*cups_password_cb_t)(const char *prompt);
3364 <h3 class=
"typedef"><a name=
"cups_ptype_t">cups_ptype_t
</a></h3>
3365 <p class=
"description">Printer type/capability bits
</p>
3367 typedef unsigned cups_ptype_t;
3369 <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>
3370 <p class=
"description">Server credentials callback
3373 typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
3375 <h3 class=
"typedef"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_size_t">cups_size_t
</a></h3>
3376 <p class=
"description">Media Size
</p>
3378 typedef struct
<a href=
"#cups_size_s">cups_size_s
</a> cups_size_t;
3380 <h3 class=
"typedef"><a name=
"pwg_map_t">pwg_map_t
</a></h3>
3381 <p class=
"description">Map element - PPD to/from PWG
</p>
3383 typedef struct
<a href=
"#pwg_map_s">pwg_map_s
</a> pwg_map_t;
3385 <h3 class=
"typedef"><a name=
"pwg_media_t">pwg_media_t
</a></h3>
3386 <p class=
"description">Common media size data
</p>
3388 typedef struct
<a href=
"#pwg_media_s">pwg_media_s
</a> pwg_media_t;
3390 <h3 class=
"typedef"><a name=
"pwg_size_t">pwg_size_t
</a></h3>
3391 <p class=
"description">Size element - PPD to/from PWG
</p>
3393 typedef struct
<a href=
"#pwg_size_s">pwg_size_s
</a> pwg_size_t;
3395 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
3396 <h3 class=
"struct"><a name=
"cups_dest_s">cups_dest_s
</a></h3>
3397 <p class=
"description">Destination
</p>
3398 <p class=
"code">struct cups_dest_s {
<br>
3399 char *name, *instance;
<br>
3400 int is_default;
<br>
3401 int num_options;
<br>
3402 <a href=
"#cups_option_t">cups_option_t
</a> *options;
<br>
3404 <h4 class=
"members">Members
</h4>
3407 <dd class=
"description">Local instance name or NULL
</dd>
3408 <dt>is_default
</dt>
3409 <dd class=
"description">Is this printer the default?
</dd>
3410 <dt>num_options
</dt>
3411 <dd class=
"description">Number of options
</dd>
3413 <dd class=
"description">Options
</dd>
3415 <h3 class=
"struct"><a name=
"cups_job_s">cups_job_s
</a></h3>
3416 <p class=
"description">Job
</p>
3417 <p class=
"code">struct cups_job_s {
<br>
3418 time_t completed_time;
<br>
3419 time_t creation_time;
<br>
3420 char *dest;
<br>
3421 char *format;
<br>
3422 int id;
<br>
3423 int priority;
<br>
3424 time_t processing_time;
<br>
3425 int size;
<br>
3426 ipp_jstate_t state;
<br>
3427 char *title;
<br>
3428 char *user;
<br>
3430 <h4 class=
"members">Members
</h4>
3432 <dt>completed_time
</dt>
3433 <dd class=
"description">Time the job was completed
</dd>
3434 <dt>creation_time
</dt>
3435 <dd class=
"description">Time the job was created
</dd>
3437 <dd class=
"description">Printer or class name
</dd>
3439 <dd class=
"description">Document format
</dd>
3441 <dd class=
"description">The job ID
</dd>
3443 <dd class=
"description">Priority (
1-
100)
</dd>
3444 <dt>processing_time
</dt>
3445 <dd class=
"description">Time the job was processed
</dd>
3447 <dd class=
"description">Size in kilobytes
</dd>
3449 <dd class=
"description">Job state
</dd>
3451 <dd class=
"description">Title/job name
</dd>
3453 <dd class=
"description">User the submitted the job
</dd>
3455 <h3 class=
"struct"><a name=
"cups_option_s">cups_option_s
</a></h3>
3456 <p class=
"description">Printer Options
</p>
3457 <p class=
"code">struct cups_option_s {
<br>
3458 char *name;
<br>
3459 char *value;
<br>
3461 <h4 class=
"members">Members
</h4>
3464 <dd class=
"description">Name of option
</dd>
3466 <dd class=
"description">Value of option
</dd>
3468 <h3 class=
"struct"><span class=
"info"> CUPS
1.6/OS X
10.8 </span><a name=
"cups_size_s">cups_size_s
</a></h3>
3469 <p class=
"description">Media Size
</p>
3470 <p class=
"code">struct cups_size_s {
<br>
3471 char media[
128];
<br>
3472 int width, length, bottom, left, right, top;
<br>
3474 <h4 class=
"members">Members
</h4>
3476 <dt>media[
128]
</dt>
3477 <dd class=
"description">Media name to use
</dd>
3479 <dd class=
"description">Top margin in hundredths of
3482 <h3 class=
"struct"><a name=
"pollfd">pollfd
</a></h3>
3483 <p class=
"description">User data (unused)
</p>
3484 <p class=
"code">struct pollfd *pollfds, unsigned int num_pollfds, int timeout, void *context) {
<br>
3485 _cups_dnssd_data_t *data;
<br>
3486 else if(val
0) data - got_data;
<br>
3487 void) timeout;
<br>
3488 int val;
<br>
3490 <h4 class=
"members">Members
</h4>
3493 <dd class=
"description">Enumeration data
</dd>
3497 <dd class=
"description">Return value
</dd>
3499 <h3 class=
"struct"><a name=
"pwg_map_s">pwg_map_s
</a></h3>
3500 <p class=
"description">Map element - PPD to/from PWG
</p>
3501 <p class=
"code">struct pwg_map_s {
<br>
3502 char *pwg, *ppd;
<br>
3504 <h4 class=
"members">Members
</h4>
3507 <dd class=
"description">PPD option keyword
</dd>
3509 <h3 class=
"struct"><a name=
"pwg_media_s">pwg_media_s
</a></h3>
3510 <p class=
"description">Common media size data
</p>
3511 <p class=
"code">struct pwg_media_s {
<br>
3512 int width, length;
<br>
3513 const char *pwg, *legacy, *ppd;
<br>
3515 <h4 class=
"members">Members
</h4>
3518 <dd class=
"description">Length in
2540ths
</dd>
3520 <dd class=
"description">Standard Adobe PPD name
</dd>
3522 <h3 class=
"struct"><a name=
"pwg_size_s">pwg_size_s
</a></h3>
3523 <p class=
"description">Size element - PPD to/from PWG
</p>
3524 <p class=
"code">struct pwg_size_s {
<br>
3525 <a href=
"#pwg_map_t">pwg_map_t
</a> map;
<br>
3526 int width, length, left, bottom, right, top;
<br>
3528 <h4 class=
"members">Members
</h4>
3531 <dd class=
"description">Map element
</dd>
3533 <dd class=
"description">Top margin in
2540ths
</dd>
3535 <h2 class=
"title"><a name=
"VARIABLES">Variables
</a></h2>
3536 <h3 class=
"variable"><a name=
"CF_RETURNS_RETAINED">CF_RETURNS_RETAINED
</a></h3>
3537 <p class=
"description">Get the Apple language identifier associated with a
3539 <p class=
"code">const char *locale) CF_RETURNS_RETAINED;
</p>
3540 <h2 class=
"title"><a name=
"ENUMERATIONS">Constants
</a></h2>
3541 <h3 class=
"enumeration"><a name=
"cups_ptype_e">cups_ptype_e
</a></h3>
3542 <p class=
"description">Printer type/capability bit
3544 <h4 class=
"constants">Constants
</h4>
3546 <dt>CUPS_PRINTER_3D
<span class=
"info"> CUPS
2.1 </span></dt>
3547 <dd class=
"description">Printer with
3D capabilities
</dd>
3548 <dt>CUPS_PRINTER_AUTHENTICATED
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3549 <dd class=
"description">Printer requires authentication
3551 <dt>CUPS_PRINTER_BIND
</dt>
3552 <dd class=
"description">Can bind output
</dd>
3553 <dt>CUPS_PRINTER_BW
</dt>
3554 <dd class=
"description">Can do B
&W printing
</dd>
3555 <dt>CUPS_PRINTER_CLASS
</dt>
3556 <dd class=
"description">Printer class
</dd>
3557 <dt>CUPS_PRINTER_COLLATE
</dt>
3558 <dd class=
"description">Can collage copies
</dd>
3559 <dt>CUPS_PRINTER_COLOR
</dt>
3560 <dd class=
"description">Can do color printing
</dd>
3561 <dt>CUPS_PRINTER_COMMANDS
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3562 <dd class=
"description">Printer supports maintenance commands
3564 <dt>CUPS_PRINTER_COPIES
</dt>
3565 <dd class=
"description">Can do copies
</dd>
3566 <dt>CUPS_PRINTER_COVER
</dt>
3567 <dd class=
"description">Can cover output
</dd>
3568 <dt>CUPS_PRINTER_DEFAULT
</dt>
3569 <dd class=
"description">Default printer on network
</dd>
3570 <dt>CUPS_PRINTER_DELETE
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3571 <dd class=
"description">Delete printer
3573 <dt>CUPS_PRINTER_DUPLEX
</dt>
3574 <dd class=
"description">Can do duplexing
</dd>
3575 <dt>CUPS_PRINTER_FAX
</dt>
3576 <dd class=
"description">Fax queue
</dd>
3577 <dt>CUPS_PRINTER_LARGE
</dt>
3578 <dd class=
"description">Can do D/E/A1/A0
</dd>
3579 <dt>CUPS_PRINTER_LOCAL
</dt>
3580 <dd class=
"description">Local printer or class
</dd>
3581 <dt>CUPS_PRINTER_MEDIUM
</dt>
3582 <dd class=
"description">Can do Tabloid/B/C/A3/A2
</dd>
3583 <dt>CUPS_PRINTER_MFP
<span class=
"info"> CUPS
1.4/OS X
10.6 </span></dt>
3584 <dd class=
"description">Printer with scanning capabilities
3586 <dt>CUPS_PRINTER_NOT_SHARED
<span class=
"info"> CUPS
1.2/OS X
10.5 </span></dt>
3587 <dd class=
"description">Printer is not shared
3589 <dt>CUPS_PRINTER_PUNCH
</dt>
3590 <dd class=
"description">Can punch output
</dd>
3591 <dt>CUPS_PRINTER_REJECTING
</dt>
3592 <dd class=
"description">Printer is rejecting jobs
</dd>
3593 <dt>CUPS_PRINTER_REMOTE
</dt>
3594 <dd class=
"description">Remote printer or class
</dd>
3595 <dt>CUPS_PRINTER_SCANNER
<span class=
"info"> CUPS
1.4/OS X
10.6 </span></dt>
3596 <dd class=
"description">Scanner-only device
3598 <dt>CUPS_PRINTER_SMALL
</dt>
3599 <dd class=
"description">Can do Letter/Legal/A4
</dd>
3600 <dt>CUPS_PRINTER_SORT
</dt>
3601 <dd class=
"description">Can sort output
</dd>
3602 <dt>CUPS_PRINTER_STAPLE
</dt>
3603 <dd class=
"description">Can staple output
</dd>
3604 <dt>CUPS_PRINTER_VARIABLE
</dt>
3605 <dd class=
"description">Can do variable sizes
</dd>