]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/api-cups.html
Merge changes from CUPS 1.7svn-r10814.
[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>
0268488e
MS
5 <title>CUPS API </title>
6 <meta name="keywords" content="Programming">
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
8 <meta name="creator" content="Mini-XML v2.7">
5a738aea
MS
9<style type="text/css"><!--
10BODY {
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
12}
13
14H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
16}
17
18KBD {
19 font-family: monaco, courier, monospace;
20 font-weight: bold;
21}
22
23PRE {
24 font-family: monaco, courier, monospace;
25}
26
27PRE.command {
10d09e33 28 border: dotted thin #7f7f7f;
5a738aea 29 margin-left: 36pt;
10d09e33 30 padding: 10px;
5a738aea
MS
31}
32
f11a948a
MS
33P.compact {
34 margin: 0;
35}
36
e4572d57
MS
37P.example {
38 font-style: italic;
39 margin-left: 36pt;
40}
41
5a738aea
MS
42PRE.example {
43 background: #eeeeee;
44 border: dotted thin #999999;
45 margin-left: 36pt;
178cb736 46 padding: 10pt;
5a738aea
MS
47}
48
49PRE.command EM, PRE.example EM {
50 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
51}
52
53P.command {
54 font-family: monaco, courier, monospace;
55 margin-left: 36pt;
56}
57
58P.formula {
59 font-style: italic;
60 margin-left: 36pt;
61}
62
63BLOCKQUOTE {
178cb736 64 background: #eeeeee;
5a738aea
MS
65 border: solid thin #999999;
66 padding: 10pt;
67}
68
e4572d57
MS
69A IMG {
70 border: none;
71}
72
73A:link:hover IMG {
74 background: #f0f0f0;
75 border-radius: 10px;
76 -moz-border-radius: 10px;
77}
78
5a738aea 79A:link, A:visited {
568fa3fa 80 font-weight: normal;
5a738aea 81 text-decoration: none;
5a738aea
MS
82}
83
84A:link:hover, A:visited:hover, A:active {
85 text-decoration: underline;
5a738aea
MS
86}
87
88SUB, SUP {
89 font-size: 50%;
90}
91
e4572d57
MS
92TR.data, TD.data, TR.data TD {
93 margin-top: 10pt;
94 padding: 5pt;
95 border-bottom: solid 1pt #999999;
96}
97
98TR.data TH {
99 border-bottom: solid 1pt #999999;
100 padding-top: 10pt;
101 padding-left: 5pt;
102 text-align: left;
103}
104
5a738aea
MS
105DIV.table TABLE {
106 border: solid thin #999999;
107 border-collapse: collapse;
108 border-spacing: 0;
109 margin-left: auto;
110 margin-right: auto;
111}
112
113DIV.table CAPTION {
114 caption-side: top;
115 font-size: 120%;
116 font-style: italic;
117 font-weight: bold;
118 margin-left: auto;
119 margin-right: auto;
120}
121
122DIV.table TABLE TD {
123 border: solid thin #cccccc;
124 padding-top: 5pt;
125}
126
127DIV.table TABLE TH {
128 background: #cccccc;
129 border: none;
130 border-bottom: solid thin #999999;
131}
132
133DIV.figure TABLE {
134 margin-left: auto;
135 margin-right: auto;
136}
137
138DIV.figure CAPTION {
139 caption-side: bottom;
140 font-size: 120%;
141 font-style: italic;
142 font-weight: bold;
143 margin-left: auto;
144 margin-right: auto;
145}
146
147TH.label {
5a738aea
MS
148 text-align: right;
149 vertical-align: top;
150}
151
e4572d57
MS
152TH.sublabel {
153 text-align: right;
154 font-weight: normal;
155}
156
5a738aea
MS
157HR {
158 border: solid thin;
159}
160
161SPAN.info {
e4572d57
MS
162 background: black;
163 border: thin solid black;
164 color: white;
5a738aea
MS
165 font-size: 80%;
166 font-style: italic;
167 font-weight: bold;
168 white-space: nowrap;
169}
170
171H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
172 float: right;
173 font-size: 100%;
174}
175
178cb736
MS
176H1.title {
177}
178
5a738aea
MS
179H2.title, H3.title {
180 border-bottom: solid 2pt #000000;
181}
182
e4572d57
MS
183DIV.indent, TABLE.indent {
184 margin-top: 2em;
185 margin-left: auto;
186 margin-right: auto;
187 width: 90%;
188}
189
190TABLE.indent {
191 border-collapse: collapse;
192}
193
194TABLE.indent TD, TABLE.indent TH {
195 padding: 0;
196}
197
198TABLE.list {
199 border-collapse: collapse;
200 margin-left: auto;
201 margin-right: auto;
202 width: 90%;
203}
204
205TABLE.list TH {
206 background: white;
207 border-bottom: solid thin #cccccc;
208 color: #444444;
209 padding-top: 10pt;
210 padding-left: 5pt;
211 text-align: left;
212 vertical-align: bottom;
213 white-space: nowrap;
214}
215
216TABLE.list TH A {
217 color: #4444cc;
218}
219
220TABLE.list TD {
221 border-bottom: solid thin #eeeeee;
222 padding-top: 5pt;
223 padding-left: 5pt;
224}
225
226TABLE.list TR:nth-child(even) {
227 background: #f8f8f8;
228}
229
230TABLE.list TR:nth-child(odd) {
231 background: #f4f4f4;
232}
233
5a738aea
MS
234DT {
235 margin-left: 36pt;
236 margin-top: 12pt;
237}
238
239DD {
240 margin-left: 54pt;
241}
242
243DL.category DT {
244 font-weight: bold;
245}
246
247P.summary {
248 margin-left: 36pt;
249 font-family: monaco, courier, monospace;
250}
251
5a738aea
MS
252DIV.summary TABLE {
253 border: solid thin #999999;
254 border-collapse: collapse;
255 border-spacing: 0;
256 margin: 10px;
257}
258
259DIV.summary TABLE TD, DIV.summary TABLE TH {
260 border: solid thin #999999;
261 padding: 5px;
262 text-align: left;
263 vertical-align: top;
264}
265
266DIV.summary TABLE THEAD TH {
267 background: #eeeeee;
268}
269
270/* API documentation styles... */
271div.body h1 {
272 margin: 0;
273}
274div.body h2 {
275 margin-top: 1.5em;
276}
277div.body h3, div.body h4, div.body h5 {
278 margin-bottom: 0.5em;
279 margin-top: 1.5em;
280}
281.class, .enumeration, .function, .struct, .typedef, .union {
282 border-bottom: solid thin #999999;
283 margin-bottom: 0;
284 margin-top: 2em;
285}
286.description {
287 margin-top: 0.5em;
288}
289code, p.code, pre, ul.code li {
290 font-family: monaco, courier, monospace;
291 font-size: 90%;
292}
293ul.code, ul.contents, ul.subcontents {
294 list-style-type: none;
295 margin: 0;
296 padding-left: 0;
297}
298ul.code li {
299 margin: 0;
300}
301ul.contents > li {
302 margin-top: 1em;
303}
304ul.contents li ul.code, ul.contents li ul.subcontents {
305 padding-left: 2em;
306}
307div.body dl {
308 margin-left: 0;
309 margin-top: 0;
310}
311div.body dt {
312 font-style: italic;
313 margin-left: 0;
314 margin-top: 0;
315}
316div.body dd {
317 margin-bottom: 0.5em;
318}
319
320/* This is just for the HTML files generated with the framedhelp target */
321div.contents {
322 background: #e8e8e8;
323 border: solid thin black;
324 padding: 10px;
325}
326div.contents h1 {
327 font-size: 110%;
328}
329div.contents h2 {
330 font-size: 100%;
331}
332div.contents ul.contents {
333 font-size: 80%;
334}
ac884b6a
MS
335div.contents ul.subcontents li {
336 margin-left: 1em;
337 text-indent: -1em;
338}
5a738aea 339--></style>
ef416fc2 340</head>
341<body>
5a738aea
MS
342<div class='body'>
343<!--
68b10830 344 "$Id$"
5a738aea 345
321d8d57 346 CUPS API header for CUPS.
5a738aea 347
321d8d57 348 Copyright 2008-2011 by Apple Inc.
5a738aea
MS
349
350 These coded instructions, statements, and computer programs are the
351 property of Apple Inc. and are protected by Federal copyright
352 law. Distribution and use rights are outlined in the file "LICENSE.txt"
353 which should have been included with this file. If this file is
354 file is missing or damaged, see the license at "http://www.cups.org/".
355-->
356
178cb736
MS
357<h1 class='title'>CUPS API</h1>
358
5a738aea
MS
359<div class='summary'><table summary='General Information'>
360<thead>
361<tr>
362 <th>Header</th>
363 <th>cups/cups.h</th>
364</tr>
365</thead>
366<tbody>
367<tr>
368 <th>Library</th>
369 <td>-lcups</td>
370</tr>
371<tr>
372 <th>See Also</th>
373 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
374 Programming: <a href='api-array.html' target='_top'>Array API</a><br>
375 Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
376 Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
377 Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
378 Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
379 Programming: <a href='api-raster.html' target='_top'>Raster API</a></td>
380</tr>
381</tbody>
382</table></div>
383<h2 class="title">Contents</h2>
384<ul class="contents">
5a738aea 385<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
0268488e
MS
386 <li><a href="#CLIENTS_AND_SERVERS">Clients and Servers</a></li>
387 <li><a href="#PRINTERS_AND_CLASSES">Printers and Classes</a></li>
388 <li><a href="#OPTIONS">Options</a></li>
389 <li><a href="#PRINT_JOBS">Print Jobs</a></li>
390 <li><a href="#ERROR_HANDLING">Error Handling</a></li>
391 <li><a href="#PASSWORDS_AND_AUTHENTICATION">Passwords and Authentication</a></li>
5a738aea
MS
392</ul></li>
393<li><a href="#FUNCTIONS">Functions</a><ul class="code">
0268488e
MS
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>
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>
5a9febac 400 <li><a href="#cupsCancelDestJob" title="Include necessary headers...">cupsCancelDestJob</a></li>
0268488e
MS
401 <li><a href="#cupsCancelJob" title="Cancel a print job on the default server.">cupsCancelJob</a></li>
402 <li><a href="#cupsCancelJob2" title="Cancel or purge a print job.">cupsCancelJob2</a></li>
5a9febac
MS
403 <li><a href="#cupsCheckDestSupported" title="Check that the option and value are supported
404by the destination.">cupsCheckDestSupported</a></li>
405 <li><a href="#cupsCloseDestJob" title="Close a job and start printing.">cupsCloseDestJob</a></li>
3e7fe0ca
MS
406 <li><a href="#cupsConnectDest" title="Connect to the server for a destination.">cupsConnectDest</a></li>
407 <li><a href="#cupsConnectDestBlock" title="Connect to the server for a destination.">cupsConnectDestBlock</a></li>
408 <li><a href="#cupsCopyDest" title="Callback block">cupsCopyDest</a></li>
5a9febac
MS
409 <li><a href="#cupsCopyDestConflicts" title="Get conflicts and resolutions for a new
410option/value pair.">cupsCopyDestConflicts</a></li>
411 <li><a href="#cupsCopyDestInfo" title="Get the supported values/capabilities for the
412destination.">cupsCopyDestInfo</a></li>
413 <li><a href="#cupsCreateDestJob" title="Create a job on a destination.">cupsCreateDestJob</a></li>
0268488e
MS
414 <li><a href="#cupsCreateJob" title="Create an empty job for streaming.">cupsCreateJob</a></li>
415 <li><a href="#cupsEncryption" title="Get the current encryption settings.">cupsEncryption</a></li>
3e7fe0ca
MS
416 <li><a href="#cupsEnumDests" title="Enumerate available destinations with a callback function.">cupsEnumDests</a></li>
417 <li><a href="#cupsEnumDestsBlock" title="Enumerate available destinations with a block.">cupsEnumDestsBlock</a></li>
5a9febac 418 <li><a href="#cupsFinishDestDocument" title="Finish the current document.">cupsFinishDestDocument</a></li>
0268488e 419 <li><a href="#cupsFinishDocument" title="Finish sending a document.">cupsFinishDocument</a></li>
5a9febac
MS
420 <li><a href="#cupsFreeDestInfo" title="Free destination information obtained using
421cupsCopyDestInfo.">cupsFreeDestInfo</a></li>
0268488e
MS
422 <li><a href="#cupsFreeDests" title="Free the memory used by the list of destinations.">cupsFreeDests</a></li>
423 <li><a href="#cupsFreeJobs" title="Free memory used by job data.">cupsFreeJobs</a></li>
424 <li><a href="#cupsFreeOptions" title="Free all memory used by options.">cupsFreeOptions</a></li>
425 <li><a href="#cupsGetClasses" title="Get a list of printer classes from the default server.">cupsGetClasses</a></li>
426 <li><a href="#cupsGetDefault" title="Get the default printer or class for the default server.">cupsGetDefault</a></li>
427 <li><a href="#cupsGetDefault2" title="Get the default printer or class for the specified server.">cupsGetDefault2</a></li>
428 <li><a href="#cupsGetDest" title="Get the named destination from the list.">cupsGetDest</a></li>
5a9febac
MS
429 <li><a href="#cupsGetDestMediaByName" title="Get media names, dimensions, and margins.">cupsGetDestMediaByName</a></li>
430 <li><a href="#cupsGetDestMediaBySize" title="Get media names, dimensions, and margins.">cupsGetDestMediaBySize</a></li>
0268488e
MS
431 <li><a href="#cupsGetDests" title="Get the list of destinations from the default server.">cupsGetDests</a></li>
432 <li><a href="#cupsGetDests2" title="Get the list of destinations from the specified server.">cupsGetDests2</a></li>
433 <li><a href="#cupsGetJobs" title="Get the jobs from the default server.">cupsGetJobs</a></li>
434 <li><a href="#cupsGetJobs2" title="Get the jobs from the specified server.">cupsGetJobs2</a></li>
435 <li><a href="#cupsGetNamedDest" title="Get options for the named destination.">cupsGetNamedDest</a></li>
436 <li><a href="#cupsGetOption" title="Get an option value.">cupsGetOption</a></li>
437 <li><a href="#cupsGetPPD" title="Get the PPD file for a printer on the default server.">cupsGetPPD</a></li>
438 <li><a href="#cupsGetPPD2" title="Get the PPD file for a printer from the specified server.">cupsGetPPD2</a></li>
439 <li><a href="#cupsGetPPD3" title="Get the PPD file for a printer on the specified
5a738aea 440server if it has changed.">cupsGetPPD3</a></li>
0268488e
MS
441 <li><a href="#cupsGetPassword" title="Get a password from the user.">cupsGetPassword</a></li>
442 <li><a href="#cupsGetPassword2" title="Get a password from the user using the advanced
aaf19ab0 443password callback.">cupsGetPassword2</a></li>
0268488e
MS
444 <li><a href="#cupsGetPrinters" title="Get a list of printers from the default server.">cupsGetPrinters</a></li>
445 <li><a href="#cupsGetServerPPD" title="Get an available PPD file from the server.">cupsGetServerPPD</a></li>
446 <li><a href="#cupsLangDefault" title="Return the default language.">cupsLangDefault</a></li>
447 <li><a href="#cupsLangEncoding" title="Return the character encoding (us-ascii, etc.)
5a738aea 448for the given language.">cupsLangEncoding</a></li>
0268488e
MS
449 <li><a href="#cupsLangFlush" title="Flush all language data out of the cache.">cupsLangFlush</a></li>
450 <li><a href="#cupsLangFree" title="Free language data.">cupsLangFree</a></li>
451 <li><a href="#cupsLangGet" title="Get a language.">cupsLangGet</a></li>
5a9febac
MS
452 <li><a href="#cupsLocalizeDestOption" title="Get the localized string for a destination
453option.">cupsLocalizeDestOption</a></li>
454 <li><a href="#cupsLocalizeDestValue" title="Get the localized string for a destination
455option+value pair.">cupsLocalizeDestValue</a></li>
0268488e
MS
456 <li><a href="#cupsNotifySubject" title="Return the subject for the given notification message.">cupsNotifySubject</a></li>
457 <li><a href="#cupsNotifyText" title="Return the text for the given notification message.">cupsNotifyText</a></li>
458 <li><a href="#cupsParseOptions" title="Parse options from a command-line argument.">cupsParseOptions</a></li>
459 <li><a href="#cupsPrintFile" title="Print a file to a printer or class on the default server.">cupsPrintFile</a></li>
460 <li><a href="#cupsPrintFile2" title="Print a file to a printer or class on the specified
5a738aea 461server.">cupsPrintFile2</a></li>
0268488e 462 <li><a href="#cupsPrintFiles" title="Print one or more files to a printer or class on the
5a738aea 463default server.">cupsPrintFiles</a></li>
0268488e 464 <li><a href="#cupsPrintFiles2" title="Print one or more files to a printer or class on the
5a738aea 465specified server.">cupsPrintFiles2</a></li>
0268488e
MS
466 <li><a href="#cupsRemoveDest" title="Remove a destination from the destination list.">cupsRemoveDest</a></li>
467 <li><a href="#cupsRemoveOption" title="Remove an option from an option array.">cupsRemoveOption</a></li>
468 <li><a href="#cupsServer" title="Return the hostname/address of the current server.">cupsServer</a></li>
469 <li><a href="#cupsSetClientCertCB" title="Set the client certificate callback.">cupsSetClientCertCB</a></li>
470 <li><a href="#cupsSetCredentials" title="Set the default credentials to be used for SSL/TLS
10d09e33 471connections.">cupsSetCredentials</a></li>
0268488e
MS
472 <li><a href="#cupsSetDefaultDest" title="Set the default destination.">cupsSetDefaultDest</a></li>
473 <li><a href="#cupsSetDests" title="Save the list of destinations for the default server.">cupsSetDests</a></li>
474 <li><a href="#cupsSetDests2" title="Save the list of destinations for the specified server.">cupsSetDests2</a></li>
475 <li><a href="#cupsSetEncryption" title="Set the encryption preference.">cupsSetEncryption</a></li>
476 <li><a href="#cupsSetPasswordCB" title="Set the password callback for CUPS.">cupsSetPasswordCB</a></li>
477 <li><a href="#cupsSetPasswordCB2" title="Set the advanced password callback for CUPS.">cupsSetPasswordCB2</a></li>
478 <li><a href="#cupsSetServer" title="Set the default server name and port.">cupsSetServer</a></li>
479 <li><a href="#cupsSetServerCertCB" title="Set the server certificate callback.">cupsSetServerCertCB</a></li>
480 <li><a href="#cupsSetUser" title="Set the default user name.">cupsSetUser</a></li>
5a9febac 481 <li><a href="#cupsStartDestDocument" title="Start a new document.">cupsStartDestDocument</a></li>
0268488e
MS
482 <li><a href="#cupsStartDocument" title="Add a document to a job created with cupsCreateJob().">cupsStartDocument</a></li>
483 <li><a href="#cupsTempFd" title="Creates a temporary file.">cupsTempFd</a></li>
484 <li><a href="#cupsTempFile" title="Generates a temporary filename.">cupsTempFile</a></li>
485 <li><a href="#cupsTempFile2" title="Creates a temporary CUPS file.">cupsTempFile2</a></li>
486 <li><a href="#cupsUser" title="Return the current user's name.">cupsUser</a></li>
8b450588 487</ul></li>
5a738aea 488<li><a href="#TYPES">Data Types</a><ul class="code">
3e7fe0ca
MS
489 <li><a href="#cups_client_cert_cb_t" title="Client credentials callback
490">cups_client_cert_cb_t</a></li>
491 <li><a href="#cups_dest_block_t" title="Destination enumeration block
492">cups_dest_block_t</a></li>
493 <li><a href="#cups_dest_cb_t" title="Destination enumeration callback
494">cups_dest_cb_t</a></li>
5a738aea 495 <li><a href="#cups_dest_t" title="Destination">cups_dest_t</a></li>
3e7fe0ca
MS
496 <li><a href="#cups_device_cb_t" title="Device callback
497">cups_device_cb_t</a></li>
498 <li><a href="#cups_dinfo_t" title="Destination capability and status
499information ">cups_dinfo_t</a></li>
5a738aea
MS
500 <li><a href="#cups_job_t" title="Job">cups_job_t</a></li>
501 <li><a href="#cups_option_t" title="Printer Options">cups_option_t</a></li>
3e7fe0ca
MS
502 <li><a href="#cups_password_cb2_t" title="New password callback
503">cups_password_cb2_t</a></li>
5a738aea
MS
504 <li><a href="#cups_password_cb_t" title="Password callback">cups_password_cb_t</a></li>
505 <li><a href="#cups_ptype_t" title="Printer type/capability bits">cups_ptype_t</a></li>
3e7fe0ca
MS
506 <li><a href="#cups_server_cert_cb_t" title="Server credentials callback
507">cups_server_cert_cb_t</a></li>
508 <li><a href="#cups_size_t" title="Media Size ">cups_size_t</a></li>
5a738aea
MS
509</ul></li>
510<li><a href="#STRUCTURES">Structures</a><ul class="code">
511 <li><a href="#cups_dest_s" title="Destination">cups_dest_s</a></li>
512 <li><a href="#cups_job_s" title="Job">cups_job_s</a></li>
513 <li><a href="#cups_option_s" title="Printer Options">cups_option_s</a></li>
3e7fe0ca 514 <li><a href="#cups_size_s" title="Media Size ">cups_size_s</a></li>
a29fd7dd 515 <li><a href="#pollfd" title="User data (unused)">pollfd</a></li>
5a738aea 516</ul></li>
22c9029b
MS
517<li><a href="#VARIABLES">Variables</a><ul class="code">
518 <li><a href="#CF_RETURNS_RETAINED" title="Get the Apple language identifier associated with a
519locale ID.">CF_RETURNS_RETAINED</a></li>
520</ul></li>
5a738aea 521<li><a href="#ENUMERATIONS">Constants</a><ul class="code">
3e7fe0ca
MS
522 <li><a href="#cups_ptype_e" title="Printer type/capability bit
523constants">cups_ptype_e</a></li>
5a738aea 524</ul></li>
0268488e 525</ul>
ef416fc2 526<!--
68b10830 527 "$Id$"
ef416fc2 528
eac3a0a0 529 API introduction for CUPS.
ef416fc2 530
eac3a0a0 531 Copyright 2007-2011 by Apple Inc.
bc44d920 532 Copyright 1997-2006 by Easy Software Products, all rights reserved.
ef416fc2 533
534 These coded instructions, statements, and computer programs are the
bc44d920 535 property of Apple Inc. and are protected by Federal copyright
536 law. Distribution and use rights are outlined in the file "LICENSE.txt"
537 which should have been included with this file. If this file is
538 file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 539-->
540
5a738aea
MS
541<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
542
543<p>The CUPS API provides the convenience functions needed to support
544applications, filters, printer drivers, and backends that need to interface
545with the CUPS scheduler.</p>
ef416fc2 546
568fa3fa
MS
547<h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3>
548
549<p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows
550clients (applications) to communicate with a server (the scheduler) to get a
551list of printers, send print jobs, and so forth. You identify which server
552you want to communicate with using a pointer to the opaque structure
553<code>http_t</code>. All of the examples in this document use the
554<code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection
555to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP
556APIs</a> document provides more information on server connections.</p>
557
5a738aea 558<h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3>
ecdc0628 559
5a738aea
MS
560<p>Printers and classes (collections of printers) are accessed through
561the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which
562includes the name (<code>name</code>), instance (<code>instance</code> -
568fa3fa
MS
563a way of selecting certain saved options/settings), and the options and
564attributes associated with that destination (<code>num_options</code> and
5a738aea
MS
565<code>options</code>). Destinations are created using the
566<a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed
567using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function.
568The <a href='#cupsGetDest'><code>cupsGetDest</code></a> function finds a
569specific destination for printing:</p>
ef416fc2 570
5a738aea
MS
571<pre class='example'>
572#include &lt;cups/cups.h&gt;
ef416fc2 573
5a738aea
MS
574<a href='#cups_dest_t'>cups_dest_t</a> *dests;
575int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
576<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
ef416fc2 577
eac3a0a0 578/* do something with dest */
ef416fc2 579
5a738aea 580<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
ef416fc2 581</pre>
582
5a738aea
MS
583<p>Passing <code>NULL</code> to
584<a href='#cupsGetDest'><code>cupsGetDest</code></a> for the destination name
585will return the default destination. Similarly, passing a <code>NULL</code>
586instance will return the default instance for that destination.</p>
ef416fc2 587
5a738aea
MS
588<div class='table'><table summary='Table 1: Printer Attributes' width='80%'>
589<caption>Table 1: <a name='TABLE1'>Printer Attributes</a></caption>
590<thead>
591<tr>
592 <th>Attribute Name</th>
593 <th>Description</th>
594</tr>
595</thead>
ef416fc2 596<tbody>
5a738aea
MS
597<tr>
598 <td>"auth-info-required"</td>
599 <td>The type of authentication required for printing to this
600 destination: "none", "username,password", "domain,username,password",
601 or "negotiate" (Kerberos)</td>
602</tr>
603<tr>
604 <td>"printer-info"</td>
605 <td>The human-readable description of the destination such as "My
606 Laser Printer".</td>
607</tr>
608<tr>
609 <td>"printer-is-accepting-jobs"</td>
aaf19ab0
MS
610 <td>"true" if the destination is accepting new jobs, "false" if
611 not.</td>
5a738aea
MS
612</tr>
613<tr>
614 <td>"printer-is-shared"</td>
aaf19ab0
MS
615 <td>"true" if the destination is being shared with other computers,
616 "false" if not.</td>
5a738aea
MS
617</tr>
618<tr>
619 <td>"printer-location"</td>
620 <td>The human-readable location of the destination such as "Lab 4".</td>
621</tr>
622<tr>
623 <td>"printer-make-and-model"</td>
624 <td>The human-readable make and model of the destination such as "HP
625 LaserJet 4000 Series".</td>
626</tr>
627<tr>
628 <td>"printer-state"</td>
629 <td>"3" if the destination is idle, "4" if the destination is printing
630 a job, and "5" if the destination is stopped.</td>
631</tr>
632<tr>
633 <td>"printer-state-change-time"</td>
634 <td>The UNIX time when the destination entered the current state.</td>
635</tr>
636<tr>
637 <td>"printer-state-reasons"</td>
638 <td>Additional comma-delimited state keywords for the destination
639 such as "media-tray-empty-error" and "toner-low-warning".</td>
640</tr>
641<tr>
642 <td>"printer-type"</td>
643 <td>The <a href='#cups_printer_t'><code>cups_printer_t</code></a>
644 value associated with the destination.</td>
645</tr>
646</tbody>
647</table></div>
648
649<h3><a name='OPTIONS'>Options</a></h3>
650
651<p>Options are stored in arrays of
652<a href='#cups_option_t'><code>cups_option_t</code></a> structures. Each
653option has a name (<code>name</code>) and value (<code>value</code>)
654associated with it. The <a href='#cups_dest_t'><code>cups_dest_t</code></a>
655<code>num_options</code> and <code>options</code> members contain the
656default options for a particular destination, along with several informational
657attributes about the destination as shown in <a href='#TABLE1'>Table 1</a>.
658The <a href='#cupsGetOption'><code>cupsGetOption</code></a> function gets
659the value for the named option. For example, the following code lists the
660available destinations and their human-readable descriptions:</p>
661
662<pre class='example'>
663#include &lt;cups/cups.h&gt;
664
665<a href='#cups_dest_t'>cups_dest_t</a> *dests;
666int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
667<a href='#cups_dest_t'>cups_dest_t</a> *dest;
668int i;
669const char *value;
670
671for (i = num_dests, dest = dests; i > 0; i --, dest ++)
672 if (dest->instance == NULL)
673 {
674 value = <a href='#cupsGetOption'>cupsGetOption</a>("printer-info", dest->num_options, dest->options);
675 printf("%s (%s)\n", dest->name, value ? value : "no description");
676 }
677
678<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
679</pre>
680
681<p>You can create your own option arrays using the
682<a href='#cupsAddOption'><code>cupsAddOption</code></a> function, which
683adds a single named option to an array:</p>
684
685<pre class='example'>
686#include &lt;cups/cups.h&gt;
687
688int num_options = 0;
689<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
690
691/* The returned num_options value is updated as needed */
692num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "value", num_options, &amp;options);
693
694/* This adds a second option value */
695num_options = <a href='#cupsAddOption'>cupsAddOption</a>("second", "value", num_options, &amp;options);
696
697/* This replaces the first option we added */
698num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "new value", num_options, &amp;options);
699</pre>
700
701<p>Use a <code>for</code> loop to copy the options from a destination:</p>
702
703<pre class='example'>
704#include &lt;cups/cups.h&gt;
705
706int i;
707int num_options = 0;
708<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
709<a href='#cups_dest_t'>cups_dest_t</a> *dest;
710
711for (i = 0; i < dest->num_options; i ++)
568fa3fa
MS
712 num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value,
713 num_options, &amp;options);
5a738aea
MS
714</pre>
715
716<p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a>
717function to free the options array when you are done using it:</p>
718
719<pre class='example'>
720<a href='#cupsFreeOptions'>cupsFreeOptions</a>(num_options, options);
721</pre>
722
723<h3><a name='PRINT_JOBS'>Print Jobs</a></h3>
724
725<p>Print jobs are identified by a locally-unique job ID number from 1 to
7262<sup>31</sup>-1 and have options and one or more files for printing to a
727single destination. The <a href='#cupsPrintFile'><code>cupsPrintFile</code></a>
728function creates a new job with one file. The following code prints the CUPS
729test page file:</p>
730
731<pre class='example'>
732#include &lt;cups/cups.h&gt;
733
734<a href='#cups_dest_t'>cups_dest_t</a> *dest;
735int num_options;
736<a href='#cups_option_t'>cups_option_t</a> *options;
737int job_id;
738
739/* Print a single file */
568fa3fa
MS
740job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps",
741 "Test Print", num_options, options);
5a738aea
MS
742</pre>
743
744<p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function
745creates a job with multiple files. The files are provided in a
746<code>char *</code> array:</p>
747
748<pre class='example'>
749#include &lt;cups/cups.h&gt;
750
751<a href='#cups_dest_t'>cups_dest_t</a> *dest;
752int num_options;
753<a href='#cups_option_t'>cups_option_t</a> *options;
754int job_id;
755char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };
756
757/* Print three files */
758job_id = <a href='#cupsPrintFiles'>cupsPrintFiles</a>(dest->name, 3, files, "Test Print", num_options, options);
759</pre>
760
761<p>Finally, the <a href='#cupsCreateJob'><code>cupsCreateJob</code></a>
762function creates a new job with no files in it. Files are added using the
763<a href='#cupsStartDocument'><code>cupsStartDocument</code></a>,
764<a href='api-httpipp.html#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>,
765and <a href='#cupsFinishDocument'><code>cupsFinishDocument</code></a> functions.
766The following example creates a job with 10 text files for printing:</p>
767
768<pre class='example'>
769#include &lt;cups/cups.h&gt;
770
771<a href='#cups_dest_t'>cups_dest_t</a> *dest;
772int num_options;
773<a href='#cups_option_t'>cups_option_t</a> *options;
774int job_id;
775int i;
776char buffer[1024];
777
778/* Create the job */
568fa3fa
MS
779job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
780 num_options, options);
5a738aea
MS
781
782/* If the job is created, add 10 files */
783if (job_id > 0)
784{
785 for (i = 1; i &lt;= 10; i ++)
786 {
787 snprintf(buffer, sizeof(buffer), "file%d.txt", i);
788
568fa3fa
MS
789 <a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
790 CUPS_FORMAT_TEXT, i == 10);
5a738aea
MS
791
792 snprintf(buffer, sizeof(buffer),
793 "File %d\n"
794 "\n"
795 "One fish,\n"
796 "Two fish,\n
797 "Red fish,\n
798 "Blue fish\n", i);
799
800 /* cupsWriteRequestData can be called as many times as needed */
801 <a href='#cupsWriteRequestData'>cupsWriteRequestData</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
802
803 <a href='#cupsFinishDocument'>cupsFinishDocument</a>(CUPS_HTTP_DEFAULT, dest->name);
804 }
805}
806</pre>
807
808<p>Once you have created a job, you can monitor its status using the
809<a href='#cupsGetJobs'><code>cupsGetJobs</code></a> function, which returns
810an array of <a href='#cups_job_t'><code>cups_job_t</code></a> structures.
811Each contains the job ID (<code>id</code>), destination name
812(<code>dest</code>), title (<code>title</code>), and other information
813associated with the job. The job array is freed using the
814<a href='#cupsFreeJobs'><code>cupsFreeJobs</code></a> function. The following
815example monitors a specific job ID, showing the current job state once every
8165 seconds until the job is completed:</p>
817
818<pre class='example'>
819#include &lt;cups/cups.h&gt;
820
821<a href='#cups_dest_t'>cups_dest_t</a> *dest;
822int job_id;
823int num_jobs;
824<a href='#cups_job_t'>cups_job_t</a> *jobs;
825int i;
826ipp_jstate_t job_state = IPP_JOB_PENDING;
827
828while (job_state &lt; IPP_JOB_STOPPED)
829{
830 /* Get my jobs (1) with any state (-1) */
831 num_jobs = <a href='#cupsGetJobs'>cupsGetJobs</a>(&amp;jobs, dest->name, 1, -1);
832
833 /* Loop to find my job */
834 job_state = IPP_JOB_COMPLETED;
835
836 for (i = 0; i &lt; num_jobs; i ++)
837 if (jobs[i].id == job_id)
838 {
839 job_state = jobs[i].state;
840 break;
841 }
842
843 /* Free the job array */
844 <a href='#cupsFreeJobs'>cupsFreeJobs</a>(num_jobs, jobs);
845
846 /* Show the current state */
847 switch (job_state)
848 {
849 case IPP_JOB_PENDING :
850 printf("Job %d is pending.\n", job_id);
851 break;
852 case IPP_JOB_HELD :
853 printf("Job %d is held.\n", job_id);
854 break;
855 case IPP_JOB_PROCESSING :
856 printf("Job %d is processing.\n", job_id);
857 break;
858 case IPP_JOB_STOPPED :
859 printf("Job %d is stopped.\n", job_id);
860 break;
861 case IPP_JOB_CANCELED :
862 printf("Job %d is canceled.\n", job_id);
863 break;
864 case IPP_JOB_ABORTED :
865 printf("Job %d is aborted.\n", job_id);
866 break;
867 case IPP_JOB_COMPLETED :
868 printf("Job %d is completed.\n", job_id);
869 break;
870 }
871
872 /* Sleep if the job is not finished */
873 if (job_state &lt; IPP_JOB_STOPPED)
874 sleep(5);
875}
876</pre>
877
878<p>To cancel a job, use the
879<a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the
880job ID:</p>
881
568fa3fa 882<pre class='example'>
5a738aea
MS
883#include &lt;cups/cups.h&gt;
884
885<a href='#cups_dest_t'>cups_dest_t</a> *dest;
886int job_id;
887
888<a href='#cupsCancelJob'>cupsCancelJob</a>(dest->name, job_id);
889</pre>
890
891<h3><a name='ERROR_HANDLING'>Error Handling</a></h3>
892
893<p>If any of the CUPS API printing functions returns an error, the reason for
894that error can be found by calling the
895<a href='#cupsLastError'><code>cupsLastError</code></a> and
896<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> functions.
897<a href='#cupsLastError'><code>cupsLastError</code></a> returns the last IPP
898error code
899(<a href='api-httpipp.html#ipp_status_t'><code>ipp_status_t</code></a>)
900that was encountered, while
901<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> returns
902a (localized) human-readable string that can be shown to the user. For example,
903if any of the job creation functions returns a job ID of 0, you can use
904<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> to show
905the reason why the job could not be created:</p>
906
907<pre class='example'>
908#include &lt;cups/cups.h&gt;
909
910int job_id;
911
912if (job_id == 0)
913 puts(cupsLastErrorString());
914</pre>
915
916<h3><a name='PASSWORDS_AND_AUTHENTICATION'>Passwords and Authentication</a></h3>
917
918<p>CUPS supports authentication of any request, including submission of print
919jobs. The default mechanism for getting the username and password is to use the
920login user and a password from the console.</p>
921
922<p>To support other types of applications, in particular Graphical User
923Interfaces ("GUIs"), the CUPS API provides functions to set the default
924username and to register a callback function that returns a password string.</p>
925
926<p>The <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a>
927function is used to set a password callback in your program. Only one
928function can be used at any time.</p>
929
930<p>The <a href="#cupsSetUser"><code>cupsSetUser</code></a> function sets the
931current username for authentication. This function can be called by your
932password callback function to change the current username as needed.</p>
933
934<p>The following example shows a simple password callback that gets a
935username and password from the user:</p>
936
937<pre class='example'>
938#include &lt;cups/cups.h&gt;
939
940const char *
941my_password_cb(const char *prompt)
942{
943 char user[65];
944
945
946 puts(prompt);
947
948 /* Get a username from the user */
949 printf("Username: ");
950 if (fgets(user, sizeof(user), stdin) == NULL)
951 return (NULL);
952
953 /* Strip the newline from the string and set the user */
954 user[strlen(user) - 1] = '\0';
955
956 <a href='#cupsSetUser'>cupsSetUser</a>(user);
957
958 /* Use getpass() to ask for the password... */
959 return (getpass("Password: "));
960}
961
962<a href='#cupsSetPasswordCB'>cupsSetPasswordCB</a>(my_password_cb);
963</pre>
964
965<p>Similarly, a GUI could display the prompt string in a window with input
966fields for the username and password. The username should default to the
967string returned by the <a href="#cupsUser"><code>cupsUser</code></a>
968function.</p>
969<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
970<h3 class="function"><a name="cupsAddDest">cupsAddDest</a></h3>
971<p class="description">Add a destination to the list of destinations.</p>
972<p class="code">
973int cupsAddDest (<br>
974&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
975&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
976&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
977&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
978);</p>
979<h4 class="parameters">Parameters</h4>
980<dl>
981<dt>name</dt>
982<dd class="description">Destination name</dd>
983<dt>instance</dt>
984<dd class="description">Instance name or <code>NULL</code> for none/primary</dd>
985<dt>num_dests</dt>
986<dd class="description">Number of destinations</dd>
987<dt>dests</dt>
988<dd class="description">Destinations</dd>
989</dl>
990<h4 class="returnvalue">Return Value</h4>
991<p class="description">New number of destinations</p>
992<h4 class="discussion">Discussion</h4>
993<p class="discussion">This function cannot be used to add a new class or printer queue,
2abf387c 994it only adds a new container of saved options for the named
5a738aea
MS
995destination or instance.<br>
996<br>
997If the named destination already exists, the destination list is
2abf387c 998returned unchanged. Adding a new instance of a destination creates
5a738aea
MS
999a copy of that destination's options.<br>
1000<br>
1001Use the <a href="#cupsSaveDests"><code>cupsSaveDests</code></a> function to save the updated list of
1002destinations to the user's lpoptions file.</p>
1003<h3 class="function"><a name="cupsAddOption">cupsAddOption</a></h3>
1004<p class="description">Add an option to an option array.</p>
1005<p class="code">
1006int cupsAddOption (<br>
1007&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1008&nbsp;&nbsp;&nbsp;&nbsp;const char *value,<br>
1009&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1010&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
1011);</p>
1012<h4 class="parameters">Parameters</h4>
1013<dl>
1014<dt>name</dt>
1015<dd class="description">Name of option</dd>
1016<dt>value</dt>
1017<dd class="description">Value of option</dd>
1018<dt>num_options</dt>
1019<dd class="description">Number of options</dd>
1020<dt>options</dt>
1021<dd class="description">Pointer to options</dd>
1022</dl>
1023<h4 class="returnvalue">Return Value</h4>
1024<p class="description">Number of options</p>
1025<h4 class="discussion">Discussion</h4>
1026<p class="discussion">New option arrays can be initialized simply by passing 0 for the
1027&quot;num_options&quot; parameter.</p>
5a9febac 1028<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD</a></h3>
426c6a59
MS
1029<p class="description">Create the Windows PPD file for a printer.</p>
1030<p class="code">
1031char *cupsAdminCreateWindowsPPD (<br>
1032&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1033&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
1034&nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>
1035&nbsp;&nbsp;&nbsp;&nbsp;int bufsize<br>
1036);</p>
1037<h4 class="parameters">Parameters</h4>
1038<dl>
1039<dt>http</dt>
1040<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1041<dt>dest</dt>
1042<dd class="description">Printer or class</dd>
1043<dt>buffer</dt>
1044<dd class="description">Filename buffer</dd>
1045<dt>bufsize</dt>
1046<dd class="description">Size of filename buffer</dd>
1047</dl>
1048<h4 class="returnvalue">Return Value</h4>
1049<p class="description">PPD file or NULL</p>
5a9febac 1050<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsAdminExportSamba">cupsAdminExportSamba</a></h3>
426c6a59
MS
1051<p class="description">Export a printer to Samba.</p>
1052<p class="code">
1053int cupsAdminExportSamba (<br>
1054&nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
1055&nbsp;&nbsp;&nbsp;&nbsp;const char *ppd,<br>
1056&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_server,<br>
1057&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_user,<br>
1058&nbsp;&nbsp;&nbsp;&nbsp;const char *samba_password,<br>
1059&nbsp;&nbsp;&nbsp;&nbsp;FILE *logfile<br>
1060);</p>
1061<h4 class="parameters">Parameters</h4>
1062<dl>
1063<dt>dest</dt>
1064<dd class="description">Destination to export</dd>
1065<dt>ppd</dt>
1066<dd class="description">PPD file</dd>
1067<dt>samba_server</dt>
1068<dd class="description">Samba server</dd>
1069<dt>samba_user</dt>
1070<dd class="description">Samba username</dd>
1071<dt>samba_password</dt>
1072<dd class="description">Samba password</dd>
1073<dt>logfile</dt>
1074<dd class="description">Log file, if any</dd>
1075</dl>
1076<h4 class="returnvalue">Return Value</h4>
1077<p class="description">1 on success, 0 on failure</p>
f3c17241 1078<h3 class="function"><span class="info">&nbsp;CUPS 1.3/OS X 10.5&nbsp;</span><a name="cupsAdminGetServerSettings">cupsAdminGetServerSettings</a></h3>
426c6a59
MS
1079<p class="description">Get settings from the server.</p>
1080<p class="code">
1081int cupsAdminGetServerSettings (<br>
1082&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1083&nbsp;&nbsp;&nbsp;&nbsp;int *num_settings,<br>
1084&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **settings<br>
1085);</p>
1086<h4 class="parameters">Parameters</h4>
1087<dl>
1088<dt>http</dt>
1089<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1090<dt>num_settings</dt>
1091<dd class="description">Number of settings</dd>
1092<dt>settings</dt>
1093<dd class="description">Settings</dd>
1094</dl>
1095<h4 class="returnvalue">Return Value</h4>
1096<p class="description">1 on success, 0 on failure</p>
1097<h4 class="discussion">Discussion</h4>
1098<p class="discussion">The returned settings should be freed with cupsFreeOptions() when
1099you are done with them.
1100
1101</p>
f3c17241 1102<h3 class="function"><span class="info">&nbsp;CUPS 1.3/OS X 10.5&nbsp;</span><a name="cupsAdminSetServerSettings">cupsAdminSetServerSettings</a></h3>
426c6a59
MS
1103<p class="description">Set settings on the server.</p>
1104<p class="code">
1105int cupsAdminSetServerSettings (<br>
1106&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1107&nbsp;&nbsp;&nbsp;&nbsp;int num_settings,<br>
1108&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *settings<br>
1109);</p>
1110<h4 class="parameters">Parameters</h4>
1111<dl>
1112<dt>http</dt>
1113<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1114<dt>num_settings</dt>
1115<dd class="description">Number of settings</dd>
1116<dt>settings</dt>
1117<dd class="description">Settings</dd>
1118</dl>
1119<h4 class="returnvalue">Return Value</h4>
1120<p class="description">1 on success, 0 on failure</p>
5a9febac
MS
1121<h3 class="function"><a name="cupsCancelDestJob">cupsCancelDestJob</a></h3>
1122<p class="description">Include necessary headers...</p>
1123<p class="code">
1124ipp_status_t cupsCancelDestJob (<br>
1125&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1126&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1127&nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
1128);</p>
1129<h4 class="parameters">Parameters</h4>
1130<dl>
1131<dt>http</dt>
1132<dd class="description">Connection to destination</dd>
1133<dt>dest</dt>
1134<dd class="description">Destination</dd>
1135<dt>job_id</dt>
1136<dd class="description">Job ID</dd>
1137</dl>
1138<h4 class="returnvalue">Return Value</h4>
1139<p class="description">Cancel a job on a destination.</p>
1140<p class="discussion">The &quot;job_id&quot; is the number returned by cupsCreateDestJob.<br>
1141<br>
1142Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
1143failure.
1144
1145</p>
5a738aea
MS
1146<h3 class="function"><a name="cupsCancelJob">cupsCancelJob</a></h3>
1147<p class="description">Cancel a print job on the default server.</p>
1148<p class="code">
1149int cupsCancelJob (<br>
1150&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1151&nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
1152);</p>
1153<h4 class="parameters">Parameters</h4>
1154<dl>
1155<dt>name</dt>
1156<dd class="description">Name of printer or class</dd>
1157<dt>job_id</dt>
568fa3fa 1158<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
1159</dl>
1160<h4 class="returnvalue">Return Value</h4>
1161<p class="description">1 on success, 0 on failure</p>
1162<h4 class="discussion">Discussion</h4>
1163<p class="discussion">Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
1164to cancel the current job on the named destination.<br>
1165<br>
1166Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
1167the cause of any failure.</p>
f3c17241 1168<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsCancelJob2">cupsCancelJob2</a></h3>
5a738aea
MS
1169<p class="description">Cancel or purge a print job.</p>
1170<p class="code">
1171ipp_status_t cupsCancelJob2 (<br>
1172&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1173&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1174&nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
1175&nbsp;&nbsp;&nbsp;&nbsp;int purge<br>
1176);</p>
1177<h4 class="parameters">Parameters</h4>
1178<dl>
1179<dt>http</dt>
568fa3fa 1180<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1181<dt>name</dt>
1182<dd class="description">Name of printer or class</dd>
1183<dt>job_id</dt>
568fa3fa 1184<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
1185<dt>purge</dt>
1186<dd class="description">1 to purge, 0 to cancel</dd>
1187</dl>
1188<h4 class="returnvalue">Return Value</h4>
1189<p class="description">IPP status</p>
1190<h4 class="discussion">Discussion</h4>
1191<p class="discussion">Canceled jobs remain in the job history while purged jobs are removed
1192from the job history.<br>
1193<br>
1194Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
1195to cancel the current job on the named destination.<br>
1196<br>
1197Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
bc44d920 1198the cause of any failure.
5a738aea 1199
5a9febac
MS
1200</p>
1201<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsCheckDestSupported">cupsCheckDestSupported</a></h3>
1202<p class="description">Check that the option and value are supported
1203by the destination.</p>
1204<p class="code">
1205int cupsCheckDestSupported (<br>
1206&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1207&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1208&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
1209&nbsp;&nbsp;&nbsp;&nbsp;const char *option,<br>
1210&nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
1211);</p>
1212<h4 class="parameters">Parameters</h4>
1213<dl>
1214<dt>http</dt>
1215<dd class="description">Connection to destination</dd>
1216<dt>dest</dt>
1217<dd class="description">Destination</dd>
1218<dt>dinfo</dt>
1219<dd class="description">Destination information</dd>
1220<dt>option</dt>
1221<dd class="description">Option</dd>
1222<dt>value</dt>
1223<dd class="description">Value</dd>
1224</dl>
1225<h4 class="returnvalue">Return Value</h4>
1226<p class="description">1 if supported, 0 otherwise</p>
1227<h4 class="discussion">Discussion</h4>
1228<p class="discussion">Returns 1 if supported, 0 otherwise.
1229
1230</p>
1231<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsCloseDestJob">cupsCloseDestJob</a></h3>
1232<p class="description">Close a job and start printing.</p>
1233<p class="code">
1234ipp_status_t cupsCloseDestJob (<br>
1235&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1236&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1237&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *info,<br>
1238&nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
1239);</p>
1240<h4 class="parameters">Parameters</h4>
1241<dl>
1242<dt>http</dt>
1243<dd class="description">Connection to destination</dd>
1244<dt>dest</dt>
1245<dd class="description">Destination</dd>
1246<dt>info</dt>
1247<dd class="description">Destination information</dd>
1248<dt>job_id</dt>
1249<dd class="description">Job ID</dd>
1250</dl>
1251<h4 class="returnvalue">Return Value</h4>
1252<p class="description">IPP status code</p>
1253<h4 class="discussion">Discussion</h4>
1254<p class="discussion">Use when the last call to cupsStartDocument passed 0 for &quot;last_document&quot;.
1255&quot;job_id&quot; is the job ID returned by cupsCreateDestJob. Returns <code>IPP_OK</code>
1256on success.
1257
3e7fe0ca 1258</p>
f3c17241 1259<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsConnectDest">cupsConnectDest</a></h3>
3e7fe0ca
MS
1260<p class="description">Connect to the server for a destination.</p>
1261<p class="code">
1262http_t *cupsConnectDest (<br>
1263&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1264&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1265&nbsp;&nbsp;&nbsp;&nbsp;int msec,<br>
1266&nbsp;&nbsp;&nbsp;&nbsp;int *cancel,<br>
1267&nbsp;&nbsp;&nbsp;&nbsp;char *resource,<br>
1268&nbsp;&nbsp;&nbsp;&nbsp;size_t resourcesize,<br>
1269&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_cb_t">cups_dest_cb_t</a> cb,<br>
1270&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
1271);</p>
1272<h4 class="parameters">Parameters</h4>
1273<dl>
1274<dt>dest</dt>
1275<dd class="description">Destination</dd>
1276<dt>flags</dt>
1277<dd class="description">Connection flags</dd>
1278<dt>msec</dt>
1279<dd class="description">Timeout in milliseconds</dd>
1280<dt>cancel</dt>
1281<dd class="description">Pointer to &quot;cancel&quot; variable</dd>
1282<dt>resource</dt>
1283<dd class="description">Resource buffer</dd>
1284<dt>resourcesize</dt>
1285<dd class="description">Size of resource buffer</dd>
1286<dt>cb</dt>
1287<dd class="description">Callback function</dd>
1288<dt>user_data</dt>
1289<dd class="description">User data pointer</dd>
1290</dl>
1291<h4 class="returnvalue">Return Value</h4>
1292<p class="description">Connection to server or <code>NULL</code></p>
1293<h4 class="discussion">Discussion</h4>
1294<p class="discussion">Connect to the destination, returning a new http_t connection object and
1295optionally the resource path to use for the destination. These calls will
1296block until a connection is made, the timeout expires, the integer pointed
1297to by &quot;cancel&quot; is non-zero, or the callback function (or block) returns 0,
1298The caller is responsible for calling httpClose() on the returned object.
1299
1300</p>
f3c17241 1301<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsConnectDestBlock">cupsConnectDestBlock</a></h3>
3e7fe0ca
MS
1302<p class="description">Connect to the server for a destination.</p>
1303<p class="code">
1304http_t *cupsConnectDestBlock (<br>
1305&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1306&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1307&nbsp;&nbsp;&nbsp;&nbsp;int msec,<br>
1308&nbsp;&nbsp;&nbsp;&nbsp;int *cancel,<br>
1309&nbsp;&nbsp;&nbsp;&nbsp;char *resource,<br>
1310&nbsp;&nbsp;&nbsp;&nbsp;size_t resourcesize,<br>
1311&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_block_t">cups_dest_block_t</a> block<br>
1312);</p>
1313<h4 class="parameters">Parameters</h4>
1314<dl>
1315<dt>dest</dt>
1316<dd class="description">Destination</dd>
1317<dt>flags</dt>
1318<dd class="description">Connection flags</dd>
1319<dt>msec</dt>
1320<dd class="description">Timeout in milliseconds</dd>
1321<dt>cancel</dt>
1322<dd class="description">Pointer to &quot;cancel&quot; variable</dd>
1323<dt>resource</dt>
1324<dd class="description">Resource buffer</dd>
1325<dt>resourcesize</dt>
1326<dd class="description">Size of resource buffer</dd>
1327<dt>block</dt>
1328<dd class="description">Callback block</dd>
1329</dl>
1330<h4 class="returnvalue">Return Value</h4>
1331<p class="description">Connection to server or <code>NULL</code></p>
1332<h4 class="discussion">Discussion</h4>
1333<p class="discussion">Connect to the destination, returning a new http_t connection object and
1334optionally the resource path to use for the destination. These calls will
1335block until a connection is made, the timeout expires, the integer pointed
1336to by &quot;cancel&quot; is non-zero, or the callback function (or block) returns 0,
1337The caller is responsible for calling httpClose() on the returned object.
1338
1339</p>
1340<h3 class="function"><a name="cupsCopyDest">cupsCopyDest</a></h3>
1341<p class="description">Callback block</p>
1342<p class="code">
1343int cupsCopyDest (<br>
1344&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1345&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1346&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1347);</p>
1348<h4 class="parameters">Parameters</h4>
1349<dl>
1350<dt>dest</dt>
1351<dt>num_dests</dt>
1352<dt>dests</dt>
1353</dl>
1354<h4 class="returnvalue">Return Value</h4>
1355<p class="description">Copy a destination.</p>
1356<p class="discussion">Make a copy of the destination to an array of destinations (or just a single
1357copy) - for use with the cupsEnumDests* functions. The caller is responsible
1358for calling cupsFreeDests() on the returned object(s).
1359
5a9febac
MS
1360</p>
1361<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsCopyDestConflicts">cupsCopyDestConflicts</a></h3>
1362<p class="description">Get conflicts and resolutions for a new
1363option/value pair.</p>
1364<p class="code">
1365int cupsCopyDestConflicts (<br>
1366&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1367&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1368&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
1369&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1370&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options,<br>
1371&nbsp;&nbsp;&nbsp;&nbsp;const char *new_option,<br>
1372&nbsp;&nbsp;&nbsp;&nbsp;const char *new_value,<br>
1373&nbsp;&nbsp;&nbsp;&nbsp;int *num_conflicts,<br>
1374&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **conflicts,<br>
1375&nbsp;&nbsp;&nbsp;&nbsp;int *num_resolved,<br>
1376&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **resolved<br>
1377);</p>
1378<h4 class="parameters">Parameters</h4>
1379<dl>
1380<dt>http</dt>
1381<dd class="description">Connection to destination</dd>
1382<dt>dest</dt>
1383<dd class="description">Destination</dd>
1384<dt>dinfo</dt>
1385<dd class="description">Destination information</dd>
1386<dt>num_options</dt>
1387<dd class="description">Number of current options</dd>
1388<dt>options</dt>
1389<dd class="description">Current options</dd>
1390<dt>new_option</dt>
1391<dd class="description">New option</dd>
1392<dt>new_value</dt>
1393<dd class="description">New value</dd>
1394<dt>num_conflicts</dt>
1395<dd class="description">Number of conflicting options</dd>
1396<dt>conflicts</dt>
1397<dd class="description">Conflicting options</dd>
1398<dt>num_resolved</dt>
1399<dd class="description">Number of options to resolve</dd>
1400<dt>resolved</dt>
1401<dd class="description">Resolved options</dd>
1402</dl>
1403<h4 class="returnvalue">Return Value</h4>
1404<p class="description">1 if there is a conflict, 0 if none, -1 on error</p>
1405<h4 class="discussion">Discussion</h4>
1406<p class="discussion">&quot;num_options&quot; and &quot;options&quot; represent the currently selected options by the
1407user. &quot;new_option&quot; and &quot;new_value&quot; are the setting the user has just
1408changed.<br>
1409<br>
1410Returns 1 if there is a conflict, 0 if there are no conflicts, and -1 if
1411there was an unrecoverable error such as a resolver loop.<br>
1412<br>
1413If &quot;num_conflicts&quot; and &quot;conflicts&quot; are not <code>NULL</code>, they are set to
1414contain the list of conflicting option/value pairs. Similarly, if
1415&quot;num_resolved&quot; and &quot;resolved&quot; are not <code>NULL</code> they will be set to the
1416list of changes needed to resolve the conflict.<br>
1417<br>
1418If cupsCopyDestConflicts returns 1 but &quot;num_resolved&quot; and &quot;resolved&quot; are set
1419to 0 and <code>NULL</code>, respectively, then the conflict cannot be resolved.
1420
1421</p>
1422<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsCopyDestInfo">cupsCopyDestInfo</a></h3>
1423<p class="description">Get the supported values/capabilities for the
1424destination.</p>
1425<p class="code">
1426<a href="#cups_dinfo_t">cups_dinfo_t</a> *cupsCopyDestInfo (<br>
1427&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1428&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest<br>
1429);</p>
1430<h4 class="parameters">Parameters</h4>
1431<dl>
1432<dt>http</dt>
1433<dd class="description">Connection to destination</dd>
1434<dt>dest</dt>
1435<dd class="description">Destination</dd>
1436</dl>
1437<h4 class="returnvalue">Return Value</h4>
1438<p class="description">Destination information</p>
1439<h4 class="discussion">Discussion</h4>
1440<p class="discussion">The caller is responsible for calling <a href="#cupsFreeDestInfo"><code>cupsFreeDestInfo</code></a> on the return
1441value. <code>NULL</code> is returned on error.
1442
1443</p>
1444<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsCreateDestJob">cupsCreateDestJob</a></h3>
1445<p class="description">Create a job on a destination.</p>
1446<p class="code">
1447ipp_status_t cupsCreateDestJob (<br>
1448&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1449&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1450&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *info,<br>
1451&nbsp;&nbsp;&nbsp;&nbsp;int *job_id,<br>
1452&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1453&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1454&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1455);</p>
1456<h4 class="parameters">Parameters</h4>
1457<dl>
1458<dt>http</dt>
1459<dd class="description">Connection to destination</dd>
1460<dt>dest</dt>
1461<dd class="description">Destination</dd>
1462<dt>info</dt>
1463<dd class="description">Destination information</dd>
1464<dt>job_id</dt>
1465<dd class="description">Job ID or 0 on error</dd>
1466<dt>title</dt>
1467<dd class="description">Job name</dd>
1468<dt>num_options</dt>
1469<dd class="description">Number of job options</dd>
1470<dt>options</dt>
1471<dd class="description">Job options</dd>
1472</dl>
1473<h4 class="returnvalue">Return Value</h4>
1474<p class="description">IPP status code</p>
1475<h4 class="discussion">Discussion</h4>
1476<p class="discussion">Returns <code>IPP_OK</code> or <code>IPP_OK_SUBST</code> on success, saving the job ID
1477in the variable pointed to by &quot;job_id&quot;.
1478
5a738aea 1479</p>
f3c17241 1480<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsCreateJob">cupsCreateJob</a></h3>
568fa3fa 1481<p class="description">Create an empty job for streaming.</p>
5a738aea
MS
1482<p class="code">
1483int cupsCreateJob (<br>
1484&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1485&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1486&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1487&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1488&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1489);</p>
1490<h4 class="parameters">Parameters</h4>
1491<dl>
1492<dt>http</dt>
568fa3fa 1493<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1494<dt>name</dt>
568fa3fa 1495<dd class="description">Destination name</dd>
5a738aea
MS
1496<dt>title</dt>
1497<dd class="description">Title of job</dd>
1498<dt>num_options</dt>
1499<dd class="description">Number of options</dd>
1500<dt>options</dt>
1501<dd class="description">Options</dd>
1502</dl>
1503<h4 class="returnvalue">Return Value</h4>
1504<p class="description">Job ID or 0 on error</p>
1505<h4 class="discussion">Discussion</h4>
568fa3fa
MS
1506<p class="discussion">Use this function when you want to stream print data using the
1507<a href="#cupsStartDocument"><code>cupsStartDocument</code></a>, <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a>, and
1508<a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> functions. If you have one or more files to
1509print, use the <a href="#cupsPrintFile2"><code>cupsPrintFile2</code></a> or <a href="#cupsPrintFiles2"><code>cupsPrintFiles2</code></a> function
1510instead.
5a738aea
MS
1511
1512</p>
1513<h3 class="function"><a name="cupsEncryption">cupsEncryption</a></h3>
aaf19ab0 1514<p class="description">Get the current encryption settings.</p>
5a738aea
MS
1515<p class="code">
1516http_encryption_t cupsEncryption (void);</p>
1517<h4 class="returnvalue">Return Value</h4>
1518<p class="description">Encryption settings</p>
1519<h4 class="discussion">Discussion</h4>
1520<p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
568fa3fa 1521environment variable, then the ~/.cups/client.conf file, and finally the
ef416fc2 1522/etc/cups/client.conf file. If not set, the default is
aaf19ab0
MS
1523<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
1524<br>
1525Note: The current encryption setting is tracked separately for each thread
1526in a program. Multi-threaded programs that override the setting via the
1527<a href="#cupsSetEncryption"><code>cupsSetEncryption</code></a> function need to do so in each thread for the same
1528setting to be used.</p>
f3c17241 1529<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsEnumDests">cupsEnumDests</a></h3>
3e7fe0ca
MS
1530<p class="description">Enumerate available destinations with a callback function.</p>
1531<p class="code">
1532int cupsEnumDests (<br>
1533&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1534&nbsp;&nbsp;&nbsp;&nbsp;int msec,<br>
1535&nbsp;&nbsp;&nbsp;&nbsp;int *cancel,<br>
1536&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_ptype_t">cups_ptype_t</a> type,<br>
1537&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_ptype_t">cups_ptype_t</a> mask,<br>
1538&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_cb_t">cups_dest_cb_t</a> cb,<br>
1539&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
1540);</p>
1541<h4 class="parameters">Parameters</h4>
1542<dl>
1543<dt>flags</dt>
1544<dd class="description">Enumeration flags</dd>
1545<dt>msec</dt>
1546<dd class="description">Timeout in milliseconds,
1547-1 for indefinite</dd>
1548<dt>cancel</dt>
1549<dd class="description">Pointer to &quot;cancel&quot; variable</dd>
1550<dt>type</dt>
1551<dd class="description">Printer type bits</dd>
1552<dt>mask</dt>
1553<dd class="description">Mask for printer type bits</dd>
1554<dt>cb</dt>
1555<dd class="description">Callback function</dd>
1556<dt>user_data</dt>
1557<dd class="description">User data</dd>
1558</dl>
1559<h4 class="returnvalue">Return Value</h4>
1560<p class="description">1 on success, 0 on failure</p>
1561<h4 class="discussion">Discussion</h4>
1562<p class="discussion">Destinations are enumerated from one or more sources. The callback function
1563receives the <code>user_data</code> pointer, destination name, instance, number of
1564options, and options which can be used as input to the <a href="#cupsAddDest"><code>cupsAddDest</code></a>
1565function. The function must return 1 to continue enumeration or 0 to stop.<br>
1566<br>
1567Enumeration happens on the current thread and does not return until all
1568destinations have been enumerated or the callback function returns 0.
1569
1570</p>
f3c17241 1571<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsEnumDestsBlock">cupsEnumDestsBlock</a></h3>
3e7fe0ca
MS
1572<p class="description">Enumerate available destinations with a block.</p>
1573<p class="code">
1574int cupsEnumDestsBlock (<br>
1575&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1576&nbsp;&nbsp;&nbsp;&nbsp;int timeout,<br>
1577&nbsp;&nbsp;&nbsp;&nbsp;int *cancel,<br>
1578&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_ptype_t">cups_ptype_t</a> type,<br>
1579&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_ptype_t">cups_ptype_t</a> mask,<br>
1580&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_block_t">cups_dest_block_t</a> block<br>
1581);</p>
1582<h4 class="parameters">Parameters</h4>
1583<dl>
1584<dt>flags</dt>
1585<dd class="description">Enumeration flags</dd>
1586<dt>timeout</dt>
1587<dd class="description">Timeout in milliseconds, 0 for indefinite</dd>
1588<dt>cancel</dt>
1589<dd class="description">Pointer to &quot;cancel&quot; variable</dd>
1590<dt>type</dt>
1591<dd class="description">Printer type bits</dd>
1592<dt>mask</dt>
1593<dd class="description">Mask for printer type bits</dd>
1594<dt>block</dt>
1595<dd class="description">Block</dd>
1596</dl>
1597<h4 class="returnvalue">Return Value</h4>
1598<p class="description">1 on success, 0 on failure</p>
1599<h4 class="discussion">Discussion</h4>
1600<p class="discussion">Destinations are enumerated from one or more sources. The block receives the
1601destination name, instance, number of options, and options which can be used
1602as input to the <a href="#cupsAddDest"><code>cupsAddDest</code></a> function. The block must return 1 to
1603continue enumeration or 0 to stop.<br>
1604<br>
1605Enumeration happens on the current thread and does not return until all
1606destinations have been enumerated or the block returns 0.
1607
5a9febac
MS
1608</p>
1609<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsFinishDestDocument">cupsFinishDestDocument</a></h3>
1610<p class="description">Finish the current document.</p>
1611<p class="code">
1612ipp_status_t cupsFinishDestDocument (<br>
1613&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1614&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1615&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *info<br>
1616);</p>
1617<h4 class="parameters">Parameters</h4>
1618<dl>
1619<dt>http</dt>
1620<dd class="description">Connection to destination</dd>
1621<dt>dest</dt>
1622<dd class="description">Destination</dd>
1623<dt>info</dt>
1624<dd class="description">Destination information</dd>
1625</dl>
1626<h4 class="returnvalue">Return Value</h4>
1627<p class="description">Status of document submission</p>
1628<h4 class="discussion">Discussion</h4>
1629<p class="discussion">Returns <code>IPP_OK</code> or <code>IPP_OK_SUBST</code> on success.
1630
3e7fe0ca 1631</p>
f3c17241 1632<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsFinishDocument">cupsFinishDocument</a></h3>
5a738aea
MS
1633<p class="description">Finish sending a document.</p>
1634<p class="code">
1635ipp_status_t cupsFinishDocument (<br>
1636&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1637&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1638);</p>
1639<h4 class="parameters">Parameters</h4>
1640<dl>
1641<dt>http</dt>
568fa3fa 1642<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 1643<dt>name</dt>
568fa3fa 1644<dd class="description">Destination name</dd>
5a738aea
MS
1645</dl>
1646<h4 class="returnvalue">Return Value</h4>
1647<p class="description">Status of document submission</p>
1648<h4 class="discussion">Discussion</h4>
1649<p class="discussion">The document must have been started using <a href="#cupsStartDocument"><code>cupsStartDocument</code></a>.
1650
1651</p>
5a9febac
MS
1652<h3 class="function"><a name="cupsFreeDestInfo">cupsFreeDestInfo</a></h3>
1653<p class="description">Free destination information obtained using
1654<a href="#cupsCopyDestInfo"><code>cupsCopyDestInfo</code></a>.</p>
1655<p class="code">
1656void cupsFreeDestInfo (<br>
1657&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo<br>
1658);</p>
1659<h4 class="parameters">Parameters</h4>
1660<dl>
1661<dt>dinfo</dt>
1662<dd class="description">Destination information</dd>
1663</dl>
5a738aea
MS
1664<h3 class="function"><a name="cupsFreeDests">cupsFreeDests</a></h3>
1665<p class="description">Free the memory used by the list of destinations.</p>
1666<p class="code">
1667void cupsFreeDests (<br>
1668&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1669&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1670);</p>
1671<h4 class="parameters">Parameters</h4>
1672<dl>
1673<dt>num_dests</dt>
1674<dd class="description">Number of destinations</dd>
1675<dt>dests</dt>
1676<dd class="description">Destinations</dd>
1677</dl>
1678<h3 class="function"><a name="cupsFreeJobs">cupsFreeJobs</a></h3>
1679<p class="description">Free memory used by job data.</p>
1680<p class="code">
1681void cupsFreeJobs (<br>
1682&nbsp;&nbsp;&nbsp;&nbsp;int num_jobs,<br>
1683&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> *jobs<br>
1684);</p>
1685<h4 class="parameters">Parameters</h4>
1686<dl>
1687<dt>num_jobs</dt>
1688<dd class="description">Number of jobs</dd>
1689<dt>jobs</dt>
1690<dd class="description">Jobs</dd>
1691</dl>
1692<h3 class="function"><a name="cupsFreeOptions">cupsFreeOptions</a></h3>
1693<p class="description">Free all memory used by options.</p>
1694<p class="code">
1695void cupsFreeOptions (<br>
1696&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1697&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1698);</p>
1699<h4 class="parameters">Parameters</h4>
1700<dl>
1701<dt>num_options</dt>
1702<dd class="description">Number of options</dd>
1703<dt>options</dt>
1704<dd class="description">Pointer to options</dd>
1705</dl>
1706<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetClasses">cupsGetClasses</a></h3>
1707<p class="description">Get a list of printer classes from the default server.</p>
1708<p class="code">
1709int cupsGetClasses (<br>
1710&nbsp;&nbsp;&nbsp;&nbsp;char ***classes<br>
1711);</p>
1712<h4 class="parameters">Parameters</h4>
1713<dl>
1714<dt>classes</dt>
1715<dd class="description">Classes</dd>
1716</dl>
1717<h4 class="returnvalue">Return Value</h4>
1718<p class="description">Number of classes</p>
1719<h4 class="discussion">Discussion</h4>
1720<p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
1721
1722</p>
1723<h3 class="function"><a name="cupsGetDefault">cupsGetDefault</a></h3>
1724<p class="description">Get the default printer or class for the default server.</p>
1725<p class="code">
1726const char *cupsGetDefault (void);</p>
1727<h4 class="returnvalue">Return Value</h4>
1728<p class="description">Default printer or <code>NULL</code></p>
1729<h4 class="discussion">Discussion</h4>
1730<p class="discussion">This function returns the default printer or class as defined by
ef416fc2 1731the LPDEST or PRINTER environment variables. If these environment
1732variables are not set, the server default destination is returned.
5a738aea
MS
1733Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1734functions to get the user-defined default printer, as this function does
1735not support the lpoptions-defined default printer.</p>
f3c17241 1736<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsGetDefault2">cupsGetDefault2</a></h3>
5a738aea
MS
1737<p class="description">Get the default printer or class for the specified server.</p>
1738<p class="code">
1739const char *cupsGetDefault2 (<br>
1740&nbsp;&nbsp;&nbsp;&nbsp;http_t *http<br>
1741);</p>
1742<h4 class="parameters">Parameters</h4>
1743<dl>
1744<dt>http</dt>
568fa3fa 1745<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1746</dl>
1747<h4 class="returnvalue">Return Value</h4>
1748<p class="description">Default printer or <code>NULL</code></p>
1749<h4 class="discussion">Discussion</h4>
1750<p class="discussion">This function returns the default printer or class as defined by
ef416fc2 1751the LPDEST or PRINTER environment variables. If these environment
1752variables are not set, the server default destination is returned.
5a738aea
MS
1753Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1754functions to get the user-defined default printer, as this function does
1755not support the lpoptions-defined default printer.
1756
1757</p>
1758<h3 class="function"><a name="cupsGetDest">cupsGetDest</a></h3>
1759<p class="description">Get the named destination from the list.</p>
1760<p class="code">
1761<a href="#cups_dest_t">cups_dest_t</a> *cupsGetDest (<br>
1762&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1763&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1764&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1765&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1766);</p>
1767<h4 class="parameters">Parameters</h4>
1768<dl>
1769<dt>name</dt>
1770<dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
1771<dt>instance</dt>
1772<dd class="description">Instance name or <code>NULL</code></dd>
1773<dt>num_dests</dt>
1774<dd class="description">Number of destinations</dd>
1775<dt>dests</dt>
1776<dd class="description">Destinations</dd>
1777</dl>
1778<h4 class="returnvalue">Return Value</h4>
1779<p class="description">Destination pointer or <code>NULL</code></p>
1780<h4 class="discussion">Discussion</h4>
1781<p class="discussion">Use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> or <a href="#cupsGetDests2"><code>cupsGetDests2</code></a> functions to get a
1782list of supported destinations for the current user.</p>
5a9febac
MS
1783<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsGetDestMediaByName">cupsGetDestMediaByName</a></h3>
1784<p class="description">Get media names, dimensions, and margins.</p>
1785<p class="code">
1786int cupsGetDestMediaByName (<br>
1787&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1788&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1789&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
1790&nbsp;&nbsp;&nbsp;&nbsp;const char *media,<br>
1791&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1792&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_size_t">cups_size_t</a> *size<br>
1793);</p>
1794<h4 class="parameters">Parameters</h4>
1795<dl>
1796<dt>http</dt>
1797<dd class="description">Connection to destination</dd>
1798<dt>dest</dt>
1799<dd class="description">Destination</dd>
1800<dt>dinfo</dt>
1801<dd class="description">Destination information</dd>
1802<dt>media</dt>
1803<dd class="description">Media name</dd>
1804<dt>flags</dt>
1805<dd class="description">Media matching flags</dd>
1806<dt>size</dt>
1807<dd class="description">Media size information</dd>
1808</dl>
1809<h4 class="returnvalue">Return Value</h4>
1810<p class="description">1 on match, 0 on failure</p>
1811<h4 class="discussion">Discussion</h4>
1812<p class="discussion">The &quot;media&quot; string is a PWG media name. &quot;Flags&quot; provides some matching
1813guidance (multiple flags can be combined):<br>
1814<br>
1815CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
1816CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
1817CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing,
1818CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
1819CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
1820size amongst the &quot;ready&quot; media.<br>
1821<br>
1822The matching result (if any) is returned in the &quot;cups_size_t&quot; structure.<br>
1823<br>
1824Returns 1 when there is a match and 0 if there is not a match.
1825
1826</p>
1827<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsGetDestMediaBySize">cupsGetDestMediaBySize</a></h3>
1828<p class="description">Get media names, dimensions, and margins.</p>
1829<p class="code">
1830int cupsGetDestMediaBySize (<br>
1831&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1832&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
1833&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
1834&nbsp;&nbsp;&nbsp;&nbsp;int width,<br>
1835&nbsp;&nbsp;&nbsp;&nbsp;int length,<br>
1836&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
1837&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_size_t">cups_size_t</a> *size<br>
1838);</p>
1839<h4 class="parameters">Parameters</h4>
1840<dl>
1841<dt>http</dt>
1842<dd class="description">Connection to destination</dd>
1843<dt>dest</dt>
1844<dd class="description">Destination</dd>
1845<dt>dinfo</dt>
1846<dd class="description">Destination information</dd>
1847<dt>width</dt>
1848<dd class="description">Media width in hundredths of
1849of millimeters</dd>
1850<dt>length</dt>
1851<dd class="description">Media length in hundredths of
1852of millimeters</dd>
1853<dt>flags</dt>
1854<dd class="description">Media matching flags</dd>
1855<dt>size</dt>
1856<dd class="description">Media size information</dd>
1857</dl>
1858<h4 class="returnvalue">Return Value</h4>
1859<p class="description">1 on match, 0 on failure</p>
1860<h4 class="discussion">Discussion</h4>
1861<p class="discussion">&quot;Width&quot; and &quot;length&quot; are the dimensions in hundredths of millimeters.
1862&quot;Flags&quot; provides some matching guidance (multiple flags can be combined):<br>
1863<br>
1864CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer,
1865CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
1866CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing,
1867CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and
1868CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the
1869size amongst the &quot;ready&quot; media.<br>
1870<br>
1871The matching result (if any) is returned in the &quot;cups_size_t&quot; structure.<br>
1872<br>
1873Returns 1 when there is a match and 0 if there is not a match.
1874
1875</p>
5a738aea
MS
1876<h3 class="function"><a name="cupsGetDests">cupsGetDests</a></h3>
1877<p class="description">Get the list of destinations from the default server.</p>
1878<p class="code">
1879int cupsGetDests (<br>
1880&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1881);</p>
1882<h4 class="parameters">Parameters</h4>
1883<dl>
1884<dt>dests</dt>
1885<dd class="description">Destinations</dd>
1886</dl>
1887<h4 class="returnvalue">Return Value</h4>
1888<p class="description">Number of destinations</p>
1889<h4 class="discussion">Discussion</h4>
1890<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 1891printer-info, printer-is-accepting-jobs, printer-is-shared,
1892printer-make-and-model, printer-state, printer-state-change-time,
426c6a59
MS
1893printer-state-reasons, and printer-type attributes as options. CUPS 1.4
1894adds the marker-change-time, marker-colors, marker-high-levels,
1895marker-levels, marker-low-levels, marker-message, marker-names,
1896marker-types, and printer-commands attributes as well.<br>
5a738aea
MS
1897<br>
1898Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1899the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.</p>
f3c17241 1900<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsGetDests2">cupsGetDests2</a></h3>
5a738aea
MS
1901<p class="description">Get the list of destinations from the specified server.</p>
1902<p class="code">
1903int cupsGetDests2 (<br>
1904&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1905&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1906);</p>
1907<h4 class="parameters">Parameters</h4>
1908<dl>
1909<dt>http</dt>
568fa3fa 1910<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1911<dt>dests</dt>
1912<dd class="description">Destinations</dd>
1913</dl>
1914<h4 class="returnvalue">Return Value</h4>
1915<p class="description">Number of destinations</p>
1916<h4 class="discussion">Discussion</h4>
1917<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
ecdc0628 1918printer-info, printer-is-accepting-jobs, printer-is-shared,
1919printer-make-and-model, printer-state, printer-state-change-time,
426c6a59
MS
1920printer-state-reasons, and printer-type attributes as options. CUPS 1.4
1921adds the marker-change-time, marker-colors, marker-high-levels,
1922marker-levels, marker-low-levels, marker-message, marker-names,
1923marker-types, and printer-commands attributes as well.<br>
5a738aea
MS
1924<br>
1925Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1926the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.
ef416fc2 1927
5a738aea
MS
1928</p>
1929<h3 class="function"><a name="cupsGetJobs">cupsGetJobs</a></h3>
1930<p class="description">Get the jobs from the default server.</p>
1931<p class="code">
1932int cupsGetJobs (<br>
1933&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1934&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1935&nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1936&nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1937);</p>
1938<h4 class="parameters">Parameters</h4>
1939<dl>
1940<dt>jobs</dt>
1941<dd class="description">Job data</dd>
1942<dt>name</dt>
568fa3fa 1943<dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
5a738aea
MS
1944<dt>myjobs</dt>
1945<dd class="description">0 = all users, 1 = mine</dd>
1946<dt>whichjobs</dt>
1947<dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1948</dl>
1949<h4 class="returnvalue">Return Value</h4>
1950<p class="description">Number of jobs</p>
1951<h4 class="discussion">Discussion</h4>
1952<p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1953of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1954pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1955jobs that are stopped, canceled, aborted, or completed.</p>
f3c17241 1956<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsGetJobs2">cupsGetJobs2</a></h3>
5a738aea
MS
1957<p class="description">Get the jobs from the specified server.</p>
1958<p class="code">
1959int cupsGetJobs2 (<br>
1960&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1961&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1962&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1963&nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1964&nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1965);</p>
1966<h4 class="parameters">Parameters</h4>
1967<dl>
1968<dt>http</dt>
568fa3fa 1969<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
1970<dt>jobs</dt>
1971<dd class="description">Job data</dd>
1972<dt>name</dt>
568fa3fa 1973<dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
5a738aea
MS
1974<dt>myjobs</dt>
1975<dd class="description">0 = all users, 1 = mine</dd>
1976<dt>whichjobs</dt>
1977<dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1978</dl>
1979<h4 class="returnvalue">Return Value</h4>
1980<p class="description">Number of jobs</p>
1981<h4 class="discussion">Discussion</h4>
1982<p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1983of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1984pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1985jobs that are stopped, canceled, aborted, or completed.
1986
1987</p>
f3c17241 1988<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsGetNamedDest">cupsGetNamedDest</a></h3>
5a738aea
MS
1989<p class="description">Get options for the named destination.</p>
1990<p class="code">
1991<a href="#cups_dest_t">cups_dest_t</a> *cupsGetNamedDest (<br>
1992&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1993&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1994&nbsp;&nbsp;&nbsp;&nbsp;const char *instance<br>
1995);</p>
1996<h4 class="parameters">Parameters</h4>
1997<dl>
1998<dt>http</dt>
568fa3fa 1999<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 2000<dt>name</dt>
568fa3fa 2001<dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
5a738aea
MS
2002<dt>instance</dt>
2003<dd class="description">Instance name or <code>NULL</code></dd>
2004</dl>
2005<h4 class="returnvalue">Return Value</h4>
2006<p class="description">Destination or <code>NULL</code></p>
2007<h4 class="discussion">Discussion</h4>
2008<p class="discussion">This function is optimized for retrieving a single destination and should
2009be used instead of <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a> when you either
2010know the name of the destination or want to print to the default destination.
2011If <code>NULL</code> is returned, the destination does not exist or there is no
2012default destination.<br>
2013<br>
2014If &quot;http&quot; is <code>CUPS_HTTP_DEFAULT</code>, the connection to the default print
2015server will be used.<br>
2016<br>
2017If &quot;name&quot; is <code>NULL</code>, the default printer for the current user will be
2018returned.<br>
2019<br>
2020The returned destination must be freed using <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> with a
2021&quot;num_dests&quot; value of 1.
2022
2023</p>
2024<h3 class="function"><a name="cupsGetOption">cupsGetOption</a></h3>
2025<p class="description">Get an option value.</p>
2026<p class="code">
2027const char *cupsGetOption (<br>
2028&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2029&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2030&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
2031);</p>
2032<h4 class="parameters">Parameters</h4>
2033<dl>
2034<dt>name</dt>
2035<dd class="description">Name of option</dd>
2036<dt>num_options</dt>
2037<dd class="description">Number of options</dd>
2038<dt>options</dt>
2039<dd class="description">Options</dd>
2040</dl>
2041<h4 class="returnvalue">Return Value</h4>
2042<p class="description">Option value or <code>NULL</code></p>
2043<h3 class="function"><a name="cupsGetPPD">cupsGetPPD</a></h3>
2044<p class="description">Get the PPD file for a printer on the default server.</p>
2045<p class="code">
2046const char *cupsGetPPD (<br>
2047&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
2048);</p>
2049<h4 class="parameters">Parameters</h4>
2050<dl>
2051<dt>name</dt>
568fa3fa 2052<dd class="description">Destination name</dd>
5a738aea
MS
2053</dl>
2054<h4 class="returnvalue">Return Value</h4>
2055<p class="description">Filename for PPD file</p>
2056<h4 class="discussion">Discussion</h4>
2057<p class="discussion">For classes, <code>cupsGetPPD</code> returns the PPD file for the first printer
568fa3fa
MS
2058in the class.<br>
2059<br>
2060The returned filename is stored in a static buffer and is overwritten with
4e6f60f0
MS
2061each call to <code>cupsGetPPD</code> or <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>. The caller &quot;owns&quot; the
2062file that is created and must <code>unlink</code> the returned filename.</p>
f3c17241 2063<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsGetPPD2">cupsGetPPD2</a></h3>
5a738aea
MS
2064<p class="description">Get the PPD file for a printer from the specified server.</p>
2065<p class="code">
2066const char *cupsGetPPD2 (<br>
2067&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2068&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
2069);</p>
2070<h4 class="parameters">Parameters</h4>
2071<dl>
2072<dt>http</dt>
568fa3fa 2073<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 2074<dt>name</dt>
568fa3fa 2075<dd class="description">Destination name</dd>
5a738aea
MS
2076</dl>
2077<h4 class="returnvalue">Return Value</h4>
2078<p class="description">Filename for PPD file</p>
2079<h4 class="discussion">Discussion</h4>
2080<p class="discussion">For classes, <code>cupsGetPPD2</code> returns the PPD file for the first printer
568fa3fa
MS
2081in the class.<br>
2082<br>
2083The returned filename is stored in a static buffer and is overwritten with
4e6f60f0
MS
2084each call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a> or <code>cupsGetPPD2</code>. The caller &quot;owns&quot; the
2085file that is created and must <code>unlink</code> the returned filename.
5a738aea
MS
2086
2087</p>
f3c17241 2088<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsGetPPD3">cupsGetPPD3</a></h3>
5a738aea
MS
2089<p class="description">Get the PPD file for a printer on the specified
2090server if it has changed.</p>
2091<p class="code">
2092http_status_t cupsGetPPD3 (<br>
2093&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2094&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2095&nbsp;&nbsp;&nbsp;&nbsp;time_t *modtime,<br>
2096&nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>
2097&nbsp;&nbsp;&nbsp;&nbsp;size_t bufsize<br>
2098);</p>
2099<h4 class="parameters">Parameters</h4>
2100<dl>
2101<dt>http</dt>
2102<dd class="description">HTTP connection or <code>CUPS_HTTP_DEFAULT</code></dd>
2103<dt>name</dt>
568fa3fa 2104<dd class="description">Destination name</dd>
5a738aea
MS
2105<dt>modtime</dt>
2106<dd class="description">Modification time</dd>
2107<dt>buffer</dt>
2108<dd class="description">Filename buffer</dd>
2109<dt>bufsize</dt>
2110<dd class="description">Size of filename buffer</dd>
2111</dl>
2112<h4 class="returnvalue">Return Value</h4>
2113<p class="description">HTTP status</p>
2114<h4 class="discussion">Discussion</h4>
2115<p class="discussion">The &quot;modtime&quot; parameter contains the modification time of any
2e4ff8af 2116locally-cached content and is updated with the time from the PPD file on
5a738aea
MS
2117the server.<br>
2118<br>
2119The &quot;buffer&quot; parameter contains the local PPD filename. If it contains
2e4ff8af 2120the empty string, a new temporary file is created, otherwise the existing
4e6f60f0
MS
2121file will be overwritten as needed. The caller &quot;owns&quot; the file that is
2122created and must <code>unlink</code> the returned filename.<br>
5a738aea
MS
2123<br>
2124On success, <code>HTTP_OK</code> is returned for a new PPD file and
2125<code>HTTP_NOT_MODIFIED</code> if the existing PPD file is up-to-date. Any other
2126status is an error.<br>
2127<br>
2128For classes, <code>cupsGetPPD3</code> returns the PPD file for the first printer
568fa3fa
MS
2129in the class.
2130
2131</p>
5a738aea
MS
2132<h3 class="function"><a name="cupsGetPassword">cupsGetPassword</a></h3>
2133<p class="description">Get a password from the user.</p>
2134<p class="code">
2135const char *cupsGetPassword (<br>
2136&nbsp;&nbsp;&nbsp;&nbsp;const char *prompt<br>
2137);</p>
2138<h4 class="parameters">Parameters</h4>
2139<dl>
2140<dt>prompt</dt>
2141<dd class="description">Prompt string</dd>
2142</dl>
2143<h4 class="returnvalue">Return Value</h4>
2144<p class="description">Password</p>
2145<h4 class="discussion">Discussion</h4>
2146<p class="discussion">Uses the current password callback function. Returns <code>NULL</code> if the
aaf19ab0
MS
2147user does not provide a password.<br>
2148<br>
2149Note: The current password callback function is tracked separately for each
2150thread in a program. Multi-threaded programs that override the setting via
2151the <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a> or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a> functions need to
2152do so in each thread for the same function to be used.</p>
f3c17241 2153<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsGetPassword2">cupsGetPassword2</a></h3>
f11a948a 2154<p class="description">Get a password from the user using the advanced
aaf19ab0 2155password callback.</p>
f11a948a
MS
2156<p class="code">
2157const char *cupsGetPassword2 (<br>
2158&nbsp;&nbsp;&nbsp;&nbsp;const char *prompt,<br>
2159&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2160&nbsp;&nbsp;&nbsp;&nbsp;const char *method,<br>
2161&nbsp;&nbsp;&nbsp;&nbsp;const char *resource<br>
2162);</p>
2163<h4 class="parameters">Parameters</h4>
2164<dl>
2165<dt>prompt</dt>
2166<dd class="description">Prompt string</dd>
2167<dt>http</dt>
2168<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
2169<dt>method</dt>
2170<dd class="description">Request method (&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;)</dd>
2171<dt>resource</dt>
2172<dd class="description">Resource path</dd>
2173</dl>
2174<h4 class="returnvalue">Return Value</h4>
2175<p class="description">Password</p>
2176<h4 class="discussion">Discussion</h4>
2177<p class="discussion">Uses the current password callback function. Returns <code>NULL</code> if the
aaf19ab0
MS
2178user does not provide a password.<br>
2179<br>
2180Note: The current password callback function is tracked separately for each
2181thread in a program. Multi-threaded programs that override the setting via
2182the <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a> or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a> functions need to
2183do so in each thread for the same function to be used.
f11a948a
MS
2184
2185</p>
5a738aea
MS
2186<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetPrinters">cupsGetPrinters</a></h3>
2187<p class="description">Get a list of printers from the default server.</p>
2188<p class="code">
2189int cupsGetPrinters (<br>
2190&nbsp;&nbsp;&nbsp;&nbsp;char ***printers<br>
2191);</p>
2192<h4 class="parameters">Parameters</h4>
2193<dl>
2194<dt>printers</dt>
2195<dd class="description">Printers</dd>
2196</dl>
2197<h4 class="returnvalue">Return Value</h4>
2198<p class="description">Number of printers</p>
2199<h4 class="discussion">Discussion</h4>
2200<p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
2201
2202</p>
f3c17241 2203<h3 class="function"><span class="info">&nbsp;CUPS 1.3/OS X 10.5&nbsp;</span><a name="cupsGetServerPPD">cupsGetServerPPD</a></h3>
5a738aea
MS
2204<p class="description">Get an available PPD file from the server.</p>
2205<p class="code">
2206char *cupsGetServerPPD (<br>
2207&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2208&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
2209);</p>
2210<h4 class="parameters">Parameters</h4>
2211<dl>
2212<dt>http</dt>
568fa3fa 2213<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
2214<dt>name</dt>
2215<dd class="description">Name of PPD file (&quot;ppd-name&quot;)</dd>
2216</dl>
2217<h4 class="returnvalue">Return Value</h4>
2218<p class="description">Name of PPD file or <code>NULL</code> on error</p>
2219<h4 class="discussion">Discussion</h4>
2220<p class="discussion">This function returns the named PPD file from the server. The
2221list of available PPDs is provided by the IPP <code>CUPS_GET_PPDS</code>
2222operation.<br>
2223<br>
2224You must remove (unlink) the PPD file when you are finished with
bc44d920 2225it. The PPD filename is stored in a static location that will be
5a738aea
MS
2226overwritten on the next call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a>, <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>,
2227or <a href="#cupsGetServerPPD"><code>cupsGetServerPPD</code></a>.
2228
2229</p>
2230<h3 class="function"><a name="cupsLangDefault">cupsLangDefault</a></h3>
2231<p class="description">Return the default language.</p>
2232<p class="code">
2233cups_lang_t *cupsLangDefault (void);</p>
2234<h4 class="returnvalue">Return Value</h4>
2235<p class="description">Language data</p>
2236<h3 class="function"><a name="cupsLangEncoding">cupsLangEncoding</a></h3>
2237<p class="description">Return the character encoding (us-ascii, etc.)
2238for the given language.</p>
2239<p class="code">
2240const char *cupsLangEncoding (<br>
2241&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
2242);</p>
2243<h4 class="parameters">Parameters</h4>
2244<dl>
2245<dt>lang</dt>
2246<dd class="description">Language data</dd>
2247</dl>
2248<h4 class="returnvalue">Return Value</h4>
2249<p class="description">Character encoding</p>
2250<h3 class="function"><a name="cupsLangFlush">cupsLangFlush</a></h3>
2251<p class="description">Flush all language data out of the cache.</p>
2252<p class="code">
2253void cupsLangFlush (void);</p>
2254<h3 class="function"><a name="cupsLangFree">cupsLangFree</a></h3>
2255<p class="description">Free language data.</p>
2256<p class="code">
2257void cupsLangFree (<br>
2258&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
2259);</p>
2260<h4 class="parameters">Parameters</h4>
2261<dl>
2262<dt>lang</dt>
2263<dd class="description">Language to free</dd>
2264</dl>
2265<h4 class="discussion">Discussion</h4>
2266<p class="discussion">This does not actually free anything; use <a href="#cupsLangFlush"><code>cupsLangFlush</code></a> for that.</p>
2267<h3 class="function"><a name="cupsLangGet">cupsLangGet</a></h3>
2268<p class="description">Get a language.</p>
2269<p class="code">
2270cups_lang_t *cupsLangGet (<br>
2271&nbsp;&nbsp;&nbsp;&nbsp;const char *language<br>
2272);</p>
2273<h4 class="parameters">Parameters</h4>
2274<dl>
2275<dt>language</dt>
2276<dd class="description">Language or locale</dd>
2277</dl>
2278<h4 class="returnvalue">Return Value</h4>
2279<p class="description">Language data</p>
5a9febac
MS
2280<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsLocalizeDestOption">cupsLocalizeDestOption</a></h3>
2281<p class="description">Get the localized string for a destination
2282option.</p>
2283<p class="code">
2284const char *cupsLocalizeDestOption (<br>
2285&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2286&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
2287&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
2288&nbsp;&nbsp;&nbsp;&nbsp;const char *option<br>
2289);</p>
2290<h4 class="parameters">Parameters</h4>
2291<dl>
2292<dt>http</dt>
2293<dd class="description">Connection to destination</dd>
2294<dt>dest</dt>
2295<dd class="description">Destination</dd>
2296<dt>dinfo</dt>
2297<dd class="description">Destination information</dd>
2298<dt>option</dt>
2299<dd class="description">Option to localize</dd>
2300</dl>
2301<h4 class="returnvalue">Return Value</h4>
2302<p class="description">Localized string</p>
2303<h4 class="discussion">Discussion</h4>
2304<p class="discussion">The returned string is stored in the destination information and will become
2305invalid if the destination information is deleted.
2306
2307</p>
2308<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsLocalizeDestValue">cupsLocalizeDestValue</a></h3>
2309<p class="description">Get the localized string for a destination
2310option+value pair.</p>
2311<p class="code">
2312const char *cupsLocalizeDestValue (<br>
2313&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2314&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
2315&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
2316&nbsp;&nbsp;&nbsp;&nbsp;const char *option,<br>
2317&nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
2318);</p>
2319<h4 class="parameters">Parameters</h4>
2320<dl>
2321<dt>http</dt>
2322<dd class="description">Connection to destination</dd>
2323<dt>dest</dt>
2324<dd class="description">Destination</dd>
2325<dt>dinfo</dt>
2326<dd class="description">Destination information</dd>
2327<dt>option</dt>
2328<dd class="description">Option to localize</dd>
2329<dt>value</dt>
2330<dd class="description">Value to localize</dd>
2331</dl>
2332<h4 class="returnvalue">Return Value</h4>
2333<p class="description">Localized string</p>
2334<h4 class="discussion">Discussion</h4>
2335<p class="discussion">The returned string is stored in the destination information and will become
2336invalid if the destination information is deleted.
2337
2338</p>
f3c17241 2339<h3 class="function"><span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span><a name="cupsNotifySubject">cupsNotifySubject</a></h3>
5a738aea
MS
2340<p class="description">Return the subject for the given notification message.</p>
2341<p class="code">
2342char *cupsNotifySubject (<br>
2343&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
2344&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
2345);</p>
2346<h4 class="parameters">Parameters</h4>
2347<dl>
2348<dt>lang</dt>
2349<dd class="description">Language data</dd>
2350<dt>event</dt>
2351<dd class="description">Event data</dd>
2352</dl>
2353<h4 class="returnvalue">Return Value</h4>
2354<p class="description">Subject string or <code>NULL</code></p>
2355<h4 class="discussion">Discussion</h4>
568fa3fa 2356<p class="discussion">The returned string must be freed by the caller using <code>free</code>.
5a738aea
MS
2357
2358</p>
f3c17241 2359<h3 class="function"><span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span><a name="cupsNotifyText">cupsNotifyText</a></h3>
5a738aea
MS
2360<p class="description">Return the text for the given notification message.</p>
2361<p class="code">
2362char *cupsNotifyText (<br>
2363&nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
2364&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
2365);</p>
2366<h4 class="parameters">Parameters</h4>
2367<dl>
2368<dt>lang</dt>
2369<dd class="description">Language data</dd>
2370<dt>event</dt>
2371<dd class="description">Event data</dd>
2372</dl>
2373<h4 class="returnvalue">Return Value</h4>
2374<p class="description">Message text or <code>NULL</code></p>
2375<h4 class="discussion">Discussion</h4>
2376<p class="discussion">The returned string must be freed by the caller using <code>free</code>.
2377
2378</p>
2379<h3 class="function"><a name="cupsParseOptions">cupsParseOptions</a></h3>
2380<p class="description">Parse options from a command-line argument.</p>
2381<p class="code">
2382int cupsParseOptions (<br>
2383&nbsp;&nbsp;&nbsp;&nbsp;const char *arg,<br>
2384&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2385&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
2386);</p>
2387<h4 class="parameters">Parameters</h4>
2388<dl>
2389<dt>arg</dt>
2390<dd class="description">Argument to parse</dd>
2391<dt>num_options</dt>
2392<dd class="description">Number of options</dd>
2393<dt>options</dt>
2394<dd class="description">Options found</dd>
2395</dl>
2396<h4 class="returnvalue">Return Value</h4>
2397<p class="description">Number of options found</p>
2398<h4 class="discussion">Discussion</h4>
2399<p class="discussion">This function converts space-delimited name/value pairs according
ef416fc2 2400to the PAPI text option ABNF specification. Collection values
2401(&quot;name={a=... b=... c=...}&quot;) are stored with the curley brackets
5a738aea
MS
2402intact - use <code>cupsParseOptions</code> on the value to extract the
2403collection attributes.</p>
2404<h3 class="function"><a name="cupsPrintFile">cupsPrintFile</a></h3>
2405<p class="description">Print a file to a printer or class on the default server.</p>
2406<p class="code">
2407int cupsPrintFile (<br>
2408&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2409&nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
2410&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
2411&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2412&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
2413);</p>
2414<h4 class="parameters">Parameters</h4>
2415<dl>
2416<dt>name</dt>
568fa3fa 2417<dd class="description">Destination name</dd>
5a738aea
MS
2418<dt>filename</dt>
2419<dd class="description">File to print</dd>
2420<dt>title</dt>
2421<dd class="description">Title of job</dd>
2422<dt>num_options</dt>
2423<dd class="description">Number of options</dd>
2424<dt>options</dt>
2425<dd class="description">Options</dd>
2426</dl>
2427<h4 class="returnvalue">Return Value</h4>
2428<p class="description">Job ID or 0 on error</p>
f3c17241 2429<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsPrintFile2">cupsPrintFile2</a></h3>
5a738aea
MS
2430<p class="description">Print a file to a printer or class on the specified
2431server.</p>
2432<p class="code">
2433int cupsPrintFile2 (<br>
2434&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2435&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2436&nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
2437&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
2438&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2439&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
2440);</p>
2441<h4 class="parameters">Parameters</h4>
2442<dl>
2443<dt>http</dt>
568fa3fa 2444<dd class="description">Connection to server</dd>
5a738aea 2445<dt>name</dt>
568fa3fa 2446<dd class="description">Destination name</dd>
5a738aea
MS
2447<dt>filename</dt>
2448<dd class="description">File to print</dd>
2449<dt>title</dt>
2450<dd class="description">Title of job</dd>
2451<dt>num_options</dt>
2452<dd class="description">Number of options</dd>
2453<dt>options</dt>
2454<dd class="description">Options</dd>
2455</dl>
2456<h4 class="returnvalue">Return Value</h4>
2457<p class="description">Job ID or 0 on error</p>
2458<h3 class="function"><a name="cupsPrintFiles">cupsPrintFiles</a></h3>
2459<p class="description">Print one or more files to a printer or class on the
2460default server.</p>
2461<p class="code">
2462int cupsPrintFiles (<br>
2463&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2464&nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
2465&nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
2466&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
2467&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2468&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
2469);</p>
2470<h4 class="parameters">Parameters</h4>
2471<dl>
2472<dt>name</dt>
568fa3fa 2473<dd class="description">Destination name</dd>
5a738aea
MS
2474<dt>num_files</dt>
2475<dd class="description">Number of files</dd>
2476<dt>files</dt>
2477<dd class="description">File(s) to print</dd>
2478<dt>title</dt>
2479<dd class="description">Title of job</dd>
2480<dt>num_options</dt>
2481<dd class="description">Number of options</dd>
2482<dt>options</dt>
2483<dd class="description">Options</dd>
2484</dl>
2485<h4 class="returnvalue">Return Value</h4>
2486<p class="description">Job ID or 0 on error</p>
f3c17241 2487<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsPrintFiles2">cupsPrintFiles2</a></h3>
5a738aea
MS
2488<p class="description">Print one or more files to a printer or class on the
2489specified server.</p>
2490<p class="code">
2491int cupsPrintFiles2 (<br>
2492&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2493&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2494&nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
2495&nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
2496&nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
2497&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2498&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
2499);</p>
2500<h4 class="parameters">Parameters</h4>
2501<dl>
2502<dt>http</dt>
568fa3fa 2503<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 2504<dt>name</dt>
568fa3fa 2505<dd class="description">Destination name</dd>
5a738aea
MS
2506<dt>num_files</dt>
2507<dd class="description">Number of files</dd>
2508<dt>files</dt>
2509<dd class="description">File(s) to print</dd>
2510<dt>title</dt>
2511<dd class="description">Title of job</dd>
2512<dt>num_options</dt>
2513<dd class="description">Number of options</dd>
2514<dt>options</dt>
2515<dd class="description">Options</dd>
2516</dl>
2517<h4 class="returnvalue">Return Value</h4>
2518<p class="description">Job ID or 0 on error</p>
f3c17241 2519<h3 class="function"><span class="info">&nbsp;CUPS 1.3/OS X 10.5&nbsp;</span><a name="cupsRemoveDest">cupsRemoveDest</a></h3>
5a738aea
MS
2520<p class="description">Remove a destination from the destination list.</p>
2521<p class="code">
2522int cupsRemoveDest (<br>
2523&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2524&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
2525&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2526&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
2527);</p>
2528<h4 class="parameters">Parameters</h4>
2529<dl>
2530<dt>name</dt>
2531<dd class="description">Destination name</dd>
2532<dt>instance</dt>
2533<dd class="description">Instance name or <code>NULL</code></dd>
2534<dt>num_dests</dt>
2535<dd class="description">Number of destinations</dd>
2536<dt>dests</dt>
2537<dd class="description">Destinations</dd>
2538</dl>
2539<h4 class="returnvalue">Return Value</h4>
2540<p class="description">New number of destinations</p>
2541<h4 class="discussion">Discussion</h4>
2542<p class="discussion">Removing a destination/instance does not delete the class or printer
f7deaa1a 2543queue, merely the lpoptions for that destination/instance. Use the
5a738aea
MS
2544<a href="#cupsSetDests"><code>cupsSetDests</code></a> or <a href="#cupsSetDests2"><code>cupsSetDests2</code></a> functions to save the new
2545options for the user.
2546
2547</p>
f3c17241 2548<h3 class="function"><span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span><a name="cupsRemoveOption">cupsRemoveOption</a></h3>
5a738aea
MS
2549<p class="description">Remove an option from an option array.</p>
2550<p class="code">
2551int cupsRemoveOption (<br>
2552&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2553&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2554&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
2555);</p>
2556<h4 class="parameters">Parameters</h4>
2557<dl>
2558<dt>name</dt>
2559<dd class="description">Option name</dd>
2560<dt>num_options</dt>
2561<dd class="description">Current number of options</dd>
2562<dt>options</dt>
2563<dd class="description">Options</dd>
2564</dl>
2565<h4 class="returnvalue">Return Value</h4>
2566<p class="description">New number of options</p>
2567<h3 class="function"><a name="cupsServer">cupsServer</a></h3>
aaf19ab0 2568<p class="description">Return the hostname/address of the current server.</p>
5a738aea
MS
2569<p class="code">
2570const char *cupsServer (void);</p>
2571<h4 class="returnvalue">Return Value</h4>
2572<p class="description">Server name</p>
2573<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2574<p class="discussion">The default server comes from the CUPS_SERVER environment variable, then the
2575~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
2576set, the default is the local system - either &quot;localhost&quot; or a domain socket
2577path.<br>
2578<br>
2579The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
2580address, or a domain socket pathname.<br>
2581<br>
2582Note: The current server is tracked separately for each thread in a program.
2583Multi-threaded programs that override the server via the
2584<a href="#cupsSetServer"><code>cupsSetServer</code></a> function need to do so in each thread for the same
2585server to be used.</p>
f3c17241 2586<h3 class="function"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cupsSetClientCertCB">cupsSetClientCertCB</a></h3>
10d09e33
MS
2587<p class="description">Set the client certificate callback.</p>
2588<p class="code">
2589void cupsSetClientCertCB (<br>
2590&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_client_cert_cb_t">cups_client_cert_cb_t</a> cb,<br>
2591&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
2592);</p>
2593<h4 class="parameters">Parameters</h4>
2594<dl>
2595<dt>cb</dt>
2596<dd class="description">Callback function</dd>
2597<dt>user_data</dt>
2598<dd class="description">User data pointer</dd>
2599</dl>
2600<h4 class="discussion">Discussion</h4>
2601<p class="discussion">Pass <code>NULL</code> to restore the default callback.<br>
2602<br>
2603Note: The current certificate callback is tracked separately for each thread
2604in a program. Multi-threaded programs that override the callback need to do
2605so in each thread for the same callback to be used.
2606
2607</p>
f3c17241 2608<h3 class="function"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cupsSetCredentials">cupsSetCredentials</a></h3>
10d09e33
MS
2609<p class="description">Set the default credentials to be used for SSL/TLS
2610connections.</p>
2611<p class="code">
2612int cupsSetCredentials (<br>
2613&nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *credentials<br>
2614);</p>
2615<h4 class="parameters">Parameters</h4>
2616<dl>
2617<dt>credentials</dt>
2618<dd class="description">Array of credentials</dd>
2619</dl>
2620<h4 class="returnvalue">Return Value</h4>
2621<p class="description">Status of call (0 = success)</p>
2622<h4 class="discussion">Discussion</h4>
2623<p class="discussion">Note: The default credentials are tracked separately for each thread in a
2624program. Multi-threaded programs that override the setting need to do so in
2625each thread for the same setting to be used.
2626
2627</p>
f3c17241 2628<h3 class="function"><span class="info">&nbsp;CUPS 1.3/OS X 10.5&nbsp;</span><a name="cupsSetDefaultDest">cupsSetDefaultDest</a></h3>
5a738aea
MS
2629<p class="description">Set the default destination.</p>
2630<p class="code">
2631void cupsSetDefaultDest (<br>
2632&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2633&nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
2634&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2635&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2636);</p>
2637<h4 class="parameters">Parameters</h4>
2638<dl>
2639<dt>name</dt>
2640<dd class="description">Destination name</dd>
2641<dt>instance</dt>
2642<dd class="description">Instance name or <code>NULL</code></dd>
2643<dt>num_dests</dt>
2644<dd class="description">Number of destinations</dd>
2645<dt>dests</dt>
2646<dd class="description">Destinations</dd>
2647</dl>
2648<h3 class="function"><a name="cupsSetDests">cupsSetDests</a></h3>
2649<p class="description">Save the list of destinations for the default server.</p>
2650<p class="code">
2651void cupsSetDests (<br>
2652&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2653&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2654);</p>
2655<h4 class="parameters">Parameters</h4>
2656<dl>
2657<dt>num_dests</dt>
2658<dd class="description">Number of destinations</dd>
2659<dt>dests</dt>
2660<dd class="description">Destinations</dd>
2661</dl>
2662<h4 class="discussion">Discussion</h4>
2663<p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
2664as root and ~/.cups/lpoptions when run as a normal user.</p>
f3c17241 2665<h3 class="function"><span class="info">&nbsp;CUPS 1.1.21/OS X 10.4&nbsp;</span><a name="cupsSetDests2">cupsSetDests2</a></h3>
5a738aea
MS
2666<p class="description">Save the list of destinations for the specified server.</p>
2667<p class="code">
2668int cupsSetDests2 (<br>
2669&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2670&nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
2671&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
2672);</p>
2673<h4 class="parameters">Parameters</h4>
2674<dl>
2675<dt>http</dt>
568fa3fa 2676<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea
MS
2677<dt>num_dests</dt>
2678<dd class="description">Number of destinations</dd>
2679<dt>dests</dt>
2680<dd class="description">Destinations</dd>
2681</dl>
2682<h4 class="returnvalue">Return Value</h4>
2683<p class="description">0 on success, -1 on error</p>
2684<h4 class="discussion">Discussion</h4>
2685<p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
80ca4592 2686as root and ~/.cups/lpoptions when run as a normal user.
ef416fc2 2687
5a738aea
MS
2688</p>
2689<h3 class="function"><a name="cupsSetEncryption">cupsSetEncryption</a></h3>
2690<p class="description">Set the encryption preference.</p>
2691<p class="code">
2692void cupsSetEncryption (<br>
2693&nbsp;&nbsp;&nbsp;&nbsp;http_encryption_t e<br>
2694);</p>
2695<h4 class="parameters">Parameters</h4>
2696<dl>
2697<dt>e</dt>
2698<dd class="description">New encryption preference</dd>
2699</dl>
aaf19ab0
MS
2700<h4 class="discussion">Discussion</h4>
2701<p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
2702environment variable, then the ~/.cups/client.conf file, and finally the
2703/etc/cups/client.conf file. If not set, the default is
2704<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
2705<br>
2706Note: The current encryption setting is tracked separately for each thread
2707in a program. Multi-threaded programs that override the setting need to do
2708so in each thread for the same setting to be used.</p>
5a738aea
MS
2709<h3 class="function"><a name="cupsSetPasswordCB">cupsSetPasswordCB</a></h3>
2710<p class="description">Set the password callback for CUPS.</p>
2711<p class="code">
2712void cupsSetPasswordCB (<br>
2713&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_password_cb_t">cups_password_cb_t</a> cb<br>
2714);</p>
2715<h4 class="parameters">Parameters</h4>
2716<dl>
2717<dt>cb</dt>
2718<dd class="description">Callback function</dd>
2719</dl>
2720<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2721<p class="discussion">Pass <code>NULL</code> to restore the default (console) password callback, which
2722reads the password from the console. Programs should call either this
2723function or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a>, as only one callback can be registered
2724by a program per thread.<br>
2725<br>
2726Note: The current password callback is tracked separately for each thread
2727in a program. Multi-threaded programs that override the callback need to do
2728so in each thread for the same callback to be used.</p>
f3c17241 2729<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsSetPasswordCB2">cupsSetPasswordCB2</a></h3>
f11a948a
MS
2730<p class="description">Set the advanced password callback for CUPS.</p>
2731<p class="code">
2732void cupsSetPasswordCB2 (<br>
2733&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_password_cb2_t">cups_password_cb2_t</a> cb,<br>
2734&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
2735);</p>
2736<h4 class="parameters">Parameters</h4>
2737<dl>
2738<dt>cb</dt>
2739<dd class="description">Callback function</dd>
2740<dt>user_data</dt>
2741<dd class="description">User data pointer</dd>
2742</dl>
2743<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2744<p class="discussion">Pass <code>NULL</code> to restore the default (console) password callback, which
2745reads the password from the console. Programs should call either this
2746function or <a href="#cupsSetPasswordCB2"><code>cupsSetPasswordCB2</code></a>, as only one callback can be registered
2747by a program per thread.<br>
2748<br>
2749Note: The current password callback is tracked separately for each thread
2750in a program. Multi-threaded programs that override the callback need to do
2751so in each thread for the same callback to be used.
f11a948a
MS
2752
2753</p>
5a738aea 2754<h3 class="function"><a name="cupsSetServer">cupsSetServer</a></h3>
aaf19ab0 2755<p class="description">Set the default server name and port.</p>
5a738aea
MS
2756<p class="code">
2757void cupsSetServer (<br>
2758&nbsp;&nbsp;&nbsp;&nbsp;const char *server<br>
2759);</p>
2760<h4 class="parameters">Parameters</h4>
2761<dl>
2762<dt>server</dt>
2763<dd class="description">Server name</dd>
2764</dl>
2765<h4 class="discussion">Discussion</h4>
2766<p class="discussion">The &quot;server&quot; string can be a fully-qualified hostname, a numeric
aaf19ab0
MS
2767IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
2768addresses can be optionally followed by a colon and port number to override
2769the default port 631, e.g. &quot;hostname:8631&quot;. Pass <code>NULL</code> to restore the
2770default server name and port.<br>
2771<br>
2772Note: The current server is tracked separately for each thread in a program.
2773Multi-threaded programs that override the server need to do so in each
2774thread for the same server to be used.</p>
f3c17241 2775<h3 class="function"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cupsSetServerCertCB">cupsSetServerCertCB</a></h3>
10d09e33
MS
2776<p class="description">Set the server certificate callback.</p>
2777<p class="code">
2778void cupsSetServerCertCB (<br>
2779&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_server_cert_cb_t">cups_server_cert_cb_t</a> cb,<br>
2780&nbsp;&nbsp;&nbsp;&nbsp;void *user_data<br>
2781);</p>
2782<h4 class="parameters">Parameters</h4>
2783<dl>
2784<dt>cb</dt>
2785<dd class="description">Callback function</dd>
2786<dt>user_data</dt>
2787<dd class="description">User data pointer</dd>
2788</dl>
2789<h4 class="discussion">Discussion</h4>
2790<p class="discussion">Pass <code>NULL</code> to restore the default callback.<br>
2791<br>
2792Note: The current credentials callback is tracked separately for each thread
2793in a program. Multi-threaded programs that override the callback need to do
2794so in each thread for the same callback to be used.
2795
2796</p>
5a738aea
MS
2797<h3 class="function"><a name="cupsSetUser">cupsSetUser</a></h3>
2798<p class="description">Set the default user name.</p>
2799<p class="code">
2800void cupsSetUser (<br>
2801&nbsp;&nbsp;&nbsp;&nbsp;const char *user<br>
2802);</p>
2803<h4 class="parameters">Parameters</h4>
2804<dl>
2805<dt>user</dt>
2806<dd class="description">User name</dd>
2807</dl>
2808<h4 class="discussion">Discussion</h4>
aaf19ab0
MS
2809<p class="discussion">Pass <code>NULL</code> to restore the default user name.<br>
2810<br>
2811Note: The current user name is tracked separately for each thread in a
2812program. Multi-threaded programs that override the user name need to do so
2813in each thread for the same user name to be used.</p>
5a9febac
MS
2814<h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsStartDestDocument">cupsStartDestDocument</a></h3>
2815<p class="description">Start a new document.</p>
2816<p class="code">
2817http_status_t cupsStartDestDocument (<br>
2818&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2819&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
2820&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *info,<br>
2821&nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
2822&nbsp;&nbsp;&nbsp;&nbsp;const char *docname,<br>
2823&nbsp;&nbsp;&nbsp;&nbsp;const char *format,<br>
2824&nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
2825&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options,<br>
2826&nbsp;&nbsp;&nbsp;&nbsp;int last_document<br>
2827);</p>
2828<h4 class="parameters">Parameters</h4>
2829<dl>
2830<dt>http</dt>
2831<dd class="description">Connection to destination</dd>
2832<dt>dest</dt>
2833<dd class="description">Destination</dd>
2834<dt>info</dt>
2835<dd class="description">Destination information</dd>
2836<dt>job_id</dt>
2837<dd class="description">Job ID</dd>
2838<dt>docname</dt>
2839<dd class="description">Document name</dd>
2840<dt>format</dt>
2841<dd class="description">Document format</dd>
2842<dt>num_options</dt>
2843<dd class="description">Number of document options</dd>
2844<dt>options</dt>
2845<dd class="description">Document options</dd>
2846<dt>last_document</dt>
2847<dd class="description">1 if this is the last document</dd>
2848</dl>
2849<h4 class="returnvalue">Return Value</h4>
2850<p class="description">Status of document creation</p>
2851<h4 class="discussion">Discussion</h4>
2852<p class="discussion">&quot;job_id&quot; is the job ID returned by cupsCreateDestJob. &quot;docname&quot; is the name
2853of the document/file being printed, &quot;format&quot; is the MIME media type for the
2854document (see CUPS_FORMAT_xxx constants), and &quot;num_options&quot; and &quot;options&quot;
2855are the options do be applied to the document. &quot;last_document&quot; should be 1
2856if this is the last document to be submitted in the job. Returns
2857<code>HTTP_CONTINUE</code> on success.
2858
2859</p>
f3c17241 2860<h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsStartDocument">cupsStartDocument</a></h3>
5a738aea
MS
2861<p class="description">Add a document to a job created with cupsCreateJob().</p>
2862<p class="code">
2863http_status_t cupsStartDocument (<br>
2864&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
2865&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
2866&nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
2867&nbsp;&nbsp;&nbsp;&nbsp;const char *docname,<br>
2868&nbsp;&nbsp;&nbsp;&nbsp;const char *format,<br>
2869&nbsp;&nbsp;&nbsp;&nbsp;int last_document<br>
2870);</p>
2871<h4 class="parameters">Parameters</h4>
2872<dl>
2873<dt>http</dt>
568fa3fa 2874<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
5a738aea 2875<dt>name</dt>
568fa3fa 2876<dd class="description">Destination name</dd>
5a738aea
MS
2877<dt>job_id</dt>
2878<dd class="description">Job ID from <a href="#cupsCreateJob"><code>cupsCreateJob</code></a></dd>
2879<dt>docname</dt>
2880<dd class="description">Name of document</dd>
2881<dt>format</dt>
2882<dd class="description">MIME type or <code>CUPS_FORMAT_foo</code></dd>
2883<dt>last_document</dt>
2884<dd class="description">1 for last document in job, 0 otherwise</dd>
2885</dl>
2886<h4 class="returnvalue">Return Value</h4>
2887<p class="description">HTTP status of request</p>
2888<h4 class="discussion">Discussion</h4>
2889<p class="discussion">Use <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a> to write data for the document and
2890<a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> to finish the document and get the submission status.<br>
2891<br>
2892The MIME type constants <code>CUPS_FORMAT_AUTO</code>, <code>CUPS_FORMAT_PDF</code>,
2893<code>CUPS_FORMAT_POSTSCRIPT</code>, <code>CUPS_FORMAT_RAW</code>, and
2894<code>CUPS_FORMAT_TEXT</code> are provided for the &quot;format&quot; argument, although
2895any supported MIME type string can be supplied.
bc44d920 2896
5a738aea
MS
2897</p>
2898<h3 class="function"><a name="cupsTempFd">cupsTempFd</a></h3>
2899<p class="description">Creates a temporary file.</p>
2900<p class="code">
2901int cupsTempFd (<br>
2902&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2903&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2904);</p>
2905<h4 class="parameters">Parameters</h4>
2906<dl>
2907<dt>filename</dt>
2908<dd class="description">Pointer to buffer</dd>
2909<dt>len</dt>
2910<dd class="description">Size of buffer</dd>
2911</dl>
2912<h4 class="returnvalue">Return Value</h4>
2913<p class="description">New file descriptor or -1 on error</p>
2914<h4 class="discussion">Discussion</h4>
2915<p class="discussion">The temporary filename is returned in the filename buffer.
2916The temporary file is opened for reading and writing.</p>
2917<h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsTempFile">cupsTempFile</a></h3>
2918<p class="description">Generates a temporary filename.</p>
2919<p class="code">
2920char *cupsTempFile (<br>
2921&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2922&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2923);</p>
2924<h4 class="parameters">Parameters</h4>
2925<dl>
2926<dt>filename</dt>
2927<dd class="description">Pointer to buffer</dd>
2928<dt>len</dt>
2929<dd class="description">Size of buffer</dd>
2930</dl>
2931<h4 class="returnvalue">Return Value</h4>
568fa3fa 2932<p class="description">Filename or <code>NULL</code> on error</p>
5a738aea
MS
2933<h4 class="discussion">Discussion</h4>
2934<p class="discussion">The temporary filename is returned in the filename buffer.
2935This function is deprecated - use <a href="#cupsTempFd"><code>cupsTempFd</code></a> or
2936<a href="#cupsTempFile2"><code>cupsTempFile2</code></a> instead.
ef416fc2 2937
5a738aea 2938</p>
f3c17241 2939<h3 class="function"><span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span><a name="cupsTempFile2">cupsTempFile2</a></h3>
5a738aea
MS
2940<p class="description">Creates a temporary CUPS file.</p>
2941<p class="code">
2942cups_file_t *cupsTempFile2 (<br>
2943&nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
2944&nbsp;&nbsp;&nbsp;&nbsp;int len<br>
2945);</p>
2946<h4 class="parameters">Parameters</h4>
2947<dl>
2948<dt>filename</dt>
2949<dd class="description">Pointer to buffer</dd>
2950<dt>len</dt>
2951<dd class="description">Size of buffer</dd>
2952</dl>
2953<h4 class="returnvalue">Return Value</h4>
568fa3fa 2954<p class="description">CUPS file or <code>NULL</code> on error</p>
5a738aea
MS
2955<h4 class="discussion">Discussion</h4>
2956<p class="discussion">The temporary filename is returned in the filename buffer.
2957The temporary file is opened for writing.
bc44d920 2958
5a738aea
MS
2959</p>
2960<h3 class="function"><a name="cupsUser">cupsUser</a></h3>
2961<p class="description">Return the current user's name.</p>
2962<p class="code">
2963const char *cupsUser (void);</p>
2964<h4 class="returnvalue">Return Value</h4>
2965<p class="description">User name</p>
aaf19ab0
MS
2966<h4 class="discussion">Discussion</h4>
2967<p class="discussion">Note: The current user name is tracked separately for each thread in a
2968program. Multi-threaded programs that override the user name with the
2969<a href="#cupsSetUser"><code>cupsSetUser</code></a> function need to do so in each thread for the same user
2970name to be used.</p>
5a738aea 2971<h2 class="title"><a name="TYPES">Data Types</a></h2>
f3c17241 2972<h3 class="typedef"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cups_client_cert_cb_t">cups_client_cert_cb_t</a></h3>
3e7fe0ca
MS
2973<p class="description">Client credentials callback
2974</p>
10d09e33
MS
2975<p class="code">
2976typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
2977</p>
f3c17241 2978<h3 class="typedef"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cups_dest_block_t">cups_dest_block_t</a></h3>
3e7fe0ca
MS
2979<p class="description">Destination enumeration block
2980</p>
2981<p class="code">
2982typedef int (*cups_dest_block_t(unsigned flags, <a href="#cups_dest_t">cups_dest_t</a> *dest);
2983</p>
f3c17241 2984<h3 class="typedef"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cups_dest_cb_t">cups_dest_cb_t</a></h3>
3e7fe0ca
MS
2985<p class="description">Destination enumeration callback
2986</p>
2987<p class="code">
2988typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags, <a href="#cups_dest_t">cups_dest_t</a> *dest);
2989</p>
5a738aea
MS
2990<h3 class="typedef"><a name="cups_dest_t">cups_dest_t</a></h3>
2991<p class="description">Destination</p>
2992<p class="code">
2993typedef struct <a href="#cups_dest_s">cups_dest_s</a> cups_dest_t;
2994</p>
f3c17241 2995<h3 class="typedef"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cups_device_cb_t">cups_device_cb_t</a></h3>
3e7fe0ca
MS
2996<p class="description">Device callback
2997</p>
ae71f5de 2998<p class="code">
06d4e77b 2999typedef 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 3000</p>
f3c17241 3001<h3 class="typedef"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cups_dinfo_t">cups_dinfo_t</a></h3>
3e7fe0ca
MS
3002<p class="description">Destination capability and status
3003information </p>
3004<p class="code">
3005typedef struct _cups_dinfo_s cups_dinfo_t;
3006</p>
5a738aea
MS
3007<h3 class="typedef"><a name="cups_job_t">cups_job_t</a></h3>
3008<p class="description">Job</p>
3009<p class="code">
3010typedef struct <a href="#cups_job_s">cups_job_s</a> cups_job_t;
3011</p>
3012<h3 class="typedef"><a name="cups_option_t">cups_option_t</a></h3>
3013<p class="description">Printer Options</p>
3014<p class="code">
3015typedef struct <a href="#cups_option_s">cups_option_s</a> cups_option_t;
3016</p>
f3c17241 3017<h3 class="typedef"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cups_password_cb2_t">cups_password_cb2_t</a></h3>
3e7fe0ca
MS
3018<p class="description">New password callback
3019</p>
f11a948a
MS
3020<p class="code">
3021typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
3022</p>
5a738aea
MS
3023<h3 class="typedef"><a name="cups_password_cb_t">cups_password_cb_t</a></h3>
3024<p class="description">Password callback</p>
3025<p class="code">
ae71f5de 3026typedef const char *(*cups_password_cb_t)(const char *prompt);
5a738aea
MS
3027</p>
3028<h3 class="typedef"><a name="cups_ptype_t">cups_ptype_t</a></h3>
3029<p class="description">Printer type/capability bits</p>
3030<p class="code">
ef416fc2 3031typedef unsigned cups_ptype_t;
5a738aea 3032</p>
f3c17241 3033<h3 class="typedef"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cups_server_cert_cb_t">cups_server_cert_cb_t</a></h3>
3e7fe0ca
MS
3034<p class="description">Server credentials callback
3035</p>
10d09e33
MS
3036<p class="code">
3037typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
3038</p>
f3c17241 3039<h3 class="typedef"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cups_size_t">cups_size_t</a></h3>
3e7fe0ca
MS
3040<p class="description">Media Size </p>
3041<p class="code">
3042typedef struct <a href="#cups_size_s">cups_size_s</a> cups_size_t;
3043</p>
5a738aea
MS
3044<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
3045<h3 class="struct"><a name="cups_dest_s">cups_dest_s</a></h3>
3046<p class="description">Destination</p>
3047<p class="code">struct cups_dest_s {<br>
3048&nbsp;&nbsp;&nbsp;&nbsp;char *name, *instance;<br>
3049&nbsp;&nbsp;&nbsp;&nbsp;int is_default;<br>
3050&nbsp;&nbsp;&nbsp;&nbsp;int num_options;<br>
3051&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options;<br>
3052};</p>
3053<h4 class="members">Members</h4>
3054<dl>
3055<dt>instance </dt>
3056<dd class="description">Local instance name or NULL</dd>
3057<dt>is_default </dt>
3058<dd class="description">Is this printer the default?</dd>
3059<dt>num_options </dt>
3060<dd class="description">Number of options</dd>
3061<dt>options </dt>
3062<dd class="description">Options</dd>
3063</dl>
3064<h3 class="struct"><a name="cups_job_s">cups_job_s</a></h3>
3065<p class="description">Job</p>
3066<p class="code">struct cups_job_s {<br>
3067&nbsp;&nbsp;&nbsp;&nbsp;time_t completed_time;<br>
3068&nbsp;&nbsp;&nbsp;&nbsp;time_t creation_time;<br>
3069&nbsp;&nbsp;&nbsp;&nbsp;char *dest;<br>
3070&nbsp;&nbsp;&nbsp;&nbsp;char *format;<br>
3071&nbsp;&nbsp;&nbsp;&nbsp;int id;<br>
3072&nbsp;&nbsp;&nbsp;&nbsp;int priority;<br>
3073&nbsp;&nbsp;&nbsp;&nbsp;time_t processing_time;<br>
3074&nbsp;&nbsp;&nbsp;&nbsp;int size;<br>
3075&nbsp;&nbsp;&nbsp;&nbsp;ipp_jstate_t state;<br>
3076&nbsp;&nbsp;&nbsp;&nbsp;char *title;<br>
3077&nbsp;&nbsp;&nbsp;&nbsp;char *user;<br>
3078};</p>
3079<h4 class="members">Members</h4>
3080<dl>
3081<dt>completed_time </dt>
3082<dd class="description">Time the job was completed</dd>
3083<dt>creation_time </dt>
3084<dd class="description">Time the job was created</dd>
3085<dt>dest </dt>
3086<dd class="description">Printer or class name</dd>
3087<dt>format </dt>
3088<dd class="description">Document format</dd>
3089<dt>id </dt>
3090<dd class="description">The job ID</dd>
3091<dt>priority </dt>
3092<dd class="description">Priority (1-100)</dd>
3093<dt>processing_time </dt>
3094<dd class="description">Time the job was processed</dd>
3095<dt>size </dt>
3096<dd class="description">Size in kilobytes</dd>
3097<dt>state </dt>
3098<dd class="description">Job state</dd>
3099<dt>title </dt>
3100<dd class="description">Title/job name</dd>
3101<dt>user </dt>
3102<dd class="description">User the submitted the job</dd>
3103</dl>
3104<h3 class="struct"><a name="cups_option_s">cups_option_s</a></h3>
3105<p class="description">Printer Options</p>
3106<p class="code">struct cups_option_s {<br>
3107&nbsp;&nbsp;&nbsp;&nbsp;char *name;<br>
3108&nbsp;&nbsp;&nbsp;&nbsp;char *value;<br>
3109};</p>
3110<h4 class="members">Members</h4>
3111<dl>
3112<dt>name </dt>
3113<dd class="description">Name of option</dd>
3114<dt>value </dt>
3115<dd class="description">Value of option</dd>
3116</dl>
f3c17241 3117<h3 class="struct"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cups_size_s">cups_size_s</a></h3>
3e7fe0ca
MS
3118<p class="description">Media Size </p>
3119<p class="code">struct cups_size_s {<br>
3120&nbsp;&nbsp;&nbsp;&nbsp;char media[128];<br>
3121&nbsp;&nbsp;&nbsp;&nbsp;int width, length, bottom, left, right, top;<br>
3122};</p>
3123<h4 class="members">Members</h4>
3124<dl>
3125<dt>media[128] </dt>
3126<dd class="description">Media name to use</dd>
3127<dt>top </dt>
3128<dd class="description">Top margin in hundredths of
3129millimeters</dd>
3130</dl>
a29fd7dd
MS
3131<h3 class="struct"><a name="pollfd">pollfd</a></h3>
3132<p class="description">User data (unused)</p>
3133<p class="code">struct pollfd *pollfds, unsigned int num_pollfds, int timeout, void *context) {<br>
3134&nbsp;&nbsp;&nbsp;&nbsp;_cups_dnssd_data_t *data;<br>
3135&nbsp;&nbsp;&nbsp;&nbsp;else if(val 0) data - got_data;<br>
3136&nbsp;&nbsp;&nbsp;&nbsp;void) timeout;<br>
3137&nbsp;&nbsp;&nbsp;&nbsp;int val;<br>
3138};</p>
3139<h4 class="members">Members</h4>
3140<dl>
3141<dt>data </dt>
3142<dd class="description">Enumeration data</dd>
3143<dt>got_data </dt>
3144<dt>timeout </dt>
3145<dt>val </dt>
3146<dd class="description">Return value</dd>
3147</dl>
22c9029b
MS
3148<h2 class="title"><a name="VARIABLES">Variables</a></h2>
3149<h3 class="variable"><a name="CF_RETURNS_RETAINED">CF_RETURNS_RETAINED</a></h3>
3150<p class="description">Get the Apple language identifier associated with a
3151locale ID.</p>
3152<p class="code">const char *locale) CF_RETURNS_RETAINED;</p>
5a738aea
MS
3153<h2 class="title"><a name="ENUMERATIONS">Constants</a></h2>
3154<h3 class="enumeration"><a name="cups_ptype_e">cups_ptype_e</a></h3>
3e7fe0ca
MS
3155<p class="description">Printer type/capability bit
3156constants</p>
5a738aea
MS
3157<h4 class="constants">Constants</h4>
3158<dl>
f3c17241 3159<dt>CUPS_PRINTER_AUTHENTICATED <span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span></dt>
3e7fe0ca
MS
3160<dd class="description">Printer requires authentication
3161</dd>
5a738aea
MS
3162<dt>CUPS_PRINTER_BIND </dt>
3163<dd class="description">Can bind output</dd>
3164<dt>CUPS_PRINTER_BW </dt>
3165<dd class="description">Can do B&amp;W printing</dd>
3166<dt>CUPS_PRINTER_CLASS </dt>
3167<dd class="description">Printer class</dd>
3168<dt>CUPS_PRINTER_COLLATE </dt>
3169<dd class="description">Can collage copies</dd>
3170<dt>CUPS_PRINTER_COLOR </dt>
3171<dd class="description">Can do color printing</dd>
f3c17241 3172<dt>CUPS_PRINTER_COMMANDS <span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span></dt>
3e7fe0ca
MS
3173<dd class="description">Printer supports maintenance commands
3174</dd>
5a738aea
MS
3175<dt>CUPS_PRINTER_COPIES </dt>
3176<dd class="description">Can do copies</dd>
3177<dt>CUPS_PRINTER_COVER </dt>
3178<dd class="description">Can cover output</dd>
3179<dt>CUPS_PRINTER_DEFAULT </dt>
3180<dd class="description">Default printer on network</dd>
f3c17241 3181<dt>CUPS_PRINTER_DELETE <span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span></dt>
3e7fe0ca
MS
3182<dd class="description">Delete printer
3183</dd>
5a738aea
MS
3184<dt>CUPS_PRINTER_DUPLEX </dt>
3185<dd class="description">Can do duplexing</dd>
3186<dt>CUPS_PRINTER_FAX </dt>
3187<dd class="description">Fax queue</dd>
5a738aea
MS
3188<dt>CUPS_PRINTER_LARGE </dt>
3189<dd class="description">Can do D/E/A1/A0</dd>
3190<dt>CUPS_PRINTER_LOCAL </dt>
3191<dd class="description">Local printer or class</dd>
3192<dt>CUPS_PRINTER_MEDIUM </dt>
3193<dd class="description">Can do Tabloid/B/C/A3/A2</dd>
f3c17241 3194<dt>CUPS_PRINTER_MFP <span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span></dt>
3e7fe0ca
MS
3195<dd class="description">Printer with scanning capabilities
3196</dd>
f3c17241 3197<dt>CUPS_PRINTER_NOT_SHARED <span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span></dt>
3e7fe0ca
MS
3198<dd class="description">Printer is not shared
3199</dd>
5a738aea
MS
3200<dt>CUPS_PRINTER_PUNCH </dt>
3201<dd class="description">Can punch output</dd>
3202<dt>CUPS_PRINTER_REJECTING </dt>
3203<dd class="description">Printer is rejecting jobs</dd>
3204<dt>CUPS_PRINTER_REMOTE </dt>
3205<dd class="description">Remote printer or class</dd>
f3c17241 3206<dt>CUPS_PRINTER_SCANNER <span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span></dt>
3e7fe0ca
MS
3207<dd class="description">Scanner-only device
3208</dd>
5a738aea
MS
3209<dt>CUPS_PRINTER_SMALL </dt>
3210<dd class="description">Can do Letter/Legal/A4</dd>
3211<dt>CUPS_PRINTER_SORT </dt>
3212<dd class="description">Can sort output</dd>
3213<dt>CUPS_PRINTER_STAPLE </dt>
3214<dd class="description">Can staple output</dd>
3215<dt>CUPS_PRINTER_VARIABLE </dt>
3216<dd class="description">Can do variable sizes</dd>
3217</dl>
3218</div>
ef416fc2 3219</body>
3220</html>