]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/api-cups.html
Merge changes from CUPS 1.5svn-r9352.
[thirdparty/cups.git] / doc / help / api-cups.html
CommitLineData
745129be 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
ef416fc2 2<html>
3<!-- SECTION: Programming -->
4<head>
5a738aea
MS
5<title>CUPS API</title>
6<meta name="keywords" content="Programming">
8b450588 7<meta name="creator" content="Mini-XML v2.6">
5a738aea
MS
8<style type="text/css"><!--
9BODY {
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
11}
12
13H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
15}
16
17KBD {
18 font-family: monaco, courier, monospace;
19 font-weight: bold;
20}
21
22PRE {
23 font-family: monaco, courier, monospace;
24}
25
26PRE.command {
10d09e33 27 border: dotted thin #7f7f7f;
5a738aea 28 margin-left: 36pt;
10d09e33 29 padding: 10px;
5a738aea
MS
30}
31
f11a948a
MS
32P.compact {
33 margin: 0;
34}
35
e4572d57
MS
36P.example {
37 font-style: italic;
38 margin-left: 36pt;
39}
40
5a738aea
MS
41PRE.example {
42 background: #eeeeee;
43 border: dotted thin #999999;
44 margin-left: 36pt;
178cb736 45 padding: 10pt;
5a738aea
MS
46}
47
48PRE.command EM, PRE.example EM {
49 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
50}
51
52P.command {
53 font-family: monaco, courier, monospace;
54 margin-left: 36pt;
55}
56
57P.formula {
58 font-style: italic;
59 margin-left: 36pt;
60}
61
62BLOCKQUOTE {
178cb736 63 background: #eeeeee;
5a738aea
MS
64 border: solid thin #999999;
65 padding: 10pt;
66}
67
e4572d57
MS
68A IMG {
69 border: none;
70}
71
72A:link:hover IMG {
73 background: #f0f0f0;
74 border-radius: 10px;
75 -moz-border-radius: 10px;
76}
77
5a738aea 78A:link, A:visited {
568fa3fa 79 font-weight: normal;
5a738aea 80 text-decoration: none;
5a738aea
MS
81}
82
83A:link:hover, A:visited:hover, A:active {
84 text-decoration: underline;
5a738aea
MS
85}
86
87SUB, SUP {
88 font-size: 50%;
89}
90
e4572d57
MS
91TR.data, TD.data, TR.data TD {
92 margin-top: 10pt;
93 padding: 5pt;
94 border-bottom: solid 1pt #999999;
95}
96
97TR.data TH {
98 border-bottom: solid 1pt #999999;
99 padding-top: 10pt;
100 padding-left: 5pt;
101 text-align: left;
102}
103
5a738aea
MS
104DIV.table TABLE {
105 border: solid thin #999999;
106 border-collapse: collapse;
107 border-spacing: 0;
108 margin-left: auto;
109 margin-right: auto;
110}
111
112DIV.table CAPTION {
113 caption-side: top;
114 font-size: 120%;
115 font-style: italic;
116 font-weight: bold;
117 margin-left: auto;
118 margin-right: auto;
119}
120
121DIV.table TABLE TD {
122 border: solid thin #cccccc;
123 padding-top: 5pt;
124}
125
126DIV.table TABLE TH {
127 background: #cccccc;
128 border: none;
129 border-bottom: solid thin #999999;
130}
131
132DIV.figure TABLE {
133 margin-left: auto;
134 margin-right: auto;
135}
136
137DIV.figure CAPTION {
138 caption-side: bottom;
139 font-size: 120%;
140 font-style: italic;
141 font-weight: bold;
142 margin-left: auto;
143 margin-right: auto;
144}
145
146TH.label {
5a738aea
MS
147 text-align: right;
148 vertical-align: top;
149}
150
e4572d57
MS
151TH.sublabel {
152 text-align: right;
153 font-weight: normal;
154}
155
5a738aea
MS
156HR {
157 border: solid thin;
158}
159
160SPAN.info {
e4572d57
MS
161 background: black;
162 border: thin solid black;
163 color: white;
5a738aea
MS
164 font-size: 80%;
165 font-style: italic;
166 font-weight: bold;
167 white-space: nowrap;
168}
169
170H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
171 float: right;
172 font-size: 100%;
173}
174
178cb736
MS
175H1.title {
176}
177
5a738aea
MS
178H2.title, H3.title {
179 border-bottom: solid 2pt #000000;
180}
181
e4572d57
MS
182DIV.indent, TABLE.indent {
183 margin-top: 2em;
184 margin-left: auto;
185 margin-right: auto;
186 width: 90%;
187}
188
189TABLE.indent {
190 border-collapse: collapse;
191}
192
193TABLE.indent TD, TABLE.indent TH {
194 padding: 0;
195}
196
197TABLE.list {
198 border-collapse: collapse;
199 margin-left: auto;
200 margin-right: auto;
201 width: 90%;
202}
203
204TABLE.list TH {
205 background: white;
206 border-bottom: solid thin #cccccc;
207 color: #444444;
208 padding-top: 10pt;
209 padding-left: 5pt;
210 text-align: left;
211 vertical-align: bottom;
212 white-space: nowrap;
213}
214
215TABLE.list TH A {
216 color: #4444cc;
217}
218
219TABLE.list TD {
220 border-bottom: solid thin #eeeeee;
221 padding-top: 5pt;
222 padding-left: 5pt;
223}
224
225TABLE.list TR:nth-child(even) {
226 background: #f8f8f8;
227}
228
229TABLE.list TR:nth-child(odd) {
230 background: #f4f4f4;
231}
232
5a738aea
MS
233DT {
234 margin-left: 36pt;
235 margin-top: 12pt;
236}
237
238DD {
239 margin-left: 54pt;
240}
241
242DL.category DT {
243 font-weight: bold;
244}
245
246P.summary {
247 margin-left: 36pt;
248 font-family: monaco, courier, monospace;
249}
250
5a738aea
MS
251DIV.summary TABLE {
252 border: solid thin #999999;
253 border-collapse: collapse;
254 border-spacing: 0;
255 margin: 10px;
256}
257
258DIV.summary TABLE TD, DIV.summary TABLE TH {
259 border: solid thin #999999;
260 padding: 5px;
261 text-align: left;
262 vertical-align: top;
263}
264
265DIV.summary TABLE THEAD TH {
266 background: #eeeeee;
267}
268
269/* API documentation styles... */
270div.body h1 {
271 margin: 0;
272}
273div.body h2 {
274 margin-top: 1.5em;
275}
276div.body h3, div.body h4, div.body h5 {
277 margin-bottom: 0.5em;
278 margin-top: 1.5em;
279}
280.class, .enumeration, .function, .struct, .typedef, .union {
281 border-bottom: solid thin #999999;
282 margin-bottom: 0;
283 margin-top: 2em;
284}
285.description {
286 margin-top: 0.5em;
287}
288code, p.code, pre, ul.code li {
289 font-family: monaco, courier, monospace;
290 font-size: 90%;
291}
292ul.code, ul.contents, ul.subcontents {
293 list-style-type: none;
294 margin: 0;
295 padding-left: 0;
296}
297ul.code li {
298 margin: 0;
299}
300ul.contents > li {
301 margin-top: 1em;
302}
303ul.contents li ul.code, ul.contents li ul.subcontents {
304 padding-left: 2em;
305}
306div.body dl {
307 margin-left: 0;
308 margin-top: 0;
309}
310div.body dt {
311 font-style: italic;
312 margin-left: 0;
313 margin-top: 0;
314}
315div.body dd {
316 margin-bottom: 0.5em;
317}
318
319/* This is just for the HTML files generated with the framedhelp target */
320div.contents {
321 background: #e8e8e8;
322 border: solid thin black;
323 padding: 10px;
324}
325div.contents h1 {
326 font-size: 110%;
327}
328div.contents h2 {
329 font-size: 100%;
330}
331div.contents ul.contents {
332 font-size: 80%;
333}
ac884b6a
MS
334div.contents ul.subcontents li {
335 margin-left: 1em;
336 text-indent: -1em;
337}
5a738aea 338--></style>
ef416fc2 339</head>
340<body>
5a738aea
MS
341<div class='body'>
342<!--
68b10830 343 "$Id$"
5a738aea
MS
344
345 CUPS API header for the Common UNIX Printing System (CUPS).
346
178cb736 347 Copyright 2008-2009 by Apple Inc.
5a738aea
MS
348
349 These coded instructions, statements, and computer programs are the
350 property of Apple Inc. and are protected by Federal copyright
351 law. Distribution and use rights are outlined in the file "LICENSE.txt"
352 which should have been included with this file. If this file is
353 file is missing or damaged, see the license at "http://www.cups.org/".
354-->
355
178cb736
MS
356<h1 class='title'>CUPS API</h1>
357
5a738aea
MS
358<div class='summary'><table summary='General Information'>
359<thead>
360<tr>
361 <th>Header</th>
362 <th>cups/cups.h</th>
363</tr>
364</thead>
365<tbody>
366<tr>
367 <th>Library</th>
368 <td>-lcups</td>
369</tr>
370<tr>
371 <th>See Also</th>
372 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
373 Programming: <a href='api-array.html' target='_top'>Array API</a><br>
374 Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
375 Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
376 Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
377 Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
378 Programming: <a href='api-raster.html' target='_top'>Raster API</a></td>
379</tr>
380</tbody>
381</table></div>
382<h2 class="title">Contents</h2>
383<ul class="contents">
426c6a59 384<ul class="subcontents">
5a738aea 385<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
568fa3fa 386<li><a href="#CLIENTS_AND_SERVERS">Clients and Servers</a></li>
5a738aea
MS
387<li><a href="#PRINTERS_AND_CLASSES">Printers and Classes</a></li>
388<li><a href="#OPTIONS">Options</a></li>
389<li><a href="#PRINT_JOBS">Print Jobs</a></li>
390<li><a href="#ERROR_HANDLING">Error Handling</a></li>
391<li><a href="#PASSWORDS_AND_AUTHENTICATION">Passwords and Authentication</a></li>
392</ul></li>
393<li><a href="#FUNCTIONS">Functions</a><ul class="code">
394<li><a href="#cupsAddDest" title="Add a destination to the list of destinations.">cupsAddDest</a></li>
395<li><a href="#cupsAddOption" title="Add an option to an option array.">cupsAddOption</a></li>
426c6a59
MS
396<li><a href="#cupsAdminCreateWindowsPPD" title="Create the Windows PPD file for a printer.">cupsAdminCreateWindowsPPD</a></li>
397<li><a href="#cupsAdminExportSamba" title="Export a printer to Samba.">cupsAdminExportSamba</a></li>
398<li><a href="#cupsAdminGetServerSettings" title="Get settings from the server.">cupsAdminGetServerSettings</a></li>
399<li><a href="#cupsAdminSetServerSettings" title="Set settings on the server.">cupsAdminSetServerSettings</a></li>
5a738aea
MS
400<li><a href="#cupsCancelJob" title="Cancel a print job on the default server.">cupsCancelJob</a></li>
401<li><a href="#cupsCancelJob2" title="Cancel or purge a print job.">cupsCancelJob2</a></li>
568fa3fa 402<li><a href="#cupsCreateJob" title="Create an empty job for streaming.">cupsCreateJob</a></li>
aaf19ab0 403<li><a href="#cupsEncryption" title="Get the current encryption settings.">cupsEncryption</a></li>
5a738aea
MS
404<li><a href="#cupsFinishDocument" title="Finish sending a document.">cupsFinishDocument</a></li>
405<li><a href="#cupsFreeDests" title="Free the memory used by the list of destinations.">cupsFreeDests</a></li>
406<li><a href="#cupsFreeJobs" title="Free memory used by job data.">cupsFreeJobs</a></li>
407<li><a href="#cupsFreeOptions" title="Free all memory used by options.">cupsFreeOptions</a></li>
408<li><a href="#cupsGetClasses" title="Get a list of printer classes from the default server.">cupsGetClasses</a></li>
409<li><a href="#cupsGetDefault" title="Get the default printer or class for the default server.">cupsGetDefault</a></li>
410<li><a href="#cupsGetDefault2" title="Get the default printer or class for the specified server.">cupsGetDefault2</a></li>
411<li><a href="#cupsGetDest" title="Get the named destination from the list.">cupsGetDest</a></li>
412<li><a href="#cupsGetDests" title="Get the list of destinations from the default server.">cupsGetDests</a></li>
413<li><a href="#cupsGetDests2" title="Get the list of destinations from the specified server.">cupsGetDests2</a></li>
5a738aea
MS
414<li><a href="#cupsGetJobs" title="Get the jobs from the default server.">cupsGetJobs</a></li>
415<li><a href="#cupsGetJobs2" title="Get the jobs from the specified server.">cupsGetJobs2</a></li>
416<li><a href="#cupsGetNamedDest" title="Get options for the named destination.">cupsGetNamedDest</a></li>
417<li><a href="#cupsGetOption" title="Get an option value.">cupsGetOption</a></li>
418<li><a href="#cupsGetPPD" title="Get the PPD file for a printer on the default server.">cupsGetPPD</a></li>
419<li><a href="#cupsGetPPD2" title="Get the PPD file for a printer from the specified server.">cupsGetPPD2</a></li>
420<li><a href="#cupsGetPPD3" title="Get the PPD file for a printer on the specified
421server if it has changed.">cupsGetPPD3</a></li>
422<li><a href="#cupsGetPassword" title="Get a password from the user.">cupsGetPassword</a></li>
f11a948a 423<li><a href="#cupsGetPassword2" title="Get a password from the user using the advanced
aaf19ab0 424password callback.">cupsGetPassword2</a></li>
5a738aea
MS
425<li><a href="#cupsGetPrinters" title="Get a list of printers from the default server.">cupsGetPrinters</a></li>
426<li><a href="#cupsGetServerPPD" title="Get an available PPD file from the server.">cupsGetServerPPD</a></li>
427<li><a href="#cupsLangDefault" title="Return the default language.">cupsLangDefault</a></li>
428<li><a href="#cupsLangEncoding" title="Return the character encoding (us-ascii, etc.)
429for the given language.">cupsLangEncoding</a></li>
430<li><a href="#cupsLangFlush" title="Flush all language data out of the cache.">cupsLangFlush</a></li>
431<li><a href="#cupsLangFree" title="Free language data.">cupsLangFree</a></li>
432<li><a href="#cupsLangGet" title="Get a language.">cupsLangGet</a></li>
5a738aea
MS
433<li><a href="#cupsNotifySubject" title="Return the subject for the given notification message.">cupsNotifySubject</a></li>
434<li><a href="#cupsNotifyText" title="Return the text for the given notification message.">cupsNotifyText</a></li>
435<li><a href="#cupsParseOptions" title="Parse options from a command-line argument.">cupsParseOptions</a></li>
436<li><a href="#cupsPrintFile" title="Print a file to a printer or class on the default server.">cupsPrintFile</a></li>
437<li><a href="#cupsPrintFile2" title="Print a file to a printer or class on the specified
438server.">cupsPrintFile2</a></li>
439<li><a href="#cupsPrintFiles" title="Print one or more files to a printer or class on the
440default server.">cupsPrintFiles</a></li>
441<li><a href="#cupsPrintFiles2" title="Print one or more files to a printer or class on the
442specified server.">cupsPrintFiles2</a></li>
5a738aea
MS
443<li><a href="#cupsRemoveDest" title="Remove a destination from the destination list.">cupsRemoveDest</a></li>
444<li><a href="#cupsRemoveOption" title="Remove an option from an option array.">cupsRemoveOption</a></li>
aaf19ab0 445<li><a href="#cupsServer" title="Return the hostname/address of the current server.">cupsServer</a></li>
10d09e33
MS
446<li><a href="#cupsSetClientCertCB" title="Set the client certificate callback.">cupsSetClientCertCB</a></li>
447<li><a href="#cupsSetCredentials" title="Set the default credentials to be used for SSL/TLS
448connections.">cupsSetCredentials</a></li>
5a738aea
MS
449<li><a href="#cupsSetDefaultDest" title="Set the default destination.">cupsSetDefaultDest</a></li>
450<li><a href="#cupsSetDests" title="Save the list of destinations for the default server.">cupsSetDests</a></li>
451<li><a href="#cupsSetDests2" title="Save the list of destinations for the specified server.">cupsSetDests2</a></li>
452<li><a href="#cupsSetEncryption" title="Set the encryption preference.">cupsSetEncryption</a></li>
453<li><a href="#cupsSetPasswordCB" title="Set the password callback for CUPS.">cupsSetPasswordCB</a></li>
f11a948a 454<li><a href="#cupsSetPasswordCB2" title="Set the advanced password callback for CUPS.">cupsSetPasswordCB2</a></li>
aaf19ab0 455<li><a href="#cupsSetServer" title="Set the default server name and port.">cupsSetServer</a></li>
10d09e33 456<li><a href="#cupsSetServerCertCB" title="Set the server certificate callback.">cupsSetServerCertCB</a></li>
5a738aea
MS
457<li><a href="#cupsSetUser" title="Set the default user name.">cupsSetUser</a></li>
458<li><a href="#cupsStartDocument" title="Add a document to a job created with cupsCreateJob().">cupsStartDocument</a></li>
459<li><a href="#cupsTempFd" title="Creates a temporary file.">cupsTempFd</a></li>
460<li><a href="#cupsTempFile" title="Generates a temporary filename.">cupsTempFile</a></li>
461<li><a href="#cupsTempFile2" title="Creates a temporary CUPS file.">cupsTempFile2</a></li>
462<li><a href="#cupsUser" title="Return the current user's name.">cupsUser</a></li>
8b450588 463</ul></li>
5a738aea 464<li><a href="#TYPES">Data Types</a><ul class="code">
10d09e33 465 <li><a href="#cups_client_cert_cb_t" title="Client credentials callback ">cups_client_cert_cb_t</a></li>
5a738aea 466 <li><a href="#cups_dest_t" title="Destination">cups_dest_t</a></li>
ae71f5de 467 <li><a href="#cups_device_cb_t" title="Device callback ">cups_device_cb_t</a></li>
5a738aea
MS
468 <li><a href="#cups_job_t" title="Job">cups_job_t</a></li>
469 <li><a href="#cups_option_t" title="Printer Options">cups_option_t</a></li>
f11a948a 470 <li><a href="#cups_password_cb2_t" title="New password callback ">cups_password_cb2_t</a></li>
5a738aea
MS
471 <li><a href="#cups_password_cb_t" title="Password callback">cups_password_cb_t</a></li>
472 <li><a href="#cups_ptype_t" title="Printer type/capability bits">cups_ptype_t</a></li>
10d09e33 473 <li><a href="#cups_server_cert_cb_t" title="Server credentials callback ">cups_server_cert_cb_t</a></li>
5a738aea
MS
474</ul></li>
475<li><a href="#STRUCTURES">Structures</a><ul class="code">
476 <li><a href="#cups_dest_s" title="Destination">cups_dest_s</a></li>
477 <li><a href="#cups_job_s" title="Job">cups_job_s</a></li>
478 <li><a href="#cups_option_s" title="Printer Options">cups_option_s</a></li>
479</ul></li>
480<li><a href="#ENUMERATIONS">Constants</a><ul class="code">
481 <li><a href="#cups_ptype_e" title="Printer type/capability bit constants">cups_ptype_e</a></li>
482</ul></li>
ef416fc2 483<!--
68b10830 484 "$Id$"
ef416fc2 485
486 CUPS API introduction for the Common UNIX Printing System (CUPS).
487
aaf19ab0 488 Copyright 2007-2010 by Apple Inc.
bc44d920 489 Copyright 1997-2006 by Easy Software Products, all rights reserved.
ef416fc2 490
491 These coded instructions, statements, and computer programs are the
bc44d920 492 property of Apple Inc. and are protected by Federal copyright
493 law. Distribution and use rights are outlined in the file "LICENSE.txt"
494 which should have been included with this file. If this file is
495 file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 496-->
497
5a738aea
MS
498<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
499
500<p>The CUPS API provides the convenience functions needed to support
501applications, filters, printer drivers, and backends that need to interface
502with the CUPS scheduler.</p>
ef416fc2 503
568fa3fa
MS
504<h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3>
505
506<p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows
507clients (applications) to communicate with a server (the scheduler) to get a
508list of printers, send print jobs, and so forth. You identify which server
509you want to communicate with using a pointer to the opaque structure
510<code>http_t</code>. All of the examples in this document use the
511<code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection
512to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP
513APIs</a> document provides more information on server connections.</p>
514
5a738aea 515<h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3>
ecdc0628 516
5a738aea
MS
517<p>Printers and classes (collections of printers) are accessed through
518the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which
519includes the name (<code>name</code>), instance (<code>instance</code> -
568fa3fa
MS
520a way of selecting certain saved options/settings), and the options and
521attributes associated with that destination (<code>num_options</code> and
5a738aea
MS
522<code>options</code>). Destinations are created using the
523<a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed
524using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function.
525The <a href='#cupsGetDest'><code>cupsGetDest</code></a> function finds a
526specific destination for printing:</p>
ef416fc2 527
5a738aea
MS
528<pre class='example'>
529#include &lt;cups/cups.h&gt;
ef416fc2 530
5a738aea
MS
531<a href='#cups_dest_t'>cups_dest_t</a> *dests;
532int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
533<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
ef416fc2 534
5a738aea 535/* do something wiith dest */
ef416fc2 536
5a738aea 537<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
ef416fc2 538</pre>
539
5a738aea
MS
540<p>Passing <code>NULL</code> to
541<a href='#cupsGetDest'><code>cupsGetDest</code></a> for the destination name
542will return the default destination. Similarly, passing a <code>NULL</code>
543instance will return the default instance for that destination.</p>
ef416fc2 544
5a738aea
MS
545<div class='table'><table summary='Table 1: Printer Attributes' width='80%'>
546<caption>Table 1: <a name='TABLE1'>Printer Attributes</a></caption>
547<thead>
548<tr>
549 <th>Attribute Name</th>
550 <th>Description</th>
551</tr>
552</thead>
ef416fc2 553<tbody>
5a738aea
MS
554<tr>
555 <td>"auth-info-required"</td>
556 <td>The type of authentication required for printing to this
557 destination: "none", "username,password", "domain,username,password",
558 or "negotiate" (Kerberos)</td>
559</tr>
560<tr>
561 <td>"printer-info"</td>
562 <td>The human-readable description of the destination such as "My
563 Laser Printer".</td>
564</tr>
565<tr>
566 <td>"printer-is-accepting-jobs"</td>
aaf19ab0
MS
567 <td>"true" if the destination is accepting new jobs, "false" if
568 not.</td>
5a738aea
MS
569</tr>
570<tr>
571 <td>"printer-is-shared"</td>
aaf19ab0
MS
572 <td>"true" if the destination is being shared with other computers,
573 "false" if not.</td>
5a738aea
MS
574</tr>
575<tr>
576 <td>"printer-location"</td>
577 <td>The human-readable location of the destination such as "Lab 4".</td>
578</tr>
579<tr>
580 <td>"printer-make-and-model"</td>
581 <td>The human-readable make and model of the destination such as "HP
582 LaserJet 4000 Series".</td>
583</tr>
584<tr>
585 <td>"printer-state"</td>
586 <td>"3" if the destination is idle, "4" if the destination is printing
587 a job, and "5" if the destination is stopped.</td>
588</tr>
589<tr>
590 <td>"printer-state-change-time"</td>
591 <td>The UNIX time when the destination entered the current state.</td>
592</tr>
593<tr>
594 <td>"printer-state-reasons"</td>
595 <td>Additional comma-delimited state keywords for the destination
596 such as "media-tray-empty-error" and "toner-low-warning".</td>
597</tr>
598<tr>
599 <td>"printer-type"</td>
600 <td>The <a href='#cups_printer_t'><code>cups_printer_t</code></a>
601 value associated with the destination.</td>
602</tr>
603</tbody>
604</table></div>
605
606<h3><a name='OPTIONS'>Options</a></h3>
607
608<p>Options are stored in arrays of
609<a href='#cups_option_t'><code>cups_option_t</code></a> structures. Each
610option has a name (<code>name</code>) and value (<code>value</code>)
611associated with it. The <a href='#cups_dest_t'><code>cups_dest_t</code></a>
612<code>num_options</code> and <code>options</code> members contain the
613default options for a particular destination, along with several informational
614attributes about the destination as shown in <a href='#TABLE1'>Table 1</a>.
615The <a href='#cupsGetOption'><code>cupsGetOption</code></a> function gets
616the value for the named option. For example, the following code lists the
617available destinations and their human-readable descriptions:</p>
618
619<pre class='example'>
620#include &lt;cups/cups.h&gt;
621
622<a href='#cups_dest_t'>cups_dest_t</a> *dests;
623int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
624<a href='#cups_dest_t'>cups_dest_t</a> *dest;
625int i;
626const char *value;
627
628for (i = num_dests, dest = dests; i > 0; i --, dest ++)
629 if (dest->instance == NULL)
630 {
631 value = <a href='#cupsGetOption'>cupsGetOption</a>("printer-info", dest->num_options, dest->options);
632 printf("%s (%s)\n", dest->name, value ? value : "no description");
633 }
634
635<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
636</pre>
637
638<p>You can create your own option arrays using the
639<a href='#cupsAddOption'><code>cupsAddOption</code></a> function, which
640adds a single named option to an array:</p>
641
642<pre class='example'>
643#include &lt;cups/cups.h&gt;
644
645int num_options = 0;
646<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
647
648/* The returned num_options value is updated as needed */
649num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "value", num_options, &amp;options);
650
651/* This adds a second option value */
652num_options = <a href='#cupsAddOption'>cupsAddOption</a>("second", "value", num_options, &amp;options);
653
654/* This replaces the first option we added */
655num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "new value", num_options, &amp;options);
656</pre>
657
658<p>Use a <code>for</code> loop to copy the options from a destination:</p>
659
660<pre class='example'>
661#include &lt;cups/cups.h&gt;
662
663int i;
664int num_options = 0;
665<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
666<a href='#cups_dest_t'>cups_dest_t</a> *dest;
667
668for (i = 0; i < dest->num_options; i ++)
568fa3fa
MS
669 num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value,
670 num_options, &amp;options);
5a738aea
MS
671</pre>
672
673<p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a>
674function to free the options array when you are done using it:</p>
675
676<pre class='example'>
677<a href='#cupsFreeOptions'>cupsFreeOptions</a>(num_options, options);
678</pre>
679
680<h3><a name='PRINT_JOBS'>Print Jobs</a></h3>
681
682<p>Print jobs are identified by a locally-unique job ID number from 1 to
6832<sup>31</sup>-1 and have options and one or more files for printing to a
684single destination. The <a href='#cupsPrintFile'><code>cupsPrintFile</code></a>
685function creates a new job with one file. The following code prints the CUPS
686test page file:</p>
687
688<pre class='example'>
689#include &lt;cups/cups.h&gt;
690
691<a href='#cups_dest_t'>cups_dest_t</a> *dest;
692int num_options;
693<a href='#cups_option_t'>cups_option_t</a> *options;
694int job_id;
695
696/* Print a single file */
568fa3fa
MS
697job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps",
698 "Test Print", num_options, options);
5a738aea
MS
699</pre>
700
701<p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function
702creates a job with multiple files. The files are provided in a
703<code>char *</code> array:</p>
704
705<pre class='example'>
706#include &lt;cups/cups.h&gt;
707
708<a href='#cups_dest_t'>cups_dest_t</a> *dest;
709int num_options;
710<a href='#cups_option_t'>cups_option_t</a> *options;
711int job_id;
712char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };
713
714/* Print three files */
715job_id = <a href='#cupsPrintFiles'>cupsPrintFiles</a>(dest->name, 3, files, "Test Print", num_options, options);
716</pre>
717
718<p>Finally, the <a href='#cupsCreateJob'><code>cupsCreateJob</code></a>
719function creates a new job with no files in it. Files are added using the
720<a href='#cupsStartDocument'><code>cupsStartDocument</code></a>,
721<a href='api-httpipp.html#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>,
722and <a href='#cupsFinishDocument'><code>cupsFinishDocument</code></a> functions.
723The following example creates a job with 10 text files for printing:</p>
724
725<pre class='example'>
726#include &lt;cups/cups.h&gt;
727
728<a href='#cups_dest_t'>cups_dest_t</a> *dest;
729int num_options;
730<a href='#cups_option_t'>cups_option_t</a> *options;
731int job_id;
732int i;
733char buffer[1024];
734
735/* Create the job */
568fa3fa
MS
736job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
737 num_options, options);
5a738aea
MS
738
739/* If the job is created, add 10 files */
740if (job_id > 0)
741{
742 for (i = 1; i &lt;= 10; i ++)
743 {
744 snprintf(buffer, sizeof(buffer), "file%d.txt", i);
745
568fa3fa
MS
746 <a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
747 CUPS_FORMAT_TEXT, i == 10);
5a738aea
MS
748
749 snprintf(buffer, sizeof(buffer),
750 "File %d\n"
751 "\n"
752 "One fish,\n"
753 "Two fish,\n
754 "Red fish,\n
755 "Blue fish\n", i);
756
757 /* cupsWriteRequestData can be called as many times as needed */
758 <a href='#cupsWriteRequestData'>cupsWriteRequestData</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
759
760 <a href='#cupsFinishDocument'>cupsFinishDocument</a>(CUPS_HTTP_DEFAULT, dest->name);
761 }
762}
763</pre>
764
765<p>Once you have created a job, you can monitor its status using the
766<a href='#cupsGetJobs'><code>cupsGetJobs</code></a> function, which returns
767an array of <a href='#cups_job_t'><code>cups_job_t</code></a> structures.
768Each contains the job ID (<code>id</code>), destination name
769(<code>dest</code>), title (<code>title</code>), and other information
770associated with the job. The job array is freed using the
771<a href='#cupsFreeJobs'><code>cupsFreeJobs</code></a> function. The following
772example monitors a specific job ID, showing the current job state once every
7735 seconds until the job is completed:</p>
774
775<pre class='example'>
776#include &lt;cups/cups.h&gt;
777
778<a href='#cups_dest_t'>cups_dest_t</a> *dest;
779int job_id;
780int num_jobs;
781<a href='#cups_job_t'>cups_job_t</a> *jobs;
782int i;
783ipp_jstate_t job_state = IPP_JOB_PENDING;
784
785while (job_state &lt; IPP_JOB_STOPPED)
786{
787 /* Get my jobs (1) with any state (-1) */
788 num_jobs = <a href='#cupsGetJobs'>cupsGetJobs</a>(&amp;jobs, dest->name, 1, -1);
789
790 /* Loop to find my job */
791 job_state = IPP_JOB_COMPLETED;
792
793 for (i = 0; i &lt; num_jobs; i ++)
794 if (jobs[i].id == job_id)
795 {
796 job_state = jobs[i].state;
797 break;
798 }
799
800 /* Free the job array */
801 <a href='#cupsFreeJobs'>cupsFreeJobs</a>(num_jobs, jobs);
802
803 /* Show the current state */
804 switch (job_state)
805 {
806 case IPP_JOB_PENDING :
807 printf("Job %d is pending.\n", job_id);
808 break;
809 case IPP_JOB_HELD :
810 printf("Job %d is held.\n", job_id);
811 break;
812 case IPP_JOB_PROCESSING :
813 printf("Job %d is processing.\n", job_id);
814 break;
815 case IPP_JOB_STOPPED :
816 printf("Job %d is stopped.\n", job_id);
817 break;
818 case IPP_JOB_CANCELED :
819 printf("Job %d is canceled.\n", job_id);
820 break;
821 case IPP_JOB_ABORTED :
822 printf("Job %d is aborted.\n", job_id);
823 break;
824 case IPP_JOB_COMPLETED :
825 printf("Job %d is completed.\n", job_id);
826 break;
827 }
828
829 /* Sleep if the job is not finished */
830 if (job_state &lt; IPP_JOB_STOPPED)
831 sleep(5);
832}
833</pre>
834
835<p>To cancel a job, use the
836<a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the
837job ID:</p>
838
568fa3fa 839<pre class='example'>
5a738aea
MS
840#include &lt;cups/cups.h&gt;
841
842<a href='#cups_dest_t'>cups_dest_t</a> *dest;
843int job_id;
844
845<a href='#cupsCancelJob'>cupsCancelJob</a>(dest->name, job_id);
846</pre>
847
848<h3><a name='ERROR_HANDLING'>Error Handling</a></h3>
849
850<p>If any of the CUPS API printing functions returns an error, the reason for
851that error can be found by calling the
852<a href='#cupsLastError'><code>cupsLastError</code></a> and
853<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> functions.
854<a href='#cupsLastError'><code>cupsLastError</code></a> returns the last IPP
855error code
856(<a href='api-httpipp.html#ipp_status_t'><code>ipp_status_t</code></a>)
857that was encountered, while
858<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> returns
859a (localized) human-readable string that can be shown to the user. For example,
860if any of the job creation functions returns a job ID of 0, you can use
861<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> to show
862the reason why the job could not be created:</p>
863
864<pre class='example'>
865#include &lt;cups/cups.h&gt;
866
867int job_id;
868
869if (job_id == 0)
870 puts(cupsLastErrorString());
871</pre>
872
873<h3><a name='PASSWORDS_AND_AUTHENTICATION'>Passwords and Authentication</a></h3>
874
875<p>CUPS supports authentication of any request, including submission of print
876jobs. The default mechanism for getting the username and password is to use the
877login user and a password from the console.</p>
878
879<p>To support other types of applications, in particular Graphical User
880Interfaces ("GUIs"), the CUPS API provides functions to set the default
881username and to register a callback function that returns a password string.</p>
882
883<p>The <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a>
884function is used to set a password callback in your program. Only one
885function can be used at any time.</p>
886
887<p>The <a href="#cupsSetUser"><code>cupsSetUser</code></a> function sets the
888current username for authentication. This function can be called by your
889password callback function to change the current username as needed.</p>
890
891<p>The following example shows a simple password callback that gets a
892username and password from the user:</p>
893
894<pre class='example'>
895#include &lt;cups/cups.h&gt;
896
897const char *
898my_password_cb(const char *prompt)
899{
900 char user[65];
901
902
903 puts(prompt);
904
905 /* Get a username from the user */
906 printf("Username: ");
907 if (fgets(user, sizeof(user), stdin) == NULL)
908 return (NULL);
909
910 /* Strip the newline from the string and set the user */
911 user[strlen(user) - 1] = '\0';
912
913 <a href='#cupsSetUser'>cupsSetUser</a>(user);
914
915 /* Use getpass() to ask for the password... */
916 return (getpass("Password: "));
917}
918
919<a href='#cupsSetPasswordCB'>cupsSetPasswordCB</a>(my_password_cb);
920</pre>
921
922<p>Similarly, a GUI could display the prompt string in a window with input
923fields for the username and password. The username should default to the
924string returned by the <a href="#cupsUser"><code>cupsUser</code></a>
925function.</p>
926<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
927<h3 class="function"><a name="cupsAddDest">cupsAddDest</a></h3>
928<p class="description">Add a destination to the list of destinations.</p>
929<p class="code">
930int cupsAddDest (<br>
931&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
932&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
933&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
934&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
935);</p>
936<h4 class="parameters">Parameters</h4>
937<dl>
938<dt>name</dt>
939<dd class="description">Destination name</dd>
940<dt>instance</dt>
941<dd class="description">Instance name or <code>NULL</code> for none/primary</dd>
942<dt>num_dests</dt>
943<dd class="description">Number of destinations</dd>
944<dt>dests</dt>
945<dd class="description">Destinations</dd>
946</dl>
947<h4 class="returnvalue">Return Value</h4>
948<p class="description">New number of destinations</p>
949<h4 class="discussion">Discussion</h4>
950<p class="discussion">This function cannot be used to add a new class or printer queue,
2abf387c 951it only adds a new container of saved options for the named
5a738aea
MS
952destination or instance.<br>
953<br>
954If the named destination already exists, the destination list is
2abf387c 955returned unchanged. Adding a new instance of a destination creates
5a738aea
MS
956a copy of that destination's options.<br>
957<br>
958Use the <a href="#cupsSaveDests"><code>cupsSaveDests</code></a> function to save the updated list of
959destinations to the user's lpoptions file.</p>
960<h3 class="function"><a name="cupsAddOption">cupsAddOption</a></h3>
961<p class="description">Add an option to an option array.</p>
962<p class="code">
963int cupsAddOption (<br>
964&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
965&nbsp;&nbsp;&nbsp;&nbsp;const char *value,<br>
966&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
967&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
968);</p>
969<h4 class="parameters">Parameters</h4>
970<dl>
971<dt>name</dt>
972<dd class="description">Name of option</dd>
973<dt>value</dt>
974<dd class="description">Value of option</dd>
975<dt>num_options</dt>
976<dd class="description">Number of options</dd>
977<dt>options</dt>
978<dd class="description">Pointer to options</dd>
979</dl>
980<h4 class="returnvalue">Return Value</h4>
981<p class="description">Number of options</p>
982<h4 class="discussion">Discussion</h4>
983<p class="discussion">New option arrays can be initialized simply by passing 0 for the
984&quot;num_options&quot; parameter.</p>
426c6a59
MS
985<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD</a></h3>
986<p class="description">Create the Windows PPD file for a printer.</p>
987<p class="code">
988char *cupsAdminCreateWindowsPPD (<br>
989&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
990&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
991&nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>
992&nbsp;&nbsp;&nbsp;&nbsp;int bufsize<br>
993);</p>
994<h4 class="parameters">Parameters</h4>
995<dl>
996<dt>http</dt>
997<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
998<dt>dest</dt>
999<dd class="description">Printer or class</dd>
1000<dt>buffer</dt>
1001<dd class="description">Filename buffer</dd>
1002<dt>bufsize</dt>
1003<dd class="description">Size of filename buffer</dd>
1004</dl>
1005<h4 class="returnvalue">Return Value</h4>
1006<p class="description">PPD file or NULL</p>
1007<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsAdminExportSamba">cupsAdminExportSamba</a></h3>
1008<p class="description">Export a printer to Samba.</p>
1009<p class="code">
1010int cupsAdminExportSamba (<br>
1011&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
1012&nbsp;&nbsp;&nbsp;&nbsp;const char *ppd,<br>
1013&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_server,<br>
1014&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_user,<br>
1015&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_password,<br>
1016&nbsp;&nbsp;&nbsp;&nbsp;FILE *logfile<br>
1017);</p>
1018<h4 class="parameters">Parameters</h4>
1019<dl>
1020<dt>dest</dt>
1021<dd class="description">Destination to export</dd>
1022<dt>ppd</dt>
1023<dd class="description">PPD file</dd>
1024<dt>samba_server</dt>
1025<dd class="description">Samba server</dd>
1026<dt>samba_user</dt>
1027<dd class="description">Samba username</dd>
1028<dt>samba_password</dt>
1029<dd class="description">Samba password</dd>
1030<dt>logfile</dt>
1031<dd class="description">Log file, if any</dd>
1032</dl>
1033<h4 class="returnvalue">Return Value</h4>
1034<p class="description">1 on success, 0 on failure</p>
1035<h3 class="function"><span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span><a name="cupsAdminGetServerSettings">cupsAdminGetServerSettings</a></h3>
1036<p class="description">Get settings from the server.</p>
1037<p class="code">
1038int cupsAdminGetServerSettings (<br>
1039&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1040&nbsp;&nbsp;&nbsp;&nbsp;int *num_settings,<br>
1041&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **settings<br>
1042);</p>
1043<h4 class="parameters">Parameters</h4>
1044<dl>
1045<dt>http</dt>
1046<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1047<dt>num_settings</dt>
1048<dd class="description">Number of settings</dd>
1049<dt>settings</dt>
1050<dd class="description">Settings</dd>
1051</dl>
1052<h4 class="returnvalue">Return Value</h4>
1053<p class="description">1 on success, 0 on failure</p>
1054<h4 class="discussion">Discussion</h4>
1055<p class="discussion">The returned settings should be freed with cupsFreeOptions() when
1056you are done with them.
1057
1058</p>
1059<h3 class="function"><span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span><a name="cupsAdminSetServerSettings">cupsAdminSetServerSettings</a></h3>
1060<p class="description">Set settings on the server.</p>
1061<p class="code">
1062int cupsAdminSetServerSettings (<br>
1063&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1064&nbsp;&nbsp;&nbsp;&nbsp;int num_settings,<br>
1065&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *settings<br>
1066);</p>
1067<h4 class="parameters">Parameters</h4>
1068<dl>
1069<dt>http</dt>
1070<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1071<dt>num_settings</dt>
1072<dd class="description">Number of settings</dd>
1073<dt>settings</dt>
1074<dd class="description">Settings</dd>
1075</dl>
1076<h4 class="returnvalue">Return Value</h4>
1077<p class="description">1 on success, 0 on failure</p>
5a738aea
MS
1078<h3 class="function"><a name="cupsCancelJob">cupsCancelJob</a></h3>
1079<p class="description">Cancel a print job on the default server.</p>
1080<p class="code">
1081int cupsCancelJob (<br>
1082&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1083&nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
1084);</p>
1085<h4 class="parameters">Parameters</h4>
1086<dl>
1087<dt>name</dt>
1088<dd class="description">Name of printer or class</dd>
1089<dt>job_id</dt>
568fa3fa 1090<dd class="description">Job ID, <code>CUPS_JOBID_CURRENT</code> for the current job, or <code>CUPS_JOBID_ALL</code> for all jobs</dd>
5a738aea
MS
1091</dl>
1092<h4 class="returnvalue">Return Value</h4>
1093<p class="description">1 on success, 0 on failure</p>
1094<h4 class="discussion">Discussion</h4>
1095<p class="discussion">Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
1096to cancel the current job on the named destination.<br>
1097<br>
1098Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
1099the cause of any failure.</p>
178cb736 1100<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsCancelJob2">cupsCancelJob2</a></h3>
5a738aea
MS
1101<p class="description">Cancel or purge a print job.</p>
1102<p class="code">
1103ipp_status_t cupsCancelJob2 (<br>
1104&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1105&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1106&nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
1107&nbsp;&nbsp;&nbsp;&nbsp;int purge<br>
1108);</p>
1109<h4 class="parameters">Parameters</h4>
1110<dl>
1111<dt>http</dt>
568fa3fa 1112<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1113<dt>name</dt>
1114<dd class="description">Name of printer or class</dd>
1115<dt>job_id</dt>
568fa3fa 1116<dd class="description">Job ID, <code>CUPS_JOBID_CURRENT</code> for the current job, or <code>CUPS_JOBID_ALL</code> for all jobs</dd>
5a738aea
MS
1117<dt>purge</dt>
1118<dd class="description">1 to purge, 0 to cancel</dd>
1119</dl>
1120<h4 class="returnvalue">Return Value</h4>
1121<p class="description">IPP status</p>
1122<h4 class="discussion">Discussion</h4>
1123<p class="discussion">Canceled jobs remain in the job history while purged jobs are removed
1124from the job history.<br>
1125<br>
1126Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
1127to cancel the current job on the named destination.<br>
1128<br>
1129Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
bc44d920 1130the cause of any failure.
5a738aea
MS
1131
1132</p>
178cb736 1133<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsCreateJob">cupsCreateJob</a></h3>
568fa3fa 1134<p class="description">Create an empty job for streaming.</p>
5a738aea
MS
1135<p class="code">
1136int cupsCreateJob (<br>
1137&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1138&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1139&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1140&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1141&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1142);</p>
1143<h4 class="parameters">Parameters</h4>
1144<dl>
1145<dt>http</dt>
568fa3fa 1146<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1147<dt>name</dt>
568fa3fa 1148<dd class="description">Destination name</dd>
5a738aea
MS
1149<dt>title</dt>
1150<dd class="description">Title of job</dd>
1151<dt>num_options</dt>
1152<dd class="description">Number of options</dd>
1153<dt>options</dt>
1154<dd class="description">Options</dd>
1155</dl>
1156<h4 class="returnvalue">Return Value</h4>
1157<p class="description">Job ID or 0 on error</p>
1158<h4 class="discussion">Discussion</h4>
568fa3fa
MS
1159<p class="discussion">Use this function when you want to stream print data using the
1160<a href="#cupsStartDocument"><code>cupsStartDocument</code></a>, <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a>, and
1161<a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> functions. If you have one or more files to
1162print, use the <a href="#cupsPrintFile2"><code>cupsPrintFile2</code></a> or <a href="#cupsPrintFiles2"><code>cupsPrintFiles2</code></a> function
1163instead.
5a738aea
MS
1164
1165</p>
1166<h3 class="function"><a name="cupsEncryption">cupsEncryption</a></h3>
aaf19ab0 1167<p class="description">Get the current encryption settings.</p>
5a738aea
MS
1168<p class="code">
1169http_encryption_t cupsEncryption (void);</p>
1170<h4 class="returnvalue">Return Value</h4>
1171<p class="description">Encryption settings</p>
1172<h4 class="discussion">Discussion</h4>
1173<p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
568fa3fa 1174environment variable, then the ~/.cups/client.conf file, and finally the
ef416fc2 1175/etc/cups/client.conf file. If not set, the default is
aaf19ab0
MS
1176<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
1177<br>
1178Note: The current encryption setting is tracked separately for each thread
1179in a program. Multi-threaded programs that override the setting via the
1180<a href="#cupsSetEncryption"><code>cupsSetEncryption</code></a> function need to do so in each thread for the same
1181setting to be used.</p>
178cb736 1182<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsFinishDocument">cupsFinishDocument</a></h3>
5a738aea
MS
1183<p class="description">Finish sending a document.</p>
1184<p class="code">
1185ipp_status_t cupsFinishDocument (<br>
1186&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1187&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1188);</p>
1189<h4 class="parameters">Parameters</h4>
1190<dl>
1191<dt>http</dt>
568fa3fa 1192<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1193<dt>name</dt>
568fa3fa 1194<dd class="description">Destination name</dd>
5a738aea
MS
1195</dl>
1196<h4 class="returnvalue">Return Value</h4>
1197<p class="description">Status of document submission</p>
1198<h4 class="discussion">Discussion</h4>
1199<p class="discussion">The document must have been started using <a href="#cupsStartDocument"><code>cupsStartDocument</code></a>.
1200
1201</p>
1202<h3 class="function"><a name="cupsFreeDests">cupsFreeDests</a></h3>
1203<p class="description">Free the memory used by the list of destinations.</p>
1204<p class="code">
1205void cupsFreeDests (<br>
1206&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1207&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1208);</p>
1209<h4 class="parameters">Parameters</h4>
1210<dl>
1211<dt>num_dests</dt>
1212<dd class="description">Number of destinations</dd>
1213<dt>dests</dt>
1214<dd class="description">Destinations</dd>
1215</dl>
1216<h3 class="function"><a name="cupsFreeJobs">cupsFreeJobs</a></h3>
1217<p class="description">Free memory used by job data.</p>
1218<p class="code">
1219void cupsFreeJobs (<br>
1220&nbsp;&nbsp;&nbsp;&nbsp;int num_jobs,<br>
1221&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> *jobs<br>
1222);</p>
1223<h4 class="parameters">Parameters</h4>
1224<dl>
1225<dt>num_jobs</dt>
1226<dd class="description">Number of jobs</dd>
1227<dt>jobs</dt>
1228<dd class="description">Jobs</dd>
1229</dl>
1230<h3 class="function"><a name="cupsFreeOptions">cupsFreeOptions</a></h3>
1231<p class="description">Free all memory used by options.</p>
1232<p class="code">
1233void cupsFreeOptions (<br>
1234&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1235&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1236);</p>
1237<h4 class="parameters">Parameters</h4>
1238<dl>
1239<dt>num_options</dt>
1240<dd class="description">Number of options</dd>
1241<dt>options</dt>
1242<dd class="description">Pointer to options</dd>
1243</dl>
1244<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetClasses">cupsGetClasses</a></h3>
1245<p class="description">Get a list of printer classes from the default server.</p>
1246<p class="code">
1247int cupsGetClasses (<br>
1248&nbsp;&nbsp;&nbsp;&nbsp;char ***classes<br>
1249);</p>
1250<h4 class="parameters">Parameters</h4>
1251<dl>
1252<dt>classes</dt>
1253<dd class="description">Classes</dd>
1254</dl>
1255<h4 class="returnvalue">Return Value</h4>
1256<p class="description">Number of classes</p>
1257<h4 class="discussion">Discussion</h4>
1258<p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
1259
1260</p>
1261<h3 class="function"><a name="cupsGetDefault">cupsGetDefault</a></h3>
1262<p class="description">Get the default printer or class for the default server.</p>
1263<p class="code">
1264const char *cupsGetDefault (void);</p>
1265<h4 class="returnvalue">Return Value</h4>
1266<p class="description">Default printer or <code>NULL</code></p>
1267<h4 class="discussion">Discussion</h4>
1268<p class="discussion">This function returns the default printer or class as defined by
ef416fc2 1269the LPDEST or PRINTER environment variables. If these environment
1270variables are not set, the server default destination is returned.
5a738aea
MS
1271Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1272functions to get the user-defined default printer, as this function does
1273not support the lpoptions-defined default printer.</p>
426c6a59 1274<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsGetDefault2">cupsGetDefault2</a></h3>
5a738aea
MS
1275<p class="description">Get the default printer or class for the specified server.</p>
1276<p class="code">
1277const char *cupsGetDefault2 (<br>
1278&nbsp;&nbsp;&nbsp;&nbsp;http_t *http<br>
1279);</p>
1280<h4 class="parameters">Parameters</h4>
1281<dl>
1282<dt>http</dt>
568fa3fa 1283<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1284</dl>
1285<h4 class="returnvalue">Return Value</h4>
1286<p class="description">Default printer or <code>NULL</code></p>
1287<h4 class="discussion">Discussion</h4>
1288<p class="discussion">This function returns the default printer or class as defined by
ef416fc2 1289the LPDEST or PRINTER environment variables. If these environment
1290variables are not set, the server default destination is returned.
5a738aea
MS
1291Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1292functions to get the user-defined default printer, as this function does
1293not support the lpoptions-defined default printer.
1294
1295</p>
1296<h3 class="function"><a name="cupsGetDest">cupsGetDest</a></h3>
1297<p class="description">Get the named destination from the list.</p>
1298<p class="code">
1299<a href="#cups_dest_t">cups_dest_t</a> *cupsGetDest (<br>
1300&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1301&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1302&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1303&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1304);</p>
1305<h4 class="parameters">Parameters</h4>
1306<dl>
1307<dt>name</dt>
1308<dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
1309<dt>instance</dt>
1310<dd class="description">Instance name or <code>NULL</code></dd>
1311<dt>num_dests</dt>
1312<dd class="description">Number of destinations</dd>
1313<dt>dests</dt>
1314<dd class="description">Destinations</dd>
1315</dl>
1316<h4 class="returnvalue">Return Value</h4>
1317<p class="description">Destination pointer or <code>NULL</code></p>
1318<h4 class="discussion">Discussion</h4>
1319<p class="discussion">Use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> or <a href="#cupsGetDests2"><code>cupsGetDests2</code></a> functions to get a
1320list of supported destinations for the current user.</p>
1321<h3 class="function"><a name="cupsGetDests">cupsGetDests</a></h3>
1322<p class="description">Get the list of destinations from the default server.</p>
1323<p class="code">
1324int cupsGetDests (<br>
1325&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1326);</p>
1327<h4 class="parameters">Parameters</h4>
1328<dl>
1329<dt>dests</dt>
1330<dd class="description">Destinations</dd>
1331</dl>
1332<h4 class="returnvalue">Return Value</h4>
1333<p class="description">Number of destinations</p>
1334<h4 class="discussion">Discussion</h4>
1335<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 1336printer-info, printer-is-accepting-jobs, printer-is-shared,
1337printer-make-and-model, printer-state, printer-state-change-time,
426c6a59
MS
1338printer-state-reasons, and printer-type attributes as options. CUPS 1.4
1339adds the marker-change-time, marker-colors, marker-high-levels,
1340marker-levels, marker-low-levels, marker-message, marker-names,
1341marker-types, and printer-commands attributes as well.<br>
5a738aea
MS
1342<br>
1343Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1344the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.</p>
426c6a59 1345<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsGetDests2">cupsGetDests2</a></h3>
5a738aea
MS
1346<p class="description">Get the list of destinations from the specified server.</p>
1347<p class="code">
1348int cupsGetDests2 (<br>
1349&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1350&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1351);</p>
1352<h4 class="parameters">Parameters</h4>
1353<dl>
1354<dt>http</dt>
568fa3fa 1355<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1356<dt>dests</dt>
1357<dd class="description">Destinations</dd>
1358</dl>
1359<h4 class="returnvalue">Return Value</h4>
1360<p class="description">Number of destinations</p>
1361<h4 class="discussion">Discussion</h4>
1362<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 1363printer-info, printer-is-accepting-jobs, printer-is-shared,
1364printer-make-and-model, printer-state, printer-state-change-time,
426c6a59
MS
1365printer-state-reasons, and printer-type attributes as options. CUPS 1.4
1366adds the marker-change-time, marker-colors, marker-high-levels,
1367marker-levels, marker-low-levels, marker-message, marker-names,
1368marker-types, and printer-commands attributes as well.<br>
5a738aea
MS
1369<br>
1370Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1371the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.
ef416fc2 1372
5a738aea
MS
1373</p>
1374<h3 class="function"><a name="cupsGetJobs">cupsGetJobs</a></h3>
1375<p class="description">Get the jobs from the default server.</p>
1376<p class="code">
1377int cupsGetJobs (<br>
1378&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1379&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1380&nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1381&nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1382);</p>
1383<h4 class="parameters">Parameters</h4>
1384<dl>
1385<dt>jobs</dt>
1386<dd class="description">Job data</dd>
1387<dt>name</dt>
568fa3fa 1388<dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
5a738aea
MS
1389<dt>myjobs</dt>
1390<dd class="description">0 = all users, 1 = mine</dd>
1391<dt>whichjobs</dt>
1392<dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1393</dl>
1394<h4 class="returnvalue">Return Value</h4>
1395<p class="description">Number of jobs</p>
1396<h4 class="discussion">Discussion</h4>
1397<p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1398of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1399pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1400jobs that are stopped, canceled, aborted, or completed.</p>
426c6a59 1401<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsGetJobs2">cupsGetJobs2</a></h3>
5a738aea
MS
1402<p class="description">Get the jobs from the specified server.</p>
1403<p class="code">
1404int cupsGetJobs2 (<br>
1405&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1406&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1407&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1408&nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1409&nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1410);</p>
1411<h4 class="parameters">Parameters</h4>
1412<dl>
1413<dt>http</dt>
568fa3fa 1414<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1415<dt>jobs</dt>
1416<dd class="description">Job data</dd>
1417<dt>name</dt>
568fa3fa 1418<dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
5a738aea
MS
1419<dt>myjobs</dt>
1420<dd class="description">0 = all users, 1 = mine</dd>
1421<dt>whichjobs</dt>
1422<dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1423</dl>
1424<h4 class="returnvalue">Return Value</h4>
1425<p class="description">Number of jobs</p>
1426<h4 class="discussion">Discussion</h4>
1427<p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1428of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1429pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1430jobs that are stopped, canceled, aborted, or completed.
1431
1432</p>
178cb736 1433<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsGetNamedDest">cupsGetNamedDest</a></h3>
5a738aea
MS
1434<p class="description">Get options for the named destination.</p>
1435<p class="code">
1436<a href="#cups_dest_t">cups_dest_t</a> *cupsGetNamedDest (<br>
1437&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1438&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1439&nbsp;&nbsp;&nbsp;&nbsp;const char *instance<br>
1440);</p>
1441<h4 class="parameters">Parameters</h4>
1442<dl>
1443<dt>http</dt>
568fa3fa 1444<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1445<dt>name</dt>
568fa3fa 1446<dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
5a738aea
MS
1447<dt>instance</dt>
1448<dd class="description">Instance name or <code>NULL</code></dd>
1449</dl>
1450<h4 class="returnvalue">Return Value</h4>
1451<p class="description">Destination or <code>NULL</code></p>
1452<h4 class="discussion">Discussion</h4>
1453<p class="discussion">This function is optimized for retrieving a single destination and should
1454be used instead of <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a> when you either
1455know the name of the destination or want to print to the default destination.
1456If <code>NULL</code> is returned, the destination does not exist or there is no
1457default destination.<br>
1458<br>
1459If &quot;http&quot; is <code>CUPS_HTTP_DEFAULT</code>, the connection to the default print
1460server will be used.<br>
1461<br>
1462If &quot;name&quot; is <code>NULL</code>, the default printer for the current user will be
1463returned.<br>
1464<br>
1465The returned destination must be freed using <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> with a
1466&quot;num_dests&quot; value of 1.
1467
1468</p>
1469<h3 class="function"><a name="cupsGetOption">cupsGetOption</a></h3>
1470<p class="description">Get an option value.</p>
1471<p class="code">
1472const char *cupsGetOption (<br>
1473&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1474&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1475&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1476);</p>
1477<h4 class="parameters">Parameters</h4>
1478<dl>
1479<dt>name</dt>
1480<dd class="description">Name of option</dd>
1481<dt>num_options</dt>
1482<dd class="description">Number of options</dd>
1483<dt>options</dt>
1484<dd class="description">Options</dd>
1485</dl>
1486<h4 class="returnvalue">Return Value</h4>
1487<p class="description">Option value or <code>NULL</code></p>
1488<h3 class="function"><a name="cupsGetPPD">cupsGetPPD</a></h3>
1489<p class="description">Get the PPD file for a printer on the default server.</p>
1490<p class="code">
1491const char *cupsGetPPD (<br>
1492&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1493);</p>
1494<h4 class="parameters">Parameters</h4>
1495<dl>
1496<dt>name</dt>
568fa3fa 1497<dd class="description">Destination name</dd>
5a738aea
MS
1498</dl>
1499<h4 class="returnvalue">Return Value</h4>
1500<p class="description">Filename for PPD file</p>
1501<h4 class="discussion">Discussion</h4>
1502<p class="discussion">For classes, <code>cupsGetPPD</code> returns the PPD file for the first printer
568fa3fa
MS
1503in the class.<br>
1504<br>
1505The returned filename is stored in a static buffer and is overwritten with
4e6f60f0
MS
1506each call to <code>cupsGetPPD</code> or <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>. The caller &quot;owns&quot; the
1507file that is created and must <code>unlink</code> the returned filename.</p>
426c6a59 1508<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsGetPPD2">cupsGetPPD2</a></h3>
5a738aea
MS
1509<p class="description">Get the PPD file for a printer from the specified server.</p>
1510<p class="code">
1511const char *cupsGetPPD2 (<br>
1512&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1513&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1514);</p>
1515<h4 class="parameters">Parameters</h4>
1516<dl>
1517<dt>http</dt>
568fa3fa 1518<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1519<dt>name</dt>
568fa3fa 1520<dd class="description">Destination name</dd>
5a738aea
MS
1521</dl>
1522<h4 class="returnvalue">Return Value</h4>
1523<p class="description">Filename for PPD file</p>
1524<h4 class="discussion">Discussion</h4>
1525<p class="discussion">For classes, <code>cupsGetPPD2</code> returns the PPD file for the first printer
568fa3fa
MS
1526in the class.<br>
1527<br>
1528The returned filename is stored in a static buffer and is overwritten with
4e6f60f0
MS
1529each call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a> or <code>cupsGetPPD2</code>. The caller &quot;owns&quot; the
1530file that is created and must <code>unlink</code> the returned filename.
5a738aea
MS
1531
1532</p>
178cb736 1533<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsGetPPD3">cupsGetPPD3</a></h3>
5a738aea
MS
1534<p class="description">Get the PPD file for a printer on the specified
1535server if it has changed.</p>
1536<p class="code">
1537http_status_t cupsGetPPD3 (<br>
1538&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1539&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1540&nbsp;&nbsp;&nbsp;&nbsp;time_t *modtime,<br>
1541&nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>
1542&nbsp;&nbsp;&nbsp;&nbsp;size_t bufsize<br>
1543);</p>
1544<h4 class="parameters">Parameters</h4>
1545<dl>
1546<dt>http</dt>
1547<dd class="description">HTTP connection or <code>CUPS_HTTP_DEFAULT</code></dd>
1548<dt>name</dt>
568fa3fa 1549<dd class="description">Destination name</dd>
5a738aea
MS
1550<dt>modtime</dt>
1551<dd class="description">Modification time</dd>
1552<dt>buffer</dt>
1553<dd class="description">Filename buffer</dd>
1554<dt>bufsize</dt>
1555<dd class="description">Size of filename buffer</dd>
1556</dl>
1557<h4 class="returnvalue">Return Value</h4>
1558<p class="description">HTTP status</p>
1559<h4 class="discussion">Discussion</h4>
1560<p class="discussion">The &quot;modtime&quot; parameter contains the modification time of any
2e4ff8af 1561locally-cached content and is updated with the time from the PPD file on
5a738aea
MS
1562the server.<br>
1563<br>
1564The &quot;buffer&quot; parameter contains the local PPD filename. If it contains
2e4ff8af 1565the empty string, a new temporary file is created, otherwise the existing
4e6f60f0
MS
1566file will be overwritten as needed. The caller &quot;owns&quot; the file that is
1567created and must <code>unlink</code> the returned filename.<br>
5a738aea
MS
1568<br>
1569On success, <code>HTTP_OK</code> is returned for a new PPD file and
1570<code>HTTP_NOT_MODIFIED</code> if the existing PPD file is up-to-date. Any other
1571status is an error.<br>
1572<br>
1573For classes, <code>cupsGetPPD3</code> returns the PPD file for the first printer
568fa3fa
MS
1574in the class.
1575
1576</p>
5a738aea
MS
1577<h3 class="function"><a name="cupsGetPassword">cupsGetPassword</a></h3>
1578<p class="description">Get a password from the user.</p>
1579<p class="code">
1580const char *cupsGetPassword (<br>
1581&nbsp;&nbsp;&nbsp;&nbsp;const char *prompt<br>
1582);</p>
1583<h4 class="parameters">Parameters</h4>
1584<dl>
1585<dt>prompt</dt>
1586<dd class="description">Prompt string</dd>
1587</dl>
1588<h4 class="returnvalue">Return Value</h4>
1589<p class="description">Password</p>
1590<h4 class="discussion">Discussion</h4>
1591<p class="discussion">Uses the current password callback function. Returns <code>NULL</code> if the
aaf19ab0
MS
1592user does not provide a password.<br>
1593<br>
1594Note: The current password callback function is tracked separately for each
1595thread in a program. Multi-threaded programs that override the setting via
1596the <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a> or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a> functions need to
1597do so in each thread for the same function to be used.</p>
178cb736 1598<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsGetPassword2">cupsGetPassword2</a></h3>
f11a948a 1599<p class="description">Get a password from the user using the advanced
aaf19ab0 1600password callback.</p>
f11a948a
MS
1601<p class="code">
1602const char *cupsGetPassword2 (<br>
1603&nbsp;&nbsp;&nbsp;&nbsp;const char *prompt,<br>
1604&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1605&nbsp;&nbsp;&nbsp;&nbsp;const char *method,<br>
1606&nbsp;&nbsp;&nbsp;&nbsp;const char *resource<br>
1607);</p>
1608<h4 class="parameters">Parameters</h4>
1609<dl>
1610<dt>prompt</dt>
1611<dd class="description">Prompt string</dd>
1612<dt>http</dt>
1613<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1614<dt>method</dt>
1615<dd class="description">Request method (&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;)</dd>
1616<dt>resource</dt>
1617<dd class="description">Resource path</dd>
1618</dl>
1619<h4 class="returnvalue">Return Value</h4>
1620<p class="description">Password</p>
1621<h4 class="discussion">Discussion</h4>
1622<p class="discussion">Uses the current password callback function. Returns <code>NULL</code> if the
aaf19ab0
MS
1623user does not provide a password.<br>
1624<br>
1625Note: The current password callback function is tracked separately for each
1626thread in a program. Multi-threaded programs that override the setting via
1627the <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a> or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a> functions need to
1628do so in each thread for the same function to be used.
f11a948a
MS
1629
1630</p>
5a738aea
MS
1631<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetPrinters">cupsGetPrinters</a></h3>
1632<p class="description">Get a list of printers from the default server.</p>
1633<p class="code">
1634int cupsGetPrinters (<br>
1635&nbsp;&nbsp;&nbsp;&nbsp;char ***printers<br>
1636);</p>
1637<h4 class="parameters">Parameters</h4>
1638<dl>
1639<dt>printers</dt>
1640<dd class="description">Printers</dd>
1641</dl>
1642<h4 class="returnvalue">Return Value</h4>
1643<p class="description">Number of printers</p>
1644<h4 class="discussion">Discussion</h4>
1645<p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
1646
1647</p>
426c6a59 1648<h3 class="function"><span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span><a name="cupsGetServerPPD">cupsGetServerPPD</a></h3>
5a738aea
MS
1649<p class="description">Get an available PPD file from the server.</p>
1650<p class="code">
1651char *cupsGetServerPPD (<br>
1652&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1653&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1654);</p>
1655<h4 class="parameters">Parameters</h4>
1656<dl>
1657<dt>http</dt>
568fa3fa 1658<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1659<dt>name</dt>
1660<dd class="description">Name of PPD file (&quot;ppd-name&quot;)</dd>
1661</dl>
1662<h4 class="returnvalue">Return Value</h4>
1663<p class="description">Name of PPD file or <code>NULL</code> on error</p>
1664<h4 class="discussion">Discussion</h4>
1665<p class="discussion">This function returns the named PPD file from the server. The
1666list of available PPDs is provided by the IPP <code>CUPS_GET_PPDS</code>
1667operation.<br>
1668<br>
1669You must remove (unlink) the PPD file when you are finished with
bc44d920 1670it. The PPD filename is stored in a static location that will be
5a738aea
MS
1671overwritten on the next call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a>, <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>,
1672or <a href="#cupsGetServerPPD"><code>cupsGetServerPPD</code></a>.
1673
1674</p>
1675<h3 class="function"><a name="cupsLangDefault">cupsLangDefault</a></h3>
1676<p class="description">Return the default language.</p>
1677<p class="code">
1678cups_lang_t *cupsLangDefault (void);</p>
1679<h4 class="returnvalue">Return Value</h4>
1680<p class="description">Language data</p>
1681<h3 class="function"><a name="cupsLangEncoding">cupsLangEncoding</a></h3>
1682<p class="description">Return the character encoding (us-ascii, etc.)
1683for the given language.</p>
1684<p class="code">
1685const char *cupsLangEncoding (<br>
1686&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
1687);</p>
1688<h4 class="parameters">Parameters</h4>
1689<dl>
1690<dt>lang</dt>
1691<dd class="description">Language data</dd>
1692</dl>
1693<h4 class="returnvalue">Return Value</h4>
1694<p class="description">Character encoding</p>
1695<h3 class="function"><a name="cupsLangFlush">cupsLangFlush</a></h3>
1696<p class="description">Flush all language data out of the cache.</p>
1697<p class="code">
1698void cupsLangFlush (void);</p>
1699<h3 class="function"><a name="cupsLangFree">cupsLangFree</a></h3>
1700<p class="description">Free language data.</p>
1701<p class="code">
1702void cupsLangFree (<br>
1703&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
1704);</p>
1705<h4 class="parameters">Parameters</h4>
1706<dl>
1707<dt>lang</dt>
1708<dd class="description">Language to free</dd>
1709</dl>
1710<h4 class="discussion">Discussion</h4>
1711<p class="discussion">This does not actually free anything; use <a href="#cupsLangFlush"><code>cupsLangFlush</code></a> for that.</p>
1712<h3 class="function"><a name="cupsLangGet">cupsLangGet</a></h3>
1713<p class="description">Get a language.</p>
1714<p class="code">
1715cups_lang_t *cupsLangGet (<br>
1716&nbsp;&nbsp;&nbsp;&nbsp;const char *language<br>
1717);</p>
1718<h4 class="parameters">Parameters</h4>
1719<dl>
1720<dt>language</dt>
1721<dd class="description">Language or locale</dd>
1722</dl>
1723<h4 class="returnvalue">Return Value</h4>
1724<p class="description">Language data</p>
426c6a59 1725<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsNotifySubject">cupsNotifySubject</a></h3>
5a738aea
MS
1726<p class="description">Return the subject for the given notification message.</p>
1727<p class="code">
1728char *cupsNotifySubject (<br>
1729&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
1730&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
1731);</p>
1732<h4 class="parameters">Parameters</h4>
1733<dl>
1734<dt>lang</dt>
1735<dd class="description">Language data</dd>
1736<dt>event</dt>
1737<dd class="description">Event data</dd>
1738</dl>
1739<h4 class="returnvalue">Return Value</h4>
1740<p class="description">Subject string or <code>NULL</code></p>
1741<h4 class="discussion">Discussion</h4>
568fa3fa 1742<p class="discussion">The returned string must be freed by the caller using <code>free</code>.
5a738aea
MS
1743
1744</p>
426c6a59 1745<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsNotifyText">cupsNotifyText</a></h3>
5a738aea
MS
1746<p class="description">Return the text for the given notification message.</p>
1747<p class="code">
1748char *cupsNotifyText (<br>
1749&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
1750&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
1751);</p>
1752<h4 class="parameters">Parameters</h4>
1753<dl>
1754<dt>lang</dt>
1755<dd class="description">Language data</dd>
1756<dt>event</dt>
1757<dd class="description">Event data</dd>
1758</dl>
1759<h4 class="returnvalue">Return Value</h4>
1760<p class="description">Message text or <code>NULL</code></p>
1761<h4 class="discussion">Discussion</h4>
1762<p class="discussion">The returned string must be freed by the caller using <code>free</code>.
1763
1764</p>
1765<h3 class="function"><a name="cupsParseOptions">cupsParseOptions</a></h3>
1766<p class="description">Parse options from a command-line argument.</p>
1767<p class="code">
1768int cupsParseOptions (<br>
1769&nbsp;&nbsp;&nbsp;&nbsp;const char *arg,<br>
1770&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1771&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
1772);</p>
1773<h4 class="parameters">Parameters</h4>
1774<dl>
1775<dt>arg</dt>
1776<dd class="description">Argument to parse</dd>
1777<dt>num_options</dt>
1778<dd class="description">Number of options</dd>
1779<dt>options</dt>
1780<dd class="description">Options found</dd>
1781</dl>
1782<h4 class="returnvalue">Return Value</h4>
1783<p class="description">Number of options found</p>
1784<h4 class="discussion">Discussion</h4>
1785<p class="discussion">This function converts space-delimited name/value pairs according
ef416fc2 1786to the PAPI text option ABNF specification. Collection values
1787(&quot;name={a=... b=... c=...}&quot;) are stored with the curley brackets
5a738aea
MS
1788intact - use <code>cupsParseOptions</code> on the value to extract the
1789collection attributes.</p>
1790<h3 class="function"><a name="cupsPrintFile">cupsPrintFile</a></h3>
1791<p class="description">Print a file to a printer or class on the default server.</p>
1792<p class="code">
1793int cupsPrintFile (<br>
1794&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1795&nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
1796&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1797&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1798&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1799);</p>
1800<h4 class="parameters">Parameters</h4>
1801<dl>
1802<dt>name</dt>
568fa3fa 1803<dd class="description">Destination name</dd>
5a738aea
MS
1804<dt>filename</dt>
1805<dd class="description">File to print</dd>
1806<dt>title</dt>
1807<dd class="description">Title of job</dd>
1808<dt>num_options</dt>
1809<dd class="description">Number of options</dd>
1810<dt>options</dt>
1811<dd class="description">Options</dd>
1812</dl>
1813<h4 class="returnvalue">Return Value</h4>
1814<p class="description">Job ID or 0 on error</p>
426c6a59 1815<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsPrintFile2">cupsPrintFile2</a></h3>
5a738aea
MS
1816<p class="description">Print a file to a printer or class on the specified
1817server.</p>
1818<p class="code">
1819int cupsPrintFile2 (<br>
1820&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1821&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1822&nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
1823&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1824&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1825&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1826);</p>
1827<h4 class="parameters">Parameters</h4>
1828<dl>
1829<dt>http</dt>
568fa3fa 1830<dd class="description">Connection to server</dd>
5a738aea 1831<dt>name</dt>
568fa3fa 1832<dd class="description">Destination name</dd>
5a738aea
MS
1833<dt>filename</dt>
1834<dd class="description">File to print</dd>
1835<dt>title</dt>
1836<dd class="description">Title of job</dd>
1837<dt>num_options</dt>
1838<dd class="description">Number of options</dd>
1839<dt>options</dt>
1840<dd class="description">Options</dd>
1841</dl>
1842<h4 class="returnvalue">Return Value</h4>
1843<p class="description">Job ID or 0 on error</p>
1844<h3 class="function"><a name="cupsPrintFiles">cupsPrintFiles</a></h3>
1845<p class="description">Print one or more files to a printer or class on the
1846default server.</p>
1847<p class="code">
1848int cupsPrintFiles (<br>
1849&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1850&nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
1851&nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
1852&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1853&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1854&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1855);</p>
1856<h4 class="parameters">Parameters</h4>
1857<dl>
1858<dt>name</dt>
568fa3fa 1859<dd class="description">Destination name</dd>
5a738aea
MS
1860<dt>num_files</dt>
1861<dd class="description">Number of files</dd>
1862<dt>files</dt>
1863<dd class="description">File(s) to print</dd>
1864<dt>title</dt>
1865<dd class="description">Title of job</dd>
1866<dt>num_options</dt>
1867<dd class="description">Number of options</dd>
1868<dt>options</dt>
1869<dd class="description">Options</dd>
1870</dl>
1871<h4 class="returnvalue">Return Value</h4>
1872<p class="description">Job ID or 0 on error</p>
426c6a59 1873<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsPrintFiles2">cupsPrintFiles2</a></h3>
5a738aea
MS
1874<p class="description">Print one or more files to a printer or class on the
1875specified server.</p>
1876<p class="code">
1877int cupsPrintFiles2 (<br>
1878&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1879&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1880&nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
1881&nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
1882&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1883&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1884&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1885);</p>
1886<h4 class="parameters">Parameters</h4>
1887<dl>
1888<dt>http</dt>
568fa3fa 1889<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1890<dt>name</dt>
568fa3fa 1891<dd class="description">Destination name</dd>
5a738aea
MS
1892<dt>num_files</dt>
1893<dd class="description">Number of files</dd>
1894<dt>files</dt>
1895<dd class="description">File(s) to print</dd>
1896<dt>title</dt>
1897<dd class="description">Title of job</dd>
1898<dt>num_options</dt>
1899<dd class="description">Number of options</dd>
1900<dt>options</dt>
1901<dd class="description">Options</dd>
1902</dl>
1903<h4 class="returnvalue">Return Value</h4>
1904<p class="description">Job ID or 0 on error</p>
426c6a59 1905<h3 class="function"><span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span><a name="cupsRemoveDest">cupsRemoveDest</a></h3>
5a738aea
MS
1906<p class="description">Remove a destination from the destination list.</p>
1907<p class="code">
1908int cupsRemoveDest (<br>
1909&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1910&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1911&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1912&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1913);</p>
1914<h4 class="parameters">Parameters</h4>
1915<dl>
1916<dt>name</dt>
1917<dd class="description">Destination name</dd>
1918<dt>instance</dt>
1919<dd class="description">Instance name or <code>NULL</code></dd>
1920<dt>num_dests</dt>
1921<dd class="description">Number of destinations</dd>
1922<dt>dests</dt>
1923<dd class="description">Destinations</dd>
1924</dl>
1925<h4 class="returnvalue">Return Value</h4>
1926<p class="description">New number of destinations</p>
1927<h4 class="discussion">Discussion</h4>
1928<p class="discussion">Removing a destination/instance does not delete the class or printer
f7deaa1a 1929queue, merely the lpoptions for that destination/instance. Use the
5a738aea
MS
1930<a href="#cupsSetDests"><code>cupsSetDests</code></a> or <a href="#cupsSetDests2"><code>cupsSetDests2</code></a> functions to save the new
1931options for the user.
1932
1933</p>
426c6a59 1934<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsRemoveOption">cupsRemoveOption</a></h3>
5a738aea
MS
1935<p class="description">Remove an option from an option array.</p>
1936<p class="code">
1937int cupsRemoveOption (<br>
1938&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1939&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1940&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
1941);</p>
1942<h4 class="parameters">Parameters</h4>
1943<dl>
1944<dt>name</dt>
1945<dd class="description">Option name</dd>
1946<dt>num_options</dt>
1947<dd class="description">Current number of options</dd>
1948<dt>options</dt>
1949<dd class="description">Options</dd>
1950</dl>
1951<h4 class="returnvalue">Return Value</h4>
1952<p class="description">New number of options</p>
1953<h3 class="function"><a name="cupsServer">cupsServer</a></h3>
aaf19ab0 1954<p class="description">Return the hostname/address of the current server.</p>
5a738aea
MS
1955<p class="code">
1956const char *cupsServer (void);</p>
1957<h4 class="returnvalue">Return Value</h4>
1958<p class="description">Server name</p>
1959<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
1960<p class="discussion">The default server comes from the CUPS_SERVER environment variable, then the
1961~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
1962set, the default is the local system - either &quot;localhost&quot; or a domain socket
1963path.<br>
1964<br>
1965The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
1966address, or a domain socket pathname.<br>
1967<br>
1968Note: The current server is tracked separately for each thread in a program.
1969Multi-threaded programs that override the server via the
1970<a href="#cupsSetServer"><code>cupsSetServer</code></a> function need to do so in each thread for the same
1971server to be used.</p>
10d09e33
MS
1972<h3 class="function"><span class="info">&nbsp;CUPS 1.5&nbsp;</span><a name="cupsSetClientCertCB">cupsSetClientCertCB</a></h3>
1973<p class="description">Set the client certificate callback.</p>
1974<p class="code">
1975void cupsSetClientCertCB (<br>
1976&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_client_cert_cb_t">cups_client_cert_cb_t</a> cb,<br>
1977&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
1978);</p>
1979<h4 class="parameters">Parameters</h4>
1980<dl>
1981<dt>cb</dt>
1982<dd class="description">Callback function</dd>
1983<dt>user_data</dt>
1984<dd class="description">User data pointer</dd>
1985</dl>
1986<h4 class="discussion">Discussion</h4>
1987<p class="discussion">Pass <code>NULL</code> to restore the default callback.<br>
1988<br>
1989Note: The current certificate callback is tracked separately for each thread
1990in a program. Multi-threaded programs that override the callback need to do
1991so in each thread for the same callback to be used.
1992
1993</p>
1994<h3 class="function"><span class="info">&nbsp;CUPS 1.5&nbsp;</span><a name="cupsSetCredentials">cupsSetCredentials</a></h3>
1995<p class="description">Set the default credentials to be used for SSL/TLS
1996connections.</p>
1997<p class="code">
1998int cupsSetCredentials (<br>
1999&nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *credentials<br>
2000);</p>
2001<h4 class="parameters">Parameters</h4>
2002<dl>
2003<dt>credentials</dt>
2004<dd class="description">Array of credentials</dd>
2005</dl>
2006<h4 class="returnvalue">Return Value</h4>
2007<p class="description">Status of call (0 = success)</p>
2008<h4 class="discussion">Discussion</h4>
2009<p class="discussion">Note: The default credentials are tracked separately for each thread in a
2010program. Multi-threaded programs that override the setting need to do so in
2011each thread for the same setting to be used.
2012
2013</p>
426c6a59 2014<h3 class="function"><span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span><a name="cupsSetDefaultDest">cupsSetDefaultDest</a></h3>
5a738aea
MS
2015<p class="description">Set the default destination.</p>
2016<p class="code">
2017void cupsSetDefaultDest (<br>
2018&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2019&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
2020&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2021&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2022);</p>
2023<h4 class="parameters">Parameters</h4>
2024<dl>
2025<dt>name</dt>
2026<dd class="description">Destination name</dd>
2027<dt>instance</dt>
2028<dd class="description">Instance name or <code>NULL</code></dd>
2029<dt>num_dests</dt>
2030<dd class="description">Number of destinations</dd>
2031<dt>dests</dt>
2032<dd class="description">Destinations</dd>
2033</dl>
2034<h3 class="function"><a name="cupsSetDests">cupsSetDests</a></h3>
2035<p class="description">Save the list of destinations for the default server.</p>
2036<p class="code">
2037void cupsSetDests (<br>
2038&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2039&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2040);</p>
2041<h4 class="parameters">Parameters</h4>
2042<dl>
2043<dt>num_dests</dt>
2044<dd class="description">Number of destinations</dd>
2045<dt>dests</dt>
2046<dd class="description">Destinations</dd>
2047</dl>
2048<h4 class="discussion">Discussion</h4>
2049<p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
2050as root and ~/.cups/lpoptions when run as a normal user.</p>
426c6a59 2051<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/Mac OS X 10.4&nbsp;</span><a name="cupsSetDests2">cupsSetDests2</a></h3>
5a738aea
MS
2052<p class="description">Save the list of destinations for the specified server.</p>
2053<p class="code">
2054int cupsSetDests2 (<br>
2055&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2056&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2057&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2058);</p>
2059<h4 class="parameters">Parameters</h4>
2060<dl>
2061<dt>http</dt>
568fa3fa 2062<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
2063<dt>num_dests</dt>
2064<dd class="description">Number of destinations</dd>
2065<dt>dests</dt>
2066<dd class="description">Destinations</dd>
2067</dl>
2068<h4 class="returnvalue">Return Value</h4>
2069<p class="description">0 on success, -1 on error</p>
2070<h4 class="discussion">Discussion</h4>
2071<p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
80ca4592 2072as root and ~/.cups/lpoptions when run as a normal user.
ef416fc2 2073
5a738aea
MS
2074</p>
2075<h3 class="function"><a name="cupsSetEncryption">cupsSetEncryption</a></h3>
2076<p class="description">Set the encryption preference.</p>
2077<p class="code">
2078void cupsSetEncryption (<br>
2079&nbsp;&nbsp;&nbsp;&nbsp;http_encryption_t e<br>
2080);</p>
2081<h4 class="parameters">Parameters</h4>
2082<dl>
2083<dt>e</dt>
2084<dd class="description">New encryption preference</dd>
2085</dl>
aaf19ab0
MS
2086<h4 class="discussion">Discussion</h4>
2087<p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
2088environment variable, then the ~/.cups/client.conf file, and finally the
2089/etc/cups/client.conf file. If not set, the default is
2090<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
2091<br>
2092Note: The current encryption setting is tracked separately for each thread
2093in a program. Multi-threaded programs that override the setting need to do
2094so in each thread for the same setting to be used.</p>
5a738aea
MS
2095<h3 class="function"><a name="cupsSetPasswordCB">cupsSetPasswordCB</a></h3>
2096<p class="description">Set the password callback for CUPS.</p>
2097<p class="code">
2098void cupsSetPasswordCB (<br>
2099&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_password_cb_t">cups_password_cb_t</a> cb<br>
2100);</p>
2101<h4 class="parameters">Parameters</h4>
2102<dl>
2103<dt>cb</dt>
2104<dd class="description">Callback function</dd>
2105</dl>
2106<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2107<p class="discussion">Pass <code>NULL</code> to restore the default (console) password callback, which
2108reads the password from the console. Programs should call either this
2109function or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a>, as only one callback can be registered
2110by a program per thread.<br>
2111<br>
2112Note: The current password callback is tracked separately for each thread
2113in a program. Multi-threaded programs that override the callback need to do
2114so in each thread for the same callback to be used.</p>
178cb736 2115<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsSetPasswordCB2">cupsSetPasswordCB2</a></h3>
f11a948a
MS
2116<p class="description">Set the advanced password callback for CUPS.</p>
2117<p class="code">
2118void cupsSetPasswordCB2 (<br>
2119&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_password_cb2_t">cups_password_cb2_t</a> cb,<br>
2120&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
2121);</p>
2122<h4 class="parameters">Parameters</h4>
2123<dl>
2124<dt>cb</dt>
2125<dd class="description">Callback function</dd>
2126<dt>user_data</dt>
2127<dd class="description">User data pointer</dd>
2128</dl>
2129<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2130<p class="discussion">Pass <code>NULL</code> to restore the default (console) password callback, which
2131reads the password from the console. Programs should call either this
2132function or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a>, as only one callback can be registered
2133by a program per thread.<br>
2134<br>
2135Note: The current password callback is tracked separately for each thread
2136in a program. Multi-threaded programs that override the callback need to do
2137so in each thread for the same callback to be used.
f11a948a
MS
2138
2139</p>
5a738aea 2140<h3 class="function"><a name="cupsSetServer">cupsSetServer</a></h3>
aaf19ab0 2141<p class="description">Set the default server name and port.</p>
5a738aea
MS
2142<p class="code">
2143void cupsSetServer (<br>
2144&nbsp;&nbsp;&nbsp;&nbsp;const char *server<br>
2145);</p>
2146<h4 class="parameters">Parameters</h4>
2147<dl>
2148<dt>server</dt>
2149<dd class="description">Server name</dd>
2150</dl>
2151<h4 class="discussion">Discussion</h4>
2152<p class="discussion">The &quot;server&quot; string can be a fully-qualified hostname, a numeric
aaf19ab0
MS
2153IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
2154addresses can be optionally followed by a colon and port number to override
2155the default port 631, e.g. &quot;hostname:8631&quot;. Pass <code>NULL</code> to restore the
2156default server name and port.<br>
2157<br>
2158Note: The current server is tracked separately for each thread in a program.
2159Multi-threaded programs that override the server need to do so in each
2160thread for the same server to be used.</p>
10d09e33
MS
2161<h3 class="function"><span class="info">&nbsp;CUPS 1.5&nbsp;</span><a name="cupsSetServerCertCB">cupsSetServerCertCB</a></h3>
2162<p class="description">Set the server certificate callback.</p>
2163<p class="code">
2164void cupsSetServerCertCB (<br>
2165&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_server_cert_cb_t">cups_server_cert_cb_t</a> cb,<br>
2166&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
2167);</p>
2168<h4 class="parameters">Parameters</h4>
2169<dl>
2170<dt>cb</dt>
2171<dd class="description">Callback function</dd>
2172<dt>user_data</dt>
2173<dd class="description">User data pointer</dd>
2174</dl>
2175<h4 class="discussion">Discussion</h4>
2176<p class="discussion">Pass <code>NULL</code> to restore the default callback.<br>
2177<br>
2178Note: The current credentials callback is tracked separately for each thread
2179in a program. Multi-threaded programs that override the callback need to do
2180so in each thread for the same callback to be used.
2181
2182</p>
5a738aea
MS
2183<h3 class="function"><a name="cupsSetUser">cupsSetUser</a></h3>
2184<p class="description">Set the default user name.</p>
2185<p class="code">
2186void cupsSetUser (<br>
2187&nbsp;&nbsp;&nbsp;&nbsp;const char *user<br>
2188);</p>
2189<h4 class="parameters">Parameters</h4>
2190<dl>
2191<dt>user</dt>
2192<dd class="description">User name</dd>
2193</dl>
2194<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2195<p class="discussion">Pass <code>NULL</code> to restore the default user name.<br>
2196<br>
2197Note: The current user name is tracked separately for each thread in a
2198program. Multi-threaded programs that override the user name need to do so
2199in each thread for the same user name to be used.</p>
178cb736 2200<h3 class="function"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cupsStartDocument">cupsStartDocument</a></h3>
5a738aea
MS
2201<p class="description">Add a document to a job created with cupsCreateJob().</p>
2202<p class="code">
2203http_status_t cupsStartDocument (<br>
2204&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2205&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2206&nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
2207&nbsp;&nbsp;&nbsp;&nbsp;const char *docname,<br>
2208&nbsp;&nbsp;&nbsp;&nbsp;const char *format,<br>
2209&nbsp;&nbsp;&nbsp;&nbsp;int last_document<br>
2210);</p>
2211<h4 class="parameters">Parameters</h4>
2212<dl>
2213<dt>http</dt>
568fa3fa 2214<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 2215<dt>name</dt>
568fa3fa 2216<dd class="description">Destination name</dd>
5a738aea
MS
2217<dt>job_id</dt>
2218<dd class="description">Job ID from <a href="#cupsCreateJob"><code>cupsCreateJob</code></a></dd>
2219<dt>docname</dt>
2220<dd class="description">Name of document</dd>
2221<dt>format</dt>
2222<dd class="description">MIME type or <code>CUPS_FORMAT_foo</code></dd>
2223<dt>last_document</dt>
2224<dd class="description">1 for last document in job, 0 otherwise</dd>
2225</dl>
2226<h4 class="returnvalue">Return Value</h4>
2227<p class="description">HTTP status of request</p>
2228<h4 class="discussion">Discussion</h4>
2229<p class="discussion">Use <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a> to write data for the document and
2230<a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> to finish the document and get the submission status.<br>
2231<br>
2232The MIME type constants <code>CUPS_FORMAT_AUTO</code>, <code>CUPS_FORMAT_PDF</code>,
2233<code>CUPS_FORMAT_POSTSCRIPT</code>, <code>CUPS_FORMAT_RAW</code>, and
2234<code>CUPS_FORMAT_TEXT</code> are provided for the &quot;format&quot; argument, although
2235any supported MIME type string can be supplied.
bc44d920 2236
5a738aea
MS
2237</p>
2238<h3 class="function"><a name="cupsTempFd">cupsTempFd</a></h3>
2239<p class="description">Creates a temporary file.</p>
2240<p class="code">
2241int cupsTempFd (<br>
2242&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2243&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2244);</p>
2245<h4 class="parameters">Parameters</h4>
2246<dl>
2247<dt>filename</dt>
2248<dd class="description">Pointer to buffer</dd>
2249<dt>len</dt>
2250<dd class="description">Size of buffer</dd>
2251</dl>
2252<h4 class="returnvalue">Return Value</h4>
2253<p class="description">New file descriptor or -1 on error</p>
2254<h4 class="discussion">Discussion</h4>
2255<p class="discussion">The temporary filename is returned in the filename buffer.
2256The temporary file is opened for reading and writing.</p>
2257<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsTempFile">cupsTempFile</a></h3>
2258<p class="description">Generates a temporary filename.</p>
2259<p class="code">
2260char *cupsTempFile (<br>
2261&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2262&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2263);</p>
2264<h4 class="parameters">Parameters</h4>
2265<dl>
2266<dt>filename</dt>
2267<dd class="description">Pointer to buffer</dd>
2268<dt>len</dt>
2269<dd class="description">Size of buffer</dd>
2270</dl>
2271<h4 class="returnvalue">Return Value</h4>
568fa3fa 2272<p class="description">Filename or <code>NULL</code> on error</p>
5a738aea
MS
2273<h4 class="discussion">Discussion</h4>
2274<p class="discussion">The temporary filename is returned in the filename buffer.
2275This function is deprecated - use <a href="#cupsTempFd"><code>cupsTempFd</code></a> or
2276<a href="#cupsTempFile2"><code>cupsTempFile2</code></a> instead.
ef416fc2 2277
5a738aea 2278</p>
426c6a59 2279<h3 class="function"><span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span><a name="cupsTempFile2">cupsTempFile2</a></h3>
5a738aea
MS
2280<p class="description">Creates a temporary CUPS file.</p>
2281<p class="code">
2282cups_file_t *cupsTempFile2 (<br>
2283&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2284&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2285);</p>
2286<h4 class="parameters">Parameters</h4>
2287<dl>
2288<dt>filename</dt>
2289<dd class="description">Pointer to buffer</dd>
2290<dt>len</dt>
2291<dd class="description">Size of buffer</dd>
2292</dl>
2293<h4 class="returnvalue">Return Value</h4>
568fa3fa 2294<p class="description">CUPS file or <code>NULL</code> on error</p>
5a738aea
MS
2295<h4 class="discussion">Discussion</h4>
2296<p class="discussion">The temporary filename is returned in the filename buffer.
2297The temporary file is opened for writing.
bc44d920 2298
5a738aea
MS
2299</p>
2300<h3 class="function"><a name="cupsUser">cupsUser</a></h3>
2301<p class="description">Return the current user's name.</p>
2302<p class="code">
2303const char *cupsUser (void);</p>
2304<h4 class="returnvalue">Return Value</h4>
2305<p class="description">User name</p>
aaf19ab0
MS
2306<h4 class="discussion">Discussion</h4>
2307<p class="discussion">Note: The current user name is tracked separately for each thread in a
2308program. Multi-threaded programs that override the user name with the
2309<a href="#cupsSetUser"><code>cupsSetUser</code></a> function need to do so in each thread for the same user
2310name to be used.</p>
5a738aea 2311<h2 class="title"><a name="TYPES">Data Types</a></h2>
10d09e33
MS
2312<h3 class="typedef"><span class="info">&nbsp;CUPS 1.5&nbsp;</span><a name="cups_client_cert_cb_t">cups_client_cert_cb_t</a></h3>
2313<p class="description">Client credentials callback </p>
2314<p class="code">
2315typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
2316</p>
5a738aea
MS
2317<h3 class="typedef"><a name="cups_dest_t">cups_dest_t</a></h3>
2318<p class="description">Destination</p>
2319<p class="code">
2320typedef struct <a href="#cups_dest_s">cups_dest_s</a> cups_dest_t;
2321</p>
178cb736 2322<h3 class="typedef"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cups_device_cb_t">cups_device_cb_t</a></h3>
ae71f5de
MS
2323<p class="description">Device callback </p>
2324<p class="code">
06d4e77b 2325typedef void (*cups_device_cb_t)(const char *device_class, const char *device_id, const char *device_info, const char *device_make_and_model, const char *device_uri, const char *device_location, void *user_data);
ae71f5de 2326</p>
5a738aea
MS
2327<h3 class="typedef"><a name="cups_job_t">cups_job_t</a></h3>
2328<p class="description">Job</p>
2329<p class="code">
2330typedef struct <a href="#cups_job_s">cups_job_s</a> cups_job_t;
2331</p>
2332<h3 class="typedef"><a name="cups_option_t">cups_option_t</a></h3>
2333<p class="description">Printer Options</p>
2334<p class="code">
2335typedef struct <a href="#cups_option_s">cups_option_s</a> cups_option_t;
2336</p>
178cb736 2337<h3 class="typedef"><span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span><a name="cups_password_cb2_t">cups_password_cb2_t</a></h3>
f11a948a
MS
2338<p class="description">New password callback </p>
2339<p class="code">
2340typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
2341</p>
5a738aea
MS
2342<h3 class="typedef"><a name="cups_password_cb_t">cups_password_cb_t</a></h3>
2343<p class="description">Password callback</p>
2344<p class="code">
ae71f5de 2345typedef const char *(*cups_password_cb_t)(const char *prompt);
5a738aea
MS
2346</p>
2347<h3 class="typedef"><a name="cups_ptype_t">cups_ptype_t</a></h3>
2348<p class="description">Printer type/capability bits</p>
2349<p class="code">
ef416fc2 2350typedef unsigned cups_ptype_t;
5a738aea 2351</p>
10d09e33
MS
2352<h3 class="typedef"><span class="info">&nbsp;CUPS 1.5&nbsp;</span><a name="cups_server_cert_cb_t">cups_server_cert_cb_t</a></h3>
2353<p class="description">Server credentials callback </p>
2354<p class="code">
2355typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
2356</p>
5a738aea
MS
2357<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
2358<h3 class="struct"><a name="cups_dest_s">cups_dest_s</a></h3>
2359<p class="description">Destination</p>
2360<p class="code">struct cups_dest_s {<br>
2361&nbsp;&nbsp;&nbsp;&nbsp;char *name, *instance;<br>
2362&nbsp;&nbsp;&nbsp;&nbsp;int is_default;<br>
2363&nbsp;&nbsp;&nbsp;&nbsp;int num_options;<br>
2364&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options;<br>
2365};</p>
2366<h4 class="members">Members</h4>
2367<dl>
2368<dt>instance </dt>
2369<dd class="description">Local instance name or NULL</dd>
2370<dt>is_default </dt>
2371<dd class="description">Is this printer the default?</dd>
2372<dt>num_options </dt>
2373<dd class="description">Number of options</dd>
2374<dt>options </dt>
2375<dd class="description">Options</dd>
2376</dl>
2377<h3 class="struct"><a name="cups_job_s">cups_job_s</a></h3>
2378<p class="description">Job</p>
2379<p class="code">struct cups_job_s {<br>
2380&nbsp;&nbsp;&nbsp;&nbsp;time_t completed_time;<br>
2381&nbsp;&nbsp;&nbsp;&nbsp;time_t creation_time;<br>
2382&nbsp;&nbsp;&nbsp;&nbsp;char *dest;<br>
2383&nbsp;&nbsp;&nbsp;&nbsp;char *format;<br>
2384&nbsp;&nbsp;&nbsp;&nbsp;int id;<br>
2385&nbsp;&nbsp;&nbsp;&nbsp;int priority;<br>
2386&nbsp;&nbsp;&nbsp;&nbsp;time_t processing_time;<br>
2387&nbsp;&nbsp;&nbsp;&nbsp;int size;<br>
2388&nbsp;&nbsp;&nbsp;&nbsp;ipp_jstate_t state;<br>
2389&nbsp;&nbsp;&nbsp;&nbsp;char *title;<br>
2390&nbsp;&nbsp;&nbsp;&nbsp;char *user;<br>
2391};</p>
2392<h4 class="members">Members</h4>
2393<dl>
2394<dt>completed_time </dt>
2395<dd class="description">Time the job was completed</dd>
2396<dt>creation_time </dt>
2397<dd class="description">Time the job was created</dd>
2398<dt>dest </dt>
2399<dd class="description">Printer or class name</dd>
2400<dt>format </dt>
2401<dd class="description">Document format</dd>
2402<dt>id </dt>
2403<dd class="description">The job ID</dd>
2404<dt>priority </dt>
2405<dd class="description">Priority (1-100)</dd>
2406<dt>processing_time </dt>
2407<dd class="description">Time the job was processed</dd>
2408<dt>size </dt>
2409<dd class="description">Size in kilobytes</dd>
2410<dt>state </dt>
2411<dd class="description">Job state</dd>
2412<dt>title </dt>
2413<dd class="description">Title/job name</dd>
2414<dt>user </dt>
2415<dd class="description">User the submitted the job</dd>
2416</dl>
2417<h3 class="struct"><a name="cups_option_s">cups_option_s</a></h3>
2418<p class="description">Printer Options</p>
2419<p class="code">struct cups_option_s {<br>
2420&nbsp;&nbsp;&nbsp;&nbsp;char *name;<br>
2421&nbsp;&nbsp;&nbsp;&nbsp;char *value;<br>
2422};</p>
2423<h4 class="members">Members</h4>
2424<dl>
2425<dt>name </dt>
2426<dd class="description">Name of option</dd>
2427<dt>value </dt>
2428<dd class="description">Value of option</dd>
2429</dl>
2430<h2 class="title"><a name="ENUMERATIONS">Constants</a></h2>
2431<h3 class="enumeration"><a name="cups_ptype_e">cups_ptype_e</a></h3>
2432<p class="description">Printer type/capability bit constants</p>
2433<h4 class="constants">Constants</h4>
2434<dl>
426c6a59 2435<dt>CUPS_PRINTER_AUTHENTICATED <span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span></dt>
5a738aea
MS
2436<dd class="description">Printer requires authentication </dd>
2437<dt>CUPS_PRINTER_BIND </dt>
2438<dd class="description">Can bind output</dd>
2439<dt>CUPS_PRINTER_BW </dt>
2440<dd class="description">Can do B&amp;W printing</dd>
2441<dt>CUPS_PRINTER_CLASS </dt>
2442<dd class="description">Printer class</dd>
2443<dt>CUPS_PRINTER_COLLATE </dt>
2444<dd class="description">Can collage copies</dd>
2445<dt>CUPS_PRINTER_COLOR </dt>
2446<dd class="description">Can do color printing</dd>
426c6a59 2447<dt>CUPS_PRINTER_COMMANDS <span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span></dt>
5a738aea
MS
2448<dd class="description">Printer supports maintenance commands </dd>
2449<dt>CUPS_PRINTER_COPIES </dt>
2450<dd class="description">Can do copies</dd>
2451<dt>CUPS_PRINTER_COVER </dt>
2452<dd class="description">Can cover output</dd>
2453<dt>CUPS_PRINTER_DEFAULT </dt>
2454<dd class="description">Default printer on network</dd>
426c6a59 2455<dt>CUPS_PRINTER_DELETE <span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span></dt>
5a738aea 2456<dd class="description">Delete printer </dd>
426c6a59 2457<dt>CUPS_PRINTER_DISCOVERED <span class="info">&nbsp;CUPS 1.3/Mac OS X 10.5&nbsp;</span></dt>
5a738aea
MS
2458<dd class="description">Printer was automatically discovered and added </dd>
2459<dt>CUPS_PRINTER_DUPLEX </dt>
2460<dd class="description">Can do duplexing</dd>
2461<dt>CUPS_PRINTER_FAX </dt>
2462<dd class="description">Fax queue</dd>
2463<dt>CUPS_PRINTER_IMPLICIT </dt>
2464<dd class="description">Implicit class</dd>
2465<dt>CUPS_PRINTER_LARGE </dt>
2466<dd class="description">Can do D/E/A1/A0</dd>
2467<dt>CUPS_PRINTER_LOCAL </dt>
2468<dd class="description">Local printer or class</dd>
2469<dt>CUPS_PRINTER_MEDIUM </dt>
2470<dd class="description">Can do Tabloid/B/C/A3/A2</dd>
178cb736 2471<dt>CUPS_PRINTER_MFP <span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span></dt>
f11a948a 2472<dd class="description">Printer with scanning capabilities </dd>
426c6a59 2473<dt>CUPS_PRINTER_NOT_SHARED <span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span></dt>
5a738aea
MS
2474<dd class="description">Printer is not shared </dd>
2475<dt>CUPS_PRINTER_PUNCH </dt>
2476<dd class="description">Can punch output</dd>
2477<dt>CUPS_PRINTER_REJECTING </dt>
2478<dd class="description">Printer is rejecting jobs</dd>
2479<dt>CUPS_PRINTER_REMOTE </dt>
2480<dd class="description">Remote printer or class</dd>
178cb736 2481<dt>CUPS_PRINTER_SCANNER <span class="info">&nbsp;CUPS 1.4/Mac OS X 10.6&nbsp;</span></dt>
f11a948a 2482<dd class="description">Scanner-only device </dd>
5a738aea
MS
2483<dt>CUPS_PRINTER_SMALL </dt>
2484<dd class="description">Can do Letter/Legal/A4</dd>
2485<dt>CUPS_PRINTER_SORT </dt>
2486<dd class="description">Can sort output</dd>
2487<dt>CUPS_PRINTER_STAPLE </dt>
2488<dd class="description">Can staple output</dd>
2489<dt>CUPS_PRINTER_VARIABLE </dt>
2490<dd class="description">Can do variable sizes</dd>
2491</dl>
2492</div>
ef416fc2 2493</body>
2494</html>